devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ulf Hansson <ulf.hansson@linaro.org>
To: Ben Hutchings <ben.hutchings@codethink.co.uk>
Cc: Ian Molton <ian@mnementh.co.uk>,
	linux-mmc <linux-mmc@vger.kernel.org>,
	Linux-sh list <linux-sh@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	linux-kernel@lists.codethink.co.uk
Subject: Re: [RFC PATCH 5/7] mmc: sh_mobile_sdhi: Add UHS-I mode support
Date: Tue, 5 May 2015 09:56:15 +0200	[thread overview]
Message-ID: <CAPDyKFodZscxZJmKgYyMV8m8mNWYc9GitkoKbixTKS5r7rv_fA@mail.gmail.com> (raw)
In-Reply-To: <1430397136.5802.44.camel@xylophone.i.decadent.org.uk>

On 30 April 2015 at 14:32, Ben Hutchings <ben.hutchings@codethink.co.uk> wrote:
> Implement voltage switch, supporting modes up to SDR-50.
>
> Based on work by Shinobu Uehara, Rob Taylor, William Towle and Ian Molton.
>
> This uses two voltage regulators, one external and one on the pfc.

Why two? If there is a parent child relation ship, that should be
handled through the regulator tree, right!? Please elaborate.

Kind regards
Uffe

