Skip to content

Commit 41c6483

Browse files
RtkFPcaiyi_zhong
authored andcommitted
soc: add realtek RTS5817
Add support for the rts5817 MCU Signed-off-by: Darcy Lu <darcy_lu@realsil.com.cn>
1 parent 7a8bd3d commit 41c6483

File tree

12 files changed

+166
-0
lines changed

12 files changed

+166
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Copyright (c) 2024 Realtek Semiconductor, Inc.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
add_subdirectory(${SOC_SERIES})

soc/realtek/fingerprint/Kconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Copyright (c) 2024 Realtek Semiconductor, Inc.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
if SOC_FAMILY_FINGERPRINT
5+
6+
rsource "*/Kconfig"
7+
8+
endif # SOC_FAMILY_FINGERPRINT
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Copyright (c) 2024 Realtek Semiconductor, Inc.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
if SOC_FAMILY_FINGERPRINT
5+
6+
rsource "*/Kconfig.defconfig"
7+
8+
endif # SOC_FAMILY_FINGERPRINT

soc/realtek/fingerprint/Kconfig.soc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Copyright (c) 2024 Realtek Semiconductor, Inc.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config SOC_FAMILY_FINGERPRINT
5+
bool
6+
7+
config SOC_FAMILY
8+
default "fingerprint" if SOC_FAMILY_FINGERPRINT
9+
10+
rsource "*/Kconfig.soc"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Copyright (c) 2024 Realtek Semiconductor, Inc.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
zephyr_include_directories(.)
5+
6+
zephyr_sources(soc.c)
7+
8+
set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/arm/cortex_m/scripts/linker.ld CACHE INTERNAL "")
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Copyright (c) 2024 Realtek Semiconductor, Inc.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config SOC_SERIES_RTS5817
5+
select ARM
6+
select CPU_CORTEX_M33
7+
select CPU_HAS_FPU
8+
select CPU_HAS_ARM_MPU
9+
select CPU_HAS_DCACHE
10+
select CPU_HAS_ICACHE
11+
select CACHE_MANAGEMENT
12+
select ARMV8_M_DSP
13+
select INIT_ARCH_HW_AT_BOOT
14+
select XIP
15+
select ARCH_HAS_EXTRA_EXCEPTION_INFO
16+
select SOC_EARLY_INIT_HOOK
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Copyright (c) 2024 Realtek Semiconductor, Inc.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
if SOC_SERIES_RTS5817
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 32
11+
12+
endif # SOC_SERIES_RTS5817
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Copyright (c) 2024 Realtek Semiconductor, Inc.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config SOC_SERIES_RTS5817
5+
bool
6+
select SOC_FAMILY_FINGERPRINT
7+
8+
config SOC_RTS5817
9+
bool
10+
select SOC_SERIES_RTS5817
11+
12+
config SOC
13+
default "rts5817" if SOC_RTS5817
14+
15+
config SOC_SERIES
16+
default "rts5817" if SOC_SERIES_RTS5817
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Copyright (c) 2024 Realtek Semiconductor, Inc.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#ifndef ZEPHYR_SOC_ARM_REALTEK_RTS5817_PINCTRL_SOC_H_
8+
#define ZEPHYR_SOC_ARM_REALTEK_RTS5817_PINCTRL_SOC_H_
9+
10+
#include <zephyr/devicetree.h>
11+
#include <zephyr/dt-bindings/pinctrl/rts5817_pinctrl.h>
12+
13+
typedef struct pinctrl_soc_pin {
14+
uint8_t pin: 8;
15+
uint8_t func: 3;
16+
uint8_t pulldown: 1;
17+
uint8_t pullup: 1;
18+
uint8_t power_source: 2;
19+
} pinctrl_soc_pin_t;
20+
21+
#define Z_PINCTRL_STATE_PIN_INIT(node_id, prop, idx) \
22+
{ \
23+
.pin = RTS_FP_PINMUX_PIN(DT_PROP_BY_IDX(node_id, prop, idx)), \
24+
.func = RTS_FP_PINMUX_FUNC(DT_PROP_BY_IDX(node_id, prop, idx)), \
25+
.pulldown = DT_PROP(node_id, bias_pull_down), \
26+
.pullup = DT_PROP(node_id, bias_pull_up), \
27+
.power_source = (DT_PROP_OR(node_id, power_source, IO_POWER_3V3)), \
28+
},
29+
30+
#define Z_PINCTRL_STATE_PINS_INIT(node_id, prop) \
31+
{DT_FOREACH_CHILD_VARGS(DT_PHANDLE(node_id, prop), DT_FOREACH_PROP_ELEM, pinmux, \
32+
Z_PINCTRL_STATE_PIN_INIT)}
33+
34+
#endif /* ZEPHYR_SOC_ARM_REALTEK_RTS5817_PINCTRL_SOC_H_ */

soc/realtek/fingerprint/rts5817/soc.c

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* Copyright (c) 2024 Realtek Semiconductor, Inc.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <zephyr/kernel.h>
8+
#include <zephyr/device.h>
9+
#include <zephyr/init.h>
10+
#include <zephyr/cache.h>
11+
#include <soc.h>
12+
13+
#include <cmsis_core.h>
14+
15+
/**
16+
* @brief Initialize cache
17+
*
18+
*/
19+
static void cache_init(void)
20+
{
21+
sys_cache_instr_enable();
22+
sys_cache_data_enable();
23+
}
24+
25+
/**
26+
* @brief Perform basic hardware initialization at boot.
27+
*
28+
* This needs to be run from the very beginning.
29+
*/
30+
void soc_early_init_hook(void)
31+
{
32+
cache_init();
33+
}

0 commit comments

Comments
 (0)