blob: d56b443b202744842e6d060fb23de32736305d7d [file] [log] [blame]
Sergey Kubushyne8f39122007-08-10 20:26:18 +02001/*
2 * Copyright (C) 2007 Sergey Kubushyn <ksi@koi8.net>
3 *
4 * Parts are shamelessly stolen from various TI sources, original copyright
5 * follows:
6 * -----------------------------------------------------------------
7 *
8 * Copyright (C) 2004 Texas Instruments.
9 *
10 * ----------------------------------------------------------------------------
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 * ----------------------------------------------------------------------------
25 */
26
27#include <common.h>
Sergey Kubushyne8f39122007-08-10 20:26:18 +020028#include <asm/arch/hardware.h>
Hugo Villeneuve4e352ef2008-07-11 15:10:13 -040029#include "../common/psc.h"
30#include "../common/misc.h"
Sergey Kubushyne8f39122007-08-10 20:26:18 +020031
Dirk Behmef2b171c2007-09-15 11:55:42 +020032DECLARE_GLOBAL_DATA_PTR;
33
Sergey Kubushyne8f39122007-08-10 20:26:18 +020034int board_init(void)
35{
Sergey Kubushyne8f39122007-08-10 20:26:18 +020036 /* arch number of the board */
37 gd->bd->bi_arch_number = MACH_TYPE_SONATA;
38
39 /* address of boot parameters */
40 gd->bd->bi_boot_params = LINUX_BOOT_PARAM_ADDR;
41
Hugo Villeneuvec9a21372008-11-21 14:35:56 -050042 /* Configure AEMIF pins (although this should be configured at boot time
43 * with pull-up/pull-down resistors) */
44 REG(PINMUX0) = 0x00000c1f;
45
46 davinci_errata_workarounds();
Sergey Kubushyne8f39122007-08-10 20:26:18 +020047
48 /* Power on required peripherals */
Sergey Kubushyne8f39122007-08-10 20:26:18 +020049 lpsc_on(DAVINCI_LPSC_GPIO);
50
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +020051#if !defined(CONFIG_SYS_USE_DSPLINK)
Sergey Kubushyne8f39122007-08-10 20:26:18 +020052 /* Powerup the DSP */
53 dsp_on();
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +020054#endif /* CONFIG_SYS_USE_DSPLINK */
Sergey Kubushyne8f39122007-08-10 20:26:18 +020055
Hugo Villeneuvec9a21372008-11-21 14:35:56 -050056 davinci_enable_uart0();
57 davinci_enable_emac();
58 davinci_enable_i2c();
Sergey Kubushyne8f39122007-08-10 20:26:18 +020059
Hugo Villeneuvec9a21372008-11-21 14:35:56 -050060 lpsc_on(DAVINCI_LPSC_TIMER1);
Sergey Kubushyne8f39122007-08-10 20:26:18 +020061 timer_init();
62
63 return(0);
64}
65
Hugo Villeneuve4e352ef2008-07-11 15:10:13 -040066int misc_init_r(void)
Sergey Kubushyne8f39122007-08-10 20:26:18 +020067{
Hugo Villeneuve4e352ef2008-07-11 15:10:13 -040068 uint8_t eeprom_enetaddr[6];
Sergey Kubushyne8f39122007-08-10 20:26:18 +020069
Hugo Villeneuve4e352ef2008-07-11 15:10:13 -040070 dv_display_clk_infos();
Sergey Kubushyne8f39122007-08-10 20:26:18 +020071
Hugo Villeneuve4e352ef2008-07-11 15:10:13 -040072 /* Read Ethernet MAC address from EEPROM if available. */
73 if (dvevm_read_mac_address(eeprom_enetaddr))
74 dv_configure_mac_address(eeprom_enetaddr);
Sergey Kubushyne8f39122007-08-10 20:26:18 +020075
Hugo Villeneuve15e55e02008-07-11 15:10:11 -040076 if (!eth_hw_init())
Sergey Kubushyne8f39122007-08-10 20:26:18 +020077 printf("ethernet init failed!\n");
Sergey Kubushyne8f39122007-08-10 20:26:18 +020078
79 return(0);
80}