From patchwork Mon Mar 6 14:17:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Perier X-Patchwork-Id: 9606381 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 0164760524 for ; Mon, 6 Mar 2017 14:20:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E9CF528418 for ; Mon, 6 Mar 2017 14:20:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DE86E26E77; Mon, 6 Mar 2017 14:20:26 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CB7CC28429 for ; Mon, 6 Mar 2017 14:20:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=/+nrfe8Ly7oTR9pVnGsL24gvFxsb6xon1Rqm6BbMXTQ=; b=hIrNzI8sD/bIHuP0pLksntEQTG a2c9craXfqY10yRO2LuD3f8nUYXFkEzSkZQu+ZJ2SAf3tsCg89RYPLs+xumARjGYvNqkfm6a2SOZ0 W24QwbfzQrmp9+jgbqdoiYDYwGrL+Qwqm4fhe1EVcAyAgkOl7DjPxj+oNSnGQc+Kn1aH0eX+HGD+H jqUAMcbZ+Cm3KD2jGXqGsYIKin6JNxidFZdhOlZsq53tk2IEN8g9mLUbhYIIuXIdgzN7Bucg33lf0 P8vXyPvwVKsY6kK/DJxgiKO6wBapxEuJUqgTKVQaXpgToT0DYZqQSRxyMDYPr1IUkXGdQJMQi+q+J QpDdm9xg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cktUg-0004gC-1M; Mon, 06 Mar 2017 14:20:10 +0000 Received: from bhuna.collabora.co.uk ([46.235.227.227]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cktSg-00026S-A5; Mon, 06 Mar 2017 14:18:09 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: rperier) with ESMTPSA id 868DC26A999 From: Romain Perier To: Ulf Hansson Subject: [PATCH v2 3/4] mmc: pwrseq_simple: Add an optional pre-power-on-delay Date: Mon, 6 Mar 2017 15:17:15 +0100 Message-Id: <20170306141716.19120-4-romain.perier@collabora.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170306141716.19120-1-romain.perier@collabora.com> References: <20170306141716.19120-1-romain.perier@collabora.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170306_061806_532544_D2990E54 X-CRM114-Status: UNSURE ( 8.34 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Heiko Stuebner , linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, Sjoerd Simons , Romain Perier , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Some devices need a while between the enablement of its clk and the time where the reset line is asserted. When this time happens between the pre_power_on and the post_power_on callbacks, there is a need to do an msleep at the end of the pre_power_on callback. This commit adds an optional DT property for such devices. Signed-off-by: Romain Perier --- Documentation/devicetree/bindings/mmc/mmc-pwrseq-simple.txt | 2 ++ drivers/mmc/core/pwrseq_simple.c | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/Documentation/devicetree/bindings/mmc/mmc-pwrseq-simple.txt b/Documentation/devicetree/bindings/mmc/mmc-pwrseq-simple.txt index e254368..821feaaf 100644 --- a/Documentation/devicetree/bindings/mmc/mmc-pwrseq-simple.txt +++ b/Documentation/devicetree/bindings/mmc/mmc-pwrseq-simple.txt @@ -18,6 +18,8 @@ Optional properties: "ext_clock" (External clock provided to the card). - post-power-on-delay-ms : Delay in ms after powering the card and de-asserting the reset-gpios (if any) +- pre-power-on-delay-ms : Delay in ms before powering the card and + asserting the reset-gpios (if any) Example: diff --git a/drivers/mmc/core/pwrseq_simple.c b/drivers/mmc/core/pwrseq_simple.c index e27019f..d8d7166 100644 --- a/drivers/mmc/core/pwrseq_simple.c +++ b/drivers/mmc/core/pwrseq_simple.c @@ -27,6 +27,7 @@ struct mmc_pwrseq_simple { struct mmc_pwrseq pwrseq; bool clk_enabled; u32 post_power_on_delay_ms; + u32 pre_power_on_delay_ms; struct clk *ext_clk; struct gpio_descs *reset_gpios; }; @@ -60,6 +61,9 @@ static void mmc_pwrseq_simple_pre_power_on(struct mmc_host *host) } mmc_pwrseq_simple_set_gpios_value(pwrseq, 1); + + if (pwrseq->pre_power_on_delay_ms) + msleep(pwrseq->pre_power_on_delay_ms); } static void mmc_pwrseq_simple_post_power_on(struct mmc_host *host) @@ -130,6 +134,8 @@ static int mmc_pwrseq_simple_probe(struct platform_device *pdev) device_property_read_u32(dev, "post-power-on-delay-ms", &pwrseq->post_power_on_delay_ms); + device_property_read_u32(dev, "pre-power-on-delay-ms", + &pwrseq->pre_power_on_delay_ms); pwrseq->pwrseq.dev = dev; if (device_property_read_bool(dev, "post-ios-power-on"))