Subject: Re: [PATCH 2/2] [POWERPC] MPC8349E-mITX: use platform IDE driver for CF interface

From: Scott Wood <[email-masked]>
Date: Wed, 25 Jul 2007 12:29:23 -0500

Vitaly Bordug wrote:
> diff --git a/arch/powerpc/boot/dts/mpc8349emitx.dts b/arch/powerpc/boot/dts/mpc8349emitx.dts
> index db0d003..f8f0e8a 100644
> --- a/arch/powerpc/boot/dts/mpc8349emitx.dts
> +++ b/arch/powerpc/boot/dts/mpc8349emitx.dts
> @@ -37,6 +37,15 @@
>  		reg = <00000000 10000000>;
>  	};
>  
> +	ide@f0000000 {
> +		compatible = "mmio-ide";
> +		device_type = "ide";
> +		reg = <f0000000 10 f000020c 4>;
> +		ioport_shift = <1>;
> +		interrupts = <17 8>;
> +		interrupt-parent = < &ipic >;
> +	};
> +

Is this binding documented anywhere?  If it's a new binding, could we 
use reg-shift instead of ioport_shift?  This is what ns16550 uses, and 
in general dashes are preferable to underscores in device trees 
(device_type is an ugly, historical exception).

> diff --git a/arch/powerpc/platforms/83xx/mpc834x_itx.c b/arch/powerpc/platforms/83xx/mpc834x_itx.c
> index 40a0194..d63a104 100644
> --- a/arch/powerpc/platforms/83xx/mpc834x_itx.c
> +++ b/arch/powerpc/platforms/83xx/mpc834x_itx.c
> @@ -23,6 +23,7 @@
>  #include <linux/delay.h>
>  #include <linux/seq_file.h>
>  #include <linux/root_dev.h>
> +#include <linux/pata_platform.h>
>  
>  #include <asm/system.h>
>  #include <asm/atomic.h>
> @@ -43,6 +44,75 @@ unsigned long isa_io_base = 0;
>  unsigned long isa_mem_base = 0;
>  #endif
>  
> +static int __init mmio_ide_of_init(void)
> +{
> +	struct device_node *np;
> +	unsigned int i;
> +
> +	for (np = NULL, i = 0;
> +	     (np = of_find_compatible_node(np, "ide", "mmio-ide")) != NULL;
> +	     i++) {
> +		int ret = 0;
> +		struct resource res[3];
> +		struct platform_device *pdev = NULL;
> +		static struct pata_platform_info pdata;

We really don't want code like this for every board with an MMIO IDE 
controller.  At the very least, make it a generic function in sysdev; 
better would be to make the driver also support of_platform devices.

-Scott