diff options
Diffstat (limited to 'drivers/ssb/sprom.c')
-rw-r--r-- | drivers/ssb/sprom.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/drivers/ssb/sprom.c b/drivers/ssb/sprom.c index 3668edb39315..8943015a3eef 100644 --- a/drivers/ssb/sprom.c +++ b/drivers/ssb/sprom.c | |||
@@ -14,6 +14,9 @@ | |||
14 | #include "ssb_private.h" | 14 | #include "ssb_private.h" |
15 | 15 | ||
16 | 16 | ||
17 | static const struct ssb_sprom *fallback_sprom; | ||
18 | |||
19 | |||
17 | static int sprom2hex(const u16 *sprom, char *buf, size_t buf_len, | 20 | static int sprom2hex(const u16 *sprom, char *buf, size_t buf_len, |
18 | size_t sprom_size_words) | 21 | size_t sprom_size_words) |
19 | { | 22 | { |
@@ -131,3 +134,36 @@ out: | |||
131 | return res; | 134 | return res; |
132 | return err ? err : count; | 135 | return err ? err : count; |
133 | } | 136 | } |
137 | |||
138 | /** | ||
139 | * ssb_arch_set_fallback_sprom - Set a fallback SPROM for use if no SPROM is found. | ||
140 | * | ||
141 | * @sprom: The SPROM data structure to register. | ||
142 | * | ||
143 | * With this function the architecture implementation may register a fallback | ||
144 | * SPROM data structure. The fallback is only used for PCI based SSB devices, | ||
145 | * where no valid SPROM can be found in the shadow registers. | ||
146 | * | ||
147 | * This function is useful for weird architectures that have a half-assed SSB device | ||
148 | * hardwired to their PCI bus. | ||
149 | * | ||
150 | * Note that it does only work with PCI attached SSB devices. PCMCIA devices currently | ||
151 | * don't use this fallback. | ||
152 | * Architectures must provide the SPROM for native SSB devices anyway, | ||
153 | * so the fallback also isn't used for native devices. | ||
154 | * | ||
155 | * This function is available for architecture code, only. So it is not exported. | ||
156 | */ | ||
157 | int ssb_arch_set_fallback_sprom(const struct ssb_sprom *sprom) | ||
158 | { | ||
159 | if (fallback_sprom) | ||
160 | return -EEXIST; | ||
161 | fallback_sprom = sprom; | ||
162 | |||
163 | return 0; | ||
164 | } | ||
165 | |||
166 | const struct ssb_sprom *ssb_get_fallback_sprom(void) | ||
167 | { | ||
168 | return fallback_sprom; | ||
169 | } | ||