mbox series

[v2,00/22] Unify MediaTek pinctrl in preparation for MT8183 and MT6765

Message ID cover.1536404280.git.sean.wang@mediatek.com
Headers show
Series Unify MediaTek pinctrl in preparation for MT8183 and MT6765 | expand

Message

Sean Wang Sept. 8, 2018, 11:07 a.m. UTC
From: Sean Wang <sean.wang@mediatek.com>

v2 and changes since v1:

add new patches
* Add additional patch 17 to 22 to support MT8183 SoC

update the existing patches
* Patch 2: Removed unnecessary blank line and headers included.
* Patch 4: Extended the size eint number can hold since it's possible more than 254 pins in certain SoC.
* Patch 11: Added cosmetic patch and fixed an error logic on invalid condition.
* Patch 14: Removed unused macro and given a better naming to the name of the default bases.

v1:

Irregular register arrangement and their logic access from various MediaTek
SoCs being introduced already causes pinctrl-mtk-common to bloat and became
really hard to maintain so that the patch creates pinctrl-mtk-common-v2 based
on the core of mt7622 pinctrl to try make the register operations to be simple.

The goals pinctrl-mtk-common-v2 want to achieve are to hopefully support
all of MediaTek SoCs, and two kinds of dt-bindings being supported,
Linux generic pinctrl dt-binding which mt762x like to support and MediaTek
vendor per-pin dt-binding the other SoCs support the MT8183 and MT6765 incline
to make use of.

The patch starts to refactor MT7622 pinctrl driver first with splitting
out these portable ways from there such as table-based register operation
and the other operations in common in the both kinds of driver.

Sean Wang (19):
  pinctrl: mediatek: add pinctrl-mtk-common-v2 for all MediaTek pinctrls
  pinctrl: mediatek: add pinctrl-moore that implements the generic
    pinctrl dt-bindings
  pinctrl: mediatek: extend struct mtk_pin_field_calc to
    pinctrl-mtk-common-v2.c
  pinctrl: mediatek: extend struct mtk_pin_desc to
    pinctrl-mtk-common-v2.c
  pinctrl: mediatek: extend struct mtk_pin_soc to
    pinctrl-mtk-common-v2.c
  pinctrl: mediatek: add driving strength related support to
    pinctrl-mtk-common-v2.c
  pinctrl: mediatek: add drv register support to pinctrl-mtk-common-v2.c
  pinctrl: mediatek: add pull related support to pinctrl-mtk-common-v2.c
  pinctrl: mediatek: add advanced pull related support to
    pinctrl-mtk-common-v2.c
  pinctrl: mediatek: add ies register support to pinctrl-mtk-common-v2.c
  pinctrl: mediatek: add pullen, pullsel register support to
    pinctrl-mtk-common-v2.c
  pinctrl: mediatek: add MT7623 pinctrl driver based on generic pinctrl
    binding
  pinctrl: mediatek: use pin descriptor all in pinctrl-mtk-common-v2.c
  pinctrl: mediatek: add multiple register bases support to
    pinctrl-mtk-common-v2.c
  pinctrl: mediatek: adjust error code and message when some register
    not supported is found
  pinctrl: mediatek: extend struct mtk_pin_desc which per-pin driver
    depends on
  pinctrl: mediatek: extend advanced pull support in
    pinctrl-mtk-common-v2.c
  pinctrl: mediatek: extend eint build to pinctrl-mtk-common-v2.c
  pinctrl: mediatek: add eint support to MT8183 pinctrl driver

Zhiyong Tao (3):
  pinctrl: mediatek: add pinctrl-paris that implements the vendor
    dt-bindings
  pinctrl: mediatek: add MT8183 pinctrl driver
  pintcrl: mediatek: add pull tweaks for I2C related pins on MT8183

 drivers/pinctrl/mediatek/Kconfig                 |   41 +-
 drivers/pinctrl/mediatek/Makefile                |    4 +
 drivers/pinctrl/mediatek/pinctrl-moore.c         |  689 ++++++++
 drivers/pinctrl/mediatek/pinctrl-moore.h         |   53 +
 drivers/pinctrl/mediatek/pinctrl-mt7622.c        | 1407 +++-------------
 drivers/pinctrl/mediatek/pinctrl-mt7623.c        | 1441 ++++++++++++++++
 drivers/pinctrl/mediatek/pinctrl-mt8183.c        |  544 ++++++
 drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c |  670 ++++++++
 drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.h |  288 ++++
 drivers/pinctrl/mediatek/pinctrl-mtk-mt8183.h    | 1916 ++++++++++++++++++++++
 drivers/pinctrl/mediatek/pinctrl-paris.c         |  906 ++++++++++
 drivers/pinctrl/mediatek/pinctrl-paris.h         |   65 +
 12 files changed, 6833 insertions(+), 1191 deletions(-)
 create mode 100644 drivers/pinctrl/mediatek/pinctrl-moore.c
 create mode 100644 drivers/pinctrl/mediatek/pinctrl-moore.h
 create mode 100644 drivers/pinctrl/mediatek/pinctrl-mt7623.c
 create mode 100644 drivers/pinctrl/mediatek/pinctrl-mt8183.c
 create mode 100644 drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c
 create mode 100644 drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.h
 create mode 100644 drivers/pinctrl/mediatek/pinctrl-mtk-mt8183.h
 create mode 100644 drivers/pinctrl/mediatek/pinctrl-paris.c
 create mode 100644 drivers/pinctrl/mediatek/pinctrl-paris.h

