kernel: fix some mistakes in ssb patch refresh in r22766, r22767 and r22768.

SVN-Revision: 22774
This commit is contained in:
Hauke Mehrtens 2010-08-22 19:22:01 +00:00
parent 8b778d5ba3
commit f313fa0bd7
5 changed files with 5 additions and 139 deletions

View file

@ -322,31 +322,6 @@
} }
return err; return err;
--- a/drivers/ssb/pci.c
+++ b/drivers/ssb/pci.c
@@ -17,6 +17,7 @@
#include <linux/ssb/ssb.h>
#include <linux/ssb/ssb_regs.h>
+#include <linux/slab.h>
#include <linux/pci.h>
#include <linux/delay.h>
@@ -642,6 +643,14 @@ static int ssb_pci_sprom_get(struct ssb_
}
ssb_dprintk(KERN_INFO PFX "SPROM offset is 0x%x\n", bus->sprom_offset);
+ if (!ssb_is_sprom_available(bus)) {
+ ssb_printk(KERN_ERR PFX "No SPROM available!\n");
+ return -ENODEV;
+ }
+
+ bus->sprom_offset = (bus->chipco.dev->id.revision < 31) ?
+ SSB_SPROM_BASE1 : SSB_SPROM_BASE31;
+
buf = kcalloc(SSB_SPROMSIZE_WORDS_R123, sizeof(u16), GFP_KERNEL);
if (!buf)
goto out;
--- a/drivers/ssb/pcihost_wrapper.c --- a/drivers/ssb/pcihost_wrapper.c
+++ b/drivers/ssb/pcihost_wrapper.c +++ b/drivers/ssb/pcihost_wrapper.c
@@ -12,6 +12,7 @@ @@ -12,6 +12,7 @@
@ -664,26 +639,6 @@
if (err) if (err)
ssb_printk(KERN_ERR PFX "SPROM write: Could not thaw all devices\n"); ssb_printk(KERN_ERR PFX "SPROM write: Could not thaw all devices\n");
out_unlock: out_unlock:
@@ -192,5 +189,19 @@ bool ssb_is_sprom_available(struct ssb_b
bus->chipco.dev->id.revision >= 31)
return bus->chipco.capabilities & SSB_CHIPCO_CAP_SPROM;
+ return true;
+}
+
+/* http://bcm-v4.sipsolutions.net/802.11/IsSpromAvailable */
+bool ssb_is_sprom_available(struct ssb_bus *bus)
+{
+ /* status register only exists on chipcomon rev >= 11 and we need check
+ for >= 31 only */
+ /* this routine differs from specs as we do not access SPROM directly
+ on PCMCIA */
+ if (bus->bustype == SSB_BUSTYPE_PCI &&
+ bus->chipco.dev->id.revision >= 31)
+ return bus->chipco.capabilities & SSB_CHIPCO_CAP_SPROM;
+
return true;
}
--- a/drivers/ssb/ssb_private.h --- a/drivers/ssb/ssb_private.h
+++ b/drivers/ssb/ssb_private.h +++ b/drivers/ssb/ssb_private.h
@@ -176,19 +176,27 @@ extern const struct ssb_sprom *ssb_get_f @@ -176,19 +176,27 @@ extern const struct ssb_sprom *ssb_get_f
@ -762,16 +717,6 @@
/* See enum ssb_quirks */ /* See enum ssb_quirks */
unsigned int quirks; unsigned int quirks;
@@ -393,6 +397,9 @@ extern void ssb_bus_unregister(struct ss
/* Does the device have an SPROM? */
extern bool ssb_is_sprom_available(struct ssb_bus *bus);
+
+/* Does the device have an SPROM? */
+extern bool ssb_is_sprom_available(struct ssb_bus *bus);
/* Set a fallback SPROM.
* See kdoc at the function definition for complete documentation. */
--- a/include/linux/ssb/ssb_regs.h --- a/include/linux/ssb/ssb_regs.h
+++ b/include/linux/ssb/ssb_regs.h +++ b/include/linux/ssb/ssb_regs.h
@@ -198,63 +198,63 @@ @@ -198,63 +198,63 @@

View file

@ -10,7 +10,7 @@
bool ssb_is_sprom_available(struct ssb_bus *bus) bool ssb_is_sprom_available(struct ssb_bus *bus)
--- a/include/linux/ssb/ssb.h --- a/include/linux/ssb/ssb.h
+++ b/include/linux/ssb/ssb.h +++ b/include/linux/ssb/ssb.h
@@ -404,6 +404,7 @@ extern bool ssb_is_sprom_available(struc @@ -401,6 +401,7 @@ extern bool ssb_is_sprom_available(struc
/* Set a fallback SPROM. /* Set a fallback SPROM.
* See kdoc at the function definition for complete documentation. */ * 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_set_fallback_sprom(const struct ssb_sprom *sprom);

View file

@ -115,26 +115,6 @@
} }
return err; return err;
--- a/drivers/ssb/sprom.c
+++ b/drivers/ssb/sprom.c
@@ -190,3 +190,17 @@ bool ssb_is_sprom_available(struct ssb_b
return true;
}
+
+/* http://bcm-v4.sipsolutions.net/802.11/IsSpromAvailable */
+bool ssb_is_sprom_available(struct ssb_bus *bus)
+{
+ /* status register only exists on chipcomon rev >= 11 and we need check
+ for >= 31 only */
+ /* this routine differs from specs as we do not access SPROM directly
+ on PCMCIA */
+ if (bus->bustype == SSB_BUSTYPE_PCI &&
+ bus->chipco.dev->id.revision >= 31)
+ return bus->chipco.capabilities & SSB_CHIPCO_CAP_SPROM;
+
+ return true;
+}
--- a/drivers/ssb/ssb_private.h --- a/drivers/ssb/ssb_private.h
+++ b/drivers/ssb/ssb_private.h +++ b/drivers/ssb/ssb_private.h
@@ -196,7 +196,7 @@ extern int ssb_devices_thaw(struct ssb_f @@ -196,7 +196,7 @@ extern int ssb_devices_thaw(struct ssb_f
@ -154,26 +134,6 @@
+#endif /* CONFIG_SSB_B43_PCI_BRIDGE */ +#endif /* CONFIG_SSB_B43_PCI_BRIDGE */
#endif /* LINUX_SSB_PRIVATE_H_ */ #endif /* LINUX_SSB_PRIVATE_H_ */
--- a/include/linux/ssb/ssb.h
+++ b/include/linux/ssb/ssb.h
@@ -305,6 +305,7 @@ struct ssb_bus {
/* ID information about the Chip. */
u16 chip_id;
u16 chip_rev;
+ u16 sprom_offset;
u16 sprom_size; /* number of words in sprom */
u16 sprom_offset;
u8 chip_package;
@@ -395,6 +396,9 @@ extern int ssb_bus_sdiobus_register(stru
extern void ssb_bus_unregister(struct ssb_bus *bus);
+/* Does the device have an SPROM? */
+extern bool ssb_is_sprom_available(struct ssb_bus *bus);
+
/* 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);
--- a/include/linux/ssb/ssb_driver_chipcommon.h --- a/include/linux/ssb/ssb_driver_chipcommon.h
+++ b/include/linux/ssb/ssb_driver_chipcommon.h +++ b/include/linux/ssb/ssb_driver_chipcommon.h
@@ -54,6 +54,7 @@ @@ -54,6 +54,7 @@

View file

@ -527,35 +527,6 @@
/* Helper to extract some _offset, which is one of the SSB_SPROM_XXX defines. */ /* Helper to extract some _offset, which is one of the SSB_SPROM_XXX defines. */
#define SPEX16(_outvar, _offset, _mask, _shift) \ #define SPEX16(_outvar, _offset, _mask, _shift) \
out->_outvar = ((in[SPOFF(_offset)] & (_mask)) >> (_shift)) out->_outvar = ((in[SPOFF(_offset)] & (_mask)) >> (_shift))
@@ -623,6 +623,28 @@ static int ssb_pci_sprom_get(struct ssb_
if (!ssb_is_sprom_available(bus)) {
ssb_printk(KERN_ERR PFX "No SPROM available!\n");
+ return -ENODEV;
+ }
+ if (bus->chipco.dev) { /* can be unavailible! */
+ /*
+ * get SPROM offset: SSB_SPROM_BASE1 except for
+ * chipcommon rev >= 31 or chip ID is 0x4312 and
+ * chipcommon status & 3 == 2
+ */
+ if (bus->chipco.dev->id.revision >= 31)
+ bus->sprom_offset = SSB_SPROM_BASE31;
+ else if (bus->chip_id == 0x4312 &&
+ (bus->chipco.status & 0x03) == 2)
+ bus->sprom_offset = SSB_SPROM_BASE31;
+ else
+ bus->sprom_offset = SSB_SPROM_BASE1;
+ } else {
+ bus->sprom_offset = SSB_SPROM_BASE1;
+ }
+ ssb_dprintk(KERN_INFO PFX "SPROM offset is 0x%x\n", bus->sprom_offset);
+
+ if (!ssb_is_sprom_available(bus)) {
+ ssb_printk(KERN_ERR PFX "No SPROM available!\n");
return -ENODEV;
}
if (bus->chipco.dev) { /* can be unavailible! */
--- a/include/linux/ssb/ssb.h --- a/include/linux/ssb/ssb.h
+++ b/include/linux/ssb/ssb.h +++ b/include/linux/ssb/ssb.h
@@ -167,7 +167,7 @@ struct ssb_device { @@ -167,7 +167,7 @@ struct ssb_device {
@ -567,17 +538,7 @@
struct ssb_bus *bus; struct ssb_bus *bus;
struct ssb_device_id id; struct ssb_device_id id;
@@ -398,6 +398,9 @@ extern void ssb_bus_unregister(struct ss @@ -470,14 +470,6 @@ extern u32 ssb_dma_translation(struct ss
/* Does the device have an SPROM? */
extern bool ssb_is_sprom_available(struct ssb_bus *bus);
+/* Does the device have an SPROM? */
+extern bool ssb_is_sprom_available(struct ssb_bus *bus);
+
/* 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);
@@ -470,14 +473,6 @@ extern u32 ssb_dma_translation(struct ss
#define SSB_DMA_TRANSLATION_MASK 0xC0000000 #define SSB_DMA_TRANSLATION_MASK 0xC0000000
#define SSB_DMA_TRANSLATION_SHIFT 30 #define SSB_DMA_TRANSLATION_SHIFT 30
@ -592,7 +553,7 @@
static inline void __cold __ssb_dma_not_implemented(struct ssb_device *dev) static inline void __cold __ssb_dma_not_implemented(struct ssb_device *dev)
{ {
#ifdef CONFIG_SSB_DEBUG #ifdef CONFIG_SSB_DEBUG
@@ -486,155 +481,6 @@ static inline void __cold __ssb_dma_not_ @@ -486,155 +478,6 @@ static inline void __cold __ssb_dma_not_
#endif /* DEBUG */ #endif /* DEBUG */
} }

View file

@ -10,7 +10,7 @@
bool ssb_is_sprom_available(struct ssb_bus *bus) bool ssb_is_sprom_available(struct ssb_bus *bus)
--- a/include/linux/ssb/ssb.h --- a/include/linux/ssb/ssb.h
+++ b/include/linux/ssb/ssb.h +++ b/include/linux/ssb/ssb.h
@@ -404,6 +404,7 @@ extern bool ssb_is_sprom_available(struc @@ -401,6 +401,7 @@ extern bool ssb_is_sprom_available(struc
/* Set a fallback SPROM. /* Set a fallback SPROM.
* See kdoc at the function definition for complete documentation. */ * 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_set_fallback_sprom(const struct ssb_sprom *sprom);