23#define SIO2_REL_BASE 0x1F808000
24#define SIO2_SEG 0xA0000000
25#define SIO2_BASE (SIO2_REL_BASE + SIO2_SEG)
27#define SIO2_REG_BASE (SIO2_BASE + 0x200)
28#define SIO2_REG_PORT0_CTRL1 (SIO2_BASE + 0x240)
29#define SIO2_REG_PORT0_CTRL2 (SIO2_BASE + 0x244)
30#define SIO2_REG_DATA_OUT (SIO2_BASE + 0x260)
31#define SIO2_REG_DATA_IN (SIO2_BASE + 0x264)
32#define SIO2_REG_CTRL (SIO2_BASE + 0x268)
33#define SIO2_REG_STAT6C (SIO2_BASE + 0x26C)
34#define SIO2_REG_STAT70 (SIO2_BASE + 0x270)
35#define SIO2_REG_STAT74 (SIO2_BASE + 0x274)
36#define SIO2_REG_UNKN78 (SIO2_BASE + 0x278)
37#define SIO2_REG_UNKN7C (SIO2_BASE + 0x27C)
38#define SIO2_REG_STAT (SIO2_BASE + 0x280)
40#define SIO2_A_QUEUE (SIO2_BASE + 0x200)
41#define SIO2_A_PORT0_CTRL1 (SIO2_BASE + 0x240)
42#define SIO2_A_PORT0_CTRL2 (SIO2_BASE + 0x244)
43#define SIO2_A_DATA_OUT (SIO2_BASE + 0x260)
44#define SIO2_A_DATA_IN (SIO2_BASE + 0x264)
45#define SIO2_A_CTRL (SIO2_BASE + 0x268)
46#define SIO2_A_STAT6C (SIO2_BASE + 0x26C)
47#define SIO2_A_CONN_STAT70 (SIO2_BASE + 0x270)
48#define SIO2_A_FIFO_STAT74 (SIO2_BASE + 0x274)
49#define SIO2_A_TX_FIFO_PT (SIO2_BASE + 0x278)
50#define SIO2_A_RX_FIFO_PT (SIO2_BASE + 0x27C)
51#define SIO2_A_INTR_STAT (SIO2_BASE + 0x280)
57#define PCTRL0_ATT_LOW_PER(x) ((((u32)(x)) << 0) & 0xFF)
58#define PCTRL0_ATT_MIN_HIGH_PER(x) ((((u32)(x)) << 8) & 0xFF00)
59#define PCTRL0_BAUD0_DIV(x) ((((u32)(x)) << 16) & 0xFF0000)
60#define PCTRL0_BAUD1_DIV(x) ((((u32)(x)) << 24) & 0xFF000000)
67#define PCTRL1_ACK_TIMEOUT_AFTER(x) ((((u32)(x)) << 0) & 0xFFFF)
77#define PCTRL1_WAIT_CYCLES_AFTER_ACK_LOW(x) ((((u32)(x)) << 16) & 0xFF0000)
78#define PCTRL1_UNK24(x) ((((u32)(x))&1) << 24)
79#define PCTRL1_IF_MODE_SPI_DIFF(x) ((((u32)(x))&1) << 25)
81#define TR_CTRL_PORT_NR(x) ((((u32)(x))&0x3) << 0)
82#define TR_CTRL_PAUSE(x) ((((u32)(x))&1) << 2)
83#define TR_CTRL_UNK03(x) ((((u32)(x))&1) << 3)
85#define TR_CTRL_TX_MODE_PIO_DMA(x) ((((u32)(x))&1) << 4)
86#define TR_CTRL_RX_MODE_PIO_DMA(x) ((((u32)(x))&1) << 5)
94#define TR_CTRL_NORMAL_TR(x) (((u32)((x))&1) << 6)
95#define TR_CTRL_SPECIAL_TR(x) (((u32)((x))&1) << 7)
97#define TR_CTRL_TX_DATA_SZ(x) ((((u32)(x))&0x1FF) << 8)
98#define TR_CTRL_UNK17(x) ((((u32)(x))&1) << 17)
99#define TR_CTRL_RX_DATA_SZ(x) ((((u32)(x))&0x1FF) << 18)
100#define TR_CTRL_UNK27(x) ((((u32)(x))&1) << 27)
102#define TR_CTRL_UNK28(x) ((((u32)(x))&1) << 28)
103#define TR_CTRL_UNK29(x) ((((u32)(x))&1) << 29)
105#define TR_CTRL_BAUD_DIV(x) ((((u32)(x))&1) << 30)
106#define TR_CTRL_WAIT_ACK_FOREVER(x) ((((u32)(x))&1) << 31)
109#define CTRL_TR_START(x) ((((u32)(x))&1) << 0)
110#define CTRL_TR_RESUME_PAUSED(x) ((((u32)(x))&1) << 1)
111#define CTRL_RESET_STATE(x) ((((u32)(x))&1) << 2)
112#define CTRL_RESET_FIFOS(x) ((((u32)(x))&1) << 3)
113#define CTRL_USE_ACK_WAIT_TIMEOUT(x) ((((u32)(x))&1) << 4)
114#define CTRL_NO_MISSING_ACK_ERR(x) ((((u32)(x))&1) << 5)
116#define CTRL_UNK06(x) ((((u32)(x))&1) << 6)
118#define CTRL_UNK07(x) ((((u32)(x))&1) << 7)
119#define CTRL_ERROR_INTR_EN(x) ((((u32)(x))&1) << 8)
120#define CTRL_TR_COMP_INTR_EN(x) ((((u32)(x))&1) << 9)
122#define CTRL_UNK10(x) ((((u32)(x))&1) << 10)
123#define CTRL_UNK11(x) ((((u32)(x))&1) << 11)
125#define CTRL_UNK2912(x) ((((u32)(x))&0x3FFFF) << 12)
126#define CTRL_PS1_MODE_EN(x) ((((u32)(x))&1) << 30)
127#define CTRL_SLAVE_MODE_EN(x) ((((u32)(x))&1) << 31)
130#define STAT_UNK0300(x) ((((u32)(x)) >> 0) & 0xF)
132#define STAT_NEED_DMA_DATA_TX(x) ((((u32)(x)) >> 4) & 1)
133#define STAT_NEED_DMA_DATA_RX(x) ((((u32)(x)) >> 5) & 1)
134#define STAT_UNK0706(x) ((((u32)(x)) >> 6) & 3)
136#define STAT_QUEUE_SLOT_PROC(x) ((((u32)(x)) >> 8) & 0xF)
138#define STAT_TR_IDLE(x) ((((u32)(x)) >> 12) & 1)
140#define STAT_ERR_TX_FIFO_UOFLOW(x) ((((u32)(x)) >> 13) & 1)
141#define STAT_ERR_RX_FIFO_UOFLOW(x) ((((u32)(x)) >> 14) & 1)
142#define STAT_ERR_ACK_MISSING(x) ((((u32)(x)) >> 15) & 1)
144#define STAT_ERR_QUEUE_SLOT(x, slot) ((((u32)(x)) >> (slot + 16)) & 1)
148#define CONN_STAT_CDC0(x) ((((u32)(x)) >> 0) & 1)
149#define CONN_STAT_CDC1(x) ((((u32)(x)) >> 1) & 1)
150#define CONN_STAT_CDC2(x) ((((u32)(x)) >> 2) & 1)
151#define CONN_STAT_CDC3(x) ((((u32)(x)) >> 3) & 1)
152#define CONN_STAT_SAS0(x) ((((u32)(x)) >> 4) & 1)
153#define CONN_STAT_SAS1(x) ((((u32)(x)) >> 5) & 1)
154#define CONN_STAT_SAS2(x) ((((u32)(x)) >> 6) & 1)
155#define CONN_STAT_SAS3(x) ((((u32)(x)) >> 7) & 1)
159#define FSTAT_TX_SZ(x) ((((u32)(x)) >> 0) & 0x1FF)
160#define FSTAT_TX_UNK09(x) ((((u32)(x)) >> 9) & 1)
161#define FSTAT_TX_OVERFLOW(x) ((((u32)(x)) >> 10) & 1)
162#define FSTAT_TX_UNDERFLOW(x) ((((u32)(x)) >> 11) & 1)
163#define FSTAT_UNK1512(x) ((((u32)(x)) >> 12) & 0xF)
164#define FSTAT_RX_SZ(x) ((((u32)(x)) >> 16) & 0x1FF)
165#define FSTAT_RX_UNK09(x) ((((u32)(x)) >> 25) & 1)
166#define FSTAT_RX_OVERFLOW(x) ((((u32)(x)) >> 26) & 1)
167#define FSTAT_RX_UNDERFLOW(x) ((((u32)(x)) >> 27) & 1)
168#define FSTAT_UNK3128(x) ((((u32)(x)) >> 28) & 0xF)
178#define GET_ISTAT_TR_COMP(x) ((((u32)(x)) >> 0) & 1)
180#define GET_ISTAT_TR_ERR(x) ((((u32)(x)) >> 1) & 1)
183 static inline void inl_sio2_ctrl_set(u32 val) { _sw(val, SIO2_REG_CTRL); }
184 static inline u32 inl_sio2_ctrl_get() {
return _lw(SIO2_REG_CTRL); }
185 static inline u32 inl_sio2_stat6c_get() {
return _lw(SIO2_REG_STAT6C); }
186 static inline void inl_sio2_portN_ctrl1_set(
int N, u32 val) { _sw(val, SIO2_REG_PORT0_CTRL1 + (N * 8)); }
187 static inline u32 inl_sio2_portN_ctrl1_get(
int N) {
return _lw(SIO2_REG_PORT0_CTRL1 + (N * 8)); }
188 static inline void inl_sio2_portN_ctrl2_set(
int N, u32 val) { _sw(val, SIO2_REG_PORT0_CTRL2 + (N * 8)); }
189 static inline u32 inl_sio2_portN_ctrl2_get(
int N) {
return _lw(SIO2_REG_PORT0_CTRL2 + (N * 8)); }
190 static inline u32 inl_sio2_stat70_get() {
return _lw(SIO2_REG_STAT70); }
191 static inline void inl_sio2_regN_set(
int N, u32 val) { _sw(val, SIO2_REG_BASE + (N * 4)); }
192 static inline u32 inl_sio2_regN_get(
int N) {
return _lw(SIO2_REG_BASE + (N * 4)); }
193 static inline u32 inl_sio2_stat74_get() {
return _lw(SIO2_REG_STAT74); }
194 static inline void inl_sio2_unkn78_set(u32 val) { _sw(val, SIO2_REG_UNKN78); }
195 static inline u32 inl_sio2_unkn78_get() {
return _lw(SIO2_REG_UNKN78); }
196 static inline void inl_sio2_unkn7c_set(u32 val) { _sw(val, SIO2_REG_UNKN7C); }
197 static inline u32 inl_sio2_unkn7c_get() {
return _lw(SIO2_REG_UNKN7C); }
198 static inline void inl_sio2_data_out(u8 val) { _sb(val, SIO2_REG_DATA_OUT); }
199 static inline u8 inl_sio2_data_in() {
return _lb(SIO2_REG_DATA_IN); }
200 static inline void inl_sio2_stat_set(u32 val) { _sw(val, SIO2_REG_STAT); }
201 static inline u32 inl_sio2_stat_get() {
return _lw(SIO2_REG_STAT); }
203static inline u16 inl_sio2_data_inh() {
return _lh(SIO2_REG_DATA_IN); }
204static inline u32 inl_sio2_data_inw() {
return _lw(SIO2_REG_DATA_IN); }