1/*  *********************************************************************
2    *  Broadcom Common Firmware Environment (CFE)
3    *
4    *  Board device initialization		File: vcs1280_devs.c
5    *
6    *  This is the "C" part of the board support package.  The
7    *  routines to create and initialize the console, wire up
8    *  device drivers, and do other customization live here.
9    *
10    *  Author:  Mitch Lichtenberg
11    *
12    *********************************************************************
13    *
14    *  Copyright 2000,2001,2002,2003
15    *  Broadcom Corporation. All rights reserved.
16    *
17    *  This software is furnished under license and may be used and
18    *  copied only in accordance with the following terms and
19    *  conditions.  Subject to these conditions, you may download,
20    *  copy, install, use, modify and distribute modified or unmodified
21    *  copies of this software in source and/or binary form.  No title
22    *  or ownership is transferred hereby.
23    *
24    *  1) Any source code used, modified or distributed must reproduce
25    *     and retain this copyright notice and list of conditions
26    *     as they appear in the source file.
27    *
28    *  2) No right is granted to use any trade name, trademark, or
29    *     logo of Broadcom Corporation.  The "Broadcom Corporation"
30    *     name may not be used to endorse or promote products derived
31    *     from this software without the prior written permission of
32    *     Broadcom Corporation.
33    *
34    *  3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR
35    *     IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED
36    *     WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
37    *     PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT
38    *     SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN
39    *     PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT,
40    *     INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
41    *     (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
42    *     GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
43    *     BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
44    *     OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
45    *     TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF
46    *     THE POSSIBILITY OF SUCH DAMAGE.
47    ********************************************************************* */
48
49
50
51#include "cfe.h"
52#include "sbmips.h"
53
54#include "env_subr.h"
55
56
57#include "sb1250_defs.h"
58#include "bcm1480_regs.h"
59#include "bcm1480_scd.h"
60
61#include "vcs1280.h"
62
63/*  *********************************************************************
64    *  Devices we're importing
65    ********************************************************************* */
66
67extern cfe_driver_t sb1250_uart;		/* SB1250 serial ports */
68
69/*  *********************************************************************
70    *  Some board-specific parameters
71    ********************************************************************* */
72
73
74/*  *********************************************************************
75    *  board_console_init()
76    *
77    *  Add the console device and set it to be the primary
78    *  console.
79    *
80    *  Input parameters:
81    *  	   nothing
82    *
83    *  Return value:
84    *  	   nothing
85    ********************************************************************* */
86
87void board_console_init(void)
88{
89    cfe_startflags = 0;
90
91    /* Console */
92    cfe_add_device(&sb1250_uart,A_BCM1480_DUART(0),0,0);
93    cfe_set_console("uart0");
94}
95
96
97/*  *********************************************************************
98    *  board_device_init()
99    *
100    *  Initialize and add other devices.  Add everything you need
101    *  for bootstrap here, like disk drives, flash memory, UARTs,
102    *  network controllers, etc.
103    *
104    *  Input parameters:
105    *  	   nothing
106    *
107    *  Return value:
108    *  	   nothing
109    ********************************************************************* */
110
111void board_device_init(void)
112{
113    uint64_t syscfg;
114    int plldiv;
115
116    syscfg = SBREADCSR(A_SCD_SYSTEM_CFG);
117    plldiv = G_BCM1480_SYS_PLL_DIV(syscfg);
118
119    cfe_cpu_speed = 50000000 * plldiv;		/* use PLL divisor */
120}
121
122
123
124/*  *********************************************************************
125    *  board_device_reset()
126    *
127    *  Reset devices.  This call is done when the firmware is restarted,
128    *  as might happen when an operating system exits, just before the
129    *  "reset" command is applied to the installed devices.   You can
130    *  do whatever board-specific things are here to keep the system
131    *  stable, like stopping DMA sources, interrupts, etc.
132    *
133    *  Input parameters:
134    *  	   nothing
135    *
136    *  Return value:
137    *  	   nothing
138    ********************************************************************* */
139
140void board_device_reset(void)
141{
142
143}
144
145
146
147/*  *********************************************************************
148    *  board_final_init()
149    *
150    *  Do any final initialization, such as adding commands to the
151    *  user interface.
152    *
153    *  If you don't want a user interface, put the startup code here.
154    *  This routine is called just before CFE starts its user interface.
155    *
156    *  Input parameters:
157    *  	   nothing
158    *
159    *  Return value:
160    *  	   nothing
161    ********************************************************************* */
162
163void board_final_init(void)
164{
165
166}
167
168