Comments

Linus Walleij Sept. 18, 2018, 7:36 p.m. UTC | #1
On Sat, Sep 8, 2018 at 4:07 AM <sean.wang@mediatek.com> wrote:

> From: Sean Wang <sean.wang@mediatek.com>
>
> Irregular register arrangement and distinct logic access from various
> MediaTek SoCs would cause pinctrl-mtk-common to bloat and really hard to
> maintain in the future so that the patch creates pinctrl-mtk-common-v2
> based on the core of mt7622-pinctrl.
>
> The goals pinctrl-mtk-common-v2 want to achieve are to hopefully support
> all of MediaTek SoCs, and two kinds of dt-bindings being supported,
> Linux generic pinctrl dt-binding mt7622 supports and MediaTek per-pin
> dt-binding the other SoCs support the MT8183 and MT6765 incline to make
> use of.
>
> The patch starts to refactor MT7622 pinctrl driver first with splitting
> out these portable ways from there such as table-based register operation
> and drive strength control that is common in both kinds of driver.
>
> Signed-off-by: Ryder.Lee <ryder.lee@mediatek.com>
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>

Patch applied, had to use some fuzzing and removed a <linux/gpio.h>
include that was not used.

Yours,
Linus Walleij
Linus Walleij Sept. 18, 2018, 7:42 p.m. UTC | #2
On Sat, Sep 8, 2018 at 4:07 AM <sean.wang@mediatek.com> wrote:

> From: Sean Wang <sean.wang@mediatek.com>
>
> Add a generic driver pinctrl-moore.c for MT762x SoC and any other SoC
> that would like to use generic dt-binding. The patch is furtherly
> refactored from pinctrl-mt7622.c that totally uses the functions back by
> the generic pinctrl core such as GENERIC_PINCONF, GENERIC_PINCTRL_GROUPS,
> and GENERIC_PINMUX_FUNCTIONS and its binding also completely follows up
> pinctrl-bindings.txt in Documentation/devicetree/bindings/pinctrl/ to
> implement.
>
> Signed-off-by: Ryder.Lee <ryder.lee@mediatek.com>
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>

Patch applied with some fuzzing, and removing un unused <linux/gpio.h>
include.

Yours,
Linus Walleij
Linus Walleij Sept. 18, 2018, 7:44 p.m. UTC | #3
On Sat, Sep 8, 2018 at 4:07 AM <sean.wang@mediatek.com> wrote:

> From: Sean Wang <sean.wang@mediatek.com>
>
> This patch introduces a data structure mtk_pin_desc, which is used to
> provide information per pin characteristic such as driving current,
> eint number and a driving index, that is used to lookup table describing
> the details about the groups of driving current by which the pin is able
> to adjust the driving strength so that the driver could get the
> appropriate driving group when calls .pin_config_get()/set().
>
> Signed-off-by: Ryder.Lee <ryder.lee@mediatek.com>
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>

Patch applied.

Yours,
Linus Walleij
Linus Walleij Sept. 18, 2018, 7:45 p.m. UTC | #4
On Sat, Sep 8, 2018 at 4:07 AM <sean.wang@mediatek.com> wrote:

> From: Sean Wang <sean.wang@mediatek.com>
>
> Add two parameters gpio_m and eint_m for configuring GPIO mode and EINT
> mode, they might be varying depend on SoC.
>
> Signed-off-by: Ryder.Lee <ryder.lee@mediatek.com>
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>

Patch applied.

