rtl8180_max2820.c File Reference

#include <unistd.h>
#include <gpxe/pci.h>
#include <gpxe/net80211.h>
#include "rtl818x.h"

Go to the source code of this file.

Defines

#define MAXIM_ANTENNA   0xb3

Functions

 FILE_LICENCE (GPL2_ONLY)
static void write_max2820 (struct net80211_device *dev, u8 addr, u32 data)
static void max2820_write_phy_antenna (struct net80211_device *dev, short chan)
static void max2820_rf_set_channel (struct net80211_device *dev, struct net80211_channel *channelp)
static void max2820_rf_stop (struct net80211_device *dev)
static void max2820_rf_init (struct net80211_device *dev)

Variables

static const u32 max2820_chan []
struct rtl818x_rf_ops
max2820_rf_ops 
__rtl818x_rf_driver


Define Documentation

#define MAXIM_ANTENNA   0xb3

Definition at line 31 of file rtl8180_max2820.c.

Referenced by max2820_write_phy_antenna().


Function Documentation

FILE_LICENCE ( GPL2_ONLY   ) 

static void write_max2820 ( struct net80211_device dev,
u8  addr,
u32  data 
) [static]

Definition at line 50 of file rtl8180_max2820.c.

References rtl818x_priv::map, mdelay(), net80211_device::priv, priv, rtl818x_csr::RFPinsEnable, rtl818x_csr::RFPinsOutput, rtl818x_iowrite16(), and u32.

Referenced by max2820_rf_init(), max2820_rf_set_channel(), and max2820_rf_stop().

00051 {
00052         struct rtl818x_priv *priv = dev->priv;
00053         u32 phy_config;
00054 
00055         phy_config = 0x90 + (data & 0xf);
00056         phy_config <<= 16;
00057         phy_config += addr;
00058         phy_config <<= 8;
00059         phy_config += (data >> 4) & 0xff;
00060 
00061         /* This was originally a 32-bit write to a typecast
00062            RFPinsOutput, but gcc complained about aliasing rules. -JBO */
00063         rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, phy_config & 0xffff);
00064         rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, phy_config >> 16);
00065 
00066         mdelay(1);
00067 }

static void max2820_write_phy_antenna ( struct net80211_device dev,
short  chan 
) [static]

Definition at line 69 of file rtl8180_max2820.c.

References BB_ANTATTEN_CHAN14, BB_ANTENNA_B, MAXIM_ANTENNA, net80211_device::priv, priv, RF_PARAM_ANTBDEFAULT, rtl818x_priv::rfparam, rtl818x_write_phy(), and u8.

Referenced by max2820_rf_init(), and max2820_rf_set_channel().

00070 {
00071         struct rtl818x_priv *priv = dev->priv;
00072         u8 ant;
00073 
00074         ant = MAXIM_ANTENNA;
00075         if (priv->rfparam & RF_PARAM_ANTBDEFAULT)
00076                 ant |= BB_ANTENNA_B;
00077         if (chan == 14)
00078                 ant |= BB_ANTATTEN_CHAN14;
00079 
00080         rtl818x_write_phy(dev, 0x10, ant);
00081 }

static void max2820_rf_set_channel ( struct net80211_device dev,
struct net80211_channel channelp 
) [static]

Definition at line 83 of file rtl8180_max2820.c.

References net80211_channel::channel_nr, max2820_chan, max2820_write_phy_antenna(), net80211_device::priv, priv, rtl818x_write_phy(), rtl818x_priv::txpower, u32, and write_max2820().

Referenced by max2820_rf_init().

00085 {
00086         struct rtl818x_priv *priv = dev->priv;
00087         int channel = channelp->channel_nr;
00088         unsigned int chan_idx = channel - 1;
00089         u32 txpw = priv->txpower[chan_idx] & 0xFF;
00090         u32 chan = max2820_chan[chan_idx];
00091 
00092         /* While philips SA2400 drive the PA bias from
00093          * sa2400, for MAXIM we do this directly from BB */
00094         rtl818x_write_phy(dev, 3, txpw);
00095 
00096         max2820_write_phy_antenna(dev, channel);
00097         write_max2820(dev, 3, chan);
00098 }

