From patchwork Sun Aug 7 01:35:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Lin X-Patchwork-Id: 9266193 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C4B5E60839 for ; Sun, 7 Aug 2016 01:38:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B64AE283DF for ; Sun, 7 Aug 2016 01:38:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AACE22840A; Sun, 7 Aug 2016 01:38:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4BC3A283DF for ; Sun, 7 Aug 2016 01:38:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752184AbcHGBig (ORCPT ); Sat, 6 Aug 2016 21:38:36 -0400 Received: from lucky1.263xmail.com ([211.157.147.131]:44513 "EHLO lucky1.263xmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752099AbcHGBie (ORCPT ); Sat, 6 Aug 2016 21:38:34 -0400 Received: from shawn.lin?rock-chips.com (unknown [192.168.167.236]) by lucky1.263xmail.com (Postfix) with SMTP id E091A8E91B; Sun, 7 Aug 2016 09:38:25 +0800 (CST) X-263anti-spam: KSV:0; X-MAIL-GRAY: 1 X-MAIL-DELIVERY: 0 X-KSVirus-check: 0 X-ABS-CHECKED: 4 X-ADDR-CHECKED: 0 Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.263.net (Postfix) with ESMTP id 4F8ED31FE; Sun, 7 Aug 2016 09:38:25 +0800 (CST) X-RL-SENDER: shawn.lin@rock-chips.com X-FST-TO: jh80.chung@samsung.com X-SENDER-IP: 58.22.7.114 X-LOGIN-NAME: shawn.lin@rock-chips.com X-UNIQUE-TAG: X-ATTACHMENT-NUM: 0 X-SENDER: lintao@rock-chips.com X-DNS-TYPE: 0 Received: from localhost.localdomain (unknown [58.22.7.114]) by smtp.263.net (Postfix) whith ESMTP id 11640CF5D5X; Sun, 07 Aug 2016 09:38:26 +0800 (CST) From: Shawn Lin To: Jaehoon Chung , Ulf Hansson Cc: Rob Herring , linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, Heiko Stuebner , linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, Shawn Lin Subject: [PATCH v2 6/6] mmc: dw_mmc-rockchip: add parsing of power control from DT Date: Sun, 7 Aug 2016 09:35:02 +0800 Message-Id: <1470533702-16567-1-git-send-email-shawn.lin@rock-chips.com> X-Mailer: git-send-email 1.8.0 In-Reply-To: <1470533618-16312-1-git-send-email-shawn.lin@rock-chips.com> References: <1470533618-16312-1-git-send-email-shawn.lin@rock-chips.com> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP By default, the power io of dw_mmc is fixed which means we could only output high level voltage to indicate the power-on state. But that is not always correct as the usage of power io should be board specific. Let's expose it to dt for supporting this kind of specific design. Signed-off-by: Shawn Lin --- Changes in v2: - fix copy-paste err and typo drivers/mmc/host/dw_mmc-rockchip.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/mmc/host/dw_mmc-rockchip.c b/drivers/mmc/host/dw_mmc-rockchip.c index 25eae35..2e51202 100644 --- a/drivers/mmc/host/dw_mmc-rockchip.c +++ b/drivers/mmc/host/dw_mmc-rockchip.c @@ -24,6 +24,7 @@ struct dw_mci_rockchip_priv_data { struct clk *drv_clk; struct clk *sample_clk; int default_sample_phase; + bool power_invert; }; static void dw_mci_rk3288_set_ios(struct dw_mci *host, struct mmc_ios *ios) @@ -67,6 +68,10 @@ static void dw_mci_rk3288_set_ios(struct dw_mci *host, struct mmc_ios *ios) if (!IS_ERR(priv->sample_clk)) clk_set_phase(priv->sample_clk, priv->default_sample_phase); + /* Make sure we need to invert the output of PWREN */ + if (priv->power_invert) + set_bit(DW_MMC_CARD_PWR_INVERT, &host->cur_slot->flags); + /* * Set the drive phase offset based on speed mode to achieve hold times. * @@ -267,6 +272,9 @@ static int dw_mci_rk3288_parse_dt(struct dw_mci *host) &priv->default_sample_phase)) priv->default_sample_phase = 0; + if (of_property_read_bool(np, "rockchip,power-invert")) + priv->power_invert = true; + priv->drv_clk = devm_clk_get(host->dev, "ciu-drive"); if (IS_ERR(priv->drv_clk)) dev_dbg(host->dev, "ciu_drv not available\n");