Skip to content

Commit c50f29f

Browse files
soc: ti: Use common peripheral startup delay config for mspm0 and mspm33
Consolidate MSPM33_PERIPH_STARTUP_DELAY and MSPM0_PERIPH_STARTUP_DELAY into a single MSP_PERIPH_STARTUP_DELAY option. Update all affected drivers to use the common configuration. Signed-off-by: Aman Lachhiramka <[email protected]>
1 parent 36c53ad commit c50f29f

File tree

7 files changed

+11
-32
lines changed

7 files changed

+11
-32
lines changed

drivers/adc/adc_msp_hsadc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,8 @@ static int adc_msp_hsadc_config_vref(int ref_internal)
173173
if (init_vref) {
174174
/* Initialize VREF module */
175175
DL_VREF_reset(VREF);
176-
DL_VREF_enablePower(VREF);
177-
delay_cycles(CONFIG_MSPM33_PERIPH_STARTUP_DELAY);
176+
DL_VREF_enablePower(VREF);
177+
delay_cycles(CONFIG_MSP_PERIPH_STARTUP_DELAY);
178178

179179
/* Configure VREF clock */
180180
DL_VREF_ClockConfig vref_clk_config = {.clockSel = DL_VREF_CLOCK_BUSCLK,
@@ -214,7 +214,7 @@ static int adc_msp_hsadc_init(const struct device *dev)
214214
DL_HSADC_reset((hsadc_ADC_LITE_REGS_Regs *)config->config_base);
215215
DL_HSADC_enablePower((hsadc_ADC_LITE_REGS_Regs *)config->config_base);
216216

217-
delay_cycles(CONFIG_MSPM33_PERIPH_STARTUP_DELAY); // wait for power to stabilize
217+
delay_cycles(CONFIG_MSP_PERIPH_STARTUP_DELAY); // wait for power to stabilize
218218

219219
/* Configure clock */
220220
DL_HSADC_setClockDivideRatio((hsadc_ADC_LITE_REGS_Regs *)config->config_base,

drivers/counter/counter_msp_timer.c

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,6 @@
1717
#include <ti/driverlib/dl_timerg.h>
1818
#include <ti/driverlib/dl_timer.h>
1919

20-
/**
21-
* @brief Platform detection macros
22-
*/
23-
#if defined(CONFIG_SOC_SERIES_MSPM0G) || defined(CONFIG_SOC_SERIES_MSPM0L)
24-
#define MSP_M0 1
25-
#elif defined(CONFIG_SOC_SERIES_MSPM33C)
26-
#define MSP_M33 1
27-
#endif
2820

2921
LOG_MODULE_REGISTER(msp_counter, CONFIG_COUNTER_LOG_LEVEL);
3022

@@ -210,11 +202,7 @@ static int counter_msp_init(const struct device *dev)
210202
DL_Timer_enablePower(config->base);
211203
}
212204

213-
#if defined(MSP_M0)
214-
delay_cycles(CONFIG_MSPM0_PERIPH_STARTUP_DELAY);
215-
#elif defined(MSP_M33)
216-
delay_cycles(CONFIG_MSPM33_PERIPH_STARTUP_DELAY);
217-
#endif
205+
delay_cycles(CONFIG_MSP_PERIPH_STARTUP_DELAY);
218206

219207
DL_Timer_setClockConfig(config->base, (DL_Timer_ClockConfig *)&config->clk_config);
220208
DL_Timer_initTimerMode(config->base, &tim_config);

drivers/i2c/i2c_mspm0.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ static int i2c_mspm0_init(const struct device *dev)
192192
/* Init power */
193193
DL_I2C_reset(config->base);
194194
DL_I2C_enablePower(config->base);
195-
delay_cycles(CONFIG_MSPM0_PERIPH_STARTUP_DELAY);
195+
delay_cycles(CONFIG_MSP_PERIPH_STARTUP_DELAY);
196196
DL_I2C_resetControllerTransfer(config->base);
197197
#ifdef CONFIG_I2C_TARGET
198198
/* Workaround for errata I2C_ERR_04 */
@@ -234,7 +234,7 @@ static int i2c_mspm0_reset_peripheral_controller(const struct device *dev)
234234
DL_I2C_disablePower(config->base);
235235

236236
DL_I2C_enablePower(config->base);
237-
delay_cycles(CONFIG_MSPM0_PERIPH_STARTUP_DELAY);
237+
delay_cycles(CONFIG_MSP_PERIPH_STARTUP_DELAY);
238238

239239
DL_I2C_disableTargetWakeup(config->base);
240240

@@ -525,7 +525,7 @@ static int i2c_mspm0_reset_peripheral_target(const struct device *dev)
525525
DL_I2C_disablePower(config->base);
526526

527527
DL_I2C_enablePower(config->base);
528-
delay_cycles(CONFIG_MSPM0_PERIPH_STARTUP_DELAY);
528+
delay_cycles(CONFIG_MSP_PERIPH_STARTUP_DELAY);
529529

530530
DL_I2C_disableTargetWakeup(config->base);
531531

drivers/pwm/pwm_mspm0.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ static int pwm_mspm0_init(const struct device *dev)
350350
DL_Timer_enablePower(config->base);
351351
}
352352

353-
delay_cycles(CONFIG_MSPM0_PERIPH_STARTUP_DELAY);
353+
delay_cycles(CONFIG_MSP_PERIPH_STARTUP_DELAY);
354354
DL_Timer_setClockConfig(config->base, (DL_Timer_ClockConfig *)&config->clk_config);
355355
if (config->is_capture) {
356356
#ifdef CONFIG_PWM_CAPTURE

drivers/serial/uart_msp.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,7 @@ static int uart_msp_init(const struct device *dev)
6565
DL_UART_Main_reset(config->regs);
6666
DL_UART_Main_enablePower(config->regs);
6767

68-
#if defined(CONFIG_SOC_FAMILY_MSPM0)
69-
delay_cycles(CONFIG_MSPM0_PERIPH_STARTUP_DELAY);
70-
#elif defined(CONFIG_SOC_FAMILY_MSPM33)
71-
delay_cycles(CONFIG_MSPM33_PERIPH_STARTUP_DELAY);
72-
#endif
68+
delay_cycles(CONFIG_MSP_PERIPH_STARTUP_DELAY);
7369
/* Init UART pins */
7470
ret = pinctrl_apply_state(config->pinctrl, PINCTRL_STATE_DEFAULT);
7571
if (ret < 0) {

soc/ti/mspm0/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ rsource "*/Kconfig"
1111
# clock cycles before accessing the peripheral's memory-mapped registers.
1212
# ULPCLK will either be equivalent or half of the main MCLK and CPUCLK,
1313
# yielding the delay time of 8 cycles
14-
config MSPM0_PERIPH_STARTUP_DELAY
14+
config MSP_PERIPH_STARTUP_DELAY
1515
int
1616
default 8
1717

soc/ti/mspm33/Kconfig

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,7 @@ if SOC_FAMILY_TI_MSPM33
77

88
rsource "*/Kconfig"
99

10-
# Per TRM Section 2.2.7 Peripheral Power Enable Control: wait at least 4 ULPCLK
11-
# clock cycles before accessing the peripheral's memory-mapped registers.
12-
# ULPCLK will either be equivalent or half of the main MCLK and CPUCLK,
13-
# yielding the delay time of 8 cycles
14-
# Same parameter as of MSPM0
15-
config MSPM33_PERIPH_STARTUP_DELAY
10+
config MSP_PERIPH_STARTUP_DELAY
1611
int
1712
default 8
1813

0 commit comments

Comments
 (0)