From 99954fa53cab5c90f12fca8d3d562f7a1bacbef7 Mon Sep 17 00:00:00 2001 From: Linus Walleij Date: Tue, 22 May 2012 11:46:45 +0200 Subject: [PATCH] --- yaml --- r: 311095 b: refs/heads/master c: daf731748f978efb4f741d19b499236e03bf667f h: refs/heads/master i: 311093: a295e2bb1b16f7688a4e198cb6be946a88c0696c 311091: aedb2446c505e79534fc4c15305a5c0f84cbb566 311087: e62893970bd80b81eac0f719223d57bd6cd3c18f v: v3 --- [refs] | 2 +- trunk/drivers/pinctrl/pinctrl-nomadik.c | 22 +++++++++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index 596f242c0c6f..8ad081d83c9c 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 14e1e9f5cadb7cff3a2846c27cc1b9c8f207ee18 +refs/heads/master: daf731748f978efb4f741d19b499236e03bf667f diff --git a/trunk/drivers/pinctrl/pinctrl-nomadik.c b/trunk/drivers/pinctrl/pinctrl-nomadik.c index e8937e7e4999..3e7e47d6b385 100644 --- a/trunk/drivers/pinctrl/pinctrl-nomadik.c +++ b/trunk/drivers/pinctrl/pinctrl-nomadik.c @@ -1438,7 +1438,27 @@ static int nmk_pmx_enable(struct pinctrl_dev *pctldev, unsigned function, dev_dbg(npct->dev, "enable group %s, %u pins\n", g->name, g->npins); - /* Handle this special glitch on altfunction C */ + /* + * If we're setting altfunc C by setting both AFSLA and AFSLB to 1, + * we may pass through an undesired state. In this case we take + * some extra care. + * + * Safe sequence used to switch IOs between GPIO and Alternate-C mode: + * - Save SLPM registers (since we have a shadow register in the + * nmk_chip we're using that as backup) + * - Set SLPM=0 for the IOs you want to switch and others to 1 + * - Configure the GPIO registers for the IOs that are being switched + * - Set IOFORCE=1 + * - Modify the AFLSA/B registers for the IOs that are being switched + * - Set IOFORCE=0 + * - Restore SLPM registers + * - Any spurious wake up event during switch sequence to be ignored + * and cleared + * + * We REALLY need to save ALL slpm registers, because the external + * IOFORCE will switch *all* ports to their sleepmode setting to as + * to avoid glitches. (Not just one port!) + */ glitch = (g->altsetting == NMK_GPIO_ALT_C); if (glitch) {