summaryrefslogtreecommitdiff
path: root/target/linux/brcm47xx-2.6/files
diff options
context:
space:
mode:
authorPeter Denison <openwrt@marshadder.org>2007-06-25 19:51:09 +0000
committerPeter Denison <openwrt@marshadder.org>2007-06-25 19:51:09 +0000
commiteed7b91c68806d8e6c72aabfadf2322b76997e3a (patch)
tree15ec468516ccbd0e750abf2a62410f7bdca5be8d /target/linux/brcm47xx-2.6/files
parent7e4f2dbf6674f1691acbeceacabd54ae4e09b5d4 (diff)
downloadmtk-20170518-eed7b91c68806d8e6c72aabfadf2322b76997e3a.zip
mtk-20170518-eed7b91c68806d8e6c72aabfadf2322b76997e3a.tar.gz
mtk-20170518-eed7b91c68806d8e6c72aabfadf2322b76997e3a.tar.bz2
Merge SSB driver from tree at bu3sch.de, pulled 24/6
SVN-Revision: 7732
Diffstat (limited to 'target/linux/brcm47xx-2.6/files')
-rw-r--r--target/linux/brcm47xx-2.6/files/drivers/ssb/driver_chipcommon.c20
-rw-r--r--target/linux/brcm47xx-2.6/files/drivers/ssb/main.c58
-rw-r--r--target/linux/brcm47xx-2.6/files/drivers/ssb/pci.c76
-rw-r--r--target/linux/brcm47xx-2.6/files/drivers/ssb/pcmcia.c7
-rw-r--r--target/linux/brcm47xx-2.6/files/drivers/ssb/scan.c8
-rw-r--r--target/linux/brcm47xx-2.6/files/drivers/ssb/ssb_private.h22
-rw-r--r--target/linux/brcm47xx-2.6/files/include/linux/ssb/ssb.h43
-rw-r--r--target/linux/brcm47xx-2.6/files/include/linux/ssb/ssb_regs.h12
8 files changed, 145 insertions, 101 deletions
diff --git a/target/linux/brcm47xx-2.6/files/drivers/ssb/driver_chipcommon.c b/target/linux/brcm47xx-2.6/files/drivers/ssb/driver_chipcommon.c
index 8e511c7..a283de9 100644
--- a/target/linux/brcm47xx-2.6/files/drivers/ssb/driver_chipcommon.c
+++ b/target/linux/brcm47xx-2.6/files/drivers/ssb/driver_chipcommon.c
@@ -293,15 +293,15 @@ void ssb_chipco_timing_init(struct ssb_chipcommon *cc,
/* set register for external IO to control LED. */
chipco_write32(cc, SSB_CHIPCO_PROG_CFG, 0x11);
- tmp = ceildiv(10, ns) << SSB_PROG_WCNT_3_SHIFT; /* Waitcount-3 = 10ns */
- tmp |= ceildiv(40, ns) << SSB_PROG_WCNT_1_SHIFT; /* Waitcount-1 = 40ns */
- tmp |= ceildiv(240, ns); /* Waitcount-0 = 240ns */
+ tmp = DIV_ROUND_UP(10, ns) << SSB_PROG_WCNT_3_SHIFT; /* Waitcount-3 = 10ns */
+ tmp |= DIV_ROUND_UP(40, ns) << SSB_PROG_WCNT_1_SHIFT; /* Waitcount-1 = 40ns */
+ tmp |= DIV_ROUND_UP(240, ns); /* Waitcount-0 = 240ns */
chipco_write32(cc, SSB_CHIPCO_PROG_WAITCNT, tmp); /* 0x01020a0c for a 100Mhz clock */
/* Set timing for the flash */
- tmp = ceildiv(10, ns) << SSB_FLASH_WCNT_3_SHIFT; /* Waitcount-3 = 10nS */
- tmp |= ceildiv(10, ns) << SSB_FLASH_WCNT_1_SHIFT; /* Waitcount-1 = 10nS */
- tmp |= ceildiv(120, ns); /* Waitcount-0 = 120nS */
+ tmp = DIV_ROUND_UP(10, ns) << SSB_FLASH_WCNT_3_SHIFT; /* Waitcount-3 = 10nS */
+ tmp |= DIV_ROUND_UP(10, ns) << SSB_FLASH_WCNT_1_SHIFT; /* Waitcount-1 = 10nS */
+ tmp |= DIV_ROUND_UP(120, ns); /* Waitcount-0 = 120nS */
if ((bus->chip_id == 0x5365) ||
(dev->id.revision < 9))
chipco_write32(cc, SSB_CHIPCO_FLASH_WAITCNT, tmp);
@@ -312,10 +312,10 @@ void ssb_chipco_timing_init(struct ssb_chipcommon *cc,
if (bus->chip_id == 0x5350) {
/* Enable EXTIF */
- tmp = ceildiv(10, ns) << SSB_PROG_WCNT_3_SHIFT; /* Waitcount-3 = 10ns */
- tmp |= ceildiv(20, ns) << SSB_PROG_WCNT_2_SHIFT; /* Waitcount-2 = 20ns */
- tmp |= ceildiv(100, ns) << SSB_PROG_WCNT_1_SHIFT; /* Waitcount-1 = 100ns */
- tmp |= ceildiv(120, ns); /* Waitcount-0 = 120ns */
+ tmp = DIV_ROUND_UP(10, ns) << SSB_PROG_WCNT_3_SHIFT; /* Waitcount-3 = 10ns */
+ tmp |= DIV_ROUND_UP(20, ns) << SSB_PROG_WCNT_2_SHIFT; /* Waitcount-2 = 20ns */
+ tmp |= DIV_ROUND_UP(100, ns) << SSB_PROG_WCNT_1_SHIFT; /* Waitcount-1 = 100ns */
+ tmp |= DIV_ROUND_UP(120, ns); /* Waitcount-0 = 120ns */
chipco_write32(cc, SSB_CHIPCO_PROG_WAITCNT, tmp); /* 0x01020a0c for a 100Mhz clock */
}
}
diff --git a/target/linux/brcm47xx-2.6/files/drivers/ssb/main.c b/target/linux/brcm47xx-2.6/files/drivers/ssb/main.c
index a2d2231..a892f1d 100644
--- a/target/linux/brcm47xx-2.6/files/drivers/ssb/main.c
+++ b/target/linux/brcm47xx-2.6/files/drivers/ssb/main.c
@@ -32,7 +32,7 @@ MODULE_LICENSE("GPL");
static LIST_HEAD(attach_queue);
static LIST_HEAD(buses);
-static int nr_buses;
+static unsigned int next_busnumber;
static DEFINE_MUTEX(buses_mutex);
static void ssb_buses_lock(void);
@@ -365,7 +365,7 @@ static int ssb_devices_register(struct ssb_bus *bus)
dev->release = ssb_release_dev;
dev->bus = &ssb_bustype;
snprintf(dev->bus_id, sizeof(dev->bus_id),
- "ssb%d:%d", bus->busnumber, dev_idx);
+ "ssb%u:%d", bus->busnumber, dev_idx);
switch (bus->bustype) {
case SSB_BUSTYPE_PCI:
@@ -435,17 +435,6 @@ static int ssb_attach_queued_buses(void)
return err;
}
-static void ssb_get_boardtype(struct ssb_bus *bus)
-{//FIXME for pcmcia?
- if (bus->bustype != SSB_BUSTYPE_PCI) {
- /* Must set board_vendor, board_type and board_rev
- * before calling ssb_bus_*_register() */
- assert(bus->board_vendor && bus->board_type);
- return;
- }
- ssb_pci_get_boardtype(bus);
-}
-
static u16 ssb_ssb_read16(struct ssb_device *dev, u16 offset)
{
struct ssb_bus *bus = dev->bus;
@@ -485,7 +474,26 @@ static const struct ssb_bus_ops ssb_ssb_ops = {
.write32 = ssb_ssb_write32,
};
+static int ssb_fetch_invariants(struct ssb_bus *bus,
+ int (*get_invariants)(struct ssb_bus *bus,
+ struct ssb_init_invariants *iv))
+{
+ struct ssb_init_invariants iv;
+ int err;
+
+ memset(&iv, 0, sizeof(iv));
+ err = get_invariants(bus, &iv);
+ if (err)
+ goto out;
+ memcpy(&bus->boardinfo, &iv.boardinfo, sizeof(iv.boardinfo));
+ memcpy(&bus->sprom, &iv.sprom, sizeof(iv.sprom));
+out:
+ return err;
+}
+
static int ssb_bus_register(struct ssb_bus *bus,
+ int (*get_invariants)(struct ssb_bus *bus,
+ struct ssb_init_invariants *iv),
unsigned long baseaddr)
{
int err;
@@ -493,13 +501,12 @@ static int ssb_bus_register(struct ssb_bus *bus,
spin_lock_init(&bus->bar_lock);
INIT_LIST_HEAD(&bus->list);
- ssb_get_boardtype(bus);
/* Powerup the bus */
err = ssb_pci_xtal(bus, SSB_GPIO_XTAL | SSB_GPIO_PLL, 1);
if (err)
goto out;
ssb_buses_lock();
- bus->busnumber = nr_buses;
+ bus->busnumber = next_busnumber;
/* Scan for devices (cores) */
err = ssb_bus_scan(bus, baseaddr);
if (err)
@@ -517,6 +524,9 @@ static int ssb_bus_register(struct ssb_bus *bus,
/* Initialize basic system devices (if available) */
ssb_chipcommon_init(&bus->chipco);
ssb_mipscore_init(&bus->mipscore);
+ err = ssb_fetch_invariants(bus, get_invariants);
+ if (err)
+ goto err_pcmcia_exit;
/* Queue it for attach */
list_add_tail(&bus->list, &attach_queue);
@@ -526,7 +536,7 @@ static int ssb_bus_register(struct ssb_bus *bus,
if (err)
goto err_dequeue;
}
- nr_buses++;
+ next_busnumber++;
ssb_buses_unlock();
out:
@@ -534,7 +544,7 @@ out:
err_dequeue:
list_del(&bus->list);
-/* err_pcmcia_exit: */
+err_pcmcia_exit:
/* ssb_pcmcia_exit(bus); */
err_pci_exit:
ssb_pci_exit(bus);
@@ -556,7 +566,7 @@ int ssb_bus_pcibus_register(struct ssb_bus *bus,
bus->host_pci = host_pci;
bus->ops = &ssb_pci_ops;
- err = ssb_bus_register(bus, 0);
+ err = ssb_bus_register(bus, ssb_pci_get_invariants, 0);
if (!err) {
ssb_printk(KERN_INFO PFX "Sonics Silicon Backplane found on "
"PCI device %s\n", host_pci->dev.bus_id);
@@ -570,17 +580,15 @@ EXPORT_SYMBOL(ssb_bus_pcibus_register);
#ifdef CONFIG_SSB_PCMCIAHOST
int ssb_bus_pcmciabus_register(struct ssb_bus *bus,
struct pcmcia_device *pcmcia_dev,
- unsigned long baseaddr,
- void (*fill_sprom)(struct ssb_sprom *sprom))
+ unsigned long baseaddr)
{
int err;
bus->bustype = SSB_BUSTYPE_PCMCIA;
bus->host_pcmcia = pcmcia_dev;
bus->ops = &ssb_pcmcia_ops;
- fill_sprom(&bus->sprom);
- err = ssb_bus_register(bus, baseaddr);
+ err = ssb_bus_register(bus, ssb_pcmcia_get_invariants, baseaddr);
if (!err) {
ssb_printk(KERN_INFO PFX "Sonics Silicon Backplane found on "
"PCMCIA device %s\n", pcmcia_dev->devname);
@@ -593,15 +601,15 @@ EXPORT_SYMBOL(ssb_bus_pcmciabus_register);
int ssb_bus_ssbbus_register(struct ssb_bus *bus,
unsigned long baseaddr,
- void (*fill_sprom)(struct ssb_sprom *sprom))
+ int (*get_invariants)(struct ssb_bus *bus,
+ struct ssb_init_invariants *iv))
{
int err;
bus->bustype = SSB_BUSTYPE_SSB;
bus->ops = &ssb_ssb_ops;
- fill_sprom(&bus->sprom);
- err = ssb_bus_register(bus, baseaddr);
+ err = ssb_bus_register(bus, get_invariants, baseaddr);
if (!err) {
ssb_printk(KERN_INFO PFX "Sonics Silicon Backplane found at "
"address 0x%08lX\n", baseaddr);
diff --git a/target/linux/brcm47xx-2.6/files/drivers/ssb/pci.c b/target/linux/brcm47xx-2.6/files/drivers/ssb/pci.c
index fcd8e87..f9dc28f 100644
--- a/target/linux/brcm47xx-2.6/files/drivers/ssb/pci.c
+++ b/target/linux/brcm47xx-2.6/files/drivers/ssb/pci.c
@@ -330,12 +330,12 @@ static void sprom_extract_r1(struct ssb_sprom_r1 *out, const u16 *in)
SPEX(gpio2, SSB_SPROM1_GPIOB, SSB_SPROM1_GPIOB_P2, 0);
SPEX(gpio3, SSB_SPROM1_GPIOB, SSB_SPROM1_GPIOB_P3,
SSB_SPROM1_GPIOB_P3_SHIFT);
- SPEX(maxpwr_a, SSB_SPROM1_MAXPWR, SSB_SPROM1_MAXPWR_A, 0);
- SPEX(maxpwr_bg, SSB_SPROM1_MAXPWR, SSB_SPROM1_MAXPWR_BG,
- SSB_SPROM1_MAXPWR_BG_SHIFT);
- SPEX(itssi_a, SSB_SPROM1_ITSSI, SSB_SPROM1_ITSSI_A, 0);
- SPEX(itssi_bg, SSB_SPROM1_ITSSI, SSB_SPROM1_ITSSI_BG,
- SSB_SPROM1_ITSSI_BG_SHIFT);
+ SPEX(maxpwr_a, SSB_SPROM1_MAXPWR, SSB_SPROM1_MAXPWR_A,
+ SSB_SPROM1_MAXPWR_A_SHIFT);
+ SPEX(maxpwr_bg, SSB_SPROM1_MAXPWR, SSB_SPROM1_MAXPWR_BG, 0);
+ SPEX(itssi_a, SSB_SPROM1_ITSSI, SSB_SPROM1_ITSSI_A,
+ SSB_SPROM1_ITSSI_A_SHIFT);
+ SPEX(itssi_bg, SSB_SPROM1_ITSSI, SSB_SPROM1_ITSSI_BG, 0);
SPEX(boardflags_lo, SSB_SPROM1_BFLLO, 0xFFFF, 0);
SPEX(antenna_gain_a, SSB_SPROM1_AGAIN, SSB_SPROM1_AGAIN_A, 0);
SPEX(antenna_gain_bg, SSB_SPROM1_AGAIN, SSB_SPROM1_AGAIN_BG,
@@ -407,7 +407,8 @@ static void sprom_extract_r3(struct ssb_sprom_r3 *out, const u16 *in)
out->ofdmgpo |= (in[SPOFF(SSB_SPROM3_OFDMGPO) + 1] & 0x00FF) << 8;
}
-static int sprom_extract(struct ssb_sprom *out, const u16 *in)
+static int sprom_extract(struct ssb_bus *bus,
+ struct ssb_sprom *out, const u16 *in)
{
memset(out, 0, sizeof(*out));
@@ -415,16 +416,23 @@ static int sprom_extract(struct ssb_sprom *out, const u16 *in)
SPEX(crc, SSB_SPROM_REVISION, SSB_SPROM_REVISION_CRC,
SSB_SPROM_REVISION_CRC_SHIFT);
- if (out->revision == 0)
- goto unsupported;
- if (out->revision >= 1 && out->revision <= 3)
+ if ((bus->chip_id & 0xFF00) == 0x4400) {
+ /* Workaround: The BCM44XX chip has a stupid revision
+ * number stored in the SPROM.
+ * Always extract r1. */
sprom_extract_r1(&out->r1, in);
- if (out->revision >= 2 && out->revision <= 3)
- sprom_extract_r2(&out->r2, in);
- if (out->revision == 3)
- sprom_extract_r3(&out->r3, in);
- if (out->revision >= 4)
- goto unsupported;
+ } else {
+ if (out->revision == 0)
+ goto unsupported;
+ if (out->revision >= 1 && out->revision <= 3)
+ sprom_extract_r1(&out->r1, in);
+ if (out->revision >= 2 && out->revision <= 3)
+ sprom_extract_r2(&out->r2, in);
+ if (out->revision == 3)
+ sprom_extract_r3(&out->r3, in);
+ if (out->revision >= 4)
+ goto unsupported;
+ }
return 0;
unsupported:
@@ -434,13 +442,12 @@ unsupported:
return 0;
}
-int ssb_pci_sprom_get(struct ssb_bus *bus)
+static int ssb_pci_sprom_get(struct ssb_bus *bus,
+ struct ssb_sprom *sprom)
{
int err = -ENOMEM;
u16 *buf;
- assert(bus->bustype == SSB_BUSTYPE_PCI);
-
buf = kcalloc(SSB_SPROMSIZE_WORDS, sizeof(u16), GFP_KERNEL);
if (!buf)
goto out;
@@ -450,21 +457,36 @@ int ssb_pci_sprom_get(struct ssb_bus *bus)
ssb_printk(KERN_WARNING PFX
"WARNING: Invalid SPROM CRC (corrupt SPROM)\n");
}
- err = sprom_extract(&bus->sprom, buf);
+ err = sprom_extract(bus, sprom, buf);
kfree(buf);
out:
return err;
}
-void ssb_pci_get_boardtype(struct ssb_bus *bus)
+static void ssb_pci_get_boardinfo(struct ssb_bus *bus,
+ struct ssb_boardinfo *bi)
{
pci_read_config_word(bus->host_pci, PCI_SUBSYSTEM_VENDOR_ID,
- &bus->board_vendor);
+ &bi->vendor);
pci_read_config_word(bus->host_pci, PCI_SUBSYSTEM_ID,
- &bus->board_type);
+ &bi->type);
pci_read_config_word(bus->host_pci, PCI_REVISION_ID,
- &bus->board_rev);
+ &bi->rev);
+}
+
+int ssb_pci_get_invariants(struct ssb_bus *bus,
+ struct ssb_init_invariants *iv)
+{
+ int err;
+
+ err = ssb_pci_sprom_get(bus, &iv->sprom);
+ if (err)
+ goto out;
+ ssb_pci_get_boardinfo(bus, &iv->boardinfo);
+
+out:
+ return err;
}
static u16 ssb_pci_read16(struct ssb_device *dev, u16 offset)
@@ -660,13 +682,7 @@ int ssb_pci_init(struct ssb_bus *bus)
err = device_create_file(&pdev->dev, &dev_attr_ssb_sprom);
if (err)
goto out;
- err = ssb_pci_sprom_get(bus);
- if (err)
- goto err_remove_sprom_file;
out:
return err;
-err_remove_sprom_file:
- device_remove_file(&pdev->dev, &dev_attr_ssb_sprom);
- return err;
}
diff --git a/target/linux/brcm47xx-2.6/files/drivers/ssb/pcmcia.c b/target/linux/brcm47xx-2.6/files/drivers/ssb/pcmcia.c
index 60cf5ad..b908563 100644
--- a/target/linux/brcm47xx-2.6/files/drivers/ssb/pcmcia.c
+++ b/target/linux/brcm47xx-2.6/files/drivers/ssb/pcmcia.c
@@ -222,6 +222,13 @@ const struct ssb_bus_ops ssb_pcmcia_ops = {
.write32 = ssb_pcmcia_write32,
};
+int ssb_pcmcia_get_invariants(struct ssb_bus *bus,
+ struct ssb_init_invariants *iv)
+{
+ //TODO
+ return 0;
+}
+
int ssb_pcmcia_init(struct ssb_bus *bus)
{
conf_reg_t reg;
diff --git a/target/linux/brcm47xx-2.6/files/drivers/ssb/scan.c b/target/linux/brcm47xx-2.6/files/drivers/ssb/scan.c
index feaf1e5..b5d909c 100644
--- a/target/linux/brcm47xx-2.6/files/drivers/ssb/scan.c
+++ b/target/linux/brcm47xx-2.6/files/drivers/ssb/scan.c
@@ -202,7 +202,11 @@ void ssb_iounmap(struct ssb_bus *bus)
iounmap(bus->mmio);
break;
case SSB_BUSTYPE_PCI:
+#ifdef CONFIG_SSB_PCIHOST
pci_iounmap(bus->host_pci, bus->mmio);
+#else
+ assert(0); /* Can't reach this code. */
+#endif
break;
}
bus->mmio = NULL;
@@ -222,7 +226,11 @@ static void __iomem * ssb_ioremap(struct ssb_bus *bus,
mmio = ioremap(baseaddr, SSB_CORE_SIZE);
break;
case SSB_BUSTYPE_PCI:
+#ifdef CONFIG_SSB_PCIHOST
mmio = pci_iomap(bus->host_pci, 0, ~0UL);
+#else
+ assert(0); /* Can't reach this code. */
+#endif
break;
}
diff --git a/target/linux/brcm47xx-2.6/files/drivers/ssb/ssb_private.h b/target/linux/brcm47xx-2.6/files/drivers/ssb/ssb_private.h
index ae1fc06..d00d186 100644
--- a/target/linux/brcm47xx-2.6/files/drivers/ssb/ssb_private.h
+++ b/target/linux/brcm47xx-2.6/files/drivers/ssb/ssb_private.h
@@ -51,8 +51,8 @@ extern int ssb_pci_switch_coreidx(struct ssb_bus *bus,
u8 coreidx);
extern int ssb_pci_xtal(struct ssb_bus *bus, u32 what,
int turn_on);
-extern int ssb_pci_sprom_get(struct ssb_bus *bus);
-extern void ssb_pci_get_boardtype(struct ssb_bus *bus);
+extern int ssb_pci_get_invariants(struct ssb_bus *bus,
+ struct ssb_init_invariants *iv);
extern void ssb_pci_exit(struct ssb_bus *bus);
extern int ssb_pci_init(struct ssb_bus *bus);
extern const struct ssb_bus_ops ssb_pci_ops;
@@ -74,13 +74,6 @@ static inline int ssb_pci_xtal(struct ssb_bus *bus, u32 what,
{
return 0;
}
-static inline int ssb_pci_sprom_get(struct ssb_bus *bus)
-{
- return 0;
-}
-static inline void ssb_pci_get_boardtype(struct ssb_bus *bus)
-{
-}
static inline void ssb_pci_exit(struct ssb_bus *bus)
{
}
@@ -99,6 +92,8 @@ extern int ssb_pcmcia_switch_coreidx(struct ssb_bus *bus,
u8 coreidx);
extern int ssb_pcmcia_switch_segment(struct ssb_bus *bus,
u8 seg);
+extern int ssb_pcmcia_get_invariants(struct ssb_bus *bus,
+ struct ssb_init_invariants *iv);
extern int ssb_pcmcia_init(struct ssb_bus *bus);
extern const struct ssb_bus_ops ssb_pcmcia_ops;
#else /* CONFIG_SSB_PCMCIAHOST */
@@ -139,13 +134,4 @@ extern int ssb_devices_thaw(struct ssb_bus *bus);
extern struct ssb_bus * ssb_pci_dev_to_bus(struct pci_dev *pdev);
#endif /* CONFIG_SSB_PCIHOST */
-
-/* Ceiling division helper. Divides x by y. */
-static inline
-unsigned long ceildiv(unsigned long x, unsigned long y)
-{
- return ((x + (y - 1)) / y);
-}
-
-
#endif /* LINUX_SSB_PRIVATE_H_ */
diff --git a/target/linux/brcm47xx-2.6/files/include/linux/ssb/ssb.h b/target/linux/brcm47xx-2.6/files/include/linux/ssb/ssb.h
index 1ed3cbc..a3d1f51 100644
--- a/target/linux/brcm47xx-2.6/files/include/linux/ssb/ssb.h
+++ b/target/linux/brcm47xx-2.6/files/include/linux/ssb/ssb.h
@@ -100,6 +100,13 @@ struct ssb_sprom {
};
};
+/* Information about the PCB the circuitry is soldered on. */
+struct ssb_boardinfo {
+ u16 vendor;
+ u16 type;
+ u16 rev;
+};
+
struct ssb_device;
/* Lowlevel read/write operations on the device MMIO.
@@ -292,19 +299,11 @@ struct ssb_bus {
struct mutex pci_sprom_mutex;
#endif
- /* ID information about the PCB. */
- u16 board_vendor;
- u16 board_type;
- u16 board_rev;
/* ID information about the Chip. */
u16 chip_id;
u16 chip_rev;
u8 chip_package;
- /* Contents of the SPROM.
- * If there is no sprom (not on PCI-bus), this is emulated. */
- struct ssb_sprom sprom;
-
/* List of devices (cores) on the backplane. */
struct ssb_device devices[SSB_MAX_NR_CORES];
u8 nr_devices;
@@ -313,7 +312,7 @@ struct ssb_bus {
u8 suspend_cnt;
/* Software ID number for this bus. */
- int busnumber;
+ unsigned int busnumber;
/* The ChipCommon device (if available). */
struct ssb_chipcommon chipco;
@@ -324,13 +323,34 @@ struct ssb_bus {
/* The EXTif-core device (if available). */
struct ssb_extif extif;
+ /* The following structure elements are not available in early
+ * SSB initialization. Though, they are available for regular
+ * registered drivers at any stage. So be careful when
+ * using them in the ssb core code. */
+
+ /* ID information about the PCB. */
+ struct ssb_boardinfo boardinfo;
+ /* Contents of the SPROM. */
+ struct ssb_sprom sprom;
+
/* Internal. */
struct list_head list;
};
+/* The initialization-invariants. */
+struct ssb_init_invariants {
+ struct ssb_boardinfo boardinfo;
+ struct ssb_sprom sprom;
+};
+
+/* Register a SSB system bus. get_invariants() is called after the
+ * basic system devices are initialized.
+ * The invariants are usually fetched from some NVRAM.
+ * Put the invariants into the struct pointed to by iv. */
extern int ssb_bus_ssbbus_register(struct ssb_bus *bus,
unsigned long baseaddr,
- void (*fill_sprom)(struct ssb_sprom *sprom));
+ int (*get_invariants)(struct ssb_bus *bus,
+ struct ssb_init_invariants *iv));
#ifdef CONFIG_SSB_PCIHOST
extern int ssb_bus_pcibus_register(struct ssb_bus *bus,
struct pci_dev *host_pci);
@@ -338,8 +358,7 @@ extern int ssb_bus_pcibus_register(struct ssb_bus *bus,
#ifdef CONFIG_SSB_PCMCIAHOST
extern int ssb_bus_pcmciabus_register(struct ssb_bus *bus,
struct pcmcia_device *pcmcia_dev,
- unsigned long baseaddr,
- void (*fill_sprom)(struct ssb_sprom *sprom));
+ unsigned long baseaddr);
#endif /* CONFIG_SSB_PCMCIAHOST */
extern void ssb_bus_unregister(struct ssb_bus *bus);
diff --git a/target/linux/brcm47xx-2.6/files/include/linux/ssb/ssb_regs.h b/target/linux/brcm47xx-2.6/files/include/linux/ssb/ssb_regs.h
index e1c7ff7..1fa4bf8 100644
--- a/target/linux/brcm47xx-2.6/files/include/linux/ssb/ssb_regs.h
+++ b/target/linux/brcm47xx-2.6/files/include/linux/ssb/ssb_regs.h
@@ -201,16 +201,16 @@
#define SSB_SPROM1_GPIOB_P3 0xFF00 /* Pin 3 */
#define SSB_SPROM1_GPIOB_P3_SHIFT 8
#define SSB_SPROM1_MAXPWR 0x1068 /* Power Amplifier Max Power */
-#define SSB_SPROM1_MAXPWR_A 0x00FF /* A-PHY (in dBm Q5.2) */
-#define SSB_SPROM1_MAXPWR_BG 0xFF00 /* B-PHY and G-PHY (in dBm Q5.2) */
-#define SSB_SPROM1_MAXPWR_BG_SHIFT 8
+#define SSB_SPROM1_MAXPWR_BG 0x00FF /* B-PHY and G-PHY (in dBm Q5.2) */
+#define SSB_SPROM1_MAXPWR_A 0xFF00 /* A-PHY (in dBm Q5.2) */
+#define SSB_SPROM1_MAXPWR_A_SHIFT 8
#define SSB_SPROM1_PA1B0 0x106A
#define SSB_SPROM1_PA1B1 0x106C
#define SSB_SPROM1_PA1B2 0x106E
#define SSB_SPROM1_ITSSI 0x1070 /* Idle TSSI Target */
-#define SSB_SPROM1_ITSSI_A 0x00FF /* A-PHY */
-#define SSB_SPROM1_ITSSI_BG 0xFF00 /* B-PHY and G-PHY */
-#define SSB_SPROM1_ITSSI_BG_SHIFT 8
+#define SSB_SPROM1_ITSSI_BG 0x00FF /* B-PHY and G-PHY*/
+#define SSB_SPROM1_ITSSI_A 0xFF00 /* A-PHY */
+#define SSB_SPROM1_ITSSI_A_SHIFT 8
#define SSB_SPROM1_BFLLO 0x1072 /* Boardflags (low 16 bits) */
#define SSB_SPROM1_AGAIN 0x1074 /* Antenna Gain (in dBm Q5.2) */
#define SSB_SPROM1_AGAIN_A 0x00FF /* A-PHY */