All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Zhong <zyw@rock-chips.com>
To: heiko@sntech.de, dianders@chromium.org
Cc: mturquette@linaro.org,
	Ian Campbell <ijc+devicetree@hellion.org.uk>,
	Russell King <linux@arm.linux.org.uk>,
	Rob Herring <robh+dt@kernel.org>, Pawel Moll <pawel.moll@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	khilman@kernel.org, linux-rockchip@lists.infradead.org,
	Chris Zhong <zyw@rock-chips.com>,
	linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH v6 2/7] pinctrl: rockchip: save and restore gpio6_c6 pinmux in suspend/resume
Date: Wed, 29 Oct 2014 19:52:00 +0800	[thread overview]
Message-ID: <1414583525-17395-3-git-send-email-zyw@rock-chips.com> (raw)
In-Reply-To: <1414583525-17395-1-git-send-email-zyw@rock-chips.com>

Save and restore the gpio6_c6 pinmux setting, since Maskrom of RK3288
would modify it to sdmmc0_det, so it need to be restored to the correct
setting after resume from Maskrom.

Signed-off-by: Chris Zhong <zyw@rock-chips.com>
Tested-by: Doug Anderson <dianders@chromium.org>
Reviewed-by: Doug Anderson <dianders@chromium.org>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

---

Changes in v6: None
Changes in v5:
- add pinctrl_force_default() in the error case

Changes in v4: None
Changes in v3: None
Changes in v2: None

 drivers/pinctrl/pinctrl-rockchip.c |   30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c
index 172ad1d..49ca40c 100644
--- a/drivers/pinctrl/pinctrl-rockchip.c
+++ b/drivers/pinctrl/pinctrl-rockchip.c
@@ -1770,16 +1770,44 @@ static struct rockchip_pin_ctrl *rockchip_pinctrl_get_soc_data(
 	return ctrl;
 }
 
+#define RK3288_GRF_GPIO6C_IOMUX		0x64
+#define GPIO6C6_SEL_WRITE_ENABLE	BIT(28)
+
+static u32 rk3288_grf_gpio6c_iomux;
+
 static int __maybe_unused rockchip_pinctrl_suspend(struct device *dev)
 {
 	struct rockchip_pinctrl *info = dev_get_drvdata(dev);
+	int ret = pinctrl_force_sleep(info->pctl_dev);
+
+	if (ret)
+		return ret;
+
+	/*
+	 * RK3288 GPIO6_C6 mux would be modified by Maskrom when resume, so save
+	 * the setting here, and restore it at resume.
+	 */
+	if (info->ctrl->type == RK3288) {
+		ret = regmap_read(info->regmap_base, RK3288_GRF_GPIO6C_IOMUX,
+				  &rk3288_grf_gpio6c_iomux);
+		if (ret) {
+			pinctrl_force_default(info->pctl_dev);
+			return ret;
+		}
+	}
 
-	return pinctrl_force_sleep(info->pctl_dev);
+	return 0;
 }
 
 static int __maybe_unused rockchip_pinctrl_resume(struct device *dev)
 {
 	struct rockchip_pinctrl *info = dev_get_drvdata(dev);
+	int ret = regmap_write(info->regmap_base, RK3288_GRF_GPIO6C_IOMUX,
+			       rk3288_grf_gpio6c_iomux |
+			       GPIO6C6_SEL_WRITE_ENABLE);
+
+	if (ret)
+		return ret;
 
 	return pinctrl_force_default(info->pctl_dev);
 }
-- 
1.7.9.5

WARNING: multiple messages have this Message-ID (diff)
From: zyw@rock-chips.com (Chris Zhong)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v6 2/7] pinctrl: rockchip: save and restore gpio6_c6 pinmux in suspend/resume
Date: Wed, 29 Oct 2014 19:52:00 +0800	[thread overview]
Message-ID: <1414583525-17395-3-git-send-email-zyw@rock-chips.com> (raw)
In-Reply-To: <1414583525-17395-1-git-send-email-zyw@rock-chips.com>

Save and restore the gpio6_c6 pinmux setting, since Maskrom of RK3288
would modify it to sdmmc0_det, so it need to be restored to the correct
setting after resume from Maskrom.

Signed-off-by: Chris Zhong <zyw@rock-chips.com>
Tested-by: Doug Anderson <dianders@chromium.org>
Reviewed-by: Doug Anderson <dianders@chromium.org>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

---

Changes in v6: None
Changes in v5:
- add pinctrl_force_default() in the error case

Changes in v4: None
Changes in v3: None
Changes in v2: None

 drivers/pinctrl/pinctrl-rockchip.c |   30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c
index 172ad1d..49ca40c 100644
--- a/drivers/pinctrl/pinctrl-rockchip.c
+++ b/drivers/pinctrl/pinctrl-rockchip.c
@@ -1770,16 +1770,44 @@ static struct rockchip_pin_ctrl *rockchip_pinctrl_get_soc_data(
 	return ctrl;
 }
 
