From 94fd599ac99ba0bd260755fdb27d7c140de58eb8 Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Fri, 25 Nov 2011 05:21:32 -0300 Subject: [PATCH] m1/patches: added soc11_2.diff posted by Sebastien on Nov 23 --- m1/patches/rtems/milkymist-map-sysfreq.patch | 86 ++++++++++++++++++++ m1/patches/rtems/series | 1 + 2 files changed, 87 insertions(+) create mode 100644 m1/patches/rtems/milkymist-map-sysfreq.patch diff --git a/m1/patches/rtems/milkymist-map-sysfreq.patch b/m1/patches/rtems/milkymist-map-sysfreq.patch new file mode 100644 index 0000000..2f3d441 --- /dev/null +++ b/m1/patches/rtems/milkymist-map-sysfreq.patch @@ -0,0 +1,86 @@ +From: S?bastien Bourdeauducq +Subject: [Milkymist-devel] RTEMS support patch for new address map + + readable system frequency + +Index: rtems/c/src/lib/libbsp/lm32/milkymist/include/system_conf.h +=================================================================== +--- rtems.orig/c/src/lib/libbsp/lm32/milkymist/include/system_conf.h 2011-11-25 05:05:51.000000000 -0300 ++++ rtems/c/src/lib/libbsp/lm32/milkymist/include/system_conf.h 2011-11-25 05:18:11.000000000 -0300 +@@ -15,9 +15,11 @@ + #ifndef __SYSTEM_CONFIG_H_ + #define __SYSTEM_CONFIG_H_ + +-#define CPU_FREQUENCY (80000000) + #define UART_BAUD_RATE (115200) + ++/* Clock frequency */ ++#define MM_FREQUENCY (0xe0001074) ++ + /* FML bridge */ + #define FMLBRG_FLUSH_BASE (0xc8000000) + #define FMLBRG_LINE_LENGTH (32) +@@ -65,10 +67,10 @@ + #define GPIO_LED2 (0x00000002) + + /* System ID and reset */ +-#define MM_SYSTEM_ID (0xe000103c) ++#define MM_SYSTEM_ID (0xe000107c) + + /* ICAP */ +-#define MM_ICAP (0xe0001034) ++#define MM_ICAP (0xe0001040) + + #define ICAP_READY (0x01) + #define ICAP_CE (0x10000) +Index: rtems/c/src/lib/libbsp/lm32/shared/milkymist_clock/ckinit.c +=================================================================== +--- rtems.orig/c/src/lib/libbsp/lm32/shared/milkymist_clock/ckinit.c 2011-08-01 10:48:39.000000000 -0300 ++++ rtems/c/src/lib/libbsp/lm32/shared/milkymist_clock/ckinit.c 2011-11-25 05:18:11.000000000 -0300 +@@ -35,7 +35,7 @@ + void Clock_driver_support_initialize_hardware(void) + { + MM_WRITE(MM_TIMER0_COMPARE, +- (CPU_FREQUENCY/(1000000/rtems_configuration_get_microseconds_per_tick()))); ++ (MM_READ(MM_FREQUENCY)/(1000000/rtems_configuration_get_microseconds_per_tick()))); + MM_WRITE(MM_TIMER0_COUNTER, 0); + MM_WRITE(MM_TIMER0_CONTROL, TIMER_ENABLE | TIMER_AUTORESTART); + bsp_interrupt_vector_enable(MM_IRQ_TIMER0); +Index: rtems/c/src/lib/libbsp/lm32/shared/milkymist_console/console.c +=================================================================== +--- rtems.orig/c/src/lib/libbsp/lm32/shared/milkymist_console/console.c 2011-11-25 05:05:51.000000000 -0300 ++++ rtems/c/src/lib/libbsp/lm32/shared/milkymist_console/console.c 2011-11-25 05:18:11.000000000 -0300 +@@ -109,7 +109,7 @@ + } + + if (baud > 0) +- MM_WRITE(MM_UART_DIV, CPU_FREQUENCY/baud/16); ++ MM_WRITE(MM_UART_DIV, MM_READ(MM_FREQUENCY)/baud/16); + + return 0; + } +Index: rtems/c/src/lib/libbsp/lm32/shared/milkymist_console/uart.c +=================================================================== +--- rtems.orig/c/src/lib/libbsp/lm32/shared/milkymist_console/uart.c 2011-11-25 05:05:51.000000000 -0300 ++++ rtems/c/src/lib/libbsp/lm32/shared/milkymist_console/uart.c 2011-11-25 05:18:11.000000000 -0300 +@@ -19,7 +19,7 @@ + + void BSP_uart_init(int baud) + { +- MM_WRITE(MM_UART_DIV, CPU_FREQUENCY/baud/16); ++ MM_WRITE(MM_UART_DIV, MM_READ(MM_FREQUENCY)/baud/16); + } + + void BSP_uart_polled_write(char ch) +Index: rtems/c/src/lib/libbsp/lm32/shared/milkymist_timer/timer.c +=================================================================== +--- rtems.orig/c/src/lib/libbsp/lm32/shared/milkymist_timer/timer.c 2011-08-01 10:48:40.000000000 -0300 ++++ rtems/c/src/lib/libbsp/lm32/shared/milkymist_timer/timer.c 2011-11-25 05:18:11.000000000 -0300 +@@ -58,7 +58,7 @@ + if (ticks == 0xffffffff) + printk("Timer overflow!\n"); + +- total = ticks / (CPU_FREQUENCY / 1000000); ++ total = ticks / (MM_READ(MM_FREQUENCY) / 1000000); + + if (benchmark_timer_find_average_overhead) + return total; diff --git a/m1/patches/rtems/series b/m1/patches/rtems/series index ed6bc08..9545037 100644 --- a/m1/patches/rtems/series +++ b/m1/patches/rtems/series @@ -4,3 +4,4 @@ chain-first-last.patch coremsgsubmit-race.patch milkymist-new-uart.patch fix-sysconf-includes.patch +milkymist-map-sysfreq.patch