pinctrl/lantiq: pinconf uses port instead of pin
The XWAY pinctrl driver invalidly uses the port and not the pin number to work out the registers and bits to be set for the opendrain and pullup/down resistors. Signed-off-by: John Crispin <blogic@openwrt.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
Родитель
d41e35c364
Коммит
362ba3cfb4
|
@ -441,17 +441,17 @@ static int xway_pinconf_get(struct pinctrl_dev *pctldev,
|
||||||
if (port == PORT3)
|
if (port == PORT3)
|
||||||
reg = GPIO3_OD;
|
reg = GPIO3_OD;
|
||||||
else
|
else
|
||||||
reg = GPIO_OD(port);
|
reg = GPIO_OD(pin);
|
||||||
*config = LTQ_PINCONF_PACK(param,
|
*config = LTQ_PINCONF_PACK(param,
|
||||||
!!gpio_getbit(info->membase[0], reg, PORT_PIN(port)));
|
!!gpio_getbit(info->membase[0], reg, PORT_PIN(pin)));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LTQ_PINCONF_PARAM_PULL:
|
case LTQ_PINCONF_PARAM_PULL:
|
||||||
if (port == PORT3)
|
if (port == PORT3)
|
||||||
reg = GPIO3_PUDEN;
|
reg = GPIO3_PUDEN;
|
||||||
else
|
else
|
||||||
reg = GPIO_PUDEN(port);
|
reg = GPIO_PUDEN(pin);
|
||||||
if (!gpio_getbit(info->membase[0], reg, PORT_PIN(port))) {
|
if (!gpio_getbit(info->membase[0], reg, PORT_PIN(pin))) {
|
||||||
*config = LTQ_PINCONF_PACK(param, 0);
|
*config = LTQ_PINCONF_PACK(param, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -459,8 +459,8 @@ static int xway_pinconf_get(struct pinctrl_dev *pctldev,
|
||||||
if (port == PORT3)
|
if (port == PORT3)
|
||||||
reg = GPIO3_PUDSEL;
|
reg = GPIO3_PUDSEL;
|
||||||
else
|
else
|
||||||
reg = GPIO_PUDSEL(port);
|
reg = GPIO_PUDSEL(pin);
|
||||||
if (!gpio_getbit(info->membase[0], reg, PORT_PIN(port)))
|
if (!gpio_getbit(info->membase[0], reg, PORT_PIN(pin)))
|
||||||
*config = LTQ_PINCONF_PACK(param, 2);
|
*config = LTQ_PINCONF_PACK(param, 2);
|
||||||
else
|
else
|
||||||
*config = LTQ_PINCONF_PACK(param, 1);
|
*config = LTQ_PINCONF_PACK(param, 1);
|
||||||
|
@ -488,29 +488,29 @@ static int xway_pinconf_set(struct pinctrl_dev *pctldev,
|
||||||
if (port == PORT3)
|
if (port == PORT3)
|
||||||
reg = GPIO3_OD;
|
reg = GPIO3_OD;
|
||||||
else
|
else
|
||||||
reg = GPIO_OD(port);
|
reg = GPIO_OD(pin);
|
||||||
gpio_setbit(info->membase[0], reg, PORT_PIN(port));
|
gpio_setbit(info->membase[0], reg, PORT_PIN(pin));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LTQ_PINCONF_PARAM_PULL:
|
case LTQ_PINCONF_PARAM_PULL:
|
||||||
if (port == PORT3)
|
if (port == PORT3)
|
||||||
reg = GPIO3_PUDEN;
|
reg = GPIO3_PUDEN;
|
||||||
else
|
else
|
||||||
reg = GPIO_PUDEN(port);
|
reg = GPIO_PUDEN(pin);
|
||||||
if (arg == 0) {
|
if (arg == 0) {
|
||||||
gpio_clearbit(info->membase[0], reg, PORT_PIN(port));
|
gpio_clearbit(info->membase[0], reg, PORT_PIN(pin));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
gpio_setbit(info->membase[0], reg, PORT_PIN(port));
|
gpio_setbit(info->membase[0], reg, PORT_PIN(pin));
|
||||||
|
|
||||||
if (port == PORT3)
|
if (port == PORT3)
|
||||||
reg = GPIO3_PUDSEL;
|
reg = GPIO3_PUDSEL;
|
||||||
else
|
else
|
||||||
reg = GPIO_PUDSEL(port);
|
reg = GPIO_PUDSEL(pin);
|
||||||
if (arg == 1)
|
if (arg == 1)
|
||||||
gpio_clearbit(info->membase[0], reg, PORT_PIN(port));
|
gpio_clearbit(info->membase[0], reg, PORT_PIN(pin));
|
||||||
else if (arg == 2)
|
else if (arg == 2)
|
||||||
gpio_setbit(info->membase[0], reg, PORT_PIN(port));
|
gpio_setbit(info->membase[0], reg, PORT_PIN(pin));
|
||||||
else
|
else
|
||||||
dev_err(pctldev->dev, "Invalid pull value %d\n", arg);
|
dev_err(pctldev->dev, "Invalid pull value %d\n", arg);
|
||||||
break;
|
break;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче