[U-Boot] [PATCH v3 17/25] rockchip: rk3288: Add pinctrl driver

Masahiro Yamada yamada.masahiro at socionext.com
Mon Jul 6 19:24:03 CEST 2015


Hi Simon,


2015-06-24 8:29 GMT+09:00 Simon Glass <sjg at chromium.org>:

> +
> +static int rk3288_pinctrl_get_periph_id(struct udevice *dev,
> +                                       struct udevice *periph)
> +{
> +       u32 cell[3];
> +       int ret;
> +
> +       ret = fdtdec_get_int_array(gd->fdt_blob, periph->of_offset,
> +                                  "interrupts", cell, ARRAY_SIZE(cell));
> +       if (ret < 0)
> +               return -EINVAL;
> +
> +       switch (cell[1]) {
> +       case 44:
> +               return PERIPH_ID_SPI0;
> +       case 45:
> +               return PERIPH_ID_SPI1;
> +       case 46:
> +               return PERIPH_ID_SPI2;
> +       case 60:
> +               return PERIPH_ID_I2C0;
> +       case 62: /* Note strange order */
> +               return PERIPH_ID_I2C1;
> +       case 61:
> +               return PERIPH_ID_I2C2;
> +       case 63:
> +               return PERIPH_ID_I2C3;
> +       case 64:
> +               return PERIPH_ID_I2C4;
> +       case 65:
> +               return PERIPH_ID_I2C5;
> +       }
> +
> +       return -ENOENT;
> +}

Weird.

Do you parse the "interrupts" property
to identify the peripheral?

This is what I really do not like to do.



-- 
Best Regards
Masahiro Yamada


More information about the U-Boot mailing list