linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] ARM: Add support for Realtek SOC
@ 2019-09-25  6:43 James Tai
  2019-09-25 13:30 ` Andreas Färber
  2019-09-25 13:31 ` Andreas Färber
  0 siblings, 2 replies; 4+ messages in thread
From: James Tai @ 2019-09-25  6:43 UTC (permalink / raw)
  To: 'Masahiro Yamada', 'Arnd Bergmann'
  Cc: 'Jason A . Donenfeld', CY_Huang[黃鉦晏],
	'Linus Walleij', 'Stefan Agner',
	'Benjamin Gaignard', Simon Hsu[徐文翰],
	'Mauro Carvalho Chehab',
	Tom Ting[丁郁庭],
	Jim Tsai [蔡維晉],
	Phinex Hung, Edward Wu[吳奕寬],
	'Rob Herring', 'Lorenzo Pieralisi',
	'Russell King', 'Mike Rapoport',
	YH_Hsieh[謝宇勳],
	TY_Chang[張子逸], 'Thierry Reding',
	'jamestai.sky@gmail.com',
	ZR_Chen[陳振榮],
	Hau, Yukuen, Jinn.Cheng[鄭才進],
	Chase Yen [顏呈育],
	Stanley Chang[昌育德], 'Doug Anderson',
	'Linux ARM', Eric Wang[王偉全],
	Adklei, James Tai, Edgar Lee [李承諭],
	'Ard Biesheuvel', PK.Chuang [莊博凱],
	'Nicolas Pitre', 'Nick Desaulniers',
	'linux-kernel@vger.kernel.org', 'Paul Burton',
	phelic, 'Andreas Färber'

From: "james.tai" <james.tai@realtek.com>

This patch adds the basic machine file for
the Realtek RTD16XX and RTD13XX platform.

Signed-off-by: james.tai <james.tai@realtek.com>
---
Changes since last version:
	- Add RTD13XX platform.
	- Add PSCI support.
	- Add ARCH_MULTI_V7 config.
	- remove 'textofs-$(CONFIG_ARCH_REALTEK) := 0x00208000' from 
	  'arch/arm/Makefile'.
	- remove map_io,init_time,init_machine and smp_init from machine
	  descriptor.
---
 arch/arm/Kconfig                |  2 ++
 arch/arm/Makefile               |  1 +
 arch/arm/mach-realtek/Kconfig   | 20 +++++++++++++
 arch/arm/mach-realtek/Makefile  |  3 ++
 arch/arm/mach-realtek/platsmp.c | 51 +++++++++++++++++++++++++++++++++
 arch/arm/mach-realtek/platsmp.h |  6 ++++
 arch/arm/mach-realtek/realtek.c | 43 +++++++++++++++++++++++++++
 7 files changed, 126 insertions(+)
 create mode 100644 arch/arm/mach-realtek/Kconfig
 create mode 100644 arch/arm/mach-realtek/Makefile
 create mode 100644 arch/arm/mach-realtek/platsmp.c
 create mode 100644 arch/arm/mach-realtek/platsmp.h
 create mode 100644 arch/arm/mach-realtek/realtek.c

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 33b00579beff..1f7967c97267 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -793,6 +793,8 @@ source "arch/arm/mach-realview/Kconfig"
 
 source "arch/arm/mach-rockchip/Kconfig"
 
+source "arch/arm/mach-realtek/Kconfig"
+
 source "arch/arm/mach-s3c24xx/Kconfig"
 
 source "arch/arm/mach-s3c64xx/Kconfig"
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index c3624ca6c0bc..560ae7d72aab 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -205,6 +205,7 @@ machine-$(CONFIG_ARCH_RDA)		+= rda
 machine-$(CONFIG_ARCH_REALVIEW)		+= realview
 machine-$(CONFIG_ARCH_ROCKCHIP)		+= rockchip
 machine-$(CONFIG_ARCH_RPC)		+= rpc
+machine-$(CONFIG_ARCH_REALTEK)		+= realtek
 machine-$(CONFIG_ARCH_S3C24XX)		+= s3c24xx
 machine-$(CONFIG_ARCH_S3C64XX)		+= s3c64xx
 machine-$(CONFIG_ARCH_S5PV210)		+= s5pv210
