linux/drivers/net/ieee802154/adf7242.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Analog Devices ADF7242 Low-Power IEEE 802.15.4 Transceiver
 *
 * Copyright 2009-2017 Analog Devices Inc.
 *
 * https://www.analog.com/ADF7242
 */

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/mutex.h>
#include <linux/workqueue.h>
#include <linux/spinlock.h>
#include <linux/firmware.h>
#include <linux/spi/spi.h>
#include <linux/skbuff.h>
#include <linux/of.h>
#include <linux/irq.h>
#include <linux/debugfs.h>
#include <linux/bitops.h>
#include <linux/ieee802154.h>
#include <net/mac802154.h>
#include <net/cfg802154.h>

#define FIRMWARE
#define MAX_POLL_LOOPS

/* All Registers */

#define REG_EXT_CTRL
#define REG_TX_FSK_TEST
#define REG_CCA1
#define REG_CCA2
#define REG_BUFFERCFG
#define REG_PKT_CFG
#define REG_DELAYCFG0
#define REG_DELAYCFG1
#define REG_DELAYCFG2
#define REG_SYNC_WORD0
#define REG_SYNC_WORD1
#define REG_SYNC_WORD2
#define REG_SYNC_CONFIG
#define REG_RC_CFG
#define REG_RC_VAR44
#define REG_CH_FREQ0
#define REG_CH_FREQ1
#define REG_CH_FREQ2
#define REG_TX_FD
#define REG_DM_CFG0
#define REG_TX_M
#define REG_RX_M
#define REG_RRB
#define REG_LRB
#define REG_DR0
#define REG_DR1
#define REG_PRAMPG
#define REG_TXPB
#define REG_RXPB
#define REG_TMR_CFG0
#define REG_TMR_CFG1
#define REG_TMR_RLD0
#define REG_TMR_RLD1
#define REG_TMR_CTRL
#define REG_PD_AUX
#define REG_GP_CFG
#define REG_GP_OUT
#define REG_GP_IN
#define REG_SYNT
#define REG_CAL_CFG
#define REG_PA_BIAS
#define REG_SYNT_CAL
#define REG_IIRF_CFG
#define REG_CDR_CFG
#define REG_DM_CFG1
#define REG_AGCSTAT
#define REG_RXCAL0
#define REG_RXCAL1
#define REG_RXFE_CFG
#define REG_PA_RR
#define REG_PA_CFG
#define REG_EXTPA_CFG
#define REG_EXTPA_MSC
#define REG_ADC_RBK
#define REG_AGC_CFG1
#define REG_AGC_MAX
#define REG_AGC_CFG2
#define REG_AGC_CFG3
#define REG_AGC_CFG4
#define REG_AGC_CFG5
#define REG_AGC_CFG6
#define REG_OCL_CFG1
#define REG_IRQ1_EN0
#define REG_IRQ1_EN1
#define REG_IRQ2_EN0
#define REG_IRQ2_EN1
#define REG_IRQ1_SRC0
#define REG_IRQ1_SRC1
#define REG_OCL_BW0
#define REG_OCL_BW1
#define REG_OCL_BW2
#define REG_OCL_BW3
#define REG_OCL_BW4
#define REG_OCL_BWS
#define REG_OCL_CFG13
#define REG_GP_DRV
#define REG_BM_CFG
#define REG_SFD_15_4
#define REG_AFC_CFG
#define REG_AFC_KI_KP
#define REG_AFC_RANGE
#define REG_AFC_READ

/* REG_EXTPA_MSC */
#define PA_PWR(x)
#define EXTPA_BIAS_SRC
#define EXTPA_BIAS_MODE(x)

/* REG_PA_CFG */
#define PA_BRIDGE_DBIAS(x)
#define PA_DBIAS_HIGH_POWER
#define PA_DBIAS_LOW_POWER

/* REG_PA_BIAS */
#define PA_BIAS_CTRL(x)
#define REG_PA_BIAS_DFL
#define PA_BIAS_HIGH_POWER
#define PA_BIAS_LOW_POWER

#define REG_PAN_ID0
#define REG_PAN_ID1
#define REG_SHORT_ADDR_0
#define REG_SHORT_ADDR_1
#define REG_IEEE_ADDR_0
#define REG_IEEE_ADDR_1
#define REG_IEEE_ADDR_2
#define REG_IEEE_ADDR_3
#define REG_IEEE_ADDR_4
#define REG_IEEE_ADDR_5
#define REG_IEEE_ADDR_6
#define REG_IEEE_ADDR_7
#define REG_FFILT_CFG
#define REG_AUTO_CFG
#define REG_AUTO_TX1
#define REG_AUTO_TX2
#define REG_AUTO_STATUS

/* REG_FFILT_CFG */
#define ACCEPT_BEACON_FRAMES
#define ACCEPT_DATA_FRAMES
#define ACCEPT_ACK_FRAMES
#define ACCEPT_MACCMD_FRAMES
#define ACCEPT_RESERVED_FRAMES
#define ACCEPT_ALL_ADDRESS

/* REG_AUTO_CFG */
#define AUTO_ACK_FRAMEPEND
#define IS_PANCOORD
#define RX_AUTO_ACK_EN
#define CSMA_CA_RX_TURNAROUND

/* REG_AUTO_TX1 */
#define MAX_FRAME_RETRIES(x)
#define MAX_CCA_RETRIES(x)

/* REG_AUTO_TX2 */
#define CSMA_MAX_BE(x)
#define CSMA_MIN_BE(x)

