[PATCHv3] ata: intf_platform_ide: add OF bindings

Sascha Hauer s.hauer at pengutronix.de
Tue Sep 8 23:54:14 PDT 2015


Hi Peter,

On Mon, Sep 07, 2015 at 07:43:53PM +0300, Peter Mamonov wrote:
> Signed-off-by: Peter Mamonov <pmamonov at gmail.com>
> ---
>  drivers/ata/intf_platform_ide.c | 34 +++++++++++++++++++++++++++++-----
>  1 file changed, 29 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/ata/intf_platform_ide.c b/drivers/ata/intf_platform_ide.c
> index 0d392d8..ab633c0 100644
> --- a/drivers/ata/intf_platform_ide.c
> +++ b/drivers/ata/intf_platform_ide.c
> @@ -29,6 +29,7 @@
>  #include <ata_drive.h>
>  #include <platform_ide.h>
>  #include <linux/err.h>
> +#include <of.h>
>  
>  /**
>   * Setup the register specific addresses for an ATA like divice
> @@ -85,8 +86,22 @@ static int platform_ide_probe(struct device_d *dev)
>  	void *reg_base, *alt_base = NULL;
>  	struct resource *reg, *alt;
>  	int mmio = 0;
> -
> -	if (pdata == NULL) {
> +	struct device_node *dn = dev->device_node;
> +	unsigned ioport_shift = 0;
> +	int dataif_be = 0;
> +	void (*reset)(int) = NULL;
> +
> +	if (pdata) {
> +		ioport_shift = pdata->ioport_shift;
> +		dataif_be = pdata->dataif_be;
> +		reset = pdata->reset;
> +	} else if (dn) {
> +		/* try to get platform data from the device tree */
> +		u32 tmp32;
> +
> +		if (of_property_read_u32(dn, "reg-shift", &tmp32) == 0)
> +			ioport_shift = (unsigned)tmp32;

Applied with one little change. We can simplify this by doing passing
&ioport_shift directly to of_property_read_u32. We do not have to check
the return value then.

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list