From patchwork Fri Jun 15 12:06:51 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 9319 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 2F04123DEB for ; Fri, 15 Jun 2012 12:07:38 +0000 (UTC) Received: from mail-gg0-f180.google.com (mail-gg0-f180.google.com [209.85.161.180]) by fiordland.canonical.com (Postfix) with ESMTP id EDAA6A18312 for ; Fri, 15 Jun 2012 12:07:37 +0000 (UTC) Received: by ggnf1 with SMTP id f1so2393280ggn.11 for ; Fri, 15 Jun 2012 05:07:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:mime-version:content-type :x-gm-message-state; bh=kIh9VfAgPyfZuAyzRZq3k/Vxa7PjyzYkfYAcD0aoQZ8=; b=pqBUJiJAvKOis4i0b+Ye67+3SPJL6SnEM/fZYy3P8BKG9deMnU6W9QT49YvVSI13Cg SMNe1kMpaLRMp/eQpKMCsK0T1vAONaP4skjIrLvvJ9xwiGw/SZxR7ckNhthNpnsHZ0GL kmtOrkUSa9lEClG5wKK35JN6CTSNU248xB4FyOm9hPKCCzKP2o5bghg7rrtAPaiqOjsX Gwvc60gp149k204/egkN5AwXqukrpaR2wZpFHzxa6R7J6gW3KmjVhjzbTWuU6V89Zsx9 jJvJ3ro/uAE47U3rOMiuren3GhQWFiCdG6vfOP1xgSbLNsXqURslMhH5XE2eaK+5yJGt Xx3Q== Received: by 10.50.193.196 with SMTP id hq4mr1406005igc.57.1339762057151; Fri, 15 Jun 2012 05:07:37 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.24.148 with SMTP id v20csp143029ibb; Fri, 15 Jun 2012 05:07:36 -0700 (PDT) Received: by 10.14.127.16 with SMTP id c16mr1350091eei.182.1339762055216; Fri, 15 Jun 2012 05:07:35 -0700 (PDT) Received: from eu1sys200aog110.obsmtp.com (eu1sys200aog110.obsmtp.com. [207.126.144.129]) by mx.google.com with SMTP id o15si4351500eef.47.2012.06.15.05.07.28 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 15 Jun 2012 05:07:35 -0700 (PDT) Received-SPF: neutral (google.com: 207.126.144.129 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) client-ip=207.126.144.129; Authentication-Results: mx.google.com; spf=neutral (google.com: 207.126.144.129 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) smtp.mail=linus.walleij@stericsson.com Received: from beta.dmz-us.st.com ([167.4.1.35]) (using TLSv1) by eu1sys200aob110.postini.com ([207.126.147.11]) with SMTP ID DSNKT9slgPba07J3rf9ko92WhgGYZForiCpo@postini.com; Fri, 15 Jun 2012 12:07:35 UTC Received: from zeta.dmz-us.st.com (ns4.st.com [167.4.16.71]) by beta.dmz-us.st.com (STMicroelectronics) with ESMTP id 4FF7D4D; Fri, 15 Jun 2012 12:06:35 +0000 (GMT) Received: from relay2.stm.gmessaging.net (unknown [10.230.100.18]) by zeta.dmz-us.st.com (STMicroelectronics) with ESMTP id 41B4E4A; Fri, 15 Jun 2012 09:16:26 +0000 (GMT) Received: from exdcvycastm003.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm003", Issuer "exdcvycastm003" (not verified)) by relay2.stm.gmessaging.net (Postfix) with ESMTPS id F006BA8083; Fri, 15 Jun 2012 14:06:50 +0200 (CEST) Received: from steludxu4075.lud.stericsson.com (10.230.100.153) by smtp.stericsson.com (10.230.100.1) with Microsoft SMTP Server (TLS) id 8.3.83.0; Fri, 15 Jun 2012 14:06:55 +0200 From: Linus Walleij To: , Cc: Stephen Warren , Linus Walleij Subject: [PATCH] pinctrl/nomadik: document Alt-C glitch Date: Fri, 15 Jun 2012 14:06:51 +0200 Message-ID: <1339762011-28159-1-git-send-email-linus.walleij@stericsson.com> X-Mailer: git-send-email 1.7.9.2 MIME-Version: 1.0 X-Gm-Message-State: ALoCoQldD0m5h+eATKOqVGt1aHzHUyoxE0MuZyETtqshCKo8DkB7gauEoakBBXjBvSxYqDcOmGfO From: Linus Walleij 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 --- 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) {