blob: b6b00e3860d8df18e7d105a6b627f9503f2c2252 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Stefan Agner60bae8c2014-08-05 23:27:30 +02002/*
Marcel Ziswilerd92dee52016-11-16 17:49:23 +01003 * (C) Copyright 2014-2016
Stefan Agner60bae8c2014-08-05 23:27:30 +02004 * Stefan Agner <stefan@agner.ch>
Stefan Agner60bae8c2014-08-05 23:27:30 +02005 */
6
7#include <common.h>
Stefan Agner60bae8c2014-08-05 23:27:30 +02008#include <asm/arch/gp_padctrl.h>
Marcel Ziswiler764d4122015-08-06 00:47:10 +02009#include <asm/arch/pinmux.h>
Marcel Ziswilerdd899d02015-08-06 00:47:00 +020010#include <asm/arch-tegra/ap.h>
11#include <asm/arch-tegra/tegra.h>
Marcel Ziswiler764d4122015-08-06 00:47:10 +020012#include <asm/gpio.h>
Marcel Ziswilerdd899d02015-08-06 00:47:00 +020013#include <asm/io.h>
Stefan Agner60bae8c2014-08-05 23:27:30 +020014#include <i2c.h>
Marcel Ziswiler764d4122015-08-06 00:47:10 +020015#include "pinmux-config-colibri_t30.h"
Stefan Agner98ffd0f2016-11-30 13:41:53 -080016#include "../common/tdx-common.h"
Stefan Agner60bae8c2014-08-05 23:27:30 +020017
Marcel Ziswilerdd899d02015-08-06 00:47:00 +020018int arch_misc_init(void)
19{
20 if (readl(NV_PA_BASE_SRAM + NVBOOTINFOTABLE_BOOTTYPE) ==
21 NVBOOTTYPE_RECOVERY)
22 printf("USB recovery mode\n");
23
24 return 0;
25}
26
Marcel Ziswilerd92dee52016-11-16 17:49:23 +010027int checkboard(void)
28{
29 puts("Model: Toradex Colibri T30 1GB\n");
30
31 return 0;
32}
33
Stefan Agner98ffd0f2016-11-30 13:41:53 -080034#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
35int ft_board_setup(void *blob, bd_t *bd)
36{
37 return ft_common_board_setup(blob, bd);
38}
39#endif
40
Stefan Agner60bae8c2014-08-05 23:27:30 +020041/*
42 * Routine: pinmux_init
43 * Description: Do individual peripheral pinmux configs
44 */
45void pinmux_init(void)
46{
47 pinmux_config_pingrp_table(tegra3_pinmux_common,
48 ARRAY_SIZE(tegra3_pinmux_common));
49
50 pinmux_config_pingrp_table(unused_pins_lowpower,
51 ARRAY_SIZE(unused_pins_lowpower));
52
53 /* Initialize any non-default pad configs (APB_MISC_GP regs) */
54 pinmux_config_drvgrp_table(colibri_t30_padctrl,
55 ARRAY_SIZE(colibri_t30_padctrl));
56}
57
58/*
59 * Enable AX88772B USB to LAN controller
60 */
61void pin_mux_usb(void)
62{
63 /* Reset ASIX using LAN_RESET */
Stephen Warren7f20bb22016-05-12 12:07:39 -060064 gpio_request(TEGRA_GPIO(DD, 0), "LAN_RESET");
65 gpio_direction_output(TEGRA_GPIO(DD, 0), 0);
Stefan Agner60bae8c2014-08-05 23:27:30 +020066 udelay(5);
Stephen Warren7f20bb22016-05-12 12:07:39 -060067 gpio_set_value(TEGRA_GPIO(DD, 0), 1);
Stefan Agner60bae8c2014-08-05 23:27:30 +020068}
Gerard Salvatella108d7392018-11-19 15:54:10 +010069
70/*
71 * Backlight off before OS handover
72 */
73void board_preboot_os(void)
74{
75 gpio_request(TEGRA_GPIO(V, 2), "BL_ON");
76 gpio_direction_output(TEGRA_GPIO(V, 2), 0);
77}