Yours,
Linus Walleij
Linus Walleij Sept. 18, 2018, 7:46 p.m. UTC | #5
On Sat, Sep 8, 2018 at 4:07 AM <sean.wang@mediatek.com> wrote:

> From: Sean Wang <sean.wang@mediatek.com>
>
> Put driving strength support related functions to pinctrl-mtk-common-v2.c
> as these operations might be different by chips and allow different type
> of driver to reuse them.
>
> Signed-off-by: Ryder.Lee <ryder.lee@mediatek.com>
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>

Patch applied.

Yours,
Linus Walleij
Linus Walleij Sept. 18, 2018, 7:47 p.m. UTC | #6
On Sat, Sep 8, 2018 at 4:07 AM <sean.wang@mediatek.com> wrote:

> From: Sean Wang <sean.wang@mediatek.com>
>
> Certain SoCs have to program DRV register to configure driving
> strength so that we add it in the existing path as an option.
>
> Signed-off-by: Ryder.Lee <ryder.lee@mediatek.com>
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>

Patch applied.

Yours,
Linus Walleij
Linus Walleij Sept. 18, 2018, 7:48 p.m. UTC | #7
On Sat, Sep 8, 2018 at 4:07 AM <sean.wang@mediatek.com> wrote:

> From: Sean Wang <sean.wang@mediatek.com>
>
> Put pull control support related functions to pinctrl-mtk-common-v2.c
> as these operations might be different by chips and allow different
> type of driver to reuse them.
>
> Signed-off-by: Ryder.Lee <ryder.lee@mediatek.com>
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>

Patch applied.

Yours,
Linus Walleij
Linus Walleij Sept. 18, 2018, 7:49 p.m. UTC | #8
On Sat, Sep 8, 2018 at 4:07 AM <sean.wang@mediatek.com> wrote:

> From: Sean Wang <sean.wang@mediatek.com>
>
> There are some specific pins (i.e. MMC/SD) need specific registers to
> turn on/off the 10K & 50k(75K) resistors when pull up/down.
>
> Therefore, this patch adds the custom prarmeters so that the user could
> control it through device tree.
>
> Signed-off-by: Ryder.Lee <ryder.lee@mediatek.com>
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>

Patch applied.

Yours,
Linus Walleij
Linus Walleij Sept. 18, 2018, 7:50 p.m. UTC | #9
On Sat, Sep 8, 2018 at 4:07 AM <sean.wang@mediatek.com> wrote:

> From: Sean Wang <sean.wang@mediatek.com>
>
> Certain SoCs have to program an extra IES register to configure input
> enabled mode so that we add it in the existing path as an option.
>
> Signed-off-by: Ryder.Lee <ryder.lee@mediatek.com>
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>

Patch applied.

Yours,
Linus Walleij
Linus Walleij Sept. 18, 2018, 7:51 p.m. UTC | #10
On Sat, Sep 8, 2018 at 4:07 AM <sean.wang@mediatek.com> wrote:

> From: Sean Wang <sean.wang@mediatek.com>
>
> Certain SoCs have to program an extra PULLEN, PULLSEL register to configure
> bias related function so that we add it in the existing path.
>
> Signed-off-by: Ryder.Lee <ryder.lee@mediatek.com>
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>

Patch applied.

Yours,
Linus Walleij
Linus Walleij Sept. 18, 2018, 10:07 p.m. UTC | #11
On Sat, Sep 8, 2018 at 4:07 AM <sean.wang@mediatek.com> wrote:

> v2 and changes since v1:

I had trouble applying the last patches in the series so I applied
all on an immutable branch (ib-mtk) then merged that into devel
and added a patch on top to fix up some GPIO includes (just sent).

Please check the result!

Yours,
Linus Walleij
Sean Wang Sept. 19, 2018, 2:54 a.m. UTC | #12
On Tue, 2018-09-18 at 15:07 -0700, Linus Walleij wrote:
> On Sat, Sep 8, 2018 at 4:07 AM <sean.wang@mediatek.com> wrote:
> 
> > v2 and changes since v1:
> 
> I had trouble applying the last patches in the series so I applied
> all on an immutable branch (ib-mtk) then merged that into devel
> and added a patch on top to fix up some GPIO includes (just sent).
> 
> Please check the result!
> 

Sure, I'll take a look and and test on the devel branch.

On the top, I'll add a fix for the issue recently reported by kbuild
test robot about implicit declaration and a new MT6765 driver based
on the series.

