drivers: i2c: cc32xx: enable I2C module clock

The I2C driver clock was initialized in board specific code, move it to
the driver as it is part of its responsabilities.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
Gerard Marull-Paretas 2023-06-12 15:36:52 +02:00 committed by Anas Nashif
parent ecc241e0ce
commit 49c4973d8e
3 changed files with 7 additions and 14 deletions

View file

@ -134,13 +134,6 @@ int pinmux_initialize(void)
unsigned long pin;
unsigned long mode;
/* Enable the I2C module clocks and wait for completion:*/
MAP_PRCMPeripheralClkEnable(PRCM_I2CA0,
PRCM_RUN_MODE_CLK |
PRCM_SLP_MODE_CLK);
while (!MAP_PRCMPeripheralStatusGet(PRCM_I2CA0)) {
}
pin = I2C_CC32XX_PIN_01_I2C_SCL & 0xff;
mode = (I2C_CC32XX_PIN_01_I2C_SCL >> 8) & 0xff;
MAP_PinTypeI2C(pin, mode);

View file

@ -110,13 +110,6 @@ int pinmux_initialize(void)
unsigned long pin;
unsigned long mode;
/* Enable the I2C module clocks and wait for completion:*/
MAP_PRCMPeripheralClkEnable(PRCM_I2CA0,
PRCM_RUN_MODE_CLK |
PRCM_SLP_MODE_CLK);
while (!MAP_PRCMPeripheralStatusGet(PRCM_I2CA0)) {
}
pin = I2C_CC32XX_PIN_01_I2C_SCL & 0xff;
mode = (I2C_CC32XX_PIN_01_I2C_SCL >> 8) & 0xff;
MAP_PinTypeI2C(pin, mode);

View file

@ -331,6 +331,13 @@ static int i2c_cc32xx_init(const struct device *dev)
int error;
uint32_t regval;
/* Enable the I2C module clocks and wait for completion:*/
MAP_PRCMPeripheralClkEnable(PRCM_I2CA0,
PRCM_RUN_MODE_CLK |
PRCM_SLP_MODE_CLK);
while (!MAP_PRCMPeripheralStatusGet(PRCM_I2CA0)) {
}
error = pinctrl_apply_state(config->pcfg, PINCTRL_STATE_DEFAULT);
if (error < 0) {
return error;