[U-Boot] [PATCH v2 10/18] pinctrl: MediaTek: add pinctrl driver for MT7629 SoC

Ryder Lee ryder.lee at mediatek.com
Thu Oct 25 06:08:15 UTC 2018


Hi Simon,

On Wed, 2018-10-24 at 21:29 -0600, Simon Glass wrote:
> Hi Ryder,
> 
> On 12 October 2018 at 01:00, Ryder Lee <ryder.lee at mediatek.com> wrote:
> > This patch adds pinctrl support for MT7629 SoC. The IO core found on
> > the SoC has the registers for pinctrl, pinconf and gpio mixed up in
> > the same register range.  Hence the driver also implements the gpio
> > functionality through UCLASS_GPIO.
> >
> > This also creates a common file as there might be other chips that use
> > the same binding and driver, then being a little more abstract could
> > help in the long run.
> >
> > Signed-off-by: Ryder Lee <ryder.lee at mediatek.com>
> > ---
> >  arch/arm/include/asm/arch-mediatek/gpio.h     |   9 +
> >  drivers/pinctrl/Kconfig                       |   1 +
> >  drivers/pinctrl/Makefile                      |   1 +
> >  drivers/pinctrl/mediatek/Kconfig              |  11 +
> >  drivers/pinctrl/mediatek/Makefile             |   6 +
> >  drivers/pinctrl/mediatek/pinctrl-mt7629.c     | 488 +++++++++++++++++++++++
> >  drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 552 ++++++++++++++++++++++++++
> >  drivers/pinctrl/mediatek/pinctrl-mtk-common.h | 182 +++++++++
> >  8 files changed, 1250 insertions(+)
> >  create mode 100644 arch/arm/include/asm/arch-mediatek/gpio.h
> >  create mode 100644 drivers/pinctrl/mediatek/Kconfig
> >  create mode 100644 drivers/pinctrl/mediatek/Makefile
> >  create mode 100644 drivers/pinctrl/mediatek/pinctrl-mt7629.c
> >  create mode 100644 drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> >  create mode 100644 drivers/pinctrl/mediatek/pinctrl-mtk-common.h
> >
> 
> [..]
> 
> > +int mtk_pinctrl_probe(struct udevice *dev, struct mtk_pinctrl_soc *soc)
> > +{
> > +       struct mtk_pinctrl_priv *priv = dev_get_priv(dev);
> > +       int ret;
> > +
> > +       priv->base = dev_read_addr_ptr(dev);
> > +       if (priv->base == (void *)FDT_ADDR_T_NONE)
> > +               return -EINVAL;
> > +
> > +       priv->soc = soc;
> > +
> > +       ret = mtk_gpiochip_register(dev);
> > +       if (ret)
> > +               return ret;
> > +
> > +       return 0;
> > +}
> 
> How come this function is exported? It should be probed like any other driver.

It makes no difference. We could reuse it for other MTK chips in this
way.

In pinctrl-mt7623.c (patch 11/18):

static int mtk_pinctrl_mt7623_probe(struct udevice *dev)
{

//common probed function
	mtk_pinctrl_probe(dev, &mt7623_data);

//proprietary operations for the chip....
	mt7623_bonding_disable(dev);
        ....
}

The similar usage is meson_pinctrl_probe() in pinctrl-meson.c

Ryder




More information about the U-Boot mailing list