summaryrefslogtreecommitdiffstats
path: root/target/linux/brcm63xx/patches-2.6.37
diff options
context:
space:
mode:
authorhauke <hauke@3c298f89-4303-0410-b956-a3cf2f4a3e73>2011-05-01 20:28:35 +0000
committerhauke <hauke@3c298f89-4303-0410-b956-a3cf2f4a3e73>2011-05-01 20:28:35 +0000
commit374bb82f67f49829cb443fe95a11d88c83675be4 (patch)
treea4af4b9a59d3ffae404928bc156a91909a87be21 /target/linux/brcm63xx/patches-2.6.37
parent505d82b643b326b3a63484cdce6fc07e7aa28277 (diff)
brcm47xx: add fallback sprom for pci devices without an own sprom.
If there is no sprom on an ssb based pci device on the brcm47xx architecture ssb now asks the architecture code to look into the nvram to get some sprom data for this device. Now we are able to read out pci/1/1/ foo or pci/1/3/ foo config options. This will fix some problems where the wireless devices does not got an mac address and the following message was show: ssb: WARNING: Invalid SPROM CRC (corrupt SPROM) git-svn-id: svn://svn.openwrt.org/openwrt/trunk@26801 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/brcm63xx/patches-2.6.37')
-rw-r--r--target/linux/brcm63xx/patches-2.6.37/110-gpiodev.patch2
-rw-r--r--target/linux/brcm63xx/patches-2.6.37/180-udc_preliminary_support.patch4
-rw-r--r--target/linux/brcm63xx/patches-2.6.37/200-extended-platform-devices.patch2
-rw-r--r--target/linux/brcm63xx/patches-2.6.37/200-spi-board-info.patch2
-rw-r--r--target/linux/brcm63xx/patches-2.6.37/240-spi.patch2
-rw-r--r--target/linux/brcm63xx/patches-2.6.37/260-no_ehci_over_current_check.patch2
-rw-r--r--target/linux/brcm63xx/patches-2.6.37/500-ssb-add-callback-for-sprom.patch157
-rw-r--r--target/linux/brcm63xx/patches-2.6.37/977-ssb_export_fallback_sprom.patch37
8 files changed, 182 insertions, 26 deletions
diff --git a/target/linux/brcm63xx/patches-2.6.37/110-gpiodev.patch b/target/linux/brcm63xx/patches-2.6.37/110-gpiodev.patch
index 99ee29f91..fc99f5345 100644
--- a/target/linux/brcm63xx/patches-2.6.37/110-gpiodev.patch
+++ b/target/linux/brcm63xx/patches-2.6.37/110-gpiodev.patch
@@ -1,6 +1,6 @@
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
-@@ -852,6 +852,10 @@ static struct platform_device mtd_dev =
+@@ -852,6 +852,10 @@ static struct platform_device mtd_dev =
.num_resources = ARRAY_SIZE(mtd_resources),
};
diff --git a/target/linux/brcm63xx/patches-2.6.37/180-udc_preliminary_support.patch b/target/linux/brcm63xx/patches-2.6.37/180-udc_preliminary_support.patch
index 2f6a27e06..6011db71e 100644
--- a/target/linux/brcm63xx/patches-2.6.37/180-udc_preliminary_support.patch
+++ b/target/linux/brcm63xx/patches-2.6.37/180-udc_preliminary_support.patch
@@ -17,7 +17,7 @@
};
static struct board_info __initdata board_rta1025w_16 = {
-@@ -1001,6 +1004,9 @@ int __init board_register_devices(void)
+@@ -1002,6 +1005,9 @@ int __init board_register_devices(void)
if (board.has_dsp)
bcm63xx_dsp_register(&board.dsp);
@@ -214,7 +214,7 @@
* SPI clock
*/
static void spi_set(struct clk *clk, int enable)
-@@ -208,6 +232,8 @@ struct clk *clk_get(struct device *dev,
+@@ -208,6 +232,8 @@ struct clk *clk_get(struct device *dev,
return &clk_ephy;
if (!strcmp(id, "usbh"))
return &clk_usbh;
diff --git a/target/linux/brcm63xx/patches-2.6.37/200-extended-platform-devices.patch b/target/linux/brcm63xx/patches-2.6.37/200-extended-platform-devices.patch
index 70637e5d4..e9619d472 100644
--- a/target/linux/brcm63xx/patches-2.6.37/200-extended-platform-devices.patch
+++ b/target/linux/brcm63xx/patches-2.6.37/200-extended-platform-devices.patch
@@ -1,6 +1,6 @@
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
-@@ -1007,6 +1007,9 @@ int __init board_register_devices(void)
+@@ -1008,6 +1008,9 @@ int __init board_register_devices(void)
if (board.has_udc0)
bcm63xx_udc_register();
diff --git a/target/linux/brcm63xx/patches-2.6.37/200-spi-board-info.patch b/target/linux/brcm63xx/patches-2.6.37/200-spi-board-info.patch
index d73d6f0ac..fc39eb4ce 100644
--- a/target/linux/brcm63xx/patches-2.6.37/200-spi-board-info.patch
+++ b/target/linux/brcm63xx/patches-2.6.37/200-spi-board-info.patch
@@ -1,6 +1,6 @@
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
-@@ -1010,6 +1010,9 @@ int __init board_register_devices(void)
+@@ -1011,6 +1011,9 @@ int __init board_register_devices(void)
if (board.num_devs)
platform_add_devices(board.devs, board.num_devs);
diff --git a/target/linux/brcm63xx/patches-2.6.37/240-spi.patch b/target/linux/brcm63xx/patches-2.6.37/240-spi.patch
index 5a81a0899..35c490c4d 100644
--- a/target/linux/brcm63xx/patches-2.6.37/240-spi.patch
+++ b/target/linux/brcm63xx/patches-2.6.37/240-spi.patch
@@ -990,7 +990,7 @@
#include <board_bcm963xx.h>
#define PFX "board_bcm963xx: "
-@@ -1586,6 +1587,9 @@ int __init board_register_devices(void)
+@@ -1587,6 +1588,9 @@ int __init board_register_devices(void)
if (board.num_spis)
spi_register_board_info(board.spis, board.num_spis);
diff --git a/target/linux/brcm63xx/patches-2.6.37/260-no_ehci_over_current_check.patch b/target/linux/brcm63xx/patches-2.6.37/260-no_ehci_over_current_check.patch
index 816343e63..513ff999a 100644
--- a/target/linux/brcm63xx/patches-2.6.37/260-no_ehci_over_current_check.patch
+++ b/target/linux/brcm63xx/patches-2.6.37/260-no_ehci_over_current_check.patch
@@ -1,6 +1,6 @@
--- a/drivers/usb/host/ehci-hub.c
+++ b/drivers/usb/host/ehci-hub.c
-@@ -861,11 +861,13 @@ static int ehci_hub_control (
+@@ -882,11 +882,13 @@ static int ehci_hub_control (
* power switching; they're allowed to just limit the
* current. khubd will turn the power back on.
*/
diff --git a/target/linux/brcm63xx/patches-2.6.37/500-ssb-add-callback-for-sprom.patch b/target/linux/brcm63xx/patches-2.6.37/500-ssb-add-callback-for-sprom.patch
new file mode 100644
index 000000000..7e153a1ef
--- /dev/null
+++ b/target/linux/brcm63xx/patches-2.6.37/500-ssb-add-callback-for-sprom.patch
@@ -0,0 +1,157 @@
+From 62a518124cff3970d99f7ccdab457f4289e3b982 Mon Sep 17 00:00:00 2001
+From: Hauke Mehrtens <hauke@hauke-m.de>
+Date: Sat, 30 Apr 2011 15:42:30 +0200
+Subject: [PATCH 1/4] ssb: add callback for sprom
+
+
+Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
+---
+ arch/mips/bcm63xx/boards/board_bcm963xx.c | 16 ++++++++++++++--
+ drivers/ssb/pci.c | 13 ++++++++-----
+ drivers/ssb/sprom.c | 26 +++++++++++++++-----------
+ drivers/ssb/ssb_private.h | 2 +-
+ include/linux/ssb/ssb.h | 3 ++-
+ 5 files changed, 40 insertions(+), 20 deletions(-)
+
+--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
++++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
+@@ -1927,6 +1927,17 @@ static struct ssb_sprom bcm63xx_sprom =
+ .boardflags_lo = 0x2848,
+ .boardflags_hi = 0x0000,
+ };
++
++int bcm63xx_get_fallback_sprom(struct ssb_bus *bus)
++{
++ if (bus->bustype == SSB_BUSTYPE_PCI) {
++ memcpy(&bus->sprom, &bcm63xx_sprom, sizeof(struct ssb_sprom));
++ return 0;
++ } else {
++ printk(KERN_ERR PFX "unable to fill SPROM for given bustype.\n");
++ return -EINVAL;
++ }
++}
+ #endif
+
+ /*
+@@ -2111,8 +2122,9 @@ void __init board_prom_init(void)
+ if (!board_get_mac_address(bcm63xx_sprom.il0mac)) {
+ memcpy(bcm63xx_sprom.et0mac, bcm63xx_sprom.il0mac, ETH_ALEN);
+ memcpy(bcm63xx_sprom.et1mac, bcm63xx_sprom.il0mac, ETH_ALEN);
+- if (ssb_arch_set_fallback_sprom(&bcm63xx_sprom) < 0)
+- printk(KERN_ERR "failed to register fallback SPROM\n");
++ if (ssb_arch_register_fallback_sprom(
++ &bcm63xx_get_fallback_sprom) < 0)
++ printk(KERN_ERR PFX "failed to register fallback SPROM\n");
+ }
+ #endif
+ }
+--- a/drivers/ssb/pci.c
++++ b/drivers/ssb/pci.c
+@@ -662,7 +662,6 @@ static int sprom_extract(struct ssb_bus
+ static int ssb_pci_sprom_get(struct ssb_bus *bus,
+ struct ssb_sprom *sprom)
+ {
+- const struct ssb_sprom *fallback;
+ int err;
+ u16 *buf;
+
+@@ -707,10 +706,14 @@ static int ssb_pci_sprom_get(struct ssb_
+ if (err) {
+ /* All CRC attempts failed.
+ * Maybe there is no SPROM on the device?
+- * If we have a fallback, use that. */
+- fallback = ssb_get_fallback_sprom();
+- if (fallback) {
+- memcpy(sprom, fallback, sizeof(*sprom));
++ * Now we ask the arch code if there is some sprom
++ * avaliable for this device in some other storage */
++ err = ssb_fill_sprom_with_fallback(bus);
++ if (err) {
++ ssb_printk(KERN_WARNING PFX "WARNING: Using"
++ " fallback SPROM failed (err %d)\n",
++ err);
++ } else {
+ err = 0;
+ goto out_free;
+ }
+--- a/drivers/ssb/sprom.c
++++ b/drivers/ssb/sprom.c
+@@ -17,7 +17,7 @@
+ #include <linux/slab.h>
+
+
+-static const struct ssb_sprom *fallback_sprom;
++static int(*get_fallback_sprom)(struct ssb_bus *dev);
+
+
+ static int sprom2hex(const u16 *sprom, char *buf, size_t buf_len,
+@@ -145,13 +145,14 @@ out:
+ }
+
+ /**
+- * ssb_arch_set_fallback_sprom - Set a fallback SPROM for use if no SPROM is found.
++ * ssb_arch_register_fallback_sprom - Registers a method providing a fallback
++ * SPROM if no SPROM is found.
+ *
+- * @sprom: The SPROM data structure to register.
++ * @sprom_callback: The callbcak function.
+ *
+- * With this function the architecture implementation may register a fallback
+- * SPROM data structure. The fallback is only used for PCI based SSB devices,
+- * where no valid SPROM can be found in the shadow registers.
++ * With this function the architecture implementation may register a callback
++ * handler which wills the SPROM data structure. The fallback is only used for
++ * PCI based SSB devices, where no valid SPROM can be found in the shadow registers.
+ *
+ * This function is useful for weird architectures that have a half-assed SSB device
+ * hardwired to their PCI bus.
+@@ -163,18 +164,21 @@ out:
+ *
+ * This function is available for architecture code, only. So it is not exported.
+ */
+-int ssb_arch_set_fallback_sprom(const struct ssb_sprom *sprom)
++int ssb_arch_register_fallback_sprom(int (*sprom_callback)(struct ssb_bus *bus))
+ {
+- if (fallback_sprom)
++ if (get_fallback_sprom)
+ return -EEXIST;
+- fallback_sprom = sprom;
++ get_fallback_sprom = sprom_callback;
+
+ return 0;
+ }
+
+-const struct ssb_sprom *ssb_get_fallback_sprom(void)
++int ssb_fill_sprom_with_fallback(struct ssb_bus *bus)
+ {
+- return fallback_sprom;
++ if (!get_fallback_sprom)
++ return -ENOENT;
++
++ return get_fallback_sprom(bus);
+ }
+
+ /* http://bcm-v4.sipsolutions.net/802.11/IsSpromAvailable */
+--- a/drivers/ssb/ssb_private.h
++++ b/drivers/ssb/ssb_private.h
+@@ -171,7 +171,7 @@ ssize_t ssb_attr_sprom_store(struct ssb_
+ const char *buf, size_t count,
+ int (*sprom_check_crc)(const u16 *sprom, size_t size),
+ int (*sprom_write)(struct ssb_bus *bus, const u16 *sprom));
+-extern const struct ssb_sprom *ssb_get_fallback_sprom(void);
++extern int ssb_fill_sprom_with_fallback(struct ssb_bus *bus);
+
+
+ /* core.c */
+--- a/include/linux/ssb/ssb.h
++++ b/include/linux/ssb/ssb.h
+@@ -404,7 +404,8 @@ extern bool ssb_is_sprom_available(struc
+
+ /* Set a fallback SPROM.
+ * See kdoc at the function definition for complete documentation. */
+-extern int ssb_arch_set_fallback_sprom(const struct ssb_sprom *sprom);
++extern int ssb_arch_register_fallback_sprom(
++ int (*sprom_callback)(struct ssb_bus *bus));
+
+ /* Suspend a SSB bus.
+ * Call this from the parent bus suspend routine. */
diff --git a/target/linux/brcm63xx/patches-2.6.37/977-ssb_export_fallback_sprom.patch b/target/linux/brcm63xx/patches-2.6.37/977-ssb_export_fallback_sprom.patch
index 2a22a3a38..3447c37a3 100644
--- a/target/linux/brcm63xx/patches-2.6.37/977-ssb_export_fallback_sprom.patch
+++ b/target/linux/brcm63xx/patches-2.6.37/977-ssb_export_fallback_sprom.patch
@@ -1,20 +1,19 @@
---- a/drivers/ssb/sprom.c
-+++ b/drivers/ssb/sprom.c
-@@ -176,6 +176,7 @@ const struct ssb_sprom *ssb_get_fallback
- {
- return fallback_sprom;
- }
-+EXPORT_SYMBOL(ssb_get_fallback_sprom);
-
- /* http://bcm-v4.sipsolutions.net/802.11/IsSpromAvailable */
- bool ssb_is_sprom_available(struct ssb_bus *bus)
---- a/include/linux/ssb/ssb.h
-+++ b/include/linux/ssb/ssb.h
-@@ -401,6 +401,7 @@ extern bool ssb_is_sprom_available(struc
- /* Set a fallback SPROM.
- * See kdoc at the function definition for complete documentation. */
- extern int ssb_arch_set_fallback_sprom(const struct ssb_sprom *sprom);
-+extern const struct ssb_sprom *ssb_get_fallback_sprom(void);
+--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
++++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
+@@ -1907,7 +1907,7 @@ static void __init nb4_nvram_fixup(void)
+ * bcm4318 WLAN work
+ */
+ #ifdef CONFIG_SSB_PCIHOST
+-static struct ssb_sprom bcm63xx_sprom = {
++struct ssb_sprom bcm63xx_sprom = {
+ .revision = 0x02,
+ .board_rev = 0x17,
+ .country_code = 0x0,
+@@ -1927,6 +1927,7 @@ static struct ssb_sprom bcm63xx_sprom =
+ .boardflags_lo = 0x2848,
+ .boardflags_hi = 0x0000,
+ };
++EXPORT_SYMBOL(bcm63xx_sprom);
- /* Suspend a SSB bus.
- * Call this from the parent bus suspend routine. */
+ int bcm63xx_get_fallback_sprom(struct ssb_bus *bus)
+ {