From 550e3756c52ae1c93df2a5528ab5ff6d69c7dcdc Mon Sep 17 00:00:00 2001 From: Tapani Utriainen Date: Wed, 4 Dec 2013 09:27:33 +0100 Subject: arm, omap3: Add support for TechNexion modules Add support for TechNexion TAO3530 SoM This patch has been posted quite a long time ago. I ported it to the latest mainline U-Boot version. With some additional cleanup and enhancements. Signed-off-by: Tapani Utriainen CC: Sandeep Paulraj Signed-off-by: Stefan Roese Cc: Thorsten Eisbein Cc: Tom Rini --- board/technexion/tao3530/tao3530.c | 170 +++++++++++++++++++++++++++++++++++++ 1 file changed, 170 insertions(+) create mode 100644 board/technexion/tao3530/tao3530.c (limited to 'board/technexion/tao3530/tao3530.c') diff --git a/board/technexion/tao3530/tao3530.c b/board/technexion/tao3530/tao3530.c new file mode 100644 index 0000000..0668c25 --- /dev/null +++ b/board/technexion/tao3530/tao3530.c @@ -0,0 +1,170 @@ +/* + * Maintainer : + * Tapani Utriainen + * + * SPDX-License-Identifier: GPL-2.0+ + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "tao3530.h" + +DECLARE_GLOBAL_DATA_PTR; + +int tao3530_revision(void) +{ + int ret = 0; + + /* char *label argument is unused in gpio_request() */ + ret = gpio_request(65, ""); + if (ret) { + puts("Error: GPIO 65 not available\n"); + goto out; + } + MUX_VAL(CP(GPMC_WAIT3), (IEN | PTU | EN | M4)); + + ret = gpio_request(1, ""); + if (ret) { + puts("Error: GPIO 1 not available\n"); + goto out2; + } + MUX_VAL(CP(SYS_CLKREQ), (IEN | PTU | EN | M4)); + + ret = gpio_direction_input(65); + if (ret) { + puts("Error: GPIO 65 not available for input\n"); + goto out3; + } + + ret = gpio_direction_input(1); + if (ret) { + puts("Error: GPIO 1 not available for input\n"); + goto out3; + } + + ret = gpio_get_value(65) << 1 | gpio_get_value(1); + +out3: + MUX_VAL(CP(SYS_CLKREQ), (IEN | PTU | EN | M0)); + gpio_free(1); +out2: + MUX_VAL(CP(GPMC_WAIT3), (IEN | PTU | EN | M0)); + gpio_free(65); +out: + + return ret; +} + +/* + * Routine: board_init + * Description: Early hardware init. + */ +int board_init(void) +{ + gpmc_init(); /* in SRAM or SDRAM, finish GPMC */ + /* board id for Linux */ + gd->bd->bi_arch_number = MACH_TYPE_OMAP3_TAO3530; + /* boot param addr */ + gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100); + + return 0; +} + +/* + * Routine: misc_init_r + * Description: Configure board specific parts + */ +int misc_init_r(void) +{ + struct gpio *gpio5_base = (struct gpio *)OMAP34XX_GPIO5_BASE; + struct gpio *gpio6_base = (struct gpio *)OMAP34XX_GPIO6_BASE; + + twl4030_power_init(); + twl4030_led_init(TWL4030_LED_LEDEN_LEDAON | TWL4030_LED_LEDEN_LEDBON); + + /* Configure GPIOs to output */ + /* GPIO23 */ + writel(~(GPIO10 | GPIO8 | GPIO2 | GPIO1), &gpio6_base->oe); + writel(~(GPIO31 | GPIO30 | GPIO22 | GPIO21 | + GPIO15 | GPIO14 | GPIO13 | GPIO12), &gpio5_base->oe); + + /* Set GPIOs */ + writel(GPIO10 | GPIO8 | GPIO2 | GPIO1, + &gpio6_base->setdataout); + writel(GPIO31 | GPIO30 | GPIO29 | GPIO28 | GPIO22 | GPIO21 | + GPIO15 | GPIO14 | GPIO13 | GPIO12, &gpio5_base->setdataout); + + dieid_num_r(); + + /* Set memory size environment variable, depending on revision */ + switch (tao3530_revision()) { + case 0x2: /* Rev C1 -- 256MB */ + setenv("mem_size", "mem=256M"); + break; + case 0x3: /* Rev A2/B2 -- 128MB */ + setenv("mem_size", "mem=128M"); + break; + default: + printf("Warning: Unknown TAO3530 rev, setting mem=128M\n"); + } + + return 0; +} + +/* + * 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. + */ +void set_muxconf_regs(void) +{ + MUX_TAO3530(); +} + +#ifdef CONFIG_GENERIC_MMC +int board_mmc_init(bd_t *bis) +{ + omap_mmc_init(0, 0, 0, -1, -1); + + return 0; +} +#endif + +#if defined(CONFIG_USB_EHCI) && !defined(CONFIG_SPL_BUILD) +/* Call usb_stop() before starting the kernel */ +void show_boot_progress(int val) +{ + if (val == BOOTSTAGE_ID_RUN_OS) + usb_stop(); +} + +static struct omap_usbhs_board_data usbhs_bdata = { + .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED, + .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, + .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED +}; + +int ehci_hcd_init(int index, enum usb_init_type init, + struct ehci_hccr **hccr, struct ehci_hcor **hcor) +{ + return omap_ehci_hcd_init(index, &usbhs_bdata, hccr, hcor); +} + +int ehci_hcd_stop(int index) +{ + return omap_ehci_hcd_stop(); +} +#endif /* CONFIG_USB_EHCI */ -- cgit v1.1