Skip to contentSkip to conversation

ARM: Add support for Realtek SOC

PATCH In review [email protected] 4 participants 7 messages Sep 5, 2019 – Sep 23, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: Add support for Realtek SOC

From: "james.tai" <[email protected]>

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

---
 arch/arm/Kconfig                |  2 +
 arch/arm/Makefile               |  2 +
 arch/arm/mach-realtek/Kconfig   | 32 ++++++++++++
 arch/arm/mach-realtek/Makefile  |  3 ++
 arch/arm/mach-realtek/platsmp.c | 91 +++++++++++++++++++++++++++++++++
 arch/arm/mach-realtek/platsmp.h |  7 +++
 arch/arm/mach-realtek/realtek.c | 78 ++++++++++++++++++++++++++++
 7 files changed, 215 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
arch/arm/Kconfig +2 -0
index 33b00579beff..c7c9a3662eb7 100644
@@ -836,6 +836,8 @@ source "arch/arm/mach-zx/Kconfig"
 
 source "arch/arm/mach-zynq/Kconfig"
 
+source "arch/arm/mach-realtek/Kconfig"
+
 # ARMv7-M architecture
 config ARCH_EFM32
 	bool "Energy Micro efm32"
arch/arm/Makefile +2 -0
index c3624ca6c0bc..1f0926449d47 100644
@@ -148,6 +148,7 @@ endif
 textofs-$(CONFIG_ARCH_MSM8X60) := 0x00208000
 textofs-$(CONFIG_ARCH_MSM8960) := 0x00208000
 textofs-$(CONFIG_ARCH_MESON) := 0x00208000
+textofs-$(CONFIG_ARCH_REALTEK) := 0x00208000
 textofs-$(CONFIG_ARCH_AXXIA) := 0x00308000
 
 # Machine directory name.  This list is sorted alphanumerically
@@ -225,6 +226,7 @@ machine-$(CONFIG_ARCH_VT8500)		+= vt8500
 machine-$(CONFIG_ARCH_W90X900)		+= w90x900
 machine-$(CONFIG_ARCH_ZX)		+= zx
 machine-$(CONFIG_ARCH_ZYNQ)		+= zynq
+machine-$(CONFIG_ARCH_REALTEK)		+= realtek
 machine-$(CONFIG_PLAT_SPEAR)		+= spear
 
 # Platform directory name.  This list is sorted alphanumerically
arch/arm/mach-realtek/Kconfig new file +32 -0
new file mode 100644
index 000000000000..a8269964dbdb
@@ -0,0 +1,32 @@
+# SPDX-License-Identifier: GPL-2.0-only
+menuconfig ARCH_REALTEK
+	bool "Realtek SoCs"
+	select ARM_GLOBAL_TIMER
+	select CLKDEV_LOOKUP
+	select HAVE_SMP
+	select HAVE_MACH_CLKDEV
+	select GENERIC_CLOCKEVENTS
+	select HAVE_SCHED_CLOCK
+	select ARCH_HAS_CPUFREQ
+	select CLKSRC_OF
+	select ARCH_REQUIRE_GPIOLIB
+	select GENERIC_IRQ_CHIP
+	select IRQ_DOMAIN
+	select PINCTRL
+	select COMMON_CLK
+	select ARCH_HAS_BARRIERS
+	select SPARSE_IRQ
+	select PM_OPP
+	select ARM_HAS_SG_CHAIN
+	select ARM_PATCH_PHYS_VIRT
+	select AUTO_ZRELADDR
+	select MIGHT_HAVE_PCI
+	select MULTI_IRQ_HANDLER
+	select PCI_DOMAINS if PCI
+	select USE_OF
+
+config ARCH_RTD16XX
+	bool "Enable support for RTD1619"
+	depends on ARCH_REALTEK
+	select ARM_GIC_V3
+	select ARM_PSCI
arch/arm/mach-realtek/Makefile new file +3 -0
new file mode 100644
index 000000000000..9cdc1f1f2917
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
+obj-$(CONFIG_ARCH_REALTEK) += realtek.o
+obj-$(CONFIG_SMP) += platsmp.o
arch/arm/mach-realtek/platsmp.c new file +91 -0

