X-Git-Url: https://git.rohieb.name/openwrt.git/blobdiff_plain/374bb82f67f49829cb443fe95a11d88c83675be4..26205d18e8788d3cab78e980aea09d10f10cb7d7:/target/linux/brcm47xx/patches-2.6.38/031-ssb-add-callback-for-sprom.patch 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 1bb2f0fc0..bf19ae0b9 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"); @@ -40,7 +40,7 @@ int err; u16 *buf; -@@ -707,10 +706,14 @@ static int ssb_pci_sprom_get(struct ssb_ +@@ -707,10 +706,17 @@ static int ssb_pci_sprom_get(struct ssb_ if (err) { /* All CRC attempts failed. * Maybe there is no SPROM on the device? @@ -50,12 +50,15 @@ - 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", + err); + } else { ++ ssb_dprintk(KERN_DEBUG PFX "Using SPROM" ++ " revision %d provided by" ++ " platform.\n", sprom->revision); err = 0; goto out_free; } @@ -66,7 +69,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 +98,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 +110,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 +127,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. */