mirror of
https://xff.cz/git/u-boot/
synced 2025-09-01 16:52:14 +02:00
dm: pinctrl: Avoid race condition on probe for UCLASS_PINCTRL
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>
This commit is contained in:
committed by
Simon Glass
parent
f00d89fd50
commit
dce406e0a2
@@ -179,11 +179,14 @@ static int pinctrl_select_state_simple(struct udevice *dev)
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* For simplicity, assume the first device of PINCTRL uclass
|
* For most system, there is only one pincontroller device. But in
|
||||||
* is the correct one. This is most likely OK as there is
|
* case of multiple pincontroller devices, probe the one with sequence
|
||||||
* usually only one pinctrl device on the system.
|
* 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)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user