18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * AT86RF230/RF231 driver 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright (C) 2009-2012 Siemens AG 68c2ecf20Sopenharmony_ci * 78c2ecf20Sopenharmony_ci * Written by: 88c2ecf20Sopenharmony_ci * Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> 98c2ecf20Sopenharmony_ci * Alexander Smirnov <alex.bluesman.smirnov@gmail.com> 108c2ecf20Sopenharmony_ci */ 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ci#ifndef _AT86RF230_H 138c2ecf20Sopenharmony_ci#define _AT86RF230_H 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ci#define RG_TRX_STATUS (0x01) 168c2ecf20Sopenharmony_ci#define SR_TRX_STATUS 0x01, 0x1f, 0 178c2ecf20Sopenharmony_ci#define SR_RESERVED_01_3 0x01, 0x20, 5 188c2ecf20Sopenharmony_ci#define SR_CCA_STATUS 0x01, 0x40, 6 198c2ecf20Sopenharmony_ci#define SR_CCA_DONE 0x01, 0x80, 7 208c2ecf20Sopenharmony_ci#define RG_TRX_STATE (0x02) 218c2ecf20Sopenharmony_ci#define SR_TRX_CMD 0x02, 0x1f, 0 228c2ecf20Sopenharmony_ci#define SR_TRAC_STATUS 0x02, 0xe0, 5 238c2ecf20Sopenharmony_ci#define RG_TRX_CTRL_0 (0x03) 248c2ecf20Sopenharmony_ci#define SR_CLKM_CTRL 0x03, 0x07, 0 258c2ecf20Sopenharmony_ci#define SR_CLKM_SHA_SEL 0x03, 0x08, 3 268c2ecf20Sopenharmony_ci#define SR_PAD_IO_CLKM 0x03, 0x30, 4 278c2ecf20Sopenharmony_ci#define SR_PAD_IO 0x03, 0xc0, 6 288c2ecf20Sopenharmony_ci#define RG_TRX_CTRL_1 (0x04) 298c2ecf20Sopenharmony_ci#define SR_IRQ_POLARITY 0x04, 0x01, 0 308c2ecf20Sopenharmony_ci#define SR_IRQ_MASK_MODE 0x04, 0x02, 1 318c2ecf20Sopenharmony_ci#define SR_SPI_CMD_MODE 0x04, 0x0c, 2 328c2ecf20Sopenharmony_ci#define SR_RX_BL_CTRL 0x04, 0x10, 4 338c2ecf20Sopenharmony_ci#define SR_TX_AUTO_CRC_ON 0x04, 0x20, 5 348c2ecf20Sopenharmony_ci#define SR_IRQ_2_EXT_EN 0x04, 0x40, 6 358c2ecf20Sopenharmony_ci#define SR_PA_EXT_EN 0x04, 0x80, 7 368c2ecf20Sopenharmony_ci#define RG_PHY_TX_PWR (0x05) 378c2ecf20Sopenharmony_ci#define SR_TX_PWR_23X 0x05, 0x0f, 0 388c2ecf20Sopenharmony_ci#define SR_PA_LT_230 0x05, 0x30, 4 398c2ecf20Sopenharmony_ci#define SR_PA_BUF_LT_230 0x05, 0xc0, 6 408c2ecf20Sopenharmony_ci#define SR_TX_PWR_212 0x05, 0x1f, 0 418c2ecf20Sopenharmony_ci#define SR_GC_PA_212 0x05, 0x60, 5 428c2ecf20Sopenharmony_ci#define SR_PA_BOOST_LT_212 0x05, 0x80, 7 438c2ecf20Sopenharmony_ci#define RG_PHY_RSSI (0x06) 448c2ecf20Sopenharmony_ci#define SR_RSSI 0x06, 0x1f, 0 458c2ecf20Sopenharmony_ci#define SR_RND_VALUE 0x06, 0x60, 5 468c2ecf20Sopenharmony_ci#define SR_RX_CRC_VALID 0x06, 0x80, 7 478c2ecf20Sopenharmony_ci#define RG_PHY_ED_LEVEL (0x07) 488c2ecf20Sopenharmony_ci#define SR_ED_LEVEL 0x07, 0xff, 0 498c2ecf20Sopenharmony_ci#define RG_PHY_CC_CCA (0x08) 508c2ecf20Sopenharmony_ci#define SR_CHANNEL 0x08, 0x1f, 0 518c2ecf20Sopenharmony_ci#define SR_CCA_MODE 0x08, 0x60, 5 528c2ecf20Sopenharmony_ci#define SR_CCA_REQUEST 0x08, 0x80, 7 538c2ecf20Sopenharmony_ci#define RG_CCA_THRES (0x09) 548c2ecf20Sopenharmony_ci#define SR_CCA_ED_THRES 0x09, 0x0f, 0 558c2ecf20Sopenharmony_ci#define SR_RESERVED_09_1 0x09, 0xf0, 4 568c2ecf20Sopenharmony_ci#define RG_RX_CTRL (0x0a) 578c2ecf20Sopenharmony_ci#define SR_PDT_THRES 0x0a, 0x0f, 0 588c2ecf20Sopenharmony_ci#define SR_RESERVED_0a_1 0x0a, 0xf0, 4 598c2ecf20Sopenharmony_ci#define RG_SFD_VALUE (0x0b) 608c2ecf20Sopenharmony_ci#define SR_SFD_VALUE 0x0b, 0xff, 0 618c2ecf20Sopenharmony_ci#define RG_TRX_CTRL_2 (0x0c) 628c2ecf20Sopenharmony_ci#define SR_OQPSK_DATA_RATE 0x0c, 0x03, 0 638c2ecf20Sopenharmony_ci#define SR_SUB_MODE 0x0c, 0x04, 2 648c2ecf20Sopenharmony_ci#define SR_BPSK_QPSK 0x0c, 0x08, 3 658c2ecf20Sopenharmony_ci#define SR_OQPSK_SUB1_RC_EN 0x0c, 0x10, 4 668c2ecf20Sopenharmony_ci#define SR_RESERVED_0c_5 0x0c, 0x60, 5 678c2ecf20Sopenharmony_ci#define SR_RX_SAFE_MODE 0x0c, 0x80, 7 688c2ecf20Sopenharmony_ci#define RG_ANT_DIV (0x0d) 698c2ecf20Sopenharmony_ci#define SR_ANT_CTRL 0x0d, 0x03, 0 708c2ecf20Sopenharmony_ci#define SR_ANT_EXT_SW_EN 0x0d, 0x04, 2 718c2ecf20Sopenharmony_ci#define SR_ANT_DIV_EN 0x0d, 0x08, 3 728c2ecf20Sopenharmony_ci#define SR_RESERVED_0d_2 0x0d, 0x70, 4 738c2ecf20Sopenharmony_ci#define SR_ANT_SEL 0x0d, 0x80, 7 748c2ecf20Sopenharmony_ci#define RG_IRQ_MASK (0x0e) 758c2ecf20Sopenharmony_ci#define SR_IRQ_MASK 0x0e, 0xff, 0 768c2ecf20Sopenharmony_ci#define RG_IRQ_STATUS (0x0f) 778c2ecf20Sopenharmony_ci#define SR_IRQ_0_PLL_LOCK 0x0f, 0x01, 0 788c2ecf20Sopenharmony_ci#define SR_IRQ_1_PLL_UNLOCK 0x0f, 0x02, 1 798c2ecf20Sopenharmony_ci#define SR_IRQ_2_RX_START 0x0f, 0x04, 2 808c2ecf20Sopenharmony_ci#define SR_IRQ_3_TRX_END 0x0f, 0x08, 3 818c2ecf20Sopenharmony_ci#define SR_IRQ_4_CCA_ED_DONE 0x0f, 0x10, 4 828c2ecf20Sopenharmony_ci#define SR_IRQ_5_AMI 0x0f, 0x20, 5 838c2ecf20Sopenharmony_ci#define SR_IRQ_6_TRX_UR 0x0f, 0x40, 6 848c2ecf20Sopenharmony_ci#define SR_IRQ_7_BAT_LOW 0x0f, 0x80, 7 858c2ecf20Sopenharmony_ci#define RG_VREG_CTRL (0x10) 868c2ecf20Sopenharmony_ci#define SR_RESERVED_10_6 0x10, 0x03, 0 878c2ecf20Sopenharmony_ci#define SR_DVDD_OK 0x10, 0x04, 2 888c2ecf20Sopenharmony_ci#define SR_DVREG_EXT 0x10, 0x08, 3 898c2ecf20Sopenharmony_ci#define SR_RESERVED_10_3 0x10, 0x30, 4 908c2ecf20Sopenharmony_ci#define SR_AVDD_OK 0x10, 0x40, 6 918c2ecf20Sopenharmony_ci#define SR_AVREG_EXT 0x10, 0x80, 7 928c2ecf20Sopenharmony_ci#define RG_BATMON (0x11) 938c2ecf20Sopenharmony_ci#define SR_BATMON_VTH 0x11, 0x0f, 0 948c2ecf20Sopenharmony_ci#define SR_BATMON_HR 0x11, 0x10, 4 958c2ecf20Sopenharmony_ci#define SR_BATMON_OK 0x11, 0x20, 5 968c2ecf20Sopenharmony_ci#define SR_RESERVED_11_1 0x11, 0xc0, 6 978c2ecf20Sopenharmony_ci#define RG_XOSC_CTRL (0x12) 988c2ecf20Sopenharmony_ci#define SR_XTAL_TRIM 0x12, 0x0f, 0 998c2ecf20Sopenharmony_ci#define SR_XTAL_MODE 0x12, 0xf0, 4 1008c2ecf20Sopenharmony_ci#define RG_RX_SYN (0x15) 1018c2ecf20Sopenharmony_ci#define SR_RX_PDT_LEVEL 0x15, 0x0f, 0 1028c2ecf20Sopenharmony_ci#define SR_RESERVED_15_2 0x15, 0x70, 4 1038c2ecf20Sopenharmony_ci#define SR_RX_PDT_DIS 0x15, 0x80, 7 1048c2ecf20Sopenharmony_ci#define RG_XAH_CTRL_1 (0x17) 1058c2ecf20Sopenharmony_ci#define SR_RESERVED_17_8 0x17, 0x01, 0 1068c2ecf20Sopenharmony_ci#define SR_AACK_PROM_MODE 0x17, 0x02, 1 1078c2ecf20Sopenharmony_ci#define SR_AACK_ACK_TIME 0x17, 0x04, 2 1088c2ecf20Sopenharmony_ci#define SR_RESERVED_17_5 0x17, 0x08, 3 1098c2ecf20Sopenharmony_ci#define SR_AACK_UPLD_RES_FT 0x17, 0x10, 4 1108c2ecf20Sopenharmony_ci#define SR_AACK_FLTR_RES_FT 0x17, 0x20, 5 1118c2ecf20Sopenharmony_ci#define SR_CSMA_LBT_MODE 0x17, 0x40, 6 1128c2ecf20Sopenharmony_ci#define SR_RESERVED_17_1 0x17, 0x80, 7 1138c2ecf20Sopenharmony_ci#define RG_FTN_CTRL (0x18) 1148c2ecf20Sopenharmony_ci#define SR_RESERVED_18_2 0x18, 0x7f, 0 1158c2ecf20Sopenharmony_ci#define SR_FTN_START 0x18, 0x80, 7 1168c2ecf20Sopenharmony_ci#define RG_PLL_CF (0x1a) 1178c2ecf20Sopenharmony_ci#define SR_RESERVED_1a_2 0x1a, 0x7f, 0 1188c2ecf20Sopenharmony_ci#define SR_PLL_CF_START 0x1a, 0x80, 7 1198c2ecf20Sopenharmony_ci#define RG_PLL_DCU (0x1b) 1208c2ecf20Sopenharmony_ci#define SR_RESERVED_1b_3 0x1b, 0x3f, 0 1218c2ecf20Sopenharmony_ci#define SR_RESERVED_1b_2 0x1b, 0x40, 6 1228c2ecf20Sopenharmony_ci#define SR_PLL_DCU_START 0x1b, 0x80, 7 1238c2ecf20Sopenharmony_ci#define RG_PART_NUM (0x1c) 1248c2ecf20Sopenharmony_ci#define SR_PART_NUM 0x1c, 0xff, 0 1258c2ecf20Sopenharmony_ci#define RG_VERSION_NUM (0x1d) 1268c2ecf20Sopenharmony_ci#define SR_VERSION_NUM 0x1d, 0xff, 0 1278c2ecf20Sopenharmony_ci#define RG_MAN_ID_0 (0x1e) 1288c2ecf20Sopenharmony_ci#define SR_MAN_ID_0 0x1e, 0xff, 0 1298c2ecf20Sopenharmony_ci#define RG_MAN_ID_1 (0x1f) 1308c2ecf20Sopenharmony_ci#define SR_MAN_ID_1 0x1f, 0xff, 0 1318c2ecf20Sopenharmony_ci#define RG_SHORT_ADDR_0 (0x20) 1328c2ecf20Sopenharmony_ci#define SR_SHORT_ADDR_0 0x20, 0xff, 0 1338c2ecf20Sopenharmony_ci#define RG_SHORT_ADDR_1 (0x21) 1348c2ecf20Sopenharmony_ci#define SR_SHORT_ADDR_1 0x21, 0xff, 0 1358c2ecf20Sopenharmony_ci#define RG_PAN_ID_0 (0x22) 1368c2ecf20Sopenharmony_ci#define SR_PAN_ID_0 0x22, 0xff, 0 1378c2ecf20Sopenharmony_ci#define RG_PAN_ID_1 (0x23) 1388c2ecf20Sopenharmony_ci#define SR_PAN_ID_1 0x23, 0xff, 0 1398c2ecf20Sopenharmony_ci#define RG_IEEE_ADDR_0 (0x24) 1408c2ecf20Sopenharmony_ci#define SR_IEEE_ADDR_0 0x24, 0xff, 0 1418c2ecf20Sopenharmony_ci#define RG_IEEE_ADDR_1 (0x25) 1428c2ecf20Sopenharmony_ci#define SR_IEEE_ADDR_1 0x25, 0xff, 0 1438c2ecf20Sopenharmony_ci#define RG_IEEE_ADDR_2 (0x26) 1448c2ecf20Sopenharmony_ci#define SR_IEEE_ADDR_2 0x26, 0xff, 0 1458c2ecf20Sopenharmony_ci#define RG_IEEE_ADDR_3 (0x27) 1468c2ecf20Sopenharmony_ci#define SR_IEEE_ADDR_3 0x27, 0xff, 0 1478c2ecf20Sopenharmony_ci#define RG_IEEE_ADDR_4 (0x28) 1488c2ecf20Sopenharmony_ci#define SR_IEEE_ADDR_4 0x28, 0xff, 0 1498c2ecf20Sopenharmony_ci#define RG_IEEE_ADDR_5 (0x29) 1508c2ecf20Sopenharmony_ci#define SR_IEEE_ADDR_5 0x29, 0xff, 0 1518c2ecf20Sopenharmony_ci#define RG_IEEE_ADDR_6 (0x2a) 1528c2ecf20Sopenharmony_ci#define SR_IEEE_ADDR_6 0x2a, 0xff, 0 1538c2ecf20Sopenharmony_ci#define RG_IEEE_ADDR_7 (0x2b) 1548c2ecf20Sopenharmony_ci#define SR_IEEE_ADDR_7 0x2b, 0xff, 0 1558c2ecf20Sopenharmony_ci#define RG_XAH_CTRL_0 (0x2c) 1568c2ecf20Sopenharmony_ci#define SR_SLOTTED_OPERATION 0x2c, 0x01, 0 1578c2ecf20Sopenharmony_ci#define SR_MAX_CSMA_RETRIES 0x2c, 0x0e, 1 1588c2ecf20Sopenharmony_ci#define SR_MAX_FRAME_RETRIES 0x2c, 0xf0, 4 1598c2ecf20Sopenharmony_ci#define RG_CSMA_SEED_0 (0x2d) 1608c2ecf20Sopenharmony_ci#define SR_CSMA_SEED_0 0x2d, 0xff, 0 1618c2ecf20Sopenharmony_ci#define RG_CSMA_SEED_1 (0x2e) 1628c2ecf20Sopenharmony_ci#define SR_CSMA_SEED_1 0x2e, 0x07, 0 1638c2ecf20Sopenharmony_ci#define SR_AACK_I_AM_COORD 0x2e, 0x08, 3 1648c2ecf20Sopenharmony_ci#define SR_AACK_DIS_ACK 0x2e, 0x10, 4 1658c2ecf20Sopenharmony_ci#define SR_AACK_SET_PD 0x2e, 0x20, 5 1668c2ecf20Sopenharmony_ci#define SR_AACK_FVN_MODE 0x2e, 0xc0, 6 1678c2ecf20Sopenharmony_ci#define RG_CSMA_BE (0x2f) 1688c2ecf20Sopenharmony_ci#define SR_MIN_BE 0x2f, 0x0f, 0 1698c2ecf20Sopenharmony_ci#define SR_MAX_BE 0x2f, 0xf0, 4 1708c2ecf20Sopenharmony_ci 1718c2ecf20Sopenharmony_ci#define CMD_REG 0x80 1728c2ecf20Sopenharmony_ci#define CMD_REG_MASK 0x3f 1738c2ecf20Sopenharmony_ci#define CMD_WRITE 0x40 1748c2ecf20Sopenharmony_ci#define CMD_FB 0x20 1758c2ecf20Sopenharmony_ci 1768c2ecf20Sopenharmony_ci#define IRQ_BAT_LOW BIT(7) 1778c2ecf20Sopenharmony_ci#define IRQ_TRX_UR BIT(6) 1788c2ecf20Sopenharmony_ci#define IRQ_AMI BIT(5) 1798c2ecf20Sopenharmony_ci#define IRQ_CCA_ED BIT(4) 1808c2ecf20Sopenharmony_ci#define IRQ_TRX_END BIT(3) 1818c2ecf20Sopenharmony_ci#define IRQ_RX_START BIT(2) 1828c2ecf20Sopenharmony_ci#define IRQ_PLL_UNL BIT(1) 1838c2ecf20Sopenharmony_ci#define IRQ_PLL_LOCK BIT(0) 1848c2ecf20Sopenharmony_ci 1858c2ecf20Sopenharmony_ci#define IRQ_ACTIVE_HIGH 0 1868c2ecf20Sopenharmony_ci#define IRQ_ACTIVE_LOW 1 1878c2ecf20Sopenharmony_ci 1888c2ecf20Sopenharmony_ci#define STATE_P_ON 0x00 /* BUSY */ 1898c2ecf20Sopenharmony_ci#define STATE_BUSY_RX 0x01 1908c2ecf20Sopenharmony_ci#define STATE_BUSY_TX 0x02 1918c2ecf20Sopenharmony_ci#define STATE_FORCE_TRX_OFF 0x03 1928c2ecf20Sopenharmony_ci#define STATE_FORCE_TX_ON 0x04 /* IDLE */ 1938c2ecf20Sopenharmony_ci/* 0x05 */ /* INVALID_PARAMETER */ 1948c2ecf20Sopenharmony_ci#define STATE_RX_ON 0x06 1958c2ecf20Sopenharmony_ci/* 0x07 */ /* SUCCESS */ 1968c2ecf20Sopenharmony_ci#define STATE_TRX_OFF 0x08 1978c2ecf20Sopenharmony_ci#define STATE_TX_ON 0x09 1988c2ecf20Sopenharmony_ci/* 0x0a - 0x0e */ /* 0x0a - UNSUPPORTED_ATTRIBUTE */ 1998c2ecf20Sopenharmony_ci#define STATE_SLEEP 0x0F 2008c2ecf20Sopenharmony_ci#define STATE_PREP_DEEP_SLEEP 0x10 2018c2ecf20Sopenharmony_ci#define STATE_BUSY_RX_AACK 0x11 2028c2ecf20Sopenharmony_ci#define STATE_BUSY_TX_ARET 0x12 2038c2ecf20Sopenharmony_ci#define STATE_RX_AACK_ON 0x16 2048c2ecf20Sopenharmony_ci#define STATE_TX_ARET_ON 0x19 2058c2ecf20Sopenharmony_ci#define STATE_RX_ON_NOCLK 0x1C 2068c2ecf20Sopenharmony_ci#define STATE_RX_AACK_ON_NOCLK 0x1D 2078c2ecf20Sopenharmony_ci#define STATE_BUSY_RX_AACK_NOCLK 0x1E 2088c2ecf20Sopenharmony_ci#define STATE_TRANSITION_IN_PROGRESS 0x1F 2098c2ecf20Sopenharmony_ci 2108c2ecf20Sopenharmony_ci#define TRX_STATE_MASK (0x1F) 2118c2ecf20Sopenharmony_ci#define TRAC_MASK(x) ((x & 0xe0) >> 5) 2128c2ecf20Sopenharmony_ci 2138c2ecf20Sopenharmony_ci#define TRAC_SUCCESS 0 2148c2ecf20Sopenharmony_ci#define TRAC_SUCCESS_DATA_PENDING 1 2158c2ecf20Sopenharmony_ci#define TRAC_SUCCESS_WAIT_FOR_ACK 2 2168c2ecf20Sopenharmony_ci#define TRAC_CHANNEL_ACCESS_FAILURE 3 2178c2ecf20Sopenharmony_ci#define TRAC_NO_ACK 5 2188c2ecf20Sopenharmony_ci#define TRAC_INVALID 7 2198c2ecf20Sopenharmony_ci 2208c2ecf20Sopenharmony_ci#endif /* !_AT86RF230_H */ 221