aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorThara Gopinath <thara@ti.com>2010-02-24 14:05:58 -0500
committerPaul Walmsley <paul@pwsan.com>2010-02-24 14:05:58 -0500
commitc23a97d377077c67e01f7526de3a411b316ee4f6 (patch)
tree84020f6b04f236f89e2bf08cbefc092de4485542 /arch
parent358f0e630d5409ab3837b86db3595560eae773b6 (diff)
OMAP: HWMOD: Add support for early device register into omap device layer
This patch adds support in omap device layer to register devices as early platform devices. Certain devices needed during system boot up like timers, gpio etc can be registered as early devices. This will allow for them to be probed very early on during system boot up. This patch adds a parameter is_early_device in omap_device_build. Depending on this parameter a call to early_platform_add_devices or platform_register_device is made. Signed-off-by: Thara Gopinath <thara@ti.com> Signed-off-by: Paul Walmsley <paul@pwsan.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/plat-omap/include/plat/omap_device.h5
-rw-r--r--arch/arm/plat-omap/omap_device.c33
2 files changed, 32 insertions, 6 deletions
diff --git a/arch/arm/plat-omap/include/plat/omap_device.h b/arch/arm/plat-omap/include/plat/omap_device.h
index 4677ff7d3ab5..3694b622c4ac 100644
--- a/arch/arm/plat-omap/include/plat/omap_device.h
+++ b/arch/arm/plat-omap/include/plat/omap_device.h
@@ -90,15 +90,16 @@ struct omap_device *omap_device_build(const char *pdev_name, int pdev_id,
90 struct omap_hwmod *oh, void *pdata, 90 struct omap_hwmod *oh, void *pdata,
91 int pdata_len, 91 int pdata_len,
92 struct omap_device_pm_latency *pm_lats, 92 struct omap_device_pm_latency *pm_lats,
93 int pm_lats_cnt); 93 int pm_lats_cnt, int is_early_device);
94 94
95struct omap_device *omap_device_build_ss(const char *pdev_name, int pdev_id, 95struct omap_device *omap_device_build_ss(const char *pdev_name, int pdev_id,
96 struct omap_hwmod **oh, int oh_cnt, 96 struct omap_hwmod **oh, int oh_cnt,
97 void *pdata, int pdata_len, 97 void *pdata, int pdata_len,
98 struct omap_device_pm_latency *pm_lats, 98 struct omap_device_pm_latency *pm_lats,
99 int pm_lats_cnt); 99 int pm_lats_cnt, int is_early_device);
100 100
101int omap_device_register(struct omap_device *od); 101int omap_device_register(struct omap_device *od);
102int omap_early_device_register(struct omap_device *od);
102 103
103/* OMAP PM interface */ 104/* OMAP PM interface */
104int omap_device_align_pm_lat(struct platform_device *pdev, 105int omap_device_align_pm_lat(struct platform_device *pdev,
diff --git a/arch/arm/plat-omap/omap_device.c b/arch/arm/plat-omap/omap_device.c
index c739a046cc02..590435894848 100644
--- a/arch/arm/plat-omap/omap_device.c
+++ b/arch/arm/plat-omap/omap_device.c
@@ -307,6 +307,7 @@ int omap_device_fill_resources(struct omap_device *od, struct resource *res)
307 * @pdata_len: amount of memory pointed to by @pdata 307 * @pdata_len: amount of memory pointed to by @pdata
308 * @pm_lats: pointer to a omap_device_pm_latency array for this device 308 * @pm_lats: pointer to a omap_device_pm_latency array for this device
309 * @pm_lats_cnt: ARRAY_SIZE() of @pm_lats 309 * @pm_lats_cnt: ARRAY_SIZE() of @pm_lats
310 * @is_early_device: should the device be registered as an early device or not
310 * 311 *
311 * Convenience function for building and registering a single 312 * Convenience function for building and registering a single
312 * omap_device record, which in turn builds and registers a 313 * omap_device record, which in turn builds and registers a
@@ -318,7 +319,7 @@ struct omap_device *omap_device_build(const char *pdev_name, int pdev_id,
318 struct omap_hwmod *oh, void *pdata, 319 struct omap_hwmod *oh, void *pdata,
319 int pdata_len, 320 int pdata_len,
320 struct omap_device_pm_latency *pm_lats, 321 struct omap_device_pm_latency *pm_lats,
321 int pm_lats_cnt) 322 int pm_lats_cnt, int is_early_device)
322{ 323{
323 struct omap_hwmod *ohs[] = { oh }; 324 struct omap_hwmod *ohs[] = { oh };
324 325
@@ -326,7 +327,8 @@ struct omap_device *omap_device_build(const char *pdev_name, int pdev_id,
326 return ERR_PTR(-EINVAL); 327 return ERR_PTR(-EINVAL);
327 328
328 return omap_device_build_ss(pdev_name, pdev_id, ohs, 1, pdata, 329 return omap_device_build_ss(pdev_name, pdev_id, ohs, 1, pdata,
329 pdata_len, pm_lats, pm_lats_cnt); 330 pdata_len, pm_lats, pm_lats_cnt,
331 is_early_device);
330} 332}
331 333
332/** 334/**
@@ -338,6 +340,7 @@ struct omap_device *omap_device_build(const char *pdev_name, int pdev_id,
338 * @pdata_len: amount of memory pointed to by @pdata 340 * @pdata_len: amount of memory pointed to by @pdata
339 * @pm_lats: pointer to a omap_device_pm_latency array for this device 341 * @pm_lats: pointer to a omap_device_pm_latency array for this device
340 * @pm_lats_cnt: ARRAY_SIZE() of @pm_lats 342 * @pm_lats_cnt: ARRAY_SIZE() of @pm_lats
343 * @is_early_device: should the device be registered as an early device or not
341 * 344 *
342 * Convenience function for building and registering an omap_device 345 * Convenience function for building and registering an omap_device
343 * subsystem record. Subsystem records consist of multiple 346 * subsystem record. Subsystem records consist of multiple
@@ -349,7 +352,7 @@ struct omap_device *omap_device_build_ss(const char *pdev_name, int pdev_id,
349 struct omap_hwmod **ohs, int oh_cnt, 352 struct omap_hwmod **ohs, int oh_cnt,
350 void *pdata, int pdata_len, 353 void *pdata, int pdata_len,
351 struct omap_device_pm_latency *pm_lats, 354 struct omap_device_pm_latency *pm_lats,
352 int pm_lats_cnt) 355 int pm_lats_cnt, int is_early_device)
353{ 356{
354 int ret = -ENOMEM; 357 int ret = -ENOMEM;
355 struct omap_device *od; 358 struct omap_device *od;
@@ -407,7 +410,11 @@ struct omap_device *omap_device_build_ss(const char *pdev_name, int pdev_id,
407 410
408 od->magic = OMAP_DEVICE_MAGIC; 411 od->magic = OMAP_DEVICE_MAGIC;
409 412
410 ret = omap_device_register(od); 413 if (is_early_device)
414 ret = omap_early_device_register(od);
415 else
416 ret = omap_device_register(od);
417
411 if (ret) 418 if (ret)
412 goto odbs_exit4; 419 goto odbs_exit4;
413 420
@@ -428,6 +435,24 @@ odbs_exit1:
428} 435}
429 436
430/** 437/**
438 * omap_early_device_register - register an omap_device as an early platform
439 * device.
440 * @od: struct omap_device * to register
441 *
442 * Register the omap_device structure. This currently just calls
443 * platform_early_add_device() on the underlying platform_device.
444 * Returns 0 by default.
445 */
446int omap_early_device_register(struct omap_device *od)
447{
448 struct platform_device *devices[1];
449
450 devices[0] = &(od->pdev);
451 early_platform_add_devices(devices, 1);
452 return 0;
453}
454
455/**
431 * omap_device_register - register an omap_device with one omap_hwmod 456 * omap_device_register - register an omap_device with one omap_hwmod
432 * @od: struct omap_device * to register 457 * @od: struct omap_device * to register
433 * 458 *