soc: arm: Add Nuvoton NPCX7M6FB SoC

Initial support for Nuvoton NPCX7M6FB SoC of NPCX series which is a chip
family of embedded controllers (EC) and targeted for a wide range of
portable applications. We implemented the SoC skeleton in
soc/arm/nuvoton_npcx since there're many chip families in Nuvoton and
aim to different markets such as PC, General MCU, and Audio. The
architectures and hardware modules are different between them. Hence, we
suggest using the company name plus with chip series for better
understanding.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
This commit is contained in:
Mulin Chao 2020-06-24 19:13:43 +08:00 committed by Ioannis Glaropoulos
parent 236759b18a
commit ec50b1846f
17 changed files with 223 additions and 0 deletions

View file

@ -40,6 +40,7 @@
/soc/arm/nxp*/ @MaureenHelm
/soc/arm/nordic_nrf/ @ioannisg
/soc/arm/nuvoton/ @ssekar15
/soc/arm/nuvoton_npcx/ @MulinChao
/soc/arm/qemu_cortex_a53/ @carlocaione
/soc/arm/silabs_exx32/efr32mg21/ @l-alfred
/soc/arm/st_stm32/ @erwango

View file

@ -0,0 +1,34 @@
/*
* Copyright (c) 2020 Nuvoton Technology Corporation.
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <arm/armv7-m.dtsi>
/ {
cpus {
#address-cells = <1>;
#size-cells = <0>;
cpu@0 {
device_type = "cpu";
compatible = "arm,cortex-m4f";
reg = <0>;
};
};
flash0: flash@10090000 {
reg = <0x10090000 0x30000>;
};
sram0: memory@200c0000 {
compatible = "mmio-sram";
reg = <0x200C0000 0x10000>;
};
};
&nvic {
arm,num-irq-priority-bits = <3>;
};

View file

@ -0,0 +1,4 @@
# SPDX-License-Identifier: Apache-2.0
add_subdirectory(common)
add_subdirectory(${SOC_SERIES})

View file

@ -0,0 +1,17 @@
# Nuvoton Cortex-M4 Embedded Controller
# Copyright (c) 2020 Nuvoton Technology Corporation.
# SPDX-License-Identifier: Apache-2.0
config SOC_FAMILY_NPCX
bool
if SOC_FAMILY_NPCX
config SOC_FAMILY
string
default "nuvoton_npcx"
# Select SoC Part No. and configuration options
source "soc/arm/nuvoton_npcx/*/Kconfig.soc"
endif # SOC_FAMILY_NPCX

View file

@ -0,0 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2020 Nuvoton Technology Corporation.
# SPDX-License-Identifier: Apache-2.0
source "soc/arm/nuvoton_npcx/*/Kconfig.defconfig.series"

View file

@ -0,0 +1,6 @@
# Nuvoton Cortex-M4 Embedded Controller
# Copyright (c) 2020 Nuvoton Technology Corporation.
# SPDX-License-Identifier: Apache-2.0
source "soc/arm/nuvoton_npcx/*/Kconfig.series"

View file

@ -0,0 +1,3 @@
# SPDX-License-Identifier: Apache-2.0
zephyr_include_directories(.)

View file

@ -0,0 +1,30 @@
/*
* Copyright (c) 2020 Nuvoton Technology Corporation.
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef _NUVOTON_NPCX_REG_ACCESS_H
#define _NUVOTON_NPCX_REG_ACCESS_H
/*
* NPCX register bit/field access operations
*/
#define IS_BIT_SET(reg, bit) ((reg >> bit) & (0x1))
#define GET_POS_FIELD(pos, size) pos
#define GET_SIZE_FIELD(pos, size) size
#define FIELD_POS(field) GET_POS_##field
#define FIELD_SIZE(field) GET_SIZE_##field
#define GET_FIELD(reg, field) \
_GET_FIELD_(reg, FIELD_POS(field), FIELD_SIZE(field))
#define _GET_FIELD_(reg, f_pos, f_size) (((reg)>>(f_pos)) & ((1<<(f_size))-1))
#define SET_FIELD(reg, field, value) \
_SET_FIELD_(reg, FIELD_POS(field), FIELD_SIZE(field), value)
#define _SET_FIELD_(reg, f_pos, f_size, value) \
((reg) = ((reg) & (~(((1 << (f_size))-1) << (f_pos)))) \
| ((value) << (f_pos)))
#endif /* _NUVOTON_NPCX_REG_ACCESS_H */

