summaryrefslogtreecommitdiffstats
path: root/drivers/ssb/sprom.c
diff options
context:
space:
mode:
authorMichael Buesch <mb@bu3sch.de>2009-02-27 16:59:05 +0100
committerJohn W. Linville <linville@tuxdriver.com>2009-03-05 14:39:32 -0500
commite79c1ba84c68de9161d541bd2bcc8ea65c89955c (patch)
tree9399343651e9d92fb92f0c7bd6280353cb296913 /drivers/ssb/sprom.c
parente31ae0508315ebf5d8b1b8a1fca8550737fb3996 (diff)
downloadop-kernel-dev-e79c1ba84c68de9161d541bd2bcc8ea65c89955c.zip
op-kernel-dev-e79c1ba84c68de9161d541bd2bcc8ea65c89955c.tar.gz
ssb: Add SPROM fallback support
This adds SSB functionality to register a fallback SPROM image from the architecture setup code. Weird architectures exist that have half-assed SSB devices without SPROM attached to their PCI busses. The architecture can register a fallback SPROM image that is used if no SPROM is found on the SSB device. Signed-off-by: Michael Buesch <mb@bu3sch.de> Cc: Florian Fainelli <florian@openwrt.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/ssb/sprom.c')
-rw-r--r--drivers/ssb/sprom.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/drivers/ssb/sprom.c b/drivers/ssb/sprom.c
index 3668edb..8943015 100644
--- a/drivers/ssb/sprom.c
+++ b/drivers/ssb/sprom.c
@@ -14,6 +14,9 @@
#include "ssb_private.h"
+static const struct ssb_sprom *fallback_sprom;
+
+
static int sprom2hex(const u16 *sprom, char *buf, size_t buf_len,
size_t sprom_size_words)
{
@@ -131,3 +134,36 @@ out:
return res;
return err ? err : count;
}
+
+/**
+ * ssb_arch_set_fallback_sprom - Set a fallback SPROM for use if no SPROM is found.
+ *
+ * @sprom: The SPROM data structure to register.
+ *
+ * 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.
+ *
+ * This function is useful for weird architectures that have a half-assed SSB device
+ * hardwired to their PCI bus.
+ *
+ * Note that it does only work with PCI attached SSB devices. PCMCIA devices currently
+ * don't use this fallback.
+ * Architectures must provide the SPROM for native SSB devices anyway,
+ * so the fallback also isn't used for native devices.
+ *
+ * This function is available for architecture code, only. So it is not exported.
+ */
+int ssb_arch_set_fallback_sprom(const struct ssb_sprom *sprom)
+{
+ if (fallback_sprom)
+ return -EEXIST;
+ fallback_sprom = sprom;
+
+ return 0;
+}
+
+const struct ssb_sprom *ssb_get_fallback_sprom(void)
+{
+ return fallback_sprom;
+}
OpenPOWER on IntegriCloud