1/*  *********************************************************************
2    *  Broadcom Common Firmware Environment (CFE)
3    *
4    *  Board device initialization		File: tiny_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 "cfe_smbus.h"
53#include "env_subr.h"
54
55#include "sb1250_defs.h"
56#include "sb1250_regs.h"
57#include "sb1250_pci.h"
58#include "sb1250_ldt.h"
59
60#include "dev_newflash.h"
61
62#include "tiny.h"
63
64/*  *********************************************************************
65    *  Devices we're importing
66    ********************************************************************* */
67
68extern cfe_driver_t sb1250_uart;		/* SB1250 serial ports */
69extern cfe_driver_t newflashdrv;		/* AMD-style flash */
70#if CFG_NETWORK
71extern cfe_smbus_t sb1250_smbus;		/* BCM1250 SMBus controller */
72extern cfe_driver_t sb1250_ether;
73extern cfe_driver_t smbus_x1240eeprom;		/* Xicor EEPROM */
74#endif
75
76/*  *********************************************************************
77    *  Some board-specific parameters
78    ********************************************************************* */
79
80#define PROMICE_BASE	(0x1FFC0000)
81#define PROMICE_WORDSIZE 1
82
83
84/*  *********************************************************************
85    *  board_console_init()
86    *
87    *  Add the console device and set it to be the primary
88    *  console.
89    *
90    *  Input parameters:
91    *  	   nothing
92    *
93    *  Return value:
94    *  	   nothing
95    ********************************************************************* */
96
97void board_console_init(void)
98{
99    /* Console */
100    cfe_add_device(&sb1250_uart,A_DUART,0,0);
101    cfe_set_console("uart0");
102}
103
104
105/*  *********************************************************************
106    *  board_device_init()
107    *
108    *  Initialize and add other devices.  Add everything you need
109    *  for bootstrap here, like disk drives, flash memory, UARTs,
110    *  network controllers, etc.
111    *
112    *  Input parameters:
113    *  	   nothing
114    *
115    *  Return value:
116    *  	   nothing
117    ********************************************************************* */
118
119//#define BOOTROM_PHYS 0x1FC00000
120//#define BOOTROM_SIZE 2*1024*1024
121void board_device_init(void)
122{
123    cfe_add_device(&newflashdrv,
124		   BOOTROM_PHYS,
125		   (BOOTROM_SIZE) | FLASH_FLG_BUS8 | FLASH_FLG_DEV16,
126		   NULL);
127
128#if CFG_NETWORK
129    cfe_add_smbus(&sb1250_smbus,A_SMB_BASE(0),0);
130    cfe_add_smbus(&sb1250_smbus,A_SMB_BASE(1),0);
131    cfe_add_device(&smbus_x1240eeprom,X1240_SMBUS_CHAN,X1240_SMBUS_DEV,0);
132    cfe_set_envdevice("eeprom0");	/* Connect NVRAM subsystem to EEPROM */
133    cfe_add_device(&sb1250_ether,A_MAC_BASE_0,0,env_getenv("ETH0_HWADDR"));
134#endif
135
136}
137
138
139/*  *********************************************************************
140    *  board_device_reset()
141    *
142    *  Reset devices.  This call is done when the firmware is restarted,
143    *  as might happen when an operating system exits, just before the
144    *  "reset" command is applied to the installed devices.   You can
145    *  do whatever board-specific things are here to keep the system
146    *  stable, like stopping DMA sources, interrupts, etc.
147    *
148    *  Input parameters:
149    *  	   nothing
150    *
151    *  Return value:
152    *  	   nothing
153    ********************************************************************* */
154
155void board_device_reset(void)
156{
157
158}
159
160
161
162/*  *********************************************************************
163    *  board_final_init()
164    *
165    *  Do any final initialization, such as adding commands to the
166    *  user interface.
167    *
168    *  If you don't want a user interface, put the startup code here.
169    *  This routine is called just before CFE starts its user interface.
170    *
171    *  Input parameters:
172    *  	   nothing
173    *
174    *  Return value:
175    *  	   nothing
176    ********************************************************************* */
177
178void board_final_init(void)
179{
180
181}
182
183