1*1802d0beSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */ 27490b008SAlexander Aring /* 37490b008SAlexander Aring * AT86RF230/RF231 driver 47490b008SAlexander Aring * 57490b008SAlexander Aring * Copyright (C) 2009-2012 Siemens AG 67490b008SAlexander Aring * 77490b008SAlexander Aring * Written by: 87490b008SAlexander Aring * Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> 97490b008SAlexander Aring * Alexander Smirnov <alex.bluesman.smirnov@gmail.com> 107490b008SAlexander Aring */ 117490b008SAlexander Aring 127490b008SAlexander Aring #ifndef _AT86RF230_H 137490b008SAlexander Aring #define _AT86RF230_H 147490b008SAlexander Aring 157490b008SAlexander Aring #define RG_TRX_STATUS (0x01) 167490b008SAlexander Aring #define SR_TRX_STATUS 0x01, 0x1f, 0 177490b008SAlexander Aring #define SR_RESERVED_01_3 0x01, 0x20, 5 187490b008SAlexander Aring #define SR_CCA_STATUS 0x01, 0x40, 6 197490b008SAlexander Aring #define SR_CCA_DONE 0x01, 0x80, 7 207490b008SAlexander Aring #define RG_TRX_STATE (0x02) 217490b008SAlexander Aring #define SR_TRX_CMD 0x02, 0x1f, 0 227490b008SAlexander Aring #define SR_TRAC_STATUS 0x02, 0xe0, 5 237490b008SAlexander Aring #define RG_TRX_CTRL_0 (0x03) 247490b008SAlexander Aring #define SR_CLKM_CTRL 0x03, 0x07, 0 257490b008SAlexander Aring #define SR_CLKM_SHA_SEL 0x03, 0x08, 3 267490b008SAlexander Aring #define SR_PAD_IO_CLKM 0x03, 0x30, 4 277490b008SAlexander Aring #define SR_PAD_IO 0x03, 0xc0, 6 287490b008SAlexander Aring #define RG_TRX_CTRL_1 (0x04) 297490b008SAlexander Aring #define SR_IRQ_POLARITY 0x04, 0x01, 0 307490b008SAlexander Aring #define SR_IRQ_MASK_MODE 0x04, 0x02, 1 317490b008SAlexander Aring #define SR_SPI_CMD_MODE 0x04, 0x0c, 2 327490b008SAlexander Aring #define SR_RX_BL_CTRL 0x04, 0x10, 4 337490b008SAlexander Aring #define SR_TX_AUTO_CRC_ON 0x04, 0x20, 5 347490b008SAlexander Aring #define SR_IRQ_2_EXT_EN 0x04, 0x40, 6 357490b008SAlexander Aring #define SR_PA_EXT_EN 0x04, 0x80, 7 367490b008SAlexander Aring #define RG_PHY_TX_PWR (0x05) 377490b008SAlexander Aring #define SR_TX_PWR_23X 0x05, 0x0f, 0 387490b008SAlexander Aring #define SR_PA_LT_230 0x05, 0x30, 4 397490b008SAlexander Aring #define SR_PA_BUF_LT_230 0x05, 0xc0, 6 407490b008SAlexander Aring #define SR_TX_PWR_212 0x05, 0x1f, 0 417490b008SAlexander Aring #define SR_GC_PA_212 0x05, 0x60, 5 427490b008SAlexander Aring #define SR_PA_BOOST_LT_212 0x05, 0x80, 7 437490b008SAlexander Aring #define RG_PHY_RSSI (0x06) 447490b008SAlexander Aring #define SR_RSSI 0x06, 0x1f, 0 457490b008SAlexander Aring #define SR_RND_VALUE 0x06, 0x60, 5 467490b008SAlexander Aring #define SR_RX_CRC_VALID 0x06, 0x80, 7 477490b008SAlexander Aring #define RG_PHY_ED_LEVEL (0x07) 487490b008SAlexander Aring #define SR_ED_LEVEL 0x07, 0xff, 0 497490b008SAlexander Aring #define RG_PHY_CC_CCA (0x08) 507490b008SAlexander Aring #define SR_CHANNEL 0x08, 0x1f, 0 517490b008SAlexander Aring #define SR_CCA_MODE 0x08, 0x60, 5 527490b008SAlexander Aring #define SR_CCA_REQUEST 0x08, 0x80, 7 537490b008SAlexander Aring #define RG_CCA_THRES (0x09) 547490b008SAlexander Aring #define SR_CCA_ED_THRES 0x09, 0x0f, 0 557490b008SAlexander Aring #define SR_RESERVED_09_1 0x09, 0xf0, 4 567490b008SAlexander Aring #define RG_RX_CTRL (0x0a) 577490b008SAlexander Aring #define SR_PDT_THRES 0x0a, 0x0f, 0 587490b008SAlexander Aring #define SR_RESERVED_0a_1 0x0a, 0xf0, 4 597490b008SAlexander Aring #define RG_SFD_VALUE (0x0b) 607490b008SAlexander Aring #define SR_SFD_VALUE 0x0b, 0xff, 0 617490b008SAlexander Aring #define RG_TRX_CTRL_2 (0x0c) 627490b008SAlexander Aring #define SR_OQPSK_DATA_RATE 0x0c, 0x03, 0 637490b008SAlexander Aring #define SR_SUB_MODE 0x0c, 0x04, 2 647490b008SAlexander Aring #define SR_BPSK_QPSK 0x0c, 0x08, 3 657490b008SAlexander Aring #define SR_OQPSK_SUB1_RC_EN 0x0c, 0x10, 4 667490b008SAlexander Aring #define SR_RESERVED_0c_5 0x0c, 0x60, 5 677490b008SAlexander Aring #define SR_RX_SAFE_MODE 0x0c, 0x80, 7 687490b008SAlexander Aring #define RG_ANT_DIV (0x0d) 697490b008SAlexander Aring #define SR_ANT_CTRL 0x0d, 0x03, 0 707490b008SAlexander Aring #define SR_ANT_EXT_SW_EN 0x0d, 0x04, 2 717490b008SAlexander Aring #define SR_ANT_DIV_EN 0x0d, 0x08, 3 727490b008SAlexander Aring #define SR_RESERVED_0d_2 0x0d, 0x70, 4 737490b008SAlexander Aring #define SR_ANT_SEL 0x0d, 0x80, 7 747490b008SAlexander Aring #define RG_IRQ_MASK (0x0e) 757490b008SAlexander Aring #define SR_IRQ_MASK 0x0e, 0xff, 0 767490b008SAlexander Aring #define RG_IRQ_STATUS (0x0f) 777490b008SAlexander Aring #define SR_IRQ_0_PLL_LOCK 0x0f, 0x01, 0 787490b008SAlexander Aring #define SR_IRQ_1_PLL_UNLOCK 0x0f, 0x02, 1 797490b008SAlexander Aring #define SR_IRQ_2_RX_START 0x0f, 0x04, 2 807490b008SAlexander Aring #define SR_IRQ_3_TRX_END 0x0f, 0x08, 3 817490b008SAlexander Aring #define SR_IRQ_4_CCA_ED_DONE 0x0f, 0x10, 4 827490b008SAlexander Aring #define SR_IRQ_5_AMI 0x0f, 0x20, 5 837490b008SAlexander Aring #define SR_IRQ_6_TRX_UR 0x0f, 0x40, 6 847490b008SAlexander Aring #define SR_IRQ_7_BAT_LOW 0x0f, 0x80, 7 857490b008SAlexander Aring #define RG_VREG_CTRL (0x10) 867490b008SAlexander Aring #define SR_RESERVED_10_6 0x10, 0x03, 0 877490b008SAlexander Aring #define SR_DVDD_OK 0x10, 0x04, 2 887490b008SAlexander Aring #define SR_DVREG_EXT 0x10, 0x08, 3 897490b008SAlexander Aring #define SR_RESERVED_10_3 0x10, 0x30, 4 907490b008SAlexander Aring #define SR_AVDD_OK 0x10, 0x40, 6 917490b008SAlexander Aring #define SR_AVREG_EXT 0x10, 0x80, 7 927490b008SAlexander Aring #define RG_BATMON (0x11) 937490b008SAlexander Aring #define SR_BATMON_VTH 0x11, 0x0f, 0 947490b008SAlexander Aring #define SR_BATMON_HR 0x11, 0x10, 4 957490b008SAlexander Aring #define SR_BATMON_OK 0x11, 0x20, 5 967490b008SAlexander Aring #define SR_RESERVED_11_1 0x11, 0xc0, 6 977490b008SAlexander Aring #define RG_XOSC_CTRL (0x12) 987490b008SAlexander Aring #define SR_XTAL_TRIM 0x12, 0x0f, 0 997490b008SAlexander Aring #define SR_XTAL_MODE 0x12, 0xf0, 4 1007490b008SAlexander Aring #define RG_RX_SYN (0x15) 1017490b008SAlexander Aring #define SR_RX_PDT_LEVEL 0x15, 0x0f, 0 1027490b008SAlexander Aring #define SR_RESERVED_15_2 0x15, 0x70, 4 1037490b008SAlexander Aring #define SR_RX_PDT_DIS 0x15, 0x80, 7 1047490b008SAlexander Aring #define RG_XAH_CTRL_1 (0x17) 1057490b008SAlexander Aring #define SR_RESERVED_17_8 0x17, 0x01, 0 1067490b008SAlexander Aring #define SR_AACK_PROM_MODE 0x17, 0x02, 1 1077490b008SAlexander Aring #define SR_AACK_ACK_TIME 0x17, 0x04, 2 1087490b008SAlexander Aring #define SR_RESERVED_17_5 0x17, 0x08, 3 1097490b008SAlexander Aring #define SR_AACK_UPLD_RES_FT 0x17, 0x10, 4 1107490b008SAlexander Aring #define SR_AACK_FLTR_RES_FT 0x17, 0x20, 5 1117490b008SAlexander Aring #define SR_CSMA_LBT_MODE 0x17, 0x40, 6 1127490b008SAlexander Aring #define SR_RESERVED_17_1 0x17, 0x80, 7 1137490b008SAlexander Aring #define RG_FTN_CTRL (0x18) 1147490b008SAlexander Aring #define SR_RESERVED_18_2 0x18, 0x7f, 0 1157490b008SAlexander Aring #define SR_FTN_START 0x18, 0x80, 7 1167490b008SAlexander Aring #define RG_PLL_CF (0x1a) 1177490b008SAlexander Aring #define SR_RESERVED_1a_2 0x1a, 0x7f, 0 1187490b008SAlexander Aring #define SR_PLL_CF_START 0x1a, 0x80, 7 1197490b008SAlexander Aring #define RG_PLL_DCU (0x1b) 1207490b008SAlexander Aring #define SR_RESERVED_1b_3 0x1b, 0x3f, 0 1217490b008SAlexander Aring #define SR_RESERVED_1b_2 0x1b, 0x40, 6 1227490b008SAlexander Aring #define SR_PLL_DCU_START 0x1b, 0x80, 7 1237490b008SAlexander Aring #define RG_PART_NUM (0x1c) 1247490b008SAlexander Aring #define SR_PART_NUM 0x1c, 0xff, 0 1257490b008SAlexander Aring #define RG_VERSION_NUM (0x1d) 1267490b008SAlexander Aring #define SR_VERSION_NUM 0x1d, 0xff, 0 1277490b008SAlexander Aring #define RG_MAN_ID_0 (0x1e) 1287490b008SAlexander Aring #define SR_MAN_ID_0 0x1e, 0xff, 0 1297490b008SAlexander Aring #define RG_MAN_ID_1 (0x1f) 1307490b008SAlexander Aring #define SR_MAN_ID_1 0x1f, 0xff, 0 1317490b008SAlexander Aring #define RG_SHORT_ADDR_0 (0x20) 1327490b008SAlexander Aring #define SR_SHORT_ADDR_0 0x20, 0xff, 0 1337490b008SAlexander Aring #define RG_SHORT_ADDR_1 (0x21) 1347490b008SAlexander Aring #define SR_SHORT_ADDR_1 0x21, 0xff, 0 1357490b008SAlexander Aring #define RG_PAN_ID_0 (0x22) 1367490b008SAlexander Aring #define SR_PAN_ID_0 0x22, 0xff, 0 1377490b008SAlexander Aring #define RG_PAN_ID_1 (0x23) 1387490b008SAlexander Aring #define SR_PAN_ID_1 0x23, 0xff, 0 1397490b008SAlexander Aring #define RG_IEEE_ADDR_0 (0x24) 1407490b008SAlexander Aring #define SR_IEEE_ADDR_0 0x24, 0xff, 0 1417490b008SAlexander Aring #define RG_IEEE_ADDR_1 (0x25) 1427490b008SAlexander Aring #define SR_IEEE_ADDR_1 0x25, 0xff, 0 1437490b008SAlexander Aring #define RG_IEEE_ADDR_2 (0x26) 1447490b008SAlexander Aring #define SR_IEEE_ADDR_2 0x26, 0xff, 0 1457490b008SAlexander Aring #define RG_IEEE_ADDR_3 (0x27) 1467490b008SAlexander Aring #define SR_IEEE_ADDR_3 0x27, 0xff, 0 1477490b008SAlexander Aring #define RG_IEEE_ADDR_4 (0x28) 1487490b008SAlexander Aring #define SR_IEEE_ADDR_4 0x28, 0xff, 0 1497490b008SAlexander Aring #define RG_IEEE_ADDR_5 (0x29) 1507490b008SAlexander Aring #define SR_IEEE_ADDR_5 0x29, 0xff, 0 1517490b008SAlexander Aring #define RG_IEEE_ADDR_6 (0x2a) 1527490b008SAlexander Aring #define SR_IEEE_ADDR_6 0x2a, 0xff, 0 1537490b008SAlexander Aring #define RG_IEEE_ADDR_7 (0x2b) 1547490b008SAlexander Aring #define SR_IEEE_ADDR_7 0x2b, 0xff, 0 1557490b008SAlexander Aring #define RG_XAH_CTRL_0 (0x2c) 1567490b008SAlexander Aring #define SR_SLOTTED_OPERATION 0x2c, 0x01, 0 1577490b008SAlexander Aring #define SR_MAX_CSMA_RETRIES 0x2c, 0x0e, 1 1587490b008SAlexander Aring #define SR_MAX_FRAME_RETRIES 0x2c, 0xf0, 4 1597490b008SAlexander Aring #define RG_CSMA_SEED_0 (0x2d) 1607490b008SAlexander Aring #define SR_CSMA_SEED_0 0x2d, 0xff, 0 1617490b008SAlexander Aring #define RG_CSMA_SEED_1 (0x2e) 1627490b008SAlexander Aring #define SR_CSMA_SEED_1 0x2e, 0x07, 0 1637490b008SAlexander Aring #define SR_AACK_I_AM_COORD 0x2e, 0x08, 3 1647490b008SAlexander Aring #define SR_AACK_DIS_ACK 0x2e, 0x10, 4 1657490b008SAlexander Aring #define SR_AACK_SET_PD 0x2e, 0x20, 5 1667490b008SAlexander Aring #define SR_AACK_FVN_MODE 0x2e, 0xc0, 6 1677490b008SAlexander Aring #define RG_CSMA_BE (0x2f) 1687490b008SAlexander Aring #define SR_MIN_BE 0x2f, 0x0f, 0 1697490b008SAlexander Aring #define SR_MAX_BE 0x2f, 0xf0, 4 1707490b008SAlexander Aring 1717490b008SAlexander Aring #define CMD_REG 0x80 1727490b008SAlexander Aring #define CMD_REG_MASK 0x3f 1737490b008SAlexander Aring #define CMD_WRITE 0x40 1747490b008SAlexander Aring #define CMD_FB 0x20 1757490b008SAlexander Aring 1767490b008SAlexander Aring #define IRQ_BAT_LOW BIT(7) 1777490b008SAlexander Aring #define IRQ_TRX_UR BIT(6) 1787490b008SAlexander Aring #define IRQ_AMI BIT(5) 1797490b008SAlexander Aring #define IRQ_CCA_ED BIT(4) 1807490b008SAlexander Aring #define IRQ_TRX_END BIT(3) 1817490b008SAlexander Aring #define IRQ_RX_START BIT(2) 1827490b008SAlexander Aring #define IRQ_PLL_UNL BIT(1) 1837490b008SAlexander Aring #define IRQ_PLL_LOCK BIT(0) 1847490b008SAlexander Aring 1857490b008SAlexander Aring #define IRQ_ACTIVE_HIGH 0 1867490b008SAlexander Aring #define IRQ_ACTIVE_LOW 1 1877490b008SAlexander Aring 1887490b008SAlexander Aring #define STATE_P_ON 0x00 /* BUSY */ 1897490b008SAlexander Aring #define STATE_BUSY_RX 0x01 1907490b008SAlexander Aring #define STATE_BUSY_TX 0x02 1917490b008SAlexander Aring #define STATE_FORCE_TRX_OFF 0x03 1927490b008SAlexander Aring #define STATE_FORCE_TX_ON 0x04 /* IDLE */ 1937490b008SAlexander Aring /* 0x05 */ /* INVALID_PARAMETER */ 1947490b008SAlexander Aring #define STATE_RX_ON 0x06 1957490b008SAlexander Aring /* 0x07 */ /* SUCCESS */ 1967490b008SAlexander Aring #define STATE_TRX_OFF 0x08 1977490b008SAlexander Aring #define STATE_TX_ON 0x09 1987490b008SAlexander Aring /* 0x0a - 0x0e */ /* 0x0a - UNSUPPORTED_ATTRIBUTE */ 1997490b008SAlexander Aring #define STATE_SLEEP 0x0F 2007490b008SAlexander Aring #define STATE_PREP_DEEP_SLEEP 0x10 2017490b008SAlexander Aring #define STATE_BUSY_RX_AACK 0x11 2027490b008SAlexander Aring #define STATE_BUSY_TX_ARET 0x12 2037490b008SAlexander Aring #define STATE_RX_AACK_ON 0x16 2047490b008SAlexander Aring #define STATE_TX_ARET_ON 0x19 2057490b008SAlexander Aring #define STATE_RX_ON_NOCLK 0x1C 2067490b008SAlexander Aring #define STATE_RX_AACK_ON_NOCLK 0x1D 2077490b008SAlexander Aring #define STATE_BUSY_RX_AACK_NOCLK 0x1E 2087490b008SAlexander Aring #define STATE_TRANSITION_IN_PROGRESS 0x1F 2097490b008SAlexander Aring 2107490b008SAlexander Aring #define TRX_STATE_MASK (0x1F) 211493bc90aSAlexander Aring #define TRAC_MASK(x) ((x & 0xe0) >> 5) 212493bc90aSAlexander Aring 213493bc90aSAlexander Aring #define TRAC_SUCCESS 0 214493bc90aSAlexander Aring #define TRAC_SUCCESS_DATA_PENDING 1 215493bc90aSAlexander Aring #define TRAC_SUCCESS_WAIT_FOR_ACK 2 216493bc90aSAlexander Aring #define TRAC_CHANNEL_ACCESS_FAILURE 3 217493bc90aSAlexander Aring #define TRAC_NO_ACK 5 218493bc90aSAlexander Aring #define TRAC_INVALID 7 2197490b008SAlexander Aring 2207490b008SAlexander Aring #endif /* !_AT86RF230_H */ 221