1
2
3
4
5
6
7
8
9
10
11
12
13
14
15#include <common.h>
16#include <twl4030.h>
17#include <asm/io.h>
18#include <asm/gpio.h>
19#include <asm/arch/mmc_host_def.h>
20#include <asm/arch/mux.h>
21#include <asm/arch/gpio.h>
22#include <asm/arch/sys_proto.h>
23#include <asm/mach-types.h>
24#include "pandora.h"
25
26DECLARE_GLOBAL_DATA_PTR;
27
28#define TWL4030_BB_CFG_BBCHEN (1 << 4)
29#define TWL4030_BB_CFG_BBSEL_3200MV (3 << 2)
30#define TWL4030_BB_CFG_BBISEL_500UA 2
31
32#define CONTROL_WKUP_CTRL 0x48002a5c
33#define GPIO_IO_PWRDNZ (1 << 6)
34#define PBIASLITEVMODE1 (1 << 8)
35
36
37
38
39
40int board_init(void)
41{
42 gpmc_init();
43
44 gd->bd->bi_arch_number = MACH_TYPE_OMAP3_PANDORA;
45
46 gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
47
48 return 0;
49}
50
51static void set_output_gpio(unsigned int gpio, int value)
52{
53 int ret;
54
55 ret = gpio_request(gpio, "");
56 if (ret != 0) {
57 printf("could not request GPIO %u\n", gpio);
58 return;
59 }
60 ret = gpio_direction_output(gpio, value);
61 if (ret != 0)
62 printf("could not set GPIO %u to %d\n", gpio, value);
63}
64
65
66
67
68
69int misc_init_r(void)
70{
71 t2_t *t2_base = (t2_t *)T2_BASE;
72 u32 pbias_lite;
73
74 twl4030_led_init(TWL4030_LED_LEDEN_LEDBON);
75
76
77 pbias_lite = readl(&t2_base->pbias_lite);
78 pbias_lite &= ~PBIASLITEVMODE1;
79 pbias_lite |= PBIASLITEPWRDNZ1;
80 writel(pbias_lite, &t2_base->pbias_lite);
81 if (get_cpu_family() == CPU_OMAP36XX)
82 writel(readl(CONTROL_WKUP_CTRL) | GPIO_IO_PWRDNZ,
83 CONTROL_WKUP_CTRL);
84
85
86 set_output_gpio(14, 0);
87 set_output_gpio(15, 0);
88 set_output_gpio(118, 0);
89
90
91 set_output_gpio(164, 1);
92
93
94 set_output_gpio(23, 1);
95 udelay(5000);
96 gpio_direction_output(23, 0);
97
98
99 twl4030_i2c_write_u8(TWL4030_CHIP_PM_RECEIVER,
100 TWL4030_PM_RECEIVER_BB_CFG,
101 TWL4030_BB_CFG_BBCHEN | TWL4030_BB_CFG_BBSEL_3200MV |
102 TWL4030_BB_CFG_BBISEL_500UA);
103
104 omap_die_id_display();
105
106 return 0;
107}
108
109
110
111
112
113
114
115void set_muxconf_regs(void)
116{
117 MUX_PANDORA();
118 if (get_cpu_family() == CPU_OMAP36XX) {
119 MUX_PANDORA_3730();
120 }
121}
122
123#ifdef CONFIG_MMC
124int board_mmc_init(bd_t *bis)
125{
126 return omap_mmc_init(0, 0, 0, -1, -1);
127}
128
129void board_mmc_power_init(void)
130{
131 twl4030_power_mmc_init(0);
132}
133#endif
134