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 ...
This commit is contained in:
@@ -615,6 +615,7 @@ int omap_hwmod_softreset(struct omap_hwmod *oh);
|
||||
|
||||
int omap_hwmod_count_resources(struct omap_hwmod *oh);
|
||||
int omap_hwmod_fill_resources(struct omap_hwmod *oh, struct resource *res);
|
||||
int omap_hwmod_fill_dma_resources(struct omap_hwmod *oh, struct resource *res);
|
||||
int omap_hwmod_get_resource_byname(struct omap_hwmod *oh, unsigned int type,
|
||||
const char *name, struct resource *res);
|
||||
|
||||
|
@@ -365,6 +365,14 @@ static int omap_device_build_from_dt(struct platform_device *pdev)
|
||||
goto odbfd_exit1;
|
||||
}
|
||||
|
||||
/* Fix up missing resource names */
|
||||
for (i = 0; i < pdev->num_resources; i++) {
|
||||
struct resource *r = &pdev->resource[i];
|
||||
|
||||
if (r->name == NULL)
|
||||
r->name = dev_name(&pdev->dev);
|
||||
}
|
||||
|
||||
if (of_get_property(node, "ti,no_idle_on_suspend", NULL))
|
||||
omap_device_disable_idle_on_suspend(pdev);
|
||||
|
||||
@@ -480,6 +488,33 @@ static int omap_device_fill_resources(struct omap_device *od,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* _od_fill_dma_resources - fill in array of struct resource with dma resources
|
||||
* @od: struct omap_device *
|
||||
* @res: pointer to an array of struct resource to be filled in
|
||||
*
|
||||
* Populate one or more empty struct resource pointed to by @res with
|
||||
* the dma resource data for this omap_device @od. Used by
|
||||
* omap_device_alloc() after calling omap_device_count_resources().
|
||||
*
|
||||
* Ideally this function would not be needed at all. If we have
|
||||
* mechanism to get dma resources from DT.
|
||||
*
|
||||
* Returns 0.
|
||||
*/
|
||||
static int _od_fill_dma_resources(struct omap_device *od,
|
||||
struct resource *res)
|
||||
{
|
||||
int i, r;
|
||||
|
||||
for (i = 0; i < od->hwmods_cnt; i++) {
|
||||
r = omap_hwmod_fill_dma_resources(od->hwmods[i], res);
|
||||
res += r;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* omap_device_alloc - allocate an omap_device
|
||||
* @pdev: platform_device that will be included in this omap_device
|
||||
@@ -519,24 +554,44 @@ struct omap_device *omap_device_alloc(struct platform_device *pdev,
|
||||
od->hwmods = hwmods;
|
||||
od->pdev = pdev;
|
||||
|
||||
/*
|
||||
* HACK: Ideally the resources from DT should match, and hwmod
|
||||
* should just add the missing ones. Since the name is not
|
||||
* properly populated by DT, stick to hwmod resources only.
|
||||
*/
|
||||
if (pdev->num_resources && pdev->resource)
|
||||
dev_warn(&pdev->dev, "%s(): resources already allocated %d\n",
|
||||
__func__, pdev->num_resources);
|
||||
|
||||
res_count = omap_device_count_resources(od);
|
||||
if (res_count > 0) {
|
||||
dev_dbg(&pdev->dev, "%s(): resources allocated from hwmod %d\n",
|
||||
__func__, res_count);
|
||||
/*
|
||||
* DT Boot:
|
||||
* OF framework will construct the resource structure (currently
|
||||
* does for MEM & IRQ resource) and we should respect/use these
|
||||
* resources, killing hwmod dependency.
|
||||
* If pdev->num_resources > 0, we assume that MEM & IRQ resources
|
||||
* have been allocated by OF layer already (through DTB).
|
||||
*
|
||||
* Non-DT Boot:
|
||||
* Here, pdev->num_resources = 0, and we should get all the
|
||||
* resources from hwmod.
|
||||
*
|
||||
* TODO: Once DMA resource is available from OF layer, we should
|
||||
* kill filling any resources from hwmod.
|
||||
*/
|
||||
if (res_count > pdev->num_resources) {
|
||||
/* Allocate resources memory to account for new resources */
|
||||
res = kzalloc(sizeof(struct resource) * res_count, GFP_KERNEL);
|
||||
if (!res)
|
||||
goto oda_exit3;
|
||||
|
||||
omap_device_fill_resources(od, res);
|
||||
/*
|
||||
* If pdev->num_resources > 0, then assume that,
|
||||
* MEM and IRQ resources will only come from DT and only
|
||||
* fill DMA resource from hwmod layer.
|
||||
*/
|
||||
if (pdev->num_resources && pdev->resource) {
|
||||
dev_dbg(&pdev->dev, "%s(): resources already allocated %d\n",
|
||||
__func__, res_count);
|
||||
memcpy(res, pdev->resource,
|
||||
sizeof(struct resource) * pdev->num_resources);
|
||||
_od_fill_dma_resources(od, &res[pdev->num_resources]);
|
||||
} else {
|
||||
dev_dbg(&pdev->dev, "%s(): using resources from hwmod %d\n",
|
||||
__func__, res_count);
|
||||
omap_device_fill_resources(od, res);
|
||||
}
|
||||
|
||||
ret = platform_device_add_resources(pdev, res, res_count);
|
||||
kfree(res);
|
||||
|
Referens i nytt ärende
Block a user