linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <horms@verge.net.au>
To: linux-sh@vger.kernel.org
Subject: Re: [PATCH 1/2 v2] ARM: shmobile: lager: add gpio/fixed regulator for SDHI
Date: Thu, 05 Dec 2013 06:59:39 +0000	[thread overview]
Message-ID: <20131205065937.GA29902@verge.net.au> (raw)
In-Reply-To: <878uwqo2df.wl%kuninori.morimoto.gx@renesas.com>

On Wed, Dec 04, 2013 at 10:11:06PM -0800, Kuninori Morimoto wrote:
> Fixed regulator is used for SDHI0/2 Vcc.
> We should use da9063 driver for Vccq,
> but, it doesn't have regulator support at this point.
> This patch uses gpio-regulator for it as quick-hack.
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
> v1 -> v2
> 
>  - fixup conflict on Simon branch
>  - fixup space before > 
>  arch/arm/mach-shmobile/board-lager.c |   83 +++++++++++++++++++++++++++++++++-
>  1 file changed, 82 insertions(+), 1 deletion(-)

Thanks, I will queue this up.

> 
> diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c
> index ce0ba7df..f20c10a 100644
> --- a/arch/arm/mach-shmobile/board-lager.c
> +++ b/arch/arm/mach-shmobile/board-lager.c
> @@ -31,7 +31,9 @@
>  #include <linux/platform_data/rcar-du.h>
>  #include <linux/platform_device.h>
>  #include <linux/phy.h>
> +#include <linux/regulator/driver.h>
>  #include <linux/regulator/fixed.h>
> +#include <linux/regulator/gpio-regulator.h>
>  #include <linux/regulator/machine.h>
>  #include <linux/sh_eth.h>
>  #include <mach/common.h>
> @@ -146,6 +148,71 @@ static struct regulator_consumer_supply fixed3v3_power_consumers[] >  	REGULATOR_SUPPLY("vmmc", "sh_mmcif.1"),
>  };
>  
> +/*
> + * SDHI regulator macro
> + *
> + ** FIXME**
> + * Lager board vqmmc is provided via DA9063 PMIC chip,
> + * and we should use ${LINK}/drivers/mfd/da9063-* driver for it.
> + * but, it doesn't have regulator support at this point.
> + * It uses gpio-regulator for vqmmc as quick-hack.
> + */
> +#define SDHI_REGULATOR(idx, vdd_pin, vccq_pin)				\
> +static struct regulator_consumer_supply vcc_sdhi##idx##_consumer =	\
> +	REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi." #idx);		\
> +									\
> +static struct regulator_init_data vcc_sdhi##idx##_init_data = {		\
> +	.constraints = {						\
> +		.valid_ops_mask = REGULATOR_CHANGE_STATUS,		\
> +	},								\
> +	.consumer_supplies	= &vcc_sdhi##idx##_consumer,		\
> +	.num_consumer_supplies	= 1,					\
> +};									\
> +									\
> +static const struct fixed_voltage_config vcc_sdhi##idx##_info __initconst = {\
> +	.supply_name	= "SDHI" #idx "Vcc",				\
> +	.microvolts	= 3300000,					\
> +	.gpio		= vdd_pin,					\
> +	.enable_high	= 1,						\
> +	.init_data	= &vcc_sdhi##idx##_init_data,			\
> +};									\
> +									\
> +static struct regulator_consumer_supply vccq_sdhi##idx##_consumer =	\
> +	REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi." #idx);		\
> +									\
> +static struct regulator_init_data vccq_sdhi##idx##_init_data = {	\
> +	.constraints = {						\
> +		.input_uV	= 3300000,				\
> +		.min_uV		= 1800000,				\
> +		.max_uV		= 3300000,				\
> +		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |		\
> +				  REGULATOR_CHANGE_STATUS,		\
> +	},								\
> +	.consumer_supplies	= &vccq_sdhi##idx##_consumer,		\
> +	.num_consumer_supplies	= 1,					\
> +};									\
> +									\
> +static struct gpio vccq_sdhi##idx##_gpio =				\
> +	{ vccq_pin, GPIOF_OUT_INIT_HIGH, "vccq-sdhi" #idx };		\
> +									\
> +static struct gpio_regulator_state vccq_sdhi##idx##_states[] = {	\
> +	{ .value = 1800000, .gpios = 0 },				\
> +	{ .value = 3300000, .gpios = 1 },				\
> +};									\
> +									\
> +static const struct gpio_regulator_config vccq_sdhi##idx##_info __initconst = {\
> +	.supply_name	= "vqmmc",					\
> +	.gpios		= &vccq_sdhi##idx##_gpio,			\
> +	.nr_gpios	= 1,						\
> +	.states		= vccq_sdhi##idx##_states,			\
> +	.nr_states	= ARRAY_SIZE(vccq_sdhi##idx##_states),		\
> +	.type		= REGULATOR_VOLTAGE,				\
> +	.init_data	= &vccq_sdhi##idx##_init_data,			\
> +};
> +
> +SDHI_REGULATOR(0, RCAR_GP_PIN(5, 24), RCAR_GP_PIN(5, 29));
> +SDHI_REGULATOR(2, RCAR_GP_PIN(5, 25), RCAR_GP_PIN(5, 30));
> +
>  /* MMCIF */
>  static const struct sh_mmcif_plat_data mmcif1_pdata __initconst = {
>  	.caps		= MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE,
> @@ -256,6 +323,9 @@ static const struct pinctrl_map lager_pinctrl_map[] = {
>  
>  static void __init lager_add_standard_devices(void)
>  {
> +	int fixed_regulator_idx = 0;
> +	int gpio_regulator_idx = 0;
> +
>  	r8a7790_clock_init();
>  
>  	pinctrl_register_mappings(lager_pinctrl_map,
> @@ -269,7 +339,8 @@ static void __init lager_add_standard_devices(void)
>  	platform_device_register_data(&platform_bus, "gpio-keys", -1,
>  				      &lager_keys_pdata,
>  				      sizeof(lager_keys_pdata));
> -	regulator_register_always_on(0, "fixed-3.3V", fixed3v3_power_consumers,
> +	regulator_register_always_on(fixed_regulator_idx++,
> +				     "fixed-3.3V", fixed3v3_power_consumers,
>  				     ARRAY_SIZE(fixed3v3_power_consumers), 3300000);
>  	platform_device_register_resndata(&platform_bus, "sh_mmcif", 1,
>  					  mmcif1_resources, ARRAY_SIZE(mmcif1_resources),
> @@ -287,6 +358,16 @@ static void __init lager_add_standard_devices(void)
>  					  ARRAY_SIZE(qspi_resources),
>  					  &qspi_pdata, sizeof(qspi_pdata));
>  	spi_register_board_info(spi_info, ARRAY_SIZE(spi_info));
> +
> +	platform_device_register_data(&platform_bus, "reg-fixed-voltage", fixed_regulator_idx++,
> +				      &vcc_sdhi0_info, sizeof(struct fixed_voltage_config));
> +	platform_device_register_data(&platform_bus, "reg-fixed-voltage", fixed_regulator_idx++,
> +				      &vcc_sdhi2_info, sizeof(struct fixed_voltage_config));
> +
> +	platform_device_register_data(&platform_bus, "gpio-regulator", gpio_regulator_idx++,
> +				      &vccq_sdhi0_info, sizeof(struct gpio_regulator_config));
> +	platform_device_register_data(&platform_bus, "gpio-regulator", gpio_regulator_idx++,
> +				      &vccq_sdhi2_info, sizeof(struct gpio_regulator_config));
>  }
>  
>  /*
> -- 
> 1.7.9.5
> 

  parent reply	other threads:[~2013-12-05  6:59 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-14 10:16 [PATCH 0/16] SDHI support for r8a7790 Kuninori Morimoto
2013-11-14 10:18 ` [PATCH 0/16]: gpio-rcar fixup Kuninori Morimoto
2013-11-14 10:19   ` [PATCH 01/16] gpio: rcar: use postcore_init() Kuninori Morimoto
2013-11-14 13:42     ` Laurent Pinchart
2013-11-15  0:26       ` Kuninori Morimoto
2013-11-18 13:59         ` Laurent Pinchart
2013-11-19  9:57           ` Linus Walleij
2013-11-19 12:36             ` Laurent Pinchart
2013-11-21  2:02               ` Kuninori Morimoto
2013-11-14 10:21 ` [PATCH 0/16] mmc: bug fix patches Kuninori Morimoto
2013-11-14 10:23   ` [PATCH 03/17] mmc: tmio: Fix odd size access Kuninori Morimoto
2013-11-14 13:32     ` Laurent Pinchart
2013-11-14 10:24   ` [PATCH 04/17] mmc: tmio: Add error IRQ status clear Kuninori Morimoto
2013-11-14 13:34     ` Laurent Pinchart
2013-11-14 10:24   ` [PATCH 05/17] mmc: tmio: don't overwrite caps2 Kuninori Morimoto
2013-11-14 13:36     ` Laurent Pinchart
2013-11-14 10:26 ` [PATCH 0/16] ARM: shmobile: bug fix Kuninori Morimoto
2013-11-14 10:27   ` [PATCH 06/17] ARM: shmobile: marzen: remove SDHI0 WP pin setting from DTS Kuninori Morimoto
2013-11-14 13:38     ` Laurent Pinchart
2013-11-14 10:27   ` [PATCH 07/17] ARM: shmobile: marzen: remove SDHI0 WP pin setting Kuninori Morimoto
2013-11-14 13:38     ` Laurent Pinchart
2013-11-14 10:27   ` [PATCH 08/17] ARM: shmobile: sh73a0: fixup sdhi compatible name Kuninori Morimoto
2013-11-14 13:39     ` Laurent Pinchart
2013-11-14 10:29 ` [PATCH 0/16] mmc: SDHI: add new feature Kuninori Morimoto
2013-11-14 10:30   ` [PATCH 09/17] mmc: tmio: bus_shift become tmio_mmc_data member Kuninori Morimoto
2013-11-14 10:31   ` [PATCH 10/17] mmc: tmio: add new TMIO_MMC_HAVE_HIGH_REG flags Kuninori Morimoto
2013-11-14 10:31   ` [PATCH 11/17] mmc: SDHI: add SoC specific workaround via HW version Kuninori Morimoto
2013-11-14 14:03     ` Sergei Shtylyov
2013-11-15  0:16       ` Kuninori Morimoto
2013-11-14 10:31   ` [PATCH 12/17] mmc: SDHI: tidyup sh_mobile_sdhi_of_match position Kuninori Morimoto
2013-11-14 10:32   ` [PATCH 13/17] mmc: SDHI: updata sh_mobile_sdhi_of_data for r8a7778 Kuninori Morimoto
2013-11-14 10:32   ` [PATCH 14/17] mmc: SDHI: updata sh_mobile_sdhi_of_data for r8a7779 Kuninori Morimoto
2013-11-14 10:32   ` [PATCH 15/17] mmc: SDHI: updata sh_mobile_sdhi_of_data for r8a7790 Kuninori Morimoto
2013-11-14 10:34 ` [PATCH 0/16] ARM: shmobile: SDHI support " Kuninori Morimoto
2013-11-14 10:34   ` [PATCH 16/17] ARM: shmobile: lager: add SDHI0/2 support Kuninori Morimoto
2013-11-14 10:35   ` [PATCH 17/17] ARM: shmobile: lager: use gpio/fixed regulator for SDHI Kuninori Morimoto
2013-11-14 13:51     ` Laurent Pinchart
2013-11-15  0:42       ` Kuninori Morimoto
2013-11-14 13:46   ` [PATCH 0/16] ARM: shmobile: SDHI support for r8a7790 Laurent Pinchart
2013-11-15  0:43     ` Kuninori Morimoto
2013-11-15  1:53   ` Kuninori Morimoto
2013-11-15  1:55     ` [PATCH 1/2 v2] ARM: shmobile: lager: add gpio/fixed regulator for SDHI Kuninori Morimoto
2013-11-18 11:35       ` Laurent Pinchart
2013-11-19  5:14         ` Kuninori Morimoto
2013-11-19 12:45           ` Laurent Pinchart
2013-11-20  7:37             ` Kuninori Morimoto
2013-11-20 10:57               ` Laurent Pinchart
2013-11-21  1:53                 ` Kuninori Morimoto
2013-12-05  6:11       ` Kuninori Morimoto
2013-12-05  6:59       ` Simon Horman [this message]
2014-02-12  6:25       ` [PATCH 1/2 v2] ARM: shmobile: lager: add SDHI0/2 support Kuninori Morimoto
2013-11-15  1:56     ` [PATCH 2/2 " Kuninori Morimoto
2013-11-18  7:21     ` [PATCH 0/16] ARM: shmobile: SDHI support for r8a7790 Simon Horman
2013-11-18  7:42       ` Kuninori Morimoto
2013-11-21  3:53         ` Simon Horman
2013-11-21  5:20           ` Kuninori Morimoto
2013-11-21  8:48             ` Simon Horman
2013-11-20  0:43 ` [PATCH 0/16] " Kuninori Morimoto

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=20131205065937.GA29902@verge.net.au \
    --to=horms@verge.net.au \
    --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).