diff options
author | Michael Buesch <mb@bu3sch.de> | 2008-02-19 11:46:48 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-02-20 20:11:49 -0500 |
commit | 7cb4461520f307a6e3fb2bb32cb8daee45aa1fae (patch) | |
tree | 24d287cb729e511285465456cdd0ec02805e9130 /drivers | |
parent | 53521d8c90d366191b6c134f88a8ebe83de60614 (diff) |
ssb: Fix pcicore cardbus mode
This fixes the pcicore driver to not die a horrible
crash death when inserting a cardbus card.
Signed-off-by: Michael Buesch <mb@bu3sch.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/ssb/driver_pcicore.c | 28 | ||||
-rw-r--r-- | drivers/ssb/main.c | 1 |
2 files changed, 27 insertions, 2 deletions
diff --git a/drivers/ssb/driver_pcicore.c b/drivers/ssb/driver_pcicore.c index 2faaa906d5d6..059452fbb168 100644 --- a/drivers/ssb/driver_pcicore.c +++ b/drivers/ssb/driver_pcicore.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/ssb/ssb.h> | 11 | #include <linux/ssb/ssb.h> |
12 | #include <linux/pci.h> | 12 | #include <linux/pci.h> |
13 | #include <linux/delay.h> | 13 | #include <linux/delay.h> |
14 | #include <linux/ssb/ssb_embedded.h> | ||
14 | 15 | ||
15 | #include "ssb_private.h" | 16 | #include "ssb_private.h" |
16 | 17 | ||
@@ -27,6 +28,18 @@ void pcicore_write32(struct ssb_pcicore *pc, u16 offset, u32 value) | |||
27 | ssb_write32(pc->dev, offset, value); | 28 | ssb_write32(pc->dev, offset, value); |
28 | } | 29 | } |
29 | 30 | ||
31 | static inline | ||
32 | u16 pcicore_read16(struct ssb_pcicore *pc, u16 offset) | ||
33 | { | ||
34 | return ssb_read16(pc->dev, offset); | ||
35 | } | ||
36 | |||
37 | static inline | ||
38 | void pcicore_write16(struct ssb_pcicore *pc, u16 offset, u16 value) | ||
39 | { | ||
40 | ssb_write16(pc->dev, offset, value); | ||
41 | } | ||
42 | |||
30 | /************************************************** | 43 | /************************************************** |
31 | * Code for hostmode operation. | 44 | * Code for hostmode operation. |
32 | **************************************************/ | 45 | **************************************************/ |
@@ -117,8 +130,10 @@ static u32 get_cfgspace_addr(struct ssb_pcicore *pc, | |||
117 | u32 addr = 0; | 130 | u32 addr = 0; |
118 | u32 tmp; | 131 | u32 tmp; |
119 | 132 | ||
120 | if (unlikely(pc->cardbusmode && dev > 1)) | 133 | /* We do only have one cardbus device behind the bridge. */ |
134 | if (pc->cardbusmode && (dev >= 1)) | ||
121 | goto out; | 135 | goto out; |
136 | |||
122 | if (bus == 0) { | 137 | if (bus == 0) { |
123 | /* Type 0 transaction */ | 138 | /* Type 0 transaction */ |
124 | if (unlikely(dev >= SSB_PCI_SLOT_MAX)) | 139 | if (unlikely(dev >= SSB_PCI_SLOT_MAX)) |
@@ -318,7 +333,16 @@ static void ssb_pcicore_init_hostmode(struct ssb_pcicore *pc) | |||
318 | pcicore_write32(pc, SSB_PCICORE_ARBCTL, val); | 333 | pcicore_write32(pc, SSB_PCICORE_ARBCTL, val); |
319 | udelay(1); /* Assertion time demanded by the PCI standard */ | 334 | udelay(1); /* Assertion time demanded by the PCI standard */ |
320 | 335 | ||
321 | /*TODO cardbus mode */ | 336 | if (pc->dev->bus->has_cardbus_slot) { |
337 | ssb_dprintk(KERN_INFO PFX "CardBus slot detected\n"); | ||
338 | pc->cardbusmode = 1; | ||
339 | /* GPIO 1 resets the bridge */ | ||
340 | ssb_gpio_out(pc->dev->bus, 1, 1); | ||
341 | ssb_gpio_outen(pc->dev->bus, 1, 1); | ||
342 | pcicore_write16(pc, SSB_PCICORE_SPROM(0), | ||
343 | pcicore_read16(pc, SSB_PCICORE_SPROM(0)) | ||
344 | | 0x0400); | ||
345 | } | ||
322 | 346 | ||
323 | /* 64MB I/O window */ | 347 | /* 64MB I/O window */ |
324 | pcicore_write32(pc, SSB_PCICORE_SBTOPCI0, | 348 | pcicore_write32(pc, SSB_PCICORE_SBTOPCI0, |
diff --git a/drivers/ssb/main.c b/drivers/ssb/main.c index af07ab22708f..bedb2b4ee9d2 100644 --- a/drivers/ssb/main.c +++ b/drivers/ssb/main.c | |||
@@ -557,6 +557,7 @@ static int ssb_fetch_invariants(struct ssb_bus *bus, | |||
557 | goto out; | 557 | goto out; |
558 | memcpy(&bus->boardinfo, &iv.boardinfo, sizeof(iv.boardinfo)); | 558 | memcpy(&bus->boardinfo, &iv.boardinfo, sizeof(iv.boardinfo)); |
559 | memcpy(&bus->sprom, &iv.sprom, sizeof(iv.sprom)); | 559 | memcpy(&bus->sprom, &iv.sprom, sizeof(iv.sprom)); |
560 | bus->has_cardbus_slot = iv.has_cardbus_slot; | ||
560 | out: | 561 | out: |
561 | return err; | 562 | return err; |
562 | } | 563 | } |