[U-Boot] [PATCH v3 17/25] rockchip: rk3288: Add pinctrl driver
Simon Glass
sjg at chromium.org
Mon Jul 6 19:32:48 CEST 2015
Hi Masahiro,
On 6 July 2015 at 11:24, Masahiro Yamada <yamada.masahiro at socionext.com> wrote:
>
> 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.
Yes. It's similar to a clock number. It doesn't really matter what we
use. The interrupt number is a fixed part of the binding and will
never change.
Regards,
Simon
More information about the U-Boot
mailing list