aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-omap
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2012-09-21 00:16:43 -0400
committerOlof Johansson <olof@lixom.net>2012-09-21 00:16:43 -0400
commitea832c41dacbc4a5f3888d9ef7c38213914aba2a (patch)
treebee97817d9a55f000e2bec5fa5d62d325050e6a6 /arch/arm/plat-omap
parentb74aae9a2074e1caa2e40bf119f3a633f77c94e4 (diff)
parent84bae6c379e362aa017efd417199f51d5c2273ac (diff)
Merge branch 'next/dt' into next/multiplatform
* next/dt: (182 commits) ARM: tegra: Add Avionic Design Tamonten Evaluation Carrier support ARM: tegra: Add Avionic Design Medcom-Wide support ARM: tegra: Add Avionic Design Plutux support ARM: tegra: Add Avionic Design Tamonten support ARM: tegra: dts: Add pwm label ARM: dt: tegra: whistler: configure power off ARM: mxs: m28evk: Disable OCOTP OUI loading ARM: imx6q: use pll2_pfd2_396m as the enfc_sel's parent ARM: dts: imx6q-sabrelite: add usbotg pinctrl support ARM: dts: imx23-olinuxino: Add USB host support ARM: dts: imx6q-sabrelite: add usbmisc device ARM: dts: mx23: Add USB resources ARM: dts: mxs: Add ethernetX to macX aliases ARM: msm: Remove non-DT targets from 8960 ARM: msm: Add DT support for 8960 ARM: msm: Move io mapping prototypes to common.h ARM: msm: Rename board-msm8x60 to signify its DT only status ARM: msm: Make 8660 a DT only target ARM: msm: Move 8660 to DT timer ARM: msm: Add DT support to msm_timer ...
Diffstat (limited to 'arch/arm/plat-omap')
-rw-r--r--arch/arm/plat-omap/include/plat/omap_hwmod.h1
-rw-r--r--arch/arm/plat-omap/omap_device.c79
2 files changed, 68 insertions, 12 deletions
diff --git a/arch/arm/plat-omap/include/plat/omap_hwmod.h b/arch/arm/plat-omap/include/plat/omap_hwmod.h
index 6132972aff37..5857b9cd6eb9 100644
--- a/arch/arm/plat-omap/include/plat/omap_hwmod.h
+++ b/arch/arm/plat-omap/include/plat/omap_hwmod.h
@@ -615,6 +615,7 @@ int omap_hwmod_softreset(struct omap_hwmod *oh);
615 615
616int omap_hwmod_count_resources(struct omap_hwmod *oh); 616int omap_hwmod_count_resources(struct omap_hwmod *oh);
617int omap_hwmod_fill_resources(struct omap_hwmod *oh, struct resource *res); 617int omap_hwmod_fill_resources(struct omap_hwmod *oh, struct resource *res);
618int omap_hwmod_fill_dma_resources(struct omap_hwmod *oh, struct resource *res);
618int omap_hwmod_get_resource_byname(struct omap_hwmod *oh, unsigned int type, 619int omap_hwmod_get_resource_byname(struct omap_hwmod *oh, unsigned int type,
619 const char *name, struct resource *res); 620 const char *name, struct resource *res);
620 621
diff --git a/arch/arm/plat-omap/omap_device.c b/arch/arm/plat-omap/omap_device.c
index b59edb065c70..2dddfc4c63af 100644
--- a/arch/arm/plat-omap/omap_device.c
+++ b/arch/arm/plat-omap/omap_device.c
@@ -365,6 +365,14 @@ static int omap_device_build_from_dt(struct platform_device *pdev)
365 goto odbfd_exit1; 365 goto odbfd_exit1;
366 } 366 }
367 367
368 /* Fix up missing resource names */
369 for (i = 0; i < pdev->num_resources; i++) {
370 struct resource *r = &pdev->resource[i];
371
372 if (r->name == NULL)
373 r->name = dev_name(&pdev->dev);
374 }
375
368 if (of_get_property(node, "ti,no_idle_on_suspend", NULL)) 376 if (of_get_property(node, "ti,no_idle_on_suspend", NULL))
369 omap_device_disable_idle_on_suspend(pdev); 377 omap_device_disable_idle_on_suspend(pdev);
370 378
@@ -481,6 +489,33 @@ static int omap_device_fill_resources(struct omap_device *od,
481} 489}
482 490
483/** 491/**
492 * _od_fill_dma_resources - fill in array of struct resource with dma resources
493 * @od: struct omap_device *
494 * @res: pointer to an array of struct resource to be filled in
495 *
496 * Populate one or more empty struct resource pointed to by @res with
497 * the dma resource data for this omap_device @od. Used by
498 * omap_device_alloc() after calling omap_device_count_resources().
499 *
500 * Ideally this function would not be needed at all. If we have
501 * mechanism to get dma resources from DT.
502 *
503 * Returns 0.
504 */
505static int _od_fill_dma_resources(struct omap_device *od,
506 struct resource *res)
507{
508 int i, r;
509
510 for (i = 0; i < od->hwmods_cnt; i++) {
511 r = omap_hwmod_fill_dma_resources(od->hwmods[i], res);
512 res += r;
513 }
514
515 return 0;
516}
517
518/**
484 * omap_device_alloc - allocate an omap_device 519 * omap_device_alloc - allocate an omap_device
485 * @pdev: platform_device that will be included in this omap_device 520 * @pdev: platform_device that will be included in this omap_device
486 * @oh: ptr to the single omap_hwmod that backs this omap_device 521 * @oh: ptr to the single omap_hwmod that backs this omap_device
@@ -519,24 +554,44 @@ struct omap_device *omap_device_alloc(struct platform_device *pdev,
519 od->hwmods = hwmods; 554 od->hwmods = hwmods;
520 od->pdev = pdev; 555 od->pdev = pdev;
521 556
557 res_count = omap_device_count_resources(od);
522 /* 558 /*
523 * HACK: Ideally the resources from DT should match, and hwmod 559 * DT Boot:
524 * should just add the missing ones. Since the name is not 560 * OF framework will construct the resource structure (currently
525 * properly populated by DT, stick to hwmod resources only. 561 * does for MEM & IRQ resource) and we should respect/use these
562 * resources, killing hwmod dependency.
563 * If pdev->num_resources > 0, we assume that MEM & IRQ resources
564 * have been allocated by OF layer already (through DTB).
565 *
566 * Non-DT Boot:
567 * Here, pdev->num_resources = 0, and we should get all the
568 * resources from hwmod.
569 *
570 * TODO: Once DMA resource is available from OF layer, we should
571 * kill filling any resources from hwmod.
526 */ 572 */
527 if (pdev->num_resources && pdev->resource) 573 if (res_count > pdev->num_resources) {
528 dev_warn(&pdev->dev, "%s(): resources already allocated %d\n", 574 /* Allocate resources memory to account for new resources */
529 __func__, pdev->num_resources);
530
531 res_count = omap_device_count_resources(od);
532 if (res_count > 0) {
533 dev_dbg(&pdev->dev, "%s(): resources allocated from hwmod %d\n",
534 __func__, res_count);
535 res = kzalloc(sizeof(struct resource) * res_count, GFP_KERNEL); 575 res = kzalloc(sizeof(struct resource) * res_count, GFP_KERNEL);
536 if (!res) 576 if (!res)
537 goto oda_exit3; 577 goto oda_exit3;
538 578
539 omap_device_fill_resources(od, res); 579 /*
580 * If pdev->num_resources > 0, then assume that,
581 * MEM and IRQ resources will only come from DT and only
582 * fill DMA resource from hwmod layer.
583 */
584 if (pdev->num_resources && pdev->resource) {
585 dev_dbg(&pdev->dev, "%s(): resources already allocated %d\n",
586 __func__, res_count);
587 memcpy(res, pdev->resource,
588 sizeof(struct resource) * pdev->num_resources);
589 _od_fill_dma_resources(od, &res[pdev->num_resources]);
590 } else {
591 dev_dbg(&pdev->dev, "%s(): using resources from hwmod %d\n",
592 __func__, res_count);
593 omap_device_fill_resources(od, res);
594 }
540 595
541 ret = platform_device_add_resources(pdev, res, res_count); 596 ret = platform_device_add_resources(pdev, res, res_count);
542 kfree(res); 597 kfree(res);