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