91 lines not on this page · raw message

arch/arm/mach-realtek/platsmp.h new file +7 -0
new file mode 100644
index 000000000000..9c411d097c14
@@ -0,0 +1,7 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+/*
+ * Copyright (c) 2019 Realtek Semiconductor Corp.
+ */
+
+extern struct smp_operations rtk_smp_ops;
arch/arm/mach-realtek/realtek.c new file +78 -0

78 lines not on this page · raw message

Signature · 1 line
2.17.1
#1 lore raw
Quoted 7 lines · On Thu, Sep 5, 2019 at 7:48 AM <[email protected]> wrote:

From: "james.tai" <[email protected]>

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

Hi James,

Thanks a lot for your submission! I'm glad to see interest in upstream support for this SoC family. I have a few small comments on details, mostly where I would either like to see an explanation in the patch description, or things that looks like they can be left out from the patch.

Quoted 11 lines

index 33b00579beff..c7c9a3662eb7 100644

arch/arm/Kconfig +2 -0
@@ -836,6 +836,8 @@ source "arch/arm/mach-zx/Kconfig"
 
 source "arch/arm/mach-zynq/Kconfig"
 
+source "arch/arm/mach-realtek/Kconfig"
+

arch/arm/mach-realtek/Kconfig machine-$(CONFIG_ARCH_VT8500) += vt8500 · line 232

Quoted 7 lines
arch/arm/mach-realtek/Kconfig +1 -0
@@ -225,6 +226,7 @@ machine-$(CONFIG_ARCH_VT8500)               += vt8500
 machine-$(CONFIG_ARCH_W90X900)         += w90x900
 machine-$(CONFIG_ARCH_ZX)              += zx
 machine-$(CONFIG_ARCH_ZYNQ)            += zynq
+machine-$(CONFIG_ARCH_REALTEK)         += realtek
 machine-$(CONFIG_PLAT_SPEAR)           += spear
 
 # Platform directory name.  This list is sorted alphanumerically

Please keep these lists in alphabetical order.

arch/arm/Makefile endif · line 152

Quoted 13 lines

# ARMv7-M architecture
config ARCH_EFM32
bool "Energy Micro efm32"

arch/arm/Makefile +1 -0
index c3624ca6c0bc..1f0926449d47 100644
@@ -148,6 +148,7 @@ endif
 textofs-$(CONFIG_ARCH_MSM8X60) := 0x00208000
 textofs-$(CONFIG_ARCH_MSM8960) := 0x00208000
 textofs-$(CONFIG_ARCH_MESON) := 0x00208000
+textofs-$(CONFIG_ARCH_REALTEK) := 0x00208000
 textofs-$(CONFIG_ARCH_AXXIA) := 0x00308000

Can you explain why this is needed for your platform?

arch/arm/mach-realtek/Kconfig line 3

Quoted 9 lines
arch/arm/Makefile +0 -0
 # Machine directory name.  This list is sorted alphanumerically

new file mode 100644
index 000000000000..a8269964dbdb

arch/arm/mach-realtek/Kconfig new file +3 -0
@@ -0,0 +1,32 @@
+# SPDX-License-Identifier: GPL-2.0-only
+menuconfig ARCH_REALTEK
+       bool "Realtek SoCs"

Please add "depends on ARCH_MULTI_V7" to avoid compile time issues when selecting it on an earlier architecture.

Quoted 13 lines
arch/arm/mach-realtek/Kconfig new file +13 -0
+       select ARM_GLOBAL_TIMER
+       select CLKDEV_LOOKUP
+       select HAVE_SMP
+       select HAVE_MACH_CLKDEV
+       select GENERIC_CLOCKEVENTS
+       select HAVE_SCHED_CLOCK
+       select ARCH_HAS_CPUFREQ
+       select CLKSRC_OF
+       select ARCH_REQUIRE_GPIOLIB
+       select GENERIC_IRQ_CHIP
+       select IRQ_DOMAIN
+       select PINCTRL
+       select COMMON_CLK

arch/arm/mach-realtek/Kconfig line 26

