41 60, 90, 120, 180, 240, 360, 480, 540,
44#define RTL818X_NR_B_RATES 4
45#define RTL818X_NR_RATES 12
85 DBG2(
"rtl818x RX:%d CRC fail: flags %08x\n",
96 DBGP(
"rtl818x RX:%d success: flags %08x %08x\n",
163#define DIV_ROUND_UP(n,d) (((n)+(d)-1)/(d))
180 unsigned int remainder;
184 remainder = (16 * (
len + 4)) %
187 if (remainder > 0 && remainder <= 6)
191 entry = &
priv->tx_ring[
priv->tx_prod];
195 tx_flags |=
priv->hw_rtscts_rate << 19;
271 reg |= (1 << 15) | (1 << 14) | (1 << 4);
336 if (!
priv->rx_ring) {
337 DBG(
"rtl818x %s: cannot allocate RX ring\n", dev->
netdev->
name);
346 entry = &
priv->rx_ring[i];
350 priv->rx_buf[i] = iob;
381 if (!
priv->tx_ring) {
382 DBG(
"rtl818x %s: cannot allocate TX ring\n", dev->
netdev->
name);
566 priv->rf->conf_erp(dev);
613 unsigned int bit_id,
unsigned long data)
634static const char *rtl818x_rf_names[] = {
637 "SA2400",
"max2820",
"GRF5101",
642#define RTL818X_NR_RF_NAMES 11
660 const char *chip_name;
665 hwinfo =
zalloc(
sizeof(*hwinfo));
667 DBG(
"rtl818x: hwinfo alloc failed\n");
669 goto err_alloc_hwinfo;
676 DBG(
"rtl818x: net80211 alloc failed\n");
687 DBG(
"rtl818x: cannot find device memory\n");
708 DBG(
"rtl818x: Unknown chip! (0x%x)\n",
reg >> 25);
716 hwinfo->
flags = NET80211_HW_RX_HAS_FCS;
739 init_at93c66(&
priv->eeprom, 16);
741 init_at93c46(&
priv->eeprom, 16);
742 priv->eeprom.bus = &
priv->spibit.bus;
749 DBG2(
"rtl818x eeprom val = %04x\n", eeprom_val);
754 if (rf->
id == eeprom_val) {
762 if (eeprom_val < RTL818X_NR_RF_NAMES &&
763 rtl818x_rf_names[eeprom_val] !=
NULL)
764 DBG(
"rtl818x: %s RF frontend not supported!\n",
765 rtl818x_rf_names[eeprom_val]);
767 DBG(
"rtl818x: RF frontend #%d not recognized!\n",
776 priv->csthreshold = eeprom_val >> 8;
788 for (i = 0; i < 14; i += 2) {
790 nvs_read(&
priv->eeprom.nvs, 0x10 + (i >> 1), &txpwr, 2);
791 priv->txpower[i] = txpwr & 0xFF;
792 priv->txpower[i + 1] = txpwr >> 8;
797 for (i = 0; i < 14; i += 2) {
799 nvs_read(&
priv->eeprom.nvs, 0x20 + (i >> 1), &txpwr, 2);
800 priv->txpower[i] |= (txpwr & 0xFF) << 8;
801 priv->txpower[i + 1] |= txpwr & 0xFF00;
809 DBG(
"rtl818x: cannot register device\n");
815 DBG(
"rtl818x: Realtek RTL818%s (RF chip %s) with address %s\n",
#define NULL
NULL pointer (VOID *)
struct arbelprm_rc_send_wqe rc
struct bofm_section_header done
uint32_t addr
Buffer address.
uint8_t data[48]
Additional event data.
#define DBG(...)
Print a debugging message.
static unsigned int count
Number of entries.
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
#define NET80211_BAND_BIT_2GHZ
Bitmask for the 2GHz band.
#define NET80211_BAND_2GHZ
The 2.4 GHz ISM band, unlicensed in most countries.
#define NET80211_CFG_ASSOC
Association has been established with a new BSS (dev->bssid)
#define NET80211_CFG_CHANNEL
Channel choice (dev->channel) or regulatory parameters have changed.
#define NET80211_CFG_RATE
Requested transmission rate (dev->rate) has changed.
#define NET80211_CFG_PHY_PARAMS
Low-level link parameters (short preamble, protection, etc) have changed.
struct net80211_device * net80211_alloc(size_t priv_size)
Allocate 802.11 device.
void net80211_tx_complete(struct net80211_device *dev, struct io_buffer *iob, int retries, int rc)
Indicate the completed transmission of a packet.
int net80211_register(struct net80211_device *dev, struct net80211_device_operations *ops, struct net80211_hw_info *hw)
Register 802.11 device with network stack.
void net80211_unregister(struct net80211_device *dev)
Unregister 802.11 device from network stack.
void net80211_rx_err(struct net80211_device *dev, struct io_buffer *iob, int rc)
Indicate an error in receiving a packet.
void net80211_free(struct net80211_device *dev)
Free 802.11 device.
void net80211_rx(struct net80211_device *dev, struct io_buffer *iob, int signal, u16 rate)
Handle receipt of 802.11 frame.
#define NET80211_MODE_G
802.11g: 54 Mbps operation using ERP/OFDM signaling on the 2.4GHz band
#define NET80211_MODE_B
802.11b: 1-11 Mbps operation using DSSS/CCK signaling on the 2.4GHz band
#define NET80211_PHY_USE_PROTECTION
Whether to use RTS/CTS or CTS-to-self protection for transmissions.
#define NET80211_ASSOCIATED
Whether we have successfully associated with the network.
#define ENXIO
No such device or address.
#define EINVAL
Invalid argument.
#define ENOSYS
Function not implemented.
#define ETIMEDOUT
Connection timed out.
#define ENOMEM
Not enough space.
#define EIO
Input/output error.
#define EBUSY
Device or resource busy.
#define ECANCELED
Operation canceled.
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
#define le16_to_cpu(value)
#define le32_to_cpu(value)
#define cpu_to_le32(value)
#define cpu_to_le16(value)
static __always_inline unsigned long virt_to_bus(volatile const void *addr)
Convert virtual address to a bus address.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
void * memset(void *dest, int character, size_t len) __nonnull
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
struct io_buffer * alloc_iob(size_t len)
Allocate I/O buffer.
#define iob_put(iobuf, len)
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
void * zalloc(size_t size)
Allocate cleared memory.
void * malloc_phys(size_t size, size_t phys_align)
Allocate memory with specified physical alignment.
void free_phys(void *ptr, size_t size)
Free memory allocated with malloc_phys()
Dynamic memory allocation.
static unsigned int unsigned int reg
The iPXE 802.11 MAC layer.
static u16 net80211_cts_duration(struct net80211_device *dev, int size)
Calculate duration field for a CTS control frame.
Network device management.
static const char * netdev_addr(struct net_device *netdev)
Get printable network device link-layer address.
int nvs_read(struct nvs_device *nvs, unsigned int address, void *data, size_t len)
Read from non-volatile storage device.
void adjust_pci_device(struct pci_device *pci)
Enable PCI device.
static void pci_set_drvdata(struct pci_device *pci, void *priv)
Set PCI driver-private data.
static void * pci_get_drvdata(struct pci_device *pci)
Get PCI driver-private data.
static void(* free)(struct refcnt *refcnt))
struct net80211_device_operations rtl818x_operations
int rtl818x_probe(struct pci_device *pdev)
void rtl818x_remove(struct pci_device *pdev)
static void rtl818x_stop(struct net80211_device *dev)
#define RTL818X_NR_B_RATES
static struct bit_basher_operations rtl818x_basher_ops
static int rtl818x_spi_read_bit(struct bit_basher *basher, unsigned int bit_id)
static void rtl818x_spi_write_bit(struct bit_basher *basher, unsigned int bit_id, unsigned long data)
static int rtl818x_init_rx_ring(struct net80211_device *dev)
static int rtl818x_init_tx_ring(struct net80211_device *dev)
static void rtl818x_poll(struct net80211_device *dev)
static void rtl818x_free_rx_ring(struct net80211_device *dev)
static void rtl818x_handle_tx(struct net80211_device *dev)
static int rtl818x_start(struct net80211_device *dev)
void rtl818x_write_phy(struct net80211_device *dev, u8 addr, u32 data)
static int rtl818x_config(struct net80211_device *dev, int changed)
static void rtl818x_free_tx_ring(struct net80211_device *dev)
static int rtl818x_init_hw(struct net80211_device *dev)
void rtl818x_set_anaparam(struct rtl818x_priv *priv, u32 anaparam)
static int rtl818x_tx(struct net80211_device *dev, struct io_buffer *iob)
static const u16 rtl818x_rates[]
static void rtl818x_set_hwaddr(struct net80211_device *dev, u8 *hwaddr)
static void rtl818x_handle_rx(struct net80211_device *dev)
static const u8 rtl818x_eeprom_bits[]
#define DIV_ROUND_UP(n, d)
static void rtl818x_irq(struct net80211_device *dev, int enable)
#define RTL818X_EEPROM_CMD_LOAD
#define RTL818X_EEPROM_CMD_CK
#define RTL818X_RF_DRIVERS
#define RTL818X_TX_CONF_HWVER_MASK
#define RTL818X_TX_CONF_R8185_D
#define RTL818X_RING_ALIGN
#define RTL818X_RX_CONF_RX_AUTORESETPHY
#define RTL818X_INT_RX_OK
@ RTL818X_TX_DESC_FLAG_CTS
@ RTL818X_TX_DESC_FLAG_NO_ENC
@ RTL818X_TX_DESC_FLAG_LS
@ RTL818X_TX_DESC_FLAG_TX_OK
@ RTL818X_TX_DESC_FLAG_FS
@ RTL818X_TX_DESC_FLAG_OWN
@ RTL818X_TX_DESC_FLAG_DMA
#define RTL818X_EEPROM_CMD_CS
#define RTL818X_CW_CONF_PERPACKET_RETRY_SHIFT
#define RTL818X_CW_CONF_PERPACKET_CW_SHIFT
#define RTL818X_TX_CONF_R8180_F
#define RTL818X_TX_AGC_CTL_PERPACKET_GAIN_SHIFT
#define RTL818X_EEPROM_CMD_NORMAL
#define RTL818X_TX_CONF_NO_ICV
#define RTL818X_CONFIG4_VCOOFF
#define RTL818X_EEPROM_CMD_PROGRAM
#define RTL818X_TX_AGC_CTL_PERPACKET_ANTSEL_SHIFT
#define RTL818X_MSR_NO_LINK
#define RTL818X_EEPROM_CMD_WRITE
static void rtl818x_iowrite8(struct rtl818x_priv *priv __unused, u8 *addr, u8 val)
#define RTL818X_RX_CONF_MGMT
#define RTL818X_TX_RING_SIZE
#define RTL818X_TX_CONF_R8180_ABCD
#define RTL818X_INT_RX_ERR
#define RF_PARAM_CARRIERSENSE1
#define RTL818X_MAX_RETRIES
#define RTL818X_RX_CONF_CSDM2
#define RTL818X_RX_CONF_DATA
@ RTL818X_RX_DESC_FLAG_FOF
@ RTL818X_RX_DESC_FLAG_RX_ERR
@ RTL818X_RX_DESC_FLAG_OWN
@ RTL818X_RX_DESC_FLAG_EOR
@ RTL818X_RX_DESC_FLAG_DMA_FAIL
@ RTL818X_RX_DESC_FLAG_CRC32_ERR
#define RTL818X_RX_CONF_BROADCAST
#define RTL818X_RX_CONF_NICMAC
#define RTL818X_MSR_INFRA
#define RTL818X_INT_TXN_OK
static u8 rtl818x_ioread8(struct rtl818x_priv *priv __unused, u8 *addr)
#define RTL818X_CMD_RESET
#define RTL818X_EEPROM_CMD_READ
static void rtl818x_iowrite16(struct rtl818x_priv *priv __unused, u16 *addr, u16 val)
static void rtl818x_iowrite32(struct rtl818x_priv *priv __unused, u32 *addr, u32 val)
#define RTL818X_TX_AGC_CTL_FEEDBACK_ANT
static u16 rtl818x_ioread16(struct rtl818x_priv *priv __unused, u16 *addr)
#define RTL818X_RX_CONF_CSDM1
#define RTL818X_TX_CONF_HW_SEQNUM
#define RF_PARAM_CARRIERSENSE2
#define RTL818X_TX_CONF_R8185_ABC
#define RTL818X_RX_RING_SIZE
#define RTL818X_INT_TXN_ERR
#define RTL818X_RX_CONF_ONLYERLPKT
#define RTL818X_EEPROM_CMD_CONFIG
#define RTL818X_CMD_RX_ENABLE
static u32 rtl818x_ioread32(struct rtl818x_priv *priv __unused, u32 *addr)
#define RTL818X_CONFIG3_ANAPARAM_WRITE
#define RTL818X_TX_CONF_PROBE_DTS
#define RTL818X_CMD_TX_ENABLE
#define RTL818X_TX_CONF_SAT_HWPLCP
#define SPI_MODE_THREEWIRE
Threewire-compatible mode.
void init_spi_bit_basher(struct spi_bit_basher *spibit)
Initialise SPI bit-bashing interface.
@ SPI_BIT_MOSI
Master Out Slave In.
@ SPI_BIT_MISO
Master In Slave Out.
@ SPI_BIT_SCLK
Serial clock.
#define SPI_BIT_SS(slave)
Determine bit index for a particular slave.
#define container_of(ptr, type, field)
Get containing structure.
void * data
Start of data.
Operations that must be implemented by an 802.11 driver.
Structure encapsulating the complete state of an 802.11 device.
struct net_device * netdev
The net_device that wraps us.
u16 rates[NET80211_MAX_RATES]
A list of all possible TX rates we might use.
struct net80211_channel channels[NET80211_MAX_CHANNELS]
A list of all possible channels we might use.
void * priv
Driver private data.
u8 rtscts_rate
The rate to use for RTS/CTS transmissions.
u16 state
State of our association to the network.
u8 channel
The channel currently in use, as an index into the channels array.
int phy_flags
Physical layer options.
u8 bssid[ETH_ALEN]
MAC address of the access point most recently associated.
u8 rate
The rate currently in use, as an index into the rates array.
Information on the capabilities of an 802.11 hardware device.
int modes
A bitwise OR of the 802.11x modes supported by this device.
enum net80211_hw_info::@277203366166200071173154201003141076360026365126 flags
A set of flags indicating peculiarities of this device.
int nr_rates[NET80211_NR_BANDS]
Number of supported rates, indexed by band.
int bands
A bitwise OR of the bands on which this device can communicate.
unsigned channel_change_time
Estimate of the time required to change channels, in microseconds.
u8 hwaddr[ETH_ALEN]
Default hardware MAC address.
unsigned signal_max
Maximum signal in arbitrary cases.
enum net80211_hw_info::@160150106134320172247032061203111226300065160315 signal_type
Signal strength information that can be provided by the device.
u16 rates[NET80211_NR_BANDS][NET80211_MAX_RATES]
List of transmission rates supported by the card, indexed by band.
char name[NETDEV_NAME_LEN]
Name of this network device.
struct device * dev
Underlying hardware device.
uint8_t ll_addr[MAX_LL_ADDR_LEN]
Link-layer address.
unsigned long ioaddr
I/O address.
struct device dev
Generic device.
struct spi_bit_basher spibit
struct bit_basher basher
Bit-bashing interface.
#define for_each_table_entry(pointer, table)
Iterate through all entries within a linker table.
Three-wire serial interface.
void mdelay(unsigned long msecs)
Delay for a fixed number of milliseconds.
void udelay(unsigned long usecs)
Delay for a fixed number of microseconds.
static struct tlan_private * priv