|
27 | 27 |
|
28 | 28 | /* PolarFire SoC MPFS250T board specific configuration */ |
29 | 29 |
|
30 | | -/* APB/AHB Clock Frequency |
31 | | - * M-mode (out of reset): 40 MHz |
32 | | - * S-mode (after HSS): 150 MHz |
| 30 | +/* APB/AHB Peripheral Bus Clock Frequency (used for UART baud rate divisor) |
| 31 | + * M-mode (out of reset, no PLL): 40 MHz |
| 32 | + * S-mode (after HSS configures PLL): 150 MHz |
33 | 33 | */ |
34 | 34 | #ifndef MSS_APB_AHB_CLK |
35 | 35 | #ifdef WOLFBOOT_RISCV_MMODE |
|
39 | 39 | #endif |
40 | 40 | #endif |
41 | 41 |
|
| 42 | +/* CPU Core Clock Frequency (used for mcycle-based benchmarking) |
| 43 | + * The E51 core runs at 2x the APB bus clock on reset. |
| 44 | + * After HSS configures the PLL, CPU runs at 600 MHz. */ |
| 45 | +#ifndef MSS_CPU_CLK |
| 46 | + #ifdef WOLFBOOT_RISCV_MMODE |
| 47 | + #define MSS_CPU_CLK (MSS_APB_AHB_CLK * 2) |
| 48 | + #else |
| 49 | + #define MSS_CPU_CLK 600000000 |
| 50 | + #endif |
| 51 | +#endif |
| 52 | + |
42 | 53 | /* Hardware Base Address */ |
43 | 54 | #define SYSREG_BASE 0x20002000 |
44 | 55 |
|
@@ -327,6 +338,14 @@ int mpfs_read_serial_number(uint8_t *serial); |
327 | 338 | /* RTC Clock Frequency (1 MHz after divisor) */ |
328 | 339 | #define RTC_CLOCK_FREQ 1000000UL |
329 | 340 |
|
| 341 | +/* Timer frequency for hal_get_timer_us(). |
| 342 | + * In M-mode: CLINT MTIME is not running without HSS, so hal_get_timer() |
| 343 | + * reads mcycle (CPU cycle counter) instead. Set frequency to CPU clock. |
| 344 | + * In S-mode: MTIME runs at 1 MHz (default RISCV_SMODE_TIMER_FREQ). */ |
| 345 | +#if defined(WOLFBOOT_RISCV_MMODE) && !defined(RISCV_SMODE_TIMER_FREQ) |
| 346 | +#define RISCV_SMODE_TIMER_FREQ MSS_CPU_CLK |
| 347 | +#endif |
| 348 | + |
330 | 349 |
|
331 | 350 | /* ============================================================================ |
332 | 351 | * Hart Local Storage (HLS) - Per-hart communication structure |
|
0 commit comments