Quoted 10 lines
arch/arm/mach-realtek/Kconfig new file +10 -0
+       select ARCH_HAS_BARRIERS
+       select SPARSE_IRQ
+       select PM_OPP
+       select ARM_HAS_SG_CHAIN
+       select ARM_PATCH_PHYS_VIRT
+       select AUTO_ZRELADDR
+       select MIGHT_HAVE_PCI
+       select MULTI_IRQ_HANDLER
+       select PCI_DOMAINS if PCI
+       select USE_OF

Almost all of the symbols above are implied by
ARCH_MULTI_V7 and should not be selected
separately.

arch/arm/mach-realtek/Kconfig line 32

Quoted 5 lines
arch/arm/mach-realtek/Kconfig new file +5 -0
+config ARCH_RTD16XX
+       bool "Enable support for RTD1619"
+       depends on ARCH_REALTEK
+       select ARM_GIC_V3
+       select ARM_PSCI

As I understand, this chip uses a Cortex-A55. What is the reason for adding support only to the 32-bit ARM architecture rather than 64-bit?

Most 64-bit SoCs are only supported with arch/arm64, but generally speaking that is not a requirement. My rule of thumb is that on systems with 1GB of RAM or more, one would want to run a 64-bit kernel, while systems with less than that are better off with a 32-bit one, but that is clearly not the only reason for picking one over the other.

arch/arm/mach-realtek/Kconfig

Quoted 11 lines
arch/arm/mach-realtek/Kconfig new file +11 -0
+
+static int rtk_boot_secondary(unsigned int cpu, struct task_struct *idle)
+{
+       unsigned long entry_pa = __pa_symbol(secondary_startup);
+
+       writel_relaxed(entry_pa | (cpu << CPUID), cpu_release_virt);
+
+       arch_send_wakeup_ipi_mask(cpumask_of(cpu));
+
+       return 0;
+}

It's very unusual to see custom smp operations on an ARMv8 system, as we normally use PSCI here. Can you explain what is going on here? Are you able to use a boot wrapper that implements these in psci instead?

Quoted 5 lines
arch/arm/mach-realtek/Kconfig new file +5 -0
+
+#include "platsmp.h"
+
+#define RBUS_BASE_PHYS (0x98000000)
+#define RBUS_BASE_VIRT (0xfe000000)

arch/arm/mach-realtek/Kconfig

Quoted 10 lines
arch/arm/mach-realtek/Kconfig new file +10 -0
+#define RBUS_BASE_SIZE (0x00100000)
+
+static struct map_desc rtk_io_desc[] __initdata = {
+       {
+               .virtual = (unsigned long) IOMEM(RBUS_BASE_VIRT),
+               .pfn = __phys_to_pfn(RBUS_BASE_PHYS),
+               .length = RBUS_BASE_SIZE,
+               .type = MT_DEVICE,
+       },
+};

This needs a comment: Why do you require a static mapping for "RBUS_BASE_PHYS"? Normally device drivers should just use ioremap() for mapping whichever registers they want to access.

arch/arm/mach-realtek/Kconfig

Quoted 4 lines
arch/arm/mach-realtek/Kconfig new file +4 -0
+static void __init rtk_dt_init(void)
+{
+       of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+}

This should be taken care of by the of_platform_default_populate_init() and can be dropped.

arch/arm/mach-realtek/Kconfig

Quoted 5 lines
arch/arm/mach-realtek/Kconfig new file +5 -0
+static void __init rtk_timer_init(void)
+{
+#ifdef CONFIG_COMMON_CLK
+       of_clk_init(NULL);
+#endif

COMMON_CLK is implied by ARCH_MULTI_V7, so the
#ifdef can be dropped.

arch/arm/mach-realtek/Kconfig

Quoted 3 lines
arch/arm/mach-realtek/Kconfig new file +3 -0
+       timer_probe();
+       tick_setup_hrtimer_broadcast();
+}

What do you need tick_setup_hrtimer_broadcast() for? I don't see any other platform calling this.

arch/arm/mach-realtek/Kconfig

