Root/target/linux/brcm47xx/patches-3.3/201-bcma-just-do-the-necessary-things-in-early-register.patch

1--- a/drivers/bcma/driver_chipcommon.c
2+++ b/drivers/bcma/driver_chipcommon.c
3@@ -22,12 +22,9 @@ static inline u32 bcma_cc_write32_masked
4     return value;
5 }
6 
7-void bcma_core_chipcommon_init(struct bcma_drv_cc *cc)
8+void bcma_core_chipcommon_early_init(struct bcma_drv_cc *cc)
9 {
10- u32 leddc_on = 10;
11- u32 leddc_off = 90;
12-
13- if (cc->setup_done)
14+ if (cc->early_setup_done)
15         return;
16 
17     if (cc->core->id.rev >= 11)
18@@ -36,6 +33,22 @@ void bcma_core_chipcommon_init(struct bc
19     if (cc->core->id.rev >= 35)
20         cc->capabilities_ext = bcma_cc_read32(cc, BCMA_CC_CAP_EXT);
21 
22+ if (cc->capabilities & BCMA_CC_CAP_PMU)
23+ bcma_pmu_early_init(cc);
24+
25+ cc->early_setup_done = true;
26+}
27+
28+void bcma_core_chipcommon_init(struct bcma_drv_cc *cc)
29+{
30+ u32 leddc_on = 10;
31+ u32 leddc_off = 90;
32+
33+ if (cc->setup_done)
34+ return;
35+
36+ bcma_core_chipcommon_early_init(cc);
37+
38     if (cc->core->id.rev >= 20) {
39         bcma_cc_write32(cc, BCMA_CC_GPIOPULLUP, 0);
40         bcma_cc_write32(cc, BCMA_CC_GPIOPULLDOWN, 0);
41--- a/drivers/bcma/driver_chipcommon_pmu.c
42+++ b/drivers/bcma/driver_chipcommon_pmu.c
43@@ -141,7 +141,7 @@ void bcma_pmu_workarounds(struct bcma_dr
44     }
45 }
46 
47-void bcma_pmu_init(struct bcma_drv_cc *cc)
48+void bcma_pmu_early_init(struct bcma_drv_cc *cc)
49 {
50     u32 pmucap;
51 
52@@ -150,7 +150,10 @@ void bcma_pmu_init(struct bcma_drv_cc *c
53 
54     bcma_debug(cc->core->bus, "Found rev %u PMU (capabilities 0x%08X)\n",
55            cc->pmu.rev, pmucap);
56+}
57 
58+void bcma_pmu_init(struct bcma_drv_cc *cc)
59+{
60     if (cc->pmu.rev == 1)
61         bcma_cc_mask32(cc, BCMA_CC_PMU_CTL,
62                   ~BCMA_CC_PMU_CTL_NOILPONW);
63--- a/drivers/bcma/driver_mips.c
64+++ b/drivers/bcma/driver_mips.c
65@@ -222,16 +222,33 @@ static void bcma_core_mips_flash_detect(
66     }
67 }
68 
69+void bcma_core_mips_early_init(struct bcma_drv_mips *mcore)
70+{
71+ struct bcma_bus *bus = mcore->core->bus;
72+
73+ if (mcore->early_setup_done)
74+ return;
75+
76+ bcma_chipco_serial_init(&bus->drv_cc);
77+ bcma_core_mips_flash_detect(mcore);
78+
79+ mcore->early_setup_done = true;
80+}
81+
82 void bcma_core_mips_init(struct bcma_drv_mips *mcore)
83 {
84     struct bcma_bus *bus;
85     struct bcma_device *core;
86     bus = mcore->core->bus;
87 
88+ if (mcore->setup_done)
89+ return;
90+
91     bcma_info(bus, "Initializing MIPS core...\n");
92 
93- if (!mcore->setup_done)
94- mcore->assigned_irqs = 1;
95+ bcma_core_mips_early_init(mcore);
96+
97+ mcore->assigned_irqs = 1;
98 
99     /* Assign IRQs to all cores on the bus */
100     list_for_each_entry(core, &bus->cores, list) {
101@@ -266,10 +283,5 @@ void bcma_core_mips_init(struct bcma_drv
102     bcma_info(bus, "IRQ reconfiguration done\n");
103     bcma_core_mips_dump_irq(bus);
104 
105- if (mcore->setup_done)
106- return;
107-
108- bcma_chipco_serial_init(&bus->drv_cc);
109- bcma_core_mips_flash_detect(mcore);
110     mcore->setup_done = true;
111 }
112--- a/drivers/bcma/main.c
113+++ b/drivers/bcma/main.c
114@@ -247,18 +247,18 @@ int __init bcma_bus_early_register(struc
115         return -1;
116     }
117 
118- /* Init CC core */
119+ /* Early init CC core */
120     core = bcma_find_core(bus, bcma_cc_core_id(bus));
121     if (core) {
122         bus->drv_cc.core = core;
123- bcma_core_chipcommon_init(&bus->drv_cc);
124+ bcma_core_chipcommon_early_init(&bus->drv_cc);
125     }
126 
127- /* Init MIPS core */
128+ /* Early init MIPS core */
129     core = bcma_find_core(bus, BCMA_CORE_MIPS_74K);
130     if (core) {
131         bus->drv_mips.core = core;
132- bcma_core_mips_init(&bus->drv_mips);
133+ bcma_core_mips_early_init(&bus->drv_mips);
134     }
135 
136     bcma_info(bus, "Early bus registered\n");
137--- a/include/linux/bcma/bcma_driver_chipcommon.h
138+++ b/include/linux/bcma/bcma_driver_chipcommon.h
139@@ -476,6 +476,7 @@ struct bcma_drv_cc {
140     u32 capabilities;
141     u32 capabilities_ext;
142     u8 setup_done:1;
143+ u8 early_setup_done:1;
144     /* Fast Powerup Delay constant */
145     u16 fast_pwrup_delay;
146     struct bcma_chipcommon_pmu pmu;
147@@ -510,6 +511,7 @@ struct bcma_drv_cc {
148     bcma_cc_write32(cc, offset, (bcma_cc_read32(cc, offset) & (mask)) | (set))
149 
150 extern void bcma_core_chipcommon_init(struct bcma_drv_cc *cc);
151+extern void bcma_core_chipcommon_early_init(struct bcma_drv_cc *cc);
152 
153 extern void bcma_chipco_suspend(struct bcma_drv_cc *cc);
154 extern void bcma_chipco_resume(struct bcma_drv_cc *cc);
155@@ -533,6 +535,7 @@ u32 bcma_chipco_gpio_polarity(struct bcm
156 
157 /* PMU support */
158 extern void bcma_pmu_init(struct bcma_drv_cc *cc);
159+extern void bcma_pmu_early_init(struct bcma_drv_cc *cc);
160 
161 extern void bcma_chipco_pll_write(struct bcma_drv_cc *cc, u32 offset,
162                   u32 value);
163--- a/include/linux/bcma/bcma_driver_mips.h
164+++ b/include/linux/bcma/bcma_driver_mips.h
165@@ -35,13 +35,16 @@ struct bcma_device;
166 struct bcma_drv_mips {
167     struct bcma_device *core;
168     u8 setup_done:1;
169+ u8 early_setup_done:1;
170     unsigned int assigned_irqs;
171 };
172 
173 #ifdef CONFIG_BCMA_DRIVER_MIPS
174 extern void bcma_core_mips_init(struct bcma_drv_mips *mcore);
175+extern void bcma_core_mips_early_init(struct bcma_drv_mips *mcore);
176 #else
177 static inline void bcma_core_mips_init(struct bcma_drv_mips *mcore) { }
178+static inline void bcma_core_mips_early_init(struct bcma_drv_mips *mcore) { }
179 #endif
180 
181 extern u32 bcma_cpu_clock(struct bcma_drv_mips *mcore);
182

Archive Download this file



interactive