aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafał Miłecki <zajec5@gmail.com>2011-08-15 12:50:55 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-08-24 14:41:43 -0400
commit78bc2463af4c311a188a9db4d833acf724bbc304 (patch)
tree1cac08d1c1728b699b207d2fd0ce037d9af9922c
parent00044f17afd36bf6397b9a2a12f242a057449e9a (diff)
b43: LCN-PHY: basic PHY init
Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/b43/phy_lcn.c74
1 files changed, 72 insertions, 2 deletions
diff --git a/drivers/net/wireless/b43/phy_lcn.c b/drivers/net/wireless/b43/phy_lcn.c
index 0fd72c194a25..604a3a66e5a6 100644
--- a/drivers/net/wireless/b43/phy_lcn.c
+++ b/drivers/net/wireless/b43/phy_lcn.c
@@ -28,6 +28,50 @@
28#include "main.h" 28#include "main.h"
29 29
30/************************************************** 30/**************************************************
31 * Various PHY ops
32 **************************************************/
33
34static void b43_phy_lcn_afe_set_unset(struct b43_wldev *dev)
35{
36 u16 afe_ctl2 = b43_phy_read(dev, B43_PHY_LCN_AFE_CTL2);
37 u16 afe_ctl1 = b43_phy_read(dev, B43_PHY_LCN_AFE_CTL1);
38
39 b43_phy_write(dev, B43_PHY_LCN_AFE_CTL2, afe_ctl2 | 0x1);
40 b43_phy_write(dev, B43_PHY_LCN_AFE_CTL1, afe_ctl1 | 0x1);
41
42 b43_phy_write(dev, B43_PHY_LCN_AFE_CTL2, afe_ctl2 & ~0x1);
43 b43_phy_write(dev, B43_PHY_LCN_AFE_CTL1, afe_ctl1 & ~0x1);
44
45 b43_phy_write(dev, B43_PHY_LCN_AFE_CTL2, afe_ctl2);
46 b43_phy_write(dev, B43_PHY_LCN_AFE_CTL1, afe_ctl1);
47}
48
49static void b43_phy_lcn_clean_0x18_table(struct b43_wldev *dev)
50{
51 u8 i;
52
53 for (i = 0; i < 0x80; i++)
54 b43_lcntab_write(dev, B43_LCNTAB32(0x18, i), 0x80000);
55}
56
57static void b43_phy_lcn_clear_0x07_table(struct b43_wldev *dev)
58{
59 u8 i;
60
61 b43_phy_write(dev, B43_PHY_LCN_TABLE_ADDR, (0x7 << 10) | 0x340);
62 for (i = 0; i < 30; i++) {
63 b43_phy_write(dev, B43_PHY_LCN_TABLE_DATAHI, 0);
64 b43_phy_write(dev, B43_PHY_LCN_TABLE_DATALO, 0);
65 }
66
67 b43_phy_write(dev, B43_PHY_LCN_TABLE_ADDR, (0x7 << 10) | 0x80);
68 for (i = 0; i < 64; i++) {
69 b43_phy_write(dev, B43_PHY_LCN_TABLE_DATAHI, 0);
70 b43_phy_write(dev, B43_PHY_LCN_TABLE_DATALO, 0);
71 }
72}
73
74/**************************************************
31 * Basic PHY ops. 75 * Basic PHY ops.
32 **************************************************/ 76 **************************************************/
33 77
@@ -60,6 +104,30 @@ static void b43_phy_lcn_op_prepare_structs(struct b43_wldev *dev)
60 memset(phy_lcn, 0, sizeof(*phy_lcn)); 104 memset(phy_lcn, 0, sizeof(*phy_lcn));
61} 105}
62 106
107static int b43_phy_lcn_op_init(struct b43_wldev *dev)
108{
109 b43_phy_set(dev, 0x44a, 0x80);
110 b43_phy_mask(dev, 0x44a, 0x7f);
111 b43_phy_set(dev, 0x6d1, 0x80);
112 b43_phy_write(dev, 0x6d0, 0x7);
113
114 b43_phy_lcn_afe_set_unset(dev);
115
116 b43_phy_write(dev, 0x60a, 0xa0);
117 b43_phy_write(dev, 0x46a, 0x19);
118 b43_phy_maskset(dev, 0x663, 0xFF00, 0x64);
119
120 b43_phy_lcn_tables_init(dev);
121 /* TODO: various tables ops here */
122 b43_phy_lcn_clean_0x18_table(dev);
123
124 /* TODO: some ops here */
125
126 b43_phy_lcn_clear_0x07_table(dev);
127
128 return 0;
129}
130
63static void b43_phy_lcn_op_software_rfkill(struct b43_wldev *dev, 131static void b43_phy_lcn_op_software_rfkill(struct b43_wldev *dev,
64 bool blocked) 132 bool blocked)
65{ 133{
@@ -77,7 +145,9 @@ static void b43_phy_lcn_op_software_rfkill(struct b43_wldev *dev,
77 b43_phy_mask(dev, B43_PHY_LCN_RF_CTL7, ~0x8); 145 b43_phy_mask(dev, B43_PHY_LCN_RF_CTL7, ~0x8);
78 b43_phy_set(dev, B43_PHY_LCN_RF_CTL6, 0x8); 146 b43_phy_set(dev, B43_PHY_LCN_RF_CTL6, 0x8);
79 } else { 147 } else {
80 /* TODO */ 148 b43_phy_mask(dev, B43_PHY_LCN_RF_CTL1, ~0x1f00);
149 b43_phy_mask(dev, B43_PHY_LCN_RF_CTL3, ~0x808);
150 b43_phy_mask(dev, B43_PHY_LCN_RF_CTL6, ~0x8);
81 } 151 }
82} 152}
83 153
@@ -116,8 +186,8 @@ const struct b43_phy_operations b43_phyops_lcn = {
116 .allocate = b43_phy_lcn_op_allocate, 186 .allocate = b43_phy_lcn_op_allocate,
117 .free = b43_phy_lcn_op_free, 187 .free = b43_phy_lcn_op_free,
118 .prepare_structs = b43_phy_lcn_op_prepare_structs, 188 .prepare_structs = b43_phy_lcn_op_prepare_structs,
119 /*
120 .init = b43_phy_lcn_op_init, 189 .init = b43_phy_lcn_op_init,
190 /*
121 .phy_read = b43_phy_lcn_op_read, 191 .phy_read = b43_phy_lcn_op_read,
122 .phy_write = b43_phy_lcn_op_write, 192 .phy_write = b43_phy_lcn_op_write,
123 .phy_maskset = b43_phy_lcn_op_maskset, 193 .phy_maskset = b43_phy_lcn_op_maskset,