diff options
author | Rafał Miłecki <zajec5@gmail.com> | 2015-01-25 12:01:37 -0500 |
---|---|---|
committer | Kalle Valo <kvalo@codeaurora.org> | 2015-01-29 03:54:43 -0500 |
commit | 3f7bb3f34cc880bc35f6c278be16cd8afee7c524 (patch) | |
tree | b4c7b7a3c4011e0353599b41dcd7a514dff1fe8f | |
parent | 86144b01a25185ec092b9301e340ca4f7a8c0d92 (diff) |
b43: AC-PHY: prepare place for developing new PHY support
There are new (not anymore?) Broadcom 802.11ac wireless cards based on
chipsets like BCM4352 and BCM4360. They use a new PHY type (called
simply AC) that will require new specific code.
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
-rw-r--r-- | drivers/net/wireless/b43/Kconfig | 9 | ||||
-rw-r--r-- | drivers/net/wireless/b43/Makefile | 1 | ||||
-rw-r--r-- | drivers/net/wireless/b43/main.c | 10 | ||||
-rw-r--r-- | drivers/net/wireless/b43/phy_ac.c | 92 | ||||
-rw-r--r-- | drivers/net/wireless/b43/phy_ac.h | 38 | ||||
-rw-r--r-- | drivers/net/wireless/b43/phy_common.c | 9 | ||||
-rw-r--r-- | drivers/net/wireless/b43/phy_common.h | 2 |
7 files changed, 160 insertions, 1 deletions
diff --git a/drivers/net/wireless/b43/Kconfig b/drivers/net/wireless/b43/Kconfig index 64a5b672e30a..759fb8d41fc9 100644 --- a/drivers/net/wireless/b43/Kconfig +++ b/drivers/net/wireless/b43/Kconfig | |||
@@ -166,6 +166,15 @@ config B43_PHY_LCN | |||
166 | 166 | ||
167 | Say N, this is BROKEN and crashes driver. | 167 | Say N, this is BROKEN and crashes driver. |
168 | 168 | ||
169 | config B43_PHY_AC | ||
170 | bool "Support for AC-PHY (802.11ac) devices (BROKEN)" | ||
171 | depends on B43 && B43_BCMA && BROKEN | ||
172 | ---help--- | ||
173 | This PHY type can be found in the following chipsets: | ||
174 | PCI: BCM4352, BCM4360 | ||
175 | |||
176 | Say N, this is BROKEN and crashes driver. | ||
177 | |||
169 | # This config option automatically enables b43 LEDS support, | 178 | # This config option automatically enables b43 LEDS support, |
170 | # if it's possible. | 179 | # if it's possible. |
171 | config B43_LEDS | 180 | config B43_LEDS |
diff --git a/drivers/net/wireless/b43/Makefile b/drivers/net/wireless/b43/Makefile index 9f7965aae93d..c624d4d90e4f 100644 --- a/drivers/net/wireless/b43/Makefile +++ b/drivers/net/wireless/b43/Makefile | |||
@@ -13,6 +13,7 @@ b43-$(CONFIG_B43_PHY_HT) += phy_ht.o | |||
13 | b43-$(CONFIG_B43_PHY_HT) += tables_phy_ht.o | 13 | b43-$(CONFIG_B43_PHY_HT) += tables_phy_ht.o |
14 | b43-$(CONFIG_B43_PHY_HT) += radio_2059.o | 14 | b43-$(CONFIG_B43_PHY_HT) += radio_2059.o |
15 | b43-$(CONFIG_B43_PHY_LCN) += phy_lcn.o tables_phy_lcn.o | 15 | b43-$(CONFIG_B43_PHY_LCN) += phy_lcn.o tables_phy_lcn.o |
16 | b43-$(CONFIG_B43_PHY_AC) += phy_ac.o | ||
16 | b43-y += sysfs.o | 17 | b43-y += sysfs.o |
17 | b43-y += xmit.o | 18 | b43-y += xmit.o |
18 | b43-y += dma.o | 19 | b43-y += dma.o |
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index 1784933573e4..2c9088633ec6 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
@@ -4544,6 +4544,12 @@ static int b43_phy_versioning(struct b43_wldev *dev) | |||
4544 | unsupported = 1; | 4544 | unsupported = 1; |
4545 | break; | 4545 | break; |
4546 | #endif | 4546 | #endif |
4547 | #ifdef CONFIG_B43_PHY_AC | ||
4548 | case B43_PHYTYPE_AC: | ||
4549 | if (phy_rev > 1) | ||
4550 | unsupported = 1; | ||
4551 | break; | ||
4552 | #endif | ||
4547 | default: | 4553 | default: |
4548 | unsupported = 1; | 4554 | unsupported = 1; |
4549 | } | 4555 | } |
@@ -4640,6 +4646,10 @@ static int b43_phy_versioning(struct b43_wldev *dev) | |||
4640 | if (radio_id != 0x2064) | 4646 | if (radio_id != 0x2064) |
4641 | unsupported = 1; | 4647 | unsupported = 1; |
4642 | break; | 4648 | break; |
4649 | case B43_PHYTYPE_AC: | ||
4650 | if (radio_id != 0x2069) | ||
4651 | unsupported = 1; | ||
4652 | break; | ||
4643 | default: | 4653 | default: |
4644 | B43_WARN_ON(1); | 4654 | B43_WARN_ON(1); |
4645 | } | 4655 | } |
diff --git a/drivers/net/wireless/b43/phy_ac.c b/drivers/net/wireless/b43/phy_ac.c new file mode 100644 index 000000000000..e75633d67938 --- /dev/null +++ b/drivers/net/wireless/b43/phy_ac.c | |||
@@ -0,0 +1,92 @@ | |||
1 | /* | ||
2 | * Broadcom B43 wireless driver | ||
3 | * IEEE 802.11ac AC-PHY support | ||
4 | * | ||
5 | * Copyright (c) 2015 Rafał Miłecki <zajec5@gmail.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it | ||
8 | * under the terms of the GNU General Public License as published by the | ||
9 | * Free Software Foundation; either version 2 of the License, or (at your | ||
10 | * option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include "b43.h" | ||
14 | #include "phy_ac.h" | ||
15 | |||
16 | /************************************************** | ||
17 | * Basic PHY ops | ||
18 | **************************************************/ | ||
19 | |||
20 | static int b43_phy_ac_op_allocate(struct b43_wldev *dev) | ||
21 | { | ||
22 | struct b43_phy_ac *phy_ac; | ||
23 | |||
24 | phy_ac = kzalloc(sizeof(*phy_ac), GFP_KERNEL); | ||
25 | if (!phy_ac) | ||
26 | return -ENOMEM; | ||
27 | dev->phy.ac = phy_ac; | ||
28 | |||
29 | return 0; | ||
30 | } | ||
31 | |||
32 | static void b43_phy_ac_op_free(struct b43_wldev *dev) | ||
33 | { | ||
34 | struct b43_phy *phy = &dev->phy; | ||
35 | struct b43_phy_ac *phy_ac = phy->ac; | ||
36 | |||
37 | kfree(phy_ac); | ||
38 | phy->ac = NULL; | ||
39 | } | ||
40 | |||
41 | static void b43_phy_ac_op_maskset(struct b43_wldev *dev, u16 reg, u16 mask, | ||
42 | u16 set) | ||
43 | { | ||
44 | b43_write16f(dev, B43_MMIO_PHY_CONTROL, reg); | ||
45 | b43_write16(dev, B43_MMIO_PHY_DATA, | ||
46 | (b43_read16(dev, B43_MMIO_PHY_DATA) & mask) | set); | ||
47 | } | ||
48 | |||
49 | static u16 b43_phy_ac_op_radio_read(struct b43_wldev *dev, u16 reg) | ||
50 | { | ||
51 | b43_write16f(dev, B43_MMIO_RADIO24_CONTROL, reg); | ||
52 | return b43_read16(dev, B43_MMIO_RADIO24_DATA); | ||
53 | } | ||
54 | |||
55 | static void b43_phy_ac_op_radio_write(struct b43_wldev *dev, u16 reg, | ||
56 | u16 value) | ||
57 | { | ||
58 | b43_write16f(dev, B43_MMIO_RADIO24_CONTROL, reg); | ||
59 | b43_write16(dev, B43_MMIO_RADIO24_DATA, value); | ||
60 | } | ||
61 | |||
62 | static unsigned int b43_phy_ac_op_get_default_chan(struct b43_wldev *dev) | ||
63 | { | ||
64 | if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) | ||
65 | return 11; | ||
66 | return 36; | ||
67 | } | ||
68 | |||
69 | static enum b43_txpwr_result | ||
70 | b43_phy_ac_op_recalc_txpower(struct b43_wldev *dev, bool ignore_tssi) | ||
71 | { | ||
72 | return B43_TXPWR_RES_DONE; | ||
73 | } | ||
74 | |||
75 | static void b43_phy_ac_op_adjust_txpower(struct b43_wldev *dev) | ||
76 | { | ||
77 | } | ||
78 | |||
79 | /************************************************** | ||
80 | * PHY ops struct | ||
81 | **************************************************/ | ||
82 | |||
83 | const struct b43_phy_operations b43_phyops_ac = { | ||
84 | .allocate = b43_phy_ac_op_allocate, | ||
85 | .free = b43_phy_ac_op_free, | ||
86 | .phy_maskset = b43_phy_ac_op_maskset, | ||
87 | .radio_read = b43_phy_ac_op_radio_read, | ||
88 | .radio_write = b43_phy_ac_op_radio_write, | ||
89 | .get_default_chan = b43_phy_ac_op_get_default_chan, | ||
90 | .recalc_txpower = b43_phy_ac_op_recalc_txpower, | ||
91 | .adjust_txpower = b43_phy_ac_op_adjust_txpower, | ||
92 | }; | ||
diff --git a/drivers/net/wireless/b43/phy_ac.h b/drivers/net/wireless/b43/phy_ac.h new file mode 100644 index 000000000000..d1ca79e0eb24 --- /dev/null +++ b/drivers/net/wireless/b43/phy_ac.h | |||
@@ -0,0 +1,38 @@ | |||
1 | #ifndef B43_PHY_AC_H_ | ||
2 | #define B43_PHY_AC_H_ | ||
3 | |||
4 | #include "phy_common.h" | ||
5 | |||
6 | #define B43_PHY_AC_BBCFG 0x001 | ||
7 | #define B43_PHY_AC_BBCFG_RSTCCA 0x4000 /* Reset CCA */ | ||
8 | #define B43_PHY_AC_BANDCTL 0x003 /* Band control */ | ||
9 | #define B43_PHY_AC_BANDCTL_5GHZ 0x0001 | ||
10 | #define B43_PHY_AC_TABLE_ID 0x00d | ||
11 | #define B43_PHY_AC_TABLE_OFFSET 0x00e | ||
12 | #define B43_PHY_AC_TABLE_DATA1 0x00f | ||
13 | #define B43_PHY_AC_TABLE_DATA2 0x010 | ||
14 | #define B43_PHY_AC_TABLE_DATA3 0x011 | ||
15 | #define B43_PHY_AC_CLASSCTL 0x140 /* Classifier control */ | ||
16 | #define B43_PHY_AC_CLASSCTL_CCKEN 0x0001 /* CCK enable */ | ||
17 | #define B43_PHY_AC_CLASSCTL_OFDMEN 0x0002 /* OFDM enable */ | ||
18 | #define B43_PHY_AC_CLASSCTL_WAITEDEN 0x0004 /* Waited enable */ | ||
19 | #define B43_PHY_AC_BW1A 0x371 | ||
20 | #define B43_PHY_AC_BW2 0x372 | ||
21 | #define B43_PHY_AC_BW3 0x373 | ||
22 | #define B43_PHY_AC_BW4 0x374 | ||
23 | #define B43_PHY_AC_BW5 0x375 | ||
24 | #define B43_PHY_AC_BW6 0x376 | ||
25 | #define B43_PHY_AC_RFCTL_CMD 0x408 | ||
26 | #define B43_PHY_AC_C1_CLIP 0x6d4 | ||
27 | #define B43_PHY_AC_C1_CLIP_DIS 0x4000 | ||
28 | #define B43_PHY_AC_C2_CLIP 0x8d4 | ||
29 | #define B43_PHY_AC_C2_CLIP_DIS 0x4000 | ||
30 | #define B43_PHY_AC_C3_CLIP 0xad4 | ||
31 | #define B43_PHY_AC_C3_CLIP_DIS 0x4000 | ||
32 | |||
33 | struct b43_phy_ac { | ||
34 | }; | ||
35 | |||
36 | extern const struct b43_phy_operations b43_phyops_ac; | ||
37 | |||
38 | #endif /* B43_PHY_AC_H_ */ | ||
diff --git a/drivers/net/wireless/b43/phy_common.c b/drivers/net/wireless/b43/phy_common.c index ee27b06074e1..ec2b9c577b90 100644 --- a/drivers/net/wireless/b43/phy_common.c +++ b/drivers/net/wireless/b43/phy_common.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include "phy_lp.h" | 33 | #include "phy_lp.h" |
34 | #include "phy_ht.h" | 34 | #include "phy_ht.h" |
35 | #include "phy_lcn.h" | 35 | #include "phy_lcn.h" |
36 | #include "phy_ac.h" | ||
36 | #include "b43.h" | 37 | #include "b43.h" |
37 | #include "main.h" | 38 | #include "main.h" |
38 | 39 | ||
@@ -70,6 +71,11 @@ int b43_phy_allocate(struct b43_wldev *dev) | |||
70 | phy->ops = &b43_phyops_lcn; | 71 | phy->ops = &b43_phyops_lcn; |
71 | #endif | 72 | #endif |
72 | break; | 73 | break; |
74 | case B43_PHYTYPE_AC: | ||
75 | #ifdef CONFIG_B43_PHY_AC | ||
76 | phy->ops = &b43_phyops_ac; | ||
77 | #endif | ||
78 | break; | ||
73 | } | 79 | } |
74 | if (B43_WARN_ON(!phy->ops)) | 80 | if (B43_WARN_ON(!phy->ops)) |
75 | return -ENODEV; | 81 | return -ENODEV; |
@@ -572,7 +578,8 @@ void b43_phy_force_clock(struct b43_wldev *dev, bool force) | |||
572 | u32 tmp; | 578 | u32 tmp; |
573 | 579 | ||
574 | WARN_ON(dev->phy.type != B43_PHYTYPE_N && | 580 | WARN_ON(dev->phy.type != B43_PHYTYPE_N && |
575 | dev->phy.type != B43_PHYTYPE_HT); | 581 | dev->phy.type != B43_PHYTYPE_HT && |
582 | dev->phy.type != B43_PHYTYPE_AC); | ||
576 | 583 | ||
577 | switch (dev->dev->bus_type) { | 584 | switch (dev->dev->bus_type) { |
578 | #ifdef CONFIG_B43_BCMA | 585 | #ifdef CONFIG_B43_BCMA |
diff --git a/drivers/net/wireless/b43/phy_common.h b/drivers/net/wireless/b43/phy_common.h index 3912274f71e3..78d86526799e 100644 --- a/drivers/net/wireless/b43/phy_common.h +++ b/drivers/net/wireless/b43/phy_common.h | |||
@@ -222,6 +222,8 @@ struct b43_phy { | |||
222 | struct b43_phy_ht *ht; | 222 | struct b43_phy_ht *ht; |
223 | /* LCN-PHY specific information */ | 223 | /* LCN-PHY specific information */ |
224 | struct b43_phy_lcn *lcn; | 224 | struct b43_phy_lcn *lcn; |
225 | /* AC-PHY specific information */ | ||
226 | struct b43_phy_ac *ac; | ||
225 | }; | 227 | }; |
226 | 228 | ||
227 | /* Band support flags. */ | 229 | /* Band support flags. */ |