From patchwork Tue Oct 21 03:43:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Zhong X-Patchwork-Id: 5109061 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 2A62E9F30B for ; Tue, 21 Oct 2014 03:46:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4BBD620103 for ; Tue, 21 Oct 2014 03:46:37 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 64BB2200E0 for ; Tue, 21 Oct 2014 03:46:36 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XgQMs-0002wZ-8M; Tue, 21 Oct 2014 03:44:18 +0000 Received: from va-smtp01.263.net ([54.88.144.211]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XgQMo-0002od-Ov; Tue, 21 Oct 2014 03:44:15 +0000 Received: from leejh-Precision-WorkStation-T3500.corp.google.com (localhost.localdomain [127.0.0.1]) by va-smtp01.263.net (Postfix) with ESMTP id CF33F7F903; Tue, 21 Oct 2014 11:43:46 +0800 (CST) X-RL-SENDER: zyw@rock-chips.com X-FST-TO: heiko@sntech.de X-SENDER-IP: 127.0.0.1 X-LOGIN-NAME: zyw@rock-chips.com X-UNIQUE-TAG: <0f09f3825e924fd912845660140063d3> X-SENDER: zyw@rock-chips.com X-DNS-TYPE: 1 Received: from leejh-Precision-WorkStation-T3500.corp.google.com (localhost [127.0.0.1]) by va-smtp01.263.net (Postfix) whith ESMTP id 22362RNVS49; Tue, 21 Oct 2014 11:43:46 +0800 (CST) From: zyw@rock-chips.com To: Heiko Stuebner Subject: [PATCH v3 2/6] pinctrl: rockchip: save and restore gpio6_c6 pinmux in suspend/resume Date: Mon, 20 Oct 2014 20:43:31 -0700 Message-Id: <1413863011-2736-1-git-send-email-zyw@rock-chips.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1413862894-2623-1-git-send-email-zyw@rock-chips.com> References: <1413862894-2623-1-git-send-email-zyw@rock-chips.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141020_204414_887632_937157E8 X-CRM114-Status: GOOD ( 12.46 ) X-Spam-Score: -0.0 (/) Cc: Mark Rutland , devicetree@vger.kernel.org, Mike Turquette , Pawel Moll , Ian Campbell , Linus Walleij , dianders@chromium.org, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, Rob Herring , Kumar Gala , Chris Zhong , Russell King , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-3.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Chris Zhong 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 --- 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 d384d99..85134e4 100644 --- a/drivers/pinctrl/pinctrl-rockchip.c +++ b/drivers/pinctrl/pinctrl-rockchip.c @@ -1796,26 +1796,54 @@ static struct rockchip_pin_ctrl *rockchip_pinctrl_get_soc_data( } #ifdef CONFIG_PM + +#define RK3288_GRF_GPIO6C_IOMUX 0x64 +#define GPIO6C6_SEL_WRITE_ENABLE BIT(28) + +static u32 rk3288_grf_gpio6c_iomux; + static int rockchip_pinctrl_suspend(struct platform_device *pdev, pm_message_t state) { struct rockchip_pinctrl *info; + int ret; info = platform_get_drvdata(pdev); if (!info) return -EINVAL; - return pinctrl_force_sleep(info->pctl_dev); + 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) + return ret; + } + + return 0; } static int rockchip_pinctrl_resume(struct platform_device *pdev) { struct rockchip_pinctrl *info; + int ret; info = platform_get_drvdata(pdev); if (!info) return -EINVAL; + 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); } #endif