brcm2708: switch to 3.14
[openwrt.git] / package / kernel / mac80211 / patches / 830-b43-workaround-pcie-bcm4716.patch
index e76758c..5ec2f4b 100644 (file)
@@ -19,28 +19,12 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
 
 --- a/drivers/net/wireless/b43/b43.h
 +++ b/drivers/net/wireless/b43/b43.h
-@@ -1061,6 +1061,31 @@ static inline bool b43_using_pio_transfe
+@@ -1054,6 +1054,15 @@ static inline bool b43_using_pio_transfe
        return dev->__using_pio_transfers;
  }
  
-+/*
-+ * bcm4716 (which includes 4717 & 4718), plus 4706 on PCIe can reorder
-+ * transactions. As a fix, a read after write is performed on certain places
-+ * in the code. Older chips and the newer 5357 family don't require this fix.
-+ */
 +#ifdef CONFIG_BCM47XX_BCMA
-+#include <asm/mach-bcm47xx/bcm47xx.h>
-+static inline void b43_wflush16(struct b43_wldev *dev, u16 offset, u16 value)
-+{
-+      if (b43_bus_host_is_pci(dev->dev) &&
-+          bcm47xx_bus_type == BCM47XX_BUS_TYPE_BCMA &&
-+          bcm47xx_bus.bcma.bus.chipinfo.id == BCMA_CHIP_ID_BCM4716) {
-+              b43_write16(dev, offset, value);
-+              b43_read16(dev, offset);
-+      } else {
-+              b43_write16(dev, offset, value);
-+      }
-+}
++void b43_wflush16(struct b43_wldev *dev, u16 offset, u16 value);
 +#else
 +static inline void b43_wflush16(struct b43_wldev *dev, u16 offset, u16 value)
 +{
@@ -53,18 +37,20 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
  __printf(2, 3) void b43err(struct b43_wl *wl, const char *fmt, ...);
 --- a/drivers/net/wireless/b43/bus.h
 +++ b/drivers/net/wireless/b43/bus.h
-@@ -60,6 +60,16 @@ static inline bool b43_bus_host_is_sdio(
-       return (dev->bus_type == B43_BUS_SSB &&
-               dev->sdev->bus->bustype == SSB_BUSTYPE_SDIO);
+@@ -70,6 +70,18 @@ static inline bool b43_bus_host_is_sdio(
+       return false;
+ #endif
  }
 +static inline bool b43_bus_host_is_pci(struct b43_bus_dev *dev)
 +{
-+      if (dev->bus_type == B43_BUS_SSB)
-+              return (dev->sdev->bus->bustype == SSB_BUSTYPE_PCI);
 +#ifdef CPTCFG_B43_BCMA
 +      if (dev->bus_type == B43_BUS_BCMA)
 +              return (dev->bdev->bus->hosttype == BCMA_HOSTTYPE_PCI);
 +#endif
++#ifdef CPTCFG_B43_SSB
++      if (dev->bus_type == B43_BUS_SSB)
++              return (dev->sdev->bus->bustype == SSB_BUSTYPE_PCI);
++#endif
 +      return false;
 +}
  
@@ -72,7 +58,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
  struct b43_bus_dev *b43_bus_dev_ssb_init(struct ssb_device *sdev);
 --- a/drivers/net/wireless/b43/main.c
 +++ b/drivers/net/wireless/b43/main.c
-@@ -4437,7 +4437,7 @@ static int b43_phy_versioning(struct b43
+@@ -4481,7 +4481,7 @@ static int b43_phy_versioning(struct b43
                u16 radio24[3];
  
                for (tmp = 0; tmp < 3; tmp++) {
@@ -81,7 +67,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
                        radio24[tmp] = b43_read16(dev, B43_MMIO_RADIO24_DATA);
                }
  
-@@ -4456,10 +4456,10 @@ static int b43_phy_versioning(struct b43
+@@ -4498,10 +4498,10 @@ static int b43_phy_versioning(struct b43
                        else
                                tmp = 0x5205017F;
                } else {
@@ -94,9 +80,36 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
                                    B43_RADIOCTL_ID);
                        tmp |= (u32)b43_read16(dev, B43_MMIO_RADIO_DATA_HIGH)
                                << 16;
+@@ -4576,6 +4576,26 @@ static int b43_phy_versioning(struct b43
+       return 0;
+ }
++/*
++ * bcm4716 (which includes 4717 & 4718), plus 4706 on PCIe can reorder
++ * transactions. As a fix, a read after write is performed on certain places
++ * in the code. Older chips and the newer 5357 family don't require this fix.
++ */
++#ifdef CONFIG_BCM47XX_BCMA
++#include <asm/mach-bcm47xx/bcm47xx.h>
++void b43_wflush16(struct b43_wldev *dev, u16 offset, u16 value)
++{
++      if (b43_bus_host_is_pci(dev->dev) &&
++          bcm47xx_bus_type == BCM47XX_BUS_TYPE_BCMA &&
++          bcm47xx_bus.bcma.bus.chipinfo.id == BCMA_CHIP_ID_BCM4716) {
++              b43_write16(dev, offset, value);
++              b43_read16(dev, offset);
++      } else {
++              b43_write16(dev, offset, value);
++      }
++}
++#endif
++
+ static void setup_struct_phy_for_init(struct b43_wldev *dev,
+                                     struct b43_phy *phy)
+ {
 --- a/drivers/net/wireless/b43/phy_common.c
 +++ b/drivers/net/wireless/b43/phy_common.c
-@@ -266,6 +266,12 @@ void b43_phy_write(struct b43_wldev *dev
+@@ -275,6 +275,12 @@ void b43_phy_write(struct b43_wldev *dev
  {
        assert_mac_suspended(dev);
        dev->phy.ops->phy_write(dev, reg, value);
@@ -154,7 +167,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
  
 --- a/drivers/net/wireless/b43/phy_lcn.c
 +++ b/drivers/net/wireless/b43/phy_lcn.c
-@@ -845,20 +845,20 @@ static void b43_phy_lcn_op_adjust_txpowe
+@@ -812,20 +812,20 @@ static void b43_phy_lcn_op_adjust_txpowe
  
  static u16 b43_phy_lcn_op_read(struct b43_wldev *dev, u16 reg)
  {
@@ -178,7 +191,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
        b43_write16(dev, B43_MMIO_PHY_DATA,
                    (b43_read16(dev, B43_MMIO_PHY_DATA) & mask) | set);
  }
-@@ -868,14 +868,14 @@ static u16 b43_phy_lcn_op_radio_read(str
+@@ -835,14 +835,14 @@ static u16 b43_phy_lcn_op_radio_read(str
        /* LCN-PHY needs 0x200 for read access */
        reg |= 0x200;
  
@@ -197,7 +210,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
  
 --- a/drivers/net/wireless/b43/phy_n.c
 +++ b/drivers/net/wireless/b43/phy_n.c
-@@ -5418,14 +5418,14 @@ static inline void check_phyreg(struct b
+@@ -6500,14 +6500,14 @@ static inline void check_phyreg(struct b
  static u16 b43_nphy_op_read(struct b43_wldev *dev, u16 reg)
  {
        check_phyreg(dev, reg);
@@ -214,7 +227,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
        b43_write16(dev, B43_MMIO_PHY_DATA, value);
  }
  
-@@ -5433,7 +5433,7 @@ static void b43_nphy_op_maskset(struct b
+@@ -6515,7 +6515,7 @@ static void b43_nphy_op_maskset(struct b
                                 u16 set)
  {
        check_phyreg(dev, reg);
@@ -223,18 +236,18 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
        b43_maskset16(dev, B43_MMIO_PHY_DATA, mask, set);
  }
  
-@@ -5444,7 +5444,7 @@ static u16 b43_nphy_op_radio_read(struct
-       /* N-PHY needs 0x100 for read access */
-       reg |= 0x100;
+@@ -6529,7 +6529,7 @@ static u16 b43_nphy_op_radio_read(struct
+       else
+               reg |= 0x100;
  
 -      b43_write16(dev, B43_MMIO_RADIO_CONTROL, reg);
 +      b43_wflush16(dev, B43_MMIO_RADIO_CONTROL, reg);
        return b43_read16(dev, B43_MMIO_RADIO_DATA_LOW);
  }
  
-@@ -5453,7 +5453,7 @@ static void b43_nphy_op_radio_write(stru
+@@ -6538,7 +6538,7 @@ static void b43_nphy_op_radio_write(stru
        /* Register 1 is a 32-bit register. */
-       B43_WARN_ON(reg == 1);
+       B43_WARN_ON(dev->phy.rev < 7 && reg == 1);
  
 -      b43_write16(dev, B43_MMIO_RADIO_CONTROL, reg);
 +      b43_wflush16(dev, B43_MMIO_RADIO_CONTROL, reg);