summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJes B. Klinke <jbk@chromium.org>2021-08-30 14:52:26 -0700
committerCommit Bot <commit-bot@chromium.org>2021-09-08 18:57:36 +0000
commitf2af0a3a74192876fc1b72706813d756393da167 (patch)
treea53007357e2be115dab1aace09365a4845e109af /include
parentf351c02b70c6a7d2137d3770e11e7c3a3850a1c8 (diff)
downloadchrome-ec-f2af0a3a74192876fc1b72706813d756393da167.tar.gz
chip/stm32: Factor family specific clock logic out of usb.c
The register for enabling USB register clock appears to have been identical across F0, F3, and G4 families, but for L5 it is different. Rather than having #ifdef in usb.c (as I recently committed), this CL will move the clock logic into clock_enable_module() where it arguably belonged all the time. Additionally: Some of the chip families make use of a clock_mask in their implementation of clock_enable_module(), but since the module_id enum has more than 32 value, until now, some values (among those MODULE_USB) would result in overflow, causing new_mask to be identical to clock_mask, and the USB case could have never been reached. BUG=b:192262089 TEST=Compile servo_v4 without linker errors BRANCH=none Signed-off-by: Jes Bodi Klinke <jbk@chromium.org> Change-Id: I7c29339f45eb513e3e78f662797a70543912c8c7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3130733 Reviewed-by: Scott Collyer <scollyer@chromium.org>
Diffstat (limited to 'include')
-rw-r--r--include/clock.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/clock.h b/include/clock.h
index acbd3fbcf5..c64cfe4db5 100644
--- a/include/clock.h
+++ b/include/clock.h
@@ -37,6 +37,13 @@ int clock_get_freq(void);
void clock_enable_module(enum module_id module, int enable);
/**
+ * Query whether clock is enabled for given module.
+ *
+ * @return Non-zero if enabled, zero if disabled.
+ */
+int clock_is_module_enabled(enum module_id module);
+
+/**
* Enable or disable the PLL.
*
* @param enable Enable PLL if non-zero; disable if zero.