aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2
diff options
context:
space:
mode:
authorFelipe Contreras <felipe.contreras@gmail.com>2011-02-24 15:51:33 -0500
committerTony Lindgren <tony@atomide.com>2011-02-24 15:51:33 -0500
commit69dbf857c80e9697621ecb0d4323385999449663 (patch)
tree7a547c4a6015148f36127fa2bf4e4fbfc86ba691 /arch/arm/mach-omap2
parent0f9dfdd3d76d356250595cde200efe7c07dec0a1 (diff)
OMAP: mailbox: build device using omap_device/omap_hwmod
Remove static platform_device and resource data within omap mailbox driver; use the one defined in the hwmod database along with omap_device framework for device build and registration. Add device latency functions to be used, so clock can be enabled and sysconfig is configured. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Omar Ramirez Luna <omar.ramirez@ti.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap2')
-rw-r--r--arch/arm/mach-omap2/devices.c98
-rw-r--r--arch/arm/mach-omap2/mailbox.c7
2 files changed, 19 insertions, 86 deletions
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 9ee876fd367a..d216976988d7 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -184,95 +184,29 @@ int __init omap4_keyboard_init(struct omap4_keypad_platform_data
184} 184}
185 185
186#if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE) 186#if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE)
187 187static struct omap_device_pm_latency mbox_latencies[] = {
188#define MBOX_REG_SIZE 0x120 188 [0] = {
189 189 .activate_func = omap_device_enable_hwmods,
190#ifdef CONFIG_ARCH_OMAP2 190 .deactivate_func = omap_device_idle_hwmods,
191static struct resource omap2_mbox_resources[] = { 191 .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
192 {
193 .start = OMAP24XX_MAILBOX_BASE,
194 .end = OMAP24XX_MAILBOX_BASE + MBOX_REG_SIZE - 1,
195 .flags = IORESOURCE_MEM,
196 },
197 {
198 .start = INT_24XX_MAIL_U0_MPU,
199 .flags = IORESOURCE_IRQ,
200 .name = "dsp",
201 },
202 {
203 .start = INT_24XX_MAIL_U3_MPU,
204 .flags = IORESOURCE_IRQ,
205 .name = "iva",
206 },
207};
208static int omap2_mbox_resources_sz = ARRAY_SIZE(omap2_mbox_resources);
209#else
210#define omap2_mbox_resources NULL
211#define omap2_mbox_resources_sz 0
212#endif
213
214#ifdef CONFIG_ARCH_OMAP3
215static struct resource omap3_mbox_resources[] = {
216 {
217 .start = OMAP34XX_MAILBOX_BASE,
218 .end = OMAP34XX_MAILBOX_BASE + MBOX_REG_SIZE - 1,
219 .flags = IORESOURCE_MEM,
220 },
221 {
222 .start = INT_24XX_MAIL_U0_MPU,
223 .flags = IORESOURCE_IRQ,
224 .name = "dsp",
225 },
226};
227static int omap3_mbox_resources_sz = ARRAY_SIZE(omap3_mbox_resources);
228#else
229#define omap3_mbox_resources NULL
230#define omap3_mbox_resources_sz 0
231#endif
232
233#ifdef CONFIG_ARCH_OMAP4
234
235#define OMAP4_MBOX_REG_SIZE 0x130
236static struct resource omap4_mbox_resources[] = {
237 {
238 .start = OMAP44XX_MAILBOX_BASE,
239 .end = OMAP44XX_MAILBOX_BASE +
240 OMAP4_MBOX_REG_SIZE - 1,
241 .flags = IORESOURCE_MEM,
242 },
243 {
244 .start = OMAP44XX_IRQ_MAIL_U0,
245 .flags = IORESOURCE_IRQ,
246 .name = "mbox",
247 }, 192 },
248}; 193};
249static int omap4_mbox_resources_sz = ARRAY_SIZE(omap4_mbox_resources);
250#else
251#define omap4_mbox_resources NULL
252#define omap4_mbox_resources_sz 0
253#endif
254
255static struct platform_device mbox_device = {
256 .name = "omap-mailbox",
257 .id = -1,
258};
259 194
260static inline void omap_init_mbox(void) 195static inline void omap_init_mbox(void)
261{ 196{
262 if (cpu_is_omap24xx()) { 197 struct omap_hwmod *oh;
263 mbox_device.resource = omap2_mbox_resources; 198 struct omap_device *od;
264 mbox_device.num_resources = omap2_mbox_resources_sz; 199
265 } else if (cpu_is_omap34xx()) { 200 oh = omap_hwmod_lookup("mailbox");
266 mbox_device.resource = omap3_mbox_resources; 201 if (!oh) {
267 mbox_device.num_resources = omap3_mbox_resources_sz; 202 pr_err("%s: unable to find hwmod\n", __func__);
268 } else if (cpu_is_omap44xx()) {
269 mbox_device.resource = omap4_mbox_resources;
270 mbox_device.num_resources = omap4_mbox_resources_sz;
271 } else {
272 pr_err("%s: platform not supported\n", __func__);
273 return; 203 return;
274 } 204 }
275 platform_device_register(&mbox_device); 205
206 od = omap_device_build("omap-mailbox", -1, oh, NULL, 0,
207 mbox_latencies, ARRAY_SIZE(mbox_latencies), 0);
208 WARN(IS_ERR(od), "%s: could not build device, err %ld\n",
209 __func__, PTR_ERR(od));
276} 210}
277#else 211#else
278static inline void omap_init_mbox(void) { } 212static inline void omap_init_mbox(void) { }
diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c
index 29b9dc3917af..de352bdbcd0a 100644
--- a/arch/arm/mach-omap2/mailbox.c
+++ b/arch/arm/mach-omap2/mailbox.c
@@ -398,14 +398,14 @@ static int __devinit omap2_mbox_probe(struct platform_device *pdev)
398 else if (cpu_is_omap34xx()) { 398 else if (cpu_is_omap34xx()) {
399 list = omap3_mboxes; 399 list = omap3_mboxes;
400 400
401 list[0]->irq = platform_get_irq_byname(pdev, "dsp"); 401 list[0]->irq = platform_get_irq(pdev, 0);
402 } 402 }
403#endif 403#endif
404#if defined(CONFIG_ARCH_OMAP2) 404#if defined(CONFIG_ARCH_OMAP2)
405 else if (cpu_is_omap2430()) { 405 else if (cpu_is_omap2430()) {
406 list = omap2_mboxes; 406 list = omap2_mboxes;
407 407
408 list[0]->irq = platform_get_irq_byname(pdev, "dsp"); 408 list[0]->irq = platform_get_irq(pdev, 0);
409 } else if (cpu_is_omap2420()) { 409 } else if (cpu_is_omap2420()) {
410 list = omap2_mboxes; 410 list = omap2_mboxes;
411 411
@@ -417,8 +417,7 @@ static int __devinit omap2_mbox_probe(struct platform_device *pdev)
417 else if (cpu_is_omap44xx()) { 417 else if (cpu_is_omap44xx()) {
418 list = omap4_mboxes; 418 list = omap4_mboxes;
419 419
420 list[0]->irq = list[1]->irq = 420 list[0]->irq = list[1]->irq = platform_get_irq(pdev, 0);
421 platform_get_irq_byname(pdev, "mbox");
422 } 421 }
423#endif 422#endif
424 else { 423 else {