Quoted 6 lines
arch/arm/mach-realtek/Kconfig new file +6 -0
+bool __init rtk_smp_init_ops(void)
+{
+       smp_set_ops(smp_ops(rtk_smp_ops));
+
+       return true;
+}

I think this can also be dropped, as you set the smp_ops in the machine descriptor.

Arnd

#2 lore raw
Quoted 9 lines

Subject: Re: [PATCH] ARM: Add support for Realtek SOC

Quoted 6 lines · On Thu, Sep 5, 2019 at 7:48 AM <[email protected]> wrote:

From: "james.tai" <[email protected]>

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

Quoted 9 lines
Quoted 1 line

Hi James,

Thanks a lot for your submission! I'm glad to see interest in upstream support for this SoC family. I have a few small comments on details, mostly where I would either like to see an explanation in the patch description, or things that looks like they can be left out from the patch.

Thanks for your reply.

Quoted 19 lines

Review

Quoted 10 lines

index 33b00579beff..c7c9a3662eb7 100644

arch/arm/Kconfig +2 -0
@@ -836,6 +836,8 @@ source "arch/arm/mach-zx/Kconfig"
 
 source "arch/arm/mach-zynq/Kconfig"
 
+source "arch/arm/mach-realtek/Kconfig"
+
(quoted diff) +0 -0

b/arch/arm/mach-realtek/Kconfig

Review machine-$(CONFIG_ARCH_VT8500)

Quoted 1 line
(quoted diff) +0 -0
@@ -225,6 +226,7 @@ machine-$(CONFIG_ARCH_VT8500)
+= vt8500
>  machine-$(CONFIG_ARCH_W90X900)         += w90x900
>  machine-$(CONFIG_ARCH_ZX)              += zx
>  machine-$(CONFIG_ARCH_ZYNQ)            += zynq
> +machine-$(CONFIG_ARCH_REALTEK)         += realtek
>  machine-$(CONFIG_PLAT_SPEAR)           += spear
Quoted 1 line
Quoted 4 lines
Quoted 1 line

# Platform directory name. This list is sorted alphanumerically

Please keep these lists in alphabetical order.

I will keep these lists in alphabetical order in new version patch.

Quoted 7 lines
Quoted 7 lines

# ARMv7-M architecture
config ARCH_EFM32
bool "Energy Micro efm32"

arch/arm/Makefile index renamed from arch/arm/Makefile +0 -0

c3624ca6c0bc..1f0926449d47 100644

arch/arm/Makefile +0 -0
Quoted 9 lines

arch/arm/Makefile endif · line 152

Quoted 6 lines
arch/arm/Makefile +1 -0
@@ -148,6 +148,7 @@ endif
 textofs-$(CONFIG_ARCH_MSM8X60) := 0x00208000
 textofs-$(CONFIG_ARCH_MSM8960) := 0x00208000
 textofs-$(CONFIG_ARCH_MESON) := 0x00208000
+textofs-$(CONFIG_ARCH_REALTEK) := 0x00208000
 textofs-$(CONFIG_ARCH_AXXIA) := 0x00308000

Can you explain why this is needed for your platform?

We need to reserve memory (0x00000000 ~ 0x001B0000) for rom and boot code.

Quoted 11 lines

arch/arm/mach-realtek/Kconfig line 2

Quoted 7 lines
arch/arm/Makefile +0 -0
 # Machine directory name.  This list is sorted alphanumerically new

file mode 100644 index 000000000000..a8269964dbdb

arch/arm/mach-realtek/Kconfig new file +2 -0
@@ -0,0 +1,32 @@
+# SPDX-License-Identifier: GPL-2.0-only menuconfig ARCH_REALTEK
+       bool "Realtek SoCs"

Please add "depends on ARCH_MULTI_V7" to avoid compile time issues when selecting it on an earlier architecture.

I will add "depends on ARCH_MULTI_V7" in new version patch.