View file

@ -0,0 +1,12 @@
/*
* Copyright (c) 2020 Nuvoton Technology Corporation.
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef _NUVOTON_NPCX_REG_DEF_H
#define _NUVOTON_NPCX_REG_DEF_H
#endif /* _NUVOTON_NPCX_REG_DEF_H */

View file

@ -0,0 +1,7 @@
# SPDX-License-Identifier: Apache-2.0
zephyr_include_directories(${ZEPHYR_BASE}/drivers)
zephyr_sources(
soc.c
)

View file

@ -0,0 +1,11 @@
# Nuvoton Cortex-M4 Embedded Controller
# Copyright (c) 2020 Nuvoton Technology Corporation.
# SPDX-License-Identifier: Apache-2.0
if SOC_NPCX7M6FB
config SOC
default "npcx76mfb"
endif # SOC_NPCX7M6FB

View file

@ -0,0 +1,16 @@
# Nuvoton Cortex-M4 Embedded Controller
# Copyright (c) 2020 Nuvoton Technology Corporation.
# SPDX-License-Identifier: Apache-2.0
if SOC_SERIES_NPCX7
config SOC_SERIES
default "npcx7"
config NUM_IRQS
default 64
source "soc/arm/nuvoton_npcx/npcx7/Kconfig.defconfig.npcx7*"
endif # SOC_SERIES_NPCX7

View file

@ -0,0 +1,15 @@
# Nuvoton Cortex-M4 Embedded Controller NPCX7 series
# Copyright (c) 2020 Nuvoton Technology Corporation.
# SPDX-License-Identifier: Apache-2.0
config SOC_SERIES_NPCX7
bool "Nuvoton NPCX7 Series"
select ARM
select CPU_CORTEX_M4
select CPU_CORTEX_M_HAS_DWT
select CPU_HAS_FPU
select CPU_HAS_ARM_MPU
select SOC_FAMILY_NPCX
help
Enable support for Nuvoton NPCX7 series

View file

@ -0,0 +1,13 @@
# Nuvoton NPCX7 EC series
# Copyright (c) 2020 Nuvoton Technology Corporation.
# SPDX-License-Identifier: Apache-2.0
choice
prompt "NPCX7M6FB Selection"
depends on SOC_SERIES_NPCX7
config SOC_NPCX7M6FB
bool "NPCX7M6FB"
endchoice

View file

@ -0,0 +1,9 @@
/* linker.ld - Linker command/script file */
/*
* Copyright (c) 2020 Nuvoton Technology Corporation.
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <arch/arm/aarch32/cortex_m/scripts/linker.ld>

View file

@ -0,0 +1,19 @@
/*
* Copyright (c) 2020 Nuvoton Technology Corporation.
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <kernel.h>
#include <device.h>
#include <init.h>
#include <soc.h>
static int soc_init(struct device *dev)
{
ARG_UNUSED(dev);
return 0;
}
SYS_INIT(soc_init, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);

View file

@ -0,0 +1,20 @@
/*
* Copyright (c) 2020 Nuvoton Technology Corporation.
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef _NUVOTON_NPCX_SOC_H_
#define _NUVOTON_NPCX_SOC_H_
/* CMSIS required definitions */
#define __FPU_PRESENT CONFIG_CPU_HAS_FPU
#define __MPU_PRESENT CONFIG_CPU_HAS_ARM_MPU
/* Add include for DTS generated information */
#include <devicetree.h>
#include <reg/reg_access.h>
#include <reg/reg_def.h>
#endif /* _NUVOTON_NPCX_SOC_H_ */