summaryrefslogtreecommitdiff
path: root/chip/stm32/system.c
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2013-06-27 11:00:41 -0700
committerChromeBot <chrome-bot@google.com>2013-07-01 10:19:49 -0700
commitd3dffe253213fd7fa75fe6ef1c14b32629ca30c6 (patch)
treea79271df4eacf1a5b35a35d9bf2ba510d22d95f8 /chip/stm32/system.c
parent61820ceb435917607107674cd0eb888598072dbf (diff)
downloadchrome-ec-d3dffe253213fd7fa75fe6ef1c14b32629ca30c6.tar.gz
stm32: Add CHIP_FAMILY defines
Previously, code which needed to work on all STM32F platforms needed to specify them by name (CHIP_VARIANT_stm32f100 || CHIP_VARIANT_stm32f10x), and we needed extra symlinks in the chip/stm32/ directory to allow the build system to find family-specific files. Add a CHIP_FAMILY level of abstraction, so that things which are common across all STM32F platforms don't need to specify every STM32F variant. Make the chip build look for family-specific filenames instead of variant-specific filenames (except for config*.h, which is actually variant specific). In the few places where things actually are variant-specific, keep using the existing CHIP_VARIANT defines. Code refactoring only; no functional changes. BUG=chrome-os-partner:20567 BRANCH=none TEST=build all platforms Change-Id: I1da831aadabf8b8dd9dfde423cac13c9f43eb953 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/60247 Reviewed-by: David Hendricks <dhendrix@chromium.org> Reviewed-by: Vic Yang <victoryang@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'chip/stm32/system.c')
-rw-r--r--chip/stm32/system.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/chip/stm32/system.c b/chip/stm32/system.c
index 0530624b06..746cbd8001 100644
--- a/chip/stm32/system.c
+++ b/chip/stm32/system.c
@@ -151,14 +151,14 @@ void system_pre_init(void)
while (!(STM32_RCC_CSR & (1 << 1)))
;
/* re-configure RTC if needed */
-#if defined(CHIP_VARIANT_stm32l15x)
+#ifdef CHIP_FAMILY_stm32l
if ((STM32_RCC_CSR & 0x00C30000) != 0x00420000) {
/* the RTC settings are bad, we need to reset it */
STM32_RCC_CSR |= 0x00800000;
/* Enable RTC and use LSI as clock source */
STM32_RCC_CSR = (STM32_RCC_CSR & ~0x00C30000) | 0x00420000;
}
-#elif defined(CHIP_VARIANT_stm32f100) || defined(CHIP_VARIANT_stm32f10x)
+#elif defined(CHIP_FAMILY_stm32f)
if ((STM32_RCC_BDCR & 0x00018300) != 0x00008200) {
/* the RTC settings are bad, we need to reset it */
STM32_RCC_BDCR |= 0x00010000;
@@ -166,7 +166,7 @@ void system_pre_init(void)
STM32_RCC_BDCR = (STM32_RCC_BDCR & ~0x00018300) | 0x00008200;
}
#else
-#error "Unsupported chip variant"
+#error "Unsupported chip family"
#endif
check_reset_cause();
@@ -203,7 +203,7 @@ void system_reset(int flags)
if (flags & SYSTEM_RESET_HARD) {
-#ifdef CHIP_VARIANT_stm32l15x
+#ifdef CHIP_FAMILY_stm32l
/*
* Ask the flash module to reboot, so that we reload the
* option bytes.