1 --- a/drivers/ssb/driver_pcicore.c
2 +++ b/drivers/ssb/driver_pcicore.c
4 #include <linux/ssb/ssb.h>
6 #include <linux/delay.h>
7 +#include <linux/ssb/ssb_embedded.h>
9 #include "ssb_private.h"
12 ssb_write32(pc->dev, offset, value);
16 +u16 pcicore_read16(struct ssb_pcicore *pc, u16 offset)
18 + return ssb_read16(pc->dev, offset);
22 +void pcicore_write16(struct ssb_pcicore *pc, u16 offset, u16 value)
24 + ssb_write16(pc->dev, offset, value);
27 /**************************************************
28 * Code for hostmode operation.
29 **************************************************/
34 - if (unlikely(pc->cardbusmode && dev > 1))
35 + /* We do only have one cardbus device behind the bridge. */
36 + if (pc->cardbusmode && (dev >= 1))
40 /* Type 0 transaction */
41 if (unlikely(dev >= SSB_PCI_SLOT_MAX))
43 pcicore_write32(pc, SSB_PCICORE_ARBCTL, val);
44 udelay(1); /* Assertion time demanded by the PCI standard */
46 - /*TODO cardbus mode */
47 + if (pc->dev->bus->has_cardbus_slot) {
48 + ssb_dprintk(KERN_INFO PFX "CardBus slot detected\n");
49 + pc->cardbusmode = 1;
50 + /* GPIO 1 resets the bridge */
51 + ssb_gpio_out(pc->dev->bus, 1, 1);
52 + ssb_gpio_outen(pc->dev->bus, 1, 1);
53 + pcicore_write16(pc, SSB_PCICORE_SPROM(0),
54 + pcicore_read16(pc, SSB_PCICORE_SPROM(0))
59 pcicore_write32(pc, SSB_PCICORE_SBTOPCI0,
60 --- a/drivers/ssb/main.c
61 +++ b/drivers/ssb/main.c
64 memcpy(&bus->boardinfo, &iv.boardinfo, sizeof(iv.boardinfo));
65 memcpy(&bus->sprom, &iv.sprom, sizeof(iv.sprom));
66 + bus->has_cardbus_slot = iv.has_cardbus_slot;
70 --- a/include/linux/ssb/ssb.h
71 +++ b/include/linux/ssb/ssb.h
73 struct ssb_boardinfo boardinfo;
74 /* Contents of the SPROM. */
75 struct ssb_sprom sprom;
76 + /* If the board has a cardbus slot, this is set to true. */
77 + bool has_cardbus_slot;
79 #ifdef CONFIG_SSB_EMBEDDED
80 /* Lock for GPIO register access. */
83 /* The initialization-invariants. */
84 struct ssb_init_invariants {
85 + /* Versioning information about the PCB. */
86 struct ssb_boardinfo boardinfo;
87 + /* The SPROM information. That's either stored in an
88 + * EEPROM or NVRAM on the board. */
89 struct ssb_sprom sprom;
90 + /* If the board has a cardbus slot, this is set to true. */
91 + bool has_cardbus_slot;
93 /* Type of function to fetch the invariants. */
94 typedef int (*ssb_invariants_func_t)(struct ssb_bus *bus,
95 --- a/include/linux/ssb/ssb_driver_pci.h
96 +++ b/include/linux/ssb/ssb_driver_pci.h
98 #define SSB_PCICORE_SBTOPCI1_MASK 0xFC000000
99 #define SSB_PCICORE_SBTOPCI2 0x0108 /* Backplane to PCI translation 2 (sbtopci2) */
100 #define SSB_PCICORE_SBTOPCI2_MASK 0xC0000000
101 +#define SSB_PCICORE_PCICFG0 0x0400 /* PCI config space 0 (rev >= 8) */
102 +#define SSB_PCICORE_PCICFG1 0x0500 /* PCI config space 1 (rev >= 8) */
103 +#define SSB_PCICORE_PCICFG2 0x0600 /* PCI config space 2 (rev >= 8) */
104 +#define SSB_PCICORE_PCICFG3 0x0700 /* PCI config space 3 (rev >= 8) */
105 +#define SSB_PCICORE_SPROM(wordoffset) (0x0800 + ((wordoffset) * 2)) /* SPROM shadow area (72 bytes) */
108 #define SSB_PCICORE_SBTOPCI_MEM 0x00000000