3 * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
4 * Marius Groeger <mgroeger@sysgo.de>
7 * David Mueller, ELSOFT AG, <d.mueller@elsoft.ch>
10 * Texas Instruments, <www.ti.com>
11 * Kshitij Gupta <Kshitij@ti.com>
13 * See file CREDITS for list of people who contributed to this
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License as
18 * published by the Free Software Foundation; either version 2 of
19 * the License, or (at your option) any later version.
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
33 #if defined(CONFIG_OMAP730)
34 #include <./configs/omap730.h>
37 DECLARE_GLOBAL_DATA_PTR;
39 int test_boot_mode(void);
40 void spin_up_leds(void);
41 void flash__init (void);
42 void ether__init (void);
43 void set_muxconf_regs (void);
44 void peripheral_power_enable (void);
46 #define FLASH_ON_CS0 1
47 #define FLASH_ON_CS3 0
49 static inline void delay (unsigned long loops)
51 __asm__ volatile ("1:\n"
53 "bne 1b":"=r" (loops):"0" (loops));
56 int test_boot_mode(void)
58 /* Check for CS0 and CS3 address decode swapping */
59 if (*((volatile int *)EMIFS_CONFIG) & 0x00000002)
65 /* Toggle backup LED indication */
66 void toggle_backup_led(void)
68 static int backupLEDState = 0; /* Init variable so that the LED will be ON the first time */
69 volatile unsigned int *IOConfReg;
72 IOConfReg = (volatile unsigned int *) ((unsigned int) OMAP730_GPIO_BASE_5 + GPIO_DATA_OUTPUT);
74 if (backupLEDState != 0) {
75 *IOConfReg &= (0xFFFFEFFF);
78 *IOConfReg |= (0x00001000);
84 * Miscellaneous platform dependent initialisations
89 /* arch number of OMAP 730 P2 Board - Same as the Innovator! */
90 gd->bd->bi_arch_number = MACH_TYPE_OMAP_PERSEUS2;
92 /* adress of boot parameters */
93 gd->bd->bi_boot_params = 0x10000100;
95 /* Configure MUX settings */
98 peripheral_power_enable ();
100 /* Backup LED indication via GPIO_140 -> Red led if MUX correctly setup */
103 /* Hold GSM in reset until needed */
104 *((volatile unsigned short *)M_CTL) &= ~1;
107 * CSx timings, GPIO Mux ... setup
110 /* Flash: CS0 timings setup */
111 *((volatile unsigned int *) FLASH_CFG_0) = 0x0000fff3;
112 *((volatile unsigned int *) FLASH_ACFG_0_1) = 0x00000088;
114 /* Ethernet support trough the debug board */
115 /* CS1 timings setup */
116 *((volatile unsigned int *) FLASH_CFG_1) = 0x0000fff3;
117 *((volatile unsigned int *) FLASH_ACFG_0_1) = 0x00000000;
119 /* this speeds up your boot a quite a bit. However to make it
120 * work, you need make sure your kernel startup flush bug is fixed.
131 int misc_init_r (void)
133 /* currently empty */
137 /******************************
140 ******************************/
141 void flash__init (void)
145 regval = *((volatile unsigned int *) EMIFS_CONFIG);
146 /* Turn off write protection for flash devices. */
147 regval = regval | 0x0001;
148 *((volatile unsigned int *) EMIFS_CONFIG) = regval;
151 /*************************************************************
153 Description: take the Ethernet controller out of reset and wait
154 for the EEPROM load to complete.
155 *************************************************************/
156 void ether__init (void)
158 #define LAN_RESET_REGISTER 0x0400001c
160 *((volatile unsigned short *) LAN_RESET_REGISTER) = 0x0000;
162 *((volatile unsigned short *) LAN_RESET_REGISTER) = 0x0001;
164 } while (*((volatile unsigned short *) LAN_RESET_REGISTER) != 0x0001);
167 *((volatile unsigned short *) LAN_RESET_REGISTER) = 0x0000;
169 } while (*((volatile unsigned short *) LAN_RESET_REGISTER) != 0x0000);
171 #define ETH_CONTROL_REG 0x0400030b
173 *((volatile unsigned char *) ETH_CONTROL_REG) &= ~0x01;
177 /******************************
180 ******************************/
183 gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
184 gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
189 /******************************************************
190 Routine: set_muxconf_regs
191 Description: Setting up the configuration Mux registers
192 specific to the hardware
193 *******************************************************/
194 void set_muxconf_regs (void)
196 volatile unsigned int *MuxConfReg;
197 /* set each registers to its reset value; */
200 * Backup LED Indication
203 /* Configure MUXed pin. Mode 6: GPIO_140 */
204 MuxConfReg = (volatile unsigned int *) (PERSEUS2_IO_CONF10);
205 *MuxConfReg &= (0xFFFFFF1F); /* Clear D_MPU_LPG1 */
206 *MuxConfReg |= 0x000000C0; /* Set D_MPU_LPG1 to 0x6 */
208 /* Configure GPIO_140 as output */
209 MuxConfReg = (volatile unsigned int *) ((unsigned int) OMAP730_GPIO_BASE_5 + GPIO_DIRECTION_CONTROL);
210 *MuxConfReg &= (0xFFFFEFFF); /* Clear direction (output) for GPIO 140 */
213 * Configure GPIOs for battery charge & feedback
216 /* Configure MUXed pin. Mode 6: GPIO_35 */
217 MuxConfReg = (volatile unsigned int *) (PERSEUS2_IO_CONF3);
218 *MuxConfReg &= 0xFFFFFFF1; /* Clear M_CLK_OUT */
219 *MuxConfReg |= 0x0000000C; /* Set M_CLK_OUT = 0x6 (GPIOs) */
221 /* Configure MUXed pin. Mode 6: GPIO_72,73,74 */
222 MuxConfReg = (volatile unsigned int *) (PERSEUS2_IO_CONF5);
223 *MuxConfReg &= 0xFFFF1FFF; /* Clear D_DDR */
224 *MuxConfReg |= 0x0000C000; /* Set D_DDR = 0x6 (GPIOs) */
226 MuxConfReg = (volatile unsigned int *) ((unsigned int) OMAP730_GPIO_BASE_3 + GPIO_DIRECTION_CONTROL);
227 *MuxConfReg |= 0x00000100; /* Configure GPIO_72 as input */
228 *MuxConfReg &= 0xFFFFFDFF; /* Configure GPIO_73 as output */
231 * Allow battery charge
234 MuxConfReg = (volatile unsigned int *) ((unsigned int) OMAP730_GPIO_BASE_3 + GPIO_DATA_OUTPUT);
235 *MuxConfReg &= (0xFFFFFDFF); /* Clear GPIO_73 pin */
238 * Configure MPU_EXT_NIRQ IO in IO_CONF9 register,
239 * It is used as the Ethernet controller interrupt
241 MuxConfReg = (volatile unsigned int *) (PERSEUS2_IO_CONF9);
242 *MuxConfReg &= 0x1FFFFFFF;
245 /******************************************************
246 Routine: peripheral_power_enable
247 Description: Enable the power for UART1
248 *******************************************************/
249 void peripheral_power_enable (void)
251 volatile unsigned int *MuxConfReg;
254 /* Set up pins used by UART */
256 /* Start UART clock (48MHz) */
257 MuxConfReg = (volatile unsigned int *) (PERSEUS_PCC_CONF_REG);
258 *MuxConfReg &= (0xFFFFFFF7);
259 *MuxConfReg |= (0x00000008);
261 /* Get the UART pin in mode0 */
262 MuxConfReg = (volatile unsigned int *) (PERSEUS2_IO_CONF3);
263 *MuxConfReg &= (0xFF1FFFFF);
264 *MuxConfReg &= (0xF1FFFFFF);