+#define RK3288_GRF_GPIO6C_IOMUX		0x64
+#define GPIO6C6_SEL_WRITE_ENABLE	BIT(28)
+
+static u32 rk3288_grf_gpio6c_iomux;
+
 static int __maybe_unused rockchip_pinctrl_suspend(struct device *dev)
 {
 	struct rockchip_pinctrl *info = dev_get_drvdata(dev);
+	int ret = pinctrl_force_sleep(info->pctl_dev);
+
+	if (ret)
+		return ret;
+
+	/*
+	 * RK3288 GPIO6_C6 mux would be modified by Maskrom when resume, so save
+	 * the setting here, and restore it at resume.
+	 */
+	if (info->ctrl->type == RK3288) {
+		ret = regmap_read(info->regmap_base, RK3288_GRF_GPIO6C_IOMUX,
+				  &rk3288_grf_gpio6c_iomux);
+		if (ret) {
+			pinctrl_force_default(info->pctl_dev);
+			return ret;
+		}
+	}
 
-	return pinctrl_force_sleep(info->pctl_dev);
+	return 0;
 }
 
 static int __maybe_unused rockchip_pinctrl_resume(struct device *dev)
 {
 	struct rockchip_pinctrl *info = dev_get_drvdata(dev);
+	int ret = regmap_write(info->regmap_base, RK3288_GRF_GPIO6C_IOMUX,
+			       rk3288_grf_gpio6c_iomux |
+			       GPIO6C6_SEL_WRITE_ENABLE);
+
+	if (ret)
+		return ret;
 
 	return pinctrl_force_default(info->pctl_dev);
 }
-- 
1.7.9.5

  parent reply	other threads:[~2014-10-29 11:52 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-29 11:51 [PATCH v6 0/7] This is the 1st version of suspend for RK3288 Chris Zhong
2014-10-29 11:51 ` Chris Zhong
2014-10-29 11:51 ` [PATCH v6 1/7] pinctrl: rockchip: add suspend/resume functions Chris Zhong
2014-10-29 11:51   ` Chris Zhong
2014-10-31 20:54   ` Linus Walleij
2014-10-31 20:54     ` Linus Walleij
2014-11-02 20:47   ` Heiko Stübner
2014-11-02 20:47     ` Heiko Stübner
2014-10-29 11:52 ` Chris Zhong [this message]
2014-10-29 11:52   ` [PATCH v6 2/7] pinctrl: rockchip: save and restore gpio6_c6 pinmux in suspend/resume Chris Zhong
2014-10-29 11:52 ` [PATCH v6 3/7] clk: rockchip: RK3288: add suspend and resume Chris Zhong
2014-10-29 11:52   ` Chris Zhong
2014-10-29 11:52 ` [PATCH v6 4/7] ARM: rockchip: add suspend and resume for RK3288 Chris Zhong
2014-10-29 11:52   ` Chris Zhong
2014-10-29 19:01   ` Kevin Hilman
2014-10-29 19:01     ` Kevin Hilman
2014-10-29 19:26     ` Doug Anderson
2014-10-29 19:26       ` Doug Anderson
2014-10-29 20:00       ` Kevin Hilman
2014-10-29 20:00         ` Kevin Hilman
2014-11-11  7:33     ` Chris Zhong
2014-11-11  7:33       ` Chris Zhong
2014-10-29 11:52 ` [PATCH v6 5/7] ARM: rockchip: Add pmu-sram binding Chris Zhong
2014-10-29 11:52 ` [PATCH v6 6/7] ARM: dts: add RK3288 suspend support Chris Zhong
2014-10-29 11:52   ` Chris Zhong
2014-10-29 11:52 ` [PATCH v6 7/7] ARM: dts: add suspend voltage setting for RK808 Chris Zhong
2014-10-29 11:52   ` Chris Zhong
2014-10-29 15:40   ` Doug Anderson
2014-10-29 15:40     ` Doug Anderson
2014-10-29 15:40     ` Doug Anderson
2014-10-29 16:29     ` Javier Martinez Canillas
2014-10-29 16:29       ` Javier Martinez Canillas
2014-10-29 16:51       ` Doug Anderson
2014-10-29 16:51         ` Doug Anderson
2014-10-29 16:51         ` Doug Anderson
2014-10-30  0:32         ` Javier Martinez Canillas
2014-10-30  0:32           ` Javier Martinez Canillas
2014-10-29 20:06 ` [PATCH v6 0/7] This is the 1st version of suspend for RK3288 Kevin Hilman
2014-10-29 20:06   ` Kevin Hilman
2014-10-29 21:50   ` Heiko Stübner
2014-10-29 21:50     ` Heiko Stübner
2014-10-29 22:26     ` Doug Anderson
2014-10-29 22:26       ` Doug Anderson
2014-10-29 22:26       ` Doug Anderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1414583525-17395-3-git-send-email-zyw@rock-chips.com \
    --to=zyw@rock-chips.com \
    --cc=dianders@chromium.org \
    --cc=heiko@sntech.de \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=khilman@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=linux@arm.linux.org.uk \
    --cc=mark.rutland@arm.com \
    --cc=mturquette@linaro.org \
    --cc=pawel.moll@arm.com \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.