> Yours,
> Linus Walleij
Manivannan Sadhasivam Sept. 19, 2018, 4:37 a.m. UTC | #13
On Wed, Sep 19, 2018 at 10:54:10AM +0800, Sean Wang wrote:
> On Tue, 2018-09-18 at 15:07 -0700, Linus Walleij wrote:
> > On Sat, Sep 8, 2018 at 4:07 AM <sean.wang@mediatek.com> wrote:
> > 
> > > v2 and changes since v1:
> > 
> > I had trouble applying the last patches in the series so I applied
> > all on an immutable branch (ib-mtk) then merged that into devel
> > and added a patch on top to fix up some GPIO includes (just sent).
> > 
> > Please check the result!
> > 
> 
> Sure, I'll take a look and and test on the devel branch.
> 
> On the top, I'll add a fix for the issue recently reported by kbuild
> test robot about implicit declaration and a new MT6765 driver based
> on the series.
>

Hi Sean,

Do you have any plans to add support for MT6797?

Thanks,
Mani

> > Yours,
> > Linus Walleij
> 
>
Sean Wang Sept. 21, 2018, 4:22 a.m. UTC | #14
On Tue, 2018-09-18 at 21:37 -0700, Manivannan Sadhasivam wrote:
> On Wed, Sep 19, 2018 at 10:54:10AM +0800, Sean Wang wrote:
> > On Tue, 2018-09-18 at 15:07 -0700, Linus Walleij wrote:
> > > On Sat, Sep 8, 2018 at 4:07 AM <sean.wang@mediatek.com> wrote:
> > > 
> > > > v2 and changes since v1:
> > > 
> > > I had trouble applying the last patches in the series so I applied
> > > all on an immutable branch (ib-mtk) then merged that into devel
> > > and added a patch on top to fix up some GPIO includes (just sent).
> > > 
> > > Please check the result!
> > > 
> > 
> > Sure, I'll take a look and and test on the devel branch.
> > 
> > On the top, I'll add a fix for the issue recently reported by kbuild
> > test robot about implicit declaration and a new MT6765 driver based
> > on the series.
> >
> 
> Hi Sean,
> 
> Do you have any plans to add support for MT6797?
> 

I personally have no the plan to add support to MT6797 because I have no
the device, but as I knew some of people in mediatek have interest to
add them by volunteers and thus there is no clear schedule. Eventually,
if they're really done, they would be still based on vendor binding not
by generic binding.

> Thanks,
> Mani
> 
> > > Yours,
> > > Linus Walleij
> > 
> >
Matthias Brugger Sept. 25, 2018, 10:48 a.m. UTC | #15
On 21/09/2018 06:22, Sean Wang wrote:
> On Tue, 2018-09-18 at 21:37 -0700, Manivannan Sadhasivam wrote:
>> On Wed, Sep 19, 2018 at 10:54:10AM +0800, Sean Wang wrote:
>>> On Tue, 2018-09-18 at 15:07 -0700, Linus Walleij wrote:
>>>> On Sat, Sep 8, 2018 at 4:07 AM <sean.wang@mediatek.com> wrote:
>>>>
>>>>> v2 and changes since v1:
>>>>
>>>> I had trouble applying the last patches in the series so I applied
>>>> all on an immutable branch (ib-mtk) then merged that into devel
>>>> and added a patch on top to fix up some GPIO includes (just sent).
>>>>
>>>> Please check the result!
>>>>
>>>
>>> Sure, I'll take a look and and test on the devel branch.
>>>
>>> On the top, I'll add a fix for the issue recently reported by kbuild
>>> test robot about implicit declaration and a new MT6765 driver based
>>> on the series.
>>>
>>
>> Hi Sean,
>>
>> Do you have any plans to add support for MT6797?
>>
> 
> I personally have no the plan to add support to MT6797 because I have no
> the device, but as I knew some of people in mediatek have interest to
> add them by volunteers and thus there is no clear schedule. Eventually,
> if they're really done, they would be still based on vendor binding not
> by generic binding.
> 

CCing Saber as he is working on the pinctrl for this device. Actually he as some
questions regarding the register layout.

Sean maybe you can bring him in contact with someone inside Mediatek who could
help him :)

