mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-10 23:24:38 +00:00
pinctrl: stmfx: update pinconf settings
Alignment with kernel driver. According to the following tab (coming from STMFX datasheet), updates have to done in stmfx_pinctrl_conf_set function: -"type" has to be set when "bias" is configured as "pull-up or pull-down" -PIN_CONFIG_DRIVE_PUSH_PULL should only be used when gpio is configured as output. There is so no need to check direction. DIR | TYPE | PUPD | MFX GPIO configuration ----|------|------|--------------------------------------------------- 1 | 1 | 1 | OUTPUT open drain with internal pull-up resistor ----|------|------|--------------------------------------------------- 1 | 1 | 0 | OUTPUT open drain with internal pull-down resistor ----|------|------|--------------------------------------------------- 1 | 0 | 0/1 | OUTPUT push pull no pull ----|------|------|--------------------------------------------------- 0 | 1 | 1 | INPUT with internal pull-up resistor ----|------|------|--------------------------------------------------- 0 | 1 | 0 | INPUT with internal pull-down resistor ----|------|------|--------------------------------------------------- 0 | 0 | 1 | INPUT floating ----|------|------|--------------------------------------------------- 0 | 0 | 0 | analog (GPIO not used, default setting) Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
This commit is contained in:
parent
7385826475
commit
abee80d789
1 changed files with 10 additions and 10 deletions
|
@ -231,23 +231,23 @@ static int stmfx_pinctrl_conf_set(struct udevice *dev, unsigned int pin,
|
||||||
switch (param) {
|
switch (param) {
|
||||||
case PIN_CONFIG_BIAS_PULL_PIN_DEFAULT:
|
case PIN_CONFIG_BIAS_PULL_PIN_DEFAULT:
|
||||||
case PIN_CONFIG_BIAS_DISABLE:
|
case PIN_CONFIG_BIAS_DISABLE:
|
||||||
|
case PIN_CONFIG_DRIVE_PUSH_PULL:
|
||||||
|
ret = stmfx_pinctrl_set_type(dev, pin, 0);
|
||||||
|
break;
|
||||||
case PIN_CONFIG_BIAS_PULL_DOWN:
|
case PIN_CONFIG_BIAS_PULL_DOWN:
|
||||||
|
ret = stmfx_pinctrl_set_type(dev, pin, 1);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
ret = stmfx_pinctrl_set_pupd(dev, pin, 0);
|
ret = stmfx_pinctrl_set_pupd(dev, pin, 0);
|
||||||
break;
|
break;
|
||||||
case PIN_CONFIG_BIAS_PULL_UP:
|
case PIN_CONFIG_BIAS_PULL_UP:
|
||||||
|
ret = stmfx_pinctrl_set_type(dev, pin, 1);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
ret = stmfx_pinctrl_set_pupd(dev, pin, 1);
|
ret = stmfx_pinctrl_set_pupd(dev, pin, 1);
|
||||||
break;
|
break;
|
||||||
case PIN_CONFIG_DRIVE_OPEN_DRAIN:
|
case PIN_CONFIG_DRIVE_OPEN_DRAIN:
|
||||||
if (dir == GPIOF_OUTPUT)
|
ret = stmfx_pinctrl_set_type(dev, pin, 1);
|
||||||
ret = stmfx_pinctrl_set_type(dev, pin, 1);
|
|
||||||
else
|
|
||||||
ret = stmfx_pinctrl_set_type(dev, pin, 0);
|
|
||||||
break;
|
|
||||||
case PIN_CONFIG_DRIVE_PUSH_PULL:
|
|
||||||
if (dir == GPIOF_OUTPUT)
|
|
||||||
ret = stmfx_pinctrl_set_type(dev, pin, 0);
|
|
||||||
else
|
|
||||||
ret = stmfx_pinctrl_set_type(dev, pin, 1);
|
|
||||||
break;
|
break;
|
||||||
case PIN_CONFIG_OUTPUT:
|
case PIN_CONFIG_OUTPUT:
|
||||||
ret = stmfx_gpio_direction_output(plat->gpio, pin, arg);
|
ret = stmfx_gpio_direction_output(plat->gpio, pin, arg);
|
||||||
|
|
Loading…
Reference in a new issue