diff options
author | Hema HK <hemahk@ti.com> | 2011-02-17 01:37:21 -0500 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2011-02-17 11:34:00 -0500 |
commit | 18a26892d62d2786c2b259ba4605ee10bba0ba13 (patch) | |
tree | da177af480b2fe9045f9357fc4ccce43f62db3e9 | |
parent | 273ff8c3bc04cf358c131f49ee7a11efa7ec73d7 (diff) |
OMAP2+: musb: hwmod adaptation for musb registration
Using omap_device_build API instead of platform_device_register for
OMAP2430,OMAP3xxx, OMAP4430 and AM35x musb device registration.
The device specific resources defined in centralized
database will be used.
Signed-off-by: Hema HK <hemahk@ti.com>
Cc: Tony Lindgren <tony@atomide.com>
Cc: Kevin Hilman <khilman@deeprootsystems.com>
Cc: Cousson, Benoit <b-cousson@ti.com>
Cc: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
-rw-r--r-- | arch/arm/mach-omap2/usb-musb.c | 84 |
1 files changed, 44 insertions, 40 deletions
diff --git a/arch/arm/mach-omap2/usb-musb.c b/arch/arm/mach-omap2/usb-musb.c index 9788b4941857..a9d4d143086d 100644 --- a/arch/arm/mach-omap2/usb-musb.c +++ b/arch/arm/mach-omap2/usb-musb.c | |||
@@ -30,26 +30,11 @@ | |||
30 | #include <mach/irqs.h> | 30 | #include <mach/irqs.h> |
31 | #include <mach/am35xx.h> | 31 | #include <mach/am35xx.h> |
32 | #include <plat/usb.h> | 32 | #include <plat/usb.h> |
33 | #include <plat/omap_device.h> | ||
33 | #include "mux.h" | 34 | #include "mux.h" |
34 | 35 | ||
35 | #if defined(CONFIG_USB_MUSB_OMAP2PLUS) || defined (CONFIG_USB_MUSB_AM35X) | 36 | #if defined(CONFIG_USB_MUSB_OMAP2PLUS) || defined (CONFIG_USB_MUSB_AM35X) |
36 | 37 | ||
37 | static struct resource musb_resources[] = { | ||
38 | [0] = { /* start and end set dynamically */ | ||
39 | .flags = IORESOURCE_MEM, | ||
40 | }, | ||
41 | [1] = { /* general IRQ */ | ||
42 | .start = INT_243X_HS_USB_MC, | ||
43 | .flags = IORESOURCE_IRQ, | ||
44 | .name = "mc", | ||
45 | }, | ||
46 | [2] = { /* DMA IRQ */ | ||
47 | .start = INT_243X_HS_USB_DMA, | ||
48 | .flags = IORESOURCE_IRQ, | ||
49 | .name = "dma", | ||
50 | }, | ||
51 | }; | ||
52 | |||
53 | static struct musb_hdrc_config musb_config = { | 38 | static struct musb_hdrc_config musb_config = { |
54 | .multipoint = 1, | 39 | .multipoint = 1, |
55 | .dyn_fifo = 1, | 40 | .dyn_fifo = 1, |
@@ -77,16 +62,12 @@ static struct musb_hdrc_platform_data musb_plat = { | |||
77 | 62 | ||
78 | static u64 musb_dmamask = DMA_BIT_MASK(32); | 63 | static u64 musb_dmamask = DMA_BIT_MASK(32); |
79 | 64 | ||
80 | static struct platform_device musb_device = { | 65 | static struct omap_device_pm_latency omap_musb_latency[] = { |
81 | .name = "musb-omap2430", | 66 | { |
82 | .id = -1, | 67 | .deactivate_func = omap_device_idle_hwmods, |
83 | .dev = { | 68 | .activate_func = omap_device_enable_hwmods, |
84 | .dma_mask = &musb_dmamask, | 69 | .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST, |
85 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
86 | .platform_data = &musb_plat, | ||
87 | }, | 70 | }, |
88 | .num_resources = ARRAY_SIZE(musb_resources), | ||
89 | .resource = musb_resources, | ||
90 | }; | 71 | }; |
91 | 72 | ||
92 | static void usb_musb_mux_init(struct omap_musb_board_data *board_data) | 73 | static void usb_musb_mux_init(struct omap_musb_board_data *board_data) |
@@ -126,24 +107,20 @@ static void usb_musb_mux_init(struct omap_musb_board_data *board_data) | |||
126 | break; | 107 | break; |
127 | } | 108 | } |
128 | } | 109 | } |
110 | |||
129 | void __init usb_musb_init(struct omap_musb_board_data *board_data) | 111 | void __init usb_musb_init(struct omap_musb_board_data *board_data) |
130 | { | 112 | { |
131 | if (cpu_is_omap243x()) { | 113 | struct omap_hwmod *oh; |
132 | musb_resources[0].start = OMAP243X_HS_BASE; | 114 | struct omap_device *od; |
133 | } else if (cpu_is_omap3517() || cpu_is_omap3505()) { | 115 | struct platform_device *pdev; |
134 | musb_device.name = "musb-am35x"; | 116 | struct device *dev; |
135 | musb_resources[0].start = AM35XX_IPSS_USBOTGSS_BASE; | 117 | int bus_id = -1; |
136 | musb_resources[1].start = INT_35XX_USBOTG_IRQ; | 118 | const char *oh_name, *name; |
137 | } else if (cpu_is_omap34xx()) { | ||
138 | musb_resources[0].start = OMAP34XX_HSUSB_OTG_BASE; | ||
139 | } else if (cpu_is_omap44xx()) { | ||
140 | musb_resources[0].start = OMAP44XX_HSUSB_OTG_BASE; | ||
141 | musb_resources[1].start = OMAP44XX_IRQ_HS_USB_MC_N; | ||
142 | musb_resources[2].start = OMAP44XX_IRQ_HS_USB_DMA_N; | ||
143 | 119 | ||
120 | if (cpu_is_omap3517() || cpu_is_omap3505()) { | ||
121 | } else if (cpu_is_omap44xx()) { | ||
144 | usb_musb_mux_init(board_data); | 122 | usb_musb_mux_init(board_data); |
145 | } | 123 | } |
146 | musb_resources[0].end = musb_resources[0].start + SZ_4K - 1; | ||
147 | 124 | ||
148 | /* | 125 | /* |
149 | * REVISIT: This line can be removed once all the platforms using | 126 | * REVISIT: This line can be removed once all the platforms using |
@@ -155,8 +132,35 @@ void __init usb_musb_init(struct omap_musb_board_data *board_data) | |||
155 | musb_plat.mode = board_data->mode; | 132 | musb_plat.mode = board_data->mode; |
156 | musb_plat.extvbus = board_data->extvbus; | 133 | musb_plat.extvbus = board_data->extvbus; |
157 | 134 | ||
158 | if (platform_device_register(&musb_device) < 0) | 135 | if (cpu_is_omap3517() || cpu_is_omap3505()) { |
159 | printk(KERN_ERR "Unable to register HS-USB (MUSB) device\n"); | 136 | oh_name = "am35x_otg_hs"; |
137 | name = "musb-am35x"; | ||
138 | } else { | ||
139 | oh_name = "usb_otg_hs"; | ||
140 | name = "musb-omap2430"; | ||
141 | } | ||
142 | |||
143 | oh = omap_hwmod_lookup(oh_name); | ||
144 | if (!oh) { | ||
145 | pr_err("Could not look up %s\n", oh_name); | ||
146 | return; | ||
147 | } | ||
148 | |||
149 | od = omap_device_build(name, bus_id, oh, &musb_plat, | ||
150 | sizeof(musb_plat), omap_musb_latency, | ||
151 | ARRAY_SIZE(omap_musb_latency), false); | ||
152 | if (IS_ERR(od)) { | ||
153 | pr_err("Could not build omap_device for %s %s\n", | ||
154 | name, oh_name); | ||
155 | return; | ||
156 | } | ||
157 | |||
158 | pdev = &od->pdev; | ||
159 | dev = &pdev->dev; | ||
160 | get_device(dev); | ||
161 | dev->dma_mask = &musb_dmamask; | ||
162 | dev->coherent_dma_mask = musb_dmamask; | ||
163 | put_device(dev); | ||
160 | } | 164 | } |
161 | 165 | ||
162 | #else | 166 | #else |