diff options
author | Rafał Miłecki <zajec5@gmail.com> | 2011-07-05 13:48:26 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-07-07 13:13:34 -0400 |
commit | 9352f69c9194f1dcb3e096377e5c4804ab1bb5fb (patch) | |
tree | a7159ee211970fe0c75fa1a864c39d3ebc5c731b /drivers/bcma/driver_pci.c | |
parent | f0c717e6b7ac032e89611fa7629a1fff57e7667a (diff) |
bcma: detect PCI core working in hostmode
We must not init it like clientmode one, it would break device (tested
by Hauke on BCM4718). Add stub hostmode driver for now.
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/bcma/driver_pci.c')
-rw-r--r-- | drivers/bcma/driver_pci.c | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/drivers/bcma/driver_pci.c b/drivers/bcma/driver_pci.c index b0c19ede0d2e..dc6f34ac96a0 100644 --- a/drivers/bcma/driver_pci.c +++ b/drivers/bcma/driver_pci.c | |||
@@ -157,11 +157,47 @@ static void bcma_pcicore_serdes_workaround(struct bcma_drv_pci *pc) | |||
157 | * Init. | 157 | * Init. |
158 | **************************************************/ | 158 | **************************************************/ |
159 | 159 | ||
160 | void bcma_core_pci_init(struct bcma_drv_pci *pc) | 160 | static void bcma_core_pci_clientmode_init(struct bcma_drv_pci *pc) |
161 | { | 161 | { |
162 | bcma_pcicore_serdes_workaround(pc); | 162 | bcma_pcicore_serdes_workaround(pc); |
163 | } | 163 | } |
164 | 164 | ||
165 | static bool bcma_core_pci_is_in_hostmode(struct bcma_drv_pci *pc) | ||
166 | { | ||
167 | struct bcma_bus *bus = pc->core->bus; | ||
168 | u16 chipid_top; | ||
169 | |||
170 | chipid_top = (bus->chipinfo.id & 0xFF00); | ||
171 | if (chipid_top != 0x4700 && | ||
172 | chipid_top != 0x5300) | ||
173 | return false; | ||
174 | |||
175 | if (bus->sprom.boardflags_lo & SSB_PCICORE_BFL_NOPCI) | ||
176 | return false; | ||
177 | |||
178 | #if 0 | ||
179 | /* TODO: on BCMA we use address from EROM instead of magic formula */ | ||
180 | u32 tmp; | ||
181 | return !mips_busprobe32(tmp, (bus->mmio + | ||
182 | (pc->core->core_index * BCMA_CORE_SIZE))); | ||
183 | #endif | ||
184 | |||
185 | return true; | ||
186 | } | ||
187 | |||
188 | void bcma_core_pci_init(struct bcma_drv_pci *pc) | ||
189 | { | ||
190 | if (bcma_core_pci_is_in_hostmode(pc)) { | ||
191 | #ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE | ||
192 | bcma_core_pci_hostmode_init(pc); | ||
193 | #else | ||
194 | pr_err("Driver compiled without support for hostmode PCI\n"); | ||
195 | #endif /* CONFIG_BCMA_DRIVER_PCI_HOSTMODE */ | ||
196 | } else { | ||
197 | bcma_core_pci_clientmode_init(pc); | ||
198 | } | ||
199 | } | ||
200 | |||
165 | int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc, struct bcma_device *core, | 201 | int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc, struct bcma_device *core, |
166 | bool enable) | 202 | bool enable) |
167 | { | 203 | { |