Sergey Kubushyn | e8f3912 | 2007-08-10 20:26:18 +0200 | [diff] [blame] | 1 | /* |
| 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 Kubushyn | e8f3912 | 2007-08-10 20:26:18 +0200 | [diff] [blame] | 28 | #include <asm/arch/hardware.h> |
Hugo Villeneuve | 4e352ef | 2008-07-11 15:10:13 -0400 | [diff] [blame] | 29 | #include "../common/misc.h" |
Sergey Kubushyn | e8f3912 | 2007-08-10 20:26:18 +0200 | [diff] [blame] | 30 | |
Dirk Behme | f2b171c | 2007-09-15 11:55:42 +0200 | [diff] [blame] | 31 | DECLARE_GLOBAL_DATA_PTR; |
| 32 | |
Sergey Kubushyn | e8f3912 | 2007-08-10 20:26:18 +0200 | [diff] [blame] | 33 | int board_init(void) |
| 34 | { |
Sergey Kubushyn | e8f3912 | 2007-08-10 20:26:18 +0200 | [diff] [blame] | 35 | /* arch number of the board */ |
| 36 | gd->bd->bi_arch_number = MACH_TYPE_SONATA; |
| 37 | |
| 38 | /* address of boot parameters */ |
| 39 | gd->bd->bi_boot_params = LINUX_BOOT_PARAM_ADDR; |
| 40 | |
Hugo Villeneuve | c9a2137 | 2008-11-21 14:35:56 -0500 | [diff] [blame] | 41 | /* Configure AEMIF pins (although this should be configured at boot time |
| 42 | * with pull-up/pull-down resistors) */ |
| 43 | REG(PINMUX0) = 0x00000c1f; |
| 44 | |
| 45 | davinci_errata_workarounds(); |
Sergey Kubushyn | e8f3912 | 2007-08-10 20:26:18 +0200 | [diff] [blame] | 46 | |
| 47 | /* Power on required peripherals */ |
Sergey Kubushyn | e8f3912 | 2007-08-10 20:26:18 +0200 | [diff] [blame] | 48 | lpsc_on(DAVINCI_LPSC_GPIO); |
| 49 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 50 | #if !defined(CONFIG_SYS_USE_DSPLINK) |
Sergey Kubushyn | e8f3912 | 2007-08-10 20:26:18 +0200 | [diff] [blame] | 51 | /* Powerup the DSP */ |
| 52 | dsp_on(); |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 53 | #endif /* CONFIG_SYS_USE_DSPLINK */ |
Sergey Kubushyn | e8f3912 | 2007-08-10 20:26:18 +0200 | [diff] [blame] | 54 | |
Hugo Villeneuve | c9a2137 | 2008-11-21 14:35:56 -0500 | [diff] [blame] | 55 | davinci_enable_uart0(); |
| 56 | davinci_enable_emac(); |
| 57 | davinci_enable_i2c(); |
Sergey Kubushyn | e8f3912 | 2007-08-10 20:26:18 +0200 | [diff] [blame] | 58 | |
Hugo Villeneuve | c9a2137 | 2008-11-21 14:35:56 -0500 | [diff] [blame] | 59 | lpsc_on(DAVINCI_LPSC_TIMER1); |
Sergey Kubushyn | e8f3912 | 2007-08-10 20:26:18 +0200 | [diff] [blame] | 60 | timer_init(); |
| 61 | |
| 62 | return(0); |
| 63 | } |
| 64 | |
Hugo Villeneuve | 4e352ef | 2008-07-11 15:10:13 -0400 | [diff] [blame] | 65 | int misc_init_r(void) |
Sergey Kubushyn | e8f3912 | 2007-08-10 20:26:18 +0200 | [diff] [blame] | 66 | { |
Hugo Villeneuve | 4e352ef | 2008-07-11 15:10:13 -0400 | [diff] [blame] | 67 | uint8_t eeprom_enetaddr[6]; |
Sergey Kubushyn | e8f3912 | 2007-08-10 20:26:18 +0200 | [diff] [blame] | 68 | |
Hugo Villeneuve | 4e352ef | 2008-07-11 15:10:13 -0400 | [diff] [blame] | 69 | /* Read Ethernet MAC address from EEPROM if available. */ |
| 70 | if (dvevm_read_mac_address(eeprom_enetaddr)) |
| 71 | dv_configure_mac_address(eeprom_enetaddr); |
Sergey Kubushyn | e8f3912 | 2007-08-10 20:26:18 +0200 | [diff] [blame] | 72 | |
Hugo Villeneuve | 15e55e0 | 2008-07-11 15:10:11 -0400 | [diff] [blame] | 73 | if (!eth_hw_init()) |
Sergey Kubushyn | e8f3912 | 2007-08-10 20:26:18 +0200 | [diff] [blame] | 74 | printf("ethernet init failed!\n"); |
Sergey Kubushyn | e8f3912 | 2007-08-10 20:26:18 +0200 | [diff] [blame] | 75 | |
| 76 | return(0); |
| 77 | } |