linux/drivers/net/ieee802154/cc2520.c

// SPDX-License-Identifier: GPL-2.0-or-later
/* Driver for TI CC2520 802.15.4 Wireless-PAN Networking controller
 *
 * Copyright (C) 2014 Varka Bhadram <[email protected]>
 *		      Md.Jamal Mohiuddin <[email protected]>
 *		      P Sowjanya <[email protected]>
 */
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/gpio/consumer.h>
#include <linux/delay.h>
#include <linux/spi/spi.h>
#include <linux/property.h>
#include <linux/workqueue.h>
#include <linux/interrupt.h>
#include <linux/skbuff.h>
#include <linux/ieee802154.h>
#include <linux/crc-ccitt.h>
#include <linux/unaligned.h>

#include <net/mac802154.h>
#include <net/cfg802154.h>

#define SPI_COMMAND_BUFFER
#define HIGH
#define LOW
#define STATE_IDLE
#define RSSI_VALID
#define RSSI_OFFSET

#define CC2520_RAM_SIZE
#define CC2520_FIFO_SIZE

#define CC2520RAM_TXFIFO
#define CC2520RAM_RXFIFO
#define CC2520RAM_IEEEADDR
#define CC2520RAM_PANID
#define CC2520RAM_SHORTADDR

#define CC2520_FREG_MASK

/* status byte values */
#define CC2520_STATUS_XOSC32M_STABLE
#define CC2520_STATUS_RSSI_VALID
#define CC2520_STATUS_TX_UNDERFLOW

/* IEEE-802.15.4 defined constants (2.4 GHz logical channels) */
#define CC2520_MINCHANNEL
#define CC2520_MAXCHANNEL
#define CC2520_CHANNEL_SPACING

/* command strobes */
#define CC2520_CMD_SNOP
#define CC2520_CMD_IBUFLD
#define CC2520_CMD_SIBUFEX
#define CC2520_CMD_SSAMPLECCA
#define CC2520_CMD_SRES
#define CC2520_CMD_MEMORY_MASK
#define CC2520_CMD_MEMORY_READ
#define CC2520_CMD_MEMORY_WRITE
#define CC2520_CMD_RXBUF
#define CC2520_CMD_RXBUFCP
#define CC2520_CMD_RXBUFMOV
#define CC2520_CMD_TXBUF
#define CC2520_CMD_TXBUFCP
#define CC2520_CMD_RANDOM
#define CC2520_CMD_SXOSCON
#define CC2520_CMD_STXCAL
#define CC2520_CMD_SRXON
#define CC2520_CMD_STXON
#define CC2520_CMD_STXONCCA
#define CC2520_CMD_SRFOFF
#define CC2520_CMD_SXOSCOFF
#define CC2520_CMD_SFLUSHRX
#define CC2520_CMD_SFLUSHTX
#define CC2520_CMD_SACK
#define CC2520_CMD_SACKPEND
#define CC2520_CMD_SNACK
#define CC2520_CMD_SRXMASKBITSET
#define CC2520_CMD_SRXMASKBITCLR
#define CC2520_CMD_RXMASKAND
#define CC2520_CMD_RXMASKOR
#define CC2520_CMD_MEMCP
#define CC2520_CMD_MEMCPR
#define CC2520_CMD_MEMXCP
#define CC2520_CMD_MEMXWR
#define CC2520_CMD_BCLR
#define CC2520_CMD_BSET
#define CC2520_CMD_CTR_UCTR
#define CC2520_CMD_CBCMAC
#define CC2520_CMD_UCBCMAC
#define CC2520_CMD_CCM
#define CC2520_CMD_UCCM
#define CC2520_CMD_ECB
#define CC2520_CMD_ECBO
#define CC2520_CMD_ECBX
#define CC2520_CMD_INC
#define CC2520_CMD_ABORT
#define CC2520_CMD_REGISTER_READ
#define CC2520_CMD_REGISTER_WRITE

/* status registers */
#define CC2520_CHIPID
#define CC2520_VERSION
#define CC2520_EXTCLOCK
#define CC2520_MDMCTRL0
#define CC2520_MDMCTRL1
#define CC2520_FREQEST
#define CC2520_RXCTRL
#define CC2520_FSCTRL
#define CC2520_FSCAL0
#define CC2520_FSCAL1
#define CC2520_FSCAL2
#define CC2520_FSCAL3
#define CC2520_AGCCTRL0
#define CC2520_AGCCTRL1
#define CC2520_AGCCTRL2
#define CC2520_AGCCTRL3
#define CC2520_ADCTEST0
#define CC2520_ADCTEST1
#define CC2520_ADCTEST2
#define CC2520_MDMTEST0
#define CC2520_MDMTEST1
#define CC2520_DACTEST0
#define CC2520_DACTEST1
#define CC2520_ATEST
#define CC2520_DACTEST2
#define CC2520_PTEST0
#define CC2520_PTEST1
#define CC2520_RESERVED
#define CC2520_DPUBIST
#define CC2520_ACTBIST
#define CC2520_RAMBIST

