blob: 0bbe81e44df4d79a462020deaf669249812ec143 [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>
Simon Glass97589732020-05-10 11:40:02 -06008#include <init.h>
Stefan Agner60bae8c2014-08-05 23:27:30 +02009#include <asm/arch/gp_padctrl.h>
Marcel Ziswiler764d4122015-08-06 00:47:10 +020010#include <asm/arch/pinmux.h>
Marcel Ziswilerdd899d02015-08-06 00:47:00 +020011#include <asm/arch-tegra/ap.h>
12#include <asm/arch-tegra/tegra.h>
Marcel Ziswiler764d4122015-08-06 00:47:10 +020013#include <asm/gpio.h>
Marcel Ziswilerdd899d02015-08-06 00:47:00 +020014#include <asm/io.h>
Stefan Agner60bae8c2014-08-05 23:27:30 +020015#include <i2c.h>
Simon Glassdbd79542020-05-10 11:40:11 -060016#include <linux/delay.h>
Marcel Ziswiler764d4122015-08-06 00:47:10 +020017#include "pinmux-config-colibri_t30.h"
Stefan Agner98ffd0f2016-11-30 13:41:53 -080018#include "../common/tdx-common.h"
Stefan Agner60bae8c2014-08-05 23:27:30 +020019
Marcel Ziswilerdd899d02015-08-06 00:47:00 +020020int 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
Marcel Ziswilerd92dee52016-11-16 17:49:23 +010029int checkboard(void)
30{
31 puts("Model: Toradex Colibri T30 1GB\n");
32
33 return 0;
34}
35
Stefan Agner98ffd0f2016-11-30 13:41:53 -080036#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
37int ft_board_setup(void *blob, bd_t *bd)
38{
39 return ft_common_board_setup(blob, bd);
40}
41#endif
42
Stefan Agner60bae8c2014-08-05 23:27:30 +020043/*
44 * Routine: pinmux_init
45 * Description: Do individual peripheral pinmux configs
46 */
47void 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 * Enable AX88772B USB to LAN controller
62 */
63void pin_mux_usb(void)
64{
65 /* Reset ASIX using LAN_RESET */
Stephen Warren7f20bb22016-05-12 12:07:39 -060066 gpio_request(TEGRA_GPIO(DD, 0), "LAN_RESET");
67 gpio_direction_output(TEGRA_GPIO(DD, 0), 0);
Stefan Agner60bae8c2014-08-05 23:27:30 +020068 udelay(5);
Stephen Warren7f20bb22016-05-12 12:07:39 -060069 gpio_set_value(TEGRA_GPIO(DD, 0), 1);
Stefan Agner60bae8c2014-08-05 23:27:30 +020070}
Gerard Salvatella108d7392018-11-19 15:54:10 +010071
72/*
73 * Backlight off before OS handover
74 */
75void board_preboot_os(void)
76{
77 gpio_request(TEGRA_GPIO(V, 2), "BL_ON");
78 gpio_direction_output(TEGRA_GPIO(V, 2), 0);
79}