* [patch 1/7] ssb: generate modaliases for modules
[not found] <20070814165746.863593000@bu3sch.de>
@ 2007-08-14 16:57 ` Michael Buesch
2007-08-14 16:57 ` [patch 2/7] ssb: include modalias in uevent for core Michael Buesch
` (5 subsequent siblings)
6 siblings, 0 replies; 7+ messages in thread
From: Michael Buesch @ 2007-08-14 16:57 UTC (permalink / raw)
To: John Linville; +Cc: linux-wireless, bcm43xx-dev, Johannes Berg
This makes the build system magic generate the appropriate
modaliases for MODULE_DEVICE_TABLE(ssb, ...)
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Michael Buesch <mb@bu3sch.de>
Index: ssb-merge-new/include/linux/mod_devicetable.h
===================================================================
--- ssb-merge-new.orig/include/linux/mod_devicetable.h 2007-08-11 01:57:43.000000000 +0200
+++ ssb-merge-new/include/linux/mod_devicetable.h 2007-08-11 20:26:09.000000000 +0200
@@ -339,4 +339,19 @@ struct parisc_device_id {
#define PA_HVERSION_ANY_ID 0xffff
#define PA_SVERSION_ANY_ID 0xffffffff
+/* SSB core, see drivers/ssb/ */
+struct ssb_device_id {
+ __u16 vendor;
+ __u16 coreid;
+ __u8 revision;
+};
+#define SSB_DEVICE(_vendor, _coreid, _revision) \
+ { .vendor = _vendor, .coreid = _coreid, .revision = _revision, }
+#define SSB_DEVTABLE_END \
+ { 0, },
+
+#define SSB_ANY_VENDOR 0xFFFF
+#define SSB_ANY_ID 0xFFFF
+#define SSB_ANY_REV 0xFF
+
#endif /* LINUX_MOD_DEVICETABLE_H */
Index: ssb-merge-new/include/linux/ssb/ssb.h
===================================================================
--- ssb-merge-new.orig/include/linux/ssb/ssb.h 2007-08-11 01:57:44.000000000 +0200
+++ ssb-merge-new/include/linux/ssb/ssb.h 2007-08-11 20:26:09.000000000 +0200
@@ -6,6 +6,7 @@
#include <linux/types.h>
#include <linux/spinlock.h>
#include <linux/pci.h>
+#include <linux/mod_devicetable.h>
#include <linux/ssb/ssb_regs.h>
@@ -153,20 +154,6 @@ struct ssb_bus_ops {
/* Vendor-ID values */
#define SSB_VENDOR_BROADCOM 0x4243
-struct ssb_device_id {
- u16 vendor;
- u16 coreid;
- u8 revision;
-};
-#define SSB_DEVICE(_vendor, _coreid, _revision) \
- { .vendor = _vendor, .coreid = _coreid, .revision = _revision, }
-#define SSB_DEVTABLE_END \
- { 0, },
-
-#define SSB_ANY_VENDOR 0xFFFF
-#define SSB_ANY_ID 0xFFFF
-#define SSB_ANY_REV 0xFF
-
/* Some kernel subsystems poke with dev->drvdata, so we must use the
* following ugly workaround to get from struct device to struct ssb_device */
struct __ssb_dev_wrapper {
Index: ssb-merge-new/scripts/mod/file2alias.c
===================================================================
--- ssb-merge-new.orig/scripts/mod/file2alias.c 2007-08-11 01:57:48.000000000 +0200
+++ ssb-merge-new/scripts/mod/file2alias.c 2007-08-11 20:26:09.000000000 +0200
@@ -484,6 +484,21 @@ static int do_parisc_entry(const char *f
return 1;
}
+/* Looks like: ssb:vNidNrevN. */
+static int do_ssb_entry(const char *filename,
+ struct ssb_device_id *id, char *alias)
+{
+ id->vendor = TO_NATIVE(id->vendor);
+ id->coreid = TO_NATIVE(id->coreid);
+ id->revision = TO_NATIVE(id->revision);
+
+ strcpy(alias, "ssb:");
+ ADD(alias, "v", id->vendor != SSB_ANY_VENDOR, id->vendor);
+ ADD(alias, "id", id->coreid != SSB_ANY_ID, id->coreid);
+ ADD(alias, "rev", id->revision != SSB_ANY_REV, id->revision);
+ return 1;
+}
+
/* Ignore any prefix, eg. v850 prepends _ */
static inline int sym_is(const char *symbol, const char *name)
{
@@ -599,6 +614,10 @@ void handle_moddevtable(struct module *m
do_table(symval, sym->st_size,
sizeof(struct parisc_device_id), "parisc",
do_parisc_entry, mod);
+ else if (sym_is(symname, "__mod_ssb_device_table"))
+ do_table(symval, sym->st_size,
+ sizeof(struct ssb_device_id), "ssb",
+ do_ssb_entry, mod);
}
/* Now add out buffered information to the generated C source */
--
^ permalink raw reply [flat|nested] 7+ messages in thread
* [patch 2/7] ssb: include modalias in uevent for core
[not found] <20070814165746.863593000@bu3sch.de>
2007-08-14 16:57 ` [patch 1/7] ssb: generate modaliases for modules Michael Buesch
@ 2007-08-14 16:57 ` Michael Buesch
2007-08-14 16:57 ` [patch 3/7] ssb: Add GPIO support to Chip Common and PCI core drivers Michael Buesch
` (4 subsequent siblings)
6 siblings, 0 replies; 7+ messages in thread
From: Michael Buesch @ 2007-08-14 16:57 UTC (permalink / raw)
To: John Linville; +Cc: linux-wireless, bcm43xx-dev, Johannes Berg
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Michael Buesch <mb@bu3sch.de>
Index: ssb-merge-new/drivers/ssb/main.c
===================================================================
--- ssb-merge-new.orig/drivers/ssb/main.c 2007-08-11 01:57:31.000000000 +0200
+++ ssb-merge-new/drivers/ssb/main.c 2007-08-11 20:26:57.000000000 +0200
@@ -317,6 +317,24 @@ static int ssb_bus_match(struct device *
return 0;
}
+static int ssb_device_uevent(struct device *dev, char **envp, int num_envp,
+ char *buffer, int buffer_size)
+{
+ struct ssb_device *ssb_dev = dev_to_ssb_dev(dev);
+ int ret, i = 0, length = 0;
+
+ if (!dev)
+ return -ENODEV;
+
+ ret = add_uevent_var(envp, num_envp, &i,
+ buffer, buffer_size, &length,
+ "MODALIAS=ssb:v%.4xid%.4xrev%.2x",
+ ssb_dev->id.vendor, ssb_dev->id.coreid,
+ ssb_dev->id.revision);
+ envp[i] = NULL;
+ return ret;
+}
+
static struct bus_type ssb_bustype = {
.name = "ssb",
.match = ssb_bus_match,
@@ -325,6 +343,7 @@ static struct bus_type ssb_bustype = {
.shutdown = ssb_device_shutdown,
.suspend = ssb_device_suspend,
.resume = ssb_device_resume,
+ .uevent = ssb_device_uevent,
};
static void ssb_buses_lock(void)
--
^ permalink raw reply [flat|nested] 7+ messages in thread
* [patch 3/7] ssb: Add GPIO support to Chip Common and PCI core drivers
[not found] <20070814165746.863593000@bu3sch.de>
2007-08-14 16:57 ` [patch 1/7] ssb: generate modaliases for modules Michael Buesch
2007-08-14 16:57 ` [patch 2/7] ssb: include modalias in uevent for core Michael Buesch
@ 2007-08-14 16:57 ` Michael Buesch
2007-08-14 16:57 ` [patch 4/7] ssb: Fix a warning in PCI core driver Michael Buesch
` (3 subsequent siblings)
6 siblings, 0 replies; 7+ messages in thread
From: Michael Buesch @ 2007-08-14 16:57 UTC (permalink / raw)
To: John Linville; +Cc: linux-wireless, bcm43xx-dev, Aurelien Jarno
From: Aurelien Jarno <aurelien@aurel32.net>
The patch below adds a functions to Chip Common and PCI core drivers to
access the GPIO lines.
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Michael Buesch <mb@bu3sch.de>
Index: ssb-merge-new/drivers/ssb/driver_chipcommon.c
===================================================================
--- ssb-merge-new.orig/drivers/ssb/driver_chipcommon.c 2007-08-11 20:25:54.000000000 +0200
+++ ssb-merge-new/drivers/ssb/driver_chipcommon.c 2007-08-13 14:16:39.000000000 +0200
@@ -39,6 +39,14 @@ static inline void chipco_write32(struct
ssb_write32(cc->dev, offset, value);
}
+static inline void chipco_write32_masked(struct ssb_chipcommon *cc, u16 offset,
+ u32 mask, u32 value)
+{
+ value &= mask;
+ value |= chipco_read32(cc, offset) & ~mask;
+ chipco_write32(cc, offset, value);
+}
+
void ssb_chipco_set_clockmode(struct ssb_chipcommon *cc,
enum ssb_clkmode mode)
{
@@ -344,6 +352,21 @@ ssb_chipco_watchdog_timer_set(struct ssb
chipco_write32(cc, SSB_CHIPCO_WATCHDOG, ticks);
}
+u32 ssb_chipco_gpio_in(struct ssb_chipcommon *cc, u32 mask)
+{
+ return chipco_read32(cc, SSB_CHIPCO_GPIOIN) & mask;
+}
+
+void ssb_chipco_gpio_out(struct ssb_chipcommon *cc, u32 mask, u32 value)
+{
+ return chipco_write32_masked(cc, SSB_CHIPCO_GPIOOUT, mask, value);
+}
+
+void ssb_chipco_gpio_outen(struct ssb_chipcommon *cc, u32 mask, u32 value)
+{
+ return chipco_write32_masked(cc, SSB_CHIPCO_GPIOOUTEN, mask, value);
+}
+
#ifdef CONFIG_SSB_SERIAL
int ssb_chipco_serial_init(struct ssb_chipcommon *cc,
struct ssb_serial_port *ports)
Index: ssb-merge-new/drivers/ssb/driver_extif.c
===================================================================
--- ssb-merge-new.orig/drivers/ssb/driver_extif.c 2007-08-11 01:57:31.000000000 +0200
+++ ssb-merge-new/drivers/ssb/driver_extif.c 2007-08-13 14:16:39.000000000 +0200
@@ -27,6 +27,14 @@ static inline void extif_write32(struct
ssb_write32(extif->dev, offset, value);
}
+static inline void extif_write32_masked(struct ssb_extif *extif, u16 offset,
+ u32 mask, u32 value)
+{
+ value &= mask;
+ value |= extif_read32(extif, offset) & ~mask;
+ extif_write32(extif, offset, value);
+}
+
#ifdef CONFIG_SSB_SERIAL
static bool serial_exists(u8 *regs)
{
@@ -102,3 +110,20 @@ void ssb_extif_get_clockcontrol(struct s
*m = extif_read32(extif, SSB_EXTIF_CLOCK_SB);
}
+u32 ssb_extif_gpio_in(struct ssb_extif *extif, u32 mask)
+{
+ return extif_read32(extif, SSB_EXTIF_GPIO_IN) & mask;
+}
+
+void ssb_extif_gpio_out(struct ssb_extif *extif, u32 mask, u32 value)
+{
+ return extif_write32_masked(extif, SSB_EXTIF_GPIO_OUT(0),
+ mask, value);
+}
+
+void ssb_extif_gpio_outen(struct ssb_extif *extif, u32 mask, u32 value)
+{
+ return extif_write32_masked(extif, SSB_EXTIF_GPIO_OUTEN(0),
+ mask, value);
+}
+
Index: ssb-merge-new/include/linux/ssb/ssb_driver_chipcommon.h
===================================================================
--- ssb-merge-new.orig/include/linux/ssb/ssb_driver_chipcommon.h 2007-08-11 01:57:44.000000000 +0200
+++ ssb-merge-new/include/linux/ssb/ssb_driver_chipcommon.h 2007-08-13 14:16:39.000000000 +0200
@@ -382,6 +382,12 @@ extern void ssb_chipco_set_clockmode(str
extern void ssb_chipco_watchdog_timer_set(struct ssb_chipcommon *cc,
u32 ticks);
+u32 ssb_chipco_gpio_in(struct ssb_chipcommon *cc, u32 mask);
+
+void ssb_chipco_gpio_out(struct ssb_chipcommon *cc, u32 mask, u32 value);
+
+void ssb_chipco_gpio_outen(struct ssb_chipcommon *cc, u32 mask, u32 value);
+
#ifdef CONFIG_SSB_SERIAL
extern int ssb_chipco_serial_init(struct ssb_chipcommon *cc,
struct ssb_serial_port *ports);
Index: ssb-merge-new/include/linux/ssb/ssb_driver_extif.h
===================================================================
--- ssb-merge-new.orig/include/linux/ssb/ssb_driver_extif.h 2007-08-11 01:57:44.000000000 +0200
+++ ssb-merge-new/include/linux/ssb/ssb_driver_extif.h 2007-08-13 14:16:39.000000000 +0200
@@ -171,6 +171,12 @@ extern void ssb_extif_get_clockcontrol(s
extern void ssb_extif_timing_init(struct ssb_extif *extif,
unsigned long ns);
+u32 ssb_extif_gpio_in(struct ssb_extif *extif, u32 mask);
+
+void ssb_extif_gpio_out(struct ssb_extif *extif, u32 mask, u32 value);
+
+void ssb_extif_gpio_outen(struct ssb_extif *extif, u32 mask, u32 value);
+
#ifdef CONFIG_SSB_SERIAL
extern int ssb_extif_serial_init(struct ssb_extif *extif,
struct ssb_serial_port *ports);
--
^ permalink raw reply [flat|nested] 7+ messages in thread
* [patch 4/7] ssb: Fix a warning in PCI core driver
[not found] <20070814165746.863593000@bu3sch.de>
` (2 preceding siblings ...)
2007-08-14 16:57 ` [patch 3/7] ssb: Add GPIO support to Chip Common and PCI core drivers Michael Buesch
@ 2007-08-14 16:57 ` Michael Buesch
2007-08-14 16:57 ` [patch 5/7] ssb: Add Broadcom 43xx PCI to SSB bridge Michael Buesch
` (2 subsequent siblings)
6 siblings, 0 replies; 7+ messages in thread
From: Michael Buesch @ 2007-08-14 16:57 UTC (permalink / raw)
To: John Linville; +Cc: linux-wireless, bcm43xx-dev, Aurelien Jarno
From: Aurelien Jarno <aurelien@aurel32.net>
The patch below fixes a warning spotted a few days ago by Andrew Morton
while releasing 2.6.23-rc2-mm1.
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Michael Buesch <mb@bu3sch.de>
Index: ssb-merge-new/include/linux/ssb/ssb_regs.h
===================================================================
--- ssb-merge-new.orig/include/linux/ssb/ssb_regs.h 2007-08-11 01:57:44.000000000 +0200
+++ ssb-merge-new/include/linux/ssb/ssb_regs.h 2007-08-13 14:17:30.000000000 +0200
@@ -5,24 +5,24 @@
/* SiliconBackplane Address Map.
* All regions may not exist on all chips.
*/
-#define SSB_SDRAM_BASE 0x00000000 /* Physical SDRAM */
-#define SSB_PCI_MEM 0x08000000 /* Host Mode sb2pcitranslation0 (64 MB) */
-#define SSB_PCI_CFG 0x0c000000 /* Host Mode sb2pcitranslation1 (64 MB) */
-#define SSB_SDRAM_SWAPPED 0x10000000 /* Byteswapped Physical SDRAM */
-#define SSB_ENUM_BASE 0x18000000 /* Enumeration space base */
-#define SSB_ENUM_LIMIT 0x18010000 /* Enumeration space limit */
-
-#define SSB_FLASH2 0x1c000000 /* Flash Region 2 (region 1 shadowed here) */
-#define SSB_FLASH2_SZ 0x02000000 /* Size of Flash Region 2 */
-
-#define SSB_EXTIF_BASE 0x1f000000 /* External Interface region base address */
-#define SSB_FLASH1 0x1fc00000 /* Flash Region 1 */
-#define SSB_FLASH1_SZ 0x00400000 /* Size of Flash Region 1 */
-
-#define SSB_PCI_DMA 0x40000000 /* Client Mode sb2pcitranslation2 (1 GB) */
-#define SSB_PCI_DMA_SZ 0x40000000 /* Client Mode sb2pcitranslation2 size in bytes */
-#define SSB_PCIE_DMA_L32 0x00000000 /* PCIE Client Mode sb2pcitranslation2 (2 ZettaBytes), low 32 bits */
-#define SSB_PCIE_DMA_H32 0x80000000 /* PCIE Client Mode sb2pcitranslation2 (2 ZettaBytes), high 32 bits */
+#define SSB_SDRAM_BASE 0x00000000U /* Physical SDRAM */
+#define SSB_PCI_MEM 0x08000000U /* Host Mode sb2pcitranslation0 (64 MB) */
+#define SSB_PCI_CFG 0x0c000000U /* Host Mode sb2pcitranslation1 (64 MB) */
+#define SSB_SDRAM_SWAPPED 0x10000000U /* Byteswapped Physical SDRAM */
+#define SSB_ENUM_BASE 0x18000000U /* Enumeration space base */
+#define SSB_ENUM_LIMIT 0x18010000U /* Enumeration space limit */
+
+#define SSB_FLASH2 0x1c000000U /* Flash Region 2 (region 1 shadowed here) */
+#define SSB_FLASH2_SZ 0x02000000U /* Size of Flash Region 2 */
+
+#define SSB_EXTIF_BASE 0x1f000000U /* External Interface region base address */
+#define SSB_FLASH1 0x1fc00000U /* Flash Region 1 */
+#define SSB_FLASH1_SZ 0x00400000U /* Size of Flash Region 1 */
+
+#define SSB_PCI_DMA 0x40000000U /* Client Mode sb2pcitranslation2 (1 GB) */
+#define SSB_PCI_DMA_SZ 0x40000000U /* Client Mode sb2pcitranslation2 size in bytes */
+#define SSB_PCIE_DMA_L32 0x00000000U /* PCIE Client Mode sb2pcitranslation2 (2 ZettaBytes), low 32 bits */
+#define SSB_PCIE_DMA_H32 0x80000000U /* PCIE Client Mode sb2pcitranslation2 (2 ZettaBytes), high 32 bits */
#define SSB_EUART (SSB_EXTIF_BASE + 0x00800000)
#define SSB_LED (SSB_EXTIF_BASE + 0x00900000)
--
^ permalink raw reply [flat|nested] 7+ messages in thread
* [patch 5/7] ssb: Add Broadcom 43xx PCI to SSB bridge
[not found] <20070814165746.863593000@bu3sch.de>
` (3 preceding siblings ...)
2007-08-14 16:57 ` [patch 4/7] ssb: Fix a warning in PCI core driver Michael Buesch
@ 2007-08-14 16:57 ` Michael Buesch
2007-08-14 16:57 ` [patch 6/7] ssb: Add debugging for buspower Michael Buesch
2007-08-14 16:57 ` [patch 7/7] ssb: Add kconfig SELECT workaround Michael Buesch
6 siblings, 0 replies; 7+ messages in thread
From: Michael Buesch @ 2007-08-14 16:57 UTC (permalink / raw)
To: John Linville; +Cc: linux-wireless, bcm43xx-dev
Signed-off-by: Michael Buesch <mb@bu3sch.de>
Index: ssb-merge-new/drivers/ssb/Makefile
===================================================================
--- ssb-merge-new.orig/drivers/ssb/Makefile 2007-08-13 17:35:33.000000000 +0200
+++ ssb-merge-new/drivers/ssb/Makefile 2007-08-13 17:35:49.000000000 +0200
@@ -11,4 +11,8 @@ ssb-$(CONFIG_SSB_DRIVER_MIPS) += driver
ssb-$(CONFIG_SSB_DRIVER_EXTIF) += driver_extif.o
ssb-$(CONFIG_SSB_DRIVER_PCICORE) += driver_pcicore.o
+# b43 pci-ssb-bridge driver
+# Not strictly a part of SSB, but kept here for convenience
+ssb-$(CONFIG_SSB_PCIHOST) += b43_pci_bridge.o
+
obj-$(CONFIG_SSB) += ssb.o
Index: ssb-merge-new/drivers/ssb/b43_pci_bridge.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ ssb-merge-new/drivers/ssb/b43_pci_bridge.c 2007-08-13 17:42:24.000000000 +0200
@@ -0,0 +1,45 @@
+/*
+ * Broadcom 43xx PCI-SSB bridge module
+ *
+ * This technically is a seperate PCI driver module, but
+ * because of its small size we include it in the SSB core
+ * instead of creating a standalone module.
+ *
+ * Copyright 2007 Michael Buesch <mb@bu3sch.de>
+ *
+ * Licensed under the GNU/GPL. See COPYING for details.
+ */
+
+#include <linux/pci.h>
+#include <linux/ssb/ssb.h>
+
+
+static const struct pci_device_id b43_pci_bridge_tbl[] = {
+ { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4307) },
+ { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4311) },
+ { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4312) },
+ { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4318) },
+ { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4319) },
+ { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4320) },
+ { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4321) },
+ { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4324) },
+ { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4325) },
+ { 0, },
+};
+MODULE_DEVICE_TABLE(pci, b43_pci_bridge_tbl);
+
+static struct pci_driver b43_pci_bridge_driver = {
+ .name = "b43-pci-bridge",
+ .id_table = b43_pci_bridge_tbl,
+};
+
+
+int __init b43_pci_ssb_bridge_init(void)
+{
+ return ssb_pcihost_register(&b43_pci_bridge_driver);
+}
+
+void __exit b43_pci_ssb_bridge_exit(void)
+{
+ ssb_pcihost_unregister(&b43_pci_bridge_driver);
+}
Index: ssb-merge-new/drivers/ssb/main.c
===================================================================
--- ssb-merge-new.orig/drivers/ssb/main.c 2007-08-13 17:35:49.000000000 +0200
+++ ssb-merge-new/drivers/ssb/main.c 2007-08-13 17:40:14.000000000 +0200
@@ -1121,12 +1121,21 @@ static int __init ssb_modinit(void)
if (err)
bus_unregister(&ssb_bustype);
+ err = b43_pci_ssb_bridge_init();
+ if (err) {
+ ssb_printk(KERN_ERR "Broadcom 43xx PCI-SSB-bridge "
+ "initialization failed");
+ /* don't fail SSB init because of this */
+ err = 0;
+ }
+
return err;
}
subsys_initcall(ssb_modinit);
static void __exit ssb_modexit(void)
{
+ b43_pci_ssb_bridge_exit();
bus_unregister(&ssb_bustype);
}
module_exit(ssb_modexit)
Index: ssb-merge-new/drivers/ssb/ssb_private.h
===================================================================
--- ssb-merge-new.orig/drivers/ssb/ssb_private.h 2007-08-13 17:35:33.000000000 +0200
+++ ssb-merge-new/drivers/ssb/ssb_private.h 2007-08-13 17:35:49.000000000 +0200
@@ -119,4 +119,18 @@ extern int ssb_devices_freeze(struct ssb
extern int ssb_devices_thaw(struct ssb_bus *bus);
extern struct ssb_bus *ssb_pci_dev_to_bus(struct pci_dev *pdev);
+/* b43_pci_bridge.c */
+#ifdef CONFIG_SSB_PCIHOST
+extern int __init b43_pci_ssb_bridge_init(void);
+extern void __exit b43_pci_ssb_bridge_exit(void);
+#else /* CONFIG_SSB_PCIHOST */
+static inline int b43_pci_ssb_bridge_init(void)
+{
+ return 0;
+}
+static inline void b43_pci_ssb_bridge_exit(void)
+{
+}
+#endif /* CONFIG_SSB_PCIHOST */
+
#endif /* LINUX_SSB_PRIVATE_H_ */
--
^ permalink raw reply [flat|nested] 7+ messages in thread
* [patch 6/7] ssb: Add debugging for buspower
[not found] <20070814165746.863593000@bu3sch.de>
` (4 preceding siblings ...)
2007-08-14 16:57 ` [patch 5/7] ssb: Add Broadcom 43xx PCI to SSB bridge Michael Buesch
@ 2007-08-14 16:57 ` Michael Buesch
2007-08-14 16:57 ` [patch 7/7] ssb: Add kconfig SELECT workaround Michael Buesch
6 siblings, 0 replies; 7+ messages in thread
From: Michael Buesch @ 2007-08-14 16:57 UTC (permalink / raw)
To: John Linville; +Cc: linux-wireless, bcm43xx-dev
Always make sure buspower is applied, when accessing the PCI MMIO space.
Otherwise this can result in crashes.
Signed-off-by: Michael Buesch <mb@bu3sch.de>
Index: ssb-merge-new/drivers/ssb/main.c
===================================================================
--- ssb-merge-new.orig/drivers/ssb/main.c 2007-08-13 17:33:23.000000000 +0200
+++ ssb-merge-new/drivers/ssb/main.c 2007-08-13 17:33:34.000000000 +0200
@@ -131,6 +131,9 @@ static void ssb_bus_suspend(struct ssb_b
#ifdef CONFIG_SSB_DRIVER_PCICORE
bus->pcicore.setup_done = 0;
#endif
+#ifdef CONFIG_SSB_DEBUG
+ bus->powered_up = 0;
+#endif
}
static int ssb_device_suspend(struct device *dev, pm_message_t state)
@@ -486,9 +489,14 @@ static int ssb_attach_queued_buses(void)
* is too early in boot for embedded systems
* (no udelay() available). So do it here in attach stage.
*/
+ err = ssb_bus_powerup(bus, 0);
+ if (err)
+ goto error;
ssb_pcicore_init(&bus->pcicore);
+ ssb_bus_may_powerdown(bus);
err = ssb_devices_register(bus);
+error:
if (err) {
drop_them_all = 1;
list_del(&bus->list);
@@ -586,11 +594,17 @@ static int ssb_bus_register(struct ssb_b
goto err_pci_exit;
/* Initialize basic system devices (if available) */
+ err = ssb_bus_powerup(bus, 0);
+ if (err)
+ goto err_pcmcia_exit;
ssb_chipcommon_init(&bus->chipco);
ssb_mipscore_init(&bus->mipscore);
err = ssb_fetch_invariants(bus, get_invariants);
- if (err)
+ if (err) {
+ ssb_bus_may_powerdown(bus);
goto err_pcmcia_exit;
+ }
+ ssb_bus_may_powerdown(bus);
/* Queue it for attach.
* See the comment at the ssb_is_early_boot definition. */
@@ -1012,24 +1026,27 @@ EXPORT_SYMBOL(ssb_dma_set_mask);
int ssb_bus_may_powerdown(struct ssb_bus *bus)
{
struct ssb_chipcommon *cc;
- int err;
+ int err = 0;
/* On buses where more than one core may be working
* at a time, we must not powerdown stuff if there are
* still cores that may want to run. */
if (bus->bustype == SSB_BUSTYPE_SSB)
- return 0;
+ goto out;
cc = &bus->chipco;
ssb_chipco_set_clockmode(cc, SSB_CLKMODE_SLOW);
err = ssb_pci_xtal(bus, SSB_GPIO_XTAL | SSB_GPIO_PLL, 0);
if (err)
goto error;
-
- return 0;
+out:
+#ifdef CONFIG_SSB_DEBUG
+ bus->powered_up = 0;
+#endif
+ return err;
error:
ssb_printk(KERN_ERR PFX "Bus powerdown failed\n");
- return err;
+ goto out;
}
EXPORT_SYMBOL(ssb_bus_may_powerdown);
@@ -1046,6 +1063,9 @@ int ssb_bus_powerup(struct ssb_bus *bus,
mode = dynamic_pctl ? SSB_CLKMODE_DYNAMIC : SSB_CLKMODE_FAST;
ssb_chipco_set_clockmode(cc, mode);
+#ifdef CONFIG_SSB_DEBUG
+ bus->powered_up = 1;
+#endif
return 0;
error:
ssb_printk(KERN_ERR PFX "Bus powerup failed\n");
Index: ssb-merge-new/drivers/ssb/pci.c
===================================================================
--- ssb-merge-new.orig/drivers/ssb/pci.c 2007-08-11 20:25:54.000000000 +0200
+++ ssb-merge-new/drivers/ssb/pci.c 2007-08-13 17:33:34.000000000 +0200
@@ -499,10 +499,34 @@ out:
return err;
}
+#ifdef CONFIG_SSB_DEBUG
+static int ssb_pci_assert_buspower(struct ssb_bus *bus)
+{
+ if (likely(bus->powered_up))
+ return 0;
+
+ printk(KERN_ERR PFX "FATAL ERROR: Bus powered down "
+ "while accessing PCI MMIO space\n");
+ if (bus->power_warn_count <= 10) {
+ bus->power_warn_count++;
+ dump_stack();
+ }
+
+ return -ENODEV;
+}
+#else /* DEBUG */
+static inline int ssb_pci_assert_buspower(struct ssb_bus *bus)
+{
+ return 0;
+}
+#endif /* DEBUG */
+
static u16 ssb_pci_read16(struct ssb_device *dev, u16 offset)
{
struct ssb_bus *bus = dev->bus;
+ if (unlikely(ssb_pci_assert_buspower(bus)))
+ return 0xFFFF;
if (unlikely(bus->mapped_device != dev)) {
if (unlikely(ssb_pci_switch_core(bus, dev)))
return 0xFFFF;
@@ -514,6 +538,8 @@ static u32 ssb_pci_read32(struct ssb_dev
{
struct ssb_bus *bus = dev->bus;
+ if (unlikely(ssb_pci_assert_buspower(bus)))
+ return 0xFFFFFFFF;
if (unlikely(bus->mapped_device != dev)) {
if (unlikely(ssb_pci_switch_core(bus, dev)))
return 0xFFFFFFFF;
@@ -525,6 +551,8 @@ static void ssb_pci_write16(struct ssb_d
{
struct ssb_bus *bus = dev->bus;
+ if (unlikely(ssb_pci_assert_buspower(bus)))
+ return;
if (unlikely(bus->mapped_device != dev)) {
if (unlikely(ssb_pci_switch_core(bus, dev)))
return;
@@ -536,6 +564,8 @@ static void ssb_pci_write32(struct ssb_d
{
struct ssb_bus *bus = dev->bus;
+ if (unlikely(ssb_pci_assert_buspower(bus)))
+ return;
if (unlikely(bus->mapped_device != dev)) {
if (unlikely(ssb_pci_switch_core(bus, dev)))
return;
Index: ssb-merge-new/include/linux/ssb/ssb.h
===================================================================
--- ssb-merge-new.orig/include/linux/ssb/ssb.h 2007-08-11 20:26:09.000000000 +0200
+++ ssb-merge-new/include/linux/ssb/ssb.h 2007-08-13 17:33:34.000000000 +0200
@@ -319,8 +319,13 @@ struct ssb_bus {
/* Contents of the SPROM. */
struct ssb_sprom sprom;
- /* Internal. */
+ /* Internal-only stuff follows. Do not touch. */
struct list_head list;
+#ifdef CONFIG_SSB_DEBUG
+ /* Is the bus already powered up? */
+ bool powered_up;
+ int power_warn_count;
+#endif /* DEBUG */
};
/* The initialization-invariants. */
--
^ permalink raw reply [flat|nested] 7+ messages in thread
* [patch 7/7] ssb: Add kconfig SELECT workaround
[not found] <20070814165746.863593000@bu3sch.de>
` (5 preceding siblings ...)
2007-08-14 16:57 ` [patch 6/7] ssb: Add debugging for buspower Michael Buesch
@ 2007-08-14 16:57 ` Michael Buesch
6 siblings, 0 replies; 7+ messages in thread
From: Michael Buesch @ 2007-08-14 16:57 UTC (permalink / raw)
To: John Linville; +Cc: linux-wireless, bcm43xx-dev
Signed-off-by: Michael Buesch <mb@bu3sch.de>
Index: ssb-merge-new/drivers/ssb/Kconfig
===================================================================
--- ssb-merge-new.orig/drivers/ssb/Kconfig 2007-08-14 17:05:12.000000000 +0200
+++ ssb-merge-new/drivers/ssb/Kconfig 2007-08-14 17:22:13.000000000 +0200
@@ -1,18 +1,33 @@
menu "Sonics Silicon Backplane"
+config SSB_POSSIBLE
+ bool
+ depends on HAS_IOMEM
+ default y
+
config SSB
tristate "Sonics Silicon Backplane support"
- depends on HAS_IOMEM
+ depends on SSB_POSSIBLE
help
- Support for the Sonics Silicon Backplane bus
+ Support for the Sonics Silicon Backplane bus.
+ You only need to enable this option, if you are
+ configuring a kernel for an embedded system with
+ this bus.
+ It will be auto-selected if needed in other
+ environments.
- The module will be called ssb
+ The module will be called ssb.
- If unsure, say M
+ If unsure, say N.
+
+config SSB_PCIHOST_POSSIBLE
+ bool
+ depends on SSB && PCI
+ default y
config SSB_PCIHOST
bool "Support for SSB on PCI-bus host"
- depends on SSB && PCI
+ depends on SSB_PCIHOST_POSSIBLE
default y
help
Support for a Sonics Silicon Backplane on top
@@ -20,9 +35,14 @@ config SSB_PCIHOST
If unsure, say Y
+config SSB_PCMCIAHOST_POSSIBLE
+ bool
+ depends on SSB && PCMCIA && EXPERIMENTAL
+ default y
+
config SSB_PCMCIAHOST
bool "Support for SSB on PCMCIA-bus host (EXPERIMENTAL)"
- depends on SSB && PCMCIA && EXPERIMENTAL
+ depends on SSB_PCMCIAHOST_POSSIBLE
help
Support for a Sonics Silicon Backplane on top
of a PCMCIA device.
@@ -31,7 +51,7 @@ config SSB_PCMCIAHOST
config SSB_SILENT
bool "No SSB kernel messages"
- depends on SSB
+ depends on SSB && EMBEDDED
help
This option turns off all Sonics Silicon Backplane printks.
Note that you won't be able to identify problems, once
@@ -55,9 +75,14 @@ config SSB_SERIAL
depends on SSB
# ChipCommon and ExtIf serial support routines.
+config SSB_DRIVER_PCICORE_POSSIBLE
+ bool
+ depends on SSB_PCIHOST
+ default y
+
config SSB_DRIVER_PCICORE
bool "SSB PCI core driver"
- depends on SSB && SSB_PCIHOST
+ depends on SSB_DRIVER_PCICORE_POSSIBLE
help
Driver for the Sonics Silicon Backplane attached
Broadcom PCI core.
--
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2007-08-14 17:00 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20070814165746.863593000@bu3sch.de>
2007-08-14 16:57 ` [patch 1/7] ssb: generate modaliases for modules Michael Buesch
2007-08-14 16:57 ` [patch 2/7] ssb: include modalias in uevent for core Michael Buesch
2007-08-14 16:57 ` [patch 3/7] ssb: Add GPIO support to Chip Common and PCI core drivers Michael Buesch
2007-08-14 16:57 ` [patch 4/7] ssb: Fix a warning in PCI core driver Michael Buesch
2007-08-14 16:57 ` [patch 5/7] ssb: Add Broadcom 43xx PCI to SSB bridge Michael Buesch
2007-08-14 16:57 ` [patch 6/7] ssb: Add debugging for buspower Michael Buesch
2007-08-14 16:57 ` [patch 7/7] ssb: Add kconfig SELECT workaround Michael Buesch
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).