Blame view

board/pandora/pandora.c 3.27 KB
83d290c56   Tom Rini   SPDX: Convert all...
1
  // SPDX-License-Identifier: GPL-2.0+
2be2c6cc6   Dirk Behme   OMAP3: Add Pandor...
2
3
4
5
6
7
8
9
10
11
12
13
  /*
   * (C) Copyright 2008
   * Grazvydas Ignotas <notasas@gmail.com>
   *
   * Derived from Beagle Board, 3430 SDP, and OMAP3EVM code by
   *	Richard Woodruff <r-woodruff2@ti.com>
   *	Syed Mohammed Khasim <khasim@ti.com>
   *	Sunil Kumar <sunilsaini05@gmail.com>
   *	Shashi Ranjan <shashiranjanmca05@gmail.com>
   *
   * (C) Copyright 2004-2008
   * Texas Instruments, <www.ti.com>
2be2c6cc6   Dirk Behme   OMAP3: Add Pandor...
14
15
   */
  #include <common.h>
8a86152db   Grazvydas Ignotas   omap3: pandora: E...
16
17
  #include <dm.h>
  #include <ns16550.h>
2c1551301   Tom Rix   OMAP3 Move twl403...
18
  #include <twl4030.h>
2be2c6cc6   Dirk Behme   OMAP3: Add Pandor...
19
  #include <asm/io.h>
7cad446b8   Grazvydas Ignotas   OMAP3: pandora: r...
20
  #include <asm/gpio.h>
86c5c5440   Tom Rini   OMAP3: pandora: U...
21
  #include <asm/arch/mmc_host_def.h>
2be2c6cc6   Dirk Behme   OMAP3: Add Pandor...
22
  #include <asm/arch/mux.h>
080a46eaf   Aneesh V   omap: fix gpio re...
23
  #include <asm/arch/gpio.h>
2be2c6cc6   Dirk Behme   OMAP3: Add Pandor...
24
25
26
  #include <asm/arch/sys_proto.h>
  #include <asm/mach-types.h>
  #include "pandora.h"
295653262   John Rigby   Move DECLARE_GLOB...
27
  DECLARE_GLOBAL_DATA_PTR;
5246d01ed   Grazvydas Ignotas   OMAP3: pandora: e...
28
29
30
  #define TWL4030_BB_CFG_BBCHEN		(1 << 4)
  #define TWL4030_BB_CFG_BBSEL_3200MV	(3 << 2)
  #define TWL4030_BB_CFG_BBISEL_500UA	2
7cad446b8   Grazvydas Ignotas   OMAP3: pandora: r...
31
32
33
  #define CONTROL_WKUP_CTRL		0x48002a5c
  #define GPIO_IO_PWRDNZ			(1 << 6)
  #define PBIASLITEVMODE1			(1 << 8)
8a86152db   Grazvydas Ignotas   omap3: pandora: E...
34
35
36
37
38
39
40
41
42
43
44
  static const struct ns16550_platdata pandora_serial = {
  	.base = OMAP34XX_UART3,
  	.reg_shift = 2,
  	.clock = V_NS16550_CLK,
  	.fcr = UART_FCR_DEFVAL,
  };
  
  U_BOOT_DEVICE(pandora_uart) = {
  	"ns16550_serial",
  	&pandora_serial
  };
589115170   Tom Rix   OMAP3 Fix multili...
45
  /*
2be2c6cc6   Dirk Behme   OMAP3: Add Pandor...
46
47
   * Routine: board_init
   * Description: Early hardware init.
589115170   Tom Rix   OMAP3 Fix multili...
48
   */
2be2c6cc6   Dirk Behme   OMAP3: Add Pandor...
49
50
  int board_init(void)
  {
2be2c6cc6   Dirk Behme   OMAP3: Add Pandor...
51
52
53
54
55
56
57
58
  	gpmc_init(); /* in SRAM or SDRAM, finish GPMC */
  	/* board id for Linux */
  	gd->bd->bi_arch_number = MACH_TYPE_OMAP3_PANDORA;
  	/* boot param addr */
  	gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
  
  	return 0;
  }
