Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp438404imm; Fri, 21 Sep 2018 02:48:03 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZFlPDcAa/2GB0h0VnCvBZ4GM3oKGmdpE4J6W878RuBaZFB0dwQBIqyxmsVDA8Sv19tLze1 X-Received: by 2002:a62:c008:: with SMTP id x8-v6mr45564720pff.149.1537523283743; Fri, 21 Sep 2018 02:48:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537523283; cv=none; d=google.com; s=arc-20160816; b=TXt2wjyIA61XgfjCKXhZI3KJTVpIIZZ1/X5ufTezEe885iWbvhJRs4QLb6FwRVYZe1 DVrCm7Q1mk4uZ2buV8eY7NctzvQdrNLUI0SukeR0DkPlddSpD7qBmYzAzCkDuCWgpUOf Vy0IBftpjNqxLFent3D8vV92XF2NY6BTl9owe8f+ysAJi2pj4+R8XQiLpbXvaaV/S6St BvjOAQlyUcAU4XbsvJSbGDwUP+8XUIGc+DV8g94bK9E1xwTnMicpW9RvkLeAzEPzmnyA sVO4089qnYMPWWOGiS80ms4tQIDwbEtoEUG4l+ISwnuFj6/qLnjqnEFqQpMnQ201/bjw w7ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=XSIzh4XMr9RfzIggUpdOfKkFJDxaM++ona6z+4sr+UQ=; b=RxrfzumPNrx5cGKIiJ3bsuDjtjiK0ApwzVrBZ3W5pytKaig/pPYNLc1snIDct4En3K rAhAIT4PBd3zS06qJZZqaw50Xoy3GgSZwgJAGrovhlZuVSPnWM7NjlGHAU286femYTdc b0pjIJpwqCdbD6l4jhVyHjBW1G2tQXNQfbwN+n0mFsrP27XfXBz6ZqDIAICUIWt5EXRD dchPEoFtXTUNDrUfjdDD9QcAPU8RQcm/zSWAIiEX550r1C+Kzn7R0dPG2z/A1ItDxPwN hJ81b0RPf4JD1W/89O6Pcn0jpMOxSe8jWXK8E94pkEiGV2mqZhHGrtfhtV0MXJt+Ytar lkbA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o5-v6si25697705pgo.250.2018.09.21.02.47.45; Fri, 21 Sep 2018 02:48:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389764AbeIUPfS (ORCPT + 99 others); Fri, 21 Sep 2018 11:35:18 -0400 Received: from mx07-00178001.pphosted.com ([62.209.51.94]:56394 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389739AbeIUPfR (ORCPT ); Fri, 21 Sep 2018 11:35:17 -0400 Received: from pps.filterd (m0046668.ppops.net [127.0.0.1]) by mx07-.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id w8L9hw2q025556; Fri, 21 Sep 2018 11:46:55 +0200 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 2mmkmr380c-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 21 Sep 2018 11:46:55 +0200 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 82BE231; Fri, 21 Sep 2018 09:46:54 +0000 (GMT) Received: from Webmail-eu.st.com (Safex1hubcas21.st.com [10.75.90.44]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 61AA42AC3; Fri, 21 Sep 2018 09:46:54 +0000 (GMT) Received: from SAFEX1HUBCAS22.st.com (10.75.90.93) by SAFEX1HUBCAS21.st.com (10.75.90.44) with Microsoft SMTP Server (TLS) id 14.3.361.1; Fri, 21 Sep 2018 11:46:54 +0200 Received: from lmecxl0923.lme.st.com (10.48.0.237) by Webmail-ga.st.com (10.75.90.48) with Microsoft SMTP Server (TLS) id 14.3.361.1; Fri, 21 Sep 2018 11:46:54 +0200 From: Ludovic Barre To: Ulf Hansson , Rob Herring CC: Maxime Coquelin , Alexandre Torgue , , Gerald Baeza , Loic Pallardy , , , , , , Ludovic Barre Subject: [PATCH V2 23/27] mmc: mmci: add variant property to request a reset Date: Fri, 21 Sep 2018 11:46:17 +0200 Message-ID: <1537523181-14578-24-git-send-email-ludovic.Barre@st.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1537523181-14578-1-git-send-email-ludovic.Barre@st.com> References: <1537523181-14578-1-git-send-email-ludovic.Barre@st.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.48.0.237] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-09-21_04:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ludovic Barre Some variants could require a reset. STM32 sdmmc variant needs to reset hardware block during the power cycle procedure (for re-initialization) Signed-off-by: Ludovic Barre --- Documentation/devicetree/bindings/mmc/mmci.txt | 2 ++ drivers/mmc/host/mmci.c | 9 +++++++++ drivers/mmc/host/mmci.h | 4 ++++ 3 files changed, 15 insertions(+) diff --git a/Documentation/devicetree/bindings/mmc/mmci.txt b/Documentation/devicetree/bindings/mmc/mmci.txt index 03796cf..e952707 100644 --- a/Documentation/devicetree/bindings/mmc/mmci.txt +++ b/Documentation/devicetree/bindings/mmc/mmci.txt @@ -11,6 +11,8 @@ Required properties: - compatible : contains "arm,pl18x", "arm,primecell". - vmmc-supply : phandle to the regulator device tree node, mentioned as the VCC/VDD supply in the eMMC/SD specs. +depend of variant: +- resets : phandle to internal reset line. Optional properties: - arm,primecell-periphid : contains the PrimeCell Peripheral ID, it overrides diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index b1d5bc5..6b3c33f 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c @@ -37,6 +37,7 @@ #include #include #include +#include #include #include @@ -1854,6 +1855,14 @@ static int mmci_probe(struct amba_device *dev, dev_dbg(mmc_dev(mmc), "clocking block at %u Hz\n", mmc->f_max); + if (variant->reset) { + host->rst = devm_reset_control_get_exclusive(&dev->dev, NULL); + if (IS_ERR(host->rst)) { + ret = PTR_ERR(host->rst); + goto clk_disable; + } + } + /* Get regulators and the supported OCR mask */ ret = mmc_regulator_get_supply(mmc); if (ret) diff --git a/drivers/mmc/host/mmci.h b/drivers/mmc/host/mmci.h index e130689..f0fa185 100644 --- a/drivers/mmc/host/mmci.h +++ b/drivers/mmc/host/mmci.h @@ -247,6 +247,7 @@ struct mmci_host; * @start_err: bitmask identifying the STARTBITERR bit inside MMCISTATUS * register. * @opendrain: bitmask identifying the OPENDRAIN bit inside MMCIPOWER register + * @reset: true if variant has need reset signal. */ struct variant_data { unsigned int clkreg; @@ -285,6 +286,7 @@ struct variant_data { bool qcom_dml; bool reversed_irq_handling; bool mmcimask1; + bool reset; unsigned int irq_pio_mask; u32 start_err; u32 opendrain; @@ -318,6 +320,8 @@ struct mmci_host { struct clk *clk; bool singleirq; + struct reset_control *rst; + spinlock_t lock; unsigned int mclk; -- 2.7.4