Quoted 24 lines
Quoted 13 lines
arch/arm/mach-realtek/Kconfig new file +13 -0
+       select ARM_GLOBAL_TIMER
+       select CLKDEV_LOOKUP
+       select HAVE_SMP
+       select HAVE_MACH_CLKDEV
+       select GENERIC_CLOCKEVENTS
+       select HAVE_SCHED_CLOCK
+       select ARCH_HAS_CPUFREQ
+       select CLKSRC_OF
+       select ARCH_REQUIRE_GPIOLIB
+       select GENERIC_IRQ_CHIP
+       select IRQ_DOMAIN
+       select PINCTRL
+       select COMMON_CLK

arch/arm/mach-realtek/Kconfig line 26

Quoted 10 lines
arch/arm/mach-realtek/Kconfig new file +10 -0
+       select ARCH_HAS_BARRIERS
+       select SPARSE_IRQ
+       select PM_OPP
+       select ARM_HAS_SG_CHAIN
+       select ARM_PATCH_PHYS_VIRT
+       select AUTO_ZRELADDR
+       select MIGHT_HAVE_PCI
+       select MULTI_IRQ_HANDLER
+       select PCI_DOMAINS if PCI
+       select USE_OF
Quoted 3 lines

Almost all of the symbols above are implied by ARCH_MULTI_V7 and should not be selected separately.

OK, I understand.

Quoted 8 lines

arch/arm/mach-realtek/Kconfig line 32

Quoted 5 lines
arch/arm/mach-realtek/Kconfig new file +5 -0
+config ARCH_RTD16XX
+       bool "Enable support for RTD1619"
+       depends on ARCH_REALTEK
+       select ARM_GIC_V3
+       select ARM_PSCI

As I understand, this chip uses a Cortex-A55. What is the reason for adding support only to the 32-bit ARM architecture rather than 64-bit?

The RTD16XX platform also support the 64-bit ARM architecture. I will add the 64-bit ARM architecture in new version patch.

Quoted 6 lines

Most 64-bit SoCs are only supported with arch/arm64, but generally speaking that is not a requirement. My rule of thumb is that on systems with 1GB of RAM or more, one would want to run a 64-bit kernel, while systems with less than that are better off with a 32-bit one, but that is clearly not the only reason for picking one over the other.

Support 32-bit ARM architecture is for application compatibility.

Quoted 7 lines
Quoted 7 lines
arch/arm/mach-realtek/Kconfig new file +7 -0
+
+static int rtk_boot_secondary(unsigned int cpu, struct task_struct
+*idle) {
+       unsigned long entry_pa = __pa_symbol(secondary_startup);
+
+       writel_relaxed(entry_pa | (cpu << CPUID), cpu_release_virt);
+
Quoted 9 lines

arch/arm/mach-realtek/Kconfig

Quoted 4 lines
arch/arm/mach-realtek/Kconfig new file +4 -0
+       arch_send_wakeup_ipi_mask(cpumask_of(cpu));
+
+       return 0;
+}

It's very unusual to see custom smp operations on an ARMv8 system, as we normally use PSCI here. Can you explain what is going on here? Are you able to use a boot wrapper that implements these in psci instead?

The smp operations is porting form other Realtek platform.

Currently, The RTD16XX platform can use the PSCI method. I will add PSCI method in new version patch.

Quoted 11 lines
Quoted 11 lines
arch/arm/mach-realtek/Kconfig new file +11 -0
+
+#include "platsmp.h"
+
+#define RBUS_BASE_PHYS (0x98000000)
+#define RBUS_BASE_VIRT (0xfe000000)
+#define RBUS_BASE_SIZE (0x00100000)
+
+static struct map_desc rtk_io_desc[] __initdata = {
+       {
+               .virtual = (unsigned long) IOMEM(RBUS_BASE_VIRT),
+               .pfn = __phys_to_pfn(RBUS_BASE_PHYS),
Quoted 9 lines

arch/arm/mach-realtek/Kconfig

Quoted 4 lines
arch/arm/mach-realtek/Kconfig new file +4 -0
+               .length = RBUS_BASE_SIZE,
+               .type = MT_DEVICE,
+       },
+};

This needs a comment: Why do you require a static mapping for "RBUS_BASE_PHYS"? Normally device drivers should just use ioremap() for mapping whichever registers they want to access.

