diff options
author | Paul Walmsley <paul@pwsan.com> | 2012-04-19 06:04:32 -0400 |
---|---|---|
committer | Paul Walmsley <paul@pwsan.com> | 2012-04-19 06:04:32 -0400 |
commit | 11cd4b94cb491894b8a192635abf159fc1917f4d (patch) | |
tree | 40f4caddf62cd8aaaefb78e1bc8d8fccd9791cdf | |
parent | 0a78c5c5963d3bb2119795f9442a3eeec3aebc1a (diff) |
ARM: OMAP: hwmod: remove code support for direct hwmod registration
Now that the data has been converted to use interface registration, we
can remove the (now unused) direct hwmod registration code.
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Cc: BenoƮt Cousson <b-cousson@ti.com>
-rw-r--r-- | arch/arm/mach-omap2/omap_hwmod.c | 124 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/plat/omap_hwmod.h | 7 |
2 files changed, 33 insertions, 98 deletions
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index 99b913aa0cb9..bf86f7e8f91f 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c | |||
@@ -173,12 +173,6 @@ static LIST_HEAD(omap_hwmod_list); | |||
173 | static struct omap_hwmod *mpu_oh; | 173 | static struct omap_hwmod *mpu_oh; |
174 | 174 | ||
175 | /* | 175 | /* |
176 | * link_registration: set to true if hwmod interfaces are being registered | ||
177 | * directly; set to false if hwmods are being registered directly | ||
178 | */ | ||
179 | static bool link_registration; | ||
180 | |||
181 | /* | ||
182 | * linkspace: ptr to a buffer that struct omap_hwmod_link records are | 176 | * linkspace: ptr to a buffer that struct omap_hwmod_link records are |
183 | * allocated from - used to reduce the number of small memory | 177 | * allocated from - used to reduce the number of small memory |
184 | * allocations, which has a significant impact on performance | 178 | * allocations, which has a significant impact on performance |
@@ -195,32 +189,22 @@ static unsigned short free_ls, max_ls, ls_supp; | |||
195 | /* Private functions */ | 189 | /* Private functions */ |
196 | 190 | ||
197 | /** | 191 | /** |
198 | * _fetch_next_ocp_if - return next OCP interface in an array or list | 192 | * _fetch_next_ocp_if - return the next OCP interface in a list |
199 | * @p: ptr to a ptr to the list_head inside the ocp_if to return | 193 | * @p: ptr to a ptr to the list_head inside the ocp_if to return |
200 | * @old: ptr to an array of struct omap_hwmod_ocp_if records | 194 | * @i: pointer to the index of the element pointed to by @p in the list |
201 | * @i: pointer to the index into the @old array | 195 | * |
202 | * | 196 | * Return a pointer to the struct omap_hwmod_ocp_if record |
203 | * Return a pointer to the next struct omap_hwmod_ocp_if record in a | 197 | * containing the struct list_head pointed to by @p, and increment |
204 | * sequence. If hwmods are being registered directly, then return a | 198 | * @p such that a future call to this routine will return the next |
205 | * struct omap_hwmod_ocp_if record corresponding to the element index | 199 | * record. |
206 | * pointed to by @i in the | ||
207 | * @old array. Otherwise, return a pointer to the struct | ||
208 | * omap_hwmod_ocp_if record containing the struct list_head record pointed | ||
209 | * to by @p, and set the pointer pointed to by @p to point to the next | ||
210 | * struct list_head record in the list. | ||
211 | */ | 200 | */ |
212 | static struct omap_hwmod_ocp_if *_fetch_next_ocp_if(struct list_head **p, | 201 | static struct omap_hwmod_ocp_if *_fetch_next_ocp_if(struct list_head **p, |
213 | struct omap_hwmod_ocp_if **old, | ||
214 | int *i) | 202 | int *i) |
215 | { | 203 | { |
216 | struct omap_hwmod_ocp_if *oi; | 204 | struct omap_hwmod_ocp_if *oi; |
217 | 205 | ||
218 | if (!link_registration) { | 206 | oi = list_entry(*p, struct omap_hwmod_link, node)->ocp_if; |
219 | oi = old[*i]; | 207 | *p = (*p)->next; |
220 | } else { | ||
221 | oi = list_entry(*p, struct omap_hwmod_link, node)->ocp_if; | ||
222 | *p = (*p)->next; | ||
223 | } | ||
224 | 208 | ||
225 | *i = *i + 1; | 209 | *i = *i + 1; |
226 | 210 | ||
@@ -642,16 +626,15 @@ static int _init_main_clk(struct omap_hwmod *oh) | |||
642 | static int _init_interface_clks(struct omap_hwmod *oh) | 626 | static int _init_interface_clks(struct omap_hwmod *oh) |
643 | { | 627 | { |
644 | struct omap_hwmod_ocp_if *os; | 628 | struct omap_hwmod_ocp_if *os; |
645 | struct list_head *p = NULL; | 629 | struct list_head *p; |
646 | struct clk *c; | 630 | struct clk *c; |
647 | int i = 0; | 631 | int i = 0; |
648 | int ret = 0; | 632 | int ret = 0; |
649 | 633 | ||
650 | if (link_registration) | 634 | p = oh->slave_ports.next; |
651 | p = oh->slave_ports.next; | ||
652 | 635 | ||
653 | while (i < oh->slaves_cnt) { | 636 | while (i < oh->slaves_cnt) { |
654 | os = _fetch_next_ocp_if(&p, oh->slaves, &i); | 637 | os = _fetch_next_ocp_if(&p, &i); |
655 | if (!os->clk) | 638 | if (!os->clk) |
656 | continue; | 639 | continue; |
657 | 640 | ||
@@ -704,7 +687,7 @@ static int _init_opt_clks(struct omap_hwmod *oh) | |||
704 | static int _enable_clocks(struct omap_hwmod *oh) | 687 | static int _enable_clocks(struct omap_hwmod *oh) |
705 | { | 688 | { |
706 | struct omap_hwmod_ocp_if *os; | 689 | struct omap_hwmod_ocp_if *os; |
707 | struct list_head *p = NULL; | 690 | struct list_head *p; |
708 | int i = 0; | 691 | int i = 0; |
709 | 692 | ||
710 | pr_debug("omap_hwmod: %s: enabling clocks\n", oh->name); | 693 | pr_debug("omap_hwmod: %s: enabling clocks\n", oh->name); |
@@ -712,11 +695,10 @@ static int _enable_clocks(struct omap_hwmod *oh) | |||
712 | if (oh->_clk) | 695 | if (oh->_clk) |
713 | clk_enable(oh->_clk); | 696 | clk_enable(oh->_clk); |
714 | 697 | ||
715 | if (link_registration) | 698 | p = oh->slave_ports.next; |
716 | p = oh->slave_ports.next; | ||
717 | 699 | ||
718 | while (i < oh->slaves_cnt) { | 700 | while (i < oh->slaves_cnt) { |
719 | os = _fetch_next_ocp_if(&p, oh->slaves, &i); | 701 | os = _fetch_next_ocp_if(&p, &i); |
720 | 702 | ||
721 | if (os->_clk && (os->flags & OCPIF_SWSUP_IDLE)) | 703 | if (os->_clk && (os->flags & OCPIF_SWSUP_IDLE)) |
722 | clk_enable(os->_clk); | 704 | clk_enable(os->_clk); |
@@ -736,7 +718,7 @@ static int _enable_clocks(struct omap_hwmod *oh) | |||
736 | static int _disable_clocks(struct omap_hwmod *oh) | 718 | static int _disable_clocks(struct omap_hwmod *oh) |
737 | { | 719 | { |
738 | struct omap_hwmod_ocp_if *os; | 720 | struct omap_hwmod_ocp_if *os; |
739 | struct list_head *p = NULL; | 721 | struct list_head *p; |
740 | int i = 0; | 722 | int i = 0; |
741 | 723 | ||
742 | pr_debug("omap_hwmod: %s: disabling clocks\n", oh->name); | 724 | pr_debug("omap_hwmod: %s: disabling clocks\n", oh->name); |
@@ -744,11 +726,10 @@ static int _disable_clocks(struct omap_hwmod *oh) | |||
744 | if (oh->_clk) | 726 | if (oh->_clk) |
745 | clk_disable(oh->_clk); | 727 | clk_disable(oh->_clk); |
746 | 728 | ||
747 | if (link_registration) | 729 | p = oh->slave_ports.next; |
748 | p = oh->slave_ports.next; | ||
749 | 730 | ||
750 | while (i < oh->slaves_cnt) { | 731 | while (i < oh->slaves_cnt) { |
751 | os = _fetch_next_ocp_if(&p, oh->slaves, &i); | 732 | os = _fetch_next_ocp_if(&p, &i); |
752 | 733 | ||
753 | if (os->_clk && (os->flags & OCPIF_SWSUP_IDLE)) | 734 | if (os->_clk && (os->flags & OCPIF_SWSUP_IDLE)) |
754 | clk_disable(os->_clk); | 735 | clk_disable(os->_clk); |
@@ -1026,12 +1007,11 @@ static int _get_addr_space_by_name(struct omap_hwmod *oh, const char *name, | |||
1026 | struct list_head *p = NULL; | 1007 | struct list_head *p = NULL; |
1027 | bool found = false; | 1008 | bool found = false; |
1028 | 1009 | ||
1029 | if (link_registration) | 1010 | p = oh->slave_ports.next; |
1030 | p = oh->slave_ports.next; | ||
1031 | 1011 | ||
1032 | i = 0; | 1012 | i = 0; |
1033 | while (i < oh->slaves_cnt) { | 1013 | while (i < oh->slaves_cnt) { |
1034 | os = _fetch_next_ocp_if(NULL, oh->slaves, &i); | 1014 | os = _fetch_next_ocp_if(&p, &i); |
1035 | 1015 | ||
1036 | if (!os->addr) | 1016 | if (!os->addr) |
1037 | return -ENOENT; | 1017 | return -ENOENT; |
@@ -1071,7 +1051,7 @@ static int _get_addr_space_by_name(struct omap_hwmod *oh, const char *name, | |||
1071 | static void __init _save_mpu_port_index(struct omap_hwmod *oh) | 1051 | static void __init _save_mpu_port_index(struct omap_hwmod *oh) |
1072 | { | 1052 | { |
1073 | struct omap_hwmod_ocp_if *os = NULL; | 1053 | struct omap_hwmod_ocp_if *os = NULL; |
1074 | struct list_head *p = NULL; | 1054 | struct list_head *p; |
1075 | int i = 0; | 1055 | int i = 0; |
1076 | 1056 | ||
1077 | if (!oh) | 1057 | if (!oh) |
@@ -1079,14 +1059,12 @@ static void __init _save_mpu_port_index(struct omap_hwmod *oh) | |||
1079 | 1059 | ||
1080 | oh->_int_flags |= _HWMOD_NO_MPU_PORT; | 1060 | oh->_int_flags |= _HWMOD_NO_MPU_PORT; |
1081 | 1061 | ||
1082 | if (link_registration) | 1062 | p = oh->slave_ports.next; |
1083 | p = oh->slave_ports.next; | ||
1084 | 1063 | ||
1085 | while (i < oh->slaves_cnt) { | 1064 | while (i < oh->slaves_cnt) { |
1086 | os = _fetch_next_ocp_if(&p, oh->slaves, &i); | 1065 | os = _fetch_next_ocp_if(&p, &i); |
1087 | if (os->user & OCP_USER_MPU) { | 1066 | if (os->user & OCP_USER_MPU) { |
1088 | oh->_mpu_port = os; | 1067 | oh->_mpu_port = os; |
1089 | oh->_mpu_port_index = i - 1; | ||
1090 | oh->_int_flags &= ~_HWMOD_NO_MPU_PORT; | 1068 | oh->_int_flags &= ~_HWMOD_NO_MPU_PORT; |
1091 | break; | 1069 | break; |
1092 | } | 1070 | } |
@@ -1113,10 +1091,7 @@ static struct omap_hwmod_ocp_if *_find_mpu_rt_port(struct omap_hwmod *oh) | |||
1113 | if (!oh || oh->_int_flags & _HWMOD_NO_MPU_PORT || oh->slaves_cnt == 0) | 1091 | if (!oh || oh->_int_flags & _HWMOD_NO_MPU_PORT || oh->slaves_cnt == 0) |
1114 | return NULL; | 1092 | return NULL; |
1115 | 1093 | ||
1116 | if (!link_registration) | 1094 | return oh->_mpu_port; |
1117 | return oh->slaves[oh->_mpu_port_index]; | ||
1118 | else | ||
1119 | return oh->_mpu_port; | ||
1120 | }; | 1095 | }; |
1121 | 1096 | ||
1122 | /** | 1097 | /** |
@@ -2104,16 +2079,15 @@ static int __init _init(struct omap_hwmod *oh, void *data) | |||
2104 | static void __init _setup_iclk_autoidle(struct omap_hwmod *oh) | 2079 | static void __init _setup_iclk_autoidle(struct omap_hwmod *oh) |
2105 | { | 2080 | { |
2106 | struct omap_hwmod_ocp_if *os; | 2081 | struct omap_hwmod_ocp_if *os; |
2107 | struct list_head *p = NULL; | 2082 | struct list_head *p; |
2108 | int i = 0; | 2083 | int i = 0; |
2109 | if (oh->_state != _HWMOD_STATE_INITIALIZED) | 2084 | if (oh->_state != _HWMOD_STATE_INITIALIZED) |
2110 | return; | 2085 | return; |
2111 | 2086 | ||
2112 | if (link_registration) | 2087 | p = oh->slave_ports.next; |
2113 | p = oh->slave_ports.next; | ||
2114 | 2088 | ||
2115 | while (i < oh->slaves_cnt) { | 2089 | while (i < oh->slaves_cnt) { |
2116 | os = _fetch_next_ocp_if(&p, oh->slaves, &i); | 2090 | os = _fetch_next_ocp_if(&p, &i); |
2117 | if (!os->_clk) | 2091 | if (!os->_clk) |
2118 | continue; | 2092 | continue; |
2119 | 2093 | ||
@@ -2584,34 +2558,6 @@ int omap_hwmod_for_each(int (*fn)(struct omap_hwmod *oh, void *data), | |||
2584 | } | 2558 | } |
2585 | 2559 | ||
2586 | /** | 2560 | /** |
2587 | * omap_hwmod_register - register an array of hwmods | ||
2588 | * @ohs: pointer to an array of omap_hwmods to register | ||
2589 | * | ||
2590 | * Intended to be called early in boot before the clock framework is | ||
2591 | * initialized. If @ohs is not null, will register all omap_hwmods | ||
2592 | * listed in @ohs that are valid for this chip. Returns 0. | ||
2593 | */ | ||
2594 | int __init omap_hwmod_register(struct omap_hwmod **ohs) | ||
2595 | { | ||
2596 | int r, i; | ||
2597 | |||
2598 | if (link_registration) | ||
2599 | return -EINVAL; | ||
2600 | |||
2601 | if (!ohs) | ||
2602 | return 0; | ||
2603 | |||
2604 | i = 0; | ||
2605 | do { | ||
2606 | r = _register(ohs[i]); | ||
2607 | WARN(r, "omap_hwmod: %s: _register returned %d\n", ohs[i]->name, | ||
2608 | r); | ||
2609 | } while (ohs[++i]); | ||
2610 | |||
2611 | return 0; | ||
2612 | } | ||
2613 | |||
2614 | /** | ||
2615 | * omap_hwmod_register_links - register an array of hwmod links | 2561 | * omap_hwmod_register_links - register an array of hwmod links |
2616 | * @ois: pointer to an array of omap_hwmod_ocp_if to register | 2562 | * @ois: pointer to an array of omap_hwmod_ocp_if to register |
2617 | * | 2563 | * |
@@ -2626,8 +2572,6 @@ int __init omap_hwmod_register_links(struct omap_hwmod_ocp_if **ois) | |||
2626 | if (!ois) | 2572 | if (!ois) |
2627 | return 0; | 2573 | return 0; |
2628 | 2574 | ||
2629 | link_registration = true; | ||
2630 | |||
2631 | if (!linkspace) { | 2575 | if (!linkspace) { |
2632 | if (_alloc_linkspace(ois)) { | 2576 | if (_alloc_linkspace(ois)) { |
2633 | pr_err("omap_hwmod: could not allocate link space\n"); | 2577 | pr_err("omap_hwmod: could not allocate link space\n"); |
@@ -2888,17 +2832,16 @@ int omap_hwmod_reset(struct omap_hwmod *oh) | |||
2888 | int omap_hwmod_count_resources(struct omap_hwmod *oh) | 2832 | int omap_hwmod_count_resources(struct omap_hwmod *oh) |
2889 | { | 2833 | { |
2890 | struct omap_hwmod_ocp_if *os; | 2834 | struct omap_hwmod_ocp_if *os; |
2891 | struct list_head *p = NULL; | 2835 | struct list_head *p; |
2892 | int ret; | 2836 | int ret; |
2893 | int i = 0; | 2837 | int i = 0; |
2894 | 2838 | ||
2895 | ret = _count_mpu_irqs(oh) + _count_sdma_reqs(oh); | 2839 | ret = _count_mpu_irqs(oh) + _count_sdma_reqs(oh); |
2896 | 2840 | ||
2897 | if (link_registration) | 2841 | p = oh->slave_ports.next; |
2898 | p = oh->slave_ports.next; | ||
2899 | 2842 | ||
2900 | while (i < oh->slaves_cnt) { | 2843 | while (i < oh->slaves_cnt) { |
2901 | os = _fetch_next_ocp_if(&p, oh->slaves, &i); | 2844 | os = _fetch_next_ocp_if(&p, &i); |
2902 | ret += _count_ocp_if_addr_spaces(os); | 2845 | ret += _count_ocp_if_addr_spaces(os); |
2903 | } | 2846 | } |
2904 | 2847 | ||
@@ -2918,7 +2861,7 @@ int omap_hwmod_count_resources(struct omap_hwmod *oh) | |||
2918 | int omap_hwmod_fill_resources(struct omap_hwmod *oh, struct resource *res) | 2861 | int omap_hwmod_fill_resources(struct omap_hwmod *oh, struct resource *res) |
2919 | { | 2862 | { |
2920 | struct omap_hwmod_ocp_if *os; | 2863 | struct omap_hwmod_ocp_if *os; |
2921 | struct list_head *p = NULL; | 2864 | struct list_head *p; |
2922 | int i, j, mpu_irqs_cnt, sdma_reqs_cnt, addr_cnt; | 2865 | int i, j, mpu_irqs_cnt, sdma_reqs_cnt, addr_cnt; |
2923 | int r = 0; | 2866 | int r = 0; |
2924 | 2867 | ||
@@ -2942,12 +2885,11 @@ int omap_hwmod_fill_resources(struct omap_hwmod *oh, struct resource *res) | |||
2942 | r++; | 2885 | r++; |
2943 | } | 2886 | } |
2944 | 2887 | ||
2945 | if (link_registration) | 2888 | p = oh->slave_ports.next; |
2946 | p = oh->slave_ports.next; | ||
2947 | 2889 | ||
2948 | i = 0; | 2890 | i = 0; |
2949 | while (i < oh->slaves_cnt) { | 2891 | while (i < oh->slaves_cnt) { |
2950 | os = _fetch_next_ocp_if(&p, oh->slaves, &i); | 2892 | os = _fetch_next_ocp_if(&p, &i); |
2951 | addr_cnt = _count_ocp_if_addr_spaces(os); | 2893 | addr_cnt = _count_ocp_if_addr_spaces(os); |
2952 | 2894 | ||
2953 | for (j = 0; j < addr_cnt; j++) { | 2895 | for (j = 0; j < addr_cnt; j++) { |
diff --git a/arch/arm/plat-omap/include/plat/omap_hwmod.h b/arch/arm/plat-omap/include/plat/omap_hwmod.h index 09679032603c..14dde32cd406 100644 --- a/arch/arm/plat-omap/include/plat/omap_hwmod.h +++ b/arch/arm/plat-omap/include/plat/omap_hwmod.h | |||
@@ -504,12 +504,9 @@ struct omap_hwmod_link { | |||
504 | * @_clk: pointer to the main struct clk (filled in at runtime) | 504 | * @_clk: pointer to the main struct clk (filled in at runtime) |
505 | * @opt_clks: other device clocks that drivers can request (0..*) | 505 | * @opt_clks: other device clocks that drivers can request (0..*) |
506 | * @voltdm: pointer to voltage domain (filled in at runtime) | 506 | * @voltdm: pointer to voltage domain (filled in at runtime) |
507 | * @masters: ptr to array of OCP ifs that this hwmod can initiate on | ||
508 | * @slaves: ptr to array of OCP ifs that this hwmod can respond on | ||
509 | * @dev_attr: arbitrary device attributes that can be passed to the driver | 507 | * @dev_attr: arbitrary device attributes that can be passed to the driver |
510 | * @_sysc_cache: internal-use hwmod flags | 508 | * @_sysc_cache: internal-use hwmod flags |
511 | * @_mpu_rt_va: cached register target start address (internal use) | 509 | * @_mpu_rt_va: cached register target start address (internal use) |
512 | * @_mpu_port_index: cached MPU register target slave ID (internal use) | ||
513 | * @_mpu_port: cached MPU register target slave (internal use) | 510 | * @_mpu_port: cached MPU register target slave (internal use) |
514 | * @opt_clks_cnt: number of @opt_clks | 511 | * @opt_clks_cnt: number of @opt_clks |
515 | * @master_cnt: number of @master entries | 512 | * @master_cnt: number of @master entries |
@@ -549,8 +546,6 @@ struct omap_hwmod { | |||
549 | struct omap_hwmod_opt_clk *opt_clks; | 546 | struct omap_hwmod_opt_clk *opt_clks; |
550 | char *clkdm_name; | 547 | char *clkdm_name; |
551 | struct clockdomain *clkdm; | 548 | struct clockdomain *clkdm; |
552 | struct omap_hwmod_ocp_if **masters; /* connect to *_IA */ | ||
553 | struct omap_hwmod_ocp_if **slaves; /* connect to *_TA */ | ||
554 | struct list_head master_ports; /* connect to *_IA */ | 549 | struct list_head master_ports; /* connect to *_IA */ |
555 | struct list_head slave_ports; /* connect to *_TA */ | 550 | struct list_head slave_ports; /* connect to *_TA */ |
556 | void *dev_attr; | 551 | void *dev_attr; |
@@ -560,7 +555,6 @@ struct omap_hwmod { | |||
560 | struct list_head node; | 555 | struct list_head node; |
561 | struct omap_hwmod_ocp_if *_mpu_port; | 556 | struct omap_hwmod_ocp_if *_mpu_port; |
562 | u16 flags; | 557 | u16 flags; |
563 | u8 _mpu_port_index; | ||
564 | u8 response_lat; | 558 | u8 response_lat; |
565 | u8 rst_lines_cnt; | 559 | u8 rst_lines_cnt; |
566 | u8 opt_clks_cnt; | 560 | u8 opt_clks_cnt; |
@@ -572,7 +566,6 @@ struct omap_hwmod { | |||
572 | u8 _postsetup_state; | 566 | u8 _postsetup_state; |
573 | }; | 567 | }; |
574 | 568 | ||
575 | int omap_hwmod_register(struct omap_hwmod **ohs); | ||
576 | struct omap_hwmod *omap_hwmod_lookup(const char *name); | 569 | struct omap_hwmod *omap_hwmod_lookup(const char *name); |
577 | int omap_hwmod_for_each(int (*fn)(struct omap_hwmod *oh, void *data), | 570 | int omap_hwmod_for_each(int (*fn)(struct omap_hwmod *oh, void *data), |
578 | void *data); | 571 | void *data); |