AT91: Convert WDT driver to be independent of processor base-address

Russell King - ARM Linux linux at arm.linux.org.uk
Wed May 4 17:12:29 EDT 2011


On Fri, Apr 29, 2011 at 10:48:10PM +0200, Andrew Victor wrote:
> @@ -248,11 +250,17 @@ static struct miscdevice at91wdt_miscdev = {
>  
>  static int __init at91wdt_probe(struct platform_device *pdev)
>  {
> +	struct resource	*r;
>  	int res;
>  
> +	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> +	if (!r)
> +		return -ENODEV;
> +
>  	if (at91wdt_miscdev.parent)
>  		return -EBUSY;
>  	at91wdt_miscdev.parent = &pdev->dev;
> +	at91wdt_private.regbase = (void __force __iomem *) r->start;

Passing virtual addresses through iomem resources really isn't nice - they
get added to the resource tree as bus addresses, which actually being
virtual addresses can conflict with real bus addresses.

The proper way to handle this is like every other platform driver, and to
use ioremap() on the resource to obtain a virtual mapping for the device.

If you wish to reuse your fixed io mapping, then override ioremap() in
a similar way to OMAP and arrange for bus addresses in the fixed io
mapping to return an appropriate iomem pointer for those.



More information about the linux-arm-kernel mailing list