Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

clocksource/drivers/ixp4xx: Add OF initialization support

This adds support for setting up the IXP4xx timer driver from
device tree.

Cc: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

+35
+35
drivers/clocksource/timer-ixp4xx.c
··· 16 16 #include <linux/slab.h> 17 17 #include <linux/bitops.h> 18 18 #include <linux/delay.h> 19 + #include <linux/of_address.h> 20 + #include <linux/of_irq.h> 19 21 /* Goes away with OF conversion */ 20 22 #include <linux/platform_data/timer-ixp4xx.h> 21 23 ··· 249 247 ixp4xx_timer_register(base, timer_irq, timer_freq); 250 248 } 251 249 EXPORT_SYMBOL_GPL(ixp4xx_timer_setup); 250 + 251 + #ifdef CONFIG_OF 252 + static __init int ixp4xx_of_timer_init(struct device_node *np) 253 + { 254 + void __iomem *base; 255 + int irq; 256 + int ret; 257 + 258 + base = of_iomap(np, 0); 259 + if (!base) { 260 + pr_crit("IXP4xx: can't remap timer\n"); 261 + return -ENODEV; 262 + } 263 + 264 + irq = irq_of_parse_and_map(np, 0); 265 + if (irq <= 0) { 266 + pr_err("Can't parse IRQ\n"); 267 + ret = -EINVAL; 268 + goto out_unmap; 269 + } 270 + 271 + /* TODO: get some fixed clocks into the device tree */ 272 + ret = ixp4xx_timer_register(base, irq, 66666000); 273 + if (ret) 274 + goto out_unmap; 275 + return 0; 276 + 277 + out_unmap: 278 + iounmap(base); 279 + return ret; 280 + } 281 + TIMER_OF_DECLARE(ixp4xx, "intel,ixp4xx-timer", ixp4xx_of_timer_init); 282 + #endif