1 /*
2 *
3 * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
4 *
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 *
13 * Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the
16 * distribution.
17 *
18 * Neither the name of Texas Instruments Incorporated nor the names of
19 * its contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 *
34 */
38 /**********************************************************************************
39 * FILE PURPOSE: Define the device interface
40 **********************************************************************************
41 * FILE NAME: device.h
42 *
43 * DESCRIPTION: This file defines the device wrapper used by IBL modules
44 *
45 * @file device.h
46 *
47 * @brief
48 * The device wrapper API is defined
49 *
50 ***********************************************************************************/
51 #ifndef DEVICE_H
52 #define DEVICE_H
54 #include "types.h"
57 /* The target specific file is pointed to via make control. There will be a different
58 target.h file for each platform */
59 #include "target.h"
63 /**
64 * @brief
65 * Fill in the ibl structure with default values
66 *
67 * @details
68 * If the ibl table is not pre-loaded during the initial boot, then
69 * each device will load a default table.
70 */
71 void deviceLoadDefaultIblTable(void);
74 /**
75 * @brief
76 * Convert a local address to a global address
77 *
78 * @details
79 * a local memory address (l1d, l1p, l2) is converted to a global address
80 */
81 Uint32 deviceLocalAddrToGlobal (Uint32 local);
84 /**
85 * @brief Configure the PLLs
86 *
87 * @details
88 * The three PLLs are enabled. Only the main PLL has the ability to configure
89 * the multiplier and dividers.
90 */
91 void devicePllConfig (void);
94 /**
95 * @brief
96 * Power up a peripheral
97 *
98 * @details
99 * The specified module (and domain if required) is power up
100 */
101 int32 devicePowerPeriph (int32 modNum);
104 /**
105 * @brief Enable the DDR controller
106 *
107 * @details
108 * The DDR controller is enabled (optionally)
109 */
110 void deviceDdrConfig (void);
113 /**
114 * @brief
115 * Perform device level configuration for nand boot
116 *
117 * @detials
118 * Board/chip specific initializations
119 */
120 int32 deviceConfigureForNand(void);
122 /**
123 * @brief
124 * Load the default ethernet address
125 *
126 * @details
127 * The mac address from e-fuse is loaded
128 */
129 void deviceLoadDefaultEthAddress (uint8 *maddr);
131 /**
132 * @brief
133 * Reset the ethernet controller
134 *
135 * @details
136 * Some devices require an external ethernet reset before configuration
137 */
138 #ifndef deviceSetEthResetState
139 void deviceSetEthResetState (int32 portNum, BOOL applyReset);
140 #endif
142 /**
143 * @brief
144 * Return the endian status
145 *
146 * @details
147 * Returns true if the device is executing in little endian mode
148 */
149 bool deviceIsLittleEndian(void);
152 /**
153 * @brief
154 * Provide an approximate delay, in cpu cycles
155 *
156 * @details
157 * A delay loop
158 */
159 void chipDelay32 (uint32 nCycles);
162 /**
163 * @brief
164 * Return the NAND interface function table
165 *
166 * @details
167 * Some devices support multiple NAND interface at once (EMIF25 and SPI).
168 * This function returns a pointer to the lower level function
169 * table to use. The table is selected in the ibl configuration.
170 */
171 typedef struct nandCtbl_s {
173 Int32 (*nct_driverInit) (int32 cs, void *nandDevInfo);
174 Int32 (*nct_driverReadBytes) (Uint32 block, Uint32 page, Uint32 byte, Uint32 nbytes, Uint8 *data);
175 Int32 (*nct_driverReadPage) (Uint32 block, Uint32 page, Uint8 *data);
176 Int32 (*nct_driverClose) (void);
178 } nandCtbl_t;
180 nandCtbl_t *deviceGetNandCtbl (int32 interface);
183 /**
184 * @brief
185 * Return the NOR interface function table
186 *
187 * @details
188 * NOR is supported through both SPI and EMIF. This function returns a pointer
189 * to the lower level function table to use during boot.
190 */
191 typedef struct norCtbl_s {
193 Int32 (*nct_driverInit) (int32 cs);
194 Int32 (*nct_driverReadBytes) (Uint8 *data, Uint32 nbytes, Uint32 address);
195 Int32 (*nct_driverClose) (void);
197 } norCtbl_t;
199 norCtbl_t *deviceGetNorCtbl (int32 interface);
203 /**
204 * @brief
205 * Return the default SPI device configuration
206 */
207 void deviceLoadInitSpiConfig (void *cfg);
209 #endif