diff options
Diffstat (limited to 'drivers/pinctrl/pinctrl-nomadik.c')
-rw-r--r-- | drivers/pinctrl/pinctrl-nomadik.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/drivers/pinctrl/pinctrl-nomadik.c b/drivers/pinctrl/pinctrl-nomadik.c index b26395d16347..3e7e47d6b385 100644 --- a/drivers/pinctrl/pinctrl-nomadik.c +++ b/drivers/pinctrl/pinctrl-nomadik.c | |||
@@ -673,7 +673,7 @@ static void __nmk_gpio_set_wake(struct nmk_gpio_chip *nmk_chip, | |||
673 | * wakeup is anyhow controlled by the RIMSC and FIMSC registers. | 673 | * wakeup is anyhow controlled by the RIMSC and FIMSC registers. |
674 | */ | 674 | */ |
675 | if (nmk_chip->sleepmode && on) { | 675 | if (nmk_chip->sleepmode && on) { |
676 | __nmk_gpio_set_slpm(nmk_chip, gpio % nmk_chip->chip.base, | 676 | __nmk_gpio_set_slpm(nmk_chip, gpio % NMK_GPIO_PER_CHIP, |
677 | NMK_GPIO_SLPM_WAKEUP_ENABLE); | 677 | NMK_GPIO_SLPM_WAKEUP_ENABLE); |
678 | } | 678 | } |
679 | 679 | ||
@@ -1246,6 +1246,7 @@ static int __devinit nmk_gpio_probe(struct platform_device *dev) | |||
1246 | ret = PTR_ERR(clk); | 1246 | ret = PTR_ERR(clk); |
1247 | goto out_unmap; | 1247 | goto out_unmap; |
1248 | } | 1248 | } |
1249 | clk_prepare(clk); | ||
1249 | 1250 | ||
1250 | nmk_chip = kzalloc(sizeof(*nmk_chip), GFP_KERNEL); | 1251 | nmk_chip = kzalloc(sizeof(*nmk_chip), GFP_KERNEL); |
1251 | if (!nmk_chip) { | 1252 | if (!nmk_chip) { |
@@ -1437,7 +1438,27 @@ static int nmk_pmx_enable(struct pinctrl_dev *pctldev, unsigned function, | |||
1437 | 1438 | ||
1438 | dev_dbg(npct->dev, "enable group %s, %u pins\n", g->name, g->npins); | 1439 | dev_dbg(npct->dev, "enable group %s, %u pins\n", g->name, g->npins); |
1439 | 1440 | ||
1440 | /* Handle this special glitch on altfunction C */ | 1441 | /* |
1442 | * If we're setting altfunc C by setting both AFSLA and AFSLB to 1, | ||
1443 | * we may pass through an undesired state. In this case we take | ||
1444 | * some extra care. | ||
1445 | * | ||
1446 | * Safe sequence used to switch IOs between GPIO and Alternate-C mode: | ||
1447 | * - Save SLPM registers (since we have a shadow register in the | ||
1448 | * nmk_chip we're using that as backup) | ||
1449 | * - Set SLPM=0 for the IOs you want to switch and others to 1 | ||
1450 | * - Configure the GPIO registers for the IOs that are being switched | ||
1451 | * - Set IOFORCE=1 | ||
1452 | * - Modify the AFLSA/B registers for the IOs that are being switched | ||
1453 | * - Set IOFORCE=0 | ||
1454 | * - Restore SLPM registers | ||
1455 | * - Any spurious wake up event during switch sequence to be ignored | ||
1456 | * and cleared | ||
1457 | * | ||
1458 | * We REALLY need to save ALL slpm registers, because the external | ||
1459 | * IOFORCE will switch *all* ports to their sleepmode setting to as | ||
1460 | * to avoid glitches. (Not just one port!) | ||
1461 | */ | ||
1441 | glitch = (g->altsetting == NMK_GPIO_ALT_C); | 1462 | glitch = (g->altsetting == NMK_GPIO_ALT_C); |
1442 | 1463 | ||
1443 | if (glitch) { | 1464 | if (glitch) { |