devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Ludovic Desroches <ludovic.desroches@atmel.com>
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	[thread overview]
Message-ID: <8304633.2ajieYmcMU@wuerfel> (raw)
In-Reply-To: <1435933037-12889-3-git-send-email-ludovic.desroches@atmel.com>

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 <ludovic.desroches@atmel.com>
> ---
>  .../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

  parent reply	other threads:[~2015-07-04 20:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-03 14:17 [PATCH 0/3] introduce driver for the Atmel SDMMC Ludovic Desroches
     [not found] ` <1435933037-12889-1-git-send-email-ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
2015-07-03 14:17   ` [PATCH 1/3] mmc: sdhci: switch from programmable clock mode to divided one if needed Ludovic Desroches
2015-07-03 14:17   ` [PATCH 2/3] mmc: sdhci-of-at91: introduce driver for the Atmel SDMMC Ludovic Desroches
2015-07-04  8:30     ` Paul Bolle
2015-07-06  7:33       ` Ludovic Desroches
2015-07-04 20:06     ` Arnd Bergmann [this message]
2015-07-06  7:33       ` Ludovic Desroches
2015-07-03 14:17 ` [PATCH 3/3] MAINTAINERS: add entry for Atmel sdhci-of-at91 driver Ludovic Desroches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8304633.2ajieYmcMU@wuerfel \
    --to=arnd@arndb.de \
    --cc=alexandre.belloni@free-electrons.com \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=ludovic.desroches@atmel.com \
    --cc=nicolas.ferre@atmel.com \
    --cc=ulf.hansson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).