b43: LP-PHY: use new pointers path to access ssb_device
PATCH 1/4 b43: LP-PHY: use new pointers path to access ssb_device
LP-PHY code is SSB specific, add check for bus type.
Signed-off-by Rafał Miłecki <[email protected]>
--- drivers/net/wireless/b43/phy_lp.c | 15 ++++++++++----- 1 files changed, 10 insertions(+), 5 deletions(-)
drivers/net/wireless/b43/phy_lp.c +10 -5
@@ -214,7 +214,7 @@ static void lpphy_table_init(struct b43_wldev *dev)static void lpphy_baseband_rev0_1_init (struct b43_wldev *dev) { -struct ssb_bus *bus = dev->sdev->bus; +struct ssb_bus *bus = dev->dev->sdev->bus;struct ssb_sprom *sprom = dev->dev->bus_sprom;struct b43_phy_lp *lpphy = dev->phy.lp;u16 tmp, tmp2;
@@ -519,7 +519,7 @@ struct b2062_freqdata {static void lpphy_2062_init (struct b43_wldev *dev) {struct b43_phy_lp *lpphy = dev->phy.lp; -struct ssb_bus *bus = dev->sdev->bus; +struct ssb_bus *bus = dev->dev->sdev->bus;u32 crystalfreq, tmp, ref;unsigned int i;const struct b2062_freqdata *fd =NULL ;
@@ -1289,7 +1289,7 @@ finish:static void lpphy_rev2plus_rc_calib (struct b43_wldev *dev) { -struct ssb_bus *bus = dev->sdev->bus; +struct ssb_bus *bus = dev->dev->sdev->bus;u32 crystal_freq = bus->chipco.pmu.crystalfreq *1000 ;u8 tmp =b43_radio_read (dev,B2063_RX_BB_SP8 ) &0xFF ;int i;
@@ -2428,7 +2428,7 @@ static int lpphy_b2062_tune(struct b43_wldev *dev, unsigned int channel) {struct b43_phy_lp *lpphy = dev->phy.lp; -struct ssb_bus *bus = dev->sdev->bus; +struct ssb_bus *bus = dev->dev->sdev->bus;const struct b206x_channel *chandata =NULL ;u32 crystal_freq = bus->chipco.pmu.crystalfreq *1000 ;u32 tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8, tmp9;
@@ -2518,7 +2518,7 @@ static void lpphy_b2063_vco_calib(struct b43_wldev *dev)static int lpphy_b2063_tune (struct b43_wldev *dev,unsigned int channel) { -struct ssb_bus *bus = dev->sdev->bus; +struct ssb_bus *bus = dev->dev->sdev->bus;static const struct b206x_channel *chandata =NULL ;u32 crystal_freq = bus->chipco.pmu.crystalfreq *1000 ;
@@ -2666,6 +2666,11 @@ static int b43_lpphy_op_init(struct b43_wldev *dev) {int err; +if (dev->dev->bus_type !=B43_BUS_SSB ) { +b43err (dev->wl,"LP-PHY is supported only on SSB!\n" ); +return -EOPNOTSUPP ; + } +lpphy_read_band_sprom (dev);//FIXME should this be in prepare_structs? lpphy_baseband_init (dev);lpphy_radio_init (dev);
Signature · 1 line
1.7.3.4
PATCH 2/4 b43: SDIO: use new pointers path to access ssb_device
SDIO code is SSB specific, we can safely just use "sdev"
Signed-off-by Rafał Miłecki <[email protected]>
--- drivers/net/wireless/b43/sdio.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/b43/sdio.c +2 -2
@@ -66,7 +66,7 @@ static void b43_sdio_interrupt_dispatcher(struct sdio_func *func)int b43_sdio_request_irq (struct b43_wldev *dev,void (*handler)(struct b43_wldev *dev)) { -struct ssb_bus *bus = dev->sdev->bus; +struct ssb_bus *bus = dev->dev->sdev->bus;struct sdio_func *func = bus->host_sdio;struct b43_sdio *sdio =sdio_get_drvdata (func);int err;
@@ -82,7 +82,7 @@ int b43_sdio_request_irq(struct b43_wldev *dev,void b43_sdio_free_irq (struct b43_wldev *dev) { -struct ssb_bus *bus = dev->sdev->bus; +struct ssb_bus *bus = dev->dev->sdev->bus;struct sdio_func *func = bus->host_sdio;struct b43_sdio *sdio =sdio_get_drvdata (func);
Signature · 1 line
1.7.3.4
PATCH 3/4 b43: use new pointers path to access ssb_device in SSB specific places
In reply to Rafał MiłeckiSigned-off-by Rafał Miłecki <[email protected]>
--- drivers/net/wireless/b43/main.c | 28 +++++++++++++++++----------- 1 files changed, 17 insertions(+), 11 deletions(-)
drivers/net/wireless/b43/main.c +17 -11
@@ -1146,6 +1146,7 @@ void b43_power_saving_ctl_bits(struct b43_wldev *dev, unsigned int ps_flags)static void b43_ssb_wireless_core_reset (struct b43_wldev *dev,u32 flags) { +struct ssb_device *sdev = dev->dev->sdev;u32 tmslow; flags |=B43_TMSLOW_PHYCLKEN ;
@@ -1156,15 +1157,15 @@ static void b43_ssb_wireless_core_reset(struct b43_wldev *dev, u32 flags)msleep (2 );/* Wait for the PLL to turn on. */ /* Now take the PHY out of Reset again */ - tmslow =ssb_read32 (dev->sdev,SSB_TMSLOW ); + tmslow =ssb_read32 (sdev,SSB_TMSLOW ); tmslow |=SSB_TMSLOW_FGC ; tmslow &= ~B43_TMSLOW_PHYRESET ; -ssb_write32 (dev->sdev,SSB_TMSLOW , tmslow); -ssb_read32 (dev->sdev,SSB_TMSLOW );/* flush */ +ssb_write32 (sdev,SSB_TMSLOW , tmslow); +ssb_read32 (sdev,SSB_TMSLOW );/* flush */ msleep (1 ); tmslow &= ~SSB_TMSLOW_FGC ; -ssb_write32 (dev->sdev,SSB_TMSLOW , tmslow); -ssb_read32 (dev->sdev,SSB_TMSLOW );/* flush */ +ssb_write32 (sdev,SSB_TMSLOW , tmslow); +ssb_read32 (sdev,SSB_TMSLOW );/* flush */ msleep (1 ); }
@@ -2157,7 +2158,7 @@ static int b43_try_request_fw(struct b43_request_fw_context *ctx)switch (dev->phy.type) {case B43_PHYTYPE_A :if ((rev >=5 ) && (rev <=10 )) { - tmshigh =ssb_read32 (dev->sdev,SSB_TMSHIGH ); + tmshigh =ssb_read32 (dev->dev->sdev,SSB_TMSHIGH );if (tmshigh &B43_TMSHIGH_HAVE_2GHZ_PHY ) filename ="a0g1initvals5" ;else
@@ -2202,7 +2203,7 @@ static int b43_try_request_fw(struct b43_request_fw_context *ctx)switch (dev->phy.type) {case B43_PHYTYPE_A :if ((rev >=5 ) && (rev <=10 )) { - tmshigh =ssb_read32 (dev->sdev,SSB_TMSHIGH ); + tmshigh =ssb_read32 (dev->dev->sdev,SSB_TMSHIGH );if (tmshigh &B43_TMSHIGH_HAVE_2GHZ_PHY ) filename ="a0g1bsinitvals5" ;else
@@ -2566,7 +2567,7 @@ out:*/ static struct ssb_device *b43_ssb_gpio_dev (struct b43_wldev *dev) { -struct ssb_bus *bus = dev->sdev->bus; +struct ssb_bus *bus = dev->dev->sdev->bus;#ifdef CONFIG_SSB_DRIVER_PCICORE return (bus->chipco.dev ? bus->chipco.dev : bus->pcicore.dev);
@@ -4231,16 +4232,21 @@ static void b43_bluetooth_coext_disable(struct b43_wldev *dev)static void b43_imcfglo_timeouts_workaround (struct b43_wldev *dev) { -struct ssb_bus *bus = dev->sdev->bus; +struct ssb_bus *bus;u32 tmp; +if (dev->dev->bus_type !=B43_BUS_SSB ) +return ; + + bus = dev->dev->sdev->bus; +if ((bus->chip_id ==0x4311 && bus->chip_rev ==2 ) || (bus->chip_id ==0x4312 )) { - tmp =ssb_read32 (dev->sdev,SSB_IMCFGLO ); + tmp =ssb_read32 (dev->dev->sdev,SSB_IMCFGLO ); tmp &= ~SSB_IMCFGLO_REQTO ; tmp &= ~SSB_IMCFGLO_SERTO ; tmp |=0x3 ; -ssb_write32 (dev->sdev,SSB_IMCFGLO , tmp); +ssb_write32 (dev->dev->sdev,SSB_IMCFGLO , tmp);ssb_commit_settings (bus); } }
Signature · 1 line
1.7.3.4
PATCH 4/4 b43: bus: add helpers for checking host type
In reply to Rafał MiłeckiSigned-off-by Rafał Miłecki <[email protected]>
--- drivers/net/wireless/b43/bus.h | 11 +++++++++++ drivers/net/wireless/b43/main.c | 12 ++++++------ 2 files changed, 17 insertions(+), 6 deletions(-)
drivers/net/wireless/b43/bus.h +11 -0
@@ -46,6 +46,17 @@ struct b43_bus_dev { u8 core_rev; }; +static inline bool b43_bus_host_is_pcmcia (struct b43_bus_dev *dev) +{ +return (dev->bus_type ==B43_BUS_SSB && + dev->sdev->bus->bustype ==SSB_BUSTYPE_PCMCIA ); +} +static inline bool b43_bus_host_is_sdio (struct b43_bus_dev *dev) +{ +return (dev->bus_type ==B43_BUS_SSB && + dev->sdev->bus->bustype ==SSB_BUSTYPE_SDIO ); +} +struct b43_bus_dev *b43_bus_dev_ssb_init (struct ssb_device *sdev);#endif /* B43_BUS_H_ */
drivers/net/wireless/b43/main.c +6 -6
@@ -1645,7 +1645,7 @@ static void b43_beacon_update_trigger_work(struct work_struct *work)mutex_lock (&wl->mutex); dev = wl->current_dev;if (likely (dev && (b43_status (dev) >=B43_STAT_INITIALIZED ))) { -if (dev->sdev->bus->bustype ==SSB_BUSTYPE_SDIO ) { +if (b43_bus_host_is_sdio (dev->dev)) {/* wl->mutex is enough. */ b43_do_beacon_update_trigger_work (dev);mmiowb ();
@@ -3955,7 +3955,7 @@ redo:/* Disable interrupts on the device. */ b43_set_status (dev,B43_STAT_INITIALIZED ); -if (dev->sdev->bus->bustype ==SSB_BUSTYPE_SDIO ) { +if (b43_bus_host_is_sdio (dev->dev)) {/* wl->mutex is locked. That is enough. */ b43_write32 (dev,B43_MMIO_GEN_IRQ_MASK ,0 );b43_read32 (dev,B43_MMIO_GEN_IRQ_MASK );/* Flush */
@@ -3968,7 +3968,7 @@ redo:/* Synchronize and free the interrupt handlers. Unlock to avoid deadlocks. */ orig_dev = dev;mutex_unlock (&wl->mutex); -if (dev->sdev->bus->bustype ==SSB_BUSTYPE_SDIO ) { +if (b43_bus_host_is_sdio (dev->dev)) {b43_sdio_free_irq (dev); }else {synchronize_irq (dev->dev->irq);
@@ -4005,7 +4005,7 @@ static int b43_wireless_core_start(struct b43_wldev *dev)B43_WARN_ON (b43_status (dev) !=B43_STAT_INITIALIZED );drain_txstatus_queue (dev); -if (dev->sdev->bus->bustype ==SSB_BUSTYPE_SDIO ) { +if (b43_bus_host_is_sdio (dev->dev)) { err =b43_sdio_request_irq (dev, b43_sdio_interrupt_handler);if (err) {b43err (dev->wl,"Cannot request SDIO IRQ\n" );
@@ -4405,8 +4405,8 @@ static int b43_wireless_core_init(struct b43_wldev *dev)/* Maximum Contention Window */ b43_shm_write16 (dev,B43_SHM_SCRATCH ,B43_SHM_SC_MAXCONT ,0x3FF ); -if ((dev->sdev->bus->bustype ==SSB_BUSTYPE_PCMCIA ) || - (dev->sdev->bus->bustype ==SSB_BUSTYPE_SDIO ) || +if (b43_bus_host_is_pcmcia (dev->dev) || +b43_bus_host_is_sdio (dev->dev) || dev->use_pio) { dev->__using_pio_transfers =1 ; err =b43_pio_init (dev);
Signature · 1 line
1.7.3.4