source: rtems/c/src/lib/libbsp/powerpc/qoriq/startup/bspstart.c @ 964c734b

4.115
Last change on this file since 964c734b was 964c734b, checked in by Jennifer Averett <Jennifer.Averett@…>, on Oct 18, 2011 at 6:32:23 PM

2011-10-18 Jennifer Averett <Jennifer.Averett@…>

PR 1917/bsps

  • Makefile.am, console/console-config.c, console/uart-bridge-master.c, console/uart-bridge-slave.c, startup/bspstart.c: Modifications to add dynamic tables for libchip serial drivers.
  • Property mode set to 100644
File size: 3.0 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup QorIQ
5 *
6 * @brief BSP startup.
7 */
8
9/*
10 * Copyright (c) 2010 embedded brains GmbH.  All rights reserved.
11 *
12 *  embedded brains GmbH
13 *  Obere Lagerstr. 30
14 *  82178 Puchheim
15 *  Germany
16 *  <rtems@embedded-brains.de>
17 *
18 * The license and distribution terms for this file may be
19 * found in the file LICENSE in this distribution or at
20 * http://www.rtems.com/license/LICENSE.
21 *
22 * $Id$
23 */
24
25#include <rtems.h>
26#include <rtems/config.h>
27
28#include <libchip/serial.h>
29
30#include <libcpu/powerpc-utility.h>
31
32#include <bsp.h>
33#include <bsp/vectors.h>
34#include <bsp/bootcard.h>
35#include <bsp/irq-generic.h>
36#include <bsp/u-boot.h>
37#include <bsp/linker-symbols.h>
38#include <bsp/mmu.h>
39#include <bsp/qoriq.h>
40
41LINKER_SYMBOL(bsp_exc_vector_base);
42
43/* Configuration parameters for console driver, ... */
44unsigned int BSP_bus_frequency;
45
46/* Configuration parameters for clock driver, ... */
47uint32_t bsp_clicks_per_usec;
48
49void BSP_panic(char *s)
50{
51  rtems_interrupt_level level;
52
53  rtems_interrupt_disable(level);
54
55  printk("%s PANIC %s\n", rtems_get_version_string(), s);
56
57  while (1) {
58    /* Do nothing */
59  }
60}
61
62void _BSP_Fatal_error(unsigned n)
63{
64  rtems_interrupt_level level;
65
66  rtems_interrupt_disable(level);
67
68  printk("%s PANIC ERROR %u\n", rtems_get_version_string(), n);
69
70  while (1) {
71    /* Do nothing */
72  }
73}
74
75void bsp_start(void)
76{
77  rtems_status_code sc = RTEMS_SUCCESSFUL;
78  unsigned long i = 0;
79
80  ppc_cpu_id_t myCpu;
81  ppc_cpu_revision_t myCpuRevision;
82
83  /*
84   * Get CPU identification dynamically. Note that the get_ppc_cpu_type() function
85   * store the result in global variables so that it can be used latter...
86   */
87  myCpu = get_ppc_cpu_type();
88  myCpuRevision = get_ppc_cpu_revision();
89
90  /* Initialize some device driver parameters */
91  #ifdef HAS_UBOOT
92    BSP_bus_frequency = bsp_uboot_board_info.bi_busfreq;
93    bsp_clicks_per_usec = bsp_uboot_board_info.bi_busfreq / 8000000;
94  #endif /* HAS_UBOOT */
95
96  /* Initialize some console parameters */
97  for (i = 0; i < Console_Port_Count; ++i) {
98    console_tbl *ct = &Console_Configuration_Ports[i];
99
100    ct->ulClock = BSP_bus_frequency;
101
102    #ifdef HAS_UBOOT
103      if (ct->deviceType == SERIAL_NS16550) {
104        ct->pDeviceParams = (void *) bsp_uboot_board_info.bi_baudrate;
105      }
106    #endif
107  }
108
109  /* Disable decrementer */
110  PPC_CLEAR_SPECIAL_PURPOSE_REGISTER_BITS(BOOKE_TCR, BOOKE_TCR_DIE);
111
112  /* Initialize exception handler */
113  ppc_exc_vector_base = (uint32_t) bsp_exc_vector_base;
114  sc = ppc_exc_initialize(
115    PPC_INTERRUPT_DISABLE_MASK_DEFAULT,
116    (uintptr_t) bsp_section_work_begin,
117    Configuration.interrupt_stack_size
118  );
119  if (sc != RTEMS_SUCCESSFUL) {
120    BSP_panic("cannot initialize exceptions");
121  }
122
123  /* Now it is possible to make the code execute only */
124  qoriq_mmu_change_perm(
125    FSL_EIS_MAS3_SR | FSL_EIS_MAS3_SX,
126    FSL_EIS_MAS3_SX,
127    FSL_EIS_MAS3_SR
128  );
129
130  /* Initalize interrupt support */
131  sc = bsp_interrupt_initialize();
132  if (sc != RTEMS_SUCCESSFUL) {
133    BSP_panic("cannot intitialize interrupts\n");
134  }
135
136  /* Disable boot page translation */
137  qoriq.lcc.bptr &= ~BPTR_EN;
138}
Note: See TracBrowser for help on using the repository browser.