diff --git a/arch/arm/mach-realtek/Kconfig b/arch/arm/mach-realtek/Kconfig
new file mode 100644
index 000000000000..a638f4322bb2
--- /dev/null
+++ b/arch/arm/mach-realtek/Kconfig
@@ -0,0 +1,20 @@
+# SPDX-License-Identifier: GPL-2.0-only
+menuconfig ARCH_REALTEK
+	bool "Realtek SoC Support"
+	depends on ARCH_MULTI_V7
+	help
+	  Support for Realtek rtd16xx & rtd13xx SoCs.
+
+if ARCH_REALTEK
+
+config ARCH_RTD13XX
+	bool "Enable support for RTD1319"
+	select ARM_GIC_V3
+	select ARM_PSCI
+
+config ARCH_RTD16XX
+	bool "Enable support for RTD1619"
+	select ARM_GIC_V3
+	select ARM_PSCI
+
+endif
diff --git a/arch/arm/mach-realtek/Makefile b/arch/arm/mach-realtek/Makefile
new file mode 100644
index 000000000000..9cdc1f1f2917
--- /dev/null
+++ b/arch/arm/mach-realtek/Makefile
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
+obj-$(CONFIG_ARCH_REALTEK) += realtek.o
+obj-$(CONFIG_SMP) += platsmp.o
diff --git a/arch/arm/mach-realtek/platsmp.c b/arch/arm/mach-realtek/platsmp.c
new file mode 100644
index 000000000000..b3fc99447ad4
--- /dev/null
+++ b/arch/arm/mach-realtek/platsmp.c
@@ -0,0 +1,51 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (c) 2019 Realtek Semiconductor Corp.
+ */
+
+#include <linux/init.h>
+#include <linux/delay.h>
+#include <linux/jiffies.h>
+#include <linux/io.h>
+#include <linux/memory.h>
+#include <linux/smp.h>
+#include <linux/of.h>
+#include <linux/arm-smccc.h>
+#include <asm/smp_plat.h>
+#include <asm/cacheflush.h>
+#include <asm/cp15.h>
+#include <asm/barrier.h>
+
+#define BL31_CMD 0x8400ff04
+#define BL31_DAT 0x00001619
+#define CORE_PWRDN_EN 0x1
+
+#define CPUPWRCTLR __ACCESS_CP15(c15, 0, c2, 7)
+
+#ifdef CONFIG_HOTPLUG_CPU
+
+static void rtk_cpu_die(unsigned int cpu)
+{
+	struct arm_smccc_res res;
+	unsigned int cpu_pwr_ctrl;
+
+	/* notify BL31 cpu hotplug */
+	arm_smccc_smc(BL31_CMD, BL31_DAT, 0, 0, 0, 0, 0, 0, &res);
+	v7_exit_coherency_flush(louis);
+
+	cpu_pwr_ctrl = read_sysreg(CPUPWRCTLR);
+	cpu_pwr_ctrl |= CORE_PWRDN_EN;
+	write_sysreg(cpu_pwr_ctrl, CPUPWRCTLR);
+
+	dsb(sy);
+
+	for (;;)
+		wfi();
+}
+#endif
+
+struct smp_operations rtk_smp_ops __initdata = {
+#ifdef CONFIG_HOTPLUG_CPU
+	.cpu_die = rtk_cpu_die,
+#endif
+};
diff --git a/arch/arm/mach-realtek/platsmp.h b/arch/arm/mach-realtek/platsmp.h
new file mode 100644
index 000000000000..c9c4d712369c
--- /dev/null
+++ b/arch/arm/mach-realtek/platsmp.h
@@ -0,0 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (c) 2019 Realtek Semiconductor Corp.
+ */
+
+extern struct smp_operations rtk_smp_ops;
diff --git a/arch/arm/mach-realtek/realtek.c b/arch/arm/mach-realtek/realtek.c
new file mode 100644
index 000000000000..2692ac53f59b
--- /dev/null
+++ b/arch/arm/mach-realtek/realtek.c
@@ -0,0 +1,43 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (c) 2019 Realtek Semiconductor Corp.
+ */
+
+#include <linux/clk-provider.h>
+#include <linux/clocksource.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/irqchip.h>
+#include <linux/of_address.h>
+#include <linux/of_irq.h>
+#include <linux/of_platform.h>
+#include <linux/io.h>
+#include <linux/memblock.h>
+#include <linux/delay.h>
+#include <linux/clockchips.h>
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/system_misc.h>
+#include <asm/system_info.h>
+
+#include "platsmp.h"
+
+static const char *const rtd13xx_board_dt_compat[] = {
+	"realtek,rtd1319",
+	NULL,
+};
+
+static const char *const rtd16xx_board_dt_compat[] = {
+	"realtek,rtd1619",
+	NULL,
+};
+
+DT_MACHINE_START(RTD13XX, "Realtek rtd13xx platform")
+	.dt_compat = rtd13xx_board_dt_compat,
+	.smp = smp_ops(rtk_smp_ops),
+MACHINE_END
+
+DT_MACHINE_START(RTD16XX, "Realtek rtd16xx platform")
+	.dt_compat = rtd16xx_board_dt_compat,
+	.smp = smp_ops(rtk_smp_ops),
+MACHINE_END
-- 
2.17.1

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-09-26  9:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-25  6:43 [PATCH v1] ARM: Add support for Realtek SOC James Tai
2019-09-25 13:30 ` Andreas Färber
2019-09-26  9:21   ` James Tai
2019-09-25 13:31 ` Andreas Färber

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).