* [PATCH] pinctrl/nomadik: document Alt-C glitch
@ 2012-06-15 12:06 Linus Walleij
2012-06-15 16:00 ` Stephen Warren
0 siblings, 1 reply; 2+ messages in thread
From: Linus Walleij @ 2012-06-15 12:06 UTC (permalink / raw)
To: linux-arm-kernel
From: Linus Walleij <linus.walleij@linaro.org>
This documentation comment existed in an earlier patch set for
GPIO consolidation, so I'm saving it for maintainability of the
code.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
drivers/pinctrl/pinctrl-nomadik.c | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/drivers/pinctrl/pinctrl-nomadik.c b/drivers/pinctrl/pinctrl-nomadik.c
index e8937e7..3e7e47d 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,
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) {
--
1.7.9.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH] pinctrl/nomadik: document Alt-C glitch
2012-06-15 12:06 [PATCH] pinctrl/nomadik: document Alt-C glitch Linus Walleij
@ 2012-06-15 16:00 ` Stephen Warren
0 siblings, 0 replies; 2+ messages in thread
From: Stephen Warren @ 2012-06-15 16:00 UTC (permalink / raw)
To: linux-arm-kernel
On 06/15/2012 06:06 AM, Linus Walleij wrote:
> From: Linus Walleij <linus.walleij@linaro.org>
>
> This documentation comment existed in an earlier patch set for
> GPIO consolidation, so I'm saving it for maintainability of the
> code.
Acked-by: Stephen Warren <swarren@wwwdotorg.org>
(I'm fine adding the comment back; I can't comment on its content:-)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-06-15 16:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-15 12:06 [PATCH] pinctrl/nomadik: document Alt-C glitch Linus Walleij
2012-06-15 16:00 ` Stephen Warren
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).