1
2
3
4
5
6
7
8
9
10
11
12
13
14
15#include <common.h>
16#include <i2c.h>
17#include <asm/arch/hardware.h>
18#include <asm/arch/davinci_misc.h>
19
20DECLARE_GLOBAL_DATA_PTR;
21
22int board_init(void)
23{
24
25 gd->bd->bi_arch_number = MACH_TYPE_DAVINCI_EVM;
26
27
28 gd->bd->bi_boot_params = LINUX_BOOT_PARAM_ADDR;
29
30
31
32 REG(PINMUX0) = 0x00000c1f;
33
34 davinci_errata_workarounds();
35
36
37 lpsc_on(DAVINCI_LPSC_GPIO);
38 lpsc_on(DAVINCI_LPSC_USB);
39
40#if !defined(CONFIG_SYS_USE_DSPLINK)
41
42 dsp_on();
43#endif
44
45 davinci_enable_uart0();
46 davinci_enable_emac();
47 davinci_enable_i2c();
48
49 lpsc_on(DAVINCI_LPSC_TIMER1);
50 timer_init();
51
52 return(0);
53}
54
55int misc_init_r(void)
56{
57 uint8_t video_mode;
58 uint8_t eeprom_enetaddr[6];
59
60
61 if (dvevm_read_mac_address(eeprom_enetaddr))
62 davinci_sync_env_enetaddr(eeprom_enetaddr);
63
64 i2c_read(0x39, 0x00, 1, &video_mode, 1);
65
66 setenv("videostd", ((video_mode & 0x80) ? "pal" : "ntsc"));
67
68 return(0);
69}
70
71#ifdef CONFIG_USB_DAVINCI
72
73
74#define IOEXP_I2C_ADDR 0x3A
75#define IOEXP_VBUSEN_MASK 1
76
77
78
79
80
81
82void enable_vbus(void)
83{
84 uchar data;
85
86
87 i2c_read(IOEXP_I2C_ADDR, 0, 0, &data, 1);
88 data &= ~IOEXP_VBUSEN_MASK;
89 i2c_write(IOEXP_I2C_ADDR, 0, 0, &data, 1);
90}
91#endif
92