The static mapping is for old Realtek devices driver. I will 'use ioremap()' to replace with static mapping.

Quoted 8 lines

arch/arm/mach-realtek/Kconfig

Quoted 4 lines
arch/arm/mach-realtek/Kconfig new file +4 -0
+static void __init rtk_dt_init(void)
+{
+       of_platform_populate(NULL, of_default_bus_match_table, NULL,
+NULL); }

This should be taken care of by the of_platform_default_populate_init() and can be dropped.

I will remove rtk_dt_init() in new version patch.

Quoted 6 lines

arch/arm/mach-realtek/Kconfig

Quoted 3 lines
arch/arm/mach-realtek/Kconfig new file +3 -0
+static void __init rtk_timer_init(void) { #ifdef CONFIG_COMMON_CLK
+       of_clk_init(NULL);
+#endif

COMMON_CLK is implied by ARCH_MULTI_V7, so the #ifdef can be dropped.

OK, I understand.

Quoted 6 lines

arch/arm/mach-realtek/Kconfig

Quoted 2 lines
arch/arm/mach-realtek/Kconfig new file +2 -0
+       timer_probe();
+       tick_setup_hrtimer_broadcast(); }

What do you need tick_setup_hrtimer_broadcast() for? I don't see any other platform calling this.

I want to initialize the HR timer.

Quoted 10 lines

arch/arm/mach-realtek/Kconfig

Quoted 6 lines
arch/arm/mach-realtek/Kconfig new file +6 -0
+bool __init rtk_smp_init_ops(void)
+{
+       smp_set_ops(smp_ops(rtk_smp_ops));
+
+       return true;
+}

I think this can also be dropped, as you set the smp_ops in the machine descriptor.

OK, I understand.

Quoted 3 lines

Arnd

------Please consider the environment before printing this e-mail.

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#3 lore raw
Quoted 11 lines · James Tai[戴志峰]
Quoted 11 lines

Subject: Re: [PATCH] ARM: Add support for Realtek SOC

arch/arm/Makefile endif · line 152

Quoted 6 lines
arch/arm/Makefile +1 -0
@@ -148,6 +148,7 @@ endif
 textofs-$(CONFIG_ARCH_MSM8X60) := 0x00208000
 textofs-$(CONFIG_ARCH_MSM8960) := 0x00208000
 textofs-$(CONFIG_ARCH_MESON) := 0x00208000
+textofs-$(CONFIG_ARCH_REALTEK) := 0x00208000
 textofs-$(CONFIG_ARCH_AXXIA) := 0x00308000

Can you explain why this is needed for your platform?

Quoted 1 line

We need to reserve memory (0x00000000 ~ 0x001B0000) for rom and boot code.

Ok.

Quoted 12 lines
Quoted 8 lines

arch/arm/mach-realtek/Kconfig line 32

Quoted 5 lines
arch/arm/mach-realtek/Kconfig new file +5 -0
+config ARCH_RTD16XX
+       bool "Enable support for RTD1619"
+       depends on ARCH_REALTEK
+       select ARM_GIC_V3
+       select ARM_PSCI

As I understand, this chip uses a Cortex-A55. What is the reason for adding support only to the 32-bit ARM architecture rather than 64-bit?

The RTD16XX platform also support the 64-bit ARM architecture. I will add the 64-bit ARM architecture in new version patch.

Quoted 7 lines
Quoted 6 lines

Most 64-bit SoCs are only supported with arch/arm64, but generally speaking that is not a requirement. My rule of thumb is that on systems with 1GB of RAM or more, one would want to run a 64-bit kernel, while systems with less than that are better off with a 32-bit one, but that is clearly not the only reason for picking one over the other.

Support 32-bit ARM architecture is for application compatibility.

Generally speaking, a 64-bit kernel should work better on 64-bit hardware even when you are running mostly 32-bit applications. However, you may have device drivers that do not correctly set compat_ioctl handlers.

As I said, it's no problem to allow both, just explain this in the changelog text for the driver, along with the need for the textofs setting.

Quoted 8 lines
Quoted 4 lines

