From 58ccd6105c6e1fc98e546ea86940e10c52b7840b Mon Sep 17 00:00:00 2001 From: Lokesh Vutla Date: Wed, 5 Aug 2020 22:44:17 +0530 Subject: arm: mach-k3: Move mmr_unlock to a common location mmr_unlock api is common for all k3 devices. Move it to a common location. Signed-off-by: Lokesh Vutla Reviewed-by: Suman Anna --- arch/arm/mach-k3/common.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'arch/arm/mach-k3/common.c') diff --git a/arch/arm/mach-k3/common.c b/arch/arm/mach-k3/common.c index 4335f2877b8..178dc210c35 100644 --- a/arch/arm/mach-k3/common.c +++ b/arch/arm/mach-k3/common.c @@ -62,6 +62,16 @@ void k3_sysfw_print_ver(void) ti_sci->version.firmware_revision, fw_desc); } +void mmr_unlock(phys_addr_t base, u32 partition) +{ + /* Translate the base address */ + phys_addr_t part_base = base + partition * CTRL_MMR0_PARTITION_SIZE; + + /* Unlock the requested partition if locked using two-step sequence */ + writel(CTRLMMR_LOCK_KICK0_UNLOCK_VAL, part_base + CTRLMMR_LOCK_KICK0); + writel(CTRLMMR_LOCK_KICK1_UNLOCK_VAL, part_base + CTRLMMR_LOCK_KICK1); +} + DECLARE_GLOBAL_DATA_PTR; #ifdef CONFIG_K3_EARLY_CONS -- cgit v1.2.3 From 2a18be77def6ce8967cb24770a2c0838125d2da5 Mon Sep 17 00:00:00 2001 From: Lokesh Vutla Date: Wed, 5 Aug 2020 22:44:19 +0530 Subject: arm: mach-k3: j721e: Add detection for j721e Add an api soc_is_j721e(), and use it to enable certain functionality that is available only on j721e. This detection is needed when DT is not available. Signed-off-by: Lokesh Vutla Signed-off-by: Suman Anna --- arch/arm/mach-k3/common.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'arch/arm/mach-k3/common.c') diff --git a/arch/arm/mach-k3/common.c b/arch/arm/mach-k3/common.c index 178dc210c35..4e366f8fffa 100644 --- a/arch/arm/mach-k3/common.c +++ b/arch/arm/mach-k3/common.c @@ -345,6 +345,16 @@ int print_cpuinfo(void) } #endif +bool soc_is_j721e(void) +{ + u32 soc; + + soc = (readl(CTRLMMR_WKUP_JTAG_ID) & + JTAG_ID_PARTNO_MASK) >> JTAG_ID_PARTNO_SHIFT; + + return soc == J721E; +} + #ifdef CONFIG_ARM64 void board_prep_linux(bootm_headers_t *images) { -- cgit v1.2.3 From 30de1ba0d375e418e94628037f3a1e30ec58f9aa Mon Sep 17 00:00:00 2001 From: Lokesh Vutla Date: Wed, 5 Aug 2020 22:44:21 +0530 Subject: arm: mach-k3: j7200: Add support for SOC detection The J7200 SoC is a part of the K3 Multicore SoC architecture platform. It is targeted for automotive gateway, vehicle compute systems, Vehicle-to-Vehicle (V2V) and Vehicle-to-Everything (V2X) applications. The SoC aims to meet the complex processing needs of modern embedded products. Some highlights of this SoC are: * Dual Cortex-A72s in a single cluster, two clusters of lockstep capable dual Cortex-R5F MCUs and a Centralized Device Management and Security Controller (DMSC). * Configurable L3 Cache and IO-coherent architecture with high data throughput capable distributed DMA architecture under NAVSS. * Integrated Ethernet switch supporting up to a total of 4 external ports in addition to legacy Ethernet switch of up to 2 ports. * Upto 1 PCIe-GEN3 controller, 1 USB3.0 Dual-role device subsystems, 20 MCANs, 3 McASP, eMMC and SD, OSPI/HyperBus memory controller, I3C and I2C, eCAP/eQEP, eHRPWM among other peripherals. * One hardware accelerator block containing AES/DES/SHA/MD5 called SA2UL management. See J7200 Technical Reference Manual (SPRUIU1, June 2020) for further details: https://www.ti.com/lit/pdf/spruiu1 Add support for detection J7200 SoC Signed-off-by: Lokesh Vutla Signed-off-by: Suman Anna --- arch/arm/mach-k3/common.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'arch/arm/mach-k3/common.c') diff --git a/arch/arm/mach-k3/common.c b/arch/arm/mach-k3/common.c index 4e366f8fffa..f4d7c3d71e6 100644 --- a/arch/arm/mach-k3/common.c +++ b/arch/arm/mach-k3/common.c @@ -355,6 +355,16 @@ bool soc_is_j721e(void) return soc == J721E; } +bool soc_is_j7200(void) +{ + u32 soc; + + soc = (readl(CTRLMMR_WKUP_JTAG_ID) & + JTAG_ID_PARTNO_MASK) >> JTAG_ID_PARTNO_SHIFT; + + return soc == J7200; +} + #ifdef CONFIG_ARM64 void board_prep_linux(bootm_headers_t *images) { -- cgit v1.2.3 From 01dbe366ba2d0eda00bbfac19b105eaa7f635d73 Mon Sep 17 00:00:00 2001 From: Lokesh Vutla Date: Wed, 5 Aug 2020 22:44:23 +0530 Subject: arm: mach-k3: j7200: Detect if ROM has already loaded sysfw Detect if sysfw is already loaded by ROM and pass this information to sysfw loader. Based on this information sysfw loader either loads the sysfw image from boot media or just receives the boot notification message form sysfw. Signed-off-by: Lokesh Vutla Reviewed-by: Suman Anna --- arch/arm/mach-k3/common.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'arch/arm/mach-k3/common.c') diff --git a/arch/arm/mach-k3/common.c b/arch/arm/mach-k3/common.c index f4d7c3d71e6..8c903f14ff8 100644 --- a/arch/arm/mach-k3/common.c +++ b/arch/arm/mach-k3/common.c @@ -72,6 +72,14 @@ void mmr_unlock(phys_addr_t base, u32 partition) writel(CTRLMMR_LOCK_KICK1_UNLOCK_VAL, part_base + CTRLMMR_LOCK_KICK1); } +bool is_rom_loaded_sysfw(struct rom_extended_boot_data *data) +{ + if (strncmp(data->header, K3_ROM_BOOT_HEADER_MAGIC, 7)) + return false; + + return data->num_components > 1; +} + DECLARE_GLOBAL_DATA_PTR; #ifdef CONFIG_K3_EARLY_CONS -- cgit v1.2.3