Sergey Kubushyn | c74b210 | 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 | c74b210 | 2007-08-10 20:26:18 +0200 | [diff] [blame] | 28 | #include <asm/arch/hardware.h> |
| 29 | #include <asm/arch/emac_defs.h> |
Hugo Villeneuve | 264bbdd | 2008-07-11 15:10:13 -0400 | [diff] [blame] | 30 | #include "../common/psc.h" |
| 31 | #include "../common/misc.h" |
Sergey Kubushyn | c74b210 | 2007-08-10 20:26:18 +0200 | [diff] [blame] | 32 | |
Dirk Behme | 66b3f24 | 2007-09-15 11:55:42 +0200 | [diff] [blame] | 33 | DECLARE_GLOBAL_DATA_PTR; |
| 34 | |
Sergey Kubushyn | c74b210 | 2007-08-10 20:26:18 +0200 | [diff] [blame] | 35 | int board_init(void) |
| 36 | { |
Sergey Kubushyn | c74b210 | 2007-08-10 20:26:18 +0200 | [diff] [blame] | 37 | /* arch number of the board */ |
| 38 | gd->bd->bi_arch_number = MACH_TYPE_SONATA; |
| 39 | |
| 40 | /* address of boot parameters */ |
| 41 | gd->bd->bi_boot_params = LINUX_BOOT_PARAM_ADDR; |
| 42 | |
| 43 | /* Workaround for TMS320DM6446 errata 1.3.22 */ |
| 44 | REG(PSC_SILVER_BULLET) = 0; |
| 45 | |
| 46 | /* Power on required peripherals */ |
| 47 | lpsc_on(DAVINCI_LPSC_EMAC); |
| 48 | lpsc_on(DAVINCI_LPSC_EMAC_WRAPPER); |
| 49 | lpsc_on(DAVINCI_LPSC_MDIO); |
| 50 | lpsc_on(DAVINCI_LPSC_I2C); |
| 51 | lpsc_on(DAVINCI_LPSC_UART0); |
| 52 | lpsc_on(DAVINCI_LPSC_TIMER1); |
| 53 | lpsc_on(DAVINCI_LPSC_GPIO); |
| 54 | |
Hugo Villeneuve | 264bbdd | 2008-07-11 15:10:13 -0400 | [diff] [blame] | 55 | #if !defined(CFG_USE_DSPLINK) |
Sergey Kubushyn | c74b210 | 2007-08-10 20:26:18 +0200 | [diff] [blame] | 56 | /* Powerup the DSP */ |
| 57 | dsp_on(); |
Hugo Villeneuve | 264bbdd | 2008-07-11 15:10:13 -0400 | [diff] [blame] | 58 | #endif /* CFG_USE_DSPLINK */ |
Sergey Kubushyn | c74b210 | 2007-08-10 20:26:18 +0200 | [diff] [blame] | 59 | |
| 60 | /* Bringup UART0 out of reset */ |
| 61 | REG(UART0_PWREMU_MGMT) = 0x0000e003; |
| 62 | |
| 63 | /* Enable GIO3.3V cells used for EMAC */ |
| 64 | REG(VDD3P3V_PWDN) = 0; |
| 65 | |
| 66 | /* Enable UART0 MUX lines */ |
| 67 | REG(PINMUX1) |= 1; |
| 68 | |
| 69 | /* Enable EMAC and AEMIF pins */ |
| 70 | REG(PINMUX0) = 0x80000c1f; |
| 71 | |
| 72 | /* Enable I2C pin Mux */ |
| 73 | REG(PINMUX1) |= (1 << 7); |
| 74 | |
| 75 | /* Set the Bus Priority Register to appropriate value */ |
| 76 | REG(VBPR) = 0x20; |
| 77 | |
| 78 | timer_init(); |
| 79 | |
| 80 | return(0); |
| 81 | } |
| 82 | |
Hugo Villeneuve | 264bbdd | 2008-07-11 15:10:13 -0400 | [diff] [blame] | 83 | int misc_init_r(void) |
Sergey Kubushyn | c74b210 | 2007-08-10 20:26:18 +0200 | [diff] [blame] | 84 | { |
Hugo Villeneuve | 264bbdd | 2008-07-11 15:10:13 -0400 | [diff] [blame] | 85 | uint8_t eeprom_enetaddr[6]; |
Sergey Kubushyn | c74b210 | 2007-08-10 20:26:18 +0200 | [diff] [blame] | 86 | |
Hugo Villeneuve | 264bbdd | 2008-07-11 15:10:13 -0400 | [diff] [blame] | 87 | dv_display_clk_infos(); |
Sergey Kubushyn | c74b210 | 2007-08-10 20:26:18 +0200 | [diff] [blame] | 88 | |
Hugo Villeneuve | 264bbdd | 2008-07-11 15:10:13 -0400 | [diff] [blame] | 89 | /* Read Ethernet MAC address from EEPROM if available. */ |
| 90 | if (dvevm_read_mac_address(eeprom_enetaddr)) |
| 91 | dv_configure_mac_address(eeprom_enetaddr); |
Sergey Kubushyn | c74b210 | 2007-08-10 20:26:18 +0200 | [diff] [blame] | 92 | |
Hugo Villeneuve | 85e5808 | 2008-07-11 15:10:11 -0400 | [diff] [blame] | 93 | if (!eth_hw_init()) |
Sergey Kubushyn | c74b210 | 2007-08-10 20:26:18 +0200 | [diff] [blame] | 94 | printf("ethernet init failed!\n"); |
Sergey Kubushyn | c74b210 | 2007-08-10 20:26:18 +0200 | [diff] [blame] | 95 | |
| 96 | return(0); |
| 97 | } |