@@ -27,9 +27,9 @@ LOG_MODULE_REGISTER(i2s_litex);
2727 */
2828static void i2s_enable (uintptr_t reg )
2929{
30- uint8_t reg_data = litex_read8 (reg + I2S_CONTROL_REG_OFFSET );
30+ uint8_t reg_data = litex_read8 (reg + I2S_CONTROL_OFFSET );
3131
32- litex_write8 (reg_data | I2S_ENABLE , reg + I2S_CONTROL_REG_OFFSET );
32+ litex_write8 (reg_data | I2S_ENABLE , reg + I2S_CONTROL_OFFSET );
3333}
3434
3535/**
@@ -39,9 +39,9 @@ static void i2s_enable(uintptr_t reg)
3939 */
4040static void i2s_disable (uintptr_t reg )
4141{
42- uint8_t reg_data = litex_read8 (reg + I2S_CONTROL_REG_OFFSET );
42+ uint8_t reg_data = litex_read8 (reg + I2S_CONTROL_OFFSET );
4343
44- litex_write8 (reg_data & ~(I2S_ENABLE ), reg + I2S_CONTROL_REG_OFFSET );
44+ litex_write8 (reg_data & ~(I2S_ENABLE ), reg + I2S_CONTROL_OFFSET );
4545}
4646
4747/**
@@ -51,9 +51,9 @@ static void i2s_disable(uintptr_t reg)
5151 */
5252static void i2s_reset_fifo (uintptr_t reg )
5353{
54- uint8_t reg_data = litex_read8 (reg + I2S_CONTROL_REG_OFFSET );
54+ uint8_t reg_data = litex_read8 (reg + I2S_CONTROL_OFFSET );
5555
56- litex_write8 (reg_data | I2S_FIFO_RESET , reg + I2S_CONTROL_REG_OFFSET );
56+ litex_write8 (reg_data | I2S_FIFO_RESET , reg + I2S_CONTROL_OFFSET );
5757}
5858
5959/**
@@ -66,7 +66,7 @@ static void i2s_reset_fifo(uintptr_t reg)
6666 */
6767static i2s_fmt_t i2s_get_foramt (uintptr_t reg )
6868{
69- uint8_t reg_data = litex_read32 (reg + I2S_CONFIG_REG_OFFSET );
69+ uint8_t reg_data = litex_read32 (reg + I2S_CONFIG_OFFSET );
7070
7171 reg_data &= I2S_CONF_FORMAT_MASK ;
7272 if (reg_data == LITEX_I2S_STANDARD ) {
@@ -86,7 +86,7 @@ static i2s_fmt_t i2s_get_foramt(uintptr_t reg)
8686 */
8787static uint32_t i2s_get_sample_width (uintptr_t reg )
8888{
89- uint32_t reg_data = litex_read32 (reg + I2S_CONFIG_REG_OFFSET );
89+ uint32_t reg_data = litex_read32 (reg + I2S_CONFIG_OFFSET );
9090
9191 reg_data &= I2S_CONF_SAMPLE_WIDTH_MASK ;
9292 return reg_data >> I2S_CONF_SAMPLE_WIDTH_OFFSET ;
@@ -101,7 +101,7 @@ static uint32_t i2s_get_sample_width(uintptr_t reg)
101101 */
102102static uint32_t i2s_get_audio_freq (uintptr_t reg )
103103{
104- uint32_t reg_data = litex_read32 (reg + I2S_CONFIG_REG_OFFSET );
104+ uint32_t reg_data = litex_read32 (reg + I2S_CONFIG_OFFSET );
105105
106106 reg_data &= I2S_CONF_LRCK_MASK ;
107107 return reg_data >> I2S_CONF_LRCK_FREQ_OFFSET ;
@@ -117,9 +117,9 @@ static void i2s_irq_enable(uintptr_t reg, int irq_type)
117117{
118118 __ASSERT_NO_MSG (irq_type == I2S_EV_READY || irq_type == I2S_EV_ERROR );
119119
120- uint8_t reg_data = litex_read8 (reg + I2S_EV_ENABLE_REG_OFFSET );
120+ uint8_t reg_data = litex_read8 (reg + I2S_EV_ENABLE_OFFSET );
121121
122- litex_write8 (reg_data | irq_type , reg + I2S_EV_ENABLE_REG_OFFSET );
122+ litex_write8 (reg_data | irq_type , reg + I2S_EV_ENABLE_OFFSET );
123123}
124124
125125/**
@@ -132,9 +132,9 @@ static void i2s_irq_disable(uintptr_t reg, int irq_type)
132132{
133133 __ASSERT_NO_MSG (irq_type == I2S_EV_READY || irq_type == I2S_EV_ERROR );
134134
135- uint8_t reg_data = litex_read8 (reg + I2S_EV_ENABLE_REG_OFFSET );
135+ uint8_t reg_data = litex_read8 (reg + I2S_EV_ENABLE_OFFSET );
136136
137- litex_write8 (reg_data & ~(irq_type ), reg + I2S_EV_ENABLE_REG_OFFSET );
137+ litex_write8 (reg_data & ~(irq_type ), reg + I2S_EV_ENABLE_OFFSET );
138138}
139139
140140/**
@@ -144,9 +144,9 @@ static void i2s_irq_disable(uintptr_t reg, int irq_type)
144144 */
145145static void i2s_clear_pending_irq (uintptr_t reg )
146146{
147- uint8_t reg_data = litex_read8 (reg + I2S_EV_PENDING_REG_OFFSET );
147+ uint8_t reg_data = litex_read8 (reg + I2S_EV_PENDING_OFFSET );
148148
149- litex_write8 (reg_data , reg + I2S_EV_PENDING_REG_OFFSET );
149+ litex_write8 (reg_data , reg + I2S_EV_PENDING_OFFSET );
150150}
151151
152152/**
@@ -323,18 +323,16 @@ static int i2s_litex_configure(const struct device *dev, enum i2s_dir dir,
323323 struct i2s_litex_data * const dev_data = dev -> data ;
324324 const struct i2s_litex_cfg * const cfg = dev -> config ;
325325 struct stream * stream ;
326- int channels_concatenated ;
326+ int channels_concatenated = litex_read8 ( cfg -> base + I2S_STATUS_OFFSET ) ;
327327 int dev_audio_freq = i2s_get_audio_freq (cfg -> base );
328328 int channel_div ;
329329
330330 if (dir == I2S_DIR_RX ) {
331331 stream = & dev_data -> rx ;
332- channels_concatenated = litex_read8 (I2S_RX_STATUS_REG ) &
333- I2S_RX_STAT_CHANNEL_CONCATENATED_MASK ;
332+ channels_concatenated &= I2S_RX_STAT_CHANNEL_CONCATENATED_MASK ;
334333 } else if (dir == I2S_DIR_TX ) {
335334 stream = & dev_data -> tx ;
336- channels_concatenated = litex_read8 (I2S_TX_STATUS_REG ) &
337- I2S_TX_STAT_CHANNEL_CONCATENATED_MASK ;
335+ channels_concatenated &= I2S_TX_STAT_CHANNEL_CONCATENATED_MASK ;
338336 } else if (dir == I2S_DIR_BOTH ) {
339337 return - ENOSYS ;
340338 } else {
@@ -612,7 +610,7 @@ static const struct i2s_driver_api i2s_litex_driver_api = {
612610 static void i2s_litex_irq_config_func_##dir(const struct device *dev); \
613611 \
614612 static struct i2s_litex_cfg i2s_litex_cfg_##dir = { \
615- .base = DT_REG_ADDR_BY_NAME (DT_NODELABEL(i2s_##dir), control ), \
613+ .base = DT_REG_ADDR (DT_NODELABEL(i2s_##dir)), \
616614 .fifo_base = \
617615 DT_REG_ADDR_BY_NAME(DT_NODELABEL(i2s_##dir), fifo), \
618616 .fifo_depth = DT_PROP(DT_NODELABEL(i2s_##dir), fifo_depth), \
0 commit comments