Skip to content

Commit 42ad39b

Browse files
lucien-nxpkartben
authored andcommitted
drivers: i2s: update i2s_mcux_sai.c
On RT1180/RT700, there is no gpr register on soc, so change driver to get configuration register base address from dts, instead of hard code. Signed-off-by: Lucien Zhao <[email protected]>
1 parent 384e940 commit 42ad39b

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

drivers/i2s/i2s_mcux_sai.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ struct i2s_mcux_config {
8888
uint32_t pll_pd;
8989
uint32_t pll_num;
9090
uint32_t pll_den;
91+
uint32_t *mclk_control_base;
9192
uint32_t mclk_pin_mask;
9293
uint32_t mclk_pin_offset;
9394
uint32_t tx_channel;
@@ -406,12 +407,12 @@ static void enable_mclk_direction(const struct device *dev, bool dir)
406407
const struct i2s_mcux_config *dev_cfg = dev->config;
407408
uint32_t offset = dev_cfg->mclk_pin_offset;
408409
uint32_t mask = dev_cfg->mclk_pin_mask;
409-
uint32_t *gpr = (uint32_t *)(DT_REG_ADDR(DT_NODELABEL(iomuxcgpr)) + offset);
410+
uint32_t *base = (uint32_t *)(dev_cfg->mclk_control_base + offset);
410411

411412
if (dir) {
412-
*gpr |= mask;
413+
*base |= mask;
413414
} else {
414-
*gpr &= ~mask;
415+
*base &= ~mask;
415416
}
416417
}
417418

@@ -1182,6 +1183,8 @@ static DEVICE_API(i2s, i2s_mcux_driver_api) = {
11821183
.pll_pd = DT_PHA_BY_NAME(DT_DRV_INST(i2s_id), pll_clocks, pd, value), \
11831184
.pll_num = DT_PHA_BY_NAME(DT_DRV_INST(i2s_id), pll_clocks, num, value), \
11841185
.pll_den = DT_PHA_BY_NAME(DT_DRV_INST(i2s_id), pll_clocks, den, value), \
1186+
.mclk_control_base = \
1187+
(uint32_t *)DT_REG_ADDR(DT_PHANDLE(DT_DRV_INST(i2s_id), pinmuxes)), \
11851188
.mclk_pin_mask = DT_PHA_BY_IDX(DT_DRV_INST(i2s_id), pinmuxes, 0, function), \
11861189
.mclk_pin_offset = DT_PHA_BY_IDX(DT_DRV_INST(i2s_id), pinmuxes, 0, pin), \
11871190
.clk_sub_sys = \

0 commit comments

Comments
 (0)