diff --git a/CODEOWNERS b/CODEOWNERS index bd18e0a089c..10bf2bacb5c 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -34,6 +34,7 @@ /soc/arm/atmel_sam/same70/ @nandojve /soc/arm/atmel_sam/samv71/ @nandojve /soc/arm/bcm*/ @sbranden +/soc/arm/infineon_xmc/ @parthitce /soc/arm/nxp*/ @MaureenHelm /soc/arm/nordic_nrf/ @ioannisg /soc/arm/qemu_cortex_a53/ @carlocaione @@ -247,6 +248,7 @@ /dts/arm/atmel/samv71* @nandojve /dts/arm/atmel/ @galak /dts/arm/broadcom/ @sbranden +/dts/arm/infineon/ @parthitce /dts/arm/qemu-virt/ @carlocaione /dts/arm/st/ @erwango /dts/arm/ti/cc13?2* @bwitherspoon diff --git a/dts/arm/infineon/xmc4500.dtsi b/dts/arm/infineon/xmc4500.dtsi new file mode 100644 index 00000000000..fe82d5287fd --- /dev/null +++ b/dts/arm/infineon/xmc4500.dtsi @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2020 Linumiz + * Author: Parthiban Nallathambi + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include + +&psram1 { + reg = <0x10000000 DT_SIZE_K(64)>; +}; + +&dsram1 { + reg = <0x20000000 DT_SIZE_K(64)>; +}; + +&dsram2 { + reg = <0x30000000 DT_SIZE_K(32)>; +}; + +&flash0 { + reg = <0xc000000 DT_SIZE_M(1)>; +}; diff --git a/dts/arm/infineon/xmc4xxx.dtsi b/dts/arm/infineon/xmc4xxx.dtsi new file mode 100644 index 00000000000..046d7a428fe --- /dev/null +++ b/dts/arm/infineon/xmc4xxx.dtsi @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2020 Linumiz + * Author: Parthiban Nallathambi + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +/ { + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu0: cpu@0 { + compatible = "arm,cortex-m4f"; + reg = <0>; + }; + }; + + /* TODO: Add psram1 & dsram2 to MEMORY layout of linker */ + psram1: memory@10000000 { + compatible = "mmio-sram"; + }; + + dsram1: memory@20000000 { + compatible = "mmio-sram"; + }; + + dsram2: memory@30000000 { + compatible = "mmio-sram"; + }; + + flash0: serial-flash@c000000 { + compatible = "serial-flash"; + }; + + sysclk: system-clock { + compatible = "fixed-clock"; + clock-frequency = <120000000>; + #clock-cells = <0>; + }; + + soc { + usic0ch0: usic@40030000 { + reg = <0x40030000 0x1ff>; + clocks = <&sysclk>; + status = "disabled"; + }; + + usic0ch1: usic@40030200 { + reg = <0x40030200 0x1ff>; + clocks = <&sysclk>; + status = "disabled"; + }; + + usic1ch0: usic@48020000 { + reg = <0x48020000 0x1ff>; + clocks = <&sysclk>; + status = "disabled"; + }; + + usic1ch1: usic@48020200 { + reg = <0x48020200 0x1ff>; + clocks = <&sysclk>; + status = "disabled"; + }; + + usic2ch0: usic@48024000 { + reg = <0x48024000 0x1ff>; + clocks = <&sysclk>; + status = "disabled"; + }; + + usic2ch1: usic@48024200 { + reg = <0x48024200 0x1ff>; + clocks = <&sysclk>; + status = "disabled"; + }; + }; +}; + +&nvic { + arm,num-irq-priority-bits = <6>; +}; diff --git a/modules/Kconfig b/modules/Kconfig index d3a4492dc36..57072d104bf 100644 --- a/modules/Kconfig +++ b/modules/Kconfig @@ -10,6 +10,7 @@ source "modules/Kconfig.civetweb" source "modules/Kconfig.cmsis" source "modules/Kconfig.cypress" source "modules/Kconfig.imx" +source "modules/Kconfig.infineon" source "modules/Kconfig.libmetal" source "modules/Kconfig.loramac-node" source "modules/Kconfig.mbedtls" diff --git a/modules/Kconfig.infineon b/modules/Kconfig.infineon new file mode 100644 index 00000000000..4248f274562 --- /dev/null +++ b/modules/Kconfig.infineon @@ -0,0 +1,18 @@ +# SPDX-License-Identifier: Apache-2.0 +# +# Copyright (c) 2020 Linumiz +# Author: Parthiban Nallathambi + +config HAS_XMCLIB + bool + select HAS_CMSIS_CORE + depends on SOC_FAMILY_XMC + +if HAS_XMCLIB + +config HAS_XMCLIB_UART + bool + help + Enable XMCLIB Universal asynchronous receiver transmitter (UART) + +endif # HAS_XMCLIB diff --git a/soc/arm/infineon_xmc/4xxx/CMakeLists.txt b/soc/arm/infineon_xmc/4xxx/CMakeLists.txt new file mode 100644 index 00000000000..124571032e1 --- /dev/null +++ b/soc/arm/infineon_xmc/4xxx/CMakeLists.txt @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: Apache-2.0 +# +# Copyright (c) 2020 Linumiz +# Author: Parthiban Nallathambi + +zephyr_sources(soc.c) +zephyr_linker_sources(NOINIT noinit.ld) diff --git a/soc/arm/infineon_xmc/4xxx/Kconfig.defconfig.series b/soc/arm/infineon_xmc/4xxx/Kconfig.defconfig.series new file mode 100644 index 00000000000..1aaad50849e --- /dev/null +++ b/soc/arm/infineon_xmc/4xxx/Kconfig.defconfig.series @@ -0,0 +1,21 @@ +# SPDX-License-Identifier: Apache-2.0 +# +# XMC 4xxx series configuration options +# Copyright (c) 2020 Linumiz +# Author: Parthiban Nallathambi + +if SOC_SERIES_XMC_4XXX + +config SOC_SERIES + default "4xxx" + +config NUM_IRQS + default 112 + +config UART_XMC4XXX + default y + depends on SERIAL + +source "soc/arm/infineon_xmc/4xxx/Kconfig.defconfig.xmc*" + +endif # SOC_SERIES_XMC_4XXX diff --git a/soc/arm/infineon_xmc/4xxx/Kconfig.defconfig.xmc4500 b/soc/arm/infineon_xmc/4xxx/Kconfig.defconfig.xmc4500 new file mode 100644 index 00000000000..7bb9ffc2b1f --- /dev/null +++ b/soc/arm/infineon_xmc/4xxx/Kconfig.defconfig.xmc4500 @@ -0,0 +1,18 @@ +# Infineon XMC4500 relax kit platform configuration options +# +# Copyright (c) 2020 Linumiz +# Author: Parthiban Nallathambi +# SPDX-License-Identifier: Apache-2.0 + +if SOC_XMC4500 + +config SOC + default "XMC4500" + +config SYS_CLOCK_HW_CYCLES_PER_SEC + default 120000000 + +config NUM_IRQS + default 110 + +endif # SOC_XMC4500 diff --git a/soc/arm/infineon_xmc/4xxx/Kconfig.series b/soc/arm/infineon_xmc/4xxx/Kconfig.series new file mode 100644 index 00000000000..10f9faff24f --- /dev/null +++ b/soc/arm/infineon_xmc/4xxx/Kconfig.series @@ -0,0 +1,16 @@ +# XMC4xxx MCU series +# +# Copyright (c) 2020 Linumiz +# Author: Parthiban Nallathambi +# SPDX-License-Identifier: Apache-2.0 + +config SOC_SERIES_XMC_4XXX + bool "XMC 4xxx Series MCU" + select ARM + select CPU_CORTEX_M4 + select CPU_CORTEX_M_HAS_DWT + select SOC_FAMILY_XMC + select CPU_HAS_ARM_MPU + select CPU_HAS_FPU + help + Enable support for XMC 4xxx MCU series diff --git a/soc/arm/infineon_xmc/4xxx/Kconfig.soc b/soc/arm/infineon_xmc/4xxx/Kconfig.soc new file mode 100644 index 00000000000..ede659c83ee --- /dev/null +++ b/soc/arm/infineon_xmc/4xxx/Kconfig.soc @@ -0,0 +1,30 @@ +# XMC 4xxx MCU line +# +# Copyright (c) 2020 Linumiz +# Author: Parthiban Nallathambi +# SPDX-License-Identifier: Apache-2.0 + +choice + prompt "XMC 4xxx MCU Selection" + depends on SOC_SERIES_XMC_4XXX + +config SOC_XMC4500 + bool "SOC_XMC4500" + select HAS_XMCLIB + +endchoice + +if SOC_SERIES_XMC_4XXX + +config SOC_PART_NUMBER_F100X1024 + bool + +config SOC_PART_NUMBER_XMC_4XXX + string + default "F100x1024" if SOC_PART_NUMBER_F100X1024 + help + This string holds the full part number of the SoC. It is a hidden option + that you should not set directly. The part number selection choice defines + the default value for this string. + +endif # SOC_SERIES_XMC_4XXX diff --git a/soc/arm/infineon_xmc/4xxx/linker.ld b/soc/arm/infineon_xmc/4xxx/linker.ld new file mode 100644 index 00000000000..2ea1b4d0bc2 --- /dev/null +++ b/soc/arm/infineon_xmc/4xxx/linker.ld @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2014 Wind River Systems, Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * @file + * @brief Linker command/script file + * + * This is the linker script for both standard images and XIP images. + */ + +#include diff --git a/soc/arm/infineon_xmc/4xxx/noinit.ld b/soc/arm/infineon_xmc/4xxx/noinit.ld new file mode 100644 index 00000000000..936da67a808 --- /dev/null +++ b/soc/arm/infineon_xmc/4xxx/noinit.ld @@ -0,0 +1,11 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2020 Linumiz + * Author: Parthiban Nallathambi + * + * Extracted from: infineon/XMCLib/devices/XMC4500/Source/GCC/XMC4500x1024.ld + */ + +/* .no_init section contains chipid, SystemCoreClock and trimming data */ +KEEP(*(.no_init)) diff --git a/soc/arm/infineon_xmc/4xxx/soc.c b/soc/arm/infineon_xmc/4xxx/soc.c new file mode 100644 index 00000000000..fe4015a63c6 --- /dev/null +++ b/soc/arm/infineon_xmc/4xxx/soc.c @@ -0,0 +1,27 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2020 Linumiz + * Author: Parthiban Nallathambi + * + */ + +#include +#include +#include + +#define PMU_FLASH_WS (0x3U) + +void z_platform_init(void) +{ + u32_t temp; + + /* setup flash wait state */ + temp = FLASH0->FCON; + temp &= ~FLASH_FCON_WSPFLASH_Msk; + temp |= PMU_FLASH_WS; + FLASH0->FCON = temp; + + /* configure PLL & system clock */ + SystemCoreClockSetup(); +} diff --git a/soc/arm/infineon_xmc/4xxx/soc.h b/soc/arm/infineon_xmc/4xxx/soc.h new file mode 100644 index 00000000000..791821283a5 --- /dev/null +++ b/soc/arm/infineon_xmc/4xxx/soc.h @@ -0,0 +1,12 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2020 Linumiz + * Author: Parthiban Nallathambi + * + */ + +/* Add include for DTS generated information */ +#include +#include +#include diff --git a/soc/arm/infineon_xmc/CMakeLists.txt b/soc/arm/infineon_xmc/CMakeLists.txt new file mode 100644 index 00000000000..9aed50a0fd8 --- /dev/null +++ b/soc/arm/infineon_xmc/CMakeLists.txt @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: Apache-2.0 +# +# Copyright (c) 2020 Linumiz +# Author: Parthiban Nallathambi + +add_subdirectory(${SOC_SERIES}) diff --git a/soc/arm/infineon_xmc/Kconfig b/soc/arm/infineon_xmc/Kconfig new file mode 100644 index 00000000000..c63d66e344d --- /dev/null +++ b/soc/arm/infineon_xmc/Kconfig @@ -0,0 +1,22 @@ +# SPDX-License-Identifier: Apache-2.0 +# +# Copyright (c) 2020 Linumiz +# Author: Parthiban Nallathambi + +config SOC_FAMILY_XMC + bool + select HAS_SEGGER_RTT + select PLATFORM_SPECIFIC_INIT + +if SOC_FAMILY_XMC + +config SOC_FAMILY + string + default "infineon_xmc" + +source "soc/arm/infineon_xmc/*/Kconfig.soc" + +config SOC_PART_NUMBER + default SOC_PART_NUMBER_XMC_4XXX if SOC_SERIES_XMC_4XXX + +endif # SOC_FAMILY_XMC diff --git a/soc/arm/infineon_xmc/Kconfig.defconfig b/soc/arm/infineon_xmc/Kconfig.defconfig new file mode 100644 index 00000000000..4a52c97fc74 --- /dev/null +++ b/soc/arm/infineon_xmc/Kconfig.defconfig @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: Apache-2.0 +# +# Copyright (c) 2020 Linumiz +# Author: Parthiban Nallathambi + +source "soc/arm/infineon_xmc/*/Kconfig.defconfig.series" diff --git a/soc/arm/infineon_xmc/Kconfig.soc b/soc/arm/infineon_xmc/Kconfig.soc new file mode 100644 index 00000000000..05f2c3841c4 --- /dev/null +++ b/soc/arm/infineon_xmc/Kconfig.soc @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: Apache-2.0 +# +# Copyright (c) 2020 Linumiz +# Author: Parthiban Nallathambi + +source "soc/arm/infineon_xmc/*/Kconfig.series" diff --git a/west.yml b/west.yml index ef47d629479..e1133638485 100644 --- a/west.yml +++ b/west.yml @@ -52,6 +52,9 @@ manifest: - name: hal_cypress revision: a12d92816a53a521d79cefcf5c38b9dc8a4fed6e path: modules/hal/cypress + - name: hal_infineon + revision: f1fa8241f8786198ba41155413243de36ed878a5 + path: modules/hal/infineon - name: hal_nordic revision: e1168a2f3290f5ca17ec0c47efbf6c601c60108a path: modules/hal/nordic