From patchwork Mon May 8 16:21:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 98836 Delivered-To: patches@linaro.org Received: by 10.140.96.100 with SMTP id j91csp1407390qge; Mon, 8 May 2017 09:21:26 -0700 (PDT) X-Received: by 10.28.0.13 with SMTP id 13mr12828932wma.19.1494260486826; Mon, 08 May 2017 09:21:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1494260486; cv=none; d=google.com; s=arc-20160816; b=fDmVntLu2gwuWCk2oVBDuyH4rLdxCf6fMn9Il/zM9POyon8+UpI/bJMopLVbeMD/TG EDvIS7P6ZkcV5SpD8Z1oTuk6Hdrg/Mc0iUO6fVVG9QinFFPV7nE9qWPdIOm/+XfdnXjG hs8vy5KPoQUVsClxvaMT9dAHAMB/ofPFQBgufwVaJQfep+iae/r0nqCHM0CjaZxop/39 th4Ngusakfo45mYL4IZs6rfar4NlcfJSjDGO3ZwNdpC1B71iOIbo2eXexQwaJUsYhF7h cxHSCTXMgyIzF3lkuZLuHO0VnATxDtQ66FH6CPQvKwv0VonT+8uQj1BI6fTk5w6SVpmp eL7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=GYbqsB0u0u3YiKDajF7tEWPfw6nMKxsjTWR2e9aQsfo=; b=tN335PYG7GPjYX8igmc016pNjUs9sQtOianreOxCpQUZHRMgwTsulPl2PH4jsje6g1 9MI5xIYfuZz80uPEYTfVqw1sYx0AQcd6y/wos8PCd7ycC2Z+cGDf6Ur1gxgShF/TT4N5 D8ok6q8FqmtbuTH2oTrdD6RmaN8W3NjecE2KQvUr/RBQXNoWuIzfMnyP+rOjz8FlwilY A/VXSoqgBmSPccLmILANuvH4vrrV9yrQ+ITtHsVW3TlClMw8kCaT6WbIBnAdGwS574J0 Zf0iIzGVjN2S0n+PikS30wEPkEg2N7ozBBoxc+McogkT79BBdpBdEEpYUpXFjeWr64En +/xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:400c:c09::231 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-wm0-x231.google.com (mail-wm0-x231.google.com. [2a00:1450:400c:c09::231]) by mx.google.com with ESMTPS id 91si15068475wrs.86.2017.05.08.09.21.26 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 May 2017 09:21:26 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:400c:c09::231 as permitted sender) client-ip=2a00:1450:400c:c09::231; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:400c:c09::231 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by mail-wm0-x231.google.com with SMTP id b84so60647352wmh.0 for ; Mon, 08 May 2017 09:21:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=GYbqsB0u0u3YiKDajF7tEWPfw6nMKxsjTWR2e9aQsfo=; b=HDVBqpc2qImHFo57vLHREtwjN/zUp5FQ2eDdewWIWK6N+q2ASLQR5puNRVxDdbDtOs ZSmveXy4Jrz4f9dHQ4aAi6zZmQscJeVJlbXJi81Q93SqW6x03E4lWAHX0OVrXRTzv9aX pMiL/mzG7AyEHJTMv3ebOfu/mzNwO1hynbrfE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=GYbqsB0u0u3YiKDajF7tEWPfw6nMKxsjTWR2e9aQsfo=; b=Ii4haSIFrHO+hKi87YMD5k2j9Ph43JQeQX67dabI/6kvGhZyvhBuvqwOVI+BtR1l7N sNoJTxqZEo5kf7O80MLpXnTcNB9aKYohuQO3HVrUg6BfFcRsEnHbJ4BhlaBYeXXzRlVH S8nW9KUsVMiK+1OCN/hfJln/Zv3j3QNf4PbYQgy5qKzteZWmfptU2gG9LYPe/sxf8X6m S/AKRb8pisO+PEqNtpPGhboFKZZ6Uib+CSbY/RqhYpp9/M1bQU7NRwFNgVbE/hX9oVez snWoVkmWUi2Wj/4UaTkx3VPKtjNRD4ThhmzBQS7QIIzvLFDavIlHKEhG3BCiiPRfVTxo bZrw== X-Gm-Message-State: AODbwcBnABIJAoM14oWM4cAUtry6HjMc2ioVO4ZxArb7jSg4YPW5Ed8K zaxYlWQ5uPdY9/KD3Kw= X-Received: by 10.25.221.4 with SMTP id u4mr9296804lfg.62.1494260486259; Mon, 08 May 2017 09:21:26 -0700 (PDT) Return-Path: Received: from localhost.localdomain (h-155-4-221-67.na.cust.bahnhof.se. [155.4.221.67]) by smtp.gmail.com with ESMTPSA id 1sm1600724ljn.59.2017.05.08.09.21.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 08 May 2017 09:21:25 -0700 (PDT) From: Ulf Hansson To: Wei Xu , linux-arm-kernel@lists.infradead.org Cc: Ulf Hansson , Daniel Lezcano , linux-mmc@vger.kernel.org Subject: [PATCH 2/8] mmc: pwrseq_simple: Parse DTS for the power-off-delay-us property Date: Mon, 8 May 2017 18:21:11 +0200 Message-Id: <1494260477-25163-3-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1494260477-25163-1-git-send-email-ulf.hansson@linaro.org> References: <1494260477-25163-1-git-send-email-ulf.hansson@linaro.org> If the optional power-off-delay-us property is found, insert the corresponding delay after asserting the GPIO during power off. This enables a graceful shutdown sequence for some devices. Cc: linux-mmc@vger.kernel.org Signed-off-by: Ulf Hansson --- drivers/mmc/core/pwrseq_simple.c | 7 +++++++ 1 file changed, 7 insertions(+) -- 2.7.4 diff --git a/drivers/mmc/core/pwrseq_simple.c b/drivers/mmc/core/pwrseq_simple.c index 1304160..13ef162 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 power_off_delay_us; struct clk *ext_clk; struct gpio_descs *reset_gpios; }; @@ -78,6 +79,10 @@ static void mmc_pwrseq_simple_power_off(struct mmc_host *host) mmc_pwrseq_simple_set_gpios_value(pwrseq, 1); + if (pwrseq->power_off_delay_us) + usleep_range(pwrseq->power_off_delay_us, + 2 * pwrseq->power_off_delay_us); + if (!IS_ERR(pwrseq->ext_clk) && pwrseq->clk_enabled) { clk_disable_unprepare(pwrseq->ext_clk); pwrseq->clk_enabled = false; @@ -119,6 +124,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, "power-off-delay-us", + &pwrseq->power_off_delay_us); pwrseq->pwrseq.dev = dev; pwrseq->pwrseq.ops = &mmc_pwrseq_simple_ops;