iPXE
Macros | Functions | Variables
rtl8180_max2820.c File Reference
#include <unistd.h>
#include <ipxe/pci.h>
#include <ipxe/net80211.h>
#include "rtl818x.h"

Go to the source code of this file.

Macros

#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
 

Macro Definition Documentation

◆ MAXIM_ANTENNA

#define MAXIM_ANTENNA   0xb3

Definition at line 31 of file rtl8180_max2820.c.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_ONLY  )

◆ write_max2820()

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

Definition at line 50 of file rtl8180_max2820.c.

51 {
52  struct rtl818x_priv *priv = dev->priv;
53  u32 phy_config;
54 
55  phy_config = 0x90 + (data & 0xf);
56  phy_config <<= 16;
57  phy_config += addr;
58  phy_config <<= 8;
59  phy_config += (data >> 4) & 0xff;
60 
61  /* This was originally a 32-bit write to a typecast
62  RFPinsOutput, but gcc complained about aliasing rules. -JBO */
63  rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, phy_config & 0xffff);
64  rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, phy_config >> 16);
65 
66  mdelay(1);
67 }
void * priv
Driver private data.
Definition: net80211.h:798
void mdelay(unsigned long msecs)
Delay for a fixed number of milliseconds.
Definition: timer.c:78
static struct tlan_private * priv
Definition: tlan.c:224
u32 addr
Definition: sky2.h:8
uint8_t data[48]
Additional event data.
Definition: ena.h:22
static void rtl818x_iowrite16(struct rtl818x_priv *priv __unused, u16 *addr, u16 val)
Definition: rtl818x.h:336
uint32_t u32
Definition: stdint.h:23

References addr, data, mdelay(), priv, net80211_device::priv, and rtl818x_iowrite16().

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

◆ max2820_write_phy_antenna()

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

Definition at line 69 of file rtl8180_max2820.c.

70 {
71  struct rtl818x_priv *priv = dev->priv;
72  u8 ant;
73 
74  ant = MAXIM_ANTENNA;
75  if (priv->rfparam & RF_PARAM_ANTBDEFAULT)
76  ant |= BB_ANTENNA_B;
77  if (chan == 14)
78  ant |= BB_ANTATTEN_CHAN14;
79 
80  rtl818x_write_phy(dev, 0x10, ant);
81 }
void rtl818x_write_phy(struct net80211_device *dev, u8 addr, u32 data)
Definition: rtl818x.c:46
#define BB_ANTENNA_B
Definition: rtl818x.h:205
#define MAXIM_ANTENNA
void * priv
Driver private data.
Definition: net80211.h:798
#define BB_ANTATTEN_CHAN14
Definition: rtl818x.h:204
static struct tlan_private * priv
Definition: tlan.c:224
#define RF_PARAM_ANTBDEFAULT
Definition: rtl818x.h:200
uint8_t u8
Definition: stdint.h:19

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

Referenced by max2820_rf_init(), and max2820_rf_set_channel().

◆ max2820_rf_set_channel()

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

Definition at line 83 of file rtl8180_max2820.c.

85 {
86  struct rtl818x_priv *priv = dev->priv;
87  int channel = channelp->channel_nr;
88  unsigned int chan_idx = channel - 1;
89  u32 txpw = priv->txpower[chan_idx] & 0xFF;
90  u32 chan = max2820_chan[chan_idx];
91 
92  /* While philips SA2400 drive the PA bias from
93  * sa2400, for MAXIM we do this directly from BB */
94  rtl818x_write_phy(dev, 3, txpw);
95 
97  write_max2820(dev, 3, chan);
98 }
void rtl818x_write_phy(struct net80211_device *dev, u8 addr, u32 data)
Definition: rtl818x.c:46
static void max2820_write_phy_antenna(struct net80211_device *dev, short chan)
uint32_t channel
RNDIS channel.
Definition: netvsc.h:14
void * priv
Driver private data.
Definition: net80211.h:798
static const u32 max2820_chan[]
static struct tlan_private * priv
Definition: tlan.c:224
static void write_max2820(struct net80211_device *dev, u8 addr, u32 data)
u8 channel_nr
A channel number interpreted according to the band.
Definition: net80211.h:405
uint32_t u32
Definition: stdint.h:23

