1 // SPDX-License-Identifier: GPL-2.0+
4 * Tapani Utriainen <linuxfae@technexion.com>
12 #include <asm/arch/mmc_host_def.h>
13 #include <asm/arch/mem.h>
14 #include <asm/arch/mux.h>
15 #include <asm/arch/sys_proto.h>
16 #include <asm/arch/gpio.h>
18 #include <asm/mach-types.h>
21 #include <asm/ehci-omap.h>
25 DECLARE_GLOBAL_DATA_PTR;
27 int tao3530_revision(void)
31 /* char *label argument is unused in gpio_request() */
32 ret = gpio_request(65, "");
34 puts("Error: GPIO 65 not available\n");
37 MUX_VAL(CP(GPMC_WAIT3), (IEN | PTU | EN | M4));
39 ret = gpio_request(1, "");
41 puts("Error: GPIO 1 not available\n");
44 MUX_VAL(CP(SYS_CLKREQ), (IEN | PTU | EN | M4));
46 ret = gpio_direction_input(65);
48 puts("Error: GPIO 65 not available for input\n");
52 ret = gpio_direction_input(1);
54 puts("Error: GPIO 1 not available for input\n");
58 ret = gpio_get_value(65) << 1 | gpio_get_value(1);
61 MUX_VAL(CP(SYS_CLKREQ), (IEN | PTU | EN | M0));
64 MUX_VAL(CP(GPMC_WAIT3), (IEN | PTU | EN | M0));
71 #ifdef CONFIG_SPL_BUILD
73 * Routine: get_board_mem_timings
74 * Description: If we use SPL then there is no x-loader nor config header
75 * so we have to setup the DDR timings ourself on both banks.
77 void get_board_mem_timings(struct board_sdrc_timings *timings)
79 #if defined(CONFIG_SYS_BOARD_OMAP3_HA)
81 * Switch baseboard LED to red upon power-on
85 /* Request a gpio before using it */
86 gpio_request(111, "");
87 /* Sets the gpio as output and its value to 1, switch LED to red */
88 gpio_direction_output(111, 1);
91 if (tao3530_revision() < 3) {
93 timings->mcfg = MCFG(256 << 20, 14); /* RAS-width 14 */
94 timings->ctrla = HYNIX_V_ACTIMA_165;
95 timings->ctrlb = HYNIX_V_ACTIMB_165;
98 timings->mcfg = MCFG(128 << 20, 13); /* RAS-width 13 */
99 timings->ctrla = MICRON_V_ACTIMA_165;
100 timings->ctrlb = MICRON_V_ACTIMB_165;
103 timings->mr = MICRON_V_MR_165;
104 timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz;
109 * Routine: board_init
110 * Description: Early hardware init.
114 gpmc_init(); /* in SRAM or SDRAM, finish GPMC */
115 /* board id for Linux */
116 gd->bd->bi_arch_number = MACH_TYPE_OMAP3_TAO3530;
117 /* boot param addr */
118 gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
124 * Routine: misc_init_r
125 * Description: Configure board specific parts
127 int misc_init_r(void)
129 struct gpio *gpio5_base = (struct gpio *)OMAP34XX_GPIO5_BASE;
130 struct gpio *gpio6_base = (struct gpio *)OMAP34XX_GPIO6_BASE;
132 twl4030_power_init();
133 twl4030_led_init(TWL4030_LED_LEDEN_LEDAON | TWL4030_LED_LEDEN_LEDBON);
135 /* Configure GPIOs to output */
137 writel(~(GPIO10 | GPIO8 | GPIO2 | GPIO1), &gpio6_base->oe);
138 writel(~(GPIO31 | GPIO30 | GPIO22 | GPIO21 |
139 GPIO15 | GPIO14 | GPIO13 | GPIO12), &gpio5_base->oe);
142 writel(GPIO10 | GPIO8 | GPIO2 | GPIO1,
143 &gpio6_base->setdataout);
144 writel(GPIO31 | GPIO30 | GPIO29 | GPIO28 | GPIO22 | GPIO21 |
145 GPIO15 | GPIO14 | GPIO13 | GPIO12, &gpio5_base->setdataout);
147 switch (tao3530_revision()) {
149 puts("TAO-3530 REV Reserve 1\n");
152 puts("TAO-3530 REV Reserve 2\n");
155 puts("TAO-3530 REV Cx\n");
158 puts("TAO-3530 REV Ax/Bx\n");
161 puts("Unknown board revision\n");
164 omap_die_id_display();
170 * Routine: set_muxconf_regs
171 * Description: Setting up the configuration Mux registers specific to the
172 * hardware. Many pins need to be moved from protect to primary
175 void set_muxconf_regs(void)
178 #if defined(CONFIG_SYS_BOARD_OMAP3_HA)
183 #if defined(CONFIG_MMC)
184 int board_mmc_init(bd_t *bis)
186 omap_mmc_init(0, 0, 0, -1, -1);
192 #if defined(CONFIG_MMC)
193 void board_mmc_power_init(void)
195 twl4030_power_mmc_init(0);
199 #if defined(CONFIG_USB_EHCI_HCD) && !defined(CONFIG_SPL_BUILD)
200 /* Call usb_stop() before starting the kernel */
201 void show_boot_progress(int val)
203 if (val == BOOTSTAGE_ID_RUN_OS)
207 static struct omap_usbhs_board_data usbhs_bdata = {
208 .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED,
209 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
210 .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED
213 int ehci_hcd_init(int index, enum usb_init_type init,
214 struct ehci_hccr **hccr, struct ehci_hcor **hcor)
216 return omap_ehci_hcd_init(index, &usbhs_bdata, hccr, hcor);
219 int ehci_hcd_stop(int index)
221 return omap_ehci_hcd_stop();
223 #endif /* CONFIG_USB_EHCI_HCD */