>
> Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
> ---
>  drivers/mmc/host/sh_mobile_sdhi.c |   48 +++++++++++++++++++++++++++++++++++++
>  1 file changed, 48 insertions(+)
>
> diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
> index 92a58c6007fe..c8538a256e22 100644
> --- a/drivers/mmc/host/sh_mobile_sdhi.c
> +++ b/drivers/mmc/host/sh_mobile_sdhi.c
> @@ -30,6 +30,7 @@
>  #include <linux/mfd/tmio.h>
>  #include <linux/sh_dma.h>
>  #include <linux/delay.h>
> +#include <linux/regulator/consumer.h>
>
>  #include "tmio_mmc.h"
>
> @@ -84,6 +85,7 @@ MODULE_DEVICE_TABLE(of, sh_mobile_sdhi_of_match);
>
>  struct sh_mobile_sdhi {
>         struct clk *clk;
> +       struct regulator *vqmmc_ref;
>         struct tmio_mmc_data mmc_data;
>         struct tmio_mmc_dma dma_priv;
>  };
> @@ -148,6 +150,41 @@ static void sh_mobile_sdhi_set_clk_div(struct platform_device *pdev, int clk)
>         }
>  }
>
> +static int sh_mobile_sdhi_start_signal_voltage_switch(
> +       struct tmio_mmc_host *host, unsigned char signal_voltage)
> +{
> +       struct sh_mobile_sdhi *priv = host_to_priv(host);
> +       int min_uV, max_uV;
> +       int ret;
> +
> +       if (signal_voltage == MMC_SIGNAL_VOLTAGE_330) {
> +               min_uV = 2700000;
> +               max_uV = 3600000;
> +       } else if (signal_voltage == MMC_SIGNAL_VOLTAGE_180) {
> +               min_uV = 1700000;
> +               max_uV = 1950000;
> +       } else {
> +               return -EINVAL;
> +       }
> +
> +       if (!IS_ERR(host->mmc->supply.vqmmc)) {
> +               ret = regulator_set_voltage(host->mmc->supply.vqmmc,
> +                                           min_uV, max_uV);
> +               if (ret)
> +                       return ret;
> +       }
> +
> +       if (!IS_ERR(priv->vqmmc_ref)) {
> +               ret = regulator_set_voltage(priv->vqmmc_ref,
> +                                           min_uV, max_uV);
> +               if (ret)
> +                       return ret;
> +       }
> +
> +       usleep_range(5000, 5500);
> +       return 0;
> +}
> +
>  static int sh_mobile_sdhi_wait_idle(struct tmio_mmc_host *host)
>  {
>         int timeout = 1000;
> @@ -240,6 +277,13 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
>                 goto eprobe;
>         }
>
> +       priv->vqmmc_ref = devm_regulator_get_optional(&pdev->dev, "vqmmc-ref");
> +       if (IS_ERR(priv->vqmmc_ref)) {
> +               if (PTR_ERR(priv->vqmmc_ref) == -EPROBE_DEFER)
> +                       return -EPROBE_DEFER;
> +               dev_info(&pdev->dev, "No vqmmc reference regulator found\n");
> +       }
> +
>         host = tmio_mmc_host_alloc(pdev);
>         if (!host) {
>                 ret = -ENOMEM;
> @@ -253,6 +297,10 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
>         host->clk_enable        = sh_mobile_sdhi_clk_enable;
>         host->clk_disable       = sh_mobile_sdhi_clk_disable;
>         host->multi_io_quirk    = sh_mobile_sdhi_multi_io_quirk;
> +
> +       host->start_signal_voltage_switch
> +                               = sh_mobile_sdhi_start_signal_voltage_switch;
> +
>         /* SD control register space size is 0x100, 0x200 for bus_shift=1 */
>         if (resource_size(res) > 0x100)
>                 host->bus_shift = 1;
> --
> 1.7.10.4
>
>
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2015-05-05  7:56 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-30 12:29 [RFC PATCH 0/7] UHS-I support for sh_mobile_sdhi Ben Hutchings
     [not found] ` <1430396995.5802.39.camel-2NU49sBE5Aze9VDwLV8dzJPsBRI6B4nW9dF7HbQ/qKg@public.gmane.org>
2015-04-30 12:30   ` [RFC PATCH 1/7] mmc: tmio: Add UHS-I mode support Ben Hutchings
2015-05-11  3:38     ` Kuninori Morimoto
     [not found]       ` <87egmn4wfo.wl%kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
2015-05-11 14:04         ` Ben Hutchings
2015-05-11 14:10       ` Ben Hutchings
2015-04-30 12:33   ` [RFC PATCH 7/7] ARM: shmobile: r8a7790-lager.dts: Assert UHS-I SDR-50 capability Ben Hutchings
2015-04-30 16:08     ` Sergei Shtylyov
2015-04-30 12:31 ` [RFC PATCH 2/7] mmc: sh_mobile_sdhi: Add actual clock rate support Ben Hutchings
2015-04-30 16:34   ` Sergei Shtylyov
     [not found]     ` <554259A0.9030307-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>
2015-05-06  1:05       ` Ben Hutchings
2015-05-06  1:10         ` Ben Hutchings
2015-04-30 12:31 ` [RFC PATCH 3/7] pinctrl: sh-pfc: r8a7790: Add regulators for SD voltage switch Ben Hutchings
2015-05-05  7:52   ` Ulf Hansson
2015-05-06  1:12     ` Ben Hutchings
2015-04-30 12:31 ` [RFC PATCH 4/7] ARM: shmobile: r8a7790: Add nodes for pfc SD voltage regulators Ben Hutchings
2015-05-01  0:57   ` Simon Horman
2015-05-06  1:18     ` Ben Hutchings
     [not found]       ` <1430875082.4222.28.camel-2NU49sBE5Aze9VDwLV8dzJPsBRI6B4nW9dF7HbQ/qKg@public.gmane.org>
2015-05-07  4:33         ` Simon Horman
2015-04-30 12:32 ` [RFC PATCH 5/7] mmc: sh_mobile_sdhi: Add UHS-I mode support Ben Hutchings
2015-04-30 16:04   ` Sergei Shtylyov
     [not found]     ` <554252A1.6070302-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>
2015-05-06  1:41       ` Ben Hutchings
2015-05-05  7:56   ` Ulf Hansson [this message]
2015-05-05  8:35     ` [Linux-kernel] " Ben Dooks
     [not found]       ` <554880C9.8080201-4yDnlxn2s6sWdaTGBSpHTA@public.gmane.org>
2015-05-05  8:47         ` Ulf Hansson
2015-05-06  1:38           ` Ben Hutchings
2015-05-06  8:44             ` Ulf Hansson
2015-05-06 13:49               ` Ben Hutchings
2015-05-11  8:54                 ` Ulf Hansson
2015-05-11 14:01                   ` Ben Hutchings
2015-05-11 14:58                     ` Ulf Hansson
2015-04-30 12:32 ` [RFC PATCH 6/7] ARM: shmobile: r8a7790-lager.dts: Set sdhi and mmcif clock rates Ben Hutchings
2015-04-30 16:06   ` Sergei Shtylyov
2015-05-06  1:44     ` Ben Hutchings
     [not found]   ` <1430397166.5802.45.camel-2NU49sBE5Aze9VDwLV8dzJPsBRI6B4nW9dF7HbQ/qKg@public.gmane.org>
2015-05-01  0:59     ` Simon Horman
     [not found]       ` <20150501005920.GH13754-/R6kz+dDXgpPR4JQBCEnsQ@public.gmane.org>
2015-05-06  1:46         ` Ben Hutchings
2015-05-07  4:29           ` Simon Horman

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=CAPDyKFodZscxZJmKgYyMV8m8mNWYc9GitkoKbixTKS5r7rv_fA@mail.gmail.com \
    --to=ulf.hansson@linaro.org \
    --cc=ben.hutchings@codethink.co.uk \
    --cc=devicetree@vger.kernel.org \
    --cc=ian@mnementh.co.uk \
    --cc=linux-kernel@lists.codethink.co.uk \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-sh@vger.kernel.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).