source: SVN/rincon/u-boot/board/davinci/dvevm/dvevm.c @ 55

Last change on this file since 55 was 55, checked in by Tim Harvey, 3 years ago

rincon: added latest u-boot source

restored form server backup

Signed-off-by: Tim Harvey <tharvey@…>

File size: 4.3 KB
Line 
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>
28#include <i2c.h>
29#include <asm/arch/hardware.h>
30#include <asm/arch/emac_defs.h>
31#include <asm/arch/emif_defs.h>
32#include "../common/psc.h"
33#include "../common/misc.h"
34
35DECLARE_GLOBAL_DATA_PTR;
36
37int board_init(void)
38{
39  u_int32_t acfg1 = 0x3ffffffc;
40  emifregs  emif_regs;
41
42  /*------------------------------------------------------------------*
43   *  NOR FLASH CHIP TIMEOUT @ 513 MHz                               *
44   *                                                                  *
45   *  AEMIF.CLK freq   = PLL1/6 = 513/6 = 85.5 MHz                    *
46   *  AEMIF.CLK period = 1/85.5 MHz = 11.7 ns                         *
47   *                                                                  *
48   *------------------------------------------------------------------*/
49   acfg1 = 0
50    | (0 << 31 )  /* selectStrobe */
51    | (0 << 30 )  /* extWait */
52    | (1 << 26 )  /* writeSetup 22 ns */
53    | (6 << 20 )  /* writeStrobe  56 ns */
54    | (1 << 17 )  /* writeHold  10 ns */
55    | (1 << 13 )  /* readSetup  10 ns */
56    | (10 << 7 ) /* readStrobe 82 ns */
57    | (4 << 4 ) /* readHold 33 ns */
58    | (1 << 2 ) /* turnAround ?? ns */
59    | (1 << 0 ) /* asyncSize  16-bit bus */
60    ;
61
62  emif_regs = (emifregs)DAVINCI_ASYNC_EMIF_CNTRL_BASE;
63
64  emif_regs->AB1CR = acfg1; /* 0x08244128 */;
65
66        /* arch number of the board */
67        gd->bd->bi_arch_number = MACH_TYPE_GW2361;
68
69        /* address of boot parameters */
70        gd->bd->bi_boot_params = LINUX_BOOT_PARAM_ADDR;
71
72        /* Workaround for TMS320DM6446 errata 1.3.22 */
73        REG(PSC_SILVER_BULLET) = 0;
74
75        /* Power on required peripherals */
76        lpsc_on(DAVINCI_LPSC_EMAC);
77        lpsc_on(DAVINCI_LPSC_EMAC_WRAPPER);
78        lpsc_on(DAVINCI_LPSC_MDIO);
79        lpsc_on(DAVINCI_LPSC_I2C);
80        lpsc_on(DAVINCI_LPSC_UART0);
81        lpsc_on(DAVINCI_LPSC_UART1);
82        lpsc_on(DAVINCI_LPSC_TIMER1);
83        lpsc_on(DAVINCI_LPSC_GPIO);
84
85#if !defined(CFG_USE_DSPLINK)
86        /* Powerup the DSP */
87        dsp_on();
88#endif /* CFG_USE_DSPLINK */
89
90        /* Bringup UART0 out of reset */
91        REG(UART0_PWREMU_MGMT) = 0x0000e003;
92        REG(UART1_PWREMU_MGMT) = 0x0000e003;
93
94        /* Enable GIO3.3V cells used for EMAC */
95        REG(VDD3P3V_PWDN) = 0;
96
97        /* Enable UART0 MUX lines */
98        REG(PINMUX1) |= 1;
99
100        /* Enable UART1 MUX lines */
101        REG(PINMUX1) |= 2;
102
103        /* Enable EMAC and AEMIF pins */
104        REG(PINMUX0) = 0x80000c1f;
105
106        /* Enable I2C pin Mux */
107        REG(PINMUX1) |= (1 << 7);
108
109        /* Set the Bus Priority Register to appropriate value */
110        REG(VBPR) = 0x20;
111
112        /* Turn on the LEDS on GPIO's 37-40 */
113        REG(DAVINCI_GPIO_BASE + 0x38) &= ~0x1e0;                // Set Direction to Output
114        REG(DAVINCI_GPIO_BASE + 0x44) |= 0x1e0;         // Set Direction to Output
115
116        timer_init();
117
118        return(0);
119}
120
121int misc_init_r(void)
122{
123        uint8_t video_mode;
124        uint8_t eeprom_enetaddr[6];
125        uint8_t i2cbuf;
126
127        dv_display_clk_infos();
128
129        /* Read Ethernet MAC address from EEPROM if available. */
130        if (dvevm_read_mac_address(eeprom_enetaddr))
131                dv_configure_mac_address(eeprom_enetaddr);
132
133        if (!eth_hw_init())
134                printf("ethernet init failed!\n");
135
136        i2cbuf = 0x1;
137        i2c_write(0x5f, 0x1, 1, &i2cbuf, 1);
138        i2c_write(0x5f, 0x1, 1, &i2cbuf, 1);
139
140        /* Try "Micrel Auto MDI/MDI-X mode" */
141        i2cbuf = 0;
142        i2c_write(0x5f, 0x1f, 1, &i2cbuf, 1);
143        i2c_write(0x5f, 0x1f, 1, &i2cbuf, 1);
144
145        i2c_write(0x5f, 0x2f, 1, &i2cbuf, 1);
146        i2c_write(0x5f, 0x2f, 1, &i2cbuf, 1);
147
148        return(0);
149}
Note: See TracBrowser for help on using the repository browser.