[rtems commit] bsp/qoriq: Remove legacy U-Boot support

Sebastian Huber sebh at rtems.org
Thu Jul 28 10:06:55 UTC 2016


Module:    rtems
Branch:    master
Commit:    f383f4bf6eae799794f5cc3eff76a592243d69c8
Changeset: http://git.rtems.org/rtems/commit/?id=f383f4bf6eae799794f5cc3eff76a592243d69c8

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Wed Jul 27 11:39:56 2016 +0200

bsp/qoriq: Remove legacy U-Boot support

---

 c/src/lib/libbsp/powerpc/qoriq/Makefile.am         |  7 --
 c/src/lib/libbsp/powerpc/qoriq/README              | 14 ++--
 c/src/lib/libbsp/powerpc/qoriq/configure.ac        | 40 +----------
 .../libbsp/powerpc/qoriq/include/u-boot-config.h   | 26 -------
 c/src/lib/libbsp/powerpc/qoriq/network/network.c   |  1 -
 c/src/lib/libbsp/powerpc/qoriq/preinstall.am       | 16 -----
 c/src/lib/libbsp/powerpc/qoriq/start/start.S       | 13 ++--
 c/src/lib/libbsp/powerpc/qoriq/startup/bspsmp.c    | 79 ++++++---------------
 c/src/lib/libbsp/powerpc/qoriq/startup/bspstart.c  | 81 +++++++++-------------
 9 files changed, 69 insertions(+), 208 deletions(-)

diff --git a/c/src/lib/libbsp/powerpc/qoriq/Makefile.am b/c/src/lib/libbsp/powerpc/qoriq/Makefile.am
index f834aa8..1416a20 100644
--- a/c/src/lib/libbsp/powerpc/qoriq/Makefile.am
+++ b/c/src/lib/libbsp/powerpc/qoriq/Makefile.am
@@ -23,15 +23,11 @@ include_bsp_HEADERS = include/irq.h \
 	../../shared/include/irq-info.h \
 	../../shared/include/bootcard.h \
 	../../shared/include/fdt.h \
-	../../shared/include/u-boot.h \
 	../../shared/include/utility.h \
-	../shared/include/u-boot-board-info.h \
-	../shared/include/u-boot-generic-board-info.h \
 	../shared/include/start.h \
 	../shared/include/tictac.h \
 	../shared/include/linker-symbols.h \
 	include/tsec-config.h \
-	include/u-boot-config.h \
 	include/mmu.h \
 	include/intercom.h \
 	include/uart-bridge.h \
@@ -63,13 +59,10 @@ libbsp_a_SOURCES += \
 	../../shared/bspclean.c \
 	../../shared/bspgetworkarea.c \
 	../../shared/src/bsp-fdt.c \
-	../../shared/src/bsp-uboot-board-info.c \
 	../shared/src/ppc-exc-handler-table.c \
 	../shared/src/tictac.c \
 	../shared/src/bsp-start-zero.S \
 	../shared/startup/bspidle.c \
-	../shared/uboot_getenv.c \
-	../shared/uboot_dump_bdinfo.c \
 	startup/l1cache.S \
 	startup/l2cache.S \
 	startup/mmu.c \
diff --git a/c/src/lib/libbsp/powerpc/qoriq/README b/c/src/lib/libbsp/powerpc/qoriq/README
index 1a6794b..2e255bf 100644
--- a/c/src/lib/libbsp/powerpc/qoriq/README
+++ b/c/src/lib/libbsp/powerpc/qoriq/README
@@ -2,15 +2,17 @@ Board support package for the Freescale QorIQ platform:
 
   http://en.wikipedia.org/wiki/QorIQ
 
-Development boards P1020RDB, T2080RDB and T4240RDB.
+Boards known to work P1020RDB, MVME2500, T2080RDB and T4240RDB.
 
-For the T series boot via U-Boot is mandatory since the FDT is used.  Use
+Boot via U-Boot and FDT support is mandatory.  Use
 
   mkimage -A ppc -O linux -T kernel -a 0x4000 -e 0x4000 -n RTEMS -d app.bin.gz app.img
 
