From fcb1557a3e36290623d2bf0a098d995b0954a633 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Thu, 5 May 2011 14:05:21 +0000 Subject: [PATCH] brcm47xx: when detecting a ssb pci device without an own sprom write the sprom data from the platform device to the correct pointer. SVN-Revision: 26829 --- .../031-ssb-add-callback-for-sprom.patch | 21 +++++------ ...3-bcm47xx-register-fallback-callback.patch | 4 +-- .../031-ssb-add-callback-for-sprom.patch | 21 +++++------ ...3-bcm47xx-register-fallback-callback.patch | 4 +-- .../500-ssb-add-callback-for-sprom.patch | 36 ++++++------------- .../977-ssb_export_fallback_sprom.patch | 2 +- 6 files changed, 38 insertions(+), 50 deletions(-) diff --git a/target/linux/brcm47xx/patches-2.6.37/031-ssb-add-callback-for-sprom.patch b/target/linux/brcm47xx/patches-2.6.37/031-ssb-add-callback-for-sprom.patch index 1bb2f0fc01..9dac61c6b3 100644 --- a/target/linux/brcm47xx/patches-2.6.37/031-ssb-add-callback-for-sprom.patch +++ b/target/linux/brcm47xx/patches-2.6.37/031-ssb-add-callback-for-sprom.patch @@ -5,10 +5,10 @@ .boardflags_hi = 0x0000, }; + -+int bcm63xx_get_fallback_sprom(struct ssb_bus *bus) ++int bcm63xx_get_fallback_sprom(struct ssb_bus *bus, struct ssb_sprom *out) +{ + if (bus->bustype == SSB_BUSTYPE_PCI) { -+ memcpy(&bus->sprom, &bcm63xx_sprom, sizeof(struct ssb_sprom)); ++ memcpy(out, &bcm63xx_sprom, sizeof(struct ssb_sprom)); + return 0; + } else { + printk(KERN_ERR PFX "unable to fill SPROM for given bustype.\n"); @@ -50,7 +50,7 @@ - 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); ++ err = ssb_fill_sprom_with_fallback(bus, sprom); + if (err) { + ssb_printk(KERN_WARNING PFX "WARNING: Using" + " fallback SPROM failed (err %d)\n", @@ -66,7 +66,7 @@ -static const struct ssb_sprom *fallback_sprom; -+static int(*get_fallback_sprom)(struct ssb_bus *dev); ++static int(*get_fallback_sprom)(struct ssb_bus *dev, struct ssb_sprom *out); static int sprom2hex(const u16 *sprom, char *buf, size_t buf_len, @@ -95,7 +95,7 @@ * 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)) ++int ssb_arch_register_fallback_sprom(int (*sprom_callback)(struct ssb_bus *bus, struct ssb_sprom *out)) { - if (fallback_sprom) + if (get_fallback_sprom) @@ -107,13 +107,13 @@ } -const struct ssb_sprom *ssb_get_fallback_sprom(void) -+int ssb_fill_sprom_with_fallback(struct ssb_bus *bus) ++int ssb_fill_sprom_with_fallback(struct ssb_bus *bus, struct ssb_sprom *out) { - return fallback_sprom; + if (!get_fallback_sprom) + return -ENOENT; + -+ return get_fallback_sprom(bus); ++ return get_fallback_sprom(bus, out); } /* http://bcm-v4.sipsolutions.net/802.11/IsSpromAvailable */ @@ -124,19 +124,20 @@ 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); ++extern int ssb_fill_sprom_with_fallback(struct ssb_bus *bus, struct ssb_sprom *out); /* 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 +@@ -404,7 +404,9 @@ 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)); ++ int (*sprom_callback)(struct ssb_bus *bus, ++ struct ssb_sprom *out)); /* Suspend a SSB bus. * Call this from the parent bus suspend routine. */ diff --git a/target/linux/brcm47xx/patches-2.6.37/033-bcm47xx-register-fallback-callback.patch b/target/linux/brcm47xx/patches-2.6.37/033-bcm47xx-register-fallback-callback.patch index f63deacddf..4e88cf644d 100644 --- a/target/linux/brcm47xx/patches-2.6.37/033-bcm47xx-register-fallback-callback.patch +++ b/target/linux/brcm47xx/patches-2.6.37/033-bcm47xx-register-fallback-callback.patch @@ -15,7 +15,7 @@ } } -+int bcm47xx_get_sprom(struct ssb_bus *bus) ++int bcm47xx_get_sprom(struct ssb_bus *bus, struct ssb_sprom *out) +{ + char prefix[10]; + @@ -23,7 +23,7 @@ + snprintf(prefix, sizeof(prefix), "pci/%x/%x/", + bus->host_pci->bus->number + 1, + PCI_SLOT(bus->host_pci->devfn)); -+ bcm47xx_fill_sprom(&bus->sprom, prefix); ++ bcm47xx_fill_sprom(out, prefix); + return 0; + } else { + printk(KERN_WARNING "bcm47xx: unable to fill SPROM for given bustype.\n"); diff --git a/target/linux/brcm47xx/patches-2.6.38/031-ssb-add-callback-for-sprom.patch b/target/linux/brcm47xx/patches-2.6.38/031-ssb-add-callback-for-sprom.patch index 1bb2f0fc01..9dac61c6b3 100644 --- a/target/linux/brcm47xx/patches-2.6.38/031-ssb-add-callback-for-sprom.patch +++ b/target/linux/brcm47xx/patches-2.6.38/031-ssb-add-callback-for-sprom.patch @@ -5,10 +5,10 @@ .boardflags_hi = 0x0000, }; + -+int bcm63xx_get_fallback_sprom(struct ssb_bus *bus) ++int bcm63xx_get_fallback_sprom(struct ssb_bus *bus, struct ssb_sprom *out) +{ + if (bus->bustype == SSB_BUSTYPE_PCI) { -+ memcpy(&bus->sprom, &bcm63xx_sprom, sizeof(struct ssb_sprom)); ++ memcpy(out, &bcm63xx_sprom, sizeof(struct ssb_sprom)); + return 0; + } else { + printk(KERN_ERR PFX "unable to fill SPROM for given bustype.\n"); @@ -50,7 +50,7 @@ - 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); ++ err = ssb_fill_sprom_with_fallback(bus, sprom); + if (err) { + ssb_printk(KERN_WARNING PFX "WARNING: Using" + " fallback SPROM failed (err %d)\n", @@ -66,7 +66,7 @@ -static const struct ssb_sprom *fallback_sprom; -+static int(*get_fallback_sprom)(struct ssb_bus *dev); ++static int(*get_fallback_sprom)(struct ssb_bus *dev, struct ssb_sprom *out); static int sprom2hex(const u16 *sprom, char *buf, size_t buf_len, @@ -95,7 +95,7 @@ * 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)) ++int ssb_arch_register_fallback_sprom(int (*sprom_callback)(struct ssb_bus *bus, struct ssb_sprom *out)) { - if (fallback_sprom) + if (get_fallback_sprom) @@ -107,13 +107,13 @@ } -const struct ssb_sprom *ssb_get_fallback_sprom(void) -+int ssb_fill_sprom_with_fallback(struct ssb_bus *bus) ++int ssb_fill_sprom_with_fallback(struct ssb_bus *bus, struct ssb_sprom *out) { - return fallback_sprom; + if (!get_fallback_sprom) + return -ENOENT; + -+ return get_fallback_sprom(bus); ++ return get_fallback_sprom(bus, out); } /* http://bcm-v4.sipsolutions.net/802.11/IsSpromAvailable */ @@ -124,19 +124,20 @@ 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); ++extern int ssb_fill_sprom_with_fallback(struct ssb_bus *bus, struct ssb_sprom *out); /* 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 +@@ -404,7 +404,9 @@ 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)); ++ int (*sprom_callback)(struct ssb_bus *bus, ++ struct ssb_sprom *out)); /* Suspend a SSB bus. * Call this from the parent bus suspend routine. */ diff --git a/target/linux/brcm47xx/patches-2.6.38/033-bcm47xx-register-fallback-callback.patch b/target/linux/brcm47xx/patches-2.6.38/033-bcm47xx-register-fallback-callback.patch index f63deacddf..4e88cf644d 100644 --- a/target/linux/brcm47xx/patches-2.6.38/033-bcm47xx-register-fallback-callback.patch +++ b/target/linux/brcm47xx/patches-2.6.38/033-bcm47xx-register-fallback-callback.patch @@ -15,7 +15,7 @@ } } -+int bcm47xx_get_sprom(struct ssb_bus *bus) ++int bcm47xx_get_sprom(struct ssb_bus *bus, struct ssb_sprom *out) +{ + char prefix[10]; + @@ -23,7 +23,7 @@ + snprintf(prefix, sizeof(prefix), "pci/%x/%x/", + bus->host_pci->bus->number + 1, + PCI_SLOT(bus->host_pci->devfn)); -+ bcm47xx_fill_sprom(&bus->sprom, prefix); ++ bcm47xx_fill_sprom(out, prefix); + return 0; + } else { + printk(KERN_WARNING "bcm47xx: unable to fill SPROM for given bustype.\n"); 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 index 7e153a1ef6..6c241622a1 100644 --- 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 @@ -1,18 +1,3 @@ -From 62a518124cff3970d99f7ccdab457f4289e3b982 Mon Sep 17 00:00:00 2001 -From: Hauke Mehrtens -Date: Sat, 30 Apr 2011 15:42:30 +0200 -Subject: [PATCH 1/4] ssb: add callback for sprom - - -Signed-off-by: Hauke Mehrtens ---- - 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 = @@ -20,10 +5,10 @@ Signed-off-by: Hauke Mehrtens .boardflags_hi = 0x0000, }; + -+int bcm63xx_get_fallback_sprom(struct ssb_bus *bus) ++int bcm63xx_get_fallback_sprom(struct ssb_bus *bus, struct ssb_sprom *out) +{ + if (bus->bustype == SSB_BUSTYPE_PCI) { -+ memcpy(&bus->sprom, &bcm63xx_sprom, sizeof(struct ssb_sprom)); ++ memcpy(out, &bcm63xx_sprom, sizeof(struct ssb_sprom)); + return 0; + } else { + printk(KERN_ERR PFX "unable to fill SPROM for given bustype.\n"); @@ -65,7 +50,7 @@ Signed-off-by: Hauke Mehrtens - 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); ++ err = ssb_fill_sprom_with_fallback(bus, sprom); + if (err) { + ssb_printk(KERN_WARNING PFX "WARNING: Using" + " fallback SPROM failed (err %d)\n", @@ -81,7 +66,7 @@ Signed-off-by: Hauke Mehrtens -static const struct ssb_sprom *fallback_sprom; -+static int(*get_fallback_sprom)(struct ssb_bus *dev); ++static int(*get_fallback_sprom)(struct ssb_bus *dev, struct ssb_sprom *out); static int sprom2hex(const u16 *sprom, char *buf, size_t buf_len, @@ -110,7 +95,7 @@ Signed-off-by: Hauke Mehrtens * 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)) ++int ssb_arch_register_fallback_sprom(int (*sprom_callback)(struct ssb_bus *bus, struct ssb_sprom *out)) { - if (fallback_sprom) + if (get_fallback_sprom) @@ -122,13 +107,13 @@ Signed-off-by: Hauke Mehrtens } -const struct ssb_sprom *ssb_get_fallback_sprom(void) -+int ssb_fill_sprom_with_fallback(struct ssb_bus *bus) ++int ssb_fill_sprom_with_fallback(struct ssb_bus *bus, struct ssb_sprom *out) { - return fallback_sprom; + if (!get_fallback_sprom) + return -ENOENT; + -+ return get_fallback_sprom(bus); ++ return get_fallback_sprom(bus, out); } /* http://bcm-v4.sipsolutions.net/802.11/IsSpromAvailable */ @@ -139,19 +124,20 @@ Signed-off-by: Hauke Mehrtens 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); ++extern int ssb_fill_sprom_with_fallback(struct ssb_bus *bus, struct ssb_sprom *out); /* 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 +@@ -404,7 +404,9 @@ 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)); ++ int (*sprom_callback)(struct ssb_bus *bus, ++ struct ssb_sprom *out)); /* 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 3447c37a3c..7671d19781 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 @@ -15,5 +15,5 @@ }; +EXPORT_SYMBOL(bcm63xx_sprom); - int bcm63xx_get_fallback_sprom(struct ssb_bus *bus) + int bcm63xx_get_fallback_sprom(struct ssb_bus *bus, struct ssb_sprom *out) { -- 2.30.2