diff mbox series

[v4,09/10] ARM: sunplus: Add initial support for Sunplus SP7021 SoC

Message ID 480a3ab57b45f4483612db1211dd25d424d90ec5.1635993377.git.qinjian@cqplus1.com (mailing list archive)
State New, archived
Headers show
Series Add Sunplus SP7021 SoC Support | expand

Commit Message

Qin Jian Nov. 4, 2021, 2:57 a.m. UTC
This patch aims to add an initial support for Sunplus SP7021 SoC.

Signed-off-by: Qin Jian <qinjian@cqplus1.com>
---
 MAINTAINERS                         |  1 +
 arch/arm/Kconfig                    | 20 ++++++++++++++++++++
 arch/arm/Makefile                   |  2 ++
 arch/arm/mach-sunplus/Kconfig       | 20 ++++++++++++++++++++
 arch/arm/mach-sunplus/Makefile      |  9 +++++++++
 arch/arm/mach-sunplus/Makefile.boot |  3 +++
 arch/arm/mach-sunplus/sp7021.c      | 16 ++++++++++++++++
 7 files changed, 71 insertions(+)
 create mode 100644 arch/arm/mach-sunplus/Kconfig
 create mode 100644 arch/arm/mach-sunplus/Makefile
 create mode 100644 arch/arm/mach-sunplus/Makefile.boot
 create mode 100644 arch/arm/mach-sunplus/sp7021.c

Comments

