1 Index: linux-2.6.28.7/drivers/ssb/pci.c
2 ===================================================================
3 --- linux-2.6.28.7.orig/drivers/ssb/pci.c 2009-02-26 20:37:02.000000000 +0100
4 +++ linux-2.6.28.7/drivers/ssb/pci.c 2009-02-26 20:41:44.000000000 +0100
5 @@ -514,6 +514,7 @@ unsupported:
6 static int ssb_pci_sprom_get(struct ssb_bus *bus,
7 struct ssb_sprom *sprom)
9 + const struct ssb_sprom *fallback;
13 @@ -533,12 +534,23 @@ static int ssb_pci_sprom_get(struct ssb_
14 bus->sprom_size = SSB_SPROMSIZE_WORDS_R4;
15 sprom_do_read(bus, buf);
16 err = sprom_check_crc(buf, bus->sprom_size);
19 + /* All CRC attempts failed.
20 + * Maybe there is no SPROM on the device?
21 + * If we have a fallback, use that. */
22 + fallback = ssb_get_fallback_sprom();
24 + memcpy(sprom, fallback, sizeof(*sprom));
28 ssb_printk(KERN_WARNING PFX "WARNING: Invalid"
29 " SPROM CRC (corrupt SPROM)\n");
32 err = sprom_extract(bus, sprom, buf, bus->sprom_size);
38 Index: linux-2.6.28.7/drivers/ssb/sprom.c
39 ===================================================================
40 --- linux-2.6.28.7.orig/drivers/ssb/sprom.c 2009-02-26 20:33:21.000000000 +0100
41 +++ linux-2.6.28.7/drivers/ssb/sprom.c 2009-02-26 20:52:35.000000000 +0100
43 #include "ssb_private.h"
46 +static const struct ssb_sprom *fallback_sprom;
49 static int sprom2hex(const u16 *sprom, char *buf, size_t buf_len,
50 size_t sprom_size_words)
52 @@ -131,3 +134,36 @@ out:
54 return err ? err : count;
58 + * ssb_arch_set_fallback_sprom - Set a fallback SPROM for use if no SPROM is found.
60 + * @sprom: The SPROM data structure to register.
62 + * With this function the architecture implementation may register a fallback
63 + * SPROM data structure. The fallback is only used for PCI based SSB devices,
64 + * where no valid SPROM can be found in the shadow registers.
66 + * This function is useful for weird architectures that have a half-assed SSB device
67 + * hardwired to their PCI bus.
69 + * Note that it does only work with PCI attached SSB devices. PCMCIA devices currently
70 + * don't use this fallback.
71 + * Architectures must provide the SPROM for native SSB devices anyway,
72 + * so the fallback also isn't used for native devices.
74 + * This function is available for architecture code, only. So it is not exported.
76 +int ssb_arch_set_fallback_sprom(const struct ssb_sprom *sprom)
80 + fallback_sprom = sprom;
85 +const struct ssb_sprom *ssb_get_fallback_sprom(void)
87 + return fallback_sprom;
89 Index: linux-2.6.28.7/drivers/ssb/ssb_private.h
90 ===================================================================
91 --- linux-2.6.28.7.orig/drivers/ssb/ssb_private.h 2009-02-26 20:36:33.000000000 +0100
92 +++ linux-2.6.28.7/drivers/ssb/ssb_private.h 2009-02-26 20:36:56.000000000 +0100
93 @@ -131,6 +131,7 @@ ssize_t ssb_attr_sprom_store(struct ssb_
94 const char *buf, size_t count,
95 int (*sprom_check_crc)(const u16 *sprom, size_t size),
96 int (*sprom_write)(struct ssb_bus *bus, const u16 *sprom));
97 +extern const struct ssb_sprom *ssb_get_fallback_sprom(void);
101 Index: linux-2.6.28.7/include/linux/ssb/ssb.h
102 ===================================================================
103 --- linux-2.6.28.7.orig/include/linux/ssb/ssb.h 2009-02-26 20:26:34.000000000 +0100
104 +++ linux-2.6.28.7/include/linux/ssb/ssb.h 2009-02-26 20:32:30.000000000 +0100
105 @@ -339,6 +339,10 @@ extern int ssb_bus_pcmciabus_register(st
107 extern void ssb_bus_unregister(struct ssb_bus *bus);
109 +/* Set a fallback SPROM.
110 + * See kdoc at the function definition for complete documentation. */
111 +extern int ssb_arch_set_fallback_sprom(const struct ssb_sprom *sprom);
113 /* Suspend a SSB bus.
114 * Call this from the parent bus suspend routine. */
115 extern int ssb_bus_suspend(struct ssb_bus *bus);