Skip to content

Commit 3112f85

Browse files
dnltzkartben
authored andcommitted
soc: Add aesc
Currently, the only available platform is Nitrogen, featuring a VexRiscv CPU that boots from external SPI flash and runs code from external HyperRAM. Signed-off-by: Daniel Schultz <dnltz@aesc-silicon.de>
1 parent 14b83d1 commit 3112f85

File tree

12 files changed

+194
-0
lines changed

12 files changed

+194
-0
lines changed

soc/aesc/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Copyright (c) 2025 Aesc Silicon
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
zephyr_include_directories(.)
5+
6+
add_subdirectory(${SOC_SERIES})

soc/aesc/Kconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Copyright (c) 2025 Aesc Silicon
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
rsource "*/Kconfig"

soc/aesc/Kconfig.defconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Copyright (c) 2025 Aesc Silicon
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
rsource "*/Kconfig.defconfig"

soc/aesc/Kconfig.soc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Copyright (c) 2025 Aesc Silicon
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
rsource "*/Kconfig.soc"

soc/aesc/ip_identification.h

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
/** @file
2+
* @brief IP Identification API.
3+
*
4+
* Copyright (c) 2025 Aesc Silicon
5+
*
6+
* SPDX-License-Identifier: Apache-2.0
7+
*/
8+
9+
#include <stdint.h>
10+
#include <zephyr/sys/util.h>
11+
12+
#ifndef INCLUDE_DRIVERS_AESC_IP_IDENTIFICATION_H_
13+
#define INCLUDE_DRIVERS_AESC_IP_IDENTIFICATION_H_
14+
#ifdef __cplusplus
15+
extern "C" {
16+
#endif
17+
18+
/**
19+
* Each Aesc Silicon IP core is equipped with a so-called IP identification
20+
* table at the beginning of each register map. This table helps to identify
21+
* the underlying hardware.
22+
*
23+
* IP identification table for API v0:
24+
*
25+
* +---------+---------+---------+---------+
26+
* | 31 - 24 | 23 - 16 | 15 - 8 | 7 - 0 |
27+
* +=========+=========+=========+=========+
28+
* | API | Length | ID | 0x00 (header)
29+
* +---------+---------+-------------------+
30+
* | Major | Minor | Patch | 0x04 (version)
31+
* +---------+---------+-------------------+
32+
*
33+
* header.api_version: Version of this IP identification table.
34+
* header.length: Total length of the IP identification table.
35+
* Important to relocate the register map.
36+
* header.id: ID of this IP core.
37+
* version: Defines the version of this IP core with major.minor.patchlevel.
38+
*/
39+
40+
struct aesc_ip_id_table {
41+
uint32_t header;
42+
uint32_t version;
43+
};
44+
45+
#define CONV_ADDR(addr) ((struct aesc_ip_id_table *)addr)
46+
47+
#define HEADER_API_MASK GENMASK(31, 24)
48+
#define HEADER_LENGTH_MASK GENMASK(23, 16)
49+
#define HEADER_ID_MASK GENMASK(15, 0)
50+
#define VERSION_MAJOR_MASK GENMASK(31, 24)
51+
#define VERSION_MINOR_MASK GENMASK(23, 16)
52+
#define VERSION_PATCH_MASK GENMASK(15, 0)
53+
54+
static inline unsigned int ip_id_get_major_version(volatile uintptr_t *addr)
55+
{
56+
const volatile struct aesc_ip_id_table *table = CONV_ADDR(addr);
57+
58+
return FIELD_GET(VERSION_MAJOR_MASK, table->version);
59+
}
60+
61+
static inline unsigned int ip_id_get_minor_version(volatile uintptr_t *addr)
62+
{
63+
const volatile struct aesc_ip_id_table *table = CONV_ADDR(addr);
64+
65+
return FIELD_GET(VERSION_MINOR_MASK, table->version);
66+
}
67+
68+
static inline unsigned int ip_id_get_patchlevel(volatile uintptr_t *addr)
69+
{
70+
const volatile struct aesc_ip_id_table *table = CONV_ADDR(addr);
71+
72+
return FIELD_GET(VERSION_PATCH_MASK, table->version);
73+
}
74+
75+
static inline unsigned int ip_id_get_api_version(volatile uintptr_t *addr)
76+
{
77+
const volatile struct aesc_ip_id_table *table = CONV_ADDR(addr);
78+
79+
return FIELD_GET(HEADER_API_MASK, table->header);
80+
}
81+
82+
static inline unsigned int ip_id_get_header_length(volatile uintptr_t *addr)
83+
{
84+
const volatile struct aesc_ip_id_table *table = CONV_ADDR(addr);
85+
86+
return FIELD_GET(HEADER_LENGTH_MASK, table->header);
87+
}
88+
89+
static inline unsigned int ip_id_get_id(volatile uintptr_t *addr)
90+
{
91+
const volatile struct aesc_ip_id_table *table = CONV_ADDR(addr);
92+
93+
return FIELD_GET(HEADER_ID_MASK, table->header);
94+
}
95+
96+
static inline uintptr_t ip_id_relocate_driver(volatile uintptr_t *addr)
97+
{
98+
return (uintptr_t)addr + ip_id_get_header_length(addr);
99+
}
100+
101+
#ifdef __cplusplus
102+
}
103+
#endif
104+
#endif /* INCLUDE_DRIVERS_AESC_IP_IDENTIFICATION_H_ */

soc/aesc/nitrogen/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
zephyr_include_directories(.)
2+
3+
set(SOC_LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/linker.ld
4+
CACHE INTERNAL "SoC Linker script ${SOC_NAME}"
5+
)

soc/aesc/nitrogen/Kconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Copyright (c) 2025 Aesc Silicon
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config SOC_SERIES_NITROGEN
5+
select RISCV
6+
select RISCV_PRIVILEGED
7+
select INCLUDE_RESET_VECTOR
8+
select ATOMIC_OPERATIONS_C
9+
select RISCV_ISA_RV32I
10+
select RISCV_ISA_EXT_M
11+
select RISCV_ISA_EXT_C
12+
select RISCV_ISA_EXT_ZICSR
13+
select RISCV_ISA_EXT_ZIFENCEI
14+
15+
config SOC_PART_NUMBER
16+
default "elemrv_n" if SOC_ELEMRV_N

soc/aesc/nitrogen/Kconfig.defconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Copyright (c) 2025 Aesc Silicon
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
if SOC_SERIES_NITROGEN
5+
6+
config SYS_CLOCK_HW_CYCLES_PER_SEC
7+
default $(dt_node_int_prop_int,/cpus/cpu@0,clock-frequency)
8+
9+
config NUM_IRQS
10+
default 12
11+
12+
config XIP
13+
default n
14+
15+
endif # SOC_SERIES_NITROGEN

soc/aesc/nitrogen/Kconfig.soc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Copyright (c) 2025 Aesc Silicon
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config SOC_SERIES_NITROGEN
5+
bool
6+
7+
config SOC_ELEMRV_N
8+
bool
9+
select SOC_SERIES_NITROGEN
10+
11+
config SOC_SERIES
12+
default "nitrogen" if SOC_SERIES_NITROGEN
13+
14+
config SOC
15+
default "elemrv_n" if SOC_ELEMRV_N

soc/aesc/nitrogen/linker.ld

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/*
2+
* Copyright (c) 2025 Aesc Silicon
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <zephyr/arch/riscv/common/linker.ld>

0 commit comments

Comments
 (0)