blob: b781a16e70c96abb94377250b9e966b5ae92eff6 [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/clock.h>
Svyatoslav Ryhelfcb1d912023-06-30 10:29:05 +030013#include <asm/arch-tegra/fuse.h>
Svyatoslav Ryhelfcb1d912023-06-30 10:29:05 +030014
Svyatoslav Ryhelfcb1d912023-06-30 10:29:05 +030015int nvidia_board_init(void)
16{
17 /* Set up panel bridge clocks */
18 clock_start_periph_pll(PERIPH_ID_EXTPERIPH3, CLOCK_ID_PERIPH,
19 24 * 1000000);
20 clock_external_output(3);
21
22 return 0;
23}
24
25#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
26int ft_board_setup(void *blob, struct bd_info *bd)
27{
28 /* First 3 bytes refer to LG vendor */
29 u8 btmacaddr[6] = { 0x00, 0x00, 0x00, 0xD0, 0xC9, 0x88 };
30
31 /* Generate device 3 bytes based on chip sd */
32 u64 bt_device = tegra_chip_uid() >> 24ull;
33
34 btmacaddr[0] = (bt_device >> 1 & 0x0F) |
35 (bt_device >> 5 & 0xF0);
36 btmacaddr[1] = (bt_device >> 11 & 0x0F) |
37 (bt_device >> 17 & 0xF0);
38 btmacaddr[2] = (bt_device >> 23 & 0x0F) |
39 (bt_device >> 29 & 0xF0);
40
41 /* Set BT MAC address */
42 fdt_find_and_setprop(blob, "/serial@70006200/bluetooth",
43 "local-bd-address", btmacaddr, 6, 1);
44
45 /* Remove TrustZone nodes */
46 fdt_del_node_and_alias(blob, "/firmware");
47 fdt_del_node_and_alias(blob, "/reserved-memory/trustzone@bfe00000");
48
49 return 0;
50}
51#endif