-to create a bootable image.  You must use the "linux" image type.  Boot it for
-example via the
+to create a bootable image.  You must use the "linux" image type to enable the
+dynamic FDT adjustment by U-Boot.  Boot it for example via the
 
-  bootm 0xe9000000 - 0xe8800000
+  tftp 1000000 app.img
+  tftp c00000 p1020rdb.dtb
+  bootm 1000000 - c00000
 
-U-Boot command.
+U-Boot commands.
diff --git a/c/src/lib/libbsp/powerpc/qoriq/configure.ac b/c/src/lib/libbsp/powerpc/qoriq/configure.ac
index 9e63763..1445a55 100644
--- a/c/src/lib/libbsp/powerpc/qoriq/configure.ac
+++ b/c/src/lib/libbsp/powerpc/qoriq/configure.ac
@@ -52,45 +52,12 @@ RTEMS_BSPOPTS_HELP([BSP_CONSOLE_BAUD],[default baud for console and other serial
 RTEMS_BSPOPTS_SET([BSP_USE_UART_INTERRUPTS],[*],[1])
 RTEMS_BSPOPTS_HELP([BSP_USE_UART_INTERRUPTS],[enable usage of interrupts for the UART modules])
 
-RTEMS_BSPOPTS_SET([U_BOOT_USE_FDT],[qoriq_t*],[1])
-RTEMS_BSPOPTS_SET([U_BOOT_USE_FDT],[*],[])
-RTEMS_BSPOPTS_HELP([U_BOOT_USE_FDT],[enables U-Boot support using FDT])
-
-RTEMS_BSPOPTS_SET([BSP_FDT_BLOB_SIZE_MAX],[qoriq_t*],[262144])
-RTEMS_BSPOPTS_SET([BSP_FDT_BLOB_SIZE_MAX],[*],[])
+RTEMS_BSPOPTS_SET([BSP_FDT_BLOB_SIZE_MAX],[*],[262144])
 RTEMS_BSPOPTS_HELP([BSP_FDT_BLOB_SIZE_MAX],[maximum size of the FDT blob in bytes])
 
-RTEMS_BSPOPTS_SET([BSP_FDT_BLOB_READ_ONLY],[qoriq_t*],[1])
-RTEMS_BSPOPTS_SET([BSP_FDT_BLOB_READ_ONLY],[*],[])
+RTEMS_BSPOPTS_SET([BSP_FDT_BLOB_READ_ONLY],[*],[1])
 RTEMS_BSPOPTS_HELP([BSP_FDT_BLOB_READ_ONLY],[place the FDT blob into the read-only data area])
 
-RTEMS_BSPOPTS_SET([HAS_UBOOT],[qoriq_t*],[])
-RTEMS_BSPOPTS_SET([HAS_UBOOT],[*],[1])
-RTEMS_BSPOPTS_HELP([HAS_UBOOT],[enables legacy U-Boot support without FDT])
-
-RTEMS_BSPOPTS_SET([U_BOOT_64_BIT_PHYS_SIZE],[qoriq_t*],[1])
-RTEMS_BSPOPTS_SET([U_BOOT_64_BIT_PHYS_SIZE],[*],[])
-RTEMS_BSPOPTS_HELP([U_BOOT_64_BIT_PHYS_SIZE],[if defined, then use uint64_t for phys_size_t (only used by legacy U-Boot support)])
-
-RTEMS_BSPOPTS_SET([U_BOOT_GENERIC_BOARD_INFO],[qoriq_t*],[1])
-RTEMS_BSPOPTS_SET([U_BOOT_GENERIC_BOARD_INFO],[*],[])
-RTEMS_BSPOPTS_HELP([U_BOOT_GENERIC_BOARD_INFO],[if defined, then use the generic bd_t structure (only used by legacy U-Boot support)])
-
-RTEMS_BSPOPTS_SET([U_BOOT_BOOT_PAGE_BEGIN],[qoriq_p2020*],[0x3fff0000])
-RTEMS_BSPOPTS_SET([U_BOOT_BOOT_PAGE_BEGIN],[qoriq_t*],[])
-RTEMS_BSPOPTS_SET([U_BOOT_BOOT_PAGE_BEGIN],[*],[0x1fff0000])
-RTEMS_BSPOPTS_HELP([U_BOOT_BOOT_PAGE_BEGIN],[the begin address of the boot page set up by U-Boot (only used by legacy U-Boot support)])
-
-RTEMS_BSPOPTS_SET([U_BOOT_BOOT_PAGE_LAST],[qoriq_p2020*],[0x3fffffff])
-RTEMS_BSPOPTS_SET([U_BOOT_BOOT_PAGE_LAST],[qoriq_t*],[])
-RTEMS_BSPOPTS_SET([U_BOOT_BOOT_PAGE_LAST],[*],[0x1fffffff])
-RTEMS_BSPOPTS_HELP([U_BOOT_BOOT_PAGE_LAST],[the last address of the boot page set up by U-Boot (only used by legacy U-Boot support)])
-
-RTEMS_BSPOPTS_SET([U_BOOT_BOOT_PAGE_SPIN_OFFSET],[qoriq_p2020*],[0xf240])
-RTEMS_BSPOPTS_SET([U_BOOT_BOOT_PAGE_SPIN_OFFSET],[qoriq_t*],[])
-RTEMS_BSPOPTS_SET([U_BOOT_BOOT_PAGE_SPIN_OFFSET],[*],[0xf2a0])
-RTEMS_BSPOPTS_HELP([U_BOOT_BOOT_PAGE_SPIN_OFFSET],[the offset to the spin table in the boot page set up by U-Boot (only used by legacy U-Boot support)])
-
 RTEMS_BSPOPTS_SET([QORIQ_CPU_COUNT],[qoriq_t*],[24])
 RTEMS_BSPOPTS_SET([QORIQ_CPU_COUNT],[*],[2])
 RTEMS_BSPOPTS_HELP([QORIQ_CPU_COUNT],[maximum virtual processor count])
@@ -133,9 +100,6 @@ RTEMS_BSPOPTS_SET([QORIQ_UART_BRIDGE_1_ENABLE],[qoriq_core_1],[1])
 RTEMS_BSPOPTS_SET([QORIQ_UART_BRIDGE_1_ENABLE],[*],[0])
 RTEMS_BSPOPTS_HELP([QORIQ_UART_BRIDGE_1_ENABLE],[use 1 to enable UART 1 to Intercom bridge, otherwise use 0])
 
-RTEMS_BSPOPTS_SET([BSP_DISABLE_UBOOT_WORK_AREA_CONFIG],[*],[1])
-RTEMS_BSPOPTS_HELP([BSP_DISABLE_UBOOT_WORK_AREA_CONFIG],[disable U-Boot work area configuration])
-
 RTEMS_BSPOPTS_SET([BSP_INTERRUPT_STACK_AT_WORK_AREA_BEGIN],[*],[1])
 RTEMS_BSPOPTS_HELP([BSP_INTERRUPT_STACK_AT_WORK_AREA_BEGIN],[indicate that the interrupt stack is at the work area begin])
 
diff --git a/c/src/lib/libbsp/powerpc/qoriq/include/u-boot-config.h b/c/src/lib/libbsp/powerpc/qoriq/include/u-boot-config.h
deleted file mode 100644
index 7f9ed73..0000000
--- a/c/src/lib/libbsp/powerpc/qoriq/include/u-boot-config.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright (c) 2010-2015 embedded brains GmbH.  All rights reserved.
- *
- *  embedded brains GmbH
- *  Dornierstr. 4
- *  82178 Puchheim
- *  Germany
- *  <rtems at embedded-brains.de>
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
- */
-
-#ifndef LIBBSP_POWERPC_QORIQ_U_BOOT_CONFIG_H
-#define LIBBSP_POWERPC_QORIQ_U_BOOT_CONFIG_H
-
-#include <bspopts.h>
-
-#define U_BOOT_BOARD_INFO_DATA_SECTION __attribute__((section(".bsp_start_data")))
-
-#define CONFIG_E500
-#define CONFIG_HAS_ETH1
-#define CONFIG_HAS_ETH2
-
-#endif /* LIBBSP_POWERPC_QORIQ_U_BOOT_CONFIG_H */
diff --git a/c/src/lib/libbsp/powerpc/qoriq/network/network.c b/c/src/lib/libbsp/powerpc/qoriq/network/network.c
index bbcfc8e..208b1a5 100644
--- a/c/src/lib/libbsp/powerpc/qoriq/network/network.c
+++ b/c/src/lib/libbsp/powerpc/qoriq/network/network.c
@@ -33,7 +33,6 @@
 
 #include <bsp.h>
 #include <bsp/tsec.h>
-#include <bsp/u-boot.h>
 #include <bsp/qoriq.h>
 
 #if QORIQ_CHIP_VARIANT == QORIQ_CHIP_P1020
diff --git a/c/src/lib/libbsp/powerpc/qoriq/preinstall.am b/c/src/lib/libbsp/powerpc/qoriq/preinstall.am
index 6a08135..bef78f1 100644
--- a/c/src/lib/libbsp/powerpc/qoriq/preinstall.am
+++ b/c/src/lib/libbsp/powerpc/qoriq/preinstall.am
@@ -73,22 +73,10 @@ $(PROJECT_INCLUDE)/bsp/fdt.h: ../../shared/include/fdt.h $(PROJECT_INCLUDE)/bsp/
 	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/fdt.h
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/fdt.h
 
-$(PROJECT_INCLUDE)/bsp/u-boot.h: ../../shared/include/u-boot.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
-	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/u-boot.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/u-boot.h
-
 $(PROJECT_INCLUDE)/bsp/utility.h: ../../shared/include/utility.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
 	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/utility.h
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/utility.h
 
-$(PROJECT_INCLUDE)/bsp/u-boot-board-info.h: ../shared/include/u-boot-board-info.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
-	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/u-boot-board-info.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/u-boot-board-info.h
-
-$(PROJECT_INCLUDE)/bsp/u-boot-generic-board-info.h: ../shared/include/u-boot-generic-board-info.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
-	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/u-boot-generic-board-info.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/u-boot-generic-board-info.h
-
 $(PROJECT_INCLUDE)/bsp/start.h: ../shared/include/start.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
 	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/start.h
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/start.h
@@ -105,10 +93,6 @@ $(PROJECT_INCLUDE)/bsp/tsec-config.h: include/tsec-config.h $(PROJECT_INCLUDE)/b
 	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/tsec-config.h
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/tsec-config.h
 
-$(PROJECT_INCLUDE)/bsp/u-boot-config.h: include/u-boot-config.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
-	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/u-boot-config.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/u-boot-config.h
-
 $(PROJECT_INCLUDE)/bsp/mmu.h: include/mmu.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
 	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/mmu.h
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/mmu.h
diff --git a/c/src/lib/libbsp/powerpc/qoriq/start/start.S b/c/src/lib/libbsp/powerpc/qoriq/start/start.S
index ba82bbc..7a50d20 100644
--- a/c/src/lib/libbsp/powerpc/qoriq/start/start.S
+++ b/c/src/lib/libbsp/powerpc/qoriq/start/start.S
@@ -51,14 +51,7 @@
 
 _start:
 	bl	.Linitearly
-
-#ifdef HAS_UBOOT
-	bl	bsp_uboot_copy_board_info
-#endif /* HAS_UBOOT */
-
-#ifdef U_BOOT_USE_FDT
 	bl	bsp_fdt_copy
-#endif /* U_BOOT_USE_FDT */
 
 #ifdef QORIQ_HAS_WRITE_BACK_L1_CACHE
 	LWI	r3, bsp_section_start_begin
@@ -152,8 +145,12 @@ _start:
 	beqlr
 	b	memcpy
 
-	/* Do not use r3 here, since this could be the U-Boot board info */
 .Linitearly:
+	/*
+	 * Do not use r3 here, since it holds the FDT base pointer provided by
+	 * the boot loader.
+	 */
+
 	/* Disable decrementer */
 	mfspr	r0, BOOKE_TCR
 	LWI	r4, BOOKE_TCR_DIE
diff --git a/c/src/lib/libbsp/powerpc/qoriq/startup/bspsmp.c b/c/src/lib/libbsp/powerpc/qoriq/startup/bspsmp.c
index 7bc7ec3..56bfa9f 100644
--- a/c/src/lib/libbsp/powerpc/qoriq/startup/bspsmp.c
+++ b/c/src/lib/libbsp/powerpc/qoriq/startup/bspsmp.c
@@ -44,16 +44,6 @@ void _start_secondary_processor(void);
 
 #define TLB_COUNT (TLB_END - TLB_BEGIN)
 
-#ifdef HAS_UBOOT
-  /*
-   * These values can be obtained with the debugger or a look into the U-Boot
-   * sources (arch/powerpc/cpu/mpc85xx/release.S).
-   */
-  #define BOOT_BEGIN U_BOOT_BOOT_PAGE_BEGIN
-  #define BOOT_LAST U_BOOT_BOOT_PAGE_LAST
-  #define SPIN_TABLE (BOOT_BEGIN + U_BOOT_BOOT_PAGE_SPIN_OFFSET)
-#endif
-
 #if QORIQ_THREAD_COUNT > 1
 static bool is_started_by_u_boot(uint32_t cpu_index)
 {
@@ -133,44 +123,27 @@ static void bsp_inter_processor_interrupt(void *arg)
 
 static uint32_t discover_processors(void)
 {
-#if defined(HAS_UBOOT)
-  return QORIQ_CPU_COUNT;
-#elif defined(U_BOOT_USE_FDT)
   const void *fdt = bsp_fdt_get();
   int cpus = fdt_path_offset(fdt, "/cpus");
   int node = fdt_first_subnode(fdt, cpus);
   uint32_t cpu = 0;
-  uintptr_t last = 0;
-  uintptr_t begin = last - 1;
 
-  while (node >= 0) {
+  while (node >= 0 && cpu < RTEMS_ARRAY_SIZE(qoriq_start_spin_table_addr)) {
     int len;
     fdt64_t *addr_fdt = (fdt64_t *)
       fdt_getprop(fdt, node, "cpu-release-addr", &len);
 
-    if (
-      addr_fdt != NULL
-        && cpu < RTEMS_ARRAY_SIZE(qoriq_start_spin_table_addr)
-    ) {
+    if (addr_fdt != NULL) {
       uintptr_t addr = (uintptr_t) fdt64_to_cpu(*addr_fdt);
 
-      if (addr < begin) {
-        begin = addr;
-      }
-
-      if (addr > last) {
-        last = addr;
-      }
-
       qoriq_start_spin_table_addr[cpu] = (qoriq_start_spin_table *) addr;
-      ++cpu;
     }
 
+    ++cpu;
     node = fdt_next_subnode(fdt, node);
   }
 
   return cpu * QORIQ_THREAD_COUNT;
-#endif
 }
 
 uint32_t _CPU_SMP_Initialize(void)
@@ -186,37 +159,33 @@ uint32_t _CPU_SMP_Initialize(void)
   return cpu_count;
 }
 
-static void release_processor(
+static bool release_processor(
   qoriq_start_spin_table *spin_table,
   uint32_t cpu_index
 )
 {
-  const Per_CPU_Control *cpu = _Per_CPU_Get_by_index(cpu_index);
-
-  spin_table->pir = cpu_index;
-  spin_table->r3_lower = (uint32_t) cpu->interrupt_stack_high;
-  spin_table->addr_upper = 0;
-  rtems_cache_flush_multiple_data_lines(spin_table, sizeof(*spin_table));
-  ppc_synchronize_data();
-  spin_table->addr_lower = (uint32_t) _start_secondary_processor;
-  rtems_cache_flush_multiple_data_lines(spin_table, sizeof(*spin_table));
+  bool spin_table_present = (spin_table != NULL);
+
+  if (spin_table_present) {
+    const Per_CPU_Control *cpu = _Per_CPU_Get_by_index(cpu_index);
+
+    spin_table->pir = cpu_index;
+    spin_table->r3_lower = (uint32_t) cpu->interrupt_stack_high;
+    spin_table->addr_upper = 0;
+    rtems_cache_flush_multiple_data_lines(spin_table, sizeof(*spin_table));
+    ppc_synchronize_data();
+    spin_table->addr_lower = (uint32_t) _start_secondary_processor;
+    rtems_cache_flush_multiple_data_lines(spin_table, sizeof(*spin_table));
+  }
+
+  return spin_table_present;
 }
 
 static qoriq_start_spin_table *get_spin_table(uint32_t cpu_index)
 {
   qoriq_start_spin_table *spin_table;
 
-#if defined(HAS_UBOOT)
-#if QORIQ_THREAD_COUNT > 1
-  spin_table = &((qoriq_start_spin_table *) SPIN_TABLE)[cpu_index / 2 - 1];
-  qoriq_start_spin_table_addr[cpu_index / 2 - 1] = spin_table;
-#else
-  spin_table = (qoriq_start_spin_table *) SPIN_TABLE;
-  qoriq_start_spin_table_addr[0] = spin_table;
-#endif
-#elif defined(U_BOOT_USE_FDT)
-  spin_table = qoriq_start_spin_table_addr[cpu_index / 2];
-#endif
+  spin_table = qoriq_start_spin_table_addr[cpu_index / QORIQ_THREAD_COUNT];
 
   return spin_table;
 }
@@ -227,18 +196,14 @@ bool _CPU_SMP_Start_processor(uint32_t cpu_index)
   if (is_started_by_u_boot(cpu_index)) {
     qoriq_start_spin_table *spin_table = get_spin_table(cpu_index);
 
-    release_processor(spin_table, cpu_index);
-
-    return true;
+    return release_processor(spin_table, cpu_index);
   } else {
     return _SMP_Should_start_processor(cpu_index - 1);
   }
 #else
   qoriq_start_spin_table *spin_table = get_spin_table(cpu_index);
 
-  release_processor(spin_table, cpu_index);
-
-  return true;
+  return release_processor(spin_table, cpu_index);
 #endif
 }
 
diff --git a/c/src/lib/libbsp/powerpc/qoriq/startup/bspstart.c b/c/src/lib/libbsp/powerpc/qoriq/startup/bspstart.c
index 4b02ff1..1b3c428 100644
--- a/c/src/lib/libbsp/powerpc/qoriq/startup/bspstart.c
+++ b/c/src/lib/libbsp/powerpc/qoriq/startup/bspstart.c
@@ -39,7 +39,6 @@
 #include <bsp/linker-symbols.h>
 #include <bsp/mmu.h>
 #include <bsp/qoriq.h>
-#include <bsp/u-boot.h>
 #include <bsp/vectors.h>
 
 LINKER_SYMBOL(bsp_exc_vector_base);
@@ -81,6 +80,36 @@ void _BSP_Fatal_error(unsigned n)
   }
 }
 
+static void initialize_frequency_parameters(void)
+{
+  const void *fdt = bsp_fdt_get();
+  int node;
+  int len;
+  fdt32_t *val_fdt;
+
+  node = fdt_node_offset_by_prop_value(fdt, -1, "device_type", "cpu", 4);
+
+  val_fdt = (fdt32_t *) fdt_getprop(fdt, node, "bus-frequency", &len);
+  if (val_fdt == NULL || len != 4) {
+    bsp_fatal(QORIQ_FATAL_FDT_NO_BUS_FREQUENCY);
+  }
+  BSP_bus_frequency = fdt32_to_cpu(*val_fdt) / QORIQ_BUS_CLOCK_DIVIDER;
+
+  val_fdt = (fdt32_t *) fdt_getprop(fdt, node, "timebase-frequency", &len);
+  if (val_fdt == NULL || len != 4) {
+    bsp_fatal(QORIQ_FATAL_FDT_NO_BUS_FREQUENCY);
+  }
+  bsp_clicks_per_usec = fdt32_to_cpu(*val_fdt) / 1000000;
+
+  #ifdef __PPC_CPU_E6500__
+    val_fdt = (fdt32_t *) fdt_getprop(fdt, node, "clock-frequency", &len);
+    if (val_fdt == NULL || len != 4) {
+      bsp_fatal(QORIQ_FATAL_FDT_NO_CLOCK_FREQUENCY);
+    }
+  #endif
+  rtems_counter_initialize_converter(fdt32_to_cpu(*val_fdt));
+}
+
 void bsp_start(void)
 {
   unsigned long i = 0;
@@ -92,48 +121,7 @@ void bsp_start(void)
   get_ppc_cpu_type();
   get_ppc_cpu_revision();
 
-  /* Initialize some device driver parameters */
-  #if defined(HAS_UBOOT)
-    BSP_bus_frequency = bsp_uboot_board_info.bi_busfreq
-      / QORIQ_BUS_CLOCK_DIVIDER;
-    bsp_clicks_per_usec = BSP_bus_frequency / 8000000;
-    rtems_counter_initialize_converter(
-      #ifdef __PPC_CPU_E6500__
-        bsp_uboot_board_info.bi_intfreq
-      #else
-        BSP_bus_frequency / 8
-      #endif
-    );
-  #elif defined(U_BOOT_USE_FDT)
-    {
-      const void *fdt = bsp_fdt_get();
-      int node;
-      int len;
-      fdt32_t *val_fdt;
-
-      node = fdt_node_offset_by_prop_value(fdt, -1, "device_type", "cpu", 4);
-
-      val_fdt = (fdt32_t *) fdt_getprop(fdt, node, "bus-frequency", &len);
-      if (val_fdt == NULL || len != 4) {
-        bsp_fatal(QORIQ_FATAL_FDT_NO_BUS_FREQUENCY);
-      }
-      BSP_bus_frequency = fdt32_to_cpu(*val_fdt) / QORIQ_BUS_CLOCK_DIVIDER;
-
-      val_fdt = (fdt32_t *) fdt_getprop(fdt, node, "timebase-frequency", &len);
-      if (val_fdt == NULL || len != 4) {
-        bsp_fatal(QORIQ_FATAL_FDT_NO_BUS_FREQUENCY);
-      }
-      bsp_clicks_per_usec = fdt32_to_cpu(*val_fdt) / 1000000;
-
-      #ifdef __PPC_CPU_E6500__
-        val_fdt = (fdt32_t *) fdt_getprop(fdt, node, "clock-frequency", &len);
-        if (val_fdt == NULL || len != 4) {
-          bsp_fatal(QORIQ_FATAL_FDT_NO_CLOCK_FREQUENCY);
-        }
-      #endif
-      rtems_counter_initialize_converter(fdt32_to_cpu(*val_fdt));
-    }
-  #endif
+  initialize_frequency_parameters();
 
   /* Initialize some console parameters */
   for (i = 0; i < console_device_count; ++i) {
@@ -149,12 +137,7 @@ void bsp_start(void)
       ns16550_context *ctx = (ns16550_context *) dev->context;
 
       ctx->clock = BSP_bus_frequency;
-
-      #if defined(HAS_UBOOT) && !defined(U_BOOT_GENERIC_BOARD_INFO)
-        ctx->initial_baud = bsp_uboot_board_info.bi_baudrate;
-      #else
-        ctx->initial_baud = 115200;
-      #endif
+      ctx->initial_baud = 115200;
     }
   }
 



More information about the vc mailing list