All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Hilman <khilman@ti.com>
To: Keshava Munegowda <keshava_mgowda@ti.com>
Cc: <linux-usb@vger.kernel.org>, <linux-omap@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <balbi@ti.com>, <gadiyar@ti.com>,
	<sameo@linux.intel.com>, <parthab@india.ti.com>,
	<tony@atomide.com>, <b-cousson@ti.com>, <paul@pwsan.com>
Subject: Re: [PATCH 2/4] arm: omap: usb: register hwmods of usbhs
Date: Wed, 01 Jun 2011 13:01:51 -0700	[thread overview]
Message-ID: <87y61lfhhs.fsf@ti.com> (raw)
In-Reply-To: <1306934847-6098-3-git-send-email-keshava_mgowda@ti.com> (Keshava Munegowda's message of "Wed, 1 Jun 2011 18:57:25 +0530")

Hi Kesheva,

Keshava Munegowda <keshava_mgowda@ti.com> writes:

> The hwmod structure of uhh and tll are retrived
> and registered with omap device
>
> Signed-off-by: Keshava Munegowda <keshava_mgowda@ti.com>

Minor comment below...

> ---
>  arch/arm/mach-omap2/usb-host.c |   99 ++++++++++++++--------------------------
>  1 files changed, 35 insertions(+), 64 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/usb-host.c b/arch/arm/mach-omap2/usb-host.c
> index 89ae298..9d762c4 100644
> --- a/arch/arm/mach-omap2/usb-host.c
> +++ b/arch/arm/mach-omap2/usb-host.c
> @@ -28,51 +28,28 @@
>  #include <mach/hardware.h>
>  #include <mach/irqs.h>
>  #include <plat/usb.h>
> +#include <plat/omap_device.h>
>  
>  #include "mux.h"
>  
>  #ifdef CONFIG_MFD_OMAP_USB_HOST
>  
> -#define OMAP_USBHS_DEVICE	"usbhs-omap"
> -
> -static struct resource usbhs_resources[] = {
> -	{
> -		.name	= "uhh",
> -		.flags	= IORESOURCE_MEM,
> -	},
> -	{
> -		.name	= "tll",
> -		.flags	= IORESOURCE_MEM,
> -	},
> -	{
> -		.name	= "ehci",
> -		.flags	= IORESOURCE_MEM,
> -	},
> -	{
> -		.name	= "ehci-irq",
> -		.flags	= IORESOURCE_IRQ,
> -	},
> -	{
> -		.name	= "ohci",
> -		.flags	= IORESOURCE_MEM,
> -	},
> -	{
> -		.name	= "ohci-irq",
> -		.flags	= IORESOURCE_IRQ,
> -	}
> -};
> -
> -static struct platform_device usbhs_device = {
> -	.name		= OMAP_USBHS_DEVICE,
> -	.id		= 0,
> -	.num_resources	= ARRAY_SIZE(usbhs_resources),
> -	.resource	= usbhs_resources,
> -};
> +#define OMAP_USBHS_DEVICE	"usbhs_omap"
> +#define	USBHS_UHH_HWMODNAME	"usbhs_uhh"
> +#define USBHS_TLL_HWMODNAME	"usbhs_tll"
>  
>  static struct usbhs_omap_platform_data		usbhs_data;
>  static struct ehci_hcd_omap_platform_data	ehci_data;
>  static struct ohci_hcd_omap_platform_data	ohci_data;

While changing the platform_data registration, these platform_data
structs should be alloc'd and then free'd after omap_device_build, since
a copy of them is made during device registration.

Kevin

> +static struct omap_device_pm_latency omap_uhhtll_latency[] = {
> +	  {
> +		.deactivate_func = omap_device_idle_hwmods,
> +		.activate_func	 = omap_device_enable_hwmods,
> +		.flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
> +	  },
> +};
> +
>  /* MUX settings for EHCI pins */
>  /*
>   * setup_ehci_io_mux - initialize IO pad mux for USBHOST
> @@ -508,7 +485,10 @@ static void setup_4430ohci_io_mux(const enum usbhs_omap_port_mode *port_mode)
>  
>  void __init usbhs_init(const struct usbhs_omap_board_data *pdata)
>  {
> -	int	i;
> +	struct omap_hwmod	*oh[2];
> +	struct omap_device	*od;
> +	int			bus_id = -1;
> +	int			i;
>  
>  	for (i = 0; i < OMAP3_HS_USB_PORTS; i++) {
>  		usbhs_data.port_mode[i] = pdata->port_mode[i];
> @@ -523,44 +503,35 @@ void __init usbhs_init(const struct usbhs_omap_board_data *pdata)
>  	usbhs_data.ohci_data = &ohci_data;
>  
>  	if (cpu_is_omap34xx()) {
> -		usbhs_resources[0].start = OMAP34XX_UHH_CONFIG_BASE;
> -		usbhs_resources[0].end = OMAP34XX_UHH_CONFIG_BASE + SZ_1K - 1;
> -		usbhs_resources[1].start = OMAP34XX_USBTLL_BASE;
> -		usbhs_resources[1].end = OMAP34XX_USBTLL_BASE + SZ_4K - 1;
> -		usbhs_resources[2].start	= OMAP34XX_EHCI_BASE;
> -		usbhs_resources[2].end	= OMAP34XX_EHCI_BASE + SZ_1K - 1;
> -		usbhs_resources[3].start = INT_34XX_EHCI_IRQ;
> -		usbhs_resources[4].start	= OMAP34XX_OHCI_BASE;
> -		usbhs_resources[4].end	= OMAP34XX_OHCI_BASE + SZ_1K - 1;
> -		usbhs_resources[5].start = INT_34XX_OHCI_IRQ;
>  		setup_ehci_io_mux(pdata->port_mode);
>  		setup_ohci_io_mux(pdata->port_mode);
>  	} else if (cpu_is_omap44xx()) {
> -		usbhs_resources[0].start = OMAP44XX_UHH_CONFIG_BASE;
> -		usbhs_resources[0].end = OMAP44XX_UHH_CONFIG_BASE + SZ_1K - 1;
> -		usbhs_resources[1].start = OMAP44XX_USBTLL_BASE;
> -		usbhs_resources[1].end = OMAP44XX_USBTLL_BASE + SZ_4K - 1;
> -		usbhs_resources[2].start = OMAP44XX_HSUSB_EHCI_BASE;
> -		usbhs_resources[2].end = OMAP44XX_HSUSB_EHCI_BASE + SZ_1K - 1;
> -		usbhs_resources[3].start = OMAP44XX_IRQ_EHCI;
> -		usbhs_resources[4].start = OMAP44XX_HSUSB_OHCI_BASE;
> -		usbhs_resources[4].end = OMAP44XX_HSUSB_OHCI_BASE + SZ_1K - 1;
> -		usbhs_resources[5].start = OMAP44XX_IRQ_OHCI;
>  		setup_4430ehci_io_mux(pdata->port_mode);
>  		setup_4430ohci_io_mux(pdata->port_mode);
>  	}
>  
> -	if (platform_device_add_data(&usbhs_device,
> -				&usbhs_data, sizeof(usbhs_data)) < 0) {
> -		printk(KERN_ERR "USBHS platform_device_add_data failed\n");
> -		goto init_end;
> +	oh[0] = omap_hwmod_lookup(USBHS_UHH_HWMODNAME);
> +	if (!oh[0]) {
> +		pr_err("Could not look up %s\n", USBHS_UHH_HWMODNAME);
> +		return;
>  	}
>  
> -	if (platform_device_register(&usbhs_device) < 0)
> -		printk(KERN_ERR "USBHS platform_device_register failed\n");
> +	oh[1] = omap_hwmod_lookup(USBHS_TLL_HWMODNAME);
> +	if (!oh[1]) {
> +		pr_err("Could not look up %s\n", USBHS_TLL_HWMODNAME);
> +		return;
> +	}
>  
> -init_end:
> -	return;
> +	od = omap_device_build_ss(OMAP_USBHS_DEVICE, bus_id, oh, 2,
> +				(void *)&usbhs_data, sizeof(usbhs_data),
> +				omap_uhhtll_latency,
> +				ARRAY_SIZE(omap_uhhtll_latency), false);
> +
> +	if (IS_ERR(od)) {
> +		pr_err("Could not build hwmod devices %s, %s\n",
> +			USBHS_UHH_HWMODNAME, USBHS_TLL_HWMODNAME);
> +		return;
> +	}
>  }
>  
>  #else

WARNING: multiple messages have this Message-ID (diff)
From: Kevin Hilman <khilman@ti.com>
To: Keshava Munegowda <keshava_mgowda@ti.com>
Cc: linux-usb@vger.kernel.org, linux-omap@vger.kernel.org,
	linux-kernel@vger.kernel.org, balbi@ti.com, gadiyar@ti.com,
	sameo@linux.intel.com, parthab@india.ti.com, tony@atomide.com,
	b-cousson@ti.com, paul@pwsan.com
Subject: Re: [PATCH 2/4] arm: omap: usb: register hwmods of usbhs
Date: Wed, 01 Jun 2011 13:01:51 -0700	[thread overview]
Message-ID: <87y61lfhhs.fsf@ti.com> (raw)
In-Reply-To: <1306934847-6098-3-git-send-email-keshava_mgowda@ti.com> (Keshava Munegowda's message of "Wed, 1 Jun 2011 18:57:25 +0530")

Hi Kesheva,

Keshava Munegowda <keshava_mgowda@ti.com> writes:

> The hwmod structure of uhh and tll are retrived
> and registered with omap device
>
> Signed-off-by: Keshava Munegowda <keshava_mgowda@ti.com>

Minor comment below...

> ---
>  arch/arm/mach-omap2/usb-host.c |   99 ++++++++++++++--------------------------
>  1 files changed, 35 insertions(+), 64 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/usb-host.c b/arch/arm/mach-omap2/usb-host.c
> index 89ae298..9d762c4 100644
> --- a/arch/arm/mach-omap2/usb-host.c
> +++ b/arch/arm/mach-omap2/usb-host.c
> @@ -28,51 +28,28 @@
>  #include <mach/hardware.h>
>  #include <mach/irqs.h>
>  #include <plat/usb.h>
> +#include <plat/omap_device.h>
>  
>  #include "mux.h"
>  
>  #ifdef CONFIG_MFD_OMAP_USB_HOST
>  
> -#define OMAP_USBHS_DEVICE	"usbhs-omap"
> -
> -static struct resource usbhs_resources[] = {
> -	{
> -		.name	= "uhh",
> -		.flags	= IORESOURCE_MEM,
> -	},
> -	{
> -		.name	= "tll",
> -		.flags	= IORESOURCE_MEM,
> -	},
> -	{
> -		.name	= "ehci",
> -		.flags	= IORESOURCE_MEM,
> -	},
> -	{
> -		.name	= "ehci-irq",
> -		.flags	= IORESOURCE_IRQ,
> -	},
> -	{
> -		.name	= "ohci",
> -		.flags	= IORESOURCE_MEM,
> -	},
> -	{
> -		.name	= "ohci-irq",
> -		.flags	= IORESOURCE_IRQ,
> -	}
> -};
> -
> -static struct platform_device usbhs_device = {
> -	.name		= OMAP_USBHS_DEVICE,
> -	.id		= 0,
> -	.num_resources	= ARRAY_SIZE(usbhs_resources),
> -	.resource	= usbhs_resources,
> -};
> +#define OMAP_USBHS_DEVICE	"usbhs_omap"
> +#define	USBHS_UHH_HWMODNAME	"usbhs_uhh"
> +#define USBHS_TLL_HWMODNAME	"usbhs_tll"
>  
>  static struct usbhs_omap_platform_data		usbhs_data;
>  static struct ehci_hcd_omap_platform_data	ehci_data;
>  static struct ohci_hcd_omap_platform_data	ohci_data;

While changing the platform_data registration, these platform_data
structs should be alloc'd and then free'd after omap_device_build, since
a copy of them is made during device registration.

Kevin

> +static struct omap_device_pm_latency omap_uhhtll_latency[] = {
> +	  {
> +		.deactivate_func = omap_device_idle_hwmods,
> +		.activate_func	 = omap_device_enable_hwmods,
> +		.flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
> +	  },
> +};
> +
>  /* MUX settings for EHCI pins */
>  /*
>   * setup_ehci_io_mux - initialize IO pad mux for USBHOST
> @@ -508,7 +485,10 @@ static void setup_4430ohci_io_mux(const enum usbhs_omap_port_mode *port_mode)
>  
>  void __init usbhs_init(const struct usbhs_omap_board_data *pdata)
>  {
> -	int	i;
> +	struct omap_hwmod	*oh[2];
> +	struct omap_device	*od;
> +	int			bus_id = -1;
> +	int			i;
>  
>  	for (i = 0; i < OMAP3_HS_USB_PORTS; i++) {
>  		usbhs_data.port_mode[i] = pdata->port_mode[i];
> @@ -523,44 +503,35 @@ void __init usbhs_init(const struct usbhs_omap_board_data *pdata)
>  	usbhs_data.ohci_data = &ohci_data;
>  
>  	if (cpu_is_omap34xx()) {
> -		usbhs_resources[0].start = OMAP34XX_UHH_CONFIG_BASE;
> -		usbhs_resources[0].end = OMAP34XX_UHH_CONFIG_BASE + SZ_1K - 1;
> -		usbhs_resources[1].start = OMAP34XX_USBTLL_BASE;
> -		usbhs_resources[1].end = OMAP34XX_USBTLL_BASE + SZ_4K - 1;
> -		usbhs_resources[2].start	= OMAP34XX_EHCI_BASE;
> -		usbhs_resources[2].end	= OMAP34XX_EHCI_BASE + SZ_1K - 1;
> -		usbhs_resources[3].start = INT_34XX_EHCI_IRQ;
> -		usbhs_resources[4].start	= OMAP34XX_OHCI_BASE;
> -		usbhs_resources[4].end	= OMAP34XX_OHCI_BASE + SZ_1K - 1;
> -		usbhs_resources[5].start = INT_34XX_OHCI_IRQ;
>  		setup_ehci_io_mux(pdata->port_mode);
>  		setup_ohci_io_mux(pdata->port_mode);
>  	} else if (cpu_is_omap44xx()) {
> -		usbhs_resources[0].start = OMAP44XX_UHH_CONFIG_BASE;
> -		usbhs_resources[0].end = OMAP44XX_UHH_CONFIG_BASE + SZ_1K - 1;
> -		usbhs_resources[1].start = OMAP44XX_USBTLL_BASE;
> -		usbhs_resources[1].end = OMAP44XX_USBTLL_BASE + SZ_4K - 1;
> -		usbhs_resources[2].start = OMAP44XX_HSUSB_EHCI_BASE;
> -		usbhs_resources[2].end = OMAP44XX_HSUSB_EHCI_BASE + SZ_1K - 1;
> -		usbhs_resources[3].start = OMAP44XX_IRQ_EHCI;
> -		usbhs_resources[4].start = OMAP44XX_HSUSB_OHCI_BASE;
> -		usbhs_resources[4].end = OMAP44XX_HSUSB_OHCI_BASE + SZ_1K - 1;
> -		usbhs_resources[5].start = OMAP44XX_IRQ_OHCI;
>  		setup_4430ehci_io_mux(pdata->port_mode);
>  		setup_4430ohci_io_mux(pdata->port_mode);
>  	}
>  
> -	if (platform_device_add_data(&usbhs_device,
> -				&usbhs_data, sizeof(usbhs_data)) < 0) {
> -		printk(KERN_ERR "USBHS platform_device_add_data failed\n");
> -		goto init_end;
> +	oh[0] = omap_hwmod_lookup(USBHS_UHH_HWMODNAME);
> +	if (!oh[0]) {
> +		pr_err("Could not look up %s\n", USBHS_UHH_HWMODNAME);
> +		return;
>  	}
>  
> -	if (platform_device_register(&usbhs_device) < 0)
> -		printk(KERN_ERR "USBHS platform_device_register failed\n");
> +	oh[1] = omap_hwmod_lookup(USBHS_TLL_HWMODNAME);
> +	if (!oh[1]) {
> +		pr_err("Could not look up %s\n", USBHS_TLL_HWMODNAME);
> +		return;
> +	}
>  
> -init_end:
> -	return;
> +	od = omap_device_build_ss(OMAP_USBHS_DEVICE, bus_id, oh, 2,
> +				(void *)&usbhs_data, sizeof(usbhs_data),
> +				omap_uhhtll_latency,
> +				ARRAY_SIZE(omap_uhhtll_latency), false);
> +
> +	if (IS_ERR(od)) {
> +		pr_err("Could not build hwmod devices %s, %s\n",
> +			USBHS_UHH_HWMODNAME, USBHS_TLL_HWMODNAME);
> +		return;
> +	}
>  }
>  
>  #else

  parent reply	other threads:[~2011-06-01 20:01 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-01 13:27 [PATCH 0/4] arm: omap: usb: Hwmod and Runtime PM support for EHCI & OHCI Keshava Munegowda
2011-06-01 13:27 ` Keshava Munegowda
2011-06-01 13:27 ` [PATCH 1/4] arm: omap: usb: ehci and ohci hwmod structures for omap3 and omap4 Keshava Munegowda
2011-06-01 13:27   ` Keshava Munegowda
2011-06-01 13:27   ` [PATCH 2/4] arm: omap: usb: register hwmods of usbhs Keshava Munegowda
2011-06-01 13:27     ` Keshava Munegowda
2011-06-01 13:27     ` [PATCH 3/4] arm: omap: usb: device name change for the clk names " Keshava Munegowda
2011-06-01 13:27       ` Keshava Munegowda
2011-06-01 13:27       ` [PATCH 4/4] mfd: global Suspend and resume support of ehci and ohci Keshava Munegowda
2011-06-01 13:27         ` Keshava Munegowda
2011-06-01 13:31         ` Felipe Balbi
2011-06-01 13:38           ` Munegowda, Keshava
2011-06-01 13:54         ` Rafael J. Wysocki
2011-06-01 14:32           ` Felipe Balbi
2011-06-05 17:19             ` Rafael J. Wysocki
2011-06-05 18:50               ` Felipe Balbi
2011-06-05 19:30                 ` Alan Stern
2011-06-05 19:30                   ` Alan Stern
2011-06-05 19:54                   ` Felipe Balbi
2011-06-05 19:54                     ` Felipe Balbi
2011-06-06 16:06                     ` Alan Stern
2011-06-06 16:06                       ` Alan Stern
2011-06-06 17:25                       ` Felipe Balbi
2011-06-06 18:03                         ` Alan Stern
2011-06-06 18:03                           ` Alan Stern
2011-06-06  9:45                   ` Mark Brown
2011-06-06  9:45                     ` Mark Brown
2011-06-02  0:06         ` Kevin Hilman
2011-06-02  0:06           ` Kevin Hilman
2011-06-29 15:22           ` Munegowda, Keshava
2011-06-29 16:37             ` Munegowda, Keshava
2011-06-29 16:37               ` Munegowda, Keshava
2011-06-29 17:33               ` Alan Stern
2011-06-29 17:33                 ` Alan Stern
2011-06-29 18:17                 ` Partha Basak
2011-06-29 18:47                   ` Alan Stern
2011-06-29 18:47                     ` Alan Stern
2011-06-29 19:20               ` Kevin Hilman
2011-06-29 19:20                 ` Kevin Hilman
2011-06-30 12:40                 ` Munegowda, Keshava
2011-06-30 12:40                   ` Munegowda, Keshava
2011-06-01 20:05       ` [PATCH 3/4] arm: omap: usb: device name change for the clk names of usbhs Kevin Hilman
2011-06-01 20:05         ` Kevin Hilman
2011-06-01 20:01     ` Kevin Hilman [this message]
2011-06-01 20:01       ` [PATCH 2/4] arm: omap: usb: register hwmods " Kevin Hilman
2011-06-01 20:04     ` Kevin Hilman
2011-06-01 20:04       ` Kevin Hilman
2011-06-01 19:56   ` [PATCH 1/4] arm: omap: usb: ehci and ohci hwmod structures for omap3 and omap4 Kevin Hilman
2011-06-01 19:56     ` Kevin Hilman
2011-06-02  6:55     ` Munegowda, Keshava

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=87y61lfhhs.fsf@ti.com \
    --to=khilman@ti.com \
    --cc=b-cousson@ti.com \
    --cc=balbi@ti.com \
    --cc=gadiyar@ti.com \
    --cc=keshava_mgowda@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=parthab@india.ti.com \
    --cc=paul@pwsan.com \
    --cc=sameo@linux.intel.com \
    --cc=tony@atomide.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.