diff options
author | Rafał Miłecki <zajec5@gmail.com> | 2015-02-08 11:11:49 -0500 |
---|---|---|
committer | Kalle Valo <kvalo@codeaurora.org> | 2015-03-02 09:59:45 -0500 |
commit | 804e27dee49e20c0addd1b7276654220cc3768ae (patch) | |
tree | dadc462a8498a33903aa528c860790f86a35a49c /drivers/bcma | |
parent | 5b6ff664c8959d715e785b9465b042407a5d87a0 (diff) |
bcma: support bringing up bus hosted on PCIe Gen 2
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Diffstat (limited to 'drivers/bcma')
-rw-r--r-- | drivers/bcma/bcma_private.h | 3 | ||||
-rw-r--r-- | drivers/bcma/driver_pcie2.c | 28 | ||||
-rw-r--r-- | drivers/bcma/host_pci.c | 2 |
3 files changed, 30 insertions, 3 deletions
diff --git a/drivers/bcma/bcma_private.h b/drivers/bcma/bcma_private.h index 351f4afdad25..36929126a206 100644 --- a/drivers/bcma/bcma_private.h +++ b/drivers/bcma/bcma_private.h | |||
@@ -104,6 +104,9 @@ u32 bcma_pcie_read(struct bcma_drv_pci *pc, u32 address); | |||
104 | void bcma_core_pci_up(struct bcma_drv_pci *pc); | 104 | void bcma_core_pci_up(struct bcma_drv_pci *pc); |
105 | void bcma_core_pci_down(struct bcma_drv_pci *pc); | 105 | void bcma_core_pci_down(struct bcma_drv_pci *pc); |
106 | 106 | ||
107 | /* driver_pcie2.c */ | ||
108 | void bcma_core_pcie2_up(struct bcma_drv_pcie2 *pcie2); | ||
109 | |||
107 | extern int bcma_chipco_watchdog_register(struct bcma_drv_cc *cc); | 110 | extern int bcma_chipco_watchdog_register(struct bcma_drv_cc *cc); |
108 | 111 | ||
109 | #ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE | 112 | #ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE |
diff --git a/drivers/bcma/driver_pcie2.c b/drivers/bcma/driver_pcie2.c index e4be537b0c66..4568bc7bd54a 100644 --- a/drivers/bcma/driver_pcie2.c +++ b/drivers/bcma/driver_pcie2.c | |||
@@ -156,14 +156,23 @@ static void pciedev_reg_pm_clk_period(struct bcma_drv_pcie2 *pcie2) | |||
156 | 156 | ||
157 | void bcma_core_pcie2_init(struct bcma_drv_pcie2 *pcie2) | 157 | void bcma_core_pcie2_init(struct bcma_drv_pcie2 *pcie2) |
158 | { | 158 | { |
159 | struct bcma_chipinfo *ci = &pcie2->core->bus->chipinfo; | 159 | struct bcma_bus *bus = pcie2->core->bus; |
160 | struct bcma_chipinfo *ci = &bus->chipinfo; | ||
160 | u32 tmp; | 161 | u32 tmp; |
161 | 162 | ||
162 | tmp = pcie2_read32(pcie2, BCMA_CORE_PCIE2_SPROM(54)); | 163 | tmp = pcie2_read32(pcie2, BCMA_CORE_PCIE2_SPROM(54)); |
163 | if ((tmp & 0xe) >> 1 == 2) | 164 | if ((tmp & 0xe) >> 1 == 2) |
164 | bcma_core_pcie2_cfg_write(pcie2, 0x4e0, 0x17); | 165 | bcma_core_pcie2_cfg_write(pcie2, 0x4e0, 0x17); |
165 | 166 | ||
166 | /* TODO: Do we need pcie_reqsize? */ | 167 | switch (bus->chipinfo.id) { |
168 | case BCMA_CHIP_ID_BCM4360: | ||
169 | case BCMA_CHIP_ID_BCM4352: | ||
170 | pcie2->reqsize = 1024; | ||
171 | break; | ||
172 | default: | ||
173 | pcie2->reqsize = 128; | ||
174 | break; | ||
175 | } | ||
167 | 176 | ||
168 | if (ci->id == BCMA_CHIP_ID_BCM4360 && ci->rev > 3) | 177 | if (ci->id == BCMA_CHIP_ID_BCM4360 && ci->rev > 3) |
169 | bcma_core_pcie2_war_delay_perst_enab(pcie2, true); | 178 | bcma_core_pcie2_war_delay_perst_enab(pcie2, true); |
@@ -173,3 +182,18 @@ void bcma_core_pcie2_init(struct bcma_drv_pcie2 *pcie2) | |||
173 | pciedev_crwlpciegen2_180(pcie2); | 182 | pciedev_crwlpciegen2_180(pcie2); |
174 | pciedev_crwlpciegen2_182(pcie2); | 183 | pciedev_crwlpciegen2_182(pcie2); |
175 | } | 184 | } |
185 | |||
186 | /************************************************** | ||
187 | * Runtime ops. | ||
188 | **************************************************/ | ||
189 | |||
190 | void bcma_core_pcie2_up(struct bcma_drv_pcie2 *pcie2) | ||
191 | { | ||
192 | struct bcma_bus *bus = pcie2->core->bus; | ||
193 | struct pci_dev *dev = bus->host_pci; | ||
194 | int err; | ||
195 | |||
196 | err = pcie_set_readrq(dev, pcie2->reqsize); | ||
197 | if (err) | ||
198 | bcma_err(bus, "Error setting PCI_EXP_DEVCTL_READRQ: %d\n", err); | ||
199 | } | ||
diff --git a/drivers/bcma/host_pci.c b/drivers/bcma/host_pci.c index 8dd37dc94cae..5fb87a899a24 100644 --- a/drivers/bcma/host_pci.c +++ b/drivers/bcma/host_pci.c | |||
@@ -322,7 +322,7 @@ void bcma_host_pci_up(struct bcma_bus *bus) | |||
322 | return; | 322 | return; |
323 | 323 | ||
324 | if (bus->host_is_pcie2) | 324 | if (bus->host_is_pcie2) |
325 | pr_warn("Bringing up bus with PCIe Gen 2 host is unsupported yet\n"); | 325 | bcma_core_pcie2_up(&bus->drv_pcie2); |
326 | else | 326 | else |
327 | bcma_core_pci_up(&bus->drv_pci[0]); | 327 | bcma_core_pci_up(&bus->drv_pci[0]); |
328 | } | 328 | } |