Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Stefan Agner | 60bae8c | 2014-08-05 23:27:30 +0200 | [diff] [blame] | 2 | /* |
Marcel Ziswiler | d92dee5 | 2016-11-16 17:49:23 +0100 | [diff] [blame] | 3 | * (C) Copyright 2014-2016 |
Stefan Agner | 60bae8c | 2014-08-05 23:27:30 +0200 | [diff] [blame] | 4 | * Stefan Agner <stefan@agner.ch> |
Stefan Agner | 60bae8c | 2014-08-05 23:27:30 +0200 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #include <common.h> |
Stefan Agner | 60bae8c | 2014-08-05 23:27:30 +0200 | [diff] [blame] | 8 | #include <asm/arch/gp_padctrl.h> |
Marcel Ziswiler | 764d412 | 2015-08-06 00:47:10 +0200 | [diff] [blame] | 9 | #include <asm/arch/pinmux.h> |
Marcel Ziswiler | dd899d0 | 2015-08-06 00:47:00 +0200 | [diff] [blame] | 10 | #include <asm/arch-tegra/ap.h> |
| 11 | #include <asm/arch-tegra/tegra.h> |
Marcel Ziswiler | 764d412 | 2015-08-06 00:47:10 +0200 | [diff] [blame] | 12 | #include <asm/gpio.h> |
Marcel Ziswiler | dd899d0 | 2015-08-06 00:47:00 +0200 | [diff] [blame] | 13 | #include <asm/io.h> |
Stefan Agner | 60bae8c | 2014-08-05 23:27:30 +0200 | [diff] [blame] | 14 | #include <i2c.h> |
Marcel Ziswiler | 764d412 | 2015-08-06 00:47:10 +0200 | [diff] [blame] | 15 | #include "pinmux-config-colibri_t30.h" |
Stefan Agner | 98ffd0f | 2016-11-30 13:41:53 -0800 | [diff] [blame] | 16 | #include "../common/tdx-common.h" |
Stefan Agner | 60bae8c | 2014-08-05 23:27:30 +0200 | [diff] [blame] | 17 | |
Marcel Ziswiler | dd899d0 | 2015-08-06 00:47:00 +0200 | [diff] [blame] | 18 | int 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 Ziswiler | d92dee5 | 2016-11-16 17:49:23 +0100 | [diff] [blame] | 27 | int checkboard(void) |
| 28 | { |
| 29 | puts("Model: Toradex Colibri T30 1GB\n"); |
| 30 | |
| 31 | return 0; |
| 32 | } |
| 33 | |
Stefan Agner | 98ffd0f | 2016-11-30 13:41:53 -0800 | [diff] [blame] | 34 | #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) |
| 35 | int ft_board_setup(void *blob, bd_t *bd) |
| 36 | { |
| 37 | return ft_common_board_setup(blob, bd); |
| 38 | } |
| 39 | #endif |
| 40 | |
Stefan Agner | 60bae8c | 2014-08-05 23:27:30 +0200 | [diff] [blame] | 41 | /* |
| 42 | * Routine: pinmux_init |
| 43 | * Description: Do individual peripheral pinmux configs |
| 44 | */ |
| 45 | void 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 | */ |
| 61 | void pin_mux_usb(void) |
| 62 | { |
| 63 | /* Reset ASIX using LAN_RESET */ |
Stephen Warren | 7f20bb2 | 2016-05-12 12:07:39 -0600 | [diff] [blame] | 64 | gpio_request(TEGRA_GPIO(DD, 0), "LAN_RESET"); |
| 65 | gpio_direction_output(TEGRA_GPIO(DD, 0), 0); |
Stefan Agner | 60bae8c | 2014-08-05 23:27:30 +0200 | [diff] [blame] | 66 | udelay(5); |
Stephen Warren | 7f20bb2 | 2016-05-12 12:07:39 -0600 | [diff] [blame] | 67 | gpio_set_value(TEGRA_GPIO(DD, 0), 1); |
Stefan Agner | 60bae8c | 2014-08-05 23:27:30 +0200 | [diff] [blame] | 68 | } |
Gerard Salvatella | 108d739 | 2018-11-19 15:54:10 +0100 | [diff] [blame] | 69 | |
| 70 | /* |
| 71 | * Backlight off before OS handover |
| 72 | */ |
| 73 | void board_preboot_os(void) |
| 74 | { |
| 75 | gpio_request(TEGRA_GPIO(V, 2), "BL_ON"); |
| 76 | gpio_direction_output(TEGRA_GPIO(V, 2), 0); |
| 77 | } |