aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/ssb/driver_pcicore.c28
-rw-r--r--drivers/ssb/main.c1
-rw-r--r--include/linux/ssb/ssb.h7
-rw-r--r--include/linux/ssb/ssb_driver_pci.h5
4 files changed, 39 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
31static inline
32u16 pcicore_read16(struct ssb_pcicore *pc, u16 offset)
33{
34 return ssb_read16(pc->dev, offset);
35}
36
37static inline
38void 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;
560out: 561out:
561 return err; 562 return err;
562} 563}
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h
index d14c03685717..20add65215af 100644
--- a/include/linux/ssb/ssb.h
+++ b/include/linux/ssb/ssb.h
@@ -282,6 +282,8 @@ struct ssb_bus {
282 struct ssb_boardinfo boardinfo; 282 struct ssb_boardinfo boardinfo;
283 /* Contents of the SPROM. */ 283 /* Contents of the SPROM. */
284 struct ssb_sprom sprom; 284 struct ssb_sprom sprom;
285 /* If the board has a cardbus slot, this is set to true. */
286 bool has_cardbus_slot;
285 287
286#ifdef CONFIG_SSB_EMBEDDED 288#ifdef CONFIG_SSB_EMBEDDED
287 /* Lock for GPIO register access. */ 289 /* Lock for GPIO register access. */
@@ -299,8 +301,13 @@ struct ssb_bus {
299 301
300/* The initialization-invariants. */ 302/* The initialization-invariants. */
301struct ssb_init_invariants { 303struct ssb_init_invariants {
304 /* Versioning information about the PCB. */
302 struct ssb_boardinfo boardinfo; 305 struct ssb_boardinfo boardinfo;
306 /* The SPROM information. That's either stored in an
307 * EEPROM or NVRAM on the board. */
303 struct ssb_sprom sprom; 308 struct ssb_sprom sprom;
309 /* If the board has a cardbus slot, this is set to true. */
310 bool has_cardbus_slot;
304}; 311};
305/* Type of function to fetch the invariants. */ 312/* Type of function to fetch the invariants. */
306typedef int (*ssb_invariants_func_t)(struct ssb_bus *bus, 313typedef int (*ssb_invariants_func_t)(struct ssb_bus *bus,
diff --git a/include/linux/ssb/ssb_driver_pci.h b/include/linux/ssb/ssb_driver_pci.h
index 9cfffb7b1a27..5e25bac4ed31 100644
--- a/include/linux/ssb/ssb_driver_pci.h
+++ b/include/linux/ssb/ssb_driver_pci.h
@@ -51,6 +51,11 @@
51#define SSB_PCICORE_SBTOPCI1_MASK 0xFC000000 51#define SSB_PCICORE_SBTOPCI1_MASK 0xFC000000
52#define SSB_PCICORE_SBTOPCI2 0x0108 /* Backplane to PCI translation 2 (sbtopci2) */ 52#define SSB_PCICORE_SBTOPCI2 0x0108 /* Backplane to PCI translation 2 (sbtopci2) */
53#define SSB_PCICORE_SBTOPCI2_MASK 0xC0000000 53#define SSB_PCICORE_SBTOPCI2_MASK 0xC0000000
54#define SSB_PCICORE_PCICFG0 0x0400 /* PCI config space 0 (rev >= 8) */
55#define SSB_PCICORE_PCICFG1 0x0500 /* PCI config space 1 (rev >= 8) */
56#define SSB_PCICORE_PCICFG2 0x0600 /* PCI config space 2 (rev >= 8) */
57#define SSB_PCICORE_PCICFG3 0x0700 /* PCI config space 3 (rev >= 8) */
58#define SSB_PCICORE_SPROM(wordoffset) (0x0800 + ((wordoffset) * 2)) /* SPROM shadow area (72 bytes) */
54 59
55/* SBtoPCIx */ 60/* SBtoPCIx */
56#define SSB_PCICORE_SBTOPCI_MEM 0x00000000 61#define SSB_PCICORE_SBTOPCI_MEM 0x00000000