static void max2820_rf_stop ( struct net80211_device dev  )  [static]

Definition at line 100 of file rtl8180_max2820.c.

References rtl818x_write_phy(), and write_max2820().

00101 {
00102         rtl818x_write_phy(dev, 3, 0x8);
00103         write_max2820(dev, 1, 0);
00104 }

static void max2820_rf_init ( struct net80211_device dev  )  [static]

Definition at line 107 of file rtl8180_max2820.c.

References rtl818x_csr::CONFIG2, rtl818x_priv::map, max2820_rf_set_channel(), max2820_write_phy_antenna(), NULL, net80211_device::priv, priv, RTL818X_CONFIG2_ANTENNA_DIV, rtl818x_ioread8(), rtl818x_write_phy(), and write_max2820().

00108 {
00109         struct rtl818x_priv *priv = dev->priv;
00110 
00111         /* MAXIM from netbsd driver */
00112         write_max2820(dev, 0, 0x007); /* test mode as indicated in datasheet */
00113         write_max2820(dev, 1, 0x01e); /* enable register */
00114         write_max2820(dev, 2, 0x001); /* synt register */
00115 
00116         max2820_rf_set_channel(dev, NULL);
00117 
00118         write_max2820(dev, 4, 0x313); /* rx register */
00119 
00120         /* PA is driven directly by the BB, we keep the MAXIM bias
00121          * at the highest value in case that setting it to lower
00122          * values may introduce some further attenuation somewhere..
00123          */
00124         write_max2820(dev, 5, 0x00f);
00125 
00126         /* baseband configuration */
00127         rtl818x_write_phy(dev, 0, 0x88); /* sys1       */
00128         rtl818x_write_phy(dev, 3, 0x08); /* txagc      */
00129         rtl818x_write_phy(dev, 4, 0xf8); /* lnadet     */
00130         rtl818x_write_phy(dev, 5, 0x90); /* ifagcinit  */
00131         rtl818x_write_phy(dev, 6, 0x1a); /* ifagclimit */
00132         rtl818x_write_phy(dev, 7, 0x64); /* ifagcdet   */
00133 
00134         max2820_write_phy_antenna(dev, 1);
00135 
00136         rtl818x_write_phy(dev, 0x11, 0x88); /* trl */
00137 
00138         if (rtl818x_ioread8(priv, &priv->map->CONFIG2) &
00139             RTL818X_CONFIG2_ANTENNA_DIV)
00140                 rtl818x_write_phy(dev, 0x12, 0xc7);
00141         else
00142                 rtl818x_write_phy(dev, 0x12, 0x47);
00143 
00144         rtl818x_write_phy(dev, 0x13, 0x9b);
00145 
00146         rtl818x_write_phy(dev, 0x19, 0x0);  /* CHESTLIM */
00147         rtl818x_write_phy(dev, 0x1a, 0x9f); /* CHSQLIM  */
00148 
00149         max2820_rf_set_channel(dev, NULL);
00150 }


Variable Documentation

const u32 max2820_chan[] [static]

Initial value:

 {
        12, 
        17,
        22,
        27,
        32,
        37,
        42,
        47,
        52,
        57,
        62,
        67,
        72,
        84, 
}

Definition at line 33 of file rtl8180_max2820.c.

Referenced by max2820_rf_set_channel().

struct rtl818x_rf_ops max2820_rf_ops __rtl818x_rf_driver

Initial value:

 {
        .name           = "Maxim max2820",
        .id             = 4,
        .init           = max2820_rf_init,
        .stop           = max2820_rf_stop,
        .set_chan       = max2820_rf_set_channel
}

Definition at line 152 of file rtl8180_max2820.c.


Generated on Tue Apr 6 20:01:38 2010 for gPXE by  doxygen 1.5.7.1