diff options
Diffstat (limited to 'drivers/net/wireless/b43/main.c')
-rw-r--r-- | drivers/net/wireless/b43/main.c | 234 |
1 files changed, 142 insertions, 92 deletions
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index d74bc5ff8e13..cae31463ead9 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
@@ -113,6 +113,16 @@ static int b43_modparam_pio = B43_PIO_DEFAULT; | |||
113 | module_param_named(pio, b43_modparam_pio, int, 0644); | 113 | module_param_named(pio, b43_modparam_pio, int, 0644); |
114 | MODULE_PARM_DESC(pio, "Use PIO accesses by default: 0=DMA, 1=PIO"); | 114 | MODULE_PARM_DESC(pio, "Use PIO accesses by default: 0=DMA, 1=PIO"); |
115 | 115 | ||
116 | #ifdef CONFIG_B43_BCMA | ||
117 | static const struct bcma_device_id b43_bcma_tbl[] = { | ||
118 | BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 0x17, BCMA_ANY_CLASS), | ||
119 | BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 0x18, BCMA_ANY_CLASS), | ||
120 | BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 0x1D, BCMA_ANY_CLASS), | ||
121 | BCMA_CORETABLE_END | ||
122 | }; | ||
123 | MODULE_DEVICE_TABLE(bcma, b43_bcma_tbl); | ||
124 | #endif | ||
125 | |||
116 | static const struct ssb_device_id b43_ssb_tbl[] = { | 126 | static const struct ssb_device_id b43_ssb_tbl[] = { |
117 | SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 5), | 127 | SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 5), |
118 | SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 6), | 128 | SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 6), |
@@ -548,7 +558,7 @@ void b43_tsf_read(struct b43_wldev *dev, u64 *tsf) | |||
548 | { | 558 | { |
549 | u32 low, high; | 559 | u32 low, high; |
550 | 560 | ||
551 | B43_WARN_ON(dev->sdev->id.revision < 3); | 561 | B43_WARN_ON(dev->dev->core_rev < 3); |
552 | 562 | ||
553 | /* The hardware guarantees us an atomic read, if we | 563 | /* The hardware guarantees us an atomic read, if we |
554 | * read the low register first. */ | 564 | * read the low register first. */ |
@@ -586,7 +596,7 @@ static void b43_tsf_write_locked(struct b43_wldev *dev, u64 tsf) | |||
586 | { | 596 | { |
587 | u32 low, high; | 597 | u32 low, high; |
588 | 598 | ||
589 | B43_WARN_ON(dev->sdev->id.revision < 3); | 599 | B43_WARN_ON(dev->dev->core_rev < 3); |
590 | 600 | ||
591 | low = tsf; | 601 | low = tsf; |
592 | high = (tsf >> 32); | 602 | high = (tsf >> 32); |
@@ -714,7 +724,7 @@ void b43_dummy_transmission(struct b43_wldev *dev, bool ofdm, bool pa_on) | |||
714 | b43_ram_write(dev, i * 4, buffer[i]); | 724 | b43_ram_write(dev, i * 4, buffer[i]); |
715 | 725 | ||
716 | b43_write16(dev, 0x0568, 0x0000); | 726 | b43_write16(dev, 0x0568, 0x0000); |
717 | if (dev->sdev->id.revision < 11) | 727 | if (dev->dev->core_rev < 11) |
718 | b43_write16(dev, 0x07C0, 0x0000); | 728 | b43_write16(dev, 0x07C0, 0x0000); |
719 | else | 729 | else |
720 | b43_write16(dev, 0x07C0, 0x0100); | 730 | b43_write16(dev, 0x07C0, 0x0100); |
@@ -1132,7 +1142,7 @@ void b43_power_saving_ctl_bits(struct b43_wldev *dev, unsigned int ps_flags) | |||
1132 | b43_write32(dev, B43_MMIO_MACCTL, macctl); | 1142 | b43_write32(dev, B43_MMIO_MACCTL, macctl); |
1133 | /* Commit write */ | 1143 | /* Commit write */ |
1134 | b43_read32(dev, B43_MMIO_MACCTL); | 1144 | b43_read32(dev, B43_MMIO_MACCTL); |
1135 | if (awake && dev->sdev->id.revision >= 5) { | 1145 | if (awake && dev->dev->core_rev >= 5) { |
1136 | /* Wait for the microcode to wake up. */ | 1146 | /* Wait for the microcode to wake up. */ |
1137 | for (i = 0; i < 100; i++) { | 1147 | for (i = 0; i < 100; i++) { |
1138 | ucstat = b43_shm_read16(dev, B43_SHM_SHARED, | 1148 | ucstat = b43_shm_read16(dev, B43_SHM_SHARED, |
@@ -1144,35 +1154,39 @@ void b43_power_saving_ctl_bits(struct b43_wldev *dev, unsigned int ps_flags) | |||
1144 | } | 1154 | } |
1145 | } | 1155 | } |
1146 | 1156 | ||
1147 | static void b43_ssb_wireless_core_reset(struct b43_wldev *dev, u32 flags) | 1157 | static void b43_ssb_wireless_core_reset(struct b43_wldev *dev, bool gmode) |
1148 | { | 1158 | { |
1159 | struct ssb_device *sdev = dev->dev->sdev; | ||
1149 | u32 tmslow; | 1160 | u32 tmslow; |
1161 | u32 flags = 0; | ||
1150 | 1162 | ||
1163 | if (gmode) | ||
1164 | flags |= B43_TMSLOW_GMODE; | ||
1151 | flags |= B43_TMSLOW_PHYCLKEN; | 1165 | flags |= B43_TMSLOW_PHYCLKEN; |
1152 | flags |= B43_TMSLOW_PHYRESET; | 1166 | flags |= B43_TMSLOW_PHYRESET; |
1153 | if (dev->phy.type == B43_PHYTYPE_N) | 1167 | if (dev->phy.type == B43_PHYTYPE_N) |
1154 | flags |= B43_TMSLOW_PHY_BANDWIDTH_20MHZ; /* Make 20 MHz def */ | 1168 | flags |= B43_TMSLOW_PHY_BANDWIDTH_20MHZ; /* Make 20 MHz def */ |
1155 | ssb_device_enable(dev->sdev, flags); | 1169 | b43_device_enable(dev, flags); |
1156 | msleep(2); /* Wait for the PLL to turn on. */ | 1170 | msleep(2); /* Wait for the PLL to turn on. */ |
1157 | 1171 | ||
1158 | /* Now take the PHY out of Reset again */ | 1172 | /* Now take the PHY out of Reset again */ |
1159 | tmslow = ssb_read32(dev->sdev, SSB_TMSLOW); | 1173 | tmslow = ssb_read32(sdev, SSB_TMSLOW); |
1160 | tmslow |= SSB_TMSLOW_FGC; | 1174 | tmslow |= SSB_TMSLOW_FGC; |
1161 | tmslow &= ~B43_TMSLOW_PHYRESET; | 1175 | tmslow &= ~B43_TMSLOW_PHYRESET; |
1162 | ssb_write32(dev->sdev, SSB_TMSLOW, tmslow); | 1176 | ssb_write32(sdev, SSB_TMSLOW, tmslow); |
1163 | ssb_read32(dev->sdev, SSB_TMSLOW); /* flush */ | 1177 | ssb_read32(sdev, SSB_TMSLOW); /* flush */ |
1164 | msleep(1); | 1178 | msleep(1); |
1165 | tmslow &= ~SSB_TMSLOW_FGC; | 1179 | tmslow &= ~SSB_TMSLOW_FGC; |
1166 | ssb_write32(dev->sdev, SSB_TMSLOW, tmslow); | 1180 | ssb_write32(sdev, SSB_TMSLOW, tmslow); |
1167 | ssb_read32(dev->sdev, SSB_TMSLOW); /* flush */ | 1181 | ssb_read32(sdev, SSB_TMSLOW); /* flush */ |
1168 | msleep(1); | 1182 | msleep(1); |
1169 | } | 1183 | } |
1170 | 1184 | ||
1171 | void b43_wireless_core_reset(struct b43_wldev *dev, u32 flags) | 1185 | void b43_wireless_core_reset(struct b43_wldev *dev, bool gmode) |
1172 | { | 1186 | { |
1173 | u32 macctl; | 1187 | u32 macctl; |
1174 | 1188 | ||
1175 | b43_ssb_wireless_core_reset(dev, flags); | 1189 | b43_ssb_wireless_core_reset(dev, gmode); |
1176 | 1190 | ||
1177 | /* Turn Analog ON, but only if we already know the PHY-type. | 1191 | /* Turn Analog ON, but only if we already know the PHY-type. |
1178 | * This protects against very early setup where we don't know the | 1192 | * This protects against very early setup where we don't know the |
@@ -1183,7 +1197,7 @@ void b43_wireless_core_reset(struct b43_wldev *dev, u32 flags) | |||
1183 | 1197 | ||
1184 | macctl = b43_read32(dev, B43_MMIO_MACCTL); | 1198 | macctl = b43_read32(dev, B43_MMIO_MACCTL); |
1185 | macctl &= ~B43_MACCTL_GMODE; | 1199 | macctl &= ~B43_MACCTL_GMODE; |
1186 | if (flags & B43_TMSLOW_GMODE) | 1200 | if (gmode) |
1187 | macctl |= B43_MACCTL_GMODE; | 1201 | macctl |= B43_MACCTL_GMODE; |
1188 | macctl |= B43_MACCTL_IHR_ENABLED; | 1202 | macctl |= B43_MACCTL_IHR_ENABLED; |
1189 | b43_write32(dev, B43_MMIO_MACCTL, macctl); | 1203 | b43_write32(dev, B43_MMIO_MACCTL, macctl); |
@@ -1221,7 +1235,7 @@ static void drain_txstatus_queue(struct b43_wldev *dev) | |||
1221 | { | 1235 | { |
1222 | u32 dummy; | 1236 | u32 dummy; |
1223 | 1237 | ||
1224 | if (dev->sdev->id.revision < 5) | 1238 | if (dev->dev->core_rev < 5) |
1225 | return; | 1239 | return; |
1226 | /* Read all entries from the microcode TXstatus FIFO | 1240 | /* Read all entries from the microcode TXstatus FIFO |
1227 | * and throw them away. | 1241 | * and throw them away. |
@@ -1427,9 +1441,9 @@ u8 b43_ieee80211_antenna_sanitize(struct b43_wldev *dev, | |||
1427 | 1441 | ||
1428 | /* Get the mask of available antennas. */ | 1442 | /* Get the mask of available antennas. */ |
1429 | if (dev->phy.gmode) | 1443 | if (dev->phy.gmode) |
1430 | antenna_mask = dev->sdev->bus->sprom.ant_available_bg; | 1444 | antenna_mask = dev->dev->bus_sprom->ant_available_bg; |
1431 | else | 1445 | else |
1432 | antenna_mask = dev->sdev->bus->sprom.ant_available_a; | 1446 | antenna_mask = dev->dev->bus_sprom->ant_available_a; |
1433 | 1447 | ||
1434 | if (!(antenna_mask & (1 << (antenna_nr - 1)))) { | 1448 | if (!(antenna_mask & (1 << (antenna_nr - 1)))) { |
1435 | /* This antenna is not available. Fall back to default. */ | 1449 | /* This antenna is not available. Fall back to default. */ |
@@ -1644,7 +1658,7 @@ static void b43_beacon_update_trigger_work(struct work_struct *work) | |||
1644 | mutex_lock(&wl->mutex); | 1658 | mutex_lock(&wl->mutex); |
1645 | dev = wl->current_dev; | 1659 | dev = wl->current_dev; |
1646 | if (likely(dev && (b43_status(dev) >= B43_STAT_INITIALIZED))) { | 1660 | if (likely(dev && (b43_status(dev) >= B43_STAT_INITIALIZED))) { |
1647 | if (dev->sdev->bus->bustype == SSB_BUSTYPE_SDIO) { | 1661 | if (b43_bus_host_is_sdio(dev->dev)) { |
1648 | /* wl->mutex is enough. */ | 1662 | /* wl->mutex is enough. */ |
1649 | b43_do_beacon_update_trigger_work(dev); | 1663 | b43_do_beacon_update_trigger_work(dev); |
1650 | mmiowb(); | 1664 | mmiowb(); |
@@ -1689,7 +1703,7 @@ static void b43_update_templates(struct b43_wl *wl) | |||
1689 | static void b43_set_beacon_int(struct b43_wldev *dev, u16 beacon_int) | 1703 | static void b43_set_beacon_int(struct b43_wldev *dev, u16 beacon_int) |
1690 | { | 1704 | { |
1691 | b43_time_lock(dev); | 1705 | b43_time_lock(dev); |
1692 | if (dev->sdev->id.revision >= 3) { | 1706 | if (dev->dev->core_rev >= 3) { |
1693 | b43_write32(dev, B43_MMIO_TSF_CFP_REP, (beacon_int << 16)); | 1707 | b43_write32(dev, B43_MMIO_TSF_CFP_REP, (beacon_int << 16)); |
1694 | b43_write32(dev, B43_MMIO_TSF_CFP_START, (beacon_int << 10)); | 1708 | b43_write32(dev, B43_MMIO_TSF_CFP_START, (beacon_int << 10)); |
1695 | } else { | 1709 | } else { |
@@ -2063,7 +2077,7 @@ int b43_do_request_fw(struct b43_request_fw_context *ctx, | |||
2063 | B43_WARN_ON(1); | 2077 | B43_WARN_ON(1); |
2064 | return -ENOSYS; | 2078 | return -ENOSYS; |
2065 | } | 2079 | } |
2066 | err = request_firmware(&blob, ctx->fwname, ctx->dev->sdev->dev); | 2080 | err = request_firmware(&blob, ctx->fwname, ctx->dev->dev->dev); |
2067 | if (err == -ENOENT) { | 2081 | if (err == -ENOENT) { |
2068 | snprintf(ctx->errors[ctx->req_type], | 2082 | snprintf(ctx->errors[ctx->req_type], |
2069 | sizeof(ctx->errors[ctx->req_type]), | 2083 | sizeof(ctx->errors[ctx->req_type]), |
@@ -2113,7 +2127,7 @@ static int b43_try_request_fw(struct b43_request_fw_context *ctx) | |||
2113 | { | 2127 | { |
2114 | struct b43_wldev *dev = ctx->dev; | 2128 | struct b43_wldev *dev = ctx->dev; |
2115 | struct b43_firmware *fw = &ctx->dev->fw; | 2129 | struct b43_firmware *fw = &ctx->dev->fw; |
2116 | const u8 rev = ctx->dev->sdev->id.revision; | 2130 | const u8 rev = ctx->dev->dev->core_rev; |
2117 | const char *filename; | 2131 | const char *filename; |
2118 | u32 tmshigh; | 2132 | u32 tmshigh; |
2119 | int err; | 2133 | int err; |
@@ -2157,7 +2171,7 @@ static int b43_try_request_fw(struct b43_request_fw_context *ctx) | |||
2157 | switch (dev->phy.type) { | 2171 | switch (dev->phy.type) { |
2158 | case B43_PHYTYPE_A: | 2172 | case B43_PHYTYPE_A: |
2159 | if ((rev >= 5) && (rev <= 10)) { | 2173 | if ((rev >= 5) && (rev <= 10)) { |
2160 | tmshigh = ssb_read32(dev->sdev, SSB_TMSHIGH); | 2174 | tmshigh = ssb_read32(dev->dev->sdev, SSB_TMSHIGH); |
2161 | if (tmshigh & B43_TMSHIGH_HAVE_2GHZ_PHY) | 2175 | if (tmshigh & B43_TMSHIGH_HAVE_2GHZ_PHY) |
2162 | filename = "a0g1initvals5"; | 2176 | filename = "a0g1initvals5"; |
2163 | else | 2177 | else |
@@ -2202,7 +2216,7 @@ static int b43_try_request_fw(struct b43_request_fw_context *ctx) | |||
2202 | switch (dev->phy.type) { | 2216 | switch (dev->phy.type) { |
2203 | case B43_PHYTYPE_A: | 2217 | case B43_PHYTYPE_A: |
2204 | if ((rev >= 5) && (rev <= 10)) { | 2218 | if ((rev >= 5) && (rev <= 10)) { |
2205 | tmshigh = ssb_read32(dev->sdev, SSB_TMSHIGH); | 2219 | tmshigh = ssb_read32(dev->dev->sdev, SSB_TMSHIGH); |
2206 | if (tmshigh & B43_TMSHIGH_HAVE_2GHZ_PHY) | 2220 | if (tmshigh & B43_TMSHIGH_HAVE_2GHZ_PHY) |
2207 | filename = "a0g1bsinitvals5"; | 2221 | filename = "a0g1bsinitvals5"; |
2208 | else | 2222 | else |
@@ -2448,7 +2462,7 @@ static int b43_upload_microcode(struct b43_wldev *dev) | |||
2448 | 2462 | ||
2449 | snprintf(wiphy->fw_version, sizeof(wiphy->fw_version), "%u.%u", | 2463 | snprintf(wiphy->fw_version, sizeof(wiphy->fw_version), "%u.%u", |
2450 | dev->fw.rev, dev->fw.patch); | 2464 | dev->fw.rev, dev->fw.patch); |
2451 | wiphy->hw_version = dev->sdev->id.coreid; | 2465 | wiphy->hw_version = dev->dev->core_id; |
2452 | 2466 | ||
2453 | if (b43_is_old_txhdr_format(dev)) { | 2467 | if (b43_is_old_txhdr_format(dev)) { |
2454 | /* We're over the deadline, but we keep support for old fw | 2468 | /* We're over the deadline, but we keep support for old fw |
@@ -2566,7 +2580,7 @@ out: | |||
2566 | */ | 2580 | */ |
2567 | static struct ssb_device *b43_ssb_gpio_dev(struct b43_wldev *dev) | 2581 | static struct ssb_device *b43_ssb_gpio_dev(struct b43_wldev *dev) |
2568 | { | 2582 | { |
2569 | struct ssb_bus *bus = dev->sdev->bus; | 2583 | struct ssb_bus *bus = dev->dev->sdev->bus; |
2570 | 2584 | ||
2571 | #ifdef CONFIG_SSB_DRIVER_PCICORE | 2585 | #ifdef CONFIG_SSB_DRIVER_PCICORE |
2572 | return (bus->chipco.dev ? bus->chipco.dev : bus->pcicore.dev); | 2586 | return (bus->chipco.dev ? bus->chipco.dev : bus->pcicore.dev); |
@@ -2588,7 +2602,7 @@ static int b43_gpio_init(struct b43_wldev *dev) | |||
2588 | 2602 | ||
2589 | mask = 0x0000001F; | 2603 | mask = 0x0000001F; |
2590 | set = 0x0000000F; | 2604 | set = 0x0000000F; |
2591 | if (dev->sdev->bus->chip_id == 0x4301) { | 2605 | if (dev->dev->chip_id == 0x4301) { |
2592 | mask |= 0x0060; | 2606 | mask |= 0x0060; |
2593 | set |= 0x0060; | 2607 | set |= 0x0060; |
2594 | } | 2608 | } |
@@ -2599,14 +2613,14 @@ static int b43_gpio_init(struct b43_wldev *dev) | |||
2599 | mask |= 0x0180; | 2613 | mask |= 0x0180; |
2600 | set |= 0x0180; | 2614 | set |= 0x0180; |
2601 | } | 2615 | } |
2602 | if (dev->sdev->bus->sprom.boardflags_lo & B43_BFL_PACTRL) { | 2616 | if (dev->dev->bus_sprom->boardflags_lo & B43_BFL_PACTRL) { |
2603 | b43_write16(dev, B43_MMIO_GPIO_MASK, | 2617 | b43_write16(dev, B43_MMIO_GPIO_MASK, |
2604 | b43_read16(dev, B43_MMIO_GPIO_MASK) | 2618 | b43_read16(dev, B43_MMIO_GPIO_MASK) |
2605 | | 0x0200); | 2619 | | 0x0200); |
2606 | mask |= 0x0200; | 2620 | mask |= 0x0200; |
2607 | set |= 0x0200; | 2621 | set |= 0x0200; |
2608 | } | 2622 | } |
2609 | if (dev->sdev->id.revision >= 2) | 2623 | if (dev->dev->core_rev >= 2) |
2610 | mask |= 0x0010; /* FIXME: This is redundant. */ | 2624 | mask |= 0x0010; /* FIXME: This is redundant. */ |
2611 | 2625 | ||
2612 | gpiodev = b43_ssb_gpio_dev(dev); | 2626 | gpiodev = b43_ssb_gpio_dev(dev); |
@@ -2741,15 +2755,15 @@ static void b43_adjust_opmode(struct b43_wldev *dev) | |||
2741 | /* Workaround: On old hardware the HW-MAC-address-filter | 2755 | /* Workaround: On old hardware the HW-MAC-address-filter |
2742 | * doesn't work properly, so always run promisc in filter | 2756 | * doesn't work properly, so always run promisc in filter |
2743 | * it in software. */ | 2757 | * it in software. */ |
2744 | if (dev->sdev->id.revision <= 4) | 2758 | if (dev->dev->core_rev <= 4) |
2745 | ctl |= B43_MACCTL_PROMISC; | 2759 | ctl |= B43_MACCTL_PROMISC; |
2746 | 2760 | ||
2747 | b43_write32(dev, B43_MMIO_MACCTL, ctl); | 2761 | b43_write32(dev, B43_MMIO_MACCTL, ctl); |
2748 | 2762 | ||
2749 | cfp_pretbtt = 2; | 2763 | cfp_pretbtt = 2; |
2750 | if ((ctl & B43_MACCTL_INFRA) && !(ctl & B43_MACCTL_AP)) { | 2764 | if ((ctl & B43_MACCTL_INFRA) && !(ctl & B43_MACCTL_AP)) { |
2751 | if (dev->sdev->bus->chip_id == 0x4306 && | 2765 | if (dev->dev->chip_id == 0x4306 && |
2752 | dev->sdev->bus->chip_rev == 3) | 2766 | dev->dev->chip_rev == 3) |
2753 | cfp_pretbtt = 100; | 2767 | cfp_pretbtt = 100; |
2754 | else | 2768 | else |
2755 | cfp_pretbtt = 50; | 2769 | cfp_pretbtt = 50; |
@@ -2907,7 +2921,7 @@ static int b43_chip_init(struct b43_wldev *dev) | |||
2907 | b43_write16(dev, 0x005E, value16); | 2921 | b43_write16(dev, 0x005E, value16); |
2908 | } | 2922 | } |
2909 | b43_write32(dev, 0x0100, 0x01000000); | 2923 | b43_write32(dev, 0x0100, 0x01000000); |
2910 | if (dev->sdev->id.revision < 5) | 2924 | if (dev->dev->core_rev < 5) |
2911 | b43_write32(dev, 0x010C, 0x01000000); | 2925 | b43_write32(dev, 0x010C, 0x01000000); |
2912 | 2926 | ||
2913 | b43_write32(dev, B43_MMIO_MACCTL, b43_read32(dev, B43_MMIO_MACCTL) | 2927 | b43_write32(dev, B43_MMIO_MACCTL, b43_read32(dev, B43_MMIO_MACCTL) |
@@ -2922,7 +2936,7 @@ static int b43_chip_init(struct b43_wldev *dev) | |||
2922 | /* Initially set the wireless operation mode. */ | 2936 | /* Initially set the wireless operation mode. */ |
2923 | b43_adjust_opmode(dev); | 2937 | b43_adjust_opmode(dev); |
2924 | 2938 | ||
2925 | if (dev->sdev->id.revision < 3) { | 2939 | if (dev->dev->core_rev < 3) { |
2926 | b43_write16(dev, 0x060E, 0x0000); | 2940 | b43_write16(dev, 0x060E, 0x0000); |
2927 | b43_write16(dev, 0x0610, 0x8000); | 2941 | b43_write16(dev, 0x0610, 0x8000); |
2928 | b43_write16(dev, 0x0604, 0x0000); | 2942 | b43_write16(dev, 0x0604, 0x0000); |
@@ -3105,7 +3119,7 @@ static int b43_validate_chipaccess(struct b43_wldev *dev) | |||
3105 | b43_shm_write32(dev, B43_SHM_SHARED, 0, backup0); | 3119 | b43_shm_write32(dev, B43_SHM_SHARED, 0, backup0); |
3106 | b43_shm_write32(dev, B43_SHM_SHARED, 4, backup4); | 3120 | b43_shm_write32(dev, B43_SHM_SHARED, 4, backup4); |
3107 | 3121 | ||
3108 | if ((dev->sdev->id.revision >= 3) && (dev->sdev->id.revision <= 10)) { | 3122 | if ((dev->dev->core_rev >= 3) && (dev->dev->core_rev <= 10)) { |
3109 | /* The 32bit register shadows the two 16bit registers | 3123 | /* The 32bit register shadows the two 16bit registers |
3110 | * with update sideeffects. Validate this. */ | 3124 | * with update sideeffects. Validate this. */ |
3111 | b43_write16(dev, B43_MMIO_TSF_CFP_START, 0xAAAA); | 3125 | b43_write16(dev, B43_MMIO_TSF_CFP_START, 0xAAAA); |
@@ -3954,7 +3968,7 @@ redo: | |||
3954 | 3968 | ||
3955 | /* Disable interrupts on the device. */ | 3969 | /* Disable interrupts on the device. */ |
3956 | b43_set_status(dev, B43_STAT_INITIALIZED); | 3970 | b43_set_status(dev, B43_STAT_INITIALIZED); |
3957 | if (dev->sdev->bus->bustype == SSB_BUSTYPE_SDIO) { | 3971 | if (b43_bus_host_is_sdio(dev->dev)) { |
3958 | /* wl->mutex is locked. That is enough. */ | 3972 | /* wl->mutex is locked. That is enough. */ |
3959 | b43_write32(dev, B43_MMIO_GEN_IRQ_MASK, 0); | 3973 | b43_write32(dev, B43_MMIO_GEN_IRQ_MASK, 0); |
3960 | b43_read32(dev, B43_MMIO_GEN_IRQ_MASK); /* Flush */ | 3974 | b43_read32(dev, B43_MMIO_GEN_IRQ_MASK); /* Flush */ |
@@ -3967,11 +3981,11 @@ redo: | |||
3967 | /* Synchronize and free the interrupt handlers. Unlock to avoid deadlocks. */ | 3981 | /* Synchronize and free the interrupt handlers. Unlock to avoid deadlocks. */ |
3968 | orig_dev = dev; | 3982 | orig_dev = dev; |
3969 | mutex_unlock(&wl->mutex); | 3983 | mutex_unlock(&wl->mutex); |
3970 | if (dev->sdev->bus->bustype == SSB_BUSTYPE_SDIO) { | 3984 | if (b43_bus_host_is_sdio(dev->dev)) { |
3971 | b43_sdio_free_irq(dev); | 3985 | b43_sdio_free_irq(dev); |
3972 | } else { | 3986 | } else { |
3973 | synchronize_irq(dev->sdev->irq); | 3987 | synchronize_irq(dev->dev->irq); |
3974 | free_irq(dev->sdev->irq, dev); | 3988 | free_irq(dev->dev->irq, dev); |
3975 | } | 3989 | } |
3976 | mutex_lock(&wl->mutex); | 3990 | mutex_lock(&wl->mutex); |
3977 | dev = wl->current_dev; | 3991 | dev = wl->current_dev; |
@@ -4004,19 +4018,19 @@ static int b43_wireless_core_start(struct b43_wldev *dev) | |||
4004 | B43_WARN_ON(b43_status(dev) != B43_STAT_INITIALIZED); | 4018 | B43_WARN_ON(b43_status(dev) != B43_STAT_INITIALIZED); |
4005 | 4019 | ||
4006 | drain_txstatus_queue(dev); | 4020 | drain_txstatus_queue(dev); |
4007 | if (dev->sdev->bus->bustype == SSB_BUSTYPE_SDIO) { | 4021 | if (b43_bus_host_is_sdio(dev->dev)) { |
4008 | err = b43_sdio_request_irq(dev, b43_sdio_interrupt_handler); | 4022 | err = b43_sdio_request_irq(dev, b43_sdio_interrupt_handler); |
4009 | if (err) { | 4023 | if (err) { |
4010 | b43err(dev->wl, "Cannot request SDIO IRQ\n"); | 4024 | b43err(dev->wl, "Cannot request SDIO IRQ\n"); |
4011 | goto out; | 4025 | goto out; |
4012 | } | 4026 | } |
4013 | } else { | 4027 | } else { |
4014 | err = request_threaded_irq(dev->sdev->irq, b43_interrupt_handler, | 4028 | err = request_threaded_irq(dev->dev->irq, b43_interrupt_handler, |
4015 | b43_interrupt_thread_handler, | 4029 | b43_interrupt_thread_handler, |
4016 | IRQF_SHARED, KBUILD_MODNAME, dev); | 4030 | IRQF_SHARED, KBUILD_MODNAME, dev); |
4017 | if (err) { | 4031 | if (err) { |
4018 | b43err(dev->wl, "Cannot request IRQ-%d\n", | 4032 | b43err(dev->wl, "Cannot request IRQ-%d\n", |
4019 | dev->sdev->irq); | 4033 | dev->dev->irq); |
4020 | goto out; | 4034 | goto out; |
4021 | } | 4035 | } |
4022 | } | 4036 | } |
@@ -4096,10 +4110,10 @@ static int b43_phy_versioning(struct b43_wldev *dev) | |||
4096 | analog_type, phy_type, phy_rev); | 4110 | analog_type, phy_type, phy_rev); |
4097 | 4111 | ||
4098 | /* Get RADIO versioning */ | 4112 | /* Get RADIO versioning */ |
4099 | if (dev->sdev->bus->chip_id == 0x4317) { | 4113 | if (dev->dev->chip_id == 0x4317) { |
4100 | if (dev->sdev->bus->chip_rev == 0) | 4114 | if (dev->dev->chip_rev == 0) |
4101 | tmp = 0x3205017F; | 4115 | tmp = 0x3205017F; |
4102 | else if (dev->sdev->bus->chip_rev == 1) | 4116 | else if (dev->dev->chip_rev == 1) |
4103 | tmp = 0x4205017F; | 4117 | tmp = 0x4205017F; |
4104 | else | 4118 | else |
4105 | tmp = 0x5205017F; | 4119 | tmp = 0x5205017F; |
@@ -4204,7 +4218,7 @@ static void setup_struct_wldev_for_init(struct b43_wldev *dev) | |||
4204 | 4218 | ||
4205 | static void b43_bluetooth_coext_enable(struct b43_wldev *dev) | 4219 | static void b43_bluetooth_coext_enable(struct b43_wldev *dev) |
4206 | { | 4220 | { |
4207 | struct ssb_sprom *sprom = &dev->sdev->bus->sprom; | 4221 | struct ssb_sprom *sprom = dev->dev->bus_sprom; |
4208 | u64 hf; | 4222 | u64 hf; |
4209 | 4223 | ||
4210 | if (!modparam_btcoex) | 4224 | if (!modparam_btcoex) |
@@ -4231,16 +4245,21 @@ static void b43_bluetooth_coext_disable(struct b43_wldev *dev) | |||
4231 | 4245 | ||
4232 | static void b43_imcfglo_timeouts_workaround(struct b43_wldev *dev) | 4246 | static void b43_imcfglo_timeouts_workaround(struct b43_wldev *dev) |
4233 | { | 4247 | { |
4234 | struct ssb_bus *bus = dev->sdev->bus; | 4248 | struct ssb_bus *bus; |
4235 | u32 tmp; | 4249 | u32 tmp; |
4236 | 4250 | ||
4251 | if (dev->dev->bus_type != B43_BUS_SSB) | ||
4252 | return; | ||
4253 | |||
4254 | bus = dev->dev->sdev->bus; | ||
4255 | |||
4237 | if ((bus->chip_id == 0x4311 && bus->chip_rev == 2) || | 4256 | if ((bus->chip_id == 0x4311 && bus->chip_rev == 2) || |
4238 | (bus->chip_id == 0x4312)) { | 4257 | (bus->chip_id == 0x4312)) { |
4239 | tmp = ssb_read32(dev->sdev, SSB_IMCFGLO); | 4258 | tmp = ssb_read32(dev->dev->sdev, SSB_IMCFGLO); |
4240 | tmp &= ~SSB_IMCFGLO_REQTO; | 4259 | tmp &= ~SSB_IMCFGLO_REQTO; |
4241 | tmp &= ~SSB_IMCFGLO_SERTO; | 4260 | tmp &= ~SSB_IMCFGLO_SERTO; |
4242 | tmp |= 0x3; | 4261 | tmp |= 0x3; |
4243 | ssb_write32(dev->sdev, SSB_IMCFGLO, tmp); | 4262 | ssb_write32(dev->dev->sdev, SSB_IMCFGLO, tmp); |
4244 | ssb_commit_settings(bus); | 4263 | ssb_commit_settings(bus); |
4245 | } | 4264 | } |
4246 | } | 4265 | } |
@@ -4310,29 +4329,26 @@ static void b43_wireless_core_exit(struct b43_wldev *dev) | |||
4310 | dev->wl->current_beacon = NULL; | 4329 | dev->wl->current_beacon = NULL; |
4311 | } | 4330 | } |
4312 | 4331 | ||
4313 | ssb_device_disable(dev->sdev, 0); | 4332 | b43_device_disable(dev, 0); |
4314 | ssb_bus_may_powerdown(dev->sdev->bus); | 4333 | b43_bus_may_powerdown(dev); |
4315 | } | 4334 | } |
4316 | 4335 | ||
4317 | /* Initialize a wireless core */ | 4336 | /* Initialize a wireless core */ |
4318 | static int b43_wireless_core_init(struct b43_wldev *dev) | 4337 | static int b43_wireless_core_init(struct b43_wldev *dev) |
4319 | { | 4338 | { |
4320 | struct ssb_bus *bus = dev->sdev->bus; | 4339 | struct ssb_bus *bus = dev->sdev->bus; |
4321 | struct ssb_sprom *sprom = &bus->sprom; | 4340 | struct ssb_sprom *sprom = dev->dev->bus_sprom; |
4322 | struct b43_phy *phy = &dev->phy; | 4341 | struct b43_phy *phy = &dev->phy; |
4323 | int err; | 4342 | int err; |
4324 | u64 hf; | 4343 | u64 hf; |
4325 | u32 tmp; | ||
4326 | 4344 | ||
4327 | B43_WARN_ON(b43_status(dev) != B43_STAT_UNINIT); | 4345 | B43_WARN_ON(b43_status(dev) != B43_STAT_UNINIT); |
4328 | 4346 | ||
4329 | err = ssb_bus_powerup(bus, 0); | 4347 | err = b43_bus_powerup(dev, 0); |
4330 | if (err) | 4348 | if (err) |
4331 | goto out; | 4349 | goto out; |
4332 | if (!ssb_device_is_enabled(dev->sdev)) { | 4350 | if (!b43_device_is_enabled(dev)) |
4333 | tmp = phy->gmode ? B43_TMSLOW_GMODE : 0; | 4351 | b43_wireless_core_reset(dev, phy->gmode); |
4334 | b43_wireless_core_reset(dev, tmp); | ||
4335 | } | ||
4336 | 4352 | ||
4337 | /* Reset all data structures. */ | 4353 | /* Reset all data structures. */ |
4338 | setup_struct_wldev_for_init(dev); | 4354 | setup_struct_wldev_for_init(dev); |
@@ -4352,7 +4368,7 @@ static int b43_wireless_core_init(struct b43_wldev *dev) | |||
4352 | if (err) | 4368 | if (err) |
4353 | goto err_busdown; | 4369 | goto err_busdown; |
4354 | b43_shm_write16(dev, B43_SHM_SHARED, | 4370 | b43_shm_write16(dev, B43_SHM_SHARED, |
4355 | B43_SHM_SH_WLCOREREV, dev->sdev->id.revision); | 4371 | B43_SHM_SH_WLCOREREV, dev->dev->core_rev); |
4356 | hf = b43_hf_read(dev); | 4372 | hf = b43_hf_read(dev); |
4357 | if (phy->type == B43_PHYTYPE_G) { | 4373 | if (phy->type == B43_PHYTYPE_G) { |
4358 | hf |= B43_HF_SYMW; | 4374 | hf |= B43_HF_SYMW; |
@@ -4399,8 +4415,8 @@ static int b43_wireless_core_init(struct b43_wldev *dev) | |||
4399 | /* Maximum Contention Window */ | 4415 | /* Maximum Contention Window */ |
4400 | b43_shm_write16(dev, B43_SHM_SCRATCH, B43_SHM_SC_MAXCONT, 0x3FF); | 4416 | b43_shm_write16(dev, B43_SHM_SCRATCH, B43_SHM_SC_MAXCONT, 0x3FF); |
4401 | 4417 | ||
4402 | if ((dev->sdev->bus->bustype == SSB_BUSTYPE_PCMCIA) || | 4418 | if (b43_bus_host_is_pcmcia(dev->dev) || |
4403 | (dev->sdev->bus->bustype == SSB_BUSTYPE_SDIO) || | 4419 | b43_bus_host_is_sdio(dev->dev) || |
4404 | dev->use_pio) { | 4420 | dev->use_pio) { |
4405 | dev->__using_pio_transfers = 1; | 4421 | dev->__using_pio_transfers = 1; |
4406 | err = b43_pio_init(dev); | 4422 | err = b43_pio_init(dev); |
@@ -4414,7 +4430,7 @@ static int b43_wireless_core_init(struct b43_wldev *dev) | |||
4414 | b43_set_synth_pu_delay(dev, 1); | 4430 | b43_set_synth_pu_delay(dev, 1); |
4415 | b43_bluetooth_coext_enable(dev); | 4431 | b43_bluetooth_coext_enable(dev); |
4416 | 4432 | ||
4417 | ssb_bus_powerup(bus, !(sprom->boardflags_lo & B43_BFL_XTAL_NOSLOW)); | 4433 | b43_bus_powerup(dev, !(sprom->boardflags_lo & B43_BFL_XTAL_NOSLOW)); |
4418 | b43_upload_card_macaddress(dev); | 4434 | b43_upload_card_macaddress(dev); |
4419 | b43_security_init(dev); | 4435 | b43_security_init(dev); |
4420 | 4436 | ||
@@ -4431,7 +4447,7 @@ out: | |||
4431 | err_chip_exit: | 4447 | err_chip_exit: |
4432 | b43_chip_exit(dev); | 4448 | b43_chip_exit(dev); |
4433 | err_busdown: | 4449 | err_busdown: |
4434 | ssb_bus_may_powerdown(bus); | 4450 | b43_bus_may_powerdown(dev); |
4435 | B43_WARN_ON(b43_status(dev) != B43_STAT_UNINIT); | 4451 | B43_WARN_ON(b43_status(dev) != B43_STAT_UNINIT); |
4436 | return err; | 4452 | return err; |
4437 | } | 4453 | } |
@@ -4741,7 +4757,6 @@ static int b43_wireless_core_attach(struct b43_wldev *dev) | |||
4741 | struct pci_dev *pdev = (bus->bustype == SSB_BUSTYPE_PCI) ? bus->host_pci : NULL; | 4757 | struct pci_dev *pdev = (bus->bustype == SSB_BUSTYPE_PCI) ? bus->host_pci : NULL; |
4742 | int err; | 4758 | int err; |
4743 | bool have_2ghz_phy = 0, have_5ghz_phy = 0; | 4759 | bool have_2ghz_phy = 0, have_5ghz_phy = 0; |
4744 | u32 tmp; | ||
4745 | 4760 | ||
4746 | /* Do NOT do any device initialization here. | 4761 | /* Do NOT do any device initialization here. |
4747 | * Do it in wireless_core_init() instead. | 4762 | * Do it in wireless_core_init() instead. |
@@ -4750,13 +4765,13 @@ static int b43_wireless_core_attach(struct b43_wldev *dev) | |||
4750 | * that in core_init(), too. | 4765 | * that in core_init(), too. |
4751 | */ | 4766 | */ |
4752 | 4767 | ||
4753 | err = ssb_bus_powerup(bus, 0); | 4768 | err = b43_bus_powerup(dev, 0); |
4754 | if (err) { | 4769 | if (err) { |
4755 | b43err(wl, "Bus powerup failed\n"); | 4770 | b43err(wl, "Bus powerup failed\n"); |
4756 | goto out; | 4771 | goto out; |
4757 | } | 4772 | } |
4758 | /* Get the PHY type. */ | 4773 | /* Get the PHY type. */ |
4759 | if (dev->sdev->id.revision >= 5) { | 4774 | if (dev->dev->core_rev >= 5) { |
4760 | u32 tmshigh; | 4775 | u32 tmshigh; |
4761 | 4776 | ||
4762 | tmshigh = ssb_read32(dev->sdev, SSB_TMSHIGH); | 4777 | tmshigh = ssb_read32(dev->sdev, SSB_TMSHIGH); |
@@ -4767,8 +4782,7 @@ static int b43_wireless_core_attach(struct b43_wldev *dev) | |||
4767 | 4782 | ||
4768 | dev->phy.gmode = have_2ghz_phy; | 4783 | dev->phy.gmode = have_2ghz_phy; |
4769 | dev->phy.radio_on = 1; | 4784 | dev->phy.radio_on = 1; |
4770 | tmp = dev->phy.gmode ? B43_TMSLOW_GMODE : 0; | 4785 | b43_wireless_core_reset(dev, dev->phy.gmode); |
4771 | b43_wireless_core_reset(dev, tmp); | ||
4772 | 4786 | ||
4773 | err = b43_phy_versioning(dev); | 4787 | err = b43_phy_versioning(dev); |
4774 | if (err) | 4788 | if (err) |
@@ -4816,8 +4830,7 @@ static int b43_wireless_core_attach(struct b43_wldev *dev) | |||
4816 | goto err_powerdown; | 4830 | goto err_powerdown; |
4817 | 4831 | ||
4818 | dev->phy.gmode = have_2ghz_phy; | 4832 | dev->phy.gmode = have_2ghz_phy; |
4819 | tmp = dev->phy.gmode ? B43_TMSLOW_GMODE : 0; | 4833 | b43_wireless_core_reset(dev, dev->phy.gmode); |
4820 | b43_wireless_core_reset(dev, tmp); | ||
4821 | 4834 | ||
4822 | err = b43_validate_chipaccess(dev); | 4835 | err = b43_validate_chipaccess(dev); |
4823 | if (err) | 4836 | if (err) |
@@ -4832,8 +4845,8 @@ static int b43_wireless_core_attach(struct b43_wldev *dev) | |||
4832 | INIT_WORK(&dev->restart_work, b43_chip_reset); | 4845 | INIT_WORK(&dev->restart_work, b43_chip_reset); |
4833 | 4846 | ||
4834 | dev->phy.ops->switch_analog(dev, 0); | 4847 | dev->phy.ops->switch_analog(dev, 0); |
4835 | ssb_device_disable(dev->sdev, 0); | 4848 | b43_device_disable(dev, 0); |
4836 | ssb_bus_may_powerdown(bus); | 4849 | b43_bus_may_powerdown(dev); |
4837 | 4850 | ||
4838 | out: | 4851 | out: |
4839 | return err; | 4852 | return err; |
@@ -4841,11 +4854,11 @@ out: | |||
4841 | err_phy_free: | 4854 | err_phy_free: |
4842 | b43_phy_free(dev); | 4855 | b43_phy_free(dev); |
4843 | err_powerdown: | 4856 | err_powerdown: |
4844 | ssb_bus_may_powerdown(bus); | 4857 | b43_bus_may_powerdown(dev); |
4845 | return err; | 4858 | return err; |
4846 | } | 4859 | } |
4847 | 4860 | ||
4848 | static void b43_one_core_detach(struct ssb_device *dev) | 4861 | static void b43_one_core_detach(struct b43_bus_dev *dev) |
4849 | { | 4862 | { |
4850 | struct b43_wldev *wldev; | 4863 | struct b43_wldev *wldev; |
4851 | struct b43_wl *wl; | 4864 | struct b43_wl *wl; |
@@ -4853,17 +4866,17 @@ static void b43_one_core_detach(struct ssb_device *dev) | |||
4853 | /* Do not cancel ieee80211-workqueue based work here. | 4866 | /* Do not cancel ieee80211-workqueue based work here. |
4854 | * See comment in b43_remove(). */ | 4867 | * See comment in b43_remove(). */ |
4855 | 4868 | ||
4856 | wldev = ssb_get_drvdata(dev); | 4869 | wldev = ssb_get_drvdata(dev->sdev); |
4857 | wl = wldev->wl; | 4870 | wl = wldev->wl; |
4858 | b43_debugfs_remove_device(wldev); | 4871 | b43_debugfs_remove_device(wldev); |
4859 | b43_wireless_core_detach(wldev); | 4872 | b43_wireless_core_detach(wldev); |
4860 | list_del(&wldev->list); | 4873 | list_del(&wldev->list); |
4861 | wl->nr_devs--; | 4874 | wl->nr_devs--; |
4862 | ssb_set_drvdata(dev, NULL); | 4875 | ssb_set_drvdata(dev->sdev, NULL); |
4863 | kfree(wldev); | 4876 | kfree(wldev); |
4864 | } | 4877 | } |
4865 | 4878 | ||
4866 | static int b43_one_core_attach(struct ssb_device *dev, struct b43_wl *wl) | 4879 | static int b43_one_core_attach(struct b43_bus_dev *dev, struct b43_wl *wl) |
4867 | { | 4880 | { |
4868 | struct b43_wldev *wldev; | 4881 | struct b43_wldev *wldev; |
4869 | int err = -ENOMEM; | 4882 | int err = -ENOMEM; |
@@ -4873,7 +4886,8 @@ static int b43_one_core_attach(struct ssb_device *dev, struct b43_wl *wl) | |||
4873 | goto out; | 4886 | goto out; |
4874 | 4887 | ||
4875 | wldev->use_pio = b43_modparam_pio; | 4888 | wldev->use_pio = b43_modparam_pio; |
4876 | wldev->sdev = dev; | 4889 | wldev->dev = dev; |
4890 | wldev->sdev = dev->sdev; /* TODO: Remove when not needed */ | ||
4877 | wldev->wl = wl; | 4891 | wldev->wl = wl; |
4878 | b43_set_status(wldev, B43_STAT_UNINIT); | 4892 | b43_set_status(wldev, B43_STAT_UNINIT); |
4879 | wldev->bad_frames_preempt = modparam_bad_frames_preempt; | 4893 | wldev->bad_frames_preempt = modparam_bad_frames_preempt; |
@@ -4885,7 +4899,7 @@ static int b43_one_core_attach(struct ssb_device *dev, struct b43_wl *wl) | |||
4885 | 4899 | ||
4886 | list_add(&wldev->list, &wl->devlist); | 4900 | list_add(&wldev->list, &wl->devlist); |
4887 | wl->nr_devs++; | 4901 | wl->nr_devs++; |
4888 | ssb_set_drvdata(dev, wldev); | 4902 | ssb_set_drvdata(dev->sdev, wldev); |
4889 | b43_debugfs_add_device(wldev); | 4903 | b43_debugfs_add_device(wldev); |
4890 | 4904 | ||
4891 | out: | 4905 | out: |
@@ -4926,11 +4940,11 @@ static void b43_sprom_fixup(struct ssb_bus *bus) | |||
4926 | } | 4940 | } |
4927 | } | 4941 | } |
4928 | 4942 | ||
4929 | static void b43_wireless_exit(struct ssb_device *dev, struct b43_wl *wl) | 4943 | static void b43_wireless_exit(struct b43_bus_dev *dev, struct b43_wl *wl) |
4930 | { | 4944 | { |
4931 | struct ieee80211_hw *hw = wl->hw; | 4945 | struct ieee80211_hw *hw = wl->hw; |
4932 | 4946 | ||
4933 | ssb_set_devtypedata(dev, NULL); | 4947 | ssb_set_devtypedata(dev->sdev, NULL); |
4934 | ieee80211_free_hw(hw); | 4948 | ieee80211_free_hw(hw); |
4935 | } | 4949 | } |
4936 | 4950 | ||
@@ -4982,24 +4996,48 @@ static struct b43_wl *b43_wireless_init(struct ssb_device *dev) | |||
4982 | return wl; | 4996 | return wl; |
4983 | } | 4997 | } |
4984 | 4998 | ||
4985 | static int b43_ssb_probe(struct ssb_device *dev, const struct ssb_device_id *id) | 4999 | #ifdef CONFIG_B43_BCMA |
5000 | static int b43_bcma_probe(struct bcma_device *core) | ||
5001 | { | ||
5002 | b43err(NULL, "BCMA is not supported yet!"); | ||
5003 | return -EOPNOTSUPP; | ||
5004 | } | ||
5005 | |||
5006 | static void b43_bcma_remove(struct bcma_device *core) | ||
5007 | { | ||
5008 | /* TODO */ | ||
5009 | } | ||
5010 | |||
5011 | static struct bcma_driver b43_bcma_driver = { | ||
5012 | .name = KBUILD_MODNAME, | ||
5013 | .id_table = b43_bcma_tbl, | ||
5014 | .probe = b43_bcma_probe, | ||
5015 | .remove = b43_bcma_remove, | ||
5016 | }; | ||
5017 | #endif | ||
5018 | |||
5019 | static | ||
5020 | int b43_ssb_probe(struct ssb_device *sdev, const struct ssb_device_id *id) | ||
4986 | { | 5021 | { |
5022 | struct b43_bus_dev *dev; | ||
4987 | struct b43_wl *wl; | 5023 | struct b43_wl *wl; |
4988 | int err; | 5024 | int err; |
4989 | int first = 0; | 5025 | int first = 0; |
4990 | 5026 | ||
4991 | wl = ssb_get_devtypedata(dev); | 5027 | dev = b43_bus_dev_ssb_init(sdev); |
5028 | |||
5029 | wl = ssb_get_devtypedata(sdev); | ||
4992 | if (!wl) { | 5030 | if (!wl) { |
4993 | /* Probing the first core. Must setup common struct b43_wl */ | 5031 | /* Probing the first core. Must setup common struct b43_wl */ |
4994 | first = 1; | 5032 | first = 1; |
4995 | b43_sprom_fixup(dev->bus); | 5033 | b43_sprom_fixup(sdev->bus); |
4996 | wl = b43_wireless_init(dev); | 5034 | wl = b43_wireless_init(sdev); |
4997 | if (IS_ERR(wl)) { | 5035 | if (IS_ERR(wl)) { |
4998 | err = PTR_ERR(wl); | 5036 | err = PTR_ERR(wl); |
4999 | goto out; | 5037 | goto out; |
5000 | } | 5038 | } |
5001 | ssb_set_devtypedata(dev, wl); | 5039 | ssb_set_devtypedata(sdev, wl); |
5002 | B43_WARN_ON(ssb_get_devtypedata(dev) != wl); | 5040 | B43_WARN_ON(ssb_get_devtypedata(sdev) != wl); |
5003 | } | 5041 | } |
5004 | err = b43_one_core_attach(dev, wl); | 5042 | err = b43_one_core_attach(dev, wl); |
5005 | if (err) | 5043 | if (err) |
@@ -5023,10 +5061,10 @@ static int b43_ssb_probe(struct ssb_device *dev, const struct ssb_device_id *id) | |||
5023 | return err; | 5061 | return err; |
5024 | } | 5062 | } |
5025 | 5063 | ||
5026 | static void b43_ssb_remove(struct ssb_device *dev) | 5064 | static void b43_ssb_remove(struct ssb_device *sdev) |
5027 | { | 5065 | { |
5028 | struct b43_wl *wl = ssb_get_devtypedata(dev); | 5066 | struct b43_wl *wl = ssb_get_devtypedata(sdev); |
5029 | struct b43_wldev *wldev = ssb_get_drvdata(dev); | 5067 | struct b43_wldev *wldev = ssb_get_drvdata(sdev); |
5030 | 5068 | ||
5031 | /* We must cancel any work here before unregistering from ieee80211, | 5069 | /* We must cancel any work here before unregistering from ieee80211, |
5032 | * as the ieee80211 unreg will destroy the workqueue. */ | 5070 | * as the ieee80211 unreg will destroy the workqueue. */ |
@@ -5042,14 +5080,14 @@ static void b43_ssb_remove(struct ssb_device *dev) | |||
5042 | ieee80211_unregister_hw(wl->hw); | 5080 | ieee80211_unregister_hw(wl->hw); |
5043 | } | 5081 | } |
5044 | 5082 | ||
5045 | b43_one_core_detach(dev); | 5083 | b43_one_core_detach(wldev->dev); |
5046 | 5084 | ||
5047 | if (list_empty(&wl->devlist)) { | 5085 | if (list_empty(&wl->devlist)) { |
5048 | b43_leds_unregister(wl); | 5086 | b43_leds_unregister(wl); |
5049 | /* Last core on the chip unregistered. | 5087 | /* Last core on the chip unregistered. |
5050 | * We can destroy common struct b43_wl. | 5088 | * We can destroy common struct b43_wl. |
5051 | */ | 5089 | */ |
5052 | b43_wireless_exit(dev, wl); | 5090 | b43_wireless_exit(wldev->dev, wl); |
5053 | } | 5091 | } |
5054 | } | 5092 | } |
5055 | 5093 | ||
@@ -5108,14 +5146,23 @@ static int __init b43_init(void) | |||
5108 | err = b43_sdio_init(); | 5146 | err = b43_sdio_init(); |
5109 | if (err) | 5147 | if (err) |
5110 | goto err_pcmcia_exit; | 5148 | goto err_pcmcia_exit; |
5111 | err = ssb_driver_register(&b43_ssb_driver); | 5149 | #ifdef CONFIG_B43_BCMA |
5150 | err = bcma_driver_register(&b43_bcma_driver); | ||
5112 | if (err) | 5151 | if (err) |
5113 | goto err_sdio_exit; | 5152 | goto err_sdio_exit; |
5153 | #endif | ||
5154 | err = ssb_driver_register(&b43_ssb_driver); | ||
5155 | if (err) | ||
5156 | goto err_bcma_driver_exit; | ||
5114 | b43_print_driverinfo(); | 5157 | b43_print_driverinfo(); |
5115 | 5158 | ||
5116 | return err; | 5159 | return err; |
5117 | 5160 | ||
5161 | err_bcma_driver_exit: | ||
5162 | #ifdef CONFIG_B43_BCMA | ||
5163 | bcma_driver_unregister(&b43_bcma_driver); | ||
5118 | err_sdio_exit: | 5164 | err_sdio_exit: |
5165 | #endif | ||
5119 | b43_sdio_exit(); | 5166 | b43_sdio_exit(); |
5120 | err_pcmcia_exit: | 5167 | err_pcmcia_exit: |
5121 | b43_pcmcia_exit(); | 5168 | b43_pcmcia_exit(); |
@@ -5127,6 +5174,9 @@ err_dfs_exit: | |||
5127 | static void __exit b43_exit(void) | 5174 | static void __exit b43_exit(void) |
5128 | { | 5175 | { |
5129 | ssb_driver_unregister(&b43_ssb_driver); | 5176 | ssb_driver_unregister(&b43_ssb_driver); |
5177 | #ifdef CONFIG_B43_BCMA | ||
5178 | bcma_driver_unregister(&b43_bcma_driver); | ||
5179 | #endif | ||
5130 | b43_sdio_exit(); | 5180 | b43_sdio_exit(); |
5131 | b43_pcmcia_exit(); | 5181 | b43_pcmcia_exit(); |
5132 | b43_debugfs_exit(); | 5182 | b43_debugfs_exit(); |