linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Roger Quadros <rogerq@ti.com>
To: Andy Green <andy.green@linaro.org>
Cc: stern@rowland.harvard.edu, linux-omap@vger.kernel.org,
	keshava_mgowda@ti.com, linux-usb@vger.kernel.org, balbi@ti.com
Subject: Re: [RFC PATCH 4/5] omap4: panda: add smsc95xx regulator and reset dependent on root hub
Date: Mon, 26 Nov 2012 18:20:00 +0200	[thread overview]
Message-ID: <50B396B0.4070800@ti.com> (raw)
In-Reply-To: <20121126124550.18106.29133.stgit@build.warmcat.com>

Hi Andy,

On 11/26/2012 02:45 PM, Andy Green wrote:
> This adds regulators which are controlled by the OMAP4 PandaBoard (ES)'s
> EHCI logical root hub existing.
> 
> Without power control, the ULPI PHY + SMSC9614 on the Panda eats 700-900mW
> all the time, which is around the same as the idle power of the SoC and
> rest of the board.
> 
> This allows us to start off with it depowered, and only power it if the
> ehci-hcd module is inserted.  When the module is removed, it's depowered
> again.
> 
> Signed-off-by: Andy Green <andy.green@linaro.org>
> ---
>  arch/arm/mach-omap2/Kconfig            |    1 
>  arch/arm/mach-omap2/board-omap4panda.c |   90 +++++++++++++++++++++++++-------
>  2 files changed, 72 insertions(+), 19 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
> index d669e22..5105109 100644
> --- a/arch/arm/mach-omap2/Kconfig
> +++ b/arch/arm/mach-omap2/Kconfig
> @@ -368,6 +368,7 @@ config MACH_OMAP4_PANDA
>  	select OMAP_PACKAGE_CBL
>  	select OMAP_PACKAGE_CBS
>  	select REGULATOR_FIXED_VOLTAGE if REGULATOR
> +	select USB_HUB_DEVICE_PATH_REGULATOR
>  
>  config OMAP3_EMU
>  	bool "OMAP3 debugging peripherals"
> diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c
> index bfcd397..b032b6b 100644
> --- a/arch/arm/mach-omap2/board-omap4panda.c
> +++ b/arch/arm/mach-omap2/board-omap4panda.c
> @@ -154,11 +154,6 @@ static const struct usbhs_omap_board_data usbhs_bdata __initconst = {
>  	.reset_gpio_port[2]  = -EINVAL
>  };
>  
> -static struct gpio panda_ehci_gpios[] __initdata = {
> -	{ GPIO_HUB_POWER,	GPIOF_OUT_INIT_LOW,  "hub_power"  },
> -	{ GPIO_HUB_NRESET,	GPIOF_OUT_INIT_LOW,  "hub_nreset" },
> -};
> -
>  static void __init omap4_ehci_init(void)
>  {
>  	int ret;
> @@ -173,23 +168,76 @@ static void __init omap4_ehci_init(void)
>  	clk_set_rate(phy_ref_clk, 19200000);
>  	clk_prepare_enable(phy_ref_clk);
>  
> -	/* disable the power to the usb hub prior to init and reset phy+hub */
> -	ret = gpio_request_array(panda_ehci_gpios,
> -				 ARRAY_SIZE(panda_ehci_gpios));
> -	if (ret) {
> -		pr_err("Unable to initialize EHCI power/reset\n");
> -		return;
> -	}
> +	usbhs_init(&usbhs_bdata);
> +}
>  
> -	gpio_export(GPIO_HUB_POWER, 0);
> -	gpio_export(GPIO_HUB_NRESET, 0);
> -	gpio_set_value(GPIO_HUB_NRESET, 1);
> +/*
> + * hub_nreset also resets the ULPI PHY and is required after powering SMSC chip
> + *	ULPI PHY is always powered... need to do reset once for both once
> + * hub_power enables a 3.3V regulator for (hub + eth) chip
> + *	however there's no point having ULPI PHY in use alone
> + *	since it's only connected to the (hub + eth) chip
> + */
>  
> -	usbhs_init(&usbhs_bdata);
> +static struct regulator_init_data panda_hub = {
> +	.constraints = {
> +		.name = "vhub",
> +		.valid_ops_mask = REGULATOR_CHANGE_STATUS,
> +	},
> +};
>  
> -	/* enable power to hub */
> -	gpio_set_value(GPIO_HUB_POWER, 1);
> -}
> +static struct fixed_voltage_config panda_vhub = {
> +	.supply_name = "vhub",
> +	.microvolts = 3300000,
> +	.gpio = GPIO_HUB_POWER,
> +	.startup_delay = 70000, /* 70msec */
> +	.enable_high = 1,
> +	.enabled_at_boot = 0,
> +	.init_data = &panda_hub,
> +};
> +
> +static struct platform_device omap_vhub_device = {
> +	.name		= "reg-fixed-voltage",
> +	.id		= 2,
> +	.dev = {
> +		.platform_data = &panda_vhub,
> +	},
> +};
> +
> +static struct regulator_init_data panda_ulpireset = {
> +	/*
> +	 * idea is that when operating ulpireset, regulator api will make
> +	 * sure that the hub+eth chip is powered, since it's the "parent"
> +	 */
> +	.supply_regulator = "vhub", /* we are a child of vhub */
> +	.constraints = {
> +		/*
> +		 * this magic string associates us with ehci-omap.0 root hub
> +		 * when the root hub logical device is up, we will power
> +		 * and reset [ ULPI PHY + [ HUB + ETH ] ]
> +		 */
> +		.name = "/platform/usbhs_omap/ehci-omap.0/usb*",
> +		.valid_ops_mask = REGULATOR_CHANGE_STATUS,
> +	},
> +};
> +
> +static struct fixed_voltage_config panda_vulpireset = {
> +	.supply_name = "/platform/usbhs_omap/ehci-omap.0/usb*",

Does this supply_name really needs to be the magic string?

> +	.microvolts = 3300000,
> +	.gpio = GPIO_HUB_NRESET,
> +	.startup_delay = 70000, /* 70msec */
> +	.enable_high = 1,
> +	.enabled_at_boot = 0,
> +	.init_data = &panda_ulpireset,
> +};
> +
> +static struct platform_device omap_vulpireset_device = {
> +	.name		= "reg-fixed-voltage",
> +	.id		= 3,
> +	.dev = {
> +		.platform_data = &panda_vulpireset,
> +	},
> +};
>  
>  static struct omap_musb_board_data musb_board_data = {
>  	.interface_type		= MUSB_INTERFACE_UTMI,
> @@ -503,7 +551,11 @@ static void __init omap4_panda_init(void)
>  	omap4_panda_init_rev();
>  	omap4_panda_i2c_init();
>  	platform_add_devices(panda_devices, ARRAY_SIZE(panda_devices));
> +	/* let device_path api know anything matching this reports as this */
> +	device_path_register_wildcard_path(panda_ulpireset.constraints.name);
>  	platform_device_register(&omap_vwlan_device);
> +	platform_device_register(&omap_vhub_device);
> +	platform_device_register(&omap_vulpireset_device);
>  	omap_serial_init();
>  	omap_sdrc_init(NULL, NULL);
>  	omap4_twl6030_hsmmc_init(mmc);
> 

--
cheers,
-roger

  reply	other threads:[~2012-11-26 16:20 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-26 12:45 [RFC PATCH 0/5] Device Paths introduced and applied to generic hub and panda Andy Green
2012-11-26 12:45 ` [RFC PATCH 1/5] drivers : introduce device_path api Andy Green
2012-11-26 19:12   ` Alan Stern
     [not found]     ` <Pine.LNX.4.44L0.1211261348310.2168-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2012-11-26 23:26       ` Andy Green
     [not found]   ` <20121126124534.18106.44137.stgit-Ak/hGR4SqtBG2qbu2SEcwgC/G2K4zDHf@public.gmane.org>
2012-11-26 19:16     ` Greg KH
     [not found]       ` <20121126191612.GA11239-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2012-11-26 23:28         ` Andy Green
2012-11-26 19:22   ` Greg KH
2012-11-26 19:27     ` Greg KH
2012-11-26 21:07     ` Alan Stern
2012-11-26 22:50       ` Greg KH
     [not found]       ` <Pine.LNX.4.44L0.1211261555400.2168-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2012-11-27  0:02         ` Andy Green
     [not found]           ` <50B40320.2020206-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2012-11-27 16:37             ` Alan Stern
2012-11-27 17:44               ` Andy Green
     [not found]                 ` <50B4FBE9.5080301-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2012-11-27 18:09                   ` Alan Stern
     [not found]                     ` <Pine.LNX.4.44L0.1211271253230.1489-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2012-11-27 19:22                       ` Andy Green
2012-11-27 20:10                         ` Alan Stern
     [not found]                           ` <Pine.LNX.4.44L0.1211271446430.1489-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2012-11-28  2:30                             ` Andy Green
     [not found]                         ` <50B51313.2060003-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2012-11-28 11:13                           ` Roger Quadros
2012-11-28 11:47                             ` Andy Green
2012-11-28 12:45                               ` Roger Quadros
2012-11-28 16:43                             ` Alan Stern
2012-11-29  2:05                               ` Ming Lei
2012-11-29 17:05                                 ` Alan Stern
2012-11-27  3:41       ` Ming Lei
2012-11-27 16:30         ` Alan Stern
     [not found]           ` <Pine.LNX.4.44L0.1211271119380.1489-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2012-11-27 17:02             ` Greg KH
2012-12-01  7:49               ` Jassi Brar
2012-12-01  8:37                 ` Andy Green
     [not found]                   ` <50B9C1B0.3080605-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2012-12-01 18:08                     ` Jassi Brar
     [not found]                 ` <CABb+yY3TC3z+jRU91KGX+FKLtJ3ZXUp55-wM_KjxiYuVZ+LL+Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-12-05 14:09                   ` Roger Quadros
     [not found]                     ` <50BF55B3.1030205-l0cyMroinI0@public.gmane.org>
2012-12-06 14:34                       ` Jassi Brar
2012-12-10  9:48                         ` Roger Quadros
     [not found]                           ` <50C5B003.9060904-l0cyMroinI0@public.gmane.org>
2012-12-10 14:36                             ` Felipe Balbi
2012-12-11  9:12                           ` Jassi Brar
     [not found]                             ` <CABb+yY3u2QB0JqXrznDGHXqH3crkYk54whC0GTwkBHqjdEzhbg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-12-11 10:01                               ` Roger Quadros
     [not found]                                 ` <50C70495.40500-l0cyMroinI0@public.gmane.org>
2012-12-11 10:09                                   ` Felipe Balbi
2012-11-27 17:22           ` Ming Lei
2012-11-27 17:55             ` Andy Green
     [not found]               ` <50B4FE7D.9030505-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2012-11-27 23:06                 ` Ming Lei
2012-11-28  1:16                   ` Ming Lei
2012-11-26 23:47     ` Andy Green
     [not found] ` <20121126123427.18106.4112.stgit-Ak/hGR4SqtBG2qbu2SEcwgC/G2K4zDHf@public.gmane.org>
2012-11-26 12:45   ` [RFC PATCH 2/5] usb: omap ehci: remove all regulator control from ehci omap Andy Green
2012-11-26 12:45 ` [RFC PATCH 3/5] usb: hub: add device_path regulator control to generic hub Andy Green
2012-11-26 19:23   ` Greg KH
2012-11-26 12:45 ` [RFC PATCH 4/5] omap4: panda: add smsc95xx regulator and reset dependent on root hub Andy Green
2012-11-26 16:20   ` Roger Quadros [this message]
2012-11-27  0:17     ` Andy Green
2012-11-26 12:45 ` [RFC PATCH 5/5] config omap2plus add ehci bits Andy Green

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=50B396B0.4070800@ti.com \
    --to=rogerq@ti.com \
    --cc=andy.green@linaro.org \
    --cc=balbi@ti.com \
    --cc=keshava_mgowda@ti.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    /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).