stm32: Move clock line mapping from stm32h7_adc.c to lookup_clock_line()

Use the common lookup_clock_line() code to lookup the adc clock lines.
This also enables resets on the adc1/adc2 hardware block.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor
2022-12-13 12:36:26 -05:00
parent 1034f19134
commit cef0b70c88
4 changed files with 14 additions and 17 deletions

View File

@@ -40,6 +40,9 @@ lookup_clock_line(uint32_t periph_base)
uint32_t bit = 1 << ((periph_base - D2_AHB2PERIPH_BASE) / 0x400);
return (struct cline){.en=&RCC->AHB2ENR, .rst=&RCC->AHB2RSTR, .bit=bit};
} else if (periph_base >= D2_AHB1PERIPH_BASE) {
if (periph_base == ADC12_COMMON_BASE)
return (struct cline){.en = &RCC->AHB1ENR, .rst = &RCC->AHB1RSTR,
.bit = RCC_AHB1ENR_ADC12EN};
uint32_t bit = 1 << ((periph_base - D2_AHB1PERIPH_BASE) / 0x400);
return (struct cline){.en=&RCC->AHB1ENR, .rst=&RCC->AHB1RSTR, .bit=bit};
} else if (periph_base >= D2_APB2PERIPH_BASE) {