This has been done in order to align the DT of U-Boot with the DT
of Linux. In Linux, a phandle from a '-gpio' DT property is linked
to the pinctrl driver, a single driver that handles both pinctrl
settings and offers GPIO API to callers. On the other hand,
U-Boot redirects such phandle to a corresponding UCLASS_GPIO
driver, because U-Boot offers two different types of drivers
in this case: UCLASS_PINCTRL which handles pin functions and
UCLASS_GPIO which handles gpio requests as a gpio provider.
Due to this, we have two drivers in Uboot, but the Devicetree
has a single node. Thus, just one of the drivers can be probed
for the DT node during platform initialization, before relocation.

Our previous solution in U-Boot was to have a different devicetree:
the gpio node has a subnode for the pinctrl driver, which
is not compliant with Linux ABI. Furthermore, our documentation
for this type of nodes mentions no such gpio compatible.

After this patch, we can no longer add nodes with a gpio
compatible in the DT. Thus, in order to link the pinctrl driver to
the gpio one, a hook to the bind method of the former in U-Boot has
been added and the GPIO related compatibles have been removed to
avoid conflict when compatibles are enumerated and bound to drivers
during platform start before relocation. The bind method will attach
the GPIO driver to the pinctrl DT node so that every phandle coming
from '-gpio' DT properties will be redirected to a valid driver
attached to the pinctrl DT node.

Furthermore, this fixes a GPIO request issue existent on sama7g5,
which was caused by the fact that there was no UCLASS_GPIO driver
bound to the pioA node label.

To make the two Devicetrees even more similar (the one from Linux and the
one from U-Boot), make the pinctrl driver's node support multiple subnodes
for its subnode.

Sergiu Moga (4):
  ARM: dts: at91: sama5: Align with Linux Devicetree
  ARM: dts: at91: sama7: Align with Linux Devicetree
  pinctrl: at91-pio4: Bind GPIO driver to the pinctrl DT node
  pinctrl: at91-pio4: Add support for pinctrl config subnodes

 arch/arm/dts/at91-sama5d27_giantboard.dts     |  59 +++--
 arch/arm/dts/at91-sama5d27_som1_ek.dts        |  80 +++----
 .../dts/at91-sama5d27_wlsom1_ek-u-boot.dtsi   |   6 +-
 arch/arm/dts/at91-sama5d27_wlsom1_ek.dts      |  92 ++++----
 arch/arm/dts/at91-sama5d2_icp.dts             | 134 ++++++------
 arch/arm/dts/at91-sama5d2_ptc_ek.dts          |  98 ++++-----
 arch/arm/dts/at91-sama5d2_xplained.dts        | 204 +++++++++---------
 arch/arm/dts/at91-sama7g5ek-u-boot.dtsi       |   2 +-
 arch/arm/dts/at91-sama7g5ek.dts               |  85 +++++---
 arch/arm/dts/sama5d2.dtsi                     |   9 +-
 arch/arm/dts/sama5d27_som1.dtsi               |  94 ++++----
 arch/arm/dts/sama5d27_wlsom1.dtsi             |  54 +++--
 arch/arm/dts/sama7g5.dtsi                     |  16 +-
 drivers/gpio/atmel_pio4.c                     |   2 -
 drivers/pinctrl/pinctrl-at91-pio4.c           | 138 ++++++++++--
 15 files changed, 592 insertions(+), 481 deletions(-)

-- 
2.25.1

Reply via email to