linux/drivers/net/wireless/zydas/zd1211rw/zd_chip.c

// SPDX-License-Identifier: GPL-2.0-or-later
/* ZD1211 USB-WLAN driver for Linux
 *
 * Copyright (C) 2005-2007 Ulrich Kunitz <[email protected]>
 * Copyright (C) 2006-2007 Daniel Drake <[email protected]>
 */

/* This file implements all the hardware specific functions for the ZD1211
 * and ZD1211B chips. Support for the ZD1211B was possible after Timothy
 * Legge sent me a ZD1211B device. Thank you Tim. -- Uli
 */

#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/slab.h>

#include "zd_def.h"
#include "zd_chip.h"
#include "zd_mac.h"
#include "zd_rf.h"

void zd_chip_init(struct zd_chip *chip,
	         struct ieee80211_hw *hw,
		 struct usb_interface *intf)
{}

void zd_chip_clear(struct zd_chip *chip)
{}

static int scnprint_mac_oui(struct zd_chip *chip, char *buffer, size_t size)
{}

/* Prints an identifier line, which will support debugging. */
static int scnprint_id(struct zd_chip *chip, char *buffer, size_t size)
{}

static void print_id(struct zd_chip *chip)
{}

static zd_addr_t inc_addr(zd_addr_t addr)
{}

/* Read a variable number of 32-bit values. Parameter count is not allowed to
 * exceed USB_MAX_IOREAD32_COUNT.
 */
int zd_ioread32v_locked(struct zd_chip *chip, u32 *values, const zd_addr_t *addr,
		 unsigned int count)
{}

static int _zd_iowrite32v_async_locked(struct zd_chip *chip,
				       const struct zd_ioreq32 *ioreqs,
				       unsigned int count)
{}

int _zd_iowrite32v_locked(struct zd_chip *chip, const struct zd_ioreq32 *ioreqs,
			  unsigned int count)
{}

int zd_iowrite16a_locked(struct zd_chip *chip,
                  const struct zd_ioreq16 *ioreqs, unsigned int count)
{}

/* Writes a variable number of 32 bit registers. The functions will split
 * that in several USB requests. A split can be forced by inserting an IO
 * request with an zero address field.
 */
int zd_iowrite32a_locked(struct zd_chip *chip,
	          const struct zd_ioreq32 *ioreqs, unsigned int count)
{}

int zd_ioread16(struct zd_chip *chip, zd_addr_t addr, u16 *value)
{}

int zd_ioread32(struct zd_chip *chip, zd_addr_t addr, u32 *value)
{}

int zd_iowrite16(struct zd_chip *chip, zd_addr_t addr, u16 value)
{}

int zd_iowrite32(struct zd_chip *chip, zd_addr_t addr, u32 value)
{}

int zd_ioread32v(struct zd_chip *chip, const zd_addr_t *addresses,
	          u32 *values, unsigned int count)
{}

int zd_iowrite32a(struct zd_chip *chip, const struct zd_ioreq32 *ioreqs,
	          unsigned int count)
{}

static int read_pod(struct zd_chip *chip, u8 *rf_type)
{}

static int zd_write_mac_addr_common(struct zd_chip *chip, const u8 *mac_addr,
				    const struct zd_ioreq32 *in_reqs,
				    const char *type)
{}

/* MAC address: if custom mac addresses are to be used CR_MAC_ADDR_P1 and
 *              CR_MAC_ADDR_P2 must be overwritten
 */
int zd_write_mac_addr(struct zd_chip *chip, const u8 *mac_addr)
{}

int zd_write_bssid(struct zd_chip *chip, const u8 *bssid)
{}

int zd_read_regdomain(struct zd_chip *chip, u8 *regdomain)
{}

static int read_values(struct zd_chip *chip, u8 *values, size_t count,
	               zd_addr_t e2p_addr, u32 guard)
{}

static int read_pwr_cal_values(struct zd_chip *chip)
{}

static int read_pwr_int_values(struct zd_chip *chip)
{}

static int read_ofdm_cal_values(struct zd_chip *chip)
{}

static int read_cal_int_tables(struct zd_chip *chip)
{}

/* phy means physical registers */
int zd_chip_lock_phy_regs(struct zd_chip *chip)
{}

int zd_chip_unlock_phy_regs(struct zd_chip *chip)
{}

/* ZD_CR157 can be optionally patched by the EEPROM for original ZD1211 */
static int patch_cr157(struct zd_chip *chip)
{}

/*
 * 6M band edge can be optionally overwritten for certain RF's
 * Vendor driver says: for FCC regulation, enabled per HWFeature 6M band edge
 * bit (for AL2230, AL2230S)
 */
