1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3 * (C) Copyright 2014-2016
4 * Stefan Agner <stefan@agner.ch>
5 */
6
7 #include <common.h>
8 #include <init.h>
9 #include <asm/arch/gp_padctrl.h>
10 #include <asm/arch/pinmux.h>
11 #include <asm/arch-tegra/ap.h>
12 #include <asm/arch-tegra/tegra.h>
13 #include <asm/gpio.h>
14 #include <asm/io.h>
15 #include <i2c.h>
16 #include <linux/delay.h>
17 #include "pinmux-config-colibri_t30.h"
18 #include "../common/tdx-common.h"
19
arch_misc_init(void)20 int arch_misc_init(void)
21 {
22 if (readl(NV_PA_BASE_SRAM + NVBOOTINFOTABLE_BOOTTYPE) ==
23 NVBOOTTYPE_RECOVERY)
24 printf("USB recovery mode\n");
25
26 return 0;
27 }
28
checkboard(void)29 int checkboard(void)
30 {
31 puts("Model: Toradex Colibri T30 1GB\n");
32
33 return 0;
34 }
35
36 #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
ft_board_setup(void * blob,struct bd_info * bd)37 int ft_board_setup(void *blob, struct bd_info *bd)
38 {
39 return ft_common_board_setup(blob, bd);
40 }
41 #endif
42
43 /*
44 * Routine: pinmux_init
45 * Description: Do individual peripheral pinmux configs
46 */
pinmux_init(void)47 void pinmux_init(void)
48 {
49 pinmux_config_pingrp_table(tegra3_pinmux_common,
50 ARRAY_SIZE(tegra3_pinmux_common));
51
52 pinmux_config_pingrp_table(unused_pins_lowpower,
53 ARRAY_SIZE(unused_pins_lowpower));
54
55 /* Initialize any non-default pad configs (APB_MISC_GP regs) */
56 pinmux_config_drvgrp_table(colibri_t30_padctrl,
57 ARRAY_SIZE(colibri_t30_padctrl));
58 }
59
60 /*
61 * Disable RS232 serial transceiver ForceOFF# pins on Iris
62 */
gpio_early_init_uart(void)63 void gpio_early_init_uart(void)
64 {
65 gpio_request(TEGRA_GPIO(X, 6), "Force OFF# X13");
66 gpio_direction_output(TEGRA_GPIO(X, 6), 1);
67 gpio_request(TEGRA_GPIO(X, 7), "Force OFF# X14");
68 gpio_direction_output(TEGRA_GPIO(X, 7), 1);
69 }
70
71 /*
72 * Enable AX88772B USB to LAN controller
73 */
pin_mux_usb(void)74 void pin_mux_usb(void)
75 {
76 /* Reset ASIX using LAN_RESET */
77 gpio_request(TEGRA_GPIO(DD, 0), "LAN_RESET");
78 gpio_direction_output(TEGRA_GPIO(DD, 0), 0);
79 udelay(5);
80 gpio_set_value(TEGRA_GPIO(DD, 0), 1);
81 }
82
83 /*
84 * Backlight off before OS handover
85 */
board_preboot_os(void)86 void board_preboot_os(void)
87 {
88 gpio_request(TEGRA_GPIO(V, 2), "BL_ON");
89 gpio_direction_output(TEGRA_GPIO(V, 2), 0);
90 }
91