3 * Tapani Utriainen <linuxfae@technexion.com>
5 * SPDX-License-Identifier: GPL-2.0+
11 #include <asm/arch/mmc_host_def.h>
12 #include <asm/arch/mem.h>
13 #include <asm/arch/mux.h>
14 #include <asm/arch/sys_proto.h>
15 #include <asm/arch/gpio.h>
17 #include <asm/mach-types.h>
20 #include <asm/ehci-omap.h>
24 DECLARE_GLOBAL_DATA_PTR;
26 int tao3530_revision(void)
30 /* char *label argument is unused in gpio_request() */
31 ret = gpio_request(65, "");
33 puts("Error: GPIO 65 not available\n");
36 MUX_VAL(CP(GPMC_WAIT3), (IEN | PTU | EN | M4));
38 ret = gpio_request(1, "");
40 puts("Error: GPIO 1 not available\n");
43 MUX_VAL(CP(SYS_CLKREQ), (IEN | PTU | EN | M4));
45 ret = gpio_direction_input(65);
47 puts("Error: GPIO 65 not available for input\n");
51 ret = gpio_direction_input(1);
53 puts("Error: GPIO 1 not available for input\n");
57 ret = gpio_get_value(65) << 1 | gpio_get_value(1);
60 MUX_VAL(CP(SYS_CLKREQ), (IEN | PTU | EN | M0));
63 MUX_VAL(CP(GPMC_WAIT3), (IEN | PTU | EN | M0));
70 #ifdef CONFIG_SPL_BUILD
72 * Routine: get_board_mem_timings
73 * Description: If we use SPL then there is no x-loader nor config header
74 * so we have to setup the DDR timings ourself on both banks.
76 void get_board_mem_timings(struct board_sdrc_timings *timings)
78 #if defined(CONFIG_SYS_BOARD_OMAP3_HA)
80 * Switch baseboard LED to red upon power-on
84 /* Request a gpio before using it */
85 gpio_request(111, "");
86 /* Sets the gpio as output and its value to 1, switch LED to red */
87 gpio_direction_output(111, 1);
90 if (tao3530_revision() < 3) {
92 timings->mcfg = MCFG(256 << 20, 14); /* RAS-width 14 */
93 timings->ctrla = HYNIX_V_ACTIMA_165;
94 timings->ctrlb = HYNIX_V_ACTIMB_165;
97 timings->mcfg = MCFG(128 << 20, 13); /* RAS-width 13 */
98 timings->ctrla = MICRON_V_ACTIMA_165;
99 timings->ctrlb = MICRON_V_ACTIMB_165;
102 timings->mr = MICRON_V_MR_165;
103 timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz;
108 * Routine: board_init
109 * Description: Early hardware init.
113 gpmc_init(); /* in SRAM or SDRAM, finish GPMC */
114 /* board id for Linux */
115 gd->bd->bi_arch_number = MACH_TYPE_OMAP3_TAO3530;
116 /* boot param addr */
117 gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
123 * Routine: misc_init_r
124 * Description: Configure board specific parts
126 int misc_init_r(void)
128 struct gpio *gpio5_base = (struct gpio *)OMAP34XX_GPIO5_BASE;
129 struct gpio *gpio6_base = (struct gpio *)OMAP34XX_GPIO6_BASE;
131 twl4030_power_init();
132 twl4030_led_init(TWL4030_LED_LEDEN_LEDAON | TWL4030_LED_LEDEN_LEDBON);
134 /* Configure GPIOs to output */
136 writel(~(GPIO10 | GPIO8 | GPIO2 | GPIO1), &gpio6_base->oe);
137 writel(~(GPIO31 | GPIO30 | GPIO22 | GPIO21 |
138 GPIO15 | GPIO14 | GPIO13 | GPIO12), &gpio5_base->oe);
141 writel(GPIO10 | GPIO8 | GPIO2 | GPIO1,
142 &gpio6_base->setdataout);
143 writel(GPIO31 | GPIO30 | GPIO29 | GPIO28 | GPIO22 | GPIO21 |
144 GPIO15 | GPIO14 | GPIO13 | GPIO12, &gpio5_base->setdataout);
146 switch (tao3530_revision()) {
148 puts("TAO-3530 REV Reserve 1\n");
151 puts("TAO-3530 REV Reserve 2\n");
154 puts("TAO-3530 REV Cx\n");
157 puts("TAO-3530 REV Ax/Bx\n");
160 puts("Unknown board revision\n");
163 omap_die_id_display();
169 * Routine: set_muxconf_regs
170 * Description: Setting up the configuration Mux registers specific to the
171 * hardware. Many pins need to be moved from protect to primary
174 void set_muxconf_regs(void)
177 #if defined(CONFIG_SYS_BOARD_OMAP3_HA)
182 #if defined(CONFIG_GENERIC_MMC) && !defined(CONFIG_SPL_BUILD)
183 int board_mmc_init(bd_t *bis)
185 omap_mmc_init(0, 0, 0, -1, -1);
191 #if defined(CONFIG_GENERIC_MMC)
192 void board_mmc_power_init(void)
194 twl4030_power_mmc_init(0);
198 #if defined(CONFIG_USB_EHCI) && !defined(CONFIG_SPL_BUILD)
199 /* Call usb_stop() before starting the kernel */
200 void show_boot_progress(int val)
202 if (val == BOOTSTAGE_ID_RUN_OS)
206 static struct omap_usbhs_board_data usbhs_bdata = {
207 .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED,
208 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
209 .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED
212 int ehci_hcd_init(int index, enum usb_init_type init,
213 struct ehci_hccr **hccr, struct ehci_hcor **hcor)
215 return omap_ehci_hcd_init(index, &usbhs_bdata, hccr, hcor);
218 int ehci_hcd_stop(int index)
220 return omap_ehci_hcd_stop();
222 #endif /* CONFIG_USB_EHCI */