blob: 6b9169be6a13ee2b9c3c48e3e83b458014655dee [file] [log] [blame]
Svyatoslav Ryhelfcb1d912023-06-30 10:29:05 +03001// SPDX-License-Identifier: GPL-2.0+
2/*
3 * (C) Copyright 2010-2013
4 * NVIDIA Corporation <www.nvidia.com>
5 *
6 * (C) Copyright 2022
7 * Svyatoslav Ryhel <clamor95@gmail.com>
8 */
9
Svyatoslav Ryhelfcb1d912023-06-30 10:29:05 +030010#include <dm.h>
Svyatoslav Ryhelfcb1d912023-06-30 10:29:05 +030011#include <fdt_support.h>
Svyatoslav Ryhelfcb1d912023-06-30 10:29:05 +030012#include <asm/arch/pinmux.h>
13#include <asm/arch/clock.h>
Svyatoslav Ryhelfcb1d912023-06-30 10:29:05 +030014#include <asm/arch-tegra/fuse.h>
Svyatoslav Ryhelfcb1d912023-06-30 10:29:05 +030015
Svyatoslav Ryhel19756932023-08-26 18:32:55 +030016#include "pinmux-config-x3.h"
Svyatoslav Ryhelfcb1d912023-06-30 10:29:05 +030017
18/*
19 * Routine: pinmux_init
20 * Description: Do individual peripheral pinmux configs
21 */
22void pinmux_init(void)
23{
24 pinmux_config_pingrp_table(tegra3_x3_pinmux_common,
25 ARRAY_SIZE(tegra3_x3_pinmux_common));
26
27#ifdef CONFIG_DEVICE_P880
28 pinmux_config_pingrp_table(tegra3_p880_pinmux,
29 ARRAY_SIZE(tegra3_p880_pinmux));
30#endif
31
32#ifdef CONFIG_DEVICE_P895
33 pinmux_config_pingrp_table(tegra3_p895_pinmux,
34 ARRAY_SIZE(tegra3_p895_pinmux));
35#endif
36}
37
Svyatoslav Ryhelfcb1d912023-06-30 10:29:05 +030038int nvidia_board_init(void)
39{
40 /* Set up panel bridge clocks */
41 clock_start_periph_pll(PERIPH_ID_EXTPERIPH3, CLOCK_ID_PERIPH,
42 24 * 1000000);
43 clock_external_output(3);
44
45 return 0;
46}
47
48#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
49int ft_board_setup(void *blob, struct bd_info *bd)
50{
51 /* First 3 bytes refer to LG vendor */
52 u8 btmacaddr[6] = { 0x00, 0x00, 0x00, 0xD0, 0xC9, 0x88 };
53
54 /* Generate device 3 bytes based on chip sd */
55 u64 bt_device = tegra_chip_uid() >> 24ull;
56
57 btmacaddr[0] = (bt_device >> 1 & 0x0F) |
58 (bt_device >> 5 & 0xF0);
59 btmacaddr[1] = (bt_device >> 11 & 0x0F) |
60 (bt_device >> 17 & 0xF0);
61 btmacaddr[2] = (bt_device >> 23 & 0x0F) |
62 (bt_device >> 29 & 0xF0);
63
64 /* Set BT MAC address */
65 fdt_find_and_setprop(blob, "/serial@70006200/bluetooth",
66 "local-bd-address", btmacaddr, 6, 1);
67
68 /* Remove TrustZone nodes */
69 fdt_del_node_and_alias(blob, "/firmware");
70 fdt_del_node_and_alias(blob, "/reserved-memory/trustzone@bfe00000");
71
72 return 0;
73}
74#endif