7cad446b8   Grazvydas Ignotas   OMAP3: pandora: r...
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
  static void set_output_gpio(unsigned int gpio, int value)
  {
  	int ret;
  
  	ret = gpio_request(gpio, "");
  	if (ret != 0) {
  		printf("could not request GPIO %u
  ", gpio);
  		return;
  	}
  	ret = gpio_direction_output(gpio, value);
  	if (ret != 0)
  		printf("could not set GPIO %u to %d
  ", gpio, value);
  }
589115170   Tom Rix   OMAP3 Fix multili...
74
  /*
2be2c6cc6   Dirk Behme   OMAP3: Add Pandor...
75
76
   * Routine: misc_init_r
   * Description: Configure board specific parts
589115170   Tom Rix   OMAP3 Fix multili...
77
   */
2be2c6cc6   Dirk Behme   OMAP3: Add Pandor...
78
79
  int misc_init_r(void)
  {
7cad446b8   Grazvydas Ignotas   OMAP3: pandora: r...
80
81
  	t2_t *t2_base = (t2_t *)T2_BASE;
  	u32 pbias_lite;
2be2c6cc6   Dirk Behme   OMAP3: Add Pandor...
82

ead39d7aa   Grazvydas Ignotas   TWL4030: make LED...
83
  	twl4030_led_init(TWL4030_LED_LEDEN_LEDBON);
2be2c6cc6   Dirk Behme   OMAP3: Add Pandor...
84

7cad446b8   Grazvydas Ignotas   OMAP3: pandora: r...
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
  	/* set up dual-voltage GPIOs to 1.8V */
  	pbias_lite = readl(&t2_base->pbias_lite);
  	pbias_lite &= ~PBIASLITEVMODE1;
  	pbias_lite |= PBIASLITEPWRDNZ1;
  	writel(pbias_lite, &t2_base->pbias_lite);
  	if (get_cpu_family() == CPU_OMAP36XX)
  		writel(readl(CONTROL_WKUP_CTRL) | GPIO_IO_PWRDNZ,
  			CONTROL_WKUP_CTRL);
  
  	/* make sure audio and BT chips are in powerdown state */
  	set_output_gpio(14, 0);
  	set_output_gpio(15, 0);
  	set_output_gpio(118, 0);
  
  	/* enable USB supply */
  	set_output_gpio(164, 1);
2be2c6cc6   Dirk Behme   OMAP3: Add Pandor...
101

7cad446b8   Grazvydas Ignotas   OMAP3: pandora: r...
102
103
104
105
  	/* wifi needs a short pulse to enter powersave state */
  	set_output_gpio(23, 1);
  	udelay(5000);
  	gpio_direction_output(23, 0);
2be2c6cc6   Dirk Behme   OMAP3: Add Pandor...
106

5246d01ed   Grazvydas Ignotas   OMAP3: pandora: e...
107
108
  	/* Enable battery backup capacitor (3.2V, 0.5mA charge current) */
  	twl4030_i2c_write_u8(TWL4030_CHIP_PM_RECEIVER,
0208aaf6c   Nishanth Menon   twl4030: make twl...
109
  		TWL4030_PM_RECEIVER_BB_CFG,
5246d01ed   Grazvydas Ignotas   OMAP3: pandora: e...
110
  		TWL4030_BB_CFG_BBCHEN | TWL4030_BB_CFG_BBSEL_3200MV |
0208aaf6c   Nishanth Menon   twl4030: make twl...
111
  		TWL4030_BB_CFG_BBISEL_500UA);
5246d01ed   Grazvydas Ignotas   OMAP3: pandora: e...
112

679f82c34   Paul Kocialkowski   omap-common: Comm...
113
  	omap_die_id_display();
e6a6a7041   Dirk Behme   OMAP3: Add suppor...
114

2be2c6cc6   Dirk Behme   OMAP3: Add Pandor...
115
116
  	return 0;
  }
589115170   Tom Rix   OMAP3 Fix multili...
117
  /*
2be2c6cc6   Dirk Behme   OMAP3: Add Pandor...
118
119
120
121
   * Routine: set_muxconf_regs
   * Description: Setting up the configuration Mux registers specific to the
   *		hardware. Many pins need to be moved from protect to primary
   *		mode.
589115170   Tom Rix   OMAP3 Fix multili...
122
   */
2be2c6cc6   Dirk Behme   OMAP3: Add Pandor...
123
124
125
  void set_muxconf_regs(void)
  {
  	MUX_PANDORA();
10cd73bf8   Grazvydas Ignotas   OMAP3: pandora: p...
126
127
128
  	if (get_cpu_family() == CPU_OMAP36XX) {
  		MUX_PANDORA_3730();
  	}
2be2c6cc6   Dirk Behme   OMAP3: Add Pandor...
129
  }
86c5c5440   Tom Rini   OMAP3: pandora: U...
130

4aa2ba3a3   Masahiro Yamada   mmc: replace CONF...
131
  #ifdef CONFIG_MMC
86c5c5440   Tom Rini   OMAP3: pandora: U...
132
133
  int board_mmc_init(bd_t *bis)
  {
e3913f56a   Nikita Kiryanov   omap_hsmmc: add d...
134
  	return omap_mmc_init(0, 0, 0, -1, -1);
86c5c5440   Tom Rini   OMAP3: pandora: U...
135
  }
aac5450ea   Paul Kocialkowski   omap_hsmmc: Board...
136
137
138
139
140
  
  void board_mmc_power_init(void)
  {
  	twl4030_power_mmc_init(0);
  }
86c5c5440   Tom Rini   OMAP3: pandora: U...
141
  #endif