[U-Boot] [PATCH v3] nios2 : convert altera_pio to driver model

Simon Glass sjg at chromium.org
Wed Sep 30 20:29:25 CEST 2015


On 26 September 2015 at 03:07, Thomas Chou <thomas at wytron.com.tw> wrote:
> Convert altera_pio to driver model.
>
> Signed-off-by: Thomas Chou <thomas at wytron.com.tw>
> ---
> v2
>   fix ranges of pio in dts
>   fix coding style as Marek suggested.
>
> v3
>   change gpio_count device tree binding.
>
>  arch/nios2/dts/3c120_devboard.dts          |  41 ++++
>  arch/nios2/include/asm/gpio.h              |  80 +-------
>  board/altera/nios2-generic/nios2-generic.c |   7 -
>  configs/nios2-generic_defconfig            |   2 +
>  drivers/gpio/Kconfig                       |   7 +
>  drivers/gpio/altera_pio.c                  | 316 +++++++----------------------
>  include/configs/nios2-generic.h            |  20 --
>  7 files changed, 127 insertions(+), 346 deletions(-)

Reviewed-by: Simon Glass <sjg at chromium.org>

See question below.

[snip]

> -int gpio_direction_output(unsigned gpio, int value)
> +static int altera_pio_ofdata_to_platdata(struct udevice *dev)
>  {
> -       u32 mask;
> -       struct altera_pio *pio;
> +       struct altera_pio_platdata *plat = dev_get_platdata(dev);
>
> -       pio = altera_pio_get_and_mask(gpio, &mask);
> -       if (!pio)
> -               return -1;
> -       if (pio->iot == 'i')
> -               return -1;
> +       plat->regs = ioremap(dev_get_addr(dev),
> +               sizeof(struct altera_pio_regs));

Do we need the ioremap() or can we rely on the 'ranges' handling?

[snip]


More information about the U-Boot mailing list