Regards.
Matthias
Manivannan Sadhasivam Sept. 25, 2018, 1:07 p.m. UTC | #16
On Tue, Sep 25, 2018 at 12:48:09PM +0200, Matthias Brugger wrote:
> 
> 
> On 21/09/2018 06:22, Sean Wang wrote:
> > On Tue, 2018-09-18 at 21:37 -0700, Manivannan Sadhasivam wrote:
> >> On Wed, Sep 19, 2018 at 10:54:10AM +0800, Sean Wang wrote:
> >>> On Tue, 2018-09-18 at 15:07 -0700, Linus Walleij wrote:
> >>>> On Sat, Sep 8, 2018 at 4:07 AM <sean.wang@mediatek.com> wrote:
> >>>>
> >>>>> v2 and changes since v1:
> >>>>
> >>>> I had trouble applying the last patches in the series so I applied
> >>>> all on an immutable branch (ib-mtk) then merged that into devel
> >>>> and added a patch on top to fix up some GPIO includes (just sent).
> >>>>
> >>>> Please check the result!
> >>>>
> >>>
> >>> Sure, I'll take a look and and test on the devel branch.
> >>>
> >>> On the top, I'll add a fix for the issue recently reported by kbuild
> >>> test robot about implicit declaration and a new MT6765 driver based
> >>> on the series.
> >>>
> >>
> >> Hi Sean,
> >>
> >> Do you have any plans to add support for MT6797?
> >>
> > 
> > I personally have no the plan to add support to MT6797 because I have no
> > the device, but as I knew some of people in mediatek have interest to
> > add them by volunteers and thus there is no clear schedule. Eventually,
> > if they're really done, they would be still based on vendor binding not
> > by generic binding.
> > 
> 
> CCing Saber as he is working on the pinctrl for this device. Actually he as some
> questions regarding the register layout.
> 
> Sean maybe you can bring him in contact with someone inside Mediatek who could
> help him :)
>

FYI. I started working on MT6797 pinctrl support but never got time to
finish it. You can find my initial work below. Eventhough it is based on
the Mediatek SDK it should be fine IMO.

It would be great if someone (Saber) can took and finish it. The hard
bit for me was lack of proper documentation :(

https://git.linaro.org/people/manivannan.sadhasivam/96b-common.git/log/?h=mt6797

Thanks,
Mani

> Regards.
> Matthias
Manivannan Sadhasivam Sept. 25, 2018, 1:09 p.m. UTC | #17
On Tue, Sep 25, 2018 at 06:07:00AM -0700, Manivannan Sadhasivam wrote:
> On Tue, Sep 25, 2018 at 12:48:09PM +0200, Matthias Brugger wrote:
> > 
> > 
> > On 21/09/2018 06:22, Sean Wang wrote:
> > > On Tue, 2018-09-18 at 21:37 -0700, Manivannan Sadhasivam wrote:
> > >> On Wed, Sep 19, 2018 at 10:54:10AM +0800, Sean Wang wrote:
> > >>> On Tue, 2018-09-18 at 15:07 -0700, Linus Walleij wrote:
> > >>>> On Sat, Sep 8, 2018 at 4:07 AM <sean.wang@mediatek.com> wrote:
> > >>>>
> > >>>>> v2 and changes since v1:
> > >>>>
> > >>>> I had trouble applying the last patches in the series so I applied
> > >>>> all on an immutable branch (ib-mtk) then merged that into devel
> > >>>> and added a patch on top to fix up some GPIO includes (just sent).
> > >>>>
> > >>>> Please check the result!
> > >>>>
> > >>>
> > >>> Sure, I'll take a look and and test on the devel branch.
> > >>>
> > >>> On the top, I'll add a fix for the issue recently reported by kbuild
> > >>> test robot about implicit declaration and a new MT6765 driver based
> > >>> on the series.
> > >>>
> > >>
> > >> Hi Sean,
> > >>
> > >> Do you have any plans to add support for MT6797?
> > >>
> > > 
> > > I personally have no the plan to add support to MT6797 because I have no
> > > the device, but as I knew some of people in mediatek have interest to
> > > add them by volunteers and thus there is no clear schedule. Eventually,
> > > if they're really done, they would be still based on vendor binding not
> > > by generic binding.
> > > 
> > 
> > CCing Saber as he is working on the pinctrl for this device. Actually he as some
> > questions regarding the register layout.
> > 
> > Sean maybe you can bring him in contact with someone inside Mediatek who could
> > help him :)
> >
> 
> FYI. I started working on MT6797 pinctrl support but never got time to
> finish it. You can find my initial work below. Eventhough it is based on
> the Mediatek SDK it should be fine IMO.
> 
> It would be great if someone (Saber) can took and finish it. The hard
> bit for me was lack of proper documentation :(
>

s/documentation/datasheet

> https://git.linaro.org/people/manivannan.sadhasivam/96b-common.git/log/?h=mt6797
> 
> Thanks,
> Mani
> 
> > Regards.
> > Matthias