diff options
Diffstat (limited to 'os/hal')
-rw-r--r-- | os/hal/platforms/SPC564Axx/hal_lld.c | 13 | ||||
-rw-r--r-- | os/hal/platforms/SPC564Axx/hal_lld.h | 9 |
2 files changed, 16 insertions, 6 deletions
diff --git a/os/hal/platforms/SPC564Axx/hal_lld.c b/os/hal/platforms/SPC564Axx/hal_lld.c index 2115116c4..c6c67ba31 100644 --- a/os/hal/platforms/SPC564Axx/hal_lld.c +++ b/os/hal/platforms/SPC564Axx/hal_lld.c @@ -53,12 +53,6 @@ void hal_lld_init(void) {
uint32_t n;
- /* FLASH wait states and prefetching setup.*/
- FLASH_A.BIUCR.R = SPC5_FLASH_BIUCR | SPC5_FLASH_WS;
- FLASH_A.BIUCR2.R = 0;
- FLASH_B.BIUCR.R = SPC5_FLASH_BIUCR | SPC5_FLASH_WS;
- FLASH_B.BIUCR2.R = 0;
-
/* The SRAM is parked on the load/store port, for some unknown reason it
is defaulted on the instructions port and this kills performance.*/
XBAR.SGPCR2.B.PARK = 1; /* RAM slave on load/store port.*/
@@ -110,6 +104,13 @@ void hal_lld_init(void) { */
void spc_clock_init(void) {
+ /* Setting up RAM/Flash wait states and the prefetching bits.*/
+ ECSM.MUDCR.R = SPC5_RAM_WS;
+ FLASH_A.BIUCR.R = SPC5_FLASH_BIUCR | SPC5_FLASH_WS;
+ FLASH_A.BIUCR2.R = 0;
+ FLASH_B.BIUCR.R = SPC5_FLASH_BIUCR | SPC5_FLASH_WS;
+ FLASH_B.BIUCR2.R = 0;
+
#if !SPC5_NO_INIT
/* PLL activation.*/
FMPLL.ESYNCR1.B.EMODE = 1; /* Enhanced mode on. */
diff --git a/os/hal/platforms/SPC564Axx/hal_lld.h b/os/hal/platforms/SPC564Axx/hal_lld.h index d2ee43f55..5612c3954 100644 --- a/os/hal/platforms/SPC564Axx/hal_lld.h +++ b/os/hal/platforms/SPC564Axx/hal_lld.h @@ -241,6 +241,15 @@ #define SPC5_FLASH_WS (BIUCR_APC_4 | BIUCR_RWSC_4 | BIUCR_WWSC_3)
#endif
+/**
+ * @brief RAM wait states are a function of the system clock.
+ */
+#if (SPC5_SYSCLK <= 98000000) || defined(__DOXYGEN__)
+#define SPC5_RAM_WS 0
+#else
+#define SPC5_RAM_WS 0x40000000
+#endif
+
/*===========================================================================*/
/* Driver data structures and types. */
/*===========================================================================*/
|