File indexing completed on 2025-05-11 08:23:53
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036 #include <rtems/counter.h>
0037
0038 #include <libchip/ns16550.h>
0039
0040 #include <libcpu/powerpc-utility.h>
0041
0042 #include <bsp.h>
0043 #include <bsp/vectors.h>
0044 #include <bsp/bootcard.h>
0045 #include <bsp/irq-generic.h>
0046 #include <bsp/linker-symbols.h>
0047 #include <bsp/u-boot.h>
0048 #include <bsp/console-termios.h>
0049
0050
0051 unsigned int BSP_bus_frequency;
0052
0053
0054 uint32_t bsp_time_base_frequency;
0055
0056
0057 uint32_t bsp_clicks_per_usec;
0058
0059
0060 static int mpc83xx_decrementer_exception_handler( BSP_Exception_frame *frame, unsigned number)
0061 {
0062 ppc_set_decrementer_register(UINT32_MAX);
0063
0064 return 0;
0065 }
0066
0067 uint32_t _CPU_Counter_frequency(void)
0068 {
0069 return bsp_time_base_frequency;
0070 }
0071
0072 void bsp_start( void)
0073 {
0074 rtems_status_code sc = RTEMS_SUCCESSFUL;
0075 unsigned long i = 0;
0076
0077
0078
0079
0080
0081 get_ppc_cpu_type();
0082 get_ppc_cpu_revision();
0083
0084
0085 cpu_init();
0086
0087
0088
0089
0090
0091 #ifdef BSP_INSTRUCTION_CACHE_ENABLED
0092 rtems_cache_enable_instruction();
0093 #endif
0094
0095 #ifdef BSP_DATA_CACHE_ENABLED
0096 rtems_cache_enable_data();
0097 #endif
0098
0099
0100
0101
0102
0103
0104
0105
0106 #ifdef HAS_UBOOT
0107 BSP_bus_frequency = bsp_uboot_board_info.bi_busfreq;
0108 #else
0109 BSP_bus_frequency = BSP_CLKIN_FRQ * BSP_SYSPLL_MF / BSP_SYSPLL_CKID;
0110 #endif
0111 bsp_time_base_frequency = BSP_bus_frequency / 4;
0112 bsp_clicks_per_usec = bsp_time_base_frequency / 1000000;
0113
0114
0115 for (i = 0; i < console_device_count; ++i) {
0116 ns16550_context *ctx = (ns16550_context *) console_device_table[i].context;
0117
0118 ctx->clock = BSP_bus_frequency;
0119
0120 #ifdef HAS_UBOOT
0121 ctx->initial_baud = bsp_uboot_board_info.bi_baudrate;
0122 #endif
0123 }
0124
0125
0126 #ifndef BSP_DATA_CACHE_ENABLED
0127 ppc_exc_cache_wb_check = 0;
0128 #endif
0129 ppc_exc_initialize();
0130
0131
0132 sc = ppc_exc_set_handler( ASM_DEC_VECTOR, mpc83xx_decrementer_exception_handler);
0133 if (sc != RTEMS_SUCCESSFUL) {
0134 rtems_panic("cannot install decrementer exception handler");
0135 }
0136
0137
0138 bsp_interrupt_initialize();
0139
0140 #ifdef SHOW_MORE_INIT_SETTINGS
0141 printk("Exit from bspstart\n");
0142 #endif
0143 }