]>
git.ipfire.org Git - thirdparty/u-boot.git/blob - board/ti/omap730p2/omap730p2.c
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 * SPDX-License-Identifier: GPL-2.0+
18 #if defined(CONFIG_OMAP730)
19 #include <./configs/omap730.h>
22 DECLARE_GLOBAL_DATA_PTR
;
24 int test_boot_mode(void);
25 void spin_up_leds(void);
26 void flash__init (void);
27 void ether__init (void);
28 void set_muxconf_regs (void);
29 void peripheral_power_enable (void);
31 #define FLASH_ON_CS0 1
32 #define FLASH_ON_CS3 0
34 static inline void delay (unsigned long loops
)
36 __asm__
volatile ("1:\n"
38 "bne 1b":"=r" (loops
):"0" (loops
));
41 int test_boot_mode(void)
43 /* Check for CS0 and CS3 address decode swapping */
44 if (*((volatile int *)EMIFS_CONFIG
) & 0x00000002)
50 /* Toggle backup LED indication */
51 void toggle_backup_led(void)
53 static int backupLEDState
= 0; /* Init variable so that the LED will be ON the first time */
54 volatile unsigned int *IOConfReg
;
57 IOConfReg
= (volatile unsigned int *) ((unsigned int) OMAP730_GPIO_BASE_5
+ GPIO_DATA_OUTPUT
);
59 if (backupLEDState
!= 0) {
60 *IOConfReg
&= (0xFFFFEFFF);
63 *IOConfReg
|= (0x00001000);
69 * Miscellaneous platform dependent initialisations
74 /* arch number of OMAP 730 P2 Board - Same as the Innovator! */
75 gd
->bd
->bi_arch_number
= MACH_TYPE_OMAP_PERSEUS2
;
77 /* adress of boot parameters */
78 gd
->bd
->bi_boot_params
= 0x10000100;
80 /* Configure MUX settings */
83 peripheral_power_enable ();
85 /* Backup LED indication via GPIO_140 -> Red led if MUX correctly setup */
88 /* Hold GSM in reset until needed */
89 *((volatile unsigned short *)M_CTL
) &= ~1;
92 * CSx timings, GPIO Mux ... setup
95 /* Flash: CS0 timings setup */
96 *((volatile unsigned int *) FLASH_CFG_0
) = 0x0000fff3;
97 *((volatile unsigned int *) FLASH_ACFG_0_1
) = 0x00000088;
99 /* Ethernet support trough the debug board */
100 /* CS1 timings setup */
101 *((volatile unsigned int *) FLASH_CFG_1
) = 0x0000fff3;
102 *((volatile unsigned int *) FLASH_ACFG_0_1
) = 0x00000000;
104 /* this speeds up your boot a quite a bit. However to make it
105 * work, you need make sure your kernel startup flush bug is fixed.
116 /******************************
119 ******************************/
120 void flash__init (void)
124 regval
= *((volatile unsigned int *) EMIFS_CONFIG
);
125 /* Turn off write protection for flash devices. */
126 regval
= regval
| 0x0001;
127 *((volatile unsigned int *) EMIFS_CONFIG
) = regval
;
130 /*************************************************************
132 Description: take the Ethernet controller out of reset and wait
133 for the EEPROM load to complete.
134 *************************************************************/
135 void ether__init (void)
137 #define LAN_RESET_REGISTER 0x0400001c
139 *((volatile unsigned short *) LAN_RESET_REGISTER
) = 0x0000;
141 *((volatile unsigned short *) LAN_RESET_REGISTER
) = 0x0001;
143 } while (*((volatile unsigned short *) LAN_RESET_REGISTER
) != 0x0001);
146 *((volatile unsigned short *) LAN_RESET_REGISTER
) = 0x0000;
148 } while (*((volatile unsigned short *) LAN_RESET_REGISTER
) != 0x0000);
150 #define ETH_CONTROL_REG 0x0400030b
152 *((volatile unsigned char *) ETH_CONTROL_REG
) &= ~0x01;
156 /******************************
159 ******************************/
162 gd
->bd
->bi_dram
[0].start
= PHYS_SDRAM_1
;
163 gd
->bd
->bi_dram
[0].size
= PHYS_SDRAM_1_SIZE
;
168 /******************************************************
169 Routine: set_muxconf_regs
170 Description: Setting up the configuration Mux registers
171 specific to the hardware
172 *******************************************************/
173 void set_muxconf_regs (void)
175 volatile unsigned int *MuxConfReg
;
176 /* set each registers to its reset value; */
179 * Backup LED Indication
182 /* Configure MUXed pin. Mode 6: GPIO_140 */
183 MuxConfReg
= (volatile unsigned int *) (PERSEUS2_IO_CONF10
);
184 *MuxConfReg
&= (0xFFFFFF1F); /* Clear D_MPU_LPG1 */
185 *MuxConfReg
|= 0x000000C0; /* Set D_MPU_LPG1 to 0x6 */
187 /* Configure GPIO_140 as output */
188 MuxConfReg
= (volatile unsigned int *) ((unsigned int) OMAP730_GPIO_BASE_5
+ GPIO_DIRECTION_CONTROL
);
189 *MuxConfReg
&= (0xFFFFEFFF); /* Clear direction (output) for GPIO 140 */
192 * Configure GPIOs for battery charge & feedback
195 /* Configure MUXed pin. Mode 6: GPIO_35 */
196 MuxConfReg
= (volatile unsigned int *) (PERSEUS2_IO_CONF3
);
197 *MuxConfReg
&= 0xFFFFFFF1; /* Clear M_CLK_OUT */
198 *MuxConfReg
|= 0x0000000C; /* Set M_CLK_OUT = 0x6 (GPIOs) */
200 /* Configure MUXed pin. Mode 6: GPIO_72,73,74 */
201 MuxConfReg
= (volatile unsigned int *) (PERSEUS2_IO_CONF5
);
202 *MuxConfReg
&= 0xFFFF1FFF; /* Clear D_DDR */
203 *MuxConfReg
|= 0x0000C000; /* Set D_DDR = 0x6 (GPIOs) */
205 MuxConfReg
= (volatile unsigned int *) ((unsigned int) OMAP730_GPIO_BASE_3
+ GPIO_DIRECTION_CONTROL
);
206 *MuxConfReg
|= 0x00000100; /* Configure GPIO_72 as input */
207 *MuxConfReg
&= 0xFFFFFDFF; /* Configure GPIO_73 as output */
210 * Allow battery charge
213 MuxConfReg
= (volatile unsigned int *) ((unsigned int) OMAP730_GPIO_BASE_3
+ GPIO_DATA_OUTPUT
);
214 *MuxConfReg
&= (0xFFFFFDFF); /* Clear GPIO_73 pin */
217 * Configure MPU_EXT_NIRQ IO in IO_CONF9 register,
218 * It is used as the Ethernet controller interrupt
220 MuxConfReg
= (volatile unsigned int *) (PERSEUS2_IO_CONF9
);
221 *MuxConfReg
&= 0x1FFFFFFF;
224 /******************************************************
225 Routine: peripheral_power_enable
226 Description: Enable the power for UART1
227 *******************************************************/
228 void peripheral_power_enable (void)
230 volatile unsigned int *MuxConfReg
;
233 /* Set up pins used by UART */
235 /* Start UART clock (48MHz) */
236 MuxConfReg
= (volatile unsigned int *) (PERSEUS_PCC_CONF_REG
);
237 *MuxConfReg
&= (0xFFFFFFF7);
238 *MuxConfReg
|= (0x00000008);
240 /* Get the UART pin in mode0 */
241 MuxConfReg
= (volatile unsigned int *) (PERSEUS2_IO_CONF3
);
242 *MuxConfReg
&= (0xFF1FFFFF);
243 *MuxConfReg
&= (0xF1FFFFFF);
246 #ifdef CONFIG_CMD_NET
247 int board_eth_init(bd_t
*bis
)
250 #ifdef CONFIG_LAN91C96
251 rc
= lan91c96_initialize(0, CONFIG_LAN91C96_BASE
);