Changeset 26853a06 in rtems
- Timestamp:
- 03/15/23 13:41:53 (7 months ago)
- Branches:
- master
- Children:
- 4021b87
- Parents:
- ca1c4e70
- git-author:
- Alan Cudmore <alan.cudmore@…> (03/15/23 13:41:53)
- git-committer:
- Joel Sherrill <joel@…> (03/28/23 19:04:04)
- Location:
- bsps/riscv/riscv
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
bsps/riscv/riscv/console/console-config.c
rca1c4e70 r26853a06 56 56 #include <string.h> 57 57 58 #if RISCV_ENABLE_ FRDME310ARTY_SUPPORT != 058 #if RISCV_ENABLE_SIFIVE_UART_SUPPORT != 0 59 59 #include <bsp/fe310-uart.h> 60 60 static fe310_uart_context fe310_uart_instance; … … 240 240 #endif 241 241 242 #if RISCV_ENABLE_ FRDME310ARTY_SUPPORT != 0242 #if RISCV_ENABLE_SIFIVE_UART_SUPPORT != 0 243 243 if (fdt_stringlist_contains(compat, compat_len, "sifive,uart0")) { 244 244 fe310_uart_context *ctx; … … 256 256 } 257 257 258 rtems_termios_device_context_initialize(&ctx->base, " FE310UART");258 rtems_termios_device_context_initialize(&ctx->base, "SIFIVEUART"); 259 259 } 260 260 #endif … … 291 291 #endif 292 292 293 #if RISCV_ENABLE_ FRDME310ARTY_SUPPORT != 0293 #if RISCV_ENABLE_SIFIVE_UART_SUPPORT != 0 294 294 fe310_uart_context *ctx; 295 295 char fe310_path[] = "/dev/ttyS0"; … … 327 327 #endif 328 328 329 #if RISCV_ENABLE_ FRDME310ARTY_SUPPORT != 0329 #if RISCV_ENABLE_SIFIVE_UART_SUPPORT != 0 330 330 ctx = &fe310_uart_instance; 331 331 rtems_termios_device_install( -
bsps/riscv/riscv/console/fe310-uart.c
rca1c4e70 r26853a06 54 54 size_t i; 55 55 56 ctx->regs->div = riscv_get_core_frequency() / 115200 - 1;56 ctx->regs->div = (riscv_get_core_frequency() / 115200 - 1) & 0xFFFF; 57 57 ctx->regs->txctrl |= 1; 58 58 ctx->regs->rxctrl |= 1; -
bsps/riscv/riscv/include/bsp.h
rca1c4e70 r26853a06 61 61 #include <rtems/devnull.h> 62 62 63 #if RISCV_ENABLE_KENDRYTE_K210_SUPPORT != 0 64 #include <bsp/k210.h> 65 #endif 66 63 67 #ifdef __cplusplus 64 68 extern "C" { -
bsps/riscv/riscv/include/bsp/riscv.h
rca1c4e70 r26853a06 57 57 #endif 58 58 59 #if RISCV_ENABLE_KENDRYTE_K210_SUPPORT != 0 60 uint32_t k210_get_frequency(void); 61 #endif 62 59 63 #ifdef __cplusplus 60 64 } -
bsps/riscv/riscv/start/bspstart.c
rca1c4e70 r26853a06 210 210 } 211 211 #endif 212 213 #if RISCV_ENABLE_KENDRYTE_K210_SUPPORT != 0 214 uint32_t cpu_clock; 215 216 cpu_clock = k210_get_frequency(); 217 return cpu_clock; 218 #else 212 219 return 0; 220 #endif 221 213 222 } 214 223 … … 223 232 return RISCV_INTERRUPT_VECTOR_EXTERNAL(intr[0]); 224 233 } 234 235 #if RISCV_ENABLE_KENDRYTE_K210_SUPPORT != 0 236 uint32_t k210_get_frequency(void) 237 { 238 k210_sysctl_t *sysctl = (k210_sysctl_t *)K210_SYSCTL_BASE; 239 uint32_t cpu_clock = 0; 240 uint32_t clk_freq; 241 uint32_t pll0, nr, nf, od; 242 uint32_t node; 243 const char *fdt; 244 const fdt32_t *val; 245 int len; 246 247 fdt = bsp_fdt_get(); 248 node = fdt_node_offset_by_compatible(fdt, -1,"fixed-clock"); 249 val = fdt_getprop(fdt, node, "clock-frequency", &len); 250 if (val != NULL && len == 4) { 251 clk_freq = fdt32_to_cpu(*val); 252 253 if (CLKSEL0_ACLK_SEL(sysctl->clk_sel0) == 1) { 254 /* PLL0 selected */ 255 pll0 = sysctl->pll0; 256 nr = PLL_CLK_R(pll0) + 1; 257 nf = PLL_CLK_F(pll0) + 1; 258 od = PLL_CLK_OD(pll0) + 1; 259 cpu_clock = (clk_freq / nr * nf / od)/2; 260 } else { 261 /* OSC selected */ 262 cpu_clock = clk_freq; 263 } 264 } 265 return cpu_clock; 266 } 267 #endif 225 268 226 269 void bsp_start(void)
Note: See TracChangeset
for help on using the changeset viewer.