References channel, net80211_channel::channel_nr, max2820_chan, max2820_write_phy_antenna(), priv, net80211_device::priv, rtl818x_write_phy(), and write_max2820().

Referenced by max2820_rf_init().

◆ max2820_rf_stop()

static void max2820_rf_stop ( struct net80211_device dev)
static

Definition at line 100 of file rtl8180_max2820.c.

101 {
102  rtl818x_write_phy(dev, 3, 0x8);
103  write_max2820(dev, 1, 0);
104 }
void rtl818x_write_phy(struct net80211_device *dev, u8 addr, u32 data)
Definition: rtl818x.c:46
static void write_max2820(struct net80211_device *dev, u8 addr, u32 data)

References rtl818x_write_phy(), and write_max2820().

◆ max2820_rf_init()

static void max2820_rf_init ( struct net80211_device dev)
static

Definition at line 107 of file rtl8180_max2820.c.

108 {
109  struct rtl818x_priv *priv = dev->priv;
110 
111  /* MAXIM from netbsd driver */
112  write_max2820(dev, 0, 0x007); /* test mode as indicated in datasheet */
113  write_max2820(dev, 1, 0x01e); /* enable register */
114  write_max2820(dev, 2, 0x001); /* synt register */
115 
117 
118  write_max2820(dev, 4, 0x313); /* rx register */
119 
120  /* PA is driven directly by the BB, we keep the MAXIM bias
121  * at the highest value in case that setting it to lower
122  * values may introduce some further attenuation somewhere..
123  */
124  write_max2820(dev, 5, 0x00f);
125 
126  /* baseband configuration */
127  rtl818x_write_phy(dev, 0, 0x88); /* sys1 */
128  rtl818x_write_phy(dev, 3, 0x08); /* txagc */
129  rtl818x_write_phy(dev, 4, 0xf8); /* lnadet */
130  rtl818x_write_phy(dev, 5, 0x90); /* ifagcinit */
131  rtl818x_write_phy(dev, 6, 0x1a); /* ifagclimit */
132  rtl818x_write_phy(dev, 7, 0x64); /* ifagcdet */
133 
135 
136  rtl818x_write_phy(dev, 0x11, 0x88); /* trl */
137 
138  if (rtl818x_ioread8(priv, &priv->map->CONFIG2) &
140  rtl818x_write_phy(dev, 0x12, 0xc7);
141  else
142  rtl818x_write_phy(dev, 0x12, 0x47);
143 
144  rtl818x_write_phy(dev, 0x13, 0x9b);
145 
146  rtl818x_write_phy(dev, 0x19, 0x0); /* CHESTLIM */
147  rtl818x_write_phy(dev, 0x1a, 0x9f); /* CHSQLIM */
148 
150 }
void rtl818x_write_phy(struct net80211_device *dev, u8 addr, u32 data)
Definition: rtl818x.c:46
static u8 rtl818x_ioread8(struct rtl818x_priv *priv __unused, u8 *addr)
Definition: rtl818x.h:315
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)
void * priv
Driver private data.
Definition: net80211.h:798
static struct tlan_private * priv
Definition: tlan.c:224
static void write_max2820(struct net80211_device *dev, u8 addr, u32 data)
#define NULL
NULL pointer (VOID *)
Definition: Base.h:321
#define RTL818X_CONFIG2_ANTENNA_DIV
Definition: rtl818x.h:114

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

Variable Documentation

◆ max2820_chan

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().

◆ __rtl818x_rf_driver

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,
}
static void max2820_rf_set_channel(struct net80211_device *dev, struct net80211_channel *channelp)
static void max2820_rf_init(struct net80211_device *dev)
static void max2820_rf_stop(struct net80211_device *dev)

Definition at line 152 of file rtl8180_max2820.c.