11#define SIO2_REL_BASE 0x1F808000
12#define SIO2_SEG 0xA0000000
13#define SIO2_BASE (SIO2_REL_BASE + SIO2_SEG)
15#define SIO2_REG_BASE (SIO2_BASE + 0x200)
16#define SIO2_REG_PORT0_CTRL1 (SIO2_BASE + 0x240)
17#define SIO2_REG_PORT0_CTRL2 (SIO2_BASE + 0x244)
18#define SIO2_REG_DATA_OUT (SIO2_BASE + 0x260)
19#define SIO2_REG_DATA_IN (SIO2_BASE + 0x264)
20#define SIO2_REG_CTRL (SIO2_BASE + 0x268)
21#define SIO2_REG_STAT6C (SIO2_BASE + 0x26C)
22#define SIO2_REG_STAT70 (SIO2_BASE + 0x270)
23#define SIO2_REG_STAT74 (SIO2_BASE + 0x274)
24#define SIO2_REG_UNKN78 (SIO2_BASE + 0x278)
25#define SIO2_REG_UNKN7C (SIO2_BASE + 0x27C)
26#define SIO2_REG_STAT (SIO2_BASE + 0x280)
28#define SIO2_A_QUEUE (SIO2_BASE + 0x200)
29#define SIO2_A_PORT0_CTRL1 (SIO2_BASE + 0x240)
30#define SIO2_A_PORT0_CTRL2 (SIO2_BASE + 0x244)
31#define SIO2_A_DATA_OUT (SIO2_BASE + 0x260)
32#define SIO2_A_DATA_IN (SIO2_BASE + 0x264)
33#define SIO2_A_CTRL (SIO2_BASE + 0x268)
34#define SIO2_A_STAT6C (SIO2_BASE + 0x26C)
35#define SIO2_A_CONN_STAT70 (SIO2_BASE + 0x270)
36#define SIO2_A_FIFO_STAT74 (SIO2_BASE + 0x274)
37#define SIO2_A_TX_FIFO_PT (SIO2_BASE + 0x278)
38#define SIO2_A_RX_FIFO_PT (SIO2_BASE + 0x27C)
39#define SIO2_A_INTR_STAT (SIO2_BASE + 0x280)
43#define PCTRL0_ATT_LOW_PER(x) ((((u32)(x)) << 0) & 0xFF)
44#define PCTRL0_ATT_MIN_HIGH_PER(x) ((((u32)(x)) << 8) & 0xFF00)
45#define PCTRL0_BAUD0_DIV(x) ((((u32)(x)) << 16) & 0xFF0000)
46#define PCTRL0_BAUD1_DIV(x) ((((u32)(x)) << 24) & 0xFF000000)
48#define PCTRL1_ACK_TIMEOUT_PER(x) ((((u32)(x)) << 0) & 0xFFFF)
49#define PCTRL1_INTER_BYTE_PER(x) ((((u32)(x)) << 16) & 0xFF0000)
50#define PCTRL1_UNK24(x) ((((u32)(x))&1) << 24)
51#define PCTRL1_IF_MODE_SPI_DIFF(x) ((((u32)(x))&1) << 25)
53#define TR_CTRL_PORT_NR(x) ((((u32)(x))&0x3) << 0)
54#define TR_CTRL_PAUSE(x) ((((u32)(x))&1) << 2)
55#define TR_CTRL_UNK03(x) ((((u32)(x))&1) << 3)
57#define TR_CTRL_TX_MODE_PIO_DMA(x) ((((u32)(x))&1) << 4)
58#define TR_CTRL_RX_MODE_PIO_DMA(x) ((((u32)(x))&1) << 5)
66#define TR_CTRL_NORMAL_TR(x) (((u32)((x))&1) << 6)
67#define TR_CTRL_SPECIAL_TR(x) (((u32)((x))&1) << 7)
69#define TR_CTRL_TX_DATA_SZ(x) ((((u32)(x))&0x1FF) << 8)
70#define TR_CTRL_UNK17(x) ((((u32)(x))&1) << 17)
71#define TR_CTRL_RX_DATA_SZ(x) ((((u32)(x))&0x1FF) << 18)
72#define TR_CTRL_UNK27(x) ((((u32)(x))&1) << 27)
74#define TR_CTRL_UNK28(x) ((((u32)(x))&1) << 28)
75#define TR_CTRL_UNK29(x) ((((u32)(x))&1) << 29)
77#define TR_CTRL_BAUD_DIV(x) ((((u32)(x))&1) << 30)
78#define TR_CTRL_WAIT_ACK_FOREVER(x) ((((u32)(x))&1) << 31)
81#define CTRL_TR_START(x) ((((u32)(x))&1) << 0)
82#define CTRL_TR_RESUME_PAUSED(x) ((((u32)(x))&1) << 1)
83#define CTRL_RESET_STATE(x) ((((u32)(x))&1) << 2)
84#define CTRL_RESET_FIFOS(x) ((((u32)(x))&1) << 3)
85#define CTRL_USE_ACK_WAIT_TIMEOUT(x) ((((u32)(x))&1) << 4)
86#define CTRL_NO_MISSING_ACK_ERR(x) ((((u32)(x))&1) << 5)
88#define CTRL_UNK06(x) ((((u32)(x))&1) << 6)
90#define CTRL_UNK07(x) ((((u32)(x))&1) << 7)
91#define CTRL_ERROR_INTR_EN(x) ((((u32)(x))&1) << 8)
92#define CTRL_TR_COMP_INTR_EN(x) ((((u32)(x))&1) << 9)
94#define CTRL_UNK10(x) ((((u32)(x))&1) << 10)
95#define CTRL_UNK11(x) ((((u32)(x))&1) << 11)
97#define CTRL_UNK2912(x) ((((u32)(x))&0x3FFFF) << 12)
98#define CTRL_PS1_MODE_EN(x) ((((u32)(x))&1) << 30)
99#define CTRL_SLAVE_MODE_EN(x) ((((u32)(x))&1) << 31)
102#define STAT_UNK0300(x) ((((u32)(x)) >> 0) & 0xF)
104#define STAT_NEED_DMA_DATA_TX(x) ((((u32)(x)) >> 4) & 1)
105#define STAT_NEED_DMA_DATA_RX(x) ((((u32)(x)) >> 5) & 1)
106#define STAT_UNK0706(x) ((((u32)(x)) >> 6) & 3)
108#define STAT_QUEUE_SLOT_PROC(x) ((((u32)(x)) >> 8) & 0xF)
110#define STAT_TR_IDLE(x) ((((u32)(x)) >> 12) & 1)
112#define STAT_ERR_TX_FIFO_UOFLOW(x) ((((u32)(x)) >> 13) & 1)
113#define STAT_ERR_RX_FIFO_UOFLOW(x) ((((u32)(x)) >> 14) & 1)
114#define STAT_ERR_ACK_MISSING(x) ((((u32)(x)) >> 15) & 1)
116#define STAT_ERR_QUEUE_SLOT(x, slot) ((((u32)(x)) >> (slot + 16)) & 1)
120#define CONN_STAT_CDC0(x) ((((u32)(x)) >> 0) & 1)
121#define CONN_STAT_CDC1(x) ((((u32)(x)) >> 1) & 1)
122#define CONN_STAT_CDC2(x) ((((u32)(x)) >> 2) & 1)
123#define CONN_STAT_CDC3(x) ((((u32)(x)) >> 3) & 1)
124#define CONN_STAT_SAS0(x) ((((u32)(x)) >> 4) & 1)
125#define CONN_STAT_SAS1(x) ((((u32)(x)) >> 5) & 1)
126#define CONN_STAT_SAS2(x) ((((u32)(x)) >> 6) & 1)
127#define CONN_STAT_SAS3(x) ((((u32)(x)) >> 7) & 1)
131#define FSTAT_TX_SZ(x) ((((u32)(x)) >> 0) & 0x1FF)
132#define FSTAT_TX_UNK09(x) ((((u32)(x)) >> 9) & 1)
133#define FSTAT_TX_OVERFLOW(x) ((((u32)(x)) >> 10) & 1)
134#define FSTAT_TX_UNDERFLOW(x) ((((u32)(x)) >> 11) & 1)
135#define FSTAT_UNK1512(x) ((((u32)(x)) >> 12) & 0xF)
136#define FSTAT_RX_SZ(x) ((((u32)(x)) >> 16) & 0x1FF)
137#define FSTAT_RX_UNK09(x) ((((u32)(x)) >> 25) & 1)
138#define FSTAT_RX_OVERFLOW(x) ((((u32)(x)) >> 26) & 1)
139#define FSTAT_RX_UNDERFLOW(x) ((((u32)(x)) >> 27) & 1)
140#define FSTAT_UNK3128(x) ((((u32)(x)) >> 28) & 0xF)
150#define GET_ISTAT_TR_COMP(x) ((((u32)(x)) >> 0) & 1)
152#define GET_ISTAT_TR_ERR(x) ((((u32)(x)) >> 1) & 1)
155 static inline void inl_sio2_ctrl_set(u32 val) { _sw(val, SIO2_REG_CTRL); }
156 static inline u32 inl_sio2_ctrl_get() {
return _lw(SIO2_REG_CTRL); }
157 static inline u32 inl_sio2_stat6c_get() {
return _lw(SIO2_REG_STAT6C); }
158 static inline void inl_sio2_portN_ctrl1_set(
int N, u32 val) { _sw(val, SIO2_REG_PORT0_CTRL1 + (N * 8)); }
159 static inline u32 inl_sio2_portN_ctrl1_get(
int N) {
return _lw(SIO2_REG_PORT0_CTRL1 + (N * 8)); }
160 static inline void inl_sio2_portN_ctrl2_set(
int N, u32 val) { _sw(val, SIO2_REG_PORT0_CTRL2 + (N * 8)); }
161 static inline u32 inl_sio2_portN_ctrl2_get(
int N) {
return _lw(SIO2_REG_PORT0_CTRL2 + (N * 8)); }
162 static inline u32 inl_sio2_stat70_get() {
return _lw(SIO2_REG_STAT70); }
163 static inline void inl_sio2_regN_set(
int N, u32 val) { _sw(val, SIO2_REG_BASE + (N * 4)); }
164 static inline u32 inl_sio2_regN_get(
int N) {
return _lw(SIO2_REG_BASE + (N * 4)); }
165 static inline u32 inl_sio2_stat74_get() {
return _lw(SIO2_REG_STAT74); }
166 static inline void inl_sio2_unkn78_set(u32 val) { _sw(val, SIO2_REG_UNKN78); }
167 static inline u32 inl_sio2_unkn78_get() {
return _lw(SIO2_REG_UNKN78); }
168 static inline void inl_sio2_unkn7c_set(u32 val) { _sw(val, SIO2_REG_UNKN7C); }
169 static inline u32 inl_sio2_unkn7c_get() {
return _lw(SIO2_REG_UNKN7C); }
170 static inline void inl_sio2_data_out(u8 val) { _sb(val, SIO2_REG_DATA_OUT); }
171 static inline u8 inl_sio2_data_in() {
return _lb(SIO2_REG_DATA_IN); }
172 static inline void inl_sio2_stat_set(u32 val) { _sw(val, SIO2_REG_STAT); }
173 static inline u32 inl_sio2_stat_get() {
return _lw(SIO2_REG_STAT); }
175static inline u16 inl_sio2_data_inh() {
return _lh(SIO2_REG_DATA_IN); }
176static inline u32 inl_sio2_data_inw() {
return _lw(SIO2_REG_DATA_IN); }