/* frame registers */
#define CC2520_FRMFILT0
#define CC2520_FRMFILT1
#define CC2520_SRCMATCH
#define CC2520_SRCSHORTEN0
#define CC2520_SRCSHORTEN1
#define CC2520_SRCSHORTEN2
#define CC2520_SRCEXTEN0
#define CC2520_SRCEXTEN1
#define CC2520_SRCEXTEN2
#define CC2520_FRMCTRL0
#define CC2520_FRMCTRL1
#define CC2520_RXENABLE0
#define CC2520_RXENABLE1
#define CC2520_EXCFLAG0
#define CC2520_EXCFLAG1
#define CC2520_EXCFLAG2
#define CC2520_EXCMASKA0
#define CC2520_EXCMASKA1
#define CC2520_EXCMASKA2
#define CC2520_EXCMASKB0
#define CC2520_EXCMASKB1
#define CC2520_EXCMASKB2
#define CC2520_EXCBINDX0
#define CC2520_EXCBINDX1
#define CC2520_EXCBINDY0
#define CC2520_EXCBINDY1
#define CC2520_GPIOCTRL0
#define CC2520_GPIOCTRL1
#define CC2520_GPIOCTRL2
#define CC2520_GPIOCTRL3
#define CC2520_GPIOCTRL4
#define CC2520_GPIOCTRL5
#define CC2520_GPIOPOLARITY
#define CC2520_GPIOCTRL
#define CC2520_DPUCON
#define CC2520_DPUSTAT
#define CC2520_FREQCTRL
#define CC2520_FREQTUNE
#define CC2520_TXPOWER
#define CC2520_TXCTRL
#define CC2520_FSMSTAT0
#define CC2520_FSMSTAT1
#define CC2520_FIFOPCTRL
#define CC2520_FSMCTRL
#define CC2520_CCACTRL0
#define CC2520_CCACTRL1
#define CC2520_RSSI
#define CC2520_RSSISTAT
#define CC2520_RXFIRST
#define CC2520_RXFIFOCNT
#define CC2520_TXFIFOCNT

/* CC2520_FRMFILT0 */
#define FRMFILT0_FRAME_FILTER_EN
#define FRMFILT0_PAN_COORDINATOR

/* CC2520_FRMCTRL0 */
#define FRMCTRL0_AUTOACK
#define FRMCTRL0_AUTOCRC

/* CC2520_FRMCTRL1 */
#define FRMCTRL1_SET_RXENMASK_ON_TX
#define FRMCTRL1_IGNORE_TX_UNDERF

/* Driver private information */
struct cc2520_private {};

/* Generic Functions */
static int
cc2520_cmd_strobe(struct cc2520_private *priv, u8 cmd)
{}

static int
cc2520_get_status(struct cc2520_private *priv, u8 *status)
{}

static int
cc2520_write_register(struct cc2520_private *priv, u8 reg, u8 value)
{}

static int
cc2520_write_ram(struct cc2520_private *priv, u16 reg, u8 len, u8 *data)
{}

static int
cc2520_read_register(struct cc2520_private *priv, u8 reg, u8 *data)
{}

static int
cc2520_write_txfifo(struct cc2520_private *priv, u8 pkt_len, u8 *data, u8 len)
{}

static int
cc2520_read_rxfifo(struct cc2520_private *priv, u8 *data, u8 len)
{}

static int cc2520_start(struct ieee802154_hw *hw)
{}

static void cc2520_stop(struct ieee802154_hw *hw)
{}

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

static int cc2520_rx(struct cc2520_private *priv)
{}

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

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

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

static inline int cc2520_set_tx_power(struct cc2520_private *priv, s32 mbm)
{}

static inline int cc2520_cc2591_set_tx_power(struct cc2520_private *priv,
					     s32 mbm)
{}

#define CC2520_MAX_TX_POWERS
static const s32 cc2520_powers[CC2520_MAX_TX_POWERS + 1] =;

#define CC2520_CC2591_MAX_TX_POWERS
static const s32 cc2520_cc2591_powers[CC2520_CC2591_MAX_TX_POWERS + 1] =;

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

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

static const struct ieee802154_ops cc2520_ops =;

static int cc2520_register(struct cc2520_private *priv)
{}

static void cc2520_fifop_irqwork(struct work_struct *work)
{}

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

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

static int cc2520_hw_init(struct cc2520_private *priv)
{}

static int cc2520_probe(struct spi_device *spi)
{}

static void cc2520_remove(struct spi_device *spi)
{}

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

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

/* SPI driver structure */
static struct spi_driver cc2520_driver =;
module_spi_driver();

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