Add support for ThunderX 88xx SoC family
Subsystems (2)
v5 cover Add support for ThunderX 88xx SoC family
This patch series adds support for Cavium ThunderX 88xx SoC family
(http://cavium.com/ThunderX_ARM_Processors.html)
This is the version 5 of the series I posted at
http://lists.denx.de/pipermail/u-boot/2015-August/224324.html
http://lists.denx.de/pipermail/u-boot/2015-August/223618.html
Changes in v5:
- Allow setting of different memory attributes in the memory map
- Added OF control support
- Added FDT for ThunderX 88xx series
- Added CONFIG_OF_CONTROL support
- Changed memory attributes
- Moved dram_init() from a separate file to thunderx.c
Changes in v4:
- Use ALIGN macro for address alignment
- Document FW calls
- Fixed build warnings
- Moved to DM_SERIAL
- Moved CONFIG_SYS_PROMPT to configs/thunderx_88xx_defconfig
- Added proper DM_SERIAL definitions
Changes in v3:
- Reduced code duplication
- Renamed CONFIG_SYS_PTL1_BITS to CONFIG_SYS_PTL2_BITS
- Moved 'reset_sctrl' call to the 'reset' label
- Rebased to the actual upstream tree
- Documented newly added config options
- Fixed clobber lists (thanks to Corey)
- Added __used keyword
- Fixed formatting
- Added MAINTAINERS
- Moved command definitions to defconfig
Changes in v2:
- Changed code licensing
- Completed the patchset
Sergey Temerkhanov (9):
armv8: Add read_mpidr() function
armv8: New MMU setup code allowing to use 48+ bits PA/VA
armv8: Add Secure Monitor/Hypervisor Call (SMC/HVC) infrastructure
armv8: Add psci.h from the Linux kernel
arm: serial: Add ability to use pre-initialized UARTs
armv8: cavium: Add the device tree for ThunderX
armv8: cavium: Add ThunderX 88xx board definition
armv8: cavium: Add an implementation of ATF calling functions
armv8: cavium: Get DRAM size from ATF
arch/arm/Kconfig | 5 + arch/arm/cpu/armv8/Makefile | 1 + arch/arm/cpu/armv8/cache_v8.c | 79 +++++++ arch/arm/cpu/armv8/fwcall.c | 75 +++++++ arch/arm/cpu/armv8/start.S | 36 ++++ arch/arm/dts/Makefile | 1 + arch/arm/dts/thunderx-88xx.dts | 27 +++ arch/arm/dts/thunderx-88xx.dtsi | 363 ++++++++++++++++++++++++++++++++ arch/arm/include/asm/armv8/mmu.h | 82 +++++++- arch/arm/include/asm/global_data.h | 1 + arch/arm/include/asm/system.h | 39 ++++ arch/arm/lib/board.c | 6 +- board/cavium/thunderx/Kconfig | 19 ++ board/cavium/thunderx/MAINTAINERS | 6 + board/cavium/thunderx/Makefile | 8 + board/cavium/thunderx/atf.c | 312 +++++++++++++++++++++++++++ board/cavium/thunderx/thunderx.c | 102 +++++++++ configs/thunderx_88xx_defconfig | 29 +++ doc/README.arm64 | 35 ++- drivers/serial/serial_pl01x.c | 13 +- include/cavium/atf.h | 22 ++ include/cavium/atf_part.h | 26 +++ include/cavium/thunderx_svc.h | 67 ++++++ include/configs/thunderx_88xx.h | 148 +++++++++++++ include/dm/platform_data/serial_pl01x.h | 6 + include/linux/psci.h | 90 ++++++++ 26 files changed, 1578 insertions(+), 20 deletions(-) create mode 100644 arch/arm/cpu/armv8/fwcall.c create mode 100644 arch/arm/dts/thunderx-88xx.dts create mode 100644 arch/arm/dts/thunderx-88xx.dtsi create mode 100644 board/cavium/thunderx/Kconfig create mode 100644 board/cavium/thunderx/MAINTAINERS create mode 100644 board/cavium/thunderx/Makefile create mode 100644 board/cavium/thunderx/atf.c create mode 100644 board/cavium/thunderx/thunderx.c create mode 100644 configs/thunderx_88xx_defconfig create mode 100644 include/cavium/atf.h create mode 100644 include/cavium/atf_part.h create mode 100644 include/cavium/thunderx_svc.h create mode 100644 include/configs/thunderx_88xx.h create mode 100644 include/linux/psci.h
Signature · 1 line
2.2.0
PATCH v5 1/9 armv8: Add read_mpidr() function
This patch adds the read_mpidr() function which returns the MPIDR_EL1 register value
---
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None
arch/arm/include/asm/system.h | 11 +++++++++++ 1 file changed, 11 insertions(+)
arch/arm/include/asm/system.h +11 -0
@@ -71,6 +71,17 @@ static inline void set_sctlr(unsigned int val) asmvolatile ("isb" ); } +static inline unsigned long read_mpidr (void ) +{ +unsigned long val; + + asmvolatile ("mrs %0, mpidr_el1" :"=r" (val)); + +return val; +} + +#define BSP_COREID 0 +void __asm_flush_dcache_all (void );void __asm_invalidate_dcache_all (void );void __asm_flush_dcache_range (u64 start,u64 end);
Signature · 1 line
2.2.0
PATCH v5 2/9 armv8: New MMU setup code allowing to use 48+ bits PA/VA
In reply to Sergey TemerkhanovThis patch adds code which sets up 2-level page tables on ARM64 thus extending available VA space. CPUs implementing 64k translation granule are able to use direct PA-VA mapping of the whole 48 bit address space.
It also adds the ability to reset the SCTRL register at the very beginning of execution to avoid interference from stale mappings set up by early firmware/loaders/etc.
---
Changes in v5:
- Allow setting of different memory attributes in the memory map
Changes in v4:
- Use ALIGN macro for address alignment
Changes in v3:
- Reduced code duplication
- Renamed CONFIG_SYS_PTL1_BITS to CONFIG_SYS_PTL2_BITS
- Moved 'reset_sctrl' call to the 'reset' label
- Rebased to the actual upstream tree
- Documented newly added config options
Changes in v2:
- Changed code licensing
- Completed the patchset
arch/arm/cpu/armv8/cache_v8.c | 79 ++++++++++++++++++++++++++++++++++++ arch/arm/cpu/armv8/start.S | 36 +++++++++++++++++ arch/arm/include/asm/armv8/mmu.h | 82 +++++++++++++++++++++++++++++++++++--- arch/arm/include/asm/global_data.h | 1 + arch/arm/include/asm/system.h | 7 ++++ arch/arm/lib/board.c | 6 ++- doc/README.arm64 | 35 +++++++++++++--- 7 files changed, 232 insertions(+), 14 deletions(-)
arch/arm/cpu/armv8/cache_v8.c +79 -0
@@ -12,6 +12,69 @@DECLARE_GLOBAL_DATA_PTR ; #ifndef CONFIG_SYS_DCACHE_OFF + +#ifdef CONFIG_SYS_FULL_VA +static void set_ptl1_entry(u64 index, u64 ptl2_entry) +{ + u64 *pgd = (u64 *)gd->arch.tlb_addr; + u64 value; + + value = ptl2_entry | PTL1_TYPE_TABLE; + pgd[index] = value; +} + +static void set_ptl2_block(u64 ptl1, u64 bfn, u64 address, u64 memory_attrs) +{ + u64 *pmd = (u64 *)ptl1; + u64 value; + + value = address | PTL2_TYPE_BLOCK | PTL2_BLOCK_AF; + value |= memory_attrs; + pmd[bfn] = value; +} + +static struct mm_region mem_map[] = CONFIG_SYS_MEM_MAP; + +#define PTL1_ENTRIES CONFIG_SYS_PTL1_ENTRIES +#define PTL2_ENTRIES CONFIG_SYS_PTL2_ENTRIES + +static void setup_pgtables(void) +{ + int l1_e, l2_e; + unsigned long pmd = 0; + unsigned long address; + + /* Setup the PMD pointers */ + for (l1_e = 0; l1_e < CONFIG_SYS_MEM_MAP_SIZE; l1_e++) { + gd->arch.pmd_addr[l1_e] = gd->arch.tlb_addr + + PTL1_ENTRIES * sizeof(u64); + gd->arch.pmd_addr[l1_e] += PTL2_ENTRIES * sizeof(u64) * l1_e; + gd->arch.pmd_addr[l1_e] = ALIGN(gd->arch.pmd_addr[l1_e], + 0x10000UL); + } + + /* Setup the page tables */ + for (l1_e = 0; l1_e < PTL1_ENTRIES; l1_e++) { + if (mem_map[pmd].base == + (uintptr_t)l1_e << PTL2_BITS) { + set_ptl1_entry(l1_e, gd->arch.pmd_addr[pmd]); + + for (l2_e = 0; l2_e < PTL2_ENTRIES; l2_e++) { + address = mem_map[pmd].base + + (uintptr_t)l2_e * BLOCK_SIZE; + set_ptl2_block(gd->arch.pmd_addr[pmd], l2_e, + address, mem_map[pmd].attrs); + } + + pmd++; + } else { + set_ptl1_entry(l1_e, 0); + } + } +} + +#else + inline void set_pgtable_section(u64 *page_table, u64 index, u64 section, u64 memory_type, u64 share) {
@@ -31,13 +94,25 @@ inline void set_pgtable_table(u64 *page_table, u64 index, u64 *table_addr) page_table[index] = value; } +#endif + +/* to activate the MMU we need to set up virtual memory */ static void mmu_setup(void) { +#ifndef CONFIG_SYS_FULL_VA bd_t *bd = gd->bd; u64 *page_table = (u64 *)gd->arch.tlb_addr, i, j; +#endif int el; +#ifdef CONFIG_SYS_FULL_VA + unsigned long coreid = read_mpidr() & CONFIG_COREID_MASK; + + /* Set up page tables only on BSP */ + if (coreid == BSP_COREID) + setup_pgtables(); +#else /* Setup an identity-mapping for all spaces */ for (i = 0; i < (PGTABLE_SIZE >> 3); i++) { set_pgtable_section(page_table, i, i << SECTION_SHIFT,
@@ -55,6 +130,7 @@ static void mmu_setup(void) } } +#endif /* load TTBR0 */ el =current_el ();if (el ==1 ) {
@@ -154,6 +230,7 @@ u64 *__weak arch_get_page_table(void) {return NULL ; } +#ifndef CONFIG_SYS_FULL_VA void mmu_set_region_dcache_behaviour (phys_addr_t start,size_t size,enum dcache_option option) {
@@ -179,6 +256,8 @@ void mmu_set_region_dcache_behaviour(phys_addr_t start, size_t size,flush_dcache_range (start, end); asm volatile("dsb sy"); } +#endif +#else /* CONFIG_SYS_DCACHE_OFF */ void invalidate_dcache_all (void )
arch/arm/cpu/armv8/start.S +36 -0
@@ -43,6 +43,9 @@ _bss_end_ofs: .quad __bss_end - _start reset: +#ifdef CONFIG_SYS_RESET_SCTRL + bl reset_sctrl +#endif /* * Could be EL3/EL2/EL1, Initial State: * Little Endian, MMU Disabled, i/dCache Disabled
@@ -97,6 +100,39 @@ master_cpu: bl _main +#ifdef CONFIG_SYS_RESET_SCTRL +reset_sctrl: + switch_el x1, 3f, 2f, 1f +3: + mrs x0, sctlr_el3 + b 0f +2: + mrs x0, sctlr_el2 + b 0f +1: + mrs x0, sctlr_el1 + +0: + ldr x1, =0xfdfffffa + and x0, x0, x1 + + switch_el x1, 6f, 5f, 4f +6: + msr sctlr_el3, x0 + b 7f +5: + msr sctlr_el2, x0 + b 7f +4: + msr sctlr_el1, x0 + +7: + dsb sy + isb + b __asm_invalidate_tlb_all + ret +#endif + /*-----------------------------------------------------------------------*/ WEAK(apply_core_errata)
arch/arm/include/asm/armv8/mmu.h +76 -6
141 lines not on this page · raw message
arch/arm/include/asm/global_data.h +1 -0
@@ -38,6 +38,7 @@ struct arch_global_data {unsigned long long timer_reset_value;#if !(defined(CONFIG_SYS_ICACHE_OFF ) && defined(CONFIG_SYS_DCACHE_OFF ))unsigned long tlb_addr; +unsigned long pmd_addr[CONFIG_SYS_PTL1_ENTRIES ];unsigned long tlb_size;#endif
arch/arm/include/asm/system.h +7 -0
@@ -14,7 +14,12 @@#define CR_WXN (1 << 19)/* Write Permision Imply XN */ #define CR_EE (1 << 25)/* Exception (Big) Endian */ +#ifndef CONFIG_SYS_FULL_VA #define PGTABLE_SIZE (0x10000) +#else +#define PGTABLE_SIZE CONFIG_SYS_PGTABLE_SIZE +#endif +/* 2MB granularity */ #define MMU_SECTION_SHIFT 21
@@ -147,7 +152,9 @@ void flush_l3_cache(void);#define CR_AFE (1 << 29)/* Access flag enable */ #define CR_TE (1 << 30)/* Thumb exception enable */ +#ifndef PGTABLE_SIZE #define PGTABLE_SIZE (4096 * 4) +#endif /* * This is used to ensure the compiler did actually allocate the register we
arch/arm/lib/board.c +4 -2
@@ -327,10 +327,12 @@ void board_init_f(ulong bootflag)#if !(defined(CONFIG_SYS_ICACHE_OFF ) && defined(CONFIG_SYS_DCACHE_OFF ))/* reserve TLB table */ gd->arch.tlb_size =PGTABLE_SIZE ; - addr -= gd->arch.tlb_size; + gd->arch.tlb_size +=0xffff ; + gd->arch.tlb_size &= ~(0x10000 -1 ); -/* round down to next 64 kB limit */ + addr -= gd->arch.tlb_size; addr &= ~(0x10000 -1 ); +/* round down to next 64 kB limit */ gd->arch.tlb_addr = addr;debug ("TLB table from %08lx to %08lx\n" , addr, addr + gd->arch.tlb_size);
doc/README.arm64 +29 -6
@@ -36,11 +36,34 @@ Notes 6. CONFIG_ARM64 instead of CONFIG_ARMV8 is used to distinguish aarch64 and aarch32 specific codes. +7. CONFIG_SYS_FULL_VA is used to enable 2-level page tables. For cores + supporting 64k pages it allows usage of full 48+ virtual/physical addresses + + Enabling this option requires the following ones to be defined: + - CONFIG_SYS_MEM_MAP - an array of 'struct mm_region' describing the + system memory map (start, length, attributes) + - CONFIG_SYS_MEM_MAP_SIZE - number of entries in CONFIG_SYS_MEM_MAP + - CONFIG_SYS_PTL1_ENTRIES - number of 1st level page table entries + - CONFIG_SYS_PTL2_ENTRIES - number of 1nd level page table entries + for the largest CONFIG_SYS_MEM_MAP entry + - CONFIG_COREID_MASK - the mask value used to get the core from the + MPIDR_EL1 register + - CONFIG_SYS_PTL2_BITS - number of bits addressed by the 2nd level + page tables + - CONFIG_SYS_BLOCK_SHIFT - number of bits addressed by a single block + entry from L2 page tables + - CONFIG_SYS_PGTABLE_SIZE - total size of the page table + - CONFIG_SYS_TCR_EL{1,2,3}_IPS_BITS - the IPS field of the TCR_EL{1,2,3} + + + + Contributor =========== - Tom Rini <[email protected]> - Scott Wood <[email protected]> - York Sun <[email protected]> - Simon Glass <[email protected]> - Sharma Bhupesh <[email protected]> - Rob Herring <[email protected]> + Tom Rini <[email protected]> + Scott Wood <[email protected]> + York Sun <[email protected]> + Simon Glass <[email protected]> + Sharma Bhupesh <[email protected]> + Rob Herring <[email protected]> + Sergey Temerkhanov <[email protected]>
Signature · 1 line
2.2.0
PATCH v5 2/9 armv8: New MMU setup code allowing to use 48+ bits PA/VA
Quoted 7 lines · Sergey Temerkhanov
This patch adds code which sets up 2-level page tables on ARM64 thus extending available VA space. CPUs implementing 64k translation granule are able to use direct PA-VA mapping of the whole 48 bit address space.
It also adds the ability to reset the SCTRL register at the very beginning of execution to avoid interference from stale mappings set up by earlyfirmware/loaders/etc.
[snip]
arch/arm/include/asm/global_data.h struct arch_global_data { · line 43
Quoted 11 lines
arch/arm/include/asm/global_data.h +1
-0@@ -38,6 +38,7 @@ struct arch_global_data {unsigned long long timer_reset_value;#if !(defined(CONFIG_SYS_ICACHE_OFF ) && defined(CONFIG_SYS_DCACHE_OFF ))unsigned long tlb_addr; +unsigned long pmd_addr[CONFIG_SYS_PTL1_ENTRIES ];unsigned long tlb_size;#endif
This hunk causes massive build breakage on non-armv8:
arm: + sama5d3_xplained_mmc
+(sama5d3_xplained_mmc) In file included from ../include/common.h:149:0,
+(sama5d3_xplained_mmc) from ../lib/asm-offsets.c:15:
+(sama5d3_xplained_mmc) ../arch/arm/include/asm/global_data.h:41:25: error: 'CONFIG_SYS_PTL1_ENTRIES' undeclared here (not in a function)
+(sama5d3_xplained_mmc) unsigned long pmd_addr[CONFIG_SYS_PTL1_ENTRIES];
+(sama5d3_xplained_mmc) ^
+(sama5d3_xplained_mmc) make[2]: *** [lib/asm-offsets.s] Error 1
+(sama5d3_xplained_mmc) make[1]: *** [prepare0] Error 2
+(sama5d3_xplained_mmc) make: *** [sub-make] Error 2
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150915/c6f95f0b/attachment.sig>
PATCH v5 2/9 armv8: New MMU setup code allowing to use 48+ bits PA/VA
Quoted 34 lines · Tom Rini
Quoted 7 lines · Sergey Temerkhanov
This patch adds code which sets up 2-level page tables on ARM64 thus extending available VA space. CPUs implementing 64k translation granule are able to use direct PA-VA mapping of the whole 48 bit address space.
It also adds the ability to reset the SCTRL register at the very beginning of execution to avoid interference from stale mappings set up by earlyfirmware/loaders/etc.[snip]
arch/arm/include/asm/global_data.h struct arch_global_data { · line 43
Quoted 11 lines
arch/arm/include/asm/global_data.h +1
-0@@ -38,6 +38,7 @@ struct arch_global_data {unsigned long long timer_reset_value;#if !(defined(CONFIG_SYS_ICACHE_OFF ) && defined(CONFIG_SYS_DCACHE_OFF ))unsigned long tlb_addr; +unsigned long pmd_addr[CONFIG_SYS_PTL1_ENTRIES ];unsigned long tlb_size;#endif This hunk causes massive build breakage on non-armv8:
arm: +sama5d3_xplained_mmc(quoted diff) +8
-1+(sama5d3_xplained_mmc) In file included from ../include/common.h:149:0, +(sama5d3_xplained_mmc) from ../lib/asm-offsets.c:15: +(sama5d3_xplained_mmc) ../arch/arm/include/asm/global_data.h:41:25: error: 'CONFIG_SYS_PTL1_ENTRIES' undeclared here (not in a function) +(sama5d3_xplained_mmc) unsigned long pmd_addr[CONFIG_SYS_PTL1_ENTRIES]; +(sama5d3_xplained_mmc) ^ +(sama5d3_xplained_mmc) make[2]: *** [lib/asm-offsets.s] Error 1 +(sama5d3_xplained_mmc) make[1]: *** [prepare0] Error 2 +(sama5d3_xplained_mmc) make: *** [sub-make] Error 2 --
Quoted 1 line
Tom
Needs a protective conditional, thanks for feedback
Regards,
Sergey
PATCH v5 3/9 armv8: Add Secure Monitor/Hypervisor Call (SMC/HVC) infrastructure
In reply to Sergey TemerkhanovThis commit adds functions issuing calls to secure monitor or hypervisore. This allows using services such as Power State Coordination Interface (PSCI) provided by firmware, e.g. ARM Trusted Firmware (ATF)
The SMC call can destroy all registers declared temporary by the calling conventions. The clobber list is "x0..x17" because of this
---
Changes in v5: None
Changes in v4:
- Document FW calls
Changes in v3:
- Fixed clobber lists (thanks to Corey)
Changes in v2: None
arch/arm/cpu/armv8/Makefile | 1 + arch/arm/cpu/armv8/fwcall.c | 75 +++++++++++++++++++++++++++++++++++++++++++ arch/arm/include/asm/system.h | 21 ++++++++++++ 3 files changed, 97 insertions(+) create mode 100644 arch/arm/cpu/armv8/fwcall.c
arch/arm/cpu/armv8/Makefile +1 -0
@@ -14,6 +14,7 @@ obj-y += exceptions.o obj-y += cache.o obj-y += tlb.o obj-y += transition.o +obj-y += fwcall.o obj-$(CONFIG_FSL_LSCH3) += fsl-lsch3/ obj-$(CONFIG_ARCH_ZYNQMP) += zynqmp/
arch/arm/cpu/armv8/fwcall.c new file +75 -0
75 lines not on this page · raw message
arch/arm/include/asm/system.h +21 -0
@@ -1,6 +1,9 @@#ifndef __ASM_ARM_SYSTEM_H#define __ASM_ARM_SYSTEM_H +#include <common.h> +#include <linux/compiler.h> +#ifdef CONFIG_ARM64 /*
@@ -104,6 +107,24 @@ void smp_kick_all_cpus(void);void flush_l3_cache (void ); +/* +*Issue a hypervisor call in accordance with ARM "SMC Calling convention", +* DEN0028A +* +* @args: input and output arguments +* +*/ +void hvc_call (struct pt_regs *args); + +/* +*Issue a secure monitor call in accordance with ARM "SMC Calling convention", +* DEN0028A +* +* @args: input and output arguments +* +*/ +void smc_call (struct pt_regs *args); +#endif /* __ASSEMBLY__ */ #else /* CONFIG_ARM64 */
Signature · 1 line
2.2.0
PATCH v5 4/9 armv8: Add psci.h from the Linux kernel
In reply to Sergey TemerkhanovThis commit adds the psci.h header file from Linux kernel which contains definitions related to the PSCI interface provided by firmware
---
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None
include/linux/psci.h | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 include/linux/psci.h
include/linux/psci.h new file +90 -0
@@ -0,0 +1,90 @@ +/* +* ARM Power State and Coordination Interface (PSCI) header +* +* This header holds common PSCI defines and macros shared +* by: ARM kernel, ARM64 kernel, KVM ARM/ARM64 and user space. +* +* Copyright (C) 2014 Linaro Ltd. +* Author: Anup Patel <[email protected]> +*/ + +#ifndef _UAPI_LINUX_PSCI_H +#define _UAPI_LINUX_PSCI_H + +/* +* PSCI v0.1 interface +* +* The PSCI v0.1 function numbers are implementation defined. +* +* Only PSCI return values such as: SUCCESS, NOT_SUPPORTED, +* INVALID_PARAMS, and DENIED defined below are applicable +* to PSCI v0.1. +*/ + +/* PSCI v0.2 interface */ +#define PSCI_0_2_FN_BASE 0x84000000 +#define PSCI_0_2_FN (n) (PSCI_0_2_FN_BASE + (n)) +#define PSCI_0_2_64BIT 0x40000000 +#define PSCI_0_2_FN64_BASE \ + (PSCI_0_2_FN_BASE + PSCI_0_2_64BIT) +#define PSCI_0_2_FN64 (n) (PSCI_0_2_FN64_BASE + (n)) + +#define PSCI_0_2_FN_PSCI_VERSION PSCI_0_2_FN(0) +#define PSCI_0_2_FN_CPU_SUSPEND PSCI_0_2_FN(1) +#define PSCI_0_2_FN_CPU_OFF PSCI_0_2_FN(2) +#define PSCI_0_2_FN_CPU_ON PSCI_0_2_FN(3) +#define PSCI_0_2_FN_AFFINITY_INFO PSCI_0_2_FN(4) +#define PSCI_0_2_FN_MIGRATE PSCI_0_2_FN(5) +#define PSCI_0_2_FN_MIGRATE_INFO_TYPE PSCI_0_2_FN(6) +#define PSCI_0_2_FN_MIGRATE_INFO_UP_CPU PSCI_0_2_FN(7) +#define PSCI_0_2_FN_SYSTEM_OFF PSCI_0_2_FN(8) +#define PSCI_0_2_FN_SYSTEM_RESET PSCI_0_2_FN(9) + +#define PSCI_0_2_FN64_CPU_SUSPEND PSCI_0_2_FN64(1) +#define PSCI_0_2_FN64_CPU_ON PSCI_0_2_FN64(3) +#define PSCI_0_2_FN64_AFFINITY_INFO PSCI_0_2_FN64(4) +#define PSCI_0_2_FN64_MIGRATE PSCI_0_2_FN64(5) +#define PSCI_0_2_FN64_MIGRATE_INFO_UP_CPU PSCI_0_2_FN64(7) + +/* PSCI v0.2 power state encoding for CPU_SUSPEND function */ +#define PSCI_0_2_POWER_STATE_ID_MASK 0xffff +#define PSCI_0_2_POWER_STATE_ID_SHIFT 0 +#define PSCI_0_2_POWER_STATE_TYPE_SHIFT 16 +#define PSCI_0_2_POWER_STATE_TYPE_MASK \ + (0x1 << PSCI_0_2_POWER_STATE_TYPE_SHIFT) +#define PSCI_0_2_POWER_STATE_AFFL_SHIFT 24 +#define PSCI_0_2_POWER_STATE_AFFL_MASK \ + (0x3 << PSCI_0_2_POWER_STATE_AFFL_SHIFT) + +/* PSCI v0.2 affinity level state returned by AFFINITY_INFO */ +#define PSCI_0_2_AFFINITY_LEVEL_ON 0 +#define PSCI_0_2_AFFINITY_LEVEL_OFF 1 +#define PSCI_0_2_AFFINITY_LEVEL_ON_PENDING 2 + +/* PSCI v0.2 multicore support in Trusted OS returned by MIGRATE_INFO_TYPE */ +#define PSCI_0_2_TOS_UP_MIGRATE 0 +#define PSCI_0_2_TOS_UP_NO_MIGRATE 1 +#define PSCI_0_2_TOS_MP 2 + +/* PSCI version decoding (independent of PSCI version) */ +#define PSCI_VERSION_MAJOR_SHIFT 16 +#define PSCI_VERSION_MINOR_MASK \ + ((1U << PSCI_VERSION_MAJOR_SHIFT) - 1) +#define PSCI_VERSION_MAJOR_MASK ~PSCI_VERSION_MINOR_MASK +#define PSCI_VERSION_MAJOR (ver) \ + (((ver) & PSCI_VERSION_MAJOR_MASK) >> PSCI_VERSION_MAJOR_SHIFT) +#define PSCI_VERSION_MINOR (ver) \ + ((ver) & PSCI_VERSION_MINOR_MASK) + +/* PSCI return values (inclusive of all PSCI versions) */ +#define PSCI_RET_SUCCESS 0 +#define PSCI_RET_NOT_SUPPORTED -1 +#define PSCI_RET_INVALID_PARAMS -2 +#define PSCI_RET_DENIED -3 +#define PSCI_RET_ALREADY_ON -4 +#define PSCI_RET_ON_PENDING -5 +#define PSCI_RET_INTERNAL_FAILURE -6 +#define PSCI_RET_NOT_PRESENT -7 +#define PSCI_RET_DISABLED -8 + +#endif /* _UAPI_LINUX_PSCI_H */
Signature · 1 line
2.2.0
PATCH v5 5/9 arm: serial: Add ability to use pre-initialized UARTs
In reply to Sergey TemerkhanovOn some systems, UART initialization is performed before running U-Boot. This commit allows to skip UART re-initializaion on those systems
---
Changes in v5:
- Added OF control support
Changes in v4:
- Fixed build warnings
- Moved to DM_SERIAL
Changes in v3:
- Added __used keyword
Changes in v2: None
drivers/serial/serial_pl01x.c | 13 +++++++------ include/dm/platform_data/serial_pl01x.h | 6 ++++++ 2 files changed, 13 insertions(+), 6 deletions(-)
drivers/serial/serial_pl01x.c +7 -6
@@ -125,7 +125,7 @@ static int pl011_set_line_control(struct pl01x_regs *regs) }static int pl01x_generic_setbrg (struct pl01x_regs *regs,enum pl01x_type type, -int clock,int baudrate) +int clock,int baudrate) {switch (type) {case TYPE_PL010 : {
@@ -295,7 +295,6 @@ __weak struct serial_device *default_serial_console(void)#endif /* nCONFIG_DM_SERIAL */ #ifdef CONFIG_DM_SERIAL - struct pl01x_priv { struct pl01x_regs *regs; enum pl01x_type type;
@@ -306,9 +305,9 @@ static int pl01x_serial_setbrg(struct udevice *dev, int baudrate)struct pl01x_serial_platdata *plat =dev_get_platdata (dev);struct pl01x_priv *priv =dev_get_priv (dev); -pl01x_generic_setbrg (priv->regs, priv->type, plat->clock, baudrate); - -return 0 ; +return (plat->flags &PL0X_PREINITIALIZED ) ?0 : +pl01x_generic_setbrg (priv->regs, priv->type, + plat->clock, baudrate); }static int pl01x_serial_probe (struct udevice *dev)
@@ -318,7 +317,8 @@ static int pl01x_serial_probe(struct udevice *dev) priv->regs = (struct pl01x_regs *)plat->base; priv->type = plat->type; -return pl01x_generic_serial_init (priv->regs, priv->type); +return (plat->flags &PL0X_PREINITIALIZED ) ?0 : +pl01x_generic_serial_init (priv->regs, priv->type); }static int pl01x_serial_getc (struct udevice *dev)
@@ -372,6 +372,7 @@ static int pl01x_serial_ofdata_to_platdata(struct udevice *dev) plat->base = addr; plat->clock =fdtdec_get_int (gd->fdt_blob, dev->of_offset,"clock" ,1 ); plat->type =dev_get_driver_data (dev); + plat->flags =fdtdec_get_int (gd->fdt_blob, dev->of_offset,"flags" ,0 ); return 0; }#endif
include/dm/platform_data/serial_pl01x.h +6 -0
@@ -11,17 +11,23 @@ enum pl01x_type { TYPE_PL011, }; +enum pl01x_flags { +PL0X_PREINITIALIZED =1 <<0 ,/* Skip port initialization */ +}; +/* *Information about a serial port * * @base: Register base address * @type: Port type * @clock: Input clock rate, used for calculating the baud rate divisor +* @flags: Port flags */ struct pl01x_serial_platdata {unsigned long base;enum pl01x_type type;unsigned int clock; +unsigned long flags; };#endif
Signature · 1 line
2.2.0
PATCH v5 5/9 arm: serial: Add ability to use pre-initialized UARTs
Hi Sergey,
Quoted 15 lines · Sergey Temerkhanov
On some systems, UART initialization is performed before running U-Boot. This commit allows to skip UART re-initializaion on those systems
Signed-off-by Sergey Temerkhanov <[email protected]>Signed-off-by Radha Mohan Chintakuntla <[email protected]>---
Changes in v5:
- Added OF control supportChanges in v4:
- Fixed build warnings
- Moved toDM_SERIAL
Quoted 8 lines
Changes in v3:
- Added__usedkeywordChanges in v2: None
drivers/serial/serial_pl01x.c | 13 +++++++------ include/dm/platform_data/serial_pl01x.h | 6 ++++++ 2 files changed, 13 insertions(+), 6 deletions(-)
But please see one issue below. Also you might consider implementing the debug UART for this driver so you get early debugging,
Quoted 46 lines
drivers/serial/serial_pl01x.c +6
-6@@ -125,7 +125,7 @@ static int pl011_set_line_control(struct pl01x_regs *regs) }static int pl01x_generic_setbrg (struct pl01x_regs *regs,enum pl01x_type type, -int clock,int baudrate) +int clock,int baudrate) {switch (type) {case TYPE_PL010 : {@@ -295,7 +295,6 @@ __weak struct serial_device *default_serial_console(void)#endif /* nCONFIG_DM_SERIAL */ #ifdef CONFIG_DM_SERIAL - struct pl01x_priv { struct pl01x_regs *regs; enum pl01x_type type;@@ -306,9 +305,9 @@ static int pl01x_serial_setbrg(struct udevice *dev, int baudrate)struct pl01x_serial_platdata *plat =dev_get_platdata (dev);struct pl01x_priv *priv =dev_get_priv (dev); -pl01x_generic_setbrg (priv->regs, priv->type, plat->clock, baudrate); - -return 0 ; +return (plat->flags &PL0X_PREINITIALIZED ) ?0 : +pl01x_generic_setbrg (priv->regs, priv->type, + plat->clock, baudrate); }static int pl01x_serial_probe (struct udevice *dev)@@ -318,7 +317,8 @@ static int pl01x_serial_probe(struct udevice *dev) priv->regs = (struct pl01x_regs *)plat->base; priv->type = plat->type; -return pl01x_generic_serial_init (priv->regs, priv->type); +return (plat->flags &PL0X_PREINITIALIZED ) ?0 : +pl01x_generic_serial_init (priv->regs, priv->type); }static int pl01x_serial_getc (struct udevice *dev)
drivers/serial/serial_pl01x.c static int pl01x_serial_ofdata_to_platdata(struct udevice *dev) · line 375
Quoted 4 lines
drivers/serial/serial_pl01x.c +1
-0@@ -372,6 +372,7 @@ static int pl01x_serial_ofdata_to_platdata(struct udevice *dev) plat->base = addr; plat->clock =fdtdec_get_int (gd->fdt_blob, dev->of_offset,"clock" ,1 ); plat->type =dev_get_driver_data (dev); + plat->flags =fdtdec_get_int (gd->fdt_blob, dev->of_offset,"flags" ,0 );
Can I suggest a boolean option here, like u-boot,skip-init? You can use fdtdec_get_bool() to read it. Also please add it to doc/device-tree-bindings/serial/pl01x.txt.
Quoted 32 lines
drivers/serial/serial_pl01x.c +0
-0return 0; }#endif include/dm/platform_data/serial_pl01x.h +6
-1@@ -11,17 +11,23 @@ enum pl01x_type { TYPE_PL011, }; +enum pl01x_flags { +PL0X_PREINITIALIZED =1 <<0 ,/* Skip port initialization */ +}; +/* *Information about a serial port * * @base: Register base address * @type: Port type * @clock: Input clock rate, used for calculating the baud rate divisor +* @flags: Port flags */ struct pl01x_serial_platdata {unsigned long base;enum pl01x_type type;unsigned int clock; +unsigned long flags; };#endif --
Quoted 2 lines
2.2.0
Regards,
Simon
PATCH v5 5/9 arm: serial: Add ability to use pre-initialized UARTs
Quoted 24 lines · Simon Glass
Hi Sergey,
Quoted 20 lines · Sergey Temerkhanov
On some systems, UART initialization is performed before running U-Boot. This commit allows to skip UART re-initializaion on those systems
Signed-off-by Sergey Temerkhanov <[email protected]>Signed-off-by Radha Mohan Chintakuntla <[email protected]>---
Changes in v5:
- Added OF control supportChanges in v4:
- Fixed build warnings
- Moved toDM_SERIALChanges in v3:
- Added__usedkeywordChanges in v2: None
Quoted 8 lines
Quoted 3 lines
drivers/serial/serial_pl01x.c | 13 +++++++------ include/dm/platform_data/serial_pl01x.h | 6 ++++++ 2 files changed, 13 insertions(+), 6 deletions(-)Reviewed-by Simon Glass <[email protected]>But please see one issue below. Also you might consider implementing the debug UART for this driver so you get early debugging,
I'll look into this and create a separate patch once it's ready.
Quoted 45 lines
Quoted 45 lines
drivers/serial/serial_pl01x.c +6
-6@@ -125,7 +125,7 @@ static int pl011_set_line_control(struct pl01x_regs *regs) }static int pl01x_generic_setbrg (struct pl01x_regs *regs,enum pl01x_type type, -int clock,int baudrate) +int clock,int baudrate) {switch (type) {case TYPE_PL010 : {@@ -295,7 +295,6 @@ __weak struct serial_device *default_serial_console(void)#endif /* nCONFIG_DM_SERIAL */ #ifdef CONFIG_DM_SERIAL - struct pl01x_priv { struct pl01x_regs *regs; enum pl01x_type type;@@ -306,9 +305,9 @@ static int pl01x_serial_setbrg(struct udevice *dev, int baudrate)struct pl01x_serial_platdata *plat =dev_get_platdata (dev);struct pl01x_priv *priv =dev_get_priv (dev); -pl01x_generic_setbrg (priv->regs, priv->type, plat->clock, baudrate); - -return 0 ; +return (plat->flags &PL0X_PREINITIALIZED ) ?0 : +pl01x_generic_setbrg (priv->regs, priv->type, + plat->clock, baudrate); }static int pl01x_serial_probe (struct udevice *dev)@@ -318,7 +317,8 @@ static int pl01x_serial_probe(struct udevice *dev) priv->regs = (struct pl01x_regs *)plat->base; priv->type = plat->type; -return pl01x_generic_serial_init (priv->regs, priv->type); +return (plat->flags &PL0X_PREINITIALIZED ) ?0 : +pl01x_generic_serial_init (priv->regs, priv->type); }
Quoted 9 lines
drivers/serial/serial_pl01x.c static int pl01x_serial_ofdata_to_platdata(struct udevice *dev) · line 375
Quoted 6 lines
drivers/serial/serial_pl01x.c +1
-0static int pl01x_serial_getc (struct udevice *dev)@@ -372,6 +372,7 @@ static int pl01x_serial_ofdata_to_platdata(struct udevice *dev) plat->base = addr; plat->clock =fdtdec_get_int (gd->fdt_blob, dev->of_offset,"clock" ,1 ); plat->type =dev_get_driver_data (dev); + plat->flags =fdtdec_get_int (gd->fdt_blob, dev->of_offset,"flags" ,0 );Can I suggest a boolean option here, like u-boot,skip-init? You can use
fdtdec_get_bool()to read it.
Agreed. This improves code readability and maintainability.
Quoted 2 lines
Also please add it to
doc/device-tree-bindings/serial/pl01x.txt.
OK.
Quoted 38 lines
Quoted 33 lines
drivers/serial/serial_pl01x.c +0
-0return 0; }#endif include/dm/platform_data/serial_pl01x.h +6
-1@@ -11,17 +11,23 @@ enum pl01x_type { TYPE_PL011, }; +enum pl01x_flags { +PL0X_PREINITIALIZED =1 <<0 ,/* Skip port initialization */ +}; +/* *Information about a serial port * * @base: Register base address * @type: Port type * @clock: Input clock rate, used for calculating the baud rate divisor +* @flags: Port flags */ struct pl01x_serial_platdata {unsigned long base;enum pl01x_type type;unsigned int clock; +unsigned long flags; };#endif --Quoted 2 lines
2.2.0
Regards,
Simon
PATCH v5 6/9 armv8: cavium: Add the device tree for ThunderX
In reply to Sergey TemerkhanovThis commit adds the FDT for the ThunderX family of SoCs
---
Changes in v5:
- Added FDT for ThunderX 88xx series
Changes in v4: None
Changes in v3: None
Changes in v2: None
arch/arm/dts/Makefile | 1 + arch/arm/dts/thunderx-88xx.dts | 27 +++ arch/arm/dts/thunderx-88xx.dtsi | 363 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 391 insertions(+) create mode 100644 arch/arm/dts/thunderx-88xx.dts create mode 100644 arch/arm/dts/thunderx-88xx.dtsi
arch/arm/dts/Makefile +1 -0
@@ -57,6 +57,7 @@ dtb-$(CONFIG_ARCH_ZYNQ) += zynq-zc702.dtb \ zynq-zc770-xm012.dtb \ zynq-zc770-xm013.dtb dtb-$(CONFIG_AM33XX) += am335x-boneblack.dtb am335x-evm.dtb +dtb-$(CONFIG_THUNDERX) += thunderx-88xx.dtb dtb-$(CONFIG_ARCH_SOCFPGA) += \ socfpga_arria5_socdk.dtb \
arch/arm/dts/thunderx-88xx.dts new file +27 -0
@@ -0,0 +1,27 @@ +/* + * Cavium Thunder DTS file - Thunder board description + * + * Copyright (C) 2014, Cavium Inc. + * + * SPDX-License-Identifier: GPL-2.0+ or X11 + * + */ + +/dts-v1/; + +/include/ "thunderx-88xx.dtsi" + +/ { + model = "Cavium ThunderX CN88XX board"; + compatible = "cavium,thunder-88xx"; + + aliases { + serial0 = &uaa0; + serial1 = &uaa1; + }; + + memory at 00000000 { + device_type = "memory"; + reg = <0x0 0x00000000 0x0 0x80000000>; + }; +};
arch/arm/dts/thunderx-88xx.dtsi new file +363 -0
363 lines not on this page · raw message
Signature · 1 line
2.2.0
PATCH v5 6/9 armv8: cavium: Add the device tree for ThunderX
Hi Sergey,
Quoted 14 lines · Sergey Temerkhanov
This commit adds the FDT for the ThunderX family of SoCs
Signed-off-by Sergey Temerkhanov <[email protected]>Signed-off-by Radha Mohan Chintakuntla <[email protected]>---
Changes in v5:
- Added FDT for ThunderX 88xx seriesChanges in v4: None
Changes in v3: None
Changes in v2: None
Quoted 6 lines
arch/arm/dts/Makefile | 1 + arch/arm/dts/thunderx-88xx.dts | 27 +++ arch/arm/dts/thunderx-88xx.dtsi | 363 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 391 insertions(+) create mode 100644 arch/arm/dts/thunderx-88xx.dts create mode 100644 arch/arm/dts/thunderx-88xx.dtsi
You could add a chosen node with stdout-path for the UART.
Regards,
Simon
PATCH v5 7/9 armv8: cavium: Add ThunderX 88xx board definition
In reply to Sergey TemerkhanovThis commit adds basic Cavium ThunderX 88xx board definitions and support.
---
Changes in v5:
- Added CONFIG_OF_CONTROL support
- Changed memory attributes
Changes in v4:
- Moved CONFIG_SYS_PROMPT to configs/thunderx_88xx_defconfig
- Added proper DM_SERIAL definitions
Changes in v3:
- Fixed formatting
- Added MAINTAINERS
- Moved command definitions to defconfig
Changes in v2: None
arch/arm/Kconfig | 5 ++ board/cavium/thunderx/Kconfig | 19 +++++ board/cavium/thunderx/MAINTAINERS | 6 ++ board/cavium/thunderx/Makefile | 8 +++ board/cavium/thunderx/thunderx.c | 75 ++++++++++++++++++++ configs/thunderx_88xx_defconfig | 29 ++++++++ include/configs/thunderx_88xx.h | 146 ++++++++++++++++++++++++++++++++++++++ 7 files changed, 288 insertions(+) create mode 100644 board/cavium/thunderx/Kconfig create mode 100644 board/cavium/thunderx/MAINTAINERS create mode 100644 board/cavium/thunderx/Makefile create mode 100644 board/cavium/thunderx/thunderx.c create mode 100644 configs/thunderx_88xx_defconfig create mode 100644 include/configs/thunderx_88xx.h
arch/arm/Kconfig +5 -0
@@ -741,6 +741,10 @@ config ARCH_ROCKCHIP select CPU_V7 select DM +config TARGET_THUNDERX_88XX + bool "Support ThunderX 88xx" + select OF_CONTROL + endchoice source "arch/arm/mach-at91/Kconfig"
@@ -894,6 +898,7 @@ source "board/woodburn/Kconfig" source "board/work-microwave/work_92105/Kconfig" source "board/xaeniax/Kconfig" source "board/zipitz2/Kconfig" +source "board/cavium/thunderx/Kconfig" source "arch/arm/Kconfig.debug"
board/cavium/thunderx/Kconfig new file +19 -0
@@ -0,0 +1,19 @@ +if TARGET_THUNDERX_88XX + +config SYS_CPU + string + default "armv8" + +config SYS_BOARD + string + default "thunderx" + +config SYS_VENDOR + string + default "cavium" + +config SYS_CONFIG_NAME + string + default "thunderx_88xx" + +endif
board/cavium/thunderx/MAINTAINERS new file +6 -0
@@ -0,0 +1,6 @@ +THUNDERX BOARD +M: Sergey Temerkhanov <[email protected]> +S: Maintained +F: board/cavium/thunderx/ +F: include/configs/thunderx_88xx.h +F: configs/thunderx_88xx_defconfig
board/cavium/thunderx/Makefile new file +8 -0
@@ -0,0 +1,8 @@ +# +# +# (C) Copyright 2014, Cavium Inc. +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y := thunderx.o
board/cavium/thunderx/thunderx.c new file +75 -0
75 lines not on this page · raw message
configs/thunderx_88xx_defconfig new file +29 -0
@@ -0,0 +1,29 @@ +CONFIG_SYS_EXTRA_OPTIONS="ARM64" +CONFIG_ARM=y +CONFIG_TARGET_THUNDERX_88XX=y +CONFIG_SYS_PROMPT="ThunderX_88XX> " + +CONFIG_DM=y +CONFIG_DM_SERIAL=y +CONFIG_DM_STDIO=y +CONFIG_DEFAULT_DEVICE_TREE="thunderx-88xx" + +CONFIG_CMD_CACHE=y +CONFIG_CMD_BDI=y +CONFIG_CMD_DIAG=y +CONFIG_CMD_ENV=y +CONFIG_CMD_IMI=y +CONFIG_CMD_MEMORY=y +CONFIG_CMD_RUN=y +CONFIG_CMD_BOOTD=y +CONFIG_CMD_ECHO=y +CONFIG_CMD_SOURCE=y + +CONFIG_CMD_LOADB=y +CONFIG_CMD_LOADS=y +CONFIG_CMD_SAVES=y + +# CONFIG_CMD_FLASH is not set +# CONFIG_CMD_IMLS is not set + +CONFIG_CMD_ATF=y
include/configs/thunderx_88xx.h new file +146 -0
146 lines not on this page · raw message
Signature · 1 line
2.2.0
PATCH v5 8/9 armv8: cavium: Add an implementation of ATF calling functions
In reply to Sergey TemerkhanovThis commit adds functions issuing calls to the product-specific ATF services
---
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None
board/cavium/thunderx/Makefile | 2 +- board/cavium/thunderx/atf.c | 312 ++++++++++++++++++++++++++++++++++++++++ include/cavium/atf.h | 22 +++ include/cavium/atf_part.h | 26 ++++ include/cavium/thunderx_svc.h | 67 +++++++++ include/configs/thunderx_88xx.h | 2 + 6 files changed, 430 insertions(+), 1 deletion(-) create mode 100644 board/cavium/thunderx/atf.c create mode 100644 include/cavium/atf.h create mode 100644 include/cavium/atf_part.h create mode 100644 include/cavium/thunderx_svc.h
board/cavium/thunderx/Makefile +1 -1
@@ -5,4 +5,4 @@ # SPDX-License-Identifier: GPL-2.0+ # -obj-y := thunderx.o +obj-y := thunderx.o atf.o
board/cavium/thunderx/atf.c new file +312 -0
312 lines not on this page · raw message
include/cavium/atf.h new file +22 -0
@@ -0,0 +1,22 @@ +/** +* (C) Copyright 2014, Cavium Inc. +* +* SPDX-License-Identifier: GPL-2.0+ +**/ +#ifndef __ATF_H__ +#define __ATF_H__ +#include <cavium/atf_part.h> + +ssize_t atf_read_mmc (uintptr_t offset,void *buffer,size_t size); +ssize_t atf_read_nor (uintptr_t offset,void *buffer,size_t size); +ssize_t atf_get_pcount (void ); +ssize_t atf_get_part (struct storage_partition *part,unsigned int index); +ssize_t atf_erase_nor (uintptr_t offset,size_t size); +ssize_t atf_write_nor (uintptr_t offset,const void *buffer,size_t size); +ssize_t atf_write_mmc (uintptr_t offset,const void *buffer,size_t size); +ssize_t atf_dram_size (unsigned int node); +ssize_t atf_node_count (void ); +ssize_t atf_env_count (void ); +ssize_t atf_env_string (size_t index,char *str); + +#endif
include/cavium/atf_part.h new file +26 -0
@@ -0,0 +1,26 @@ +/** +* (C) Copyright 2014, Cavium Inc. +* +* SPDX-License-Identifier: GPL-2.0+ +**/ + +#ifndef __ATF_PART_H__ +#define __ATF_PART_H__ + +struct storage_partition { +unsigned int type; +unsigned int size; +unsigned long offset; +}; + +enum { +PARTITION_NBL1FW_REST =0 , +PARTITION_BL2_BL31 =1 , +PARTITION_UBOOT =2 , +PARTITION_UEFI =2 , +PARTITION_KERNEL =3 , +PARTITION_DEVICE_TREE =4 , +PARTITION_LAST , +}; + +#endif
include/cavium/thunderx_svc.h new file +67 -0
67 lines not on this page · raw message
include/configs/thunderx_88xx.h +2 -0
@@ -28,6 +28,8 @@#define CONFIG_SYS_FULL_VA +#define CONFIG_SYS_LOWMEM_BASE MEM_BASE +#define CONFIG_SYS_MEM_MAP {{0x000000000000UL, 0x40000000000UL, \ PTL2_MEMTYPE(MT_NORMAL) | \ PTL2_BLOCK_NON_SHARE}, \
Signature · 1 line
2.2.0
PATCH v5 9/9 armv8: cavium: Get DRAM size from ATF
In reply to Sergey TemerkhanovChange the dram_init() function on ThunderX to query ATF services for the real installed DRAM size
DRAM fix
---
Changes in v5:
- Moved dram_init() from a separate file to thunderx.c
Changes in v4: None
Changes in v3: None
Changes in v2: None
board/cavium/thunderx/thunderx.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
board/cavium/thunderx/thunderx.c +27 -0
@@ -9,6 +9,8 @@#include <errno.h> #include <linux/compiler.h> +#include <cavium/atf.h> +#if !CONFIG_IS_ENABLED (OF_CONTROL )#include <dm/platdata.h> #include <dm/platform_data/serial_pl01x.h>
@@ -50,6 +52,31 @@ int timer_init(void)return 0 ; } +int dram_init (void ) +{ +ssize_t node_count =atf_node_count (); +ssize_t dram_size; +int node; + +printf ("Initializing\nNodes in system: %zd\n" , node_count); + + gd->ram_size =0 ; + +for (node =0 ; node < node_count; node++) { + dram_size =atf_dram_size (node); +printf ("Node %d: %zd MBytes of DRAM\n" , node, dram_size >>20 ); + gd->ram_size += dram_size; + } + + gd->ram_size -=MEM_BASE ; + + *(unsigned long *)CPU_RELEASE_ADDR =0 ; + +puts ("DRAM size:" ); + +return 0 ; +} +/* * Board specific reset that is system reset. */
Signature · 1 line
2.2.0