Randy Dunlap Nov. 4, 2021, 5:09 a.m. UTC | #1
On 11/3/21 7:57 PM, Qin Jian wrote:
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index 59baf6c13..feba287eb 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -487,6 +487,24 @@ config ARCH_S3C24XX
>   	  (<http://www.simtec.co.uk/products/EB110ITX/>), the IPAQ 1940 or the
>   	  Samsung SMDK2410 development board (and derivatives).
>   
> +config ARCH_SUNPLUS
> +	bool "Sunplus SoCs"
> +	select CLKSRC_OF
> +	select COMMON_CLK
> +	select GENERIC_CLOCKEVENTS
> +	select GENERIC_IRQ_CHIP
> +	select GENERIC_IRQ_MULTI_HANDLER
> +	select SERIAL_SUNPLUS
> +	select SERIAL_SUNPLUS_CONSOLE
> +	select USE_OF
> +	select RTC_CLASS
> +	select RESET_SUNPLUS
> +	help
> +	  Support for Sunplus SoC family: SP7021 and succeed SoCs based systems,

	                                             succeeding or successsor or following
	                                                     SoC-based systems,

> +	  such as the Banana Pi BPI-F2S development board ( and derivatives).

	                                                  (and derivatives).

> +	  (<http://www.sinovoip.com.cn/ecp_view.asp?id=586>)
> +	  (<https://tibbo.com/store/plus1.html>)
Randy Dunlap Nov. 4, 2021, 5:09 a.m. UTC | #2
On 11/3/21 7:57 PM, Qin Jian wrote:
> diff --git a/arch/arm/mach-sunplus/Kconfig b/arch/arm/mach-sunplus/Kconfig
> new file mode 100644
> index 000000000..f7ad76959
> --- /dev/null
> +++ b/arch/arm/mach-sunplus/Kconfig
> @@ -0,0 +1,20 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +
> +config SOC_SP7021
> +	bool "Sunplus SP7021 SoC support"
> +	default y
> +	select CPU_V7
> +	select ARM_GIC
> +	select SUNPLUS_SP7021_INTC
> +	select HAVE_SMP
> +	select ARM_PSCI
> +	select COMMON_CLK_SP7021
> +	select PINCTRL
> +	select PINCTRL_SPPCTL
> +	select OF_OVERLAY
> +	select GPIOLIB
> +	help
> +	  Support for Sunplus SP7021 SoC. It is based on ARM 4-core
> +	  Cotex-A7 with various peripherals (ex: I2C, SPI, SDIO,

Is that   Cortex-A7
?

> +	  Ethernet and etc.), FPGA interface,  chip-to-chip bus.
> +	  It is designed for industrial control.
kernel test robot Nov. 4, 2021, 3:23 p.m. UTC | #3
Hi Qin,

I love your patch! Yet something to improve:

[auto build test ERROR on pza/reset/next]
[also build test ERROR on robh/for-next clk/clk-next v5.15]
[cannot apply to tip/irq/core linus/master next-20211104]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Qin-Jian/dt-bindings-vendor-prefixes-Add-Sunplus/20211104-115746
base:   https://git.pengutronix.de/git/pza/linux reset/next
config: arm-randconfig-c002-20211104 (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/a0450f4dfa75b60af973bceea07b1be864ae81ba
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Qin-Jian/dt-bindings-vendor-prefixes-Add-Sunplus/20211104-115746
        git checkout a0450f4dfa75b60af973bceea07b1be864ae81ba
        # save the attached .config to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arm SHELL=/bin/bash arch/arm/kernel/ arch/arm/mm/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   arch/arm/kernel/setup.c: In function 'early_print':
   arch/arm/kernel/setup.c:372:9: warning: function 'early_print' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
     372 |         vsnprintf(buf, sizeof(buf), str, ap);
         |         ^~~~~~~~~
   In file included from arch/arm/kernel/setup.c:36:
   arch/arm/kernel/setup.c: In function 'cpuid_init_hwcaps':
>> arch/arm/include/asm/cputype.h:22:25: error: expected ':' or ')' before numeric constant
      22 | #define CPUID_EXT_ISAR0 0x60
         |                         ^~~~
   arch/arm/include/asm/cputype.h:135:51: note: in definition of macro 'read_cpuid_ext'
     135 |                 asm("mrc        p15, 0, %0, c0, " ext_reg               \
         |                                                   ^~~~~~~
   arch/arm/kernel/setup.c:457:17: note: in expansion of macro 'cpuid_feature_extract'
     457 |         block = cpuid_feature_extract(CPUID_EXT_ISAR0, 24);
         |                 ^~~~~~~~~~~~~~~~~~~~~
   arch/arm/kernel/setup.c:457:39: note: in expansion of macro 'CPUID_EXT_ISAR0'
     457 |         block = cpuid_feature_extract(CPUID_EXT_ISAR0, 24);
         |                                       ^~~~~~~~~~~~~~~
   arch/arm/include/asm/cputype.h:18:25: error: expected ':' or ')' before numeric constant
      18 | #define CPUID_EXT_MMFR0 0x50
         |                         ^~~~
   arch/arm/include/asm/cputype.h:135:51: note: in definition of macro 'read_cpuid_ext'
     135 |                 asm("mrc        p15, 0, %0, c0, " ext_reg               \
         |                                                   ^~~~~~~
   arch/arm/kernel/setup.c:464:17: note: in expansion of macro 'cpuid_feature_extract'
     464 |         block = cpuid_feature_extract(CPUID_EXT_MMFR0, 0);
         |                 ^~~~~~~~~~~~~~~~~~~~~
   arch/arm/kernel/setup.c:464:39: note: in expansion of macro 'CPUID_EXT_MMFR0'
     464 |         block = cpuid_feature_extract(CPUID_EXT_MMFR0, 0);
         |                                       ^~~~~~~~~~~~~~~
   arch/arm/include/asm/cputype.h:27:25: error: expected ':' or ')' before numeric constant
      27 | #define CPUID_EXT_ISAR5 0x74
         |                         ^~~~
   arch/arm/include/asm/cputype.h:135:51: note: in definition of macro 'read_cpuid_ext'
     135 |                 asm("mrc        p15, 0, %0, c0, " ext_reg               \
         |                                                   ^~~~~~~
   arch/arm/kernel/setup.c:469:32: note: in expansion of macro 'CPUID_EXT_ISAR5'
     469 |         isar5 = read_cpuid_ext(CPUID_EXT_ISAR5);
         |                                ^~~~~~~~~~~~~~~
   arch/arm/kernel/setup.c: In function 'elf_hwcap_fixup':
   arch/arm/include/asm/cputype.h:25:25: error: expected ':' or ')' before numeric constant
      25 | #define CPUID_EXT_ISAR3 0x6c
         |                         ^~~~
   arch/arm/include/asm/cputype.h:135:51: note: in definition of macro 'read_cpuid_ext'
     135 |                 asm("mrc        p15, 0, %0, c0, " ext_reg               \
         |                                                   ^~~~~~~
   arch/arm/kernel/setup.c:513:13: note: in expansion of macro 'cpuid_feature_extract'
     513 |         if (cpuid_feature_extract(CPUID_EXT_ISAR3, 12) > 1 ||
         |             ^~~~~~~~~~~~~~~~~~~~~
   arch/arm/kernel/setup.c:513:35: note: in expansion of macro 'CPUID_EXT_ISAR3'
     513 |         if (cpuid_feature_extract(CPUID_EXT_ISAR3, 12) > 1 ||
         |                                   ^~~~~~~~~~~~~~~
   arch/arm/include/asm/cputype.h:25:25: error: expected ':' or ')' before numeric constant
      25 | #define CPUID_EXT_ISAR3 0x6c
         |                         ^~~~
   arch/arm/include/asm/cputype.h:135:51: note: in definition of macro 'read_cpuid_ext'
     135 |                 asm("mrc        p15, 0, %0, c0, " ext_reg               \
         |                                                   ^~~~~~~
   arch/arm/kernel/setup.c:514:14: note: in expansion of macro 'cpuid_feature_extract'
     514 |             (cpuid_feature_extract(CPUID_EXT_ISAR3, 12) == 1 &&
         |              ^~~~~~~~~~~~~~~~~~~~~
   arch/arm/kernel/setup.c:514:36: note: in expansion of macro 'CPUID_EXT_ISAR3'
     514 |             (cpuid_feature_extract(CPUID_EXT_ISAR3, 12) == 1 &&
         |                                    ^~~~~~~~~~~~~~~
   arch/arm/include/asm/cputype.h:26:25: error: expected ':' or ')' before numeric constant
      26 | #define CPUID_EXT_ISAR4 0x70
         |                         ^~~~
   arch/arm/include/asm/cputype.h:135:51: note: in definition of macro 'read_cpuid_ext'
     135 |                 asm("mrc        p15, 0, %0, c0, " ext_reg               \
         |                                                   ^~~~~~~
   arch/arm/kernel/setup.c:515:14: note: in expansion of macro 'cpuid_feature_extract'
     515 |              cpuid_feature_extract(CPUID_EXT_ISAR4, 20) >= 3))
         |              ^~~~~~~~~~~~~~~~~~~~~
   arch/arm/kernel/setup.c:515:36: note: in expansion of macro 'CPUID_EXT_ISAR4'
     515 |              cpuid_feature_extract(CPUID_EXT_ISAR4, 20) >= 3))
         |                                    ^~~~~~~~~~~~~~~
   In file included from arch/arm/include/asm/efi.h:12,
                    from arch/arm/kernel/setup.c:37:
   At top level:
   arch/arm/include/asm/fixmap.h:39:35: warning: '__end_of_fixed_addresses' defined but not used [-Wunused-const-variable=]
      39 | static const enum fixed_addresses __end_of_fixed_addresses =
         |                                   ^~~~~~~~~~~~~~~~~~~~~~~~
--
   arch/arm/mm/pmsa-v8.c: In function 'prlar_read':
>> arch/arm/mm/pmsa-v8.c:53:16: error: implicit declaration of function 'readl_relaxed' [-Werror=implicit-function-declaration]
      53 |         return readl_relaxed(BASEADDR_V7M_SCB + PMSAv8_RLAR);
         |                ^~~~~~~~~~~~~
>> arch/arm/mm/pmsa-v8.c:53:30: error: 'BASEADDR_V7M_SCB' undeclared (first use in this function)
      53 |         return readl_relaxed(BASEADDR_V7M_SCB + PMSAv8_RLAR);
         |                              ^~~~~~~~~~~~~~~~
   arch/arm/mm/pmsa-v8.c:53:30: note: each undeclared identifier is reported only once for each function it appears in
>> arch/arm/mm/pmsa-v8.c:53:49: error: 'PMSAv8_RLAR' undeclared (first use in this function); did you mean 'PMSAv8_MAIR'?
      53 |         return readl_relaxed(BASEADDR_V7M_SCB + PMSAv8_RLAR);
         |                                                 ^~~~~~~~~~~
         |                                                 PMSAv8_MAIR
   arch/arm/mm/pmsa-v8.c: In function 'prbar_read':
   arch/arm/mm/pmsa-v8.c:58:30: error: 'BASEADDR_V7M_SCB' undeclared (first use in this function)
      58 |         return readl_relaxed(BASEADDR_V7M_SCB + PMSAv8_RBAR);
         |                              ^~~~~~~~~~~~~~~~
>> arch/arm/mm/pmsa-v8.c:58:49: error: 'PMSAv8_RBAR' undeclared (first use in this function); did you mean 'PMSAv8_MAIR'?
      58 |         return readl_relaxed(BASEADDR_V7M_SCB + PMSAv8_RBAR);
         |                                                 ^~~~~~~~~~~
         |                                                 PMSAv8_MAIR
   arch/arm/mm/pmsa-v8.c: In function 'prsel_write':
>> arch/arm/mm/pmsa-v8.c:63:9: error: implicit declaration of function 'writel_relaxed' [-Werror=implicit-function-declaration]
      63 |         writel_relaxed(v, BASEADDR_V7M_SCB + PMSAv8_RNR);
         |         ^~~~~~~~~~~~~~
   arch/arm/mm/pmsa-v8.c:63:27: error: 'BASEADDR_V7M_SCB' undeclared (first use in this function)
      63 |         writel_relaxed(v, BASEADDR_V7M_SCB + PMSAv8_RNR);
         |                           ^~~~~~~~~~~~~~~~
>> arch/arm/mm/pmsa-v8.c:63:46: error: 'PMSAv8_RNR' undeclared (first use in this function); did you mean 'PMSAv8_MAIR'?
      63 |         writel_relaxed(v, BASEADDR_V7M_SCB + PMSAv8_RNR);
         |                                              ^~~~~~~~~~
         |                                              PMSAv8_MAIR
   arch/arm/mm/pmsa-v8.c: In function 'prbar_write':
   arch/arm/mm/pmsa-v8.c:68:27: error: 'BASEADDR_V7M_SCB' undeclared (first use in this function)
      68 |         writel_relaxed(v, BASEADDR_V7M_SCB + PMSAv8_RBAR);
         |                           ^~~~~~~~~~~~~~~~
   arch/arm/mm/pmsa-v8.c:68:46: error: 'PMSAv8_RBAR' undeclared (first use in this function); did you mean 'PMSAv8_MAIR'?
      68 |         writel_relaxed(v, BASEADDR_V7M_SCB + PMSAv8_RBAR);
         |                                              ^~~~~~~~~~~
         |                                              PMSAv8_MAIR
   arch/arm/mm/pmsa-v8.c: In function 'prlar_write':
   arch/arm/mm/pmsa-v8.c:73:27: error: 'BASEADDR_V7M_SCB' undeclared (first use in this function)
      73 |         writel_relaxed(v, BASEADDR_V7M_SCB + PMSAv8_RLAR);
         |                           ^~~~~~~~~~~~~~~~
   arch/arm/mm/pmsa-v8.c:73:46: error: 'PMSAv8_RLAR' undeclared (first use in this function); did you mean 'PMSAv8_MAIR'?
      73 |         writel_relaxed(v, BASEADDR_V7M_SCB + PMSAv8_RLAR);
         |                                              ^~~~~~~~~~~
         |                                              PMSAv8_MAIR
   arch/arm/mm/pmsa-v8.c: In function 'prbar_read':
   arch/arm/mm/pmsa-v8.c:59:1: error: control reaches end of non-void function [-Werror=return-type]
      59 | }
         | ^
   arch/arm/mm/pmsa-v8.c: In function 'prlar_read':
   arch/arm/mm/pmsa-v8.c:54:1: error: control reaches end of non-void function [-Werror=return-type]
      54 | }
         | ^
   cc1: some warnings being treated as errors


vim +22 arch/arm/include/asm/cputype.h

0ba8b9b273c45d Russell King     2008-08-10  12  
6fae9cdafc92ae Uwe Kleine-König 2013-05-06  13  #ifdef CONFIG_CPU_V7M
6fae9cdafc92ae Uwe Kleine-König 2013-05-06  14  #define CPUID_EXT_PFR0	0x40
6fae9cdafc92ae Uwe Kleine-König 2013-05-06  15  #define CPUID_EXT_PFR1	0x44
6fae9cdafc92ae Uwe Kleine-König 2013-05-06  16  #define CPUID_EXT_DFR0	0x48
6fae9cdafc92ae Uwe Kleine-König 2013-05-06  17  #define CPUID_EXT_AFR0	0x4c
6fae9cdafc92ae Uwe Kleine-König 2013-05-06  18  #define CPUID_EXT_MMFR0	0x50
6fae9cdafc92ae Uwe Kleine-König 2013-05-06  19  #define CPUID_EXT_MMFR1	0x54
6fae9cdafc92ae Uwe Kleine-König 2013-05-06  20  #define CPUID_EXT_MMFR2	0x58
6fae9cdafc92ae Uwe Kleine-König 2013-05-06  21  #define CPUID_EXT_MMFR3	0x5c
6fae9cdafc92ae Uwe Kleine-König 2013-05-06 @22  #define CPUID_EXT_ISAR0	0x60
6fae9cdafc92ae Uwe Kleine-König 2013-05-06  23  #define CPUID_EXT_ISAR1	0x64
6fae9cdafc92ae Uwe Kleine-König 2013-05-06  24  #define CPUID_EXT_ISAR2	0x68
6fae9cdafc92ae Uwe Kleine-König 2013-05-06  25  #define CPUID_EXT_ISAR3	0x6c
6fae9cdafc92ae Uwe Kleine-König 2013-05-06  26  #define CPUID_EXT_ISAR4	0x70
6fae9cdafc92ae Uwe Kleine-König 2013-05-06  27  #define CPUID_EXT_ISAR5	0x74
6fae9cdafc92ae Uwe Kleine-König 2013-05-06  28  #else
faa7bc51c11d5b Catalin Marinas  2009-05-30  29  #define CPUID_EXT_PFR0	"c1, 0"
faa7bc51c11d5b Catalin Marinas  2009-05-30  30  #define CPUID_EXT_PFR1	"c1, 1"
faa7bc51c11d5b Catalin Marinas  2009-05-30  31  #define CPUID_EXT_DFR0	"c1, 2"
faa7bc51c11d5b Catalin Marinas  2009-05-30  32  #define CPUID_EXT_AFR0	"c1, 3"
faa7bc51c11d5b Catalin Marinas  2009-05-30  33  #define CPUID_EXT_MMFR0	"c1, 4"
faa7bc51c11d5b Catalin Marinas  2009-05-30  34  #define CPUID_EXT_MMFR1	"c1, 5"
faa7bc51c11d5b Catalin Marinas  2009-05-30  35  #define CPUID_EXT_MMFR2	"c1, 6"
faa7bc51c11d5b Catalin Marinas  2009-05-30  36  #define CPUID_EXT_MMFR3	"c1, 7"
faa7bc51c11d5b Catalin Marinas  2009-05-30  37  #define CPUID_EXT_ISAR0	"c2, 0"
faa7bc51c11d5b Catalin Marinas  2009-05-30  38  #define CPUID_EXT_ISAR1	"c2, 1"
faa7bc51c11d5b Catalin Marinas  2009-05-30  39  #define CPUID_EXT_ISAR2	"c2, 2"
faa7bc51c11d5b Catalin Marinas  2009-05-30  40  #define CPUID_EXT_ISAR3	"c2, 3"
faa7bc51c11d5b Catalin Marinas  2009-05-30  41  #define CPUID_EXT_ISAR4	"c2, 4"
faa7bc51c11d5b Catalin Marinas  2009-05-30  42  #define CPUID_EXT_ISAR5	"c2, 5"
6fae9cdafc92ae Uwe Kleine-König 2013-05-06  43  #endif
faa7bc51c11d5b Catalin Marinas  2009-05-30  44  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff mbox series

Patch

diff --git a/MAINTAINERS b/MAINTAINERS
index febbd97bf..0ae537a41 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2664,6 +2664,7 @@  F:	Documentation/devicetree/bindings/arm/sunplus,sp7021.yaml
 F:	Documentation/devicetree/bindings/clock/sunplus,sp7021-clkc.yaml
 F:	Documentation/devicetree/bindings/interrupt-controller/sunplus,sp7021-intc.yaml
 F:	Documentation/devicetree/bindings/reset/sunplus,reset.yaml
+F:	arch/arm/mach-sunplus/
 F:	drivers/clk/clk-sp7021.c
 F:	drivers/irqchip/irq-sp7021-intc.c
 F:	drivers/reset/reset-sunplus.c
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 59baf6c13..feba287eb 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -487,6 +487,24 @@  config ARCH_S3C24XX
 	  (<http://www.simtec.co.uk/products/EB110ITX/>), the IPAQ 1940 or the
 	  Samsung SMDK2410 development board (and derivatives).
 
+config ARCH_SUNPLUS
+	bool "Sunplus SoCs"
+	select CLKSRC_OF
+	select COMMON_CLK
+	select GENERIC_CLOCKEVENTS
+	select GENERIC_IRQ_CHIP
+	select GENERIC_IRQ_MULTI_HANDLER
+	select SERIAL_SUNPLUS
+	select SERIAL_SUNPLUS_CONSOLE
+	select USE_OF
+	select RTC_CLASS
+	select RESET_SUNPLUS
+	help
+	  Support for Sunplus SoC family: SP7021 and succeed SoCs based systems,
+	  such as the Banana Pi BPI-F2S development board ( and derivatives).
+	  (<http://www.sinovoip.com.cn/ecp_view.asp?id=586>)
+	  (<https://tibbo.com/store/plus1.html>)
+
 config ARCH_OMAP1
 	bool "TI OMAP1"
 	depends on MMU
@@ -689,6 +707,8 @@  source "arch/arm/mach-sti/Kconfig"
 
 source "arch/arm/mach-stm32/Kconfig"
 
+source "arch/arm/mach-sunplus/Kconfig"
+
 source "arch/arm/mach-sunxi/Kconfig"
 
 source "arch/arm/mach-tegra/Kconfig"
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 847c31e7c..cac95a950 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -152,6 +152,7 @@  textofs-$(CONFIG_ARCH_MSM8X60) := 0x00208000
 textofs-$(CONFIG_ARCH_MSM8960) := 0x00208000
 textofs-$(CONFIG_ARCH_MESON) := 0x00208000
 textofs-$(CONFIG_ARCH_AXXIA) := 0x00308000
+textofs-$(CONFIG_ARCH_SUNPLUS) := 0x00308000
 
 # Machine directory name.  This list is sorted alphanumerically
 # by CONFIG_* macro name.
@@ -212,6 +213,7 @@  machine-$(CONFIG_ARCH_RENESAS)	 	+= shmobile
 machine-$(CONFIG_ARCH_INTEL_SOCFPGA)	+= socfpga
 machine-$(CONFIG_ARCH_STI)		+= sti
 machine-$(CONFIG_ARCH_STM32)		+= stm32
+machine-$(CONFIG_ARCH_SUNPLUS)		+= sunplus
 machine-$(CONFIG_ARCH_SUNXI)		+= sunxi
 machine-$(CONFIG_ARCH_TEGRA)		+= tegra
 machine-$(CONFIG_ARCH_U8500)		+= ux500
diff --git a/arch/arm/mach-sunplus/Kconfig b/arch/arm/mach-sunplus/Kconfig
new file mode 100644
index 000000000..f7ad76959
--- /dev/null
+++ b/arch/arm/mach-sunplus/Kconfig
@@ -0,0 +1,20 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+
+config SOC_SP7021
+	bool "Sunplus SP7021 SoC support"
+	default y
+	select CPU_V7
+	select ARM_GIC
+	select SUNPLUS_SP7021_INTC
+	select HAVE_SMP
+	select ARM_PSCI
+	select COMMON_CLK_SP7021
+	select PINCTRL
+	select PINCTRL_SPPCTL
+	select OF_OVERLAY
+	select GPIOLIB
+	help
+	  Support for Sunplus SP7021 SoC. It is based on ARM 4-core
+	  Cotex-A7 with various peripherals (ex: I2C, SPI, SDIO,
+	  Ethernet and etc.), FPGA interface,  chip-to-chip bus.
+	  It is designed for industrial control.
diff --git a/arch/arm/mach-sunplus/Makefile b/arch/arm/mach-sunplus/Makefile
new file mode 100644
index 000000000..c902580a7
--- /dev/null
+++ b/arch/arm/mach-sunplus/Makefile
@@ -0,0 +1,9 @@ 
+# SPDX-License-Identifier: GPL-2.0
+#
+# Makefile for the linux kernel.
+#
+
+# Object file lists.
+
+obj-$(CONFIG_SOC_SP7021)	+= sp7021.o
+
diff --git a/arch/arm/mach-sunplus/Makefile.boot b/arch/arm/mach-sunplus/Makefile.boot
new file mode 100644
index 000000000..401c30840
--- /dev/null
+++ b/arch/arm/mach-sunplus/Makefile.boot
@@ -0,0 +1,3 @@ 
+# SPDX-License-Identifier: GPL-2.0
+
+zreladdr-$(CONFIG_ARCH_SUNPLUS) := 0x00308000
diff --git a/arch/arm/mach-sunplus/sp7021.c b/arch/arm/mach-sunplus/sp7021.c
new file mode 100644
index 000000000..774d0a5bd
--- /dev/null
+++ b/arch/arm/mach-sunplus/sp7021.c
@@ -0,0 +1,16 @@ 
+// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+/*
+ * Copyright (C) Sunplus Technology Co., Ltd.
+ *       All rights reserved.
+ */
+#include <linux/kernel.h>
+#include <asm/mach/arch.h>
+
+static const char *sp7021_compat[] __initconst = {
+	"sunplus,sp7021",
+	NULL
+};
+
+DT_MACHINE_START(SP7021_DT, "SP7021")
+	.dt_compat	= sp7021_compat,
+MACHINE_END