提交 993e4fbd 编写于 作者: O Ohad Ben-Cohen 提交者: Tony Lindgren

ARM: OMAP: omap_device: Expose omap_device_{alloc, delete, register}

Expose omap_device_{alloc, delete, register} so we can use them outside
of omap_device.c.

This approach allows users, which need to manipulate an archdata member
of a device before it is registered, to do so. This is also useful
for users who have their devices created very early so they can be used
at ->reserve() time to reserve CMA memory.

The immediate use case for this is to set the private iommu archdata
member, which binds a device to its associated iommu controller.
This way, generic code will be able to attach omap devices to their
iommus, without calling any omap-specific API.

With this in hand, we can further clean the existing mainline OMAP iommu
driver and its mainline users, and focus on generic IOMMU approaches
for future users (rpmsg/remoteproc and the upcoming generic DMA API).

This patch is still considered an interim solution until DT fully materializes
for omap; at that point, this functionality will be removed as DT will
take care of creating the devices and configuring them correctly.

Tested on OMAP4 with a generic rpmsg/remoteproc that doesn't use any
omap-specific IOMMU API anymore.
Signed-off-by: NOhad Ben-Cohen <ohad@wizery.com>
Signed-off-by: NKevin Hilman <khilman@ti.com>
Signed-off-by: NTony Lindgren <tony@atomide.com>
上级 d5171102
...@@ -100,6 +100,13 @@ struct platform_device *omap_device_build_ss(const char *pdev_name, int pdev_id, ...@@ -100,6 +100,13 @@ struct platform_device *omap_device_build_ss(const char *pdev_name, int pdev_id,
struct omap_device_pm_latency *pm_lats, struct omap_device_pm_latency *pm_lats,
int pm_lats_cnt, int is_early_device); int pm_lats_cnt, int is_early_device);
struct omap_device *omap_device_alloc(struct platform_device *pdev,
struct omap_hwmod **ohs, int oh_cnt,
struct omap_device_pm_latency *pm_lats,
int pm_lats_cnt);
void omap_device_delete(struct omap_device *od);
int omap_device_register(struct platform_device *pdev);
void __iomem *omap_device_get_rt_va(struct omap_device *od); void __iomem *omap_device_get_rt_va(struct omap_device *od);
struct device *omap_device_get_by_hwmod_name(const char *oh_name); struct device *omap_device_get_by_hwmod_name(const char *oh_name);
......
...@@ -97,14 +97,7 @@ ...@@ -97,14 +97,7 @@
#define USE_WAKEUP_LAT 0 #define USE_WAKEUP_LAT 0
#define IGNORE_WAKEUP_LAT 1 #define IGNORE_WAKEUP_LAT 1
static int omap_device_register(struct platform_device *pdev);
static int omap_early_device_register(struct platform_device *pdev); static int omap_early_device_register(struct platform_device *pdev);
static struct omap_device *omap_device_alloc(struct platform_device *pdev,
struct omap_hwmod **ohs, int oh_cnt,
struct omap_device_pm_latency *pm_lats,
int pm_lats_cnt);
static void omap_device_delete(struct omap_device *od);
static struct omap_device_pm_latency omap_default_latency[] = { static struct omap_device_pm_latency omap_default_latency[] = {
{ {
...@@ -509,7 +502,7 @@ static int omap_device_fill_resources(struct omap_device *od, ...@@ -509,7 +502,7 @@ static int omap_device_fill_resources(struct omap_device *od,
* *
* Returns an struct omap_device pointer or ERR_PTR() on error; * Returns an struct omap_device pointer or ERR_PTR() on error;
*/ */
static struct omap_device *omap_device_alloc(struct platform_device *pdev, struct omap_device *omap_device_alloc(struct platform_device *pdev,
struct omap_hwmod **ohs, int oh_cnt, struct omap_hwmod **ohs, int oh_cnt,
struct omap_device_pm_latency *pm_lats, struct omap_device_pm_latency *pm_lats,
int pm_lats_cnt) int pm_lats_cnt)
...@@ -591,7 +584,7 @@ static struct omap_device *omap_device_alloc(struct platform_device *pdev, ...@@ -591,7 +584,7 @@ static struct omap_device *omap_device_alloc(struct platform_device *pdev,
return ERR_PTR(ret); return ERR_PTR(ret);
} }
static void omap_device_delete(struct omap_device *od) void omap_device_delete(struct omap_device *od)
{ {
if (!od) if (!od)
return; return;
...@@ -817,7 +810,7 @@ static struct dev_pm_domain omap_device_pm_domain = { ...@@ -817,7 +810,7 @@ static struct dev_pm_domain omap_device_pm_domain = {
* platform_device_register() on the underlying platform_device. * platform_device_register() on the underlying platform_device.
* Returns the return value of platform_device_register(). * Returns the return value of platform_device_register().
*/ */
static int omap_device_register(struct platform_device *pdev) int omap_device_register(struct platform_device *pdev)
{ {
pr_debug("omap_device: %s: registering\n", pdev->name); pr_debug("omap_device: %s: registering\n", pdev->name);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册