Commit f19ebe7d authored by Rafał Miłecki's avatar Rafał Miłecki Committed by John W. Linville

b43: N-PHY: prepare for rev3+ channel tables

Signed-off-by: default avatarRafał Miłecki <zajec5@gmail.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent ffd2d9bd
...@@ -104,7 +104,7 @@ static enum b43_txpwr_result b43_nphy_op_recalc_txpower(struct b43_wldev *dev, ...@@ -104,7 +104,7 @@ static enum b43_txpwr_result b43_nphy_op_recalc_txpower(struct b43_wldev *dev,
} }
static void b43_chantab_radio_upload(struct b43_wldev *dev, static void b43_chantab_radio_upload(struct b43_wldev *dev,
const struct b43_nphy_channeltab_entry *e) const struct b43_nphy_channeltab_entry_rev2 *e)
{ {
b43_radio_write(dev, B2055_PLL_REF, e->radio_pll_ref); b43_radio_write(dev, B2055_PLL_REF, e->radio_pll_ref);
b43_radio_write(dev, B2055_RF_PLLMOD0, e->radio_rf_pllmod0); b43_radio_write(dev, B2055_RF_PLLMOD0, e->radio_rf_pllmod0);
...@@ -159,7 +159,7 @@ static void b43_nphy_tx_power_fix(struct b43_wldev *dev) ...@@ -159,7 +159,7 @@ static void b43_nphy_tx_power_fix(struct b43_wldev *dev)
/* http://bcm-v4.sipsolutions.net/802.11/PHY/Radio/2055Setup */ /* http://bcm-v4.sipsolutions.net/802.11/PHY/Radio/2055Setup */
static void b43_radio_2055_setup(struct b43_wldev *dev, static void b43_radio_2055_setup(struct b43_wldev *dev,
const struct b43_nphy_channeltab_entry *e) const struct b43_nphy_channeltab_entry_rev2 *e)
{ {
B43_WARN_ON(dev->phy.rev >= 3); B43_WARN_ON(dev->phy.rev >= 3);
...@@ -3336,16 +3336,20 @@ static int b43_nphy_set_chanspec(struct b43_wldev *dev, ...@@ -3336,16 +3336,20 @@ static int b43_nphy_set_chanspec(struct b43_wldev *dev,
{ {
struct b43_phy_n *nphy = dev->phy.n; struct b43_phy_n *nphy = dev->phy.n;
const struct b43_nphy_channeltab_entry *tabent; const struct b43_nphy_channeltab_entry_rev2 *tabent_r2;
const struct b43_nphy_channeltab_entry_rev3 *tabent_r3;
u8 tmp; u8 tmp;
u8 channel = chanspec.channel; u8 channel = chanspec.channel;
if (dev->phy.rev >= 3) { if (dev->phy.rev >= 3) {
/* TODO */ /* TODO */
tabent_r3 = NULL;
if (!tabent_r3)
return -ESRCH;
} else { } else {
tabent = b43_nphy_get_chantabent(dev, channel); tabent_r2 = b43_nphy_get_chantabent_rev2(dev, channel);
if (!tabent) if (!tabent_r2)
return -ESRCH; return -ESRCH;
} }
...@@ -3367,13 +3371,13 @@ static int b43_nphy_set_chanspec(struct b43_wldev *dev, ...@@ -3367,13 +3371,13 @@ static int b43_nphy_set_chanspec(struct b43_wldev *dev,
if (dev->phy.rev >= 3) { if (dev->phy.rev >= 3) {
tmp = (chanspec.b_freq == 1) ? 4 : 0; tmp = (chanspec.b_freq == 1) ? 4 : 0;
b43_radio_maskset(dev, 0x08, 0xFFFB, tmp); b43_radio_maskset(dev, 0x08, 0xFFFB, tmp);
/* TODO: PHY Radio2056 Setup (chan_info_ptr[i]) */ /* TODO: PHY Radio2056 Setup (dev, tabent_r3); */
/* TODO: N PHY Chanspec Setup (chan_info_ptr[i]) */ b43_nphy_chanspec_setup(dev, &(tabent_r3->phy_regs), chanspec);
} else { } else {
tmp = (chanspec.b_freq == 1) ? 0x0020 : 0x0050; tmp = (chanspec.b_freq == 1) ? 0x0020 : 0x0050;
b43_radio_maskset(dev, B2055_MASTER1, 0xFF8F, tmp); b43_radio_maskset(dev, B2055_MASTER1, 0xFF8F, tmp);
b43_radio_2055_setup(dev, tabent); b43_radio_2055_setup(dev, tabent_r2);
b43_nphy_chanspec_setup(dev, &(tabent->phy_regs), chanspec); b43_nphy_chanspec_setup(dev, &(tabent_r2->phy_regs), chanspec);
} }
return 0; return 0;
......
...@@ -325,7 +325,7 @@ void b2055_upload_inittab(struct b43_wldev *dev, ...@@ -325,7 +325,7 @@ void b2055_upload_inittab(struct b43_wldev *dev,
.phy_regs.phy_bw5 = r4, \ .phy_regs.phy_bw5 = r4, \
.phy_regs.phy_bw6 = r5 .phy_regs.phy_bw6 = r5
static const struct b43_nphy_channeltab_entry b43_nphy_channeltab[] = { static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab[] = {
{ .channel = 184, { .channel = 184,
.freq = 4920, /* MHz */ .freq = 4920, /* MHz */
.unk2 = 3280, .unk2 = 3280,
...@@ -1320,10 +1320,10 @@ static const struct b43_nphy_channeltab_entry b43_nphy_channeltab[] = { ...@@ -1320,10 +1320,10 @@ static const struct b43_nphy_channeltab_entry b43_nphy_channeltab[] = {
}, },
}; };
const struct b43_nphy_channeltab_entry * const struct b43_nphy_channeltab_entry_rev2 *
b43_nphy_get_chantabent(struct b43_wldev *dev, u8 channel) b43_nphy_get_chantabent_rev2(struct b43_wldev *dev, u8 channel)
{ {
const struct b43_nphy_channeltab_entry *e; const struct b43_nphy_channeltab_entry_rev2 *e;
unsigned int i; unsigned int i;
for (i = 0; i < ARRAY_SIZE(b43_nphy_channeltab); i++) { for (i = 0; i < ARRAY_SIZE(b43_nphy_channeltab); i++) {
......
...@@ -13,7 +13,7 @@ struct b43_phy_n_sfo_cfg { ...@@ -13,7 +13,7 @@ struct b43_phy_n_sfo_cfg {
u16 phy_bw6; u16 phy_bw6;
}; };
struct b43_nphy_channeltab_entry { struct b43_nphy_channeltab_entry_rev2 {
/* The channel number */ /* The channel number */
u8 channel; u8 channel;
/* The channel frequency in MHz */ /* The channel frequency in MHz */
...@@ -47,6 +47,17 @@ struct b43_nphy_channeltab_entry { ...@@ -47,6 +47,17 @@ struct b43_nphy_channeltab_entry {
struct b43_phy_n_sfo_cfg phy_regs; struct b43_phy_n_sfo_cfg phy_regs;
}; };
struct b43_nphy_channeltab_entry_rev3 {
/* The channel number */
u8 channel;
/* The channel frequency in MHz */
u16 freq;
/* Radio register values on channelswitch */
/* TODO */
/* PHY register values on channelswitch */
struct b43_phy_n_sfo_cfg phy_regs;
};
struct b43_wldev; struct b43_wldev;
...@@ -81,8 +92,8 @@ void b2055_upload_inittab(struct b43_wldev *dev, ...@@ -81,8 +92,8 @@ void b2055_upload_inittab(struct b43_wldev *dev,
/* Get the NPHY Channel Switch Table entry for a channel number. /* Get the NPHY Channel Switch Table entry for a channel number.
* Returns NULL on failure to find an entry. */ * Returns NULL on failure to find an entry. */
const struct b43_nphy_channeltab_entry * const struct b43_nphy_channeltab_entry_rev2 *
b43_nphy_get_chantabent(struct b43_wldev *dev, u8 channel); b43_nphy_get_chantabent_rev2(struct b43_wldev *dev, u8 channel);
/* The N-PHY tables. */ /* The N-PHY tables. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment