[U-Boot] [PATCH v2 0/2] Update pinctrl-uclass

This series adds: - For system with multiple pincontroller device, insure probe order to avoid race condition using sequence number (alias) - Avoid to bind child node with gpio-controller properties.
Changes in v2: - Update commit message with explanaition
Patrice Chotard (1): dm: pinctrl: Avoid race condition on probe for UCLASS_PINCTRL
Patrick Delaunay (1): dm: pinctrl: Skip gpio-controller node in pinconfig_post_bind()
drivers/pinctrl/pinctrl-uclass.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)

In case of system with several pin-controller device, probe the first UCLASS_PINCTRL by seq number (defined by alias) to avoid race condition with I2C PINCONTROL driver for GPIO expander (GPIO expander need I2C bus, I2C driver need PINCONFIG).
Signed-off-by: Patrick DELAUNAY patrick.delaunay@st.com Signed-off-by: Patrice Chotard patrice.chotard@st.com Reviewed-by: Simon Glass sjg@chromium.org ---
Changes in v2: None
drivers/pinctrl/pinctrl-uclass.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/pinctrl/pinctrl-uclass.c b/drivers/pinctrl/pinctrl-uclass.c index 0e3260afd1ee..abb622cfe79e 100644 --- a/drivers/pinctrl/pinctrl-uclass.c +++ b/drivers/pinctrl/pinctrl-uclass.c @@ -201,11 +201,14 @@ static int pinctrl_select_state_simple(struct udevice *dev) int ret;
/* - * For simplicity, assume the first device of PINCTRL uclass - * is the correct one. This is most likely OK as there is - * usually only one pinctrl device on the system. + * For most system, there is only one pincontroller device. But in + * case of multiple pincontroller devices, probe the one with sequence + * number 0 (defined by alias) to avoid race condition. */ - ret = uclass_get_device(UCLASS_PINCTRL, 0, &pctldev); + ret = uclass_get_device_by_seq(UCLASS_PINCTRL, 0, &pctldev); + if (ret) + /* if not found, get the first one */ + ret = uclass_get_device(UCLASS_PINCTRL, 0, &pctldev); if (ret) return ret;

From: Patrick Delaunay patrick.delaunay@st.com
Some binding define child node gpio-controller without compatible property. This patch avoid to bind the pinconfig uclass to these node.
For example, the binding for st,stm32-pinctrl (./device-tree-bindings/pinctrl/st,stm32-pinctrl.txt) defines the GPIO controller/bank node as sub-node of pincontrol (st,stm32f429-pinctrl) but without compatible (as it is not mandatory).
Signed-off-by: Patrick Delaunay patrick.delaunay@st.com Signed-off-by: Patrice Chotard patrice.chotard@st.com ---
Changes in v2: - Update commit message with explanaition
drivers/pinctrl/pinctrl-uclass.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/drivers/pinctrl/pinctrl-uclass.c b/drivers/pinctrl/pinctrl-uclass.c index abb622cfe79e..9df06a262cd5 100644 --- a/drivers/pinctrl/pinctrl-uclass.c +++ b/drivers/pinctrl/pinctrl-uclass.c @@ -149,6 +149,9 @@ static int pinconfig_post_bind(struct udevice *dev) ofnode_get_property(node, "compatible", &ret); if (ret >= 0) continue; + /* If this node has "gpio-controller" property, skip */ + if (ofnode_read_bool(node, "gpio-controller")) + continue;
if (ret != -FDT_ERR_NOTFOUND) return ret;

On Mon, 25 Feb 2019 at 05:40, Patrice Chotard patrice.chotard@st.com wrote:
From: Patrick Delaunay patrick.delaunay@st.com
Some binding define child node gpio-controller without compatible property. This patch avoid to bind the pinconfig uclass to these node.
For example, the binding for st,stm32-pinctrl (./device-tree-bindings/pinctrl/st,stm32-pinctrl.txt) defines the GPIO controller/bank node as sub-node of pincontrol (st,stm32f429-pinctrl) but without compatible (as it is not mandatory).
Signed-off-by: Patrick Delaunay patrick.delaunay@st.com Signed-off-by: Patrice Chotard patrice.chotard@st.com
Changes in v2: - Update commit message with explanaition
drivers/pinctrl/pinctrl-uclass.c | 3 +++ 1 file changed, 3 insertions(+)
Reviewed-by: Simon Glass sjg@chromium.org

Hi
Just a gentle reminder to not forgot this series which has been submitted and reviewed since several weeks.
Thanks
Patrice
On 2/25/19 1:39 PM, Patrice Chotard wrote:
This series adds:
- For system with multiple pincontroller device, insure probe order to avoid race condition using sequence number (alias)
- Avoid to bind child node with gpio-controller properties.
Changes in v2: - Update commit message with explanaition
Patrice Chotard (1): dm: pinctrl: Avoid race condition on probe for UCLASS_PINCTRL
Patrick Delaunay (1): dm: pinctrl: Skip gpio-controller node in pinconfig_post_bind()
drivers/pinctrl/pinctrl-uclass.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)

Hi Patrice,
It is making its way in via u-boot-dm.
Regards, Simon
On Thu, 11 Apr 2019 at 03:06, Patrice CHOTARD patrice.chotard@st.com wrote:
Hi
Just a gentle reminder to not forgot this series which has been submitted and reviewed since several weeks.
Thanks
Patrice
On 2/25/19 1:39 PM, Patrice Chotard wrote:
This series adds:
- For system with multiple pincontroller device, insure probe order to avoid race condition using sequence number (alias)
- Avoid to bind child node with gpio-controller properties.
Changes in v2: - Update commit message with explanaition
Patrice Chotard (1): dm: pinctrl: Avoid race condition on probe for UCLASS_PINCTRL
Patrick Delaunay (1): dm: pinctrl: Skip gpio-controller node in pinconfig_post_bind()
drivers/pinctrl/pinctrl-uclass.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
participants (3)
-
Patrice CHOTARD
-
Patrice Chotard
-
Simon Glass