Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Tom Warren | 112a188 | 2011-04-14 12:18:06 +0000 | [diff] [blame] | 2 | /* |
Tom Warren | ab0cc6b | 2015-03-04 16:36:00 -0700 | [diff] [blame] | 3 | * (C) Copyright 2010-2015 |
Tom Warren | 112a188 | 2011-04-14 12:18:06 +0000 | [diff] [blame] | 4 | * NVIDIA Corporation <www.nvidia.com> |
Tom Warren | 112a188 | 2011-04-14 12:18:06 +0000 | [diff] [blame] | 5 | */ |
| 6 | #include <asm/types.h> |
| 7 | |
| 8 | /* Stabilization delays, in usec */ |
Tom Warren | 61c6d0e | 2012-12-11 13:34:15 +0000 | [diff] [blame] | 9 | #define PLL_STABILIZATION_DELAY (300) |
Tom Warren | 112a188 | 2011-04-14 12:18:06 +0000 | [diff] [blame] | 10 | #define IO_STABILIZATION_DELAY (1000) |
| 11 | |
Tom Warren | 112a188 | 2011-04-14 12:18:06 +0000 | [diff] [blame] | 12 | #define PLLX_ENABLED (1 << 30) |
| 13 | #define CCLK_BURST_POLICY 0x20008888 |
| 14 | #define SUPER_CCLK_DIVIDER 0x80000000 |
| 15 | |
| 16 | /* Calculate clock fractional divider value from ref and target frequencies */ |
Tom Warren | 61c6d0e | 2012-12-11 13:34:15 +0000 | [diff] [blame] | 17 | #define CLK_DIVIDER(REF, FREQ) ((((REF) * 2) / FREQ) - 2) |
Tom Warren | 112a188 | 2011-04-14 12:18:06 +0000 | [diff] [blame] | 18 | |
| 19 | /* Calculate clock frequency value from reference and clock divider value */ |
Tom Warren | 61c6d0e | 2012-12-11 13:34:15 +0000 | [diff] [blame] | 20 | #define CLK_FREQUENCY(REF, REG) (((REF) * 2) / (REG + 2)) |
Tom Warren | 112a188 | 2011-04-14 12:18:06 +0000 | [diff] [blame] | 21 | |
| 22 | /* AVP/CPU ID */ |
| 23 | #define PG_UP_TAG_0_PID_CPU 0x55555555 /* CPU aka "a9" aka "mpcore" */ |
Tom Warren | 61c6d0e | 2012-12-11 13:34:15 +0000 | [diff] [blame] | 24 | #define PG_UP_TAG_0 0x0 |
Tom Warren | 112a188 | 2011-04-14 12:18:06 +0000 | [diff] [blame] | 25 | |
Tom Warren | 61c6d0e | 2012-12-11 13:34:15 +0000 | [diff] [blame] | 26 | /* AP base physical address of internal SRAM */ |
| 27 | #define NV_PA_BASE_SRAM 0x40000000 |
Tom Warren | 112a188 | 2011-04-14 12:18:06 +0000 | [diff] [blame] | 28 | |
| 29 | #define EXCEP_VECTOR_CPU_RESET_VECTOR (NV_PA_EVP_BASE + 0x100) |
| 30 | #define CSITE_CPU_DBG0_LAR (NV_PA_CSITE_BASE + 0x10FB0) |
| 31 | #define CSITE_CPU_DBG1_LAR (NV_PA_CSITE_BASE + 0x12FB0) |
| 32 | |
| 33 | #define FLOW_CTLR_HALT_COP_EVENTS (NV_PA_FLOW_BASE + 4) |
| 34 | #define FLOW_MODE_STOP 2 |
| 35 | #define HALT_COP_EVENT_JTAG (1 << 28) |
| 36 | #define HALT_COP_EVENT_IRQ_1 (1 << 11) |
| 37 | #define HALT_COP_EVENT_FIQ_1 (1 << 9) |
| 38 | |
Simon Glass | ec8dab4 | 2011-11-05 03:56:50 +0000 | [diff] [blame] | 39 | /* This is the main entry into U-Boot, used by the Cortex-A9 */ |
| 40 | extern void _start(void); |
Simon Glass | 1fed82a | 2012-04-02 13:18:50 +0000 | [diff] [blame] | 41 | |
| 42 | /** |
Tom Warren | 8b81711 | 2013-04-10 10:32:32 -0700 | [diff] [blame] | 43 | * Works out the SOC/SKU type used for clocks settings |
Simon Glass | 1fed82a | 2012-04-02 13:18:50 +0000 | [diff] [blame] | 44 | * |
Heinrich Schuchardt | 47b4c02 | 2022-01-19 18:05:50 +0100 | [diff] [blame] | 45 | * Return: SOC type - see TEGRA_SOC... |
Simon Glass | 1fed82a | 2012-04-02 13:18:50 +0000 | [diff] [blame] | 46 | */ |
Tom Warren | 8b81711 | 2013-04-10 10:32:32 -0700 | [diff] [blame] | 47 | int tegra_get_chip_sku(void); |
| 48 | |
| 49 | /** |
| 50 | * Returns the pure SOC (chip ID) from the HIDREV register |
| 51 | * |
Heinrich Schuchardt | 47b4c02 | 2022-01-19 18:05:50 +0100 | [diff] [blame] | 52 | * Return: SOC ID - see CHIPID_TEGRAxx... |
Tom Warren | 8b81711 | 2013-04-10 10:32:32 -0700 | [diff] [blame] | 53 | */ |
| 54 | int tegra_get_chip(void); |
| 55 | |
| 56 | /** |
| 57 | * Returns the SKU ID from the sku_info register |
| 58 | * |
Heinrich Schuchardt | 47b4c02 | 2022-01-19 18:05:50 +0100 | [diff] [blame] | 59 | * Return: SKU ID - see SKU_ID_Txx... |
Tom Warren | 8b81711 | 2013-04-10 10:32:32 -0700 | [diff] [blame] | 60 | */ |
| 61 | int tegra_get_sku_info(void); |
| 62 | |
| 63 | /* Do any chip-specific cache config */ |
Tom Warren | 82b5134 | 2013-03-25 16:22:26 -0700 | [diff] [blame] | 64 | void config_cache(void); |
Bryan Wu | 97adb22 | 2014-06-24 11:45:29 +0900 | [diff] [blame] | 65 | |
Stephen Warren | 8d1fb31 | 2015-01-19 16:25:52 -0700 | [diff] [blame] | 66 | #if defined(CONFIG_TEGRA_SUPPORT_NON_SECURE) |
| 67 | bool tegra_cpu_is_non_secure(void); |
| 68 | #endif |