diff options
-rw-r--r-- | drivers/pinctrl/pinctrl-nomadik.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/drivers/pinctrl/pinctrl-nomadik.c b/drivers/pinctrl/pinctrl-nomadik.c index e8937e7e4999..3e7e47d6b385 100644 --- a/drivers/pinctrl/pinctrl-nomadik.c +++ b/drivers/pinctrl/pinctrl-nomadik.c | |||
@@ -1438,7 +1438,27 @@ static int nmk_pmx_enable(struct pinctrl_dev *pctldev, unsigned function, | |||
1438 | 1438 | ||
1439 | 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); |
1440 | 1440 | ||
1441 | /* 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 | */ | ||
1442 | glitch = (g->altsetting == NMK_GPIO_ALT_C); | 1462 | glitch = (g->altsetting == NMK_GPIO_ALT_C); |
1443 | 1463 | ||
1444 | if (glitch) { | 1464 | if (glitch) { |