* [PATCH 4/5 v4] OMAP2+: musb: HWMOD adaptation for musb.
@ 2010-12-10 12:53 Hema HK
2010-12-10 13:02 ` Felipe Balbi
0 siblings, 1 reply; 3+ messages in thread
From: Hema HK @ 2010-12-10 12:53 UTC (permalink / raw)
To: linux-usb-u79uwXL29TY76Z2rM5mHXA,
linux-omap-u79uwXL29TY76Z2rM5mHXA
Cc: Hema HK, Felipe Balbi, Tony Lindgren, Kevin Hilman,
Cousson, Benoit, Paul Walmsley
Using omap_device_build API instead of platform_device_register for
OMAP2430,OMAP34xx and OMAP4430 musb device registration.
The device specific resources defined in centralized
database will be used.
Signed-off-by: Hema HK <hemahk-l0cyMroinI0@public.gmane.org>
Cc: Felipe Balbi <balbi-l0cyMroinI0@public.gmane.org>
Cc: Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
Cc: Kevin Hilman <khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
Cc: Cousson, Benoit <b-cousson-l0cyMroinI0@public.gmane.org>
Cc: Paul Walmsley <paul-DWxLp4Yu+b8AvxtiuMwx3w@public.gmane.org>
---
arch/arm/mach-omap2/usb-musb.c | 66 +++++++++++++++++++++++++++++++----------
1 file changed, 51 insertions(+), 15 deletions(-)
Index: usb/arch/arm/mach-omap2/usb-musb.c
===================================================================
--- usb.orig/arch/arm/mach-omap2/usb-musb.c
+++ usb/arch/arm/mach-omap2/usb-musb.c
@@ -31,9 +31,12 @@
#include <mach/am35xx.h>
#include <plat/usb.h>
#include "control.h"
+#include <plat/omap_device.h>
#if defined(CONFIG_USB_MUSB_OMAP2PLUS) || defined (CONFIG_USB_MUSB_AM35X)
+static const char name[] = "musb-omap2430";
+
static void am35x_musb_reset(void)
{
u32 regval;
@@ -170,7 +173,7 @@ static struct musb_hdrc_platform_data mu
static u64 musb_dmamask = DMA_BIT_MASK(32);
static struct platform_device musb_device = {
- .name = "musb-omap2430",
+ .name = "musb-am35x",
.id = -1,
.dev = {
.dma_mask = &musb_dmamask,
@@ -181,27 +184,40 @@ static struct platform_device musb_devic
.resource = musb_resources,
};
+static struct omap_device_pm_latency omap_musb_latency[] = {
+ {
+ .deactivate_func = omap_device_idle_hwmods,
+ .activate_func = omap_device_enable_hwmods,
+ .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
+ },
+};
+
void __init usb_musb_init(struct omap_musb_board_data *board_data)
{
- if (cpu_is_omap243x()) {
- musb_resources[0].start = OMAP243X_HS_BASE;
- } else if (cpu_is_omap3517() || cpu_is_omap3505()) {
- musb_device.name = "musb-am35x";
+ struct omap_hwmod *oh;
+ struct omap_device *od;
+ struct platform_device *pdev;
+ struct device *dev;
+ int bus_id = -1;
+ const char *oh_name = "usb_otg_hs";
+ struct musb_hdrc_platform_data *pdata;
+
+ if (cpu_is_omap3517() || cpu_is_omap3505()) {
musb_resources[0].start = AM35XX_IPSS_USBOTGSS_BASE;
musb_resources[1].start = INT_35XX_USBOTG_IRQ;
board_data->set_phy_power = am35x_musb_phy_power;
board_data->clear_irq = am35x_musb_clear_irq;
board_data->set_mode = am35x_musb_set_mode;
board_data->reset = am35x_musb_reset;
- } else if (cpu_is_omap34xx()) {
- musb_resources[0].start = OMAP34XX_HSUSB_OTG_BASE;
- } else if (cpu_is_omap44xx()) {
- musb_resources[0].start = OMAP44XX_HSUSB_OTG_BASE;
- musb_resources[1].start = OMAP44XX_IRQ_HS_USB_MC_N;
- musb_resources[2].start = OMAP44XX_IRQ_HS_USB_DMA_N;
- }
- musb_resources[0].end = musb_resources[0].start + SZ_4K - 1;
+ musb_resources[0].end = musb_resources[0].start + SZ_4K - 1;
+ } else {
+ oh = omap_hwmod_lookup(oh_name);
+ if (!oh) {
+ pr_err("Could not look up %s\n", oh_name);
+ return;
+ }
+ }
/*
* REVISIT: This line can be removed once all the platforms using
* musb_core.c have been converted to use use clkdev.
@@ -212,8 +228,28 @@ void __init usb_musb_init(struct omap_mu
musb_plat.mode = board_data->mode;
musb_plat.extvbus = board_data->extvbus;
- if (platform_device_register(&musb_device) < 0)
- printk(KERN_ERR "Unable to register HS-USB (MUSB) device\n");
+ if (cpu_is_omap3517() || cpu_is_omap3505()) {
+
+ if (platform_device_register(&musb_device) < 0)
+ printk(KERN_ERR "Unable to register HS-USB \
+ (MUSB) device\n");
+ } else {
+ pdata = &musb_plat;
+ od = omap_device_build(name, bus_id, oh, pdata,
+ sizeof(*pdata), omap_musb_latency,
+ ARRAY_SIZE(omap_musb_latency), false);
+ if (IS_ERR(od)) {
+ pr_err("Could not build omap_device for %s %s\n",
+ name, oh_name);
+ return;
+ }
+ pdev = &od->pdev;
+ dev = &pdev->dev;
+ get_device(dev);
+ dev->dma_mask = &musb_dmamask;
+ dev->coherent_dma_mask = musb_dmamask;
+ put_device(dev);
+ }
}
#else
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 4/5 v4] OMAP2+: musb: HWMOD adaptation for musb.
2010-12-10 12:53 [PATCH 4/5 v4] OMAP2+: musb: HWMOD adaptation for musb Hema HK
@ 2010-12-10 13:02 ` Felipe Balbi
2010-12-10 13:28 ` Kalliguddi, Hema
0 siblings, 1 reply; 3+ messages in thread
From: Felipe Balbi @ 2010-12-10 13:02 UTC (permalink / raw)
To: Hema HK
Cc: linux-usb, linux-omap, Felipe Balbi, Tony Lindgren, Kevin Hilman,
Cousson, Benoit, Paul Walmsley
Hi,
On Fri, Dec 10, 2010 at 06:23:10PM +0530, Hema HK wrote:
>@@ -212,8 +228,28 @@ void __init usb_musb_init(struct omap_mu
> musb_plat.mode = board_data->mode;
> musb_plat.extvbus = board_data->extvbus;
>
>- if (platform_device_register(&musb_device) < 0)
>- printk(KERN_ERR "Unable to register HS-USB (MUSB) device\n");
>+ if (cpu_is_omap3517() || cpu_is_omap3505()) {
>+
>+ if (platform_device_register(&musb_device) < 0)
>+ printk(KERN_ERR "Unable to register HS-USB \
>+ (MUSB) device\n");
>+ } else {
you can amend these two branches to the previous one. move the
platform_device_register() to the previous if (cpu_is_omap3517() ||
cpu_is_omap3505()) check. similarly with the code below.
>+ pdata = &musb_plat;
>+ od = omap_device_build(name, bus_id, oh, pdata,
>+ sizeof(*pdata), omap_musb_latency,
>+ ARRAY_SIZE(omap_musb_latency), false);
>+ if (IS_ERR(od)) {
>+ pr_err("Could not build omap_device for %s %s\n",
>+ name, oh_name);
>+ return;
>+ }
>+ pdev = &od->pdev;
>+ dev = &pdev->dev;
>+ get_device(dev);
>+ dev->dma_mask = &musb_dmamask;
>+ dev->coherent_dma_mask = musb_dmamask;
>+ put_device(dev);
>+ }
> }
>
> #else
--
balbi
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 4/5 v4] OMAP2+: musb: HWMOD adaptation for musb.
2010-12-10 13:02 ` Felipe Balbi
@ 2010-12-10 13:28 ` Kalliguddi, Hema
0 siblings, 0 replies; 3+ messages in thread
From: Kalliguddi, Hema @ 2010-12-10 13:28 UTC (permalink / raw)
To: balbi
Cc: linux-usb, linux-omap, Tony Lindgren, Kevin Hilman,
Cousson, Benoit, Paul Walmsley
On Fri, Dec 10, 2010 at 6:32 PM, Felipe Balbi <balbi@ti.com> wrote:
> Hi,
>
> On Fri, Dec 10, 2010 at 06:23:10PM +0530, Hema HK wrote:
>>
>> @@ -212,8 +228,28 @@ void __init usb_musb_init(struct omap_mu
>> musb_plat.mode = board_data->mode;
>> musb_plat.extvbus = board_data->extvbus;
>>
>> - if (platform_device_register(&musb_device) < 0)
>> - printk(KERN_ERR "Unable to register HS-USB (MUSB)
>> device\n");
>> + if (cpu_is_omap3517() || cpu_is_omap3505()) {
>> +
>> + if (platform_device_register(&musb_device) < 0)
>> + printk(KERN_ERR "Unable to register HS-USB \
>> + (MUSB) device\n");
>> + } else {
>
> you can amend these two branches to the previous one. move the
> platform_device_register() to the previous if (cpu_is_omap3517() ||
> cpu_is_omap3505()) check. similarly with the code below.
Yes... Can be done.
Regards,
Hema
>
>> + pdata = &musb_plat;
>> + od = omap_device_build(name, bus_id, oh, pdata,
>> + sizeof(*pdata), omap_musb_latency,
>> + ARRAY_SIZE(omap_musb_latency),
>> false);
>> + if (IS_ERR(od)) {
>> + pr_err("Could not build omap_device for %s %s\n",
>> + name, oh_name);
>> + return;
>> + }
>> + pdev = &od->pdev;
>> + dev = &pdev->dev;
>> + get_device(dev);
>> + dev->dma_mask = &musb_dmamask;
>> + dev->coherent_dma_mask = musb_dmamask;
>> + put_device(dev);
>> + }
>> }
>>
>> #else
>
> --
> balbi
>
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-12-10 13:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-10 12:53 [PATCH 4/5 v4] OMAP2+: musb: HWMOD adaptation for musb Hema HK
2010-12-10 13:02 ` Felipe Balbi
2010-12-10 13:28 ` Kalliguddi, Hema
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox