[PATCH 4/4] ARM: kirkwood: convert orion-wdt to fdt.
Arnd Bergmann
arnd at arndb.de
Fri Mar 2 06:48:51 EST 2012
On Thursday 01 March 2012, Jason Cooper wrote:
> static int heartbeat = -1; /* module parameter (seconds) */
> static unsigned int wdt_max_duration; /* (seconds) */
> static unsigned int wdt_tclk;
> +static unsigned int wdt_reg;
> static unsigned long wdt_status;
> static DEFINE_SPINLOCK(wdt_lock);
This variable needs to be a 'void __iomem *', not an int.
> + wdt_reg = TIMER_VIRT_BASE;
> +
> + of_property_read_u32(np, "reg", &wdt_reg);
> +
> if (orion_wdt_miscdev.parent)
> return -EBUSY;
> orion_wdt_miscdev.parent = &pdev->dev;
Don't just read a reg property, but use the resource instead and ioremap it.
This driver still uses hardcoded virtual addresses for its registers, which
we're trying to get rid of. The best solution would be to always put the
register address into the platform device resources, either hardcoded for
classic boards or automatic through the device tree.
A reg property is special in that it's not just a number but is relative
to the "ranges" property of the parent device and can be multiple 32 bit
values for the address, which get turned into a CPU physical address using
of_translate_address().
Arnd
More information about the devicetree-discuss
mailing list