1 // SPDX-License-Identifier: GPL-2.0+
4 * Tapani Utriainen <linuxfae@technexion.com>
10 #include <asm/arch/mmc_host_def.h>
11 #include <asm/arch/mem.h>
12 #include <asm/arch/mux.h>
13 #include <asm/arch/sys_proto.h>
14 #include <asm/arch/gpio.h>
16 #include <asm/mach-types.h>
19 #include <asm/ehci-omap.h>
23 DECLARE_GLOBAL_DATA_PTR;
25 int tao3530_revision(void)
29 /* char *label argument is unused in gpio_request() */
30 ret = gpio_request(65, "");
32 puts("Error: GPIO 65 not available\n");
35 MUX_VAL(CP(GPMC_WAIT3), (IEN | PTU | EN | M4));
37 ret = gpio_request(1, "");
39 puts("Error: GPIO 1 not available\n");
42 MUX_VAL(CP(SYS_CLKREQ), (IEN | PTU | EN | M4));
44 ret = gpio_direction_input(65);
46 puts("Error: GPIO 65 not available for input\n");
50 ret = gpio_direction_input(1);
52 puts("Error: GPIO 1 not available for input\n");
56 ret = gpio_get_value(65) << 1 | gpio_get_value(1);
59 MUX_VAL(CP(SYS_CLKREQ), (IEN | PTU | EN | M0));
62 MUX_VAL(CP(GPMC_WAIT3), (IEN | PTU | EN | M0));
69 #ifdef CONFIG_SPL_BUILD
71 * Routine: get_board_mem_timings
72 * Description: If we use SPL then there is no x-loader nor config header
73 * so we have to setup the DDR timings ourself on both banks.
75 void get_board_mem_timings(struct board_sdrc_timings *timings)
77 #if defined(CONFIG_SYS_BOARD_OMAP3_HA)
79 * Switch baseboard LED to red upon power-on
83 /* Request a gpio before using it */
84 gpio_request(111, "");
85 /* Sets the gpio as output and its value to 1, switch LED to red */
86 gpio_direction_output(111, 1);
89 if (tao3530_revision() < 3) {
91 timings->mcfg = MCFG(256 << 20, 14); /* RAS-width 14 */
92 timings->ctrla = HYNIX_V_ACTIMA_165;
93 timings->ctrlb = HYNIX_V_ACTIMB_165;
96 timings->mcfg = MCFG(128 << 20, 13); /* RAS-width 13 */
97 timings->ctrla = MICRON_V_ACTIMA_165;
98 timings->ctrlb = MICRON_V_ACTIMB_165;
101 timings->mr = MICRON_V_MR_165;
102 timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz;
107 * Routine: board_init
108 * Description: Early hardware init.
112 gpmc_init(); /* in SRAM or SDRAM, finish GPMC */
113 /* board id for Linux */
114 gd->bd->bi_arch_number = MACH_TYPE_OMAP3_TAO3530;
115 /* boot param addr */
116 gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
122 * Routine: misc_init_r
123 * Description: Configure board specific parts
125 int misc_init_r(void)
127 struct gpio *gpio5_base = (struct gpio *)OMAP34XX_GPIO5_BASE;
128 struct gpio *gpio6_base = (struct gpio *)OMAP34XX_GPIO6_BASE;
130 twl4030_power_init();
131 twl4030_led_init(TWL4030_LED_LEDEN_LEDAON | TWL4030_LED_LEDEN_LEDBON);
133 /* Configure GPIOs to output */
135 writel(~(GPIO10 | GPIO8 | GPIO2 | GPIO1), &gpio6_base->oe);
136 writel(~(GPIO31 | GPIO30 | GPIO22 | GPIO21 |
137 GPIO15 | GPIO14 | GPIO13 | GPIO12), &gpio5_base->oe);
140 writel(GPIO10 | GPIO8 | GPIO2 | GPIO1,
141 &gpio6_base->setdataout);
142 writel(GPIO31 | GPIO30 | GPIO29 | GPIO28 | GPIO22 | GPIO21 |
143 GPIO15 | GPIO14 | GPIO13 | GPIO12, &gpio5_base->setdataout);
145 switch (tao3530_revision()) {
147 puts("TAO-3530 REV Reserve 1\n");
150 puts("TAO-3530 REV Reserve 2\n");
153 puts("TAO-3530 REV Cx\n");
156 puts("TAO-3530 REV Ax/Bx\n");
159 puts("Unknown board revision\n");
162 omap_die_id_display();
168 * Routine: set_muxconf_regs
169 * Description: Setting up the configuration Mux registers specific to the
170 * hardware. Many pins need to be moved from protect to primary
173 void set_muxconf_regs(void)
176 #if defined(CONFIG_SYS_BOARD_OMAP3_HA)
181 #if defined(CONFIG_MMC)
182 int board_mmc_init(bd_t *bis)
184 omap_mmc_init(0, 0, 0, -1, -1);
190 #if defined(CONFIG_MMC)
191 void board_mmc_power_init(void)
193 twl4030_power_mmc_init(0);
197 #if defined(CONFIG_USB_EHCI_HCD) && !defined(CONFIG_SPL_BUILD)
198 /* Call usb_stop() before starting the kernel */
199 void show_boot_progress(int val)
201 if (val == BOOTSTAGE_ID_RUN_OS)
205 static struct omap_usbhs_board_data usbhs_bdata = {
206 .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED,
207 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
208 .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED
211 int ehci_hcd_init(int index, enum usb_init_type init,
212 struct ehci_hccr **hccr, struct ehci_hcor **hcor)
214 return omap_ehci_hcd_init(index, &usbhs_bdata, hccr, hcor);
217 int ehci_hcd_stop(int index)
219 return omap_ehci_hcd_stop();
221 #endif /* CONFIG_USB_EHCI_HCD */