diff --git a/cpu/stm32/cpu_common.c b/cpu/stm32/cpu_common.c index 8820f2cdf3..a42207d6ca 100644 --- a/cpu/stm32/cpu_common.c +++ b/cpu/stm32/cpu_common.c @@ -72,13 +72,19 @@ void periph_clk_en(bus_t bus, uint32_t mask) RCC->APB1ENR1 |= mask; #elif defined(CPU_FAM_STM32G0) RCC->APBENR1 |= mask; +#elif defined(CPU_FAM_STM32MP1) + RCC->MC_APB1ENSETR |= mask; #else RCC->APB1ENR |= mask; #endif break; #if !defined(CPU_FAM_STM32G0) case APB2: +#if defined(CPU_FAM_STM32MP1) + RCC->MC_APB2ENSETR |= mask; +#else RCC->APB2ENR |= mask; +#endif break; #endif #if defined(CPU_FAM_STM32L4) || defined(CPU_FAM_STM32WB) || \ @@ -119,6 +125,11 @@ void periph_clk_en(bus_t bus, uint32_t mask) RCC->AHB3ENR |= mask; break; #endif +#endif +#if defined(CPU_FAM_STM32MP1) + case AHB4: + RCC->MC_AHB4ENSETR |= mask; + break; #endif default: DEBUG("unsupported bus %d\n", (int)bus); @@ -137,13 +148,20 @@ void periph_clk_dis(bus_t bus, uint32_t mask) RCC->APB1ENR1 &= ~(mask); #elif defined(CPU_FAM_STM32G0) RCC->APBENR1 &= ~(mask); +#elif defined(CPU_FAM_STM32MP1) + /* Write 1 to clear */ + RCC->MC_APB1ENCLRR |= mask; #else RCC->APB1ENR &= ~(mask); #endif break; #if !defined(CPU_FAM_STM32G0) case APB2: +#if defined(CPU_FAM_STM32MP1) + RCC->MC_APB2ENCLRR |= mask; +#else RCC->APB2ENR &= ~(mask); +#endif break; #endif #if defined(CPU_FAM_STM32L4) || defined(CPU_FAM_STM32WB) || \ diff --git a/cpu/stm32/include/periph_cpu.h b/cpu/stm32/include/periph_cpu.h index ad5b7230b8..3f211454a0 100644 --- a/cpu/stm32/include/periph_cpu.h +++ b/cpu/stm32/include/periph_cpu.h @@ -191,10 +191,14 @@ typedef enum { AHB1, /**< AHB1 bus */ AHB2, /**< AHB2 bus */ AHB3, /**< AHB3 bus */ +#elif defined(CPU_FAM_STM32MP1) + AHB1, /**< AHB1 bus */ + AHB2, /**< AHB2 bus */ + AHB3, /**< AHB3 bus */ #else #warning "unsupported stm32XX family" #endif -#if defined(CPU_FAM_STM32WB) +#if defined(CPU_FAM_STM32WB) || defined(CPU_FAM_STM32MP1) AHB4, /**< AHB4 bus */ #endif } bus_t;