static int patch_6m_band_edge(struct zd_chip *chip, u8 channel)
{}

/* Generic implementation of 6M band edge patching, used by most RFs via
 * zd_rf_generic_patch_6m() */
int zd_chip_generic_patch_6m_band(struct zd_chip *chip, int channel)
{}

static int zd1211_hw_reset_phy(struct zd_chip *chip)
{}

static int zd1211b_hw_reset_phy(struct zd_chip *chip)
{}

static int hw_reset_phy(struct zd_chip *chip)
{}

static int zd1211_hw_init_hmac(struct zd_chip *chip)
{}

static int zd1211b_hw_init_hmac(struct zd_chip *chip)
{}

static int hw_init_hmac(struct zd_chip *chip)
{}

struct aw_pt_bi {};

static int get_aw_pt_bi(struct zd_chip *chip, struct aw_pt_bi *s)
{}

static int set_aw_pt_bi(struct zd_chip *chip, struct aw_pt_bi *s)
{}


static int set_beacon_interval(struct zd_chip *chip, u16 interval,
			       u8 dtim_period, int type)
{}

int zd_set_beacon_interval(struct zd_chip *chip, u16 interval, u8 dtim_period,
			   int type)
{}

static int hw_init(struct zd_chip *chip)
{}

static zd_addr_t fw_reg_addr(struct zd_chip *chip, u16 offset)
{}

#ifdef DEBUG
static int dump_cr(struct zd_chip *chip, const zd_addr_t addr,
	           const char *addr_string)
{}

static int test_init(struct zd_chip *chip)
{}

static void dump_fw_registers(struct zd_chip *chip)
{}
#endif /* DEBUG */

static int print_fw_version(struct zd_chip *chip)
{}

static int set_mandatory_rates(struct zd_chip *chip, int gmode)
{}

int zd_chip_set_rts_cts_rate_locked(struct zd_chip *chip,
				    int preamble)
{}

int zd_chip_enable_hwint(struct zd_chip *chip)
{}

static int disable_hwint(struct zd_chip *chip)
{}

int zd_chip_disable_hwint(struct zd_chip *chip)
{}

static int read_fw_regs_offset(struct zd_chip *chip)
{}

/* Read mac address using pre-firmware interface */
int zd_chip_read_mac_addr_fw(struct zd_chip *chip, u8 *addr)
{}

int zd_chip_init_hw(struct zd_chip *chip)
{}

static int update_pwr_int(struct zd_chip *chip, u8 channel)
{}

static int update_pwr_cal(struct zd_chip *chip, u8 channel)
{}

static int update_ofdm_cal(struct zd_chip *chip, u8 channel)
{}

static int update_channel_integration_and_calibration(struct zd_chip *chip,
	                                              u8 channel)
{}

/* The CCK baseband gain can be optionally patched by the EEPROM */
static int patch_cck_gain(struct zd_chip *chip)
{}

int zd_chip_set_channel(struct zd_chip *chip, u8 channel)
{}

u8 zd_chip_get_channel(struct zd_chip *chip)
{}

int zd_chip_control_leds(struct zd_chip *chip, enum led_status status)
{}

int zd_chip_set_basic_rates(struct zd_chip *chip, u16 cr_rates)
{}

static inline u8 zd_rate_from_ofdm_plcp_header(const void *rx_frame)
{}

/**
 * zd_rx_rate - report zd-rate
 * @rx_frame: received frame
 * @status: rx_status as given by the device
 *
 * This function converts the rate as encoded in the received packet to the
 * zd-rate, we are using on other places in the driver.
 */
u8 zd_rx_rate(const void *rx_frame, const struct rx_status *status)
{}

int zd_chip_switch_radio_on(struct zd_chip *chip)
{}

int zd_chip_switch_radio_off(struct zd_chip *chip)
{}

int zd_chip_enable_int(struct zd_chip *chip)
{}

void zd_chip_disable_int(struct zd_chip *chip)
{}

int zd_chip_enable_rxtx(struct zd_chip *chip)
{}

void zd_chip_disable_rxtx(struct zd_chip *chip)
{}

int zd_rfwritev_locked(struct zd_chip *chip,
	               const u32* values, unsigned int count, u8 bits)
{}

/*
 * We can optionally program the RF directly through CR regs, if supported by
 * the hardware. This is much faster than the older method.
 */
int zd_rfwrite_cr_locked(struct zd_chip *chip, u32 value)
{}

int zd_rfwritev_cr_locked(struct zd_chip *chip,
	                  const u32 *values, unsigned int count)
{}

int zd_chip_set_multicast_hash(struct zd_chip *chip,
	                       struct zd_mc_hash *hash)
{}

u64 zd_chip_get_tsf(struct zd_chip *chip)
{}