diff options
author | Kishon Vijay Abraham I <kishon@ti.com> | 2010-09-24 12:23:18 -0400 |
---|---|---|
committer | Paul Walmsley <paul@pwsan.com> | 2010-09-24 12:23:18 -0400 |
commit | f39f4898ac72fec92066f15aef0e7485013482ea (patch) | |
tree | 3f989719e1dd77257fe05e0dcdc8c44c3f58f3d3 /arch | |
parent | 74ff3a68ed11f1e9eede4fe301f42cc3cdf7396a (diff) |
OMAP: omap_device: Fix to support multiple hwmods for a single device
Currently there is a bug in the existing omap_device core code when
extracting the hwmod structures passed to omap_device_build_ss(). This bug
gets exposed only when passing multiple hwmod structures to
omap_device_build_ss() resulting in incorrect extraction from second hwmod
structure.
This fix uses the pointer to pointer to omap_hwmod structure (array of
pointers to omap_hwmod structure) passed to omap_device_build_ss() to
correctly extract the appropriate omap_hwmod structure.
This patch has been created and tested on lo/master and mainline.
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Acked-by: Benoit Cousson <b-cousson@ti.com>
Acked-by: Kevin Hilman <khilman@deeprootsystems.com>
Cc: Charulatha V <charu@ti.com>
Cc: Shubhrajyoti D <shubhrajyoti@ti.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/plat-omap/omap_device.c | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/arch/arm/plat-omap/omap_device.c b/arch/arm/plat-omap/omap_device.c index ceba58a47595..533ad13d0d9f 100644 --- a/arch/arm/plat-omap/omap_device.c +++ b/arch/arm/plat-omap/omap_device.c | |||
@@ -296,12 +296,11 @@ static void _add_optional_clock_alias(struct omap_device *od, | |||
296 | */ | 296 | */ |
297 | int omap_device_count_resources(struct omap_device *od) | 297 | int omap_device_count_resources(struct omap_device *od) |
298 | { | 298 | { |
299 | struct omap_hwmod *oh; | ||
300 | int c = 0; | 299 | int c = 0; |
301 | int i; | 300 | int i; |
302 | 301 | ||
303 | for (i = 0, oh = *od->hwmods; i < od->hwmods_cnt; i++, oh++) | 302 | for (i = 0; i < od->hwmods_cnt; i++) |
304 | c += omap_hwmod_count_resources(oh); | 303 | c += omap_hwmod_count_resources(od->hwmods[i]); |
305 | 304 | ||
306 | pr_debug("omap_device: %s: counted %d total resources across %d " | 305 | pr_debug("omap_device: %s: counted %d total resources across %d " |
307 | "hwmods\n", od->pdev.name, c, od->hwmods_cnt); | 306 | "hwmods\n", od->pdev.name, c, od->hwmods_cnt); |
@@ -328,12 +327,11 @@ int omap_device_count_resources(struct omap_device *od) | |||
328 | */ | 327 | */ |
329 | int omap_device_fill_resources(struct omap_device *od, struct resource *res) | 328 | int omap_device_fill_resources(struct omap_device *od, struct resource *res) |
330 | { | 329 | { |
331 | struct omap_hwmod *oh; | ||
332 | int c = 0; | 330 | int c = 0; |
333 | int i, r; | 331 | int i, r; |
334 | 332 | ||
335 | for (i = 0, oh = *od->hwmods; i < od->hwmods_cnt; i++, oh++) { | 333 | for (i = 0; i < od->hwmods_cnt; i++) { |
336 | r = omap_hwmod_fill_resources(oh, res); | 334 | r = omap_hwmod_fill_resources(od->hwmods[i], res); |
337 | res += r; | 335 | res += r; |
338 | c += r; | 336 | c += r; |
339 | } | 337 | } |
@@ -607,7 +605,6 @@ int omap_device_shutdown(struct platform_device *pdev) | |||
607 | { | 605 | { |
608 | int ret, i; | 606 | int ret, i; |
609 | struct omap_device *od; | 607 | struct omap_device *od; |
610 | struct omap_hwmod *oh; | ||
611 | 608 | ||
612 | od = _find_by_pdev(pdev); | 609 | od = _find_by_pdev(pdev); |
613 | 610 | ||
@@ -620,8 +617,8 @@ int omap_device_shutdown(struct platform_device *pdev) | |||
620 | 617 | ||
621 | ret = _omap_device_deactivate(od, IGNORE_WAKEUP_LAT); | 618 | ret = _omap_device_deactivate(od, IGNORE_WAKEUP_LAT); |
622 | 619 | ||
623 | for (i = 0, oh = *od->hwmods; i < od->hwmods_cnt; i++, oh++) | 620 | for (i = 0; i < od->hwmods_cnt; i++) |
624 | omap_hwmod_shutdown(oh); | 621 | omap_hwmod_shutdown(od->hwmods[i]); |
625 | 622 | ||
626 | od->_state = OMAP_DEVICE_STATE_SHUTDOWN; | 623 | od->_state = OMAP_DEVICE_STATE_SHUTDOWN; |
627 | 624 | ||
@@ -733,11 +730,10 @@ void __iomem *omap_device_get_rt_va(struct omap_device *od) | |||
733 | */ | 730 | */ |
734 | int omap_device_enable_hwmods(struct omap_device *od) | 731 | int omap_device_enable_hwmods(struct omap_device *od) |
735 | { | 732 | { |
736 | struct omap_hwmod *oh; | ||
737 | int i; | 733 | int i; |
738 | 734 | ||
739 | for (i = 0, oh = *od->hwmods; i < od->hwmods_cnt; i++, oh++) | 735 | for (i = 0; i < od->hwmods_cnt; i++) |
740 | omap_hwmod_enable(oh); | 736 | omap_hwmod_enable(od->hwmods[i]); |
741 | 737 | ||
742 | /* XXX pass along return value here? */ | 738 | /* XXX pass along return value here? */ |
743 | return 0; | 739 | return 0; |
@@ -751,11 +747,10 @@ int omap_device_enable_hwmods(struct omap_device *od) | |||
751 | */ | 747 | */ |
752 | int omap_device_idle_hwmods(struct omap_device *od) | 748 | int omap_device_idle_hwmods(struct omap_device *od) |
753 | { | 749 | { |
754 | struct omap_hwmod *oh; | ||
755 | int i; | 750 | int i; |
756 | 751 | ||
757 | for (i = 0, oh = *od->hwmods; i < od->hwmods_cnt; i++, oh++) | 752 | for (i = 0; i < od->hwmods_cnt; i++) |
758 | omap_hwmod_idle(oh); | 753 | omap_hwmod_idle(od->hwmods[i]); |
759 | 754 | ||
760 | /* XXX pass along return value here? */ | 755 | /* XXX pass along return value here? */ |
761 | return 0; | 756 | return 0; |
@@ -770,11 +765,10 @@ int omap_device_idle_hwmods(struct omap_device *od) | |||
770 | */ | 765 | */ |
771 | int omap_device_disable_clocks(struct omap_device *od) | 766 | int omap_device_disable_clocks(struct omap_device *od) |
772 | { | 767 | { |
773 | struct omap_hwmod *oh; | ||
774 | int i; | 768 | int i; |
775 | 769 | ||
776 | for (i = 0, oh = *od->hwmods; i < od->hwmods_cnt; i++, oh++) | 770 | for (i = 0; i < od->hwmods_cnt; i++) |
777 | omap_hwmod_disable_clocks(oh); | 771 | omap_hwmod_disable_clocks(od->hwmods[i]); |
778 | 772 | ||
779 | /* XXX pass along return value here? */ | 773 | /* XXX pass along return value here? */ |
780 | return 0; | 774 | return 0; |
@@ -789,11 +783,10 @@ int omap_device_disable_clocks(struct omap_device *od) | |||
789 | */ | 783 | */ |
790 | int omap_device_enable_clocks(struct omap_device *od) | 784 | int omap_device_enable_clocks(struct omap_device *od) |
791 | { | 785 | { |
792 | struct omap_hwmod *oh; | ||
793 | int i; | 786 | int i; |
794 | 787 | ||
795 | for (i = 0, oh = *od->hwmods; i < od->hwmods_cnt; i++, oh++) | 788 | for (i = 0; i < od->hwmods_cnt; i++) |
796 | omap_hwmod_enable_clocks(oh); | 789 | omap_hwmod_enable_clocks(od->hwmods[i]); |
797 | 790 | ||
798 | /* XXX pass along return value here? */ | 791 | /* XXX pass along return value here? */ |
799 | return 0; | 792 | return 0; |