Skip to content

Commit 806ea80

Browse files
committed
refactor(i3c): delegate kernel clock source selection to variant clock config
Signed-off-by: Aymane Bahssain <aymane.bahssain@st.com>
1 parent 5c1e148 commit 806ea80

1 file changed

Lines changed: 4 additions & 29 deletions

File tree

‎libraries/I3C/src/I3C.cpp‎

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -140,42 +140,17 @@ bool I3CBus::initGPIO()
140140
bool I3CBus::initClocks()
141141
{
142142
bool result = false;
143-
HAL_StatusTypeDef hal_status = HAL_OK;
144143

145144
if (_instance == I3C1) {
146145
#if defined(I3C1)
147-
RCC_PeriphCLKInitTypeDef PeriphClkInit {};
148-
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_I3C1;
149-
#if defined(RCC_I3C1CLKSOURCE_PCLK1)
150-
PeriphClkInit.I3c1ClockSelection = RCC_I3C1CLKSOURCE_PCLK1;
151-
#else
152-
#error "I3C1: no known PCLK source"
153-
#endif
154-
155-
hal_status = HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit);
156-
if (hal_status == HAL_OK) {
157-
__HAL_RCC_I3C1_CLK_ENABLE();
158-
result = true;
159-
}
146+
__HAL_RCC_I3C1_CLK_ENABLE();
147+
result = true;
160148
#endif
161149
}
162150
#if defined(I3C2)
163151
else if (_instance == I3C2) {
164-
RCC_PeriphCLKInitTypeDef PeriphClkInit {};
165-
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_I3C2;
166-
#if defined(RCC_I3C2CLKSOURCE_PCLK2)
167-
PeriphClkInit.I3c2ClockSelection = RCC_I3C2CLKSOURCE_PCLK2;
168-
#elif defined(RCC_I3C2CLKSOURCE_PCLK3)
169-
PeriphClkInit.I3c2ClockSelection = RCC_I3C2CLKSOURCE_PCLK3;
170-
#else
171-
#error "I3C2: no known PCLK source"
172-
#endif
173-
174-
hal_status = HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit);
175-
if (hal_status == HAL_OK) {
176-
__HAL_RCC_I3C2_CLK_ENABLE();
177-
result = true;
178-
}
152+
__HAL_RCC_I3C2_CLK_ENABLE();
153+
result = true;
179154
}
180155
#endif
181156

0 commit comments

Comments
 (0)