Svyatoslav Ryhel | fcb1d91 | 2023-06-30 10:29:05 +0300 | [diff] [blame] | 1 | // 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 Ryhel | fcb1d91 | 2023-06-30 10:29:05 +0300 | [diff] [blame] | 10 | #include <dm.h> |
Svyatoslav Ryhel | fcb1d91 | 2023-06-30 10:29:05 +0300 | [diff] [blame] | 11 | #include <fdt_support.h> |
Svyatoslav Ryhel | fcb1d91 | 2023-06-30 10:29:05 +0300 | [diff] [blame] | 12 | #include <asm/arch/clock.h> |
Svyatoslav Ryhel | fcb1d91 | 2023-06-30 10:29:05 +0300 | [diff] [blame] | 13 | #include <asm/arch-tegra/fuse.h> |
Svyatoslav Ryhel | fcb1d91 | 2023-06-30 10:29:05 +0300 | [diff] [blame] | 14 | |
Svyatoslav Ryhel | fcb1d91 | 2023-06-30 10:29:05 +0300 | [diff] [blame] | 15 | int 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) |
| 26 | int 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 |