It's very unusual to see custom smp operations on an ARMv8 system, as we normally use PSCI here. Can you explain what is going on here? Are you able to use a boot wrapper that implements these in psci instead?

The smp operations is porting form other Realtek platform.

Currently, The RTD16XX platform can use the PSCI method. I will add PSCI method in new version patch.

Ok, perfect!

Quoted 7 lines
Quoted 6 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+       timer_probe();
+       tick_setup_hrtimer_broadcast(); }

What do you need tick_setup_hrtimer_broadcast() for? I don't see any other platform calling this.

I want to initialize the HR timer.

I'm still unsure about this one. My feeling is that it should not be in the platform
code, but I don't quite understand which hardware needs it. I see that Lorenzo Pieralisi added the same code to arm64 in commit 9358d755bd5c ("arm64: kernel: initialize broadcast hrtimer based clock event device"), but nothing ever calls it on 32-bit arch/arm even though the code does get built in to the kernel.

My feeling is that either you don't really need it, or this is something that other platforms should really do as well, and it should be called from the generic time_init() function in arch/arm/kernel/time.c instead.

Can you try to find out more of the background here, and then move the call to time_init() assuming it is indeed useful?

Arnd

#4 lore raw
Quoted 13 lines · Arnd Bergmann
Quoted 11 lines · James Tai[戴志峰]
Quoted 11 lines

Subject: Re: [PATCH] ARM: Add support for Realtek SOC

arch/arm/Makefile endif · line 152

Quoted 6 lines
arch/arm/Makefile +1 -0
@@ -148,6 +148,7 @@ endif
 textofs-$(CONFIG_ARCH_MSM8X60) := 0x00208000
 textofs-$(CONFIG_ARCH_MSM8960) := 0x00208000
 textofs-$(CONFIG_ARCH_MESON) := 0x00208000
+textofs-$(CONFIG_ARCH_REALTEK) := 0x00208000
 textofs-$(CONFIG_ARCH_AXXIA) := 0x00308000

Can you explain why this is needed for your platform?

Quoted 3 lines
Quoted 1 line

We need to reserve memory (0x00000000 ~ 0x001B0000) for rom and boot code.

Ok.

I do not like this much.

This platform is ARCH_MULTI_V7.

ARM_PATCH_PHYS_VIRT allows you to place the kernel image anywhere in memory as long as the base is aligned at 16MB.

The minimum 'textofs-y := 0x0008000' + extra 16MB offset will create a space (0x00000000 ~ 0x01008000).

This is more than needed, but it is not a big deal to waste some megabytes of memory.

Signature · 2 lines
Best Regards
Masahiro Yamada
maintainer
#5 lore raw
Quoted 27 lines

Subject: Re: [PATCH] ARM: Add support for Realtek SOC

Quoted 2 lines · Arnd Bergmann

On Wed, Sep 11, 2019 at 9:46 AM James Tai[戴志峰]

Quoted 11 lines · <[email protected]> wrote:
Quoted 11 lines
Quoted 11 lines

Subject: Re: [PATCH] ARM: Add support for Realtek SOC

arch/arm/Makefile endif · line 152

Quoted 6 lines
arch/arm/Makefile +1 -0
@@ -148,6 +148,7 @@ endif
 textofs-$(CONFIG_ARCH_MSM8X60) := 0x00208000
 textofs-$(CONFIG_ARCH_MSM8960) := 0x00208000
 textofs-$(CONFIG_ARCH_MESON) := 0x00208000
+textofs-$(CONFIG_ARCH_REALTEK) := 0x00208000
 textofs-$(CONFIG_ARCH_AXXIA) := 0x00308000

Can you explain why this is needed for your platform?

Quoted 1 line
Quoted 1 line

We need to reserve memory (0x00000000 ~ 0x001B0000) for rom and boot

code.

Quoted 2 lines

Ok.

I do not like this much.

This platform is ARCH_MULTI_V7.

Quoted 9 lines

ARM_PATCH_PHYS_VIRT allows you to place the kernel image anywhere in memory as long as the base is aligned at 16MB.

The minimum 'textofs-y := 0x0008000' + extra 16MB offset will create a space (0x00000000 ~ 0x01008000).

