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));
72 * Description: Early hardware init.
76 gpmc_init(); /* in SRAM or SDRAM, finish GPMC */
77 /* board id for Linux */
78 gd->bd->bi_arch_number = MACH_TYPE_OMAP3_TAO3530;
80 gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
86 * Routine: misc_init_r
87 * Description: Configure board specific parts
91 struct gpio *gpio5_base = (struct gpio *)OMAP34XX_GPIO5_BASE;
92 struct gpio *gpio6_base = (struct gpio *)OMAP34XX_GPIO6_BASE;
95 twl4030_led_init(TWL4030_LED_LEDEN_LEDAON | TWL4030_LED_LEDEN_LEDBON);
97 /* Configure GPIOs to output */
99 writel(~(GPIO10 | GPIO8 | GPIO2 | GPIO1), &gpio6_base->oe);
100 writel(~(GPIO31 | GPIO30 | GPIO22 | GPIO21 |
101 GPIO15 | GPIO14 | GPIO13 | GPIO12), &gpio5_base->oe);
104 writel(GPIO10 | GPIO8 | GPIO2 | GPIO1,
105 &gpio6_base->setdataout);
106 writel(GPIO31 | GPIO30 | GPIO29 | GPIO28 | GPIO22 | GPIO21 |
107 GPIO15 | GPIO14 | GPIO13 | GPIO12, &gpio5_base->setdataout);
111 /* Set memory size environment variable, depending on revision */
112 switch (tao3530_revision()) {
113 case 0x2: /* Rev C1 -- 256MB */
114 setenv("mem_size", "mem=256M");
116 case 0x3: /* Rev A2/B2 -- 128MB */
117 setenv("mem_size", "mem=128M");
120 printf("Warning: Unknown TAO3530 rev, setting mem=128M\n");
127 * Routine: set_muxconf_regs
128 * Description: Setting up the configuration Mux registers specific to the
129 * hardware. Many pins need to be moved from protect to primary
132 void set_muxconf_regs(void)
137 #ifdef CONFIG_GENERIC_MMC
138 int board_mmc_init(bd_t *bis)
140 omap_mmc_init(0, 0, 0, -1, -1);
146 #if defined(CONFIG_USB_EHCI) && !defined(CONFIG_SPL_BUILD)
147 /* Call usb_stop() before starting the kernel */
148 void show_boot_progress(int val)
150 if (val == BOOTSTAGE_ID_RUN_OS)
154 static struct omap_usbhs_board_data usbhs_bdata = {
155 .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED,
156 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
157 .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED
160 int ehci_hcd_init(int index, enum usb_init_type init,
161 struct ehci_hccr **hccr, struct ehci_hcor **hcor)
163 return omap_ehci_hcd_init(index, &usbhs_bdata, hccr, hcor);
166 int ehci_hcd_stop(int index)
168 return omap_ehci_hcd_stop();
170 #endif /* CONFIG_USB_EHCI */