#define CMD_SPI_NOP
#define CMD_SPI_PKT_WR
#define CMD_SPI_PKT_RD
#define CMD_SPI_MEM_WR(x)
#define CMD_SPI_MEM_RD(x)
#define CMD_SPI_MEMR_WR(x)
#define CMD_SPI_MEMR_RD(x)
#define CMD_SPI_PRAM_WR
#define CMD_SPI_PRAM_RD
#define CMD_RC_SLEEP
#define CMD_RC_IDLE
#define CMD_RC_PHY_RDY
#define CMD_RC_RX
#define CMD_RC_TX
#define CMD_RC_MEAS
#define CMD_RC_CCA
#define CMD_RC_CSMACA
#define CMD_RC_PC_RESET
#define CMD_RC_RESET
#define CMD_RC_PC_RESET_NO_WAIT

/* STATUS */

#define STAT_SPI_READY
#define STAT_IRQ_STATUS
#define STAT_RC_READY
#define STAT_CCA_RESULT
#define RC_STATUS_IDLE
#define RC_STATUS_MEAS
#define RC_STATUS_PHY_RDY
#define RC_STATUS_RX
#define RC_STATUS_TX
#define RC_STATUS_MASK

/* AUTO_STATUS */

#define SUCCESS
#define SUCCESS_DATPEND
#define FAILURE_CSMACA
#define FAILURE_NOACK
#define AUTO_STATUS_MASK

#define PRAM_PAGESIZE

/* IRQ1 */

#define IRQ_CCA_COMPLETE
#define IRQ_SFD_RX
#define IRQ_SFD_TX
#define IRQ_RX_PKT_RCVD
#define IRQ_TX_PKT_SENT
#define IRQ_FRAME_VALID
#define IRQ_ADDRESS_VALID
#define IRQ_CSMA_CA

#define AUTO_TX_TURNAROUND
#define ADDON_EN

#define FLAG_XMIT
#define FLAG_START

#define ADF7242_REPORT_CSMA_CA_STAT

struct adf7242_local {};

static int adf7242_soft_reset(struct adf7242_local *lp, int line);

static int adf7242_status(struct adf7242_local *lp, u8 *stat)
{}

static int adf7242_wait_status(struct adf7242_local *lp, unsigned int status,
			       unsigned int mask, int line)
{}

static int adf7242_wait_rc_ready(struct adf7242_local *lp, int line)
{}

static int adf7242_wait_spi_ready(struct adf7242_local *lp, int line)
{}

static int adf7242_write_fbuf(struct adf7242_local *lp, u8 *data, u8 len)
{}

static int adf7242_read_fbuf(struct adf7242_local *lp,
			     u8 *data, size_t len, bool packet_read)
{}

static int adf7242_read_reg(struct adf7242_local *lp, u16 addr, u8 *data)
{}

static int adf7242_write_reg(struct adf7242_local *lp, u16 addr, u8 data)
{}

static int adf7242_cmd(struct adf7242_local *lp, unsigned int cmd)
{}

static int adf7242_upload_firmware(struct adf7242_local *lp, u8 *data, u16 len)
{}

static int adf7242_verify_firmware(struct adf7242_local *lp,
				   const u8 *data, size_t len)
{}

static void adf7242_clear_irqstat(struct adf7242_local *lp)
{}

static int adf7242_cmd_rx(struct adf7242_local *lp)
{}

static void adf7242_rx_cal_work(struct work_struct *work)
{}

static int adf7242_set_txpower(struct ieee802154_hw *hw, int mbm)
{}

static int adf7242_set_csma_params(struct ieee802154_hw *hw, u8 min_be,
				   u8 max_be, u8 retries)
{}

static int adf7242_set_frame_retries(struct ieee802154_hw *hw, s8 retries)
{}

static int adf7242_ed(struct ieee802154_hw *hw, u8 *level)
{}

static int adf7242_start(struct ieee802154_hw *hw)
{}

static void adf7242_stop(struct ieee802154_hw *hw)
{}

static int adf7242_channel(struct ieee802154_hw *hw, u8 page, u8 channel)
{}

static int adf7242_set_hw_addr_filt(struct ieee802154_hw *hw,
				    struct ieee802154_hw_addr_filt *filt,
				    unsigned long changed)
{}

static int adf7242_set_promiscuous_mode(struct ieee802154_hw *hw, bool on)
{}

static int adf7242_set_cca_ed_level(struct ieee802154_hw *hw, s32 mbm)
{}

static int adf7242_xmit(struct ieee802154_hw *hw, struct sk_buff *skb)
{}

static int adf7242_rx(struct adf7242_local *lp)
{}

static const struct ieee802154_ops adf7242_ops =;

static void adf7242_debug(struct adf7242_local *lp, u8 irq1)
{}

static irqreturn_t adf7242_isr(int irq, void *data)
{}

static int adf7242_soft_reset(struct adf7242_local *lp, int line)
{}

static int adf7242_hw_init(struct adf7242_local *lp)
{}

static int adf7242_stats_show(struct seq_file *file, void *offset)
{}

static void adf7242_debugfs_init(struct adf7242_local *lp)
{}

static const s32 adf7242_powers[] =;

static const s32 adf7242_ed_levels[] =;

static int adf7242_probe(struct spi_device *spi)
{}

static void adf7242_remove(struct spi_device *spi)
{}

static const struct of_device_id adf7242_of_match[] =;
MODULE_DEVICE_TABLE(of, adf7242_of_match);

static const struct spi_device_id adf7242_device_id[] =;
MODULE_DEVICE_TABLE(spi, adf7242_device_id);

static struct spi_driver adf7242_driver =;

module_spi_driver();

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();

MODULE_FIRMWARE();