This is more than needed, but it is not a big deal to waste some megabytes of memory.

OK. I understand.

Quoted 5 lines

--
Best Regards
Masahiro Yamada

------Please consider the environment before printing this e-mail.

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

maintainer
#6 lore raw
In reply to Arnd Bergmann
Quoted 36 lines
Quoted 11 lines · <[email protected]> wrote:
Quoted 11 lines

Subject: Re: [PATCH] ARM: Add support for Realtek SOC

arch/arm/Makefile endif · line 152

Quoted 6 lines
arch/arm/Makefile +1 -0
@@ -148,6 +148,7 @@ endif
 textofs-$(CONFIG_ARCH_MSM8X60) := 0x00208000
 textofs-$(CONFIG_ARCH_MSM8960) := 0x00208000
 textofs-$(CONFIG_ARCH_MESON) := 0x00208000
+textofs-$(CONFIG_ARCH_REALTEK) := 0x00208000
 textofs-$(CONFIG_ARCH_AXXIA) := 0x00308000

Can you explain why this is needed for your platform?

Quoted 1 line

We need to reserve memory (0x00000000 ~ 0x001B0000) for rom and boot

code.

Ok.

Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
arch/arm/mach-realtek/Kconfig new file +5 -0
+config ARCH_RTD16XX
+       bool "Enable support for RTD1619"
+       depends on ARCH_REALTEK
+       select ARM_GIC_V3
+       select ARM_PSCI
Quoted 11 lines
Quoted 2 lines

As I understand, this chip uses a Cortex-A55. What is the reason for adding support only to the 32-bit ARM architecture rather than 64-bit?

The RTD16XX platform also support the 64-bit ARM architecture. I will add the 64-bit ARM architecture in new version patch.

Quoted 5 lines

Most 64-bit SoCs are only supported with arch/arm64, but generally speaking that is not a requirement. My rule of thumb is that on systems with 1GB of RAM or more, one would want to run a 64-bit kernel, while systems with less than that are better off with a 32-bit one, but that is clearly not the only reason for picking one over the

other.

Quoted 1 line
Quoted 1 line
Quoted 9 lines
Quoted 1 line

Support 32-bit ARM architecture is for application compatibility.

Generally speaking, a 64-bit kernel should work better on 64-bit hardware even when you are running mostly 32-bit applications. However, you may have device drivers that do not correctly set compat_ioctl handlers.

As I said, it's no problem to allow both, just explain this in the changelog text for the driver, along with the need for the textofs setting.

OK.

Quoted 17 lines
Quoted 8 lines
Quoted 4 lines

It's very unusual to see custom smp operations on an ARMv8 system, as we normally use PSCI here. Can you explain what is going on here? Are you able to use a boot wrapper that implements these in psci instead?

The smp operations is porting form other Realtek platform.

Currently, The RTD16XX platform can use the PSCI method. I will add PSCI method in new version patch.

Ok, perfect!

Quoted 6 lines
Quoted 6 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+       timer_probe();
+       tick_setup_hrtimer_broadcast(); }

What do you need tick_setup_hrtimer_broadcast() for? I don't see any other platform calling this.

Quoted 8 lines
Quoted 1 line

I want to initialize the HR timer.

I'm still unsure about this one. My feeling is that it should not be in the platform code, but I don't quite understand which hardware needs it. I see that Lorenzo Pieralisi added the same code to arm64 in commit 9358d755bd5c ("arm64: kernel: initialize broadcast hrtimer based clock event device"), but nothing ever calls it on 32-bit arch/arm even though the code does get built in to the kernel.

I will add the 'hrtimer' initialization flow in related devices drivers.

Quoted 4 lines

My feeling is that either you don't really need it, or this is something that other platforms should really do as well, and it should be called from the generic time_init() function in arch/arm/kernel/time.c instead.

OK. I understand.

Quoted 2 lines

Can you try to find out more of the background here, and then move the call to time_init() assuming it is indeed useful?

I agree with you. It is not necessary to call 'time_init()' function in platform code.

Quoted 3 lines

Arnd

------Please consider the environment before printing this e-mail.