Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753617AbbGEJkZ (ORCPT ); Sun, 5 Jul 2015 05:40:25 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:62755 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753276AbbGEJkR (ORCPT ); Sun, 5 Jul 2015 05:40:17 -0400 From: Arnd Bergmann To: Ludovic Desroches Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, ulf.hansson@linaro.org, nicolas.ferre@atmel.com, alexandre.belloni@free-electrons.com Subject: Re: [PATCH 2/3] mmc: sdhci-of-at91: introduce driver for the Atmel SDMMC Date: Sat, 04 Jul 2015 22:06:49 +0200 Message-ID: <8304633.2ajieYmcMU@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) In-Reply-To: <1435933037-12889-3-git-send-email-ludovic.desroches@atmel.com> References: <1435933037-12889-1-git-send-email-ludovic.desroches@atmel.com> <1435933037-12889-3-git-send-email-ludovic.desroches@atmel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:h9tl7r+QSGTHVQNkIUZD+phfIFtE+nNUMqTob/7XbA3dbBfRE3A g4KaaZoT/VKJbHAz9b5aGJpwbWxsB3zOkFVgeE4CNWqRLL1wCWG9hqfEZ7kfK53ttInuuJ0 ELEmmDcYkb3XddzE9rYXIVOrfOLe/Cg3fVItMqpQ2TU5/axrpiQU/NDbLPOIA9NX71WKB1F lfG+buaxCHK/15wa0tB/Q== X-UI-Out-Filterresults: notjunk:1;V01:K0:tS8wH5tjOTg=:718jPLvfvDB+TI7zNA2bE8 t4YZQtnUpCS/NO9yPjgv7HXmoFkRKjO63cR4FRFVhRyQPcmuY+hXirg5GI/bKmQEmaXgq8rR2 adD5UxPc971bMWDm8EKxgnTbtWDHhHqCrcjzkyk1M1GGwox8GGj1xtfjcnbf/SGvFgxTtxZcM RxsVRsYSQHOtR9mH1XGq0rcB3ULkGS/yNAPHj2Mx95Hol9IykXWVbAdJHs1rM18MzBySrD3eB /r995cq7cWK7xPGkhyFDtQ768n/TuwWvFekDmCIse///wOFqze8Ob46cWFWfP5Qnp4NCe/q43 XYRHmia61x/5JZ8aZD4ilNa++JlualkQ5QPLBmUqox1SnBteJ636MCTt6hDlgzrwHNxqpT6LV hPU+i9X1GByMGoTx2YIYGYkrINEC2dJ4LllIJsvRaE/8XJGyEjwiIYouQXIzc2ZJZFPIZhuLa sUC17Y80efnlySqhz18PC9QRX1CtQw5gitzLRd8vgY0y1k6HR7IURKQvRg331QjYrwI8aj6pn cHlUYRPTNUWStZRF6xwqWaj6YpiEOcMRZpf9GfhoZ9Koy/3s3rYr3C/dRscjJusklmvTNhWXq JfYJHa85StXBDDXHlDiAKDE+owwduZowaKPxP9Auw+TmFbQbXnZzHojxtY7dAcTPPowdJDorC XTGUZ/w/M70Rk+2hur4JOnhDoWp0O+EU3BYWTgO1dKsQxqg== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3147 Lines: 84 On Friday 03 July 2015 16:17:16 Ludovic Desroches wrote: > Introduce driver for he Atmel SDMMC available on sama5d2. It is a sdhci > compliant controller. > > Signed-off-by: Ludovic Desroches > --- > .../devicetree/bindings/mmc/sdhci-atmel.txt | 21 +++ > drivers/mmc/host/Kconfig | 8 + > drivers/mmc/host/Makefile | 1 + > drivers/mmc/host/sdhci-of-at91.c | 188 +++++++++++++++++++++ > 4 files changed, 218 insertions(+) > create mode 100644 Documentation/devicetree/bindings/mmc/sdhci-atmel.txt > create mode 100644 drivers/mmc/host/sdhci-of-at91.c > > diff --git a/Documentation/devicetree/bindings/mmc/sdhci-atmel.txt b/Documentation/devicetree/bindings/mmc/sdhci-atmel.txt > new file mode 100644 > index 0000000..1b662d7 > --- /dev/null > +++ b/Documentation/devicetree/bindings/mmc/sdhci-atmel.txt > @@ -0,0 +1,21 @@ > +* Atmel SDHCI controller > + > +This file documents the differences between the core properties in > +Documentation/devicetree/bindings/mmc/mmc.txt and the properties used by the > +sdhci-of-at91 driver. > + > +Required properties: > +- compatible: Must be "atmel,sama5d2-sdhci". > +- clocks: Phandlers to the clocks. > +- clock-names: Must be "hclock", "multclk", "baseclk"; > + Are you sure that these are all new clocks that are unrelated to the "core", "mmc", and "iface" clocks that are used in other drivers? > + > + priv->mainck = devm_clk_get(&pdev->dev, "baseclk"); > + if (IS_ERR(priv->mainck)) { > + dev_err(&pdev->dev, "failed to get baseclk\n"); > + return PTR_ERR(priv->mainck); > + } > + > + priv->hclock = devm_clk_get(&pdev->dev, "hclock"); > + if (IS_ERR(priv->hclock)) { > + dev_err(&pdev->dev, "failed to get hclock\n"); > + return PTR_ERR(priv->hclock); > + } > + > + priv->gck = devm_clk_get(&pdev->dev, "multclk"); > + if (IS_ERR(priv->gck)) { > + dev_err(&pdev->dev, "failed to get multclk\n"); > + return PTR_ERR(priv->gck); > + } > + > + host = sdhci_pltfm_init(pdev, soc_data, 0); > + if (IS_ERR(host)) > + return PTR_ERR(host); > + > + /* > + * The mult clock is provided by as a generated clock by the PMC > + * controller. In order to set the rate of gck, we have to get the > + * base clock rate and the clock mult from capabilities. > + */ > + clk_prepare_enable(priv->hclock); > + caps0 = readl(host->ioaddr + SDHCI_CAPABILITIES); > + caps1 = readl(host->ioaddr + SDHCI_CAPABILITIES_1); > + clk_base = (caps0 & SDHCI_CLOCK_V3_BASE_MASK) >> SDHCI_CLOCK_BASE_SHIFT; > + clk_mul = (caps1 & SDHCI_CLOCK_MUL_MASK) >> SDHCI_CLOCK_MUL_SHIFT; > + gck_rate = clk_base * 1000000 * (clk_mul + 1); > + ret = clk_set_rate(priv->gck, gck_rate); > + if (ret < 0) { > + dev_err(&pdev->dev, "failed to set gck"); > + goto hclock_disable_unprepare; > + return -EINVAL; > + } Could this be shared with other drivers? Arnd -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/