diff options
author | John Crispin <blogic@openwrt.org> | 2013-02-01 07:04:55 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2013-02-05 10:17:21 -0500 |
commit | 362ba3cfb45a68d12b6b7d2584eda6df28c77bcb (patch) | |
tree | ce551347652c2bf61d428aadcbd066cd863b1d7c /drivers | |
parent | d41e35c364391d5c80467f62eecec8c4c65342f4 (diff) |
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/pinctrl/pinctrl-xway.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/drivers/pinctrl/pinctrl-xway.c b/drivers/pinctrl/pinctrl-xway.c index 5f0eb04c2336..69dec9b191d9 100644 --- a/drivers/pinctrl/pinctrl-xway.c +++ b/drivers/pinctrl/pinctrl-xway.c | |||
@@ -441,17 +441,17 @@ static int xway_pinconf_get(struct pinctrl_dev *pctldev, | |||
441 | if (port == PORT3) | 441 | if (port == PORT3) |
442 | reg = GPIO3_OD; | 442 | reg = GPIO3_OD; |
443 | else | 443 | else |
444 | reg = GPIO_OD(port); | 444 | reg = GPIO_OD(pin); |
445 | *config = LTQ_PINCONF_PACK(param, | 445 | *config = LTQ_PINCONF_PACK(param, |
446 | !!gpio_getbit(info->membase[0], reg, PORT_PIN(port))); | 446 | !!gpio_getbit(info->membase[0], reg, PORT_PIN(pin))); |
447 | break; | 447 | break; |
448 | 448 | ||
449 | case LTQ_PINCONF_PARAM_PULL: | 449 | case LTQ_PINCONF_PARAM_PULL: |
450 | if (port == PORT3) | 450 | if (port == PORT3) |
451 | reg = GPIO3_PUDEN; | 451 | reg = GPIO3_PUDEN; |
452 | else | 452 | else |
453 | reg = GPIO_PUDEN(port); | 453 | reg = GPIO_PUDEN(pin); |
454 | if (!gpio_getbit(info->membase[0], reg, PORT_PIN(port))) { | 454 | if (!gpio_getbit(info->membase[0], reg, PORT_PIN(pin))) { |
455 | *config = LTQ_PINCONF_PACK(param, 0); | 455 | *config = LTQ_PINCONF_PACK(param, 0); |
456 | break; | 456 | break; |
457 | } | 457 | } |
@@ -459,8 +459,8 @@ static int xway_pinconf_get(struct pinctrl_dev *pctldev, | |||
459 | if (port == PORT3) | 459 | if (port == PORT3) |
460 | reg = GPIO3_PUDSEL; | 460 | reg = GPIO3_PUDSEL; |
461 | else | 461 | else |
462 | reg = GPIO_PUDSEL(port); | 462 | reg = GPIO_PUDSEL(pin); |
463 | if (!gpio_getbit(info->membase[0], reg, PORT_PIN(port))) | 463 | if (!gpio_getbit(info->membase[0], reg, PORT_PIN(pin))) |
464 | *config = LTQ_PINCONF_PACK(param, 2); | 464 | *config = LTQ_PINCONF_PACK(param, 2); |
465 | else | 465 | else |
466 | *config = LTQ_PINCONF_PACK(param, 1); | 466 | *config = LTQ_PINCONF_PACK(param, 1); |
@@ -488,29 +488,29 @@ static int xway_pinconf_set(struct pinctrl_dev *pctldev, | |||
488 | if (port == PORT3) | 488 | if (port == PORT3) |
489 | reg = GPIO3_OD; | 489 | reg = GPIO3_OD; |
490 | else | 490 | else |
491 | reg = GPIO_OD(port); | 491 | reg = GPIO_OD(pin); |
492 | gpio_setbit(info->membase[0], reg, PORT_PIN(port)); | 492 | gpio_setbit(info->membase[0], reg, PORT_PIN(pin)); |
493 | break; | 493 | break; |
494 | 494 | ||
495 | case LTQ_PINCONF_PARAM_PULL: | 495 | case LTQ_PINCONF_PARAM_PULL: |
496 | if (port == PORT3) | 496 | if (port == PORT3) |
497 | reg = GPIO3_PUDEN; | 497 | reg = GPIO3_PUDEN; |
498 | else | 498 | else |
499 | reg = GPIO_PUDEN(port); | 499 | reg = GPIO_PUDEN(pin); |
500 | if (arg == 0) { | 500 | if (arg == 0) { |
501 | gpio_clearbit(info->membase[0], reg, PORT_PIN(port)); | 501 | gpio_clearbit(info->membase[0], reg, PORT_PIN(pin)); |
502 | break; | 502 | break; |
503 | } | 503 | } |
504 | gpio_setbit(info->membase[0], reg, PORT_PIN(port)); | 504 | gpio_setbit(info->membase[0], reg, PORT_PIN(pin)); |
505 | 505 | ||
506 | if (port == PORT3) | 506 | if (port == PORT3) |
507 | reg = GPIO3_PUDSEL; | 507 | reg = GPIO3_PUDSEL; |
508 | else | 508 | else |
509 | reg = GPIO_PUDSEL(port); | 509 | reg = GPIO_PUDSEL(pin); |
510 | if (arg == 1) | 510 | if (arg == 1) |
511 | gpio_clearbit(info->membase[0], reg, PORT_PIN(port)); | 511 | gpio_clearbit(info->membase[0], reg, PORT_PIN(pin)); |
512 | else if (arg == 2) | 512 | else if (arg == 2) |
513 | gpio_setbit(info->membase[0], reg, PORT_PIN(port)); | 513 | gpio_setbit(info->membase[0], reg, PORT_PIN(pin)); |
514 | else | 514 | else |
515 | dev_err(pctldev->dev, "Invalid pull value %d\n", arg); | 515 | dev_err(pctldev->dev, "Invalid pull value %d\n", arg); |
516 | break; | 516 | break; |