devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6] mips: Support for RTL9302C
@ 2024-06-21  4:27 Chris Packham
  2024-06-21  4:27 ` [PATCH 1/6] dt-bindings: mips: realtek: Add rtl930x-soc compatible Chris Packham
                   ` (5 more replies)
  0 siblings, 6 replies; 20+ messages in thread
From: Chris Packham @ 2024-06-21  4:27 UTC (permalink / raw)
  To: tglx, robh, krzk+dt, conor+dt, tsbogend, daniel.lezcano,
	paulburton, peterz, mail, bert, john, sander
  Cc: linux-kernel, devicetree, linux-mips, kabel, ericwouds,
	Chris Packham

This series adds basic support for the RTL9302C reference board. Currently the
focus is on the CPU block stuff. I hope to get around to the DSA switch driver
eventually but this is a small start that lets me boot a mainline kernel on the
board I have. I initialiy started with code from openwrt but have paired it
down to just the clocksource driver and devicetree.

Chris Packham (6):
  dt-bindings: mips: realtek: Add rtl930x-soc compatible
  dt-bindings: timer: Add schema for realtek,otto-timer
  dt-bindings: interrupt-controller: realtek,rtl-intc: Add rtl9300-intc
  clocksource: realtek: Add timer driver for rtl-otto platforms
  mips: generic: add fdt fixup for Realtek reference board
  mips: dts: realtek: Add RTL9302C board

 .../realtek,rtl-intc.yaml                     |   1 +
 .../devicetree/bindings/mips/realtek-rtl.yaml |   2 +
 .../bindings/timer/realtek,otto-timer.yaml    |  54 ++++
 arch/mips/boot/dts/realtek/Makefile           |   1 +
 arch/mips/boot/dts/realtek/RTL9302C.dts       |  74 +++++
 arch/mips/boot/dts/realtek/rtl930x.dtsi       |  78 +++++
 arch/mips/generic/Makefile                    |   1 +
 arch/mips/generic/board-realtek.c             |  81 +++++
 drivers/clocksource/Kconfig                   |  11 +
 drivers/clocksource/Makefile                  |   1 +
 drivers/clocksource/timer-rtl-otto.c          | 287 ++++++++++++++++++
 include/linux/cpuhotplug.h                    |   1 +
 12 files changed, 592 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/timer/realtek,otto-timer.yaml
 create mode 100644 arch/mips/boot/dts/realtek/RTL9302C.dts
 create mode 100644 arch/mips/boot/dts/realtek/rtl930x.dtsi
 create mode 100644 arch/mips/generic/board-realtek.c
 create mode 100644 drivers/clocksource/timer-rtl-otto.c

-- 
2.45.2


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

* [PATCH 1/6] dt-bindings: mips: realtek: Add rtl930x-soc compatible
  2024-06-21  4:27 [PATCH 0/6] mips: Support for RTL9302C Chris Packham
@ 2024-06-21  4:27 ` Chris Packham
  2024-06-22 12:15   ` Conor Dooley
  2024-06-23  7:12   ` Krzysztof Kozlowski
  2024-06-21  4:27 ` [PATCH 2/6] dt-bindings: timer: Add schema for realtek,otto-timer Chris Packham
                   ` (4 subsequent siblings)
  5 siblings, 2 replies; 20+ messages in thread
From: Chris Packham @ 2024-06-21  4:27 UTC (permalink / raw)
  To: tglx, robh, krzk+dt, conor+dt, tsbogend, daniel.lezcano,
	paulburton, peterz, mail, bert, john, sander
  Cc: linux-kernel, devicetree, linux-mips, kabel, ericwouds,
	Chris Packham

Add the rtl930x-soc and RTL9302C board to the list of Realtek compatible
strings.

Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
---
 Documentation/devicetree/bindings/mips/realtek-rtl.yaml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/mips/realtek-rtl.yaml b/Documentation/devicetree/bindings/mips/realtek-rtl.yaml
index f8ac309d2994..f59249a2cefe 100644
--- a/Documentation/devicetree/bindings/mips/realtek-rtl.yaml
+++ b/Documentation/devicetree/bindings/mips/realtek-rtl.yaml
@@ -19,6 +19,8 @@ properties:
       - items:
           - enum:
               - cisco,sg220-26
+              - realtek,RTL9302C
           - const: realtek,rtl8382-soc
+          - const: realtek,rtl930x-soc
 
 additionalProperties: true
-- 
2.45.2


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

* [PATCH 2/6] dt-bindings: timer: Add schema for realtek,otto-timer
  2024-06-21  4:27 [PATCH 0/6] mips: Support for RTL9302C Chris Packham
  2024-06-21  4:27 ` [PATCH 1/6] dt-bindings: mips: realtek: Add rtl930x-soc compatible Chris Packham
@ 2024-06-21  4:27 ` Chris Packham
  2024-06-22 12:11   ` Conor Dooley
  2024-06-23  7:19   ` Krzysztof Kozlowski
  2024-06-21  4:27 ` [PATCH 3/6] dt-bindings: interrupt-controller: realtek,rtl-intc: Add rtl9300-intc Chris Packham
                   ` (3 subsequent siblings)
  5 siblings, 2 replies; 20+ messages in thread
From: Chris Packham @ 2024-06-21  4:27 UTC (permalink / raw)
  To: tglx, robh, krzk+dt, conor+dt, tsbogend, daniel.lezcano,
	paulburton, peterz, mail, bert, john, sander
  Cc: linux-kernel, devicetree, linux-mips, kabel, ericwouds,
	Chris Packham

Add the devicetree schema for the realtek,otto-timer present on a number
of Realtek SoCs.

Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
---
 .../bindings/timer/realtek,otto-timer.yaml    | 54 +++++++++++++++++++
 1 file changed, 54 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/timer/realtek,otto-timer.yaml

diff --git a/Documentation/devicetree/bindings/timer/realtek,otto-timer.yaml b/Documentation/devicetree/bindings/timer/realtek,otto-timer.yaml
new file mode 100644
index 000000000000..b6e85aadbc99
--- /dev/null
+++ b/Documentation/devicetree/bindings/timer/realtek,otto-timer.yaml
@@ -0,0 +1,54 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/timer/realtek,otto-timer.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Realtek Otto SoCs Timer/Counter
+
+description:
+  Realtek SoCs support a number of timers/counters. These are used
+  as a per CPU clock event generator and an overall CPU clocksource.
+
+maintainers:
+  - Chris Packham <chris.packham@alliedtelesis.co.nz>
+
+properties:
+  $nodename:
+    pattern: "^timer@[0-9a-f]+$"
+
+  compatible:
+    items:
+      - enum:
+          - realtek,rtl930x-timer
+      - const: realtek,otto-timer
+  reg:
+    minItems: 5
+    maxItems: 5
+
+  clocks:
+    maxItems: 1
+
+  interrupts:
+    minItems: 5
+    maxItems: 5
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - interrupts
+
+additionalProperties: false
+
+examples:
+  - |
+    timer0: timer@3200 {
+      compatible = "realtek,rtl930x-timer", "realtek,otto-timer";
+      reg = <0x3200 0x10>, <0x3210 0x10>, <0x3220 0x10>,
+            <0x3230 0x10>, <0x3240 0x10>;
+
+      interrupt-parent = <&intc>;
+      interrupts = <7 4>, <8 4>, <9 4>, <10 4>, <11 4>;
+      clocks = <&lx_clk>;
+    };
-- 
2.45.2


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

* [PATCH 3/6] dt-bindings: interrupt-controller: realtek,rtl-intc: Add rtl9300-intc
  2024-06-21  4:27 [PATCH 0/6] mips: Support for RTL9302C Chris Packham
  2024-06-21  4:27 ` [PATCH 1/6] dt-bindings: mips: realtek: Add rtl930x-soc compatible Chris Packham
  2024-06-21  4:27 ` [PATCH 2/6] dt-bindings: timer: Add schema for realtek,otto-timer Chris Packham
@ 2024-06-21  4:27 ` Chris Packham
  2024-06-22 12:08   ` Conor Dooley
  2024-06-23  7:12   ` Krzysztof Kozlowski
  2024-06-21  4:27 ` [PATCH 4/6] clocksource: realtek: Add timer driver for rtl-otto platforms Chris Packham
                   ` (2 subsequent siblings)
  5 siblings, 2 replies; 20+ messages in thread
From: Chris Packham @ 2024-06-21  4:27 UTC (permalink / raw)
  To: tglx, robh, krzk+dt, conor+dt, tsbogend, daniel.lezcano,
	paulburton, peterz, mail, bert, john, sander
  Cc: linux-kernel, devicetree, linux-mips, kabel, ericwouds,
	Chris Packham

Add a compatible string for the interrupt controller found on the
rtl930x SoCs.

Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
---
 .../bindings/interrupt-controller/realtek,rtl-intc.yaml          | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/interrupt-controller/realtek,rtl-intc.yaml b/Documentation/devicetree/bindings/interrupt-controller/realtek,rtl-intc.yaml
index fb5593724059..a5469a32ce76 100644
--- a/Documentation/devicetree/bindings/interrupt-controller/realtek,rtl-intc.yaml
+++ b/Documentation/devicetree/bindings/interrupt-controller/realtek,rtl-intc.yaml
@@ -25,6 +25,7 @@ properties:
       - items:
           - enum:
               - realtek,rtl8380-intc
+              - realtek,rtl9300-intc
           - const: realtek,rtl-intc
       - const: realtek,rtl-intc
         deprecated: true
-- 
2.45.2


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

* [PATCH 4/6] clocksource: realtek: Add timer driver for rtl-otto platforms
  2024-06-21  4:27 [PATCH 0/6] mips: Support for RTL9302C Chris Packham
                   ` (2 preceding siblings ...)
  2024-06-21  4:27 ` [PATCH 3/6] dt-bindings: interrupt-controller: realtek,rtl-intc: Add rtl9300-intc Chris Packham
@ 2024-06-21  4:27 ` Chris Packham
  2024-06-23  7:13   ` Krzysztof Kozlowski
                     ` (3 more replies)
  2024-06-21  4:27 ` [PATCH 5/6] mips: generic: add fdt fixup for Realtek reference board Chris Packham
  2024-06-21  4:27 ` [PATCH 6/6] mips: dts: realtek: Add RTL9302C board Chris Packham
  5 siblings, 4 replies; 20+ messages in thread
From: Chris Packham @ 2024-06-21  4:27 UTC (permalink / raw)
  To: tglx, robh, krzk+dt, conor+dt, tsbogend, daniel.lezcano,
	paulburton, peterz, mail, bert, john, sander
  Cc: linux-kernel, devicetree, linux-mips, kabel, ericwouds,
	Chris Packham, Markus Stockhausen

The timer/counter block on the Realtek SoCs provides up to 5 timers. It
also includes a watchdog timer but this isn't being used currently (it
will be added as a separate wdt driver).

One timer will be used per CPU as a local clock event generator. An
additional timer will be used as an overal stable clocksource.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Signed-off-by: Sander Vanheule <sander@svanheule.net>
Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
---

Notes:
    This is derrived from openwrt[1],[2]. I've retained the original signoff
    and added my own.
    
    [1] https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob_plain;f=target/linux/realtek/files-5.15/drivers/clocksource/timer-rtl-otto.c;hb=HEAD
    [2] https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob_plain;f=target/linux/realtek/patches-5.15/302-clocksource-add-otto-driver.patch;hb=HEAD

 drivers/clocksource/Kconfig          |  11 +
 drivers/clocksource/Makefile         |   1 +
 drivers/clocksource/timer-rtl-otto.c | 287 +++++++++++++++++++++++++++
 include/linux/cpuhotplug.h           |   1 +
 4 files changed, 300 insertions(+)
 create mode 100644 drivers/clocksource/timer-rtl-otto.c

diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index 34faa0320ece..f02b5b50d166 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -134,6 +134,17 @@ config RDA_TIMER
 	help
 	  Enables the support for the RDA Micro timer driver.
 
+config REALTEK_OTTO_TIMER
+	bool "Clocksource/timer for the Realtek Otto platform"
+	select COMMON_CLK
+	select TIMER_OF
+	help
+	  This driver adds support for the timers found in the Realtek RTL83xx
+	  and RTL93xx SoCs series. This includes chips such as RTL8380, RTL8381
+	  and RTL832, as well as chips from the RTL839x series, such as RTL8390
+	  RT8391, RTL8392, RTL8393 and RTL8396 and chips of the RTL930x series
+	  such as RTL9301, RTL9302 or RTL9303.
+
 config SUN4I_TIMER
 	bool "Sun4i timer driver" if COMPILE_TEST
 	depends on HAS_IOMEM
diff --git a/drivers/clocksource/Makefile b/drivers/clocksource/Makefile
index 4bb856e4df55..22743785299e 100644
--- a/drivers/clocksource/Makefile
+++ b/drivers/clocksource/Makefile
@@ -59,6 +59,7 @@ obj-$(CONFIG_MILBEAUT_TIMER)	+= timer-milbeaut.o
 obj-$(CONFIG_SPRD_TIMER)	+= timer-sprd.o
 obj-$(CONFIG_NPCM7XX_TIMER)	+= timer-npcm7xx.o
 obj-$(CONFIG_RDA_TIMER)		+= timer-rda.o
+obj-$(CONFIG_REALTEK_OTTO_TIMER)	+= timer-rtl-otto.o
 
 obj-$(CONFIG_ARC_TIMERS)		+= arc_timer.o
 obj-$(CONFIG_ARM_ARCH_TIMER)		+= arm_arch_timer.o
diff --git a/drivers/clocksource/timer-rtl-otto.c b/drivers/clocksource/timer-rtl-otto.c
new file mode 100644
index 000000000000..7e41ae95d7dc
--- /dev/null
+++ b/drivers/clocksource/timer-rtl-otto.c
@@ -0,0 +1,287 @@
+// SPDX-License-Identifier: GPL-2.0-only
+
+#define pr_fmt(fmt)	KBUILD_MODNAME ": " fmt
+
+#include <linux/clk.h>
+#include <linux/clockchips.h>
+#include <linux/cpu.h>
+#include <linux/cpuhotplug.h>
+#include <linux/interrupt.h>
+#include <linux/sched_clock.h>
+#include "timer-of.h"
+
+#define RTTM_DATA		0x0
+#define RTTM_CNT		0x4
+#define RTTM_CTRL		0x8
+#define RTTM_INT		0xc
+
+#define RTTM_CTRL_ENABLE	BIT(28)
+#define RTTM_INT_PENDING	BIT(16)
+#define RTTM_INT_ENABLE		BIT(20)
+
+/*
+ * The Otto platform provides multiple 28 bit timers/counters with the following
+ * operating logic. If enabled the timer counts up. Per timer one can set a
+ * maximum counter value as an end marker. If end marker is reached the timer
+ * fires an interrupt. If the timer "overflows" by reaching the end marker or
+ * by adding 1 to 0x0fffffff the counter is reset to 0. When this happens and
+ * the timer is in operating mode COUNTER it stops. In mode TIMER it will
+ * continue to count up.
+ */
+#define RTTM_CTRL_COUNTER	0
+#define RTTM_CTRL_TIMER		BIT(24)
+
+#define RTTM_BIT_COUNT		28
+#define RTTM_MIN_DELTA		8
+#define RTTM_MAX_DELTA		CLOCKSOURCE_MASK(28)
+
+/*
+ * Timers are derived from the LXB clock frequency. Usually this is a fixed
+ * multiple of the 25 MHz oscillator. The 930X SOC is an exception from that.
+ * Its LXB clock has only dividers and uses the switch PLL of 2.45 GHz as its
+ * base. The only meaningful frequencies we can achieve from that are 175.000
+ * MHz and 153.125 MHz. The greatest common divisor of all explained possible
+ * speeds is 3125000. Pin the timers to this 3.125 MHz reference frequency.
+ */
+#define RTTM_TICKS_PER_SEC	3125000
+
+struct rttm_cs {
+	struct timer_of		to;
+	struct clocksource	cs;
+};
+
+/* Simple internal register functions */
+static inline void rttm_set_counter(void __iomem *base, unsigned int counter)
+{
+	iowrite32(counter, base + RTTM_CNT);
+}
+
+static inline unsigned int rttm_get_counter(void __iomem *base)
+{
+	return ioread32(base + RTTM_CNT);
+}
+
+static inline void rttm_set_period(void __iomem *base, unsigned int period)
+{
+	iowrite32(period, base + RTTM_DATA);
+}
+
+static inline void rttm_disable_timer(void __iomem *base)
+{
+	iowrite32(0, base + RTTM_CTRL);
+}
+
+static inline void rttm_enable_timer(void __iomem *base, u32 mode, u32 divisor)
+{
+	iowrite32(RTTM_CTRL_ENABLE | mode | divisor, base + RTTM_CTRL);
+}
+
+static inline void rttm_ack_irq(void __iomem *base)
+{
+	iowrite32(ioread32(base + RTTM_INT) | RTTM_INT_PENDING, base + RTTM_INT);
+}
+
+static inline void rttm_enable_irq(void __iomem *base)
+{
+	iowrite32(RTTM_INT_ENABLE, base + RTTM_INT);
+}
+
+static inline void rttm_disable_irq(void __iomem *base)
+{
+	iowrite32(0, base + RTTM_INT);
+}
+
+/* Aggregated control functions for kernel clock framework */
+#define RTTM_DEBUG(base)			\
+	pr_debug("------------- %d %08x\n",	\
+		 smp_processor_id(), (u32)base)
+
+static irqreturn_t rttm_timer_interrupt(int irq, void *dev_id)
+{
+	struct clock_event_device *clkevt = dev_id;
+	struct timer_of *to = to_timer_of(clkevt);
+
+	rttm_ack_irq(to->of_base.base);
+	RTTM_DEBUG(to->of_base.base);
+	clkevt->event_handler(clkevt);
+
+	return IRQ_HANDLED;
+}
+
+static void rttm_stop_timer(void __iomem *base)
+{
+	rttm_disable_timer(base);
+	rttm_ack_irq(base);
+}
+
+static void rttm_start_timer(struct timer_of *to, u32 mode)
+{
+	rttm_set_counter(to->of_base.base, 0);
+	rttm_enable_timer(to->of_base.base, mode, to->of_clk.rate / RTTM_TICKS_PER_SEC);
+}
+
+static int rttm_next_event(unsigned long delta, struct clock_event_device *clkevt)
+{
+	struct timer_of *to = to_timer_of(clkevt);
+
+	RTTM_DEBUG(to->of_base.base);
+	rttm_stop_timer(to->of_base.base);
+	rttm_set_period(to->of_base.base, delta);
+	rttm_start_timer(to, RTTM_CTRL_COUNTER);
+
+	return 0;
+}
+
+static int rttm_state_oneshot(struct clock_event_device *clkevt)
+{
+	struct timer_of *to = to_timer_of(clkevt);
+
+	RTTM_DEBUG(to->of_base.base);
+	rttm_stop_timer(to->of_base.base);
+	rttm_set_period(to->of_base.base, RTTM_TICKS_PER_SEC / HZ);
+	rttm_start_timer(to, RTTM_CTRL_COUNTER);
+
+	return 0;
+}
+
+static int rttm_state_periodic(struct clock_event_device *clkevt)
+{
+	struct timer_of *to = to_timer_of(clkevt);
+
+	RTTM_DEBUG(to->of_base.base);
+	rttm_stop_timer(to->of_base.base);
+	rttm_set_period(to->of_base.base, RTTM_TICKS_PER_SEC / HZ);
+	rttm_start_timer(to, RTTM_CTRL_TIMER);
+
+	return 0;
+}
+
+static int rttm_state_shutdown(struct clock_event_device *clkevt)
+{
+	struct timer_of *to = to_timer_of(clkevt);
+
+	RTTM_DEBUG(to->of_base.base);
+	rttm_stop_timer(to->of_base.base);
+
+	return 0;
+}
+
+static void rttm_setup_timer(void __iomem *base)
+{
+	RTTM_DEBUG(base);
+	rttm_stop_timer(base);
+	rttm_set_period(base, 0);
+}
+
+static u64 rttm_read_clocksource(struct clocksource *cs)
+{
+	struct rttm_cs *rcs = container_of(cs, struct rttm_cs, cs);
+
+	return (u64)rttm_get_counter(rcs->to.of_base.base);
+}
+
+/* Module initialization part. */
+static DEFINE_PER_CPU(struct timer_of, rttm_to) = {
+	.flags				= TIMER_OF_BASE | TIMER_OF_CLOCK | TIMER_OF_IRQ,
+	.of_irq = {
+		.flags			= IRQF_PERCPU | IRQF_TIMER,
+		.handler		= rttm_timer_interrupt,
+	},
+	.clkevt = {
+		.rating			= 400,
+		.features		= CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
+		.set_state_periodic	= rttm_state_periodic,
+		.set_state_shutdown	= rttm_state_shutdown,
+		.set_state_oneshot	= rttm_state_oneshot,
+		.set_next_event		= rttm_next_event
+	},
+};
+
+static int rttm_enable_clocksource(struct clocksource *cs)
+{
+	struct rttm_cs *rcs = container_of(cs, struct rttm_cs, cs);
+
+	rttm_disable_irq(rcs->to.of_base.base);
+	rttm_setup_timer(rcs->to.of_base.base);
+	rttm_enable_timer(rcs->to.of_base.base, RTTM_CTRL_TIMER,
+			  rcs->to.of_clk.rate / RTTM_TICKS_PER_SEC);
+
+	return 0;
+}
+
+struct rttm_cs rttm_cs = {
+	.to = {
+		.flags	= TIMER_OF_BASE | TIMER_OF_CLOCK,
+	},
+	.cs = {
+		.name	= "realtek_otto_timer",
+		.rating	= 400,
+		.mask	= CLOCKSOURCE_MASK(RTTM_BIT_COUNT),
+		.flags	= CLOCK_SOURCE_IS_CONTINUOUS,
+		.read	= rttm_read_clocksource,
+	}
+};
+
+static u64 notrace rttm_read_clock(void)
+{
+	return (u64)rttm_get_counter(rttm_cs.to.of_base.base);
+}
+
+static int rttm_cpu_starting(unsigned int cpu)
+{
+	struct timer_of *to = per_cpu_ptr(&rttm_to, cpu);
+
+	RTTM_DEBUG(to->of_base.base);
+	to->clkevt.cpumask = cpumask_of(cpu);
+	irq_force_affinity(to->of_irq.irq, to->clkevt.cpumask);
+	clockevents_config_and_register(&to->clkevt, RTTM_TICKS_PER_SEC,
+					RTTM_MIN_DELTA, RTTM_MAX_DELTA);
+	rttm_enable_irq(to->of_base.base);
+
+	return 0;
+}
+
+static int __init rttm_probe(struct device_node *np)
+{
+	int cpu, cpu_rollback;
+	struct timer_of *to;
+	int clkidx = num_possible_cpus();
+
+	/* Use the first n timers as per CPU clock event generators */
+	for_each_possible_cpu(cpu) {
+		to = per_cpu_ptr(&rttm_to, cpu);
+		to->of_irq.index = to->of_base.index = cpu;
+		if (timer_of_init(np, to)) {
+			pr_err("setup of timer %d failed\n", cpu);
+			goto rollback;
+		}
+		rttm_setup_timer(to->of_base.base);
+	}
+
+	/* Activate the n'th + 1 timer as a stable CPU clocksource. */
+	to = &rttm_cs.to;
+	to->of_base.index = clkidx;
+	timer_of_init(np, to);
+	if (rttm_cs.to.of_base.base && rttm_cs.to.of_clk.rate) {
+		rttm_enable_clocksource(&rttm_cs.cs);
+		clocksource_register_hz(&rttm_cs.cs, RTTM_TICKS_PER_SEC);
+		sched_clock_register(rttm_read_clock, RTTM_BIT_COUNT, RTTM_TICKS_PER_SEC);
+	} else
+		pr_err(" setup of timer %d as clocksource failed", clkidx);
+
+	return cpuhp_setup_state(CPUHP_AP_REALTEK_TIMER_STARTING,
+				"timer/realtek:online",
+				rttm_cpu_starting, NULL);
+rollback:
+	pr_err("timer registration failed\n");
+	for_each_possible_cpu(cpu_rollback) {
+		if (cpu_rollback == cpu)
+			break;
+		to = per_cpu_ptr(&rttm_to, cpu_rollback);
+		timer_of_cleanup(to);
+	}
+
+	return -EINVAL;
+}
+
+TIMER_OF_DECLARE(otto_timer, "realtek,otto-timer", rttm_probe);
diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h
index 7a5785f405b6..56b744dc1317 100644
--- a/include/linux/cpuhotplug.h
+++ b/include/linux/cpuhotplug.h
@@ -171,6 +171,7 @@ enum cpuhp_state {
 	CPUHP_AP_ARMADA_TIMER_STARTING,
 	CPUHP_AP_MIPS_GIC_TIMER_STARTING,
 	CPUHP_AP_ARC_TIMER_STARTING,
+	CPUHP_AP_REALTEK_TIMER_STARTING,
 	CPUHP_AP_RISCV_TIMER_STARTING,
 	CPUHP_AP_CLINT_TIMER_STARTING,
 	CPUHP_AP_CSKY_TIMER_STARTING,
-- 
2.45.2


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

* [PATCH 5/6] mips: generic: add fdt fixup for Realtek reference board
  2024-06-21  4:27 [PATCH 0/6] mips: Support for RTL9302C Chris Packham
                   ` (3 preceding siblings ...)
  2024-06-21  4:27 ` [PATCH 4/6] clocksource: realtek: Add timer driver for rtl-otto platforms Chris Packham
@ 2024-06-21  4:27 ` Chris Packham
  2024-06-21  4:27 ` [PATCH 6/6] mips: dts: realtek: Add RTL9302C board Chris Packham
  5 siblings, 0 replies; 20+ messages in thread
From: Chris Packham @ 2024-06-21  4:27 UTC (permalink / raw)
  To: tglx, robh, krzk+dt, conor+dt, tsbogend, daniel.lezcano,
	paulburton, peterz, mail, bert, john, sander
  Cc: linux-kernel, devicetree, linux-mips, kabel, ericwouds,
	Chris Packham

The bootloader used on the Realtek RTL9302C boards is an ancient vendor
fork of U-Boot that doesn't understand device trees. So to run a modern
kernel it is necessary use one of the APPENDED_DTB options.

When appending the DTB the inintrd information, if present, needs to be
inserted into the /chosen device tree node. The bootloader provides the
initrd start/size via the firmware environment. Add a fdt fixup that
will update the device tree with the initrd information.

Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
---
 arch/mips/generic/Makefile        |  1 +
 arch/mips/generic/board-realtek.c | 81 +++++++++++++++++++++++++++++++
 2 files changed, 82 insertions(+)
 create mode 100644 arch/mips/generic/board-realtek.c

diff --git a/arch/mips/generic/Makefile b/arch/mips/generic/Makefile
index 56011d738441..ea0e4ad5e600 100644
--- a/arch/mips/generic/Makefile
+++ b/arch/mips/generic/Makefile
@@ -13,3 +13,4 @@ obj-$(CONFIG_LEGACY_BOARD_SEAD3)	+= board-sead3.o
 obj-$(CONFIG_LEGACY_BOARD_OCELOT)	+= board-ocelot.o
 obj-$(CONFIG_MACH_INGENIC)			+= board-ingenic.o
 obj-$(CONFIG_VIRT_BOARD_RANCHU)		+= board-ranchu.o
+obj-$(CONFIG_MACH_REALTEK_RTL)		+= board-realtek.o
diff --git a/arch/mips/generic/board-realtek.c b/arch/mips/generic/board-realtek.c
new file mode 100644
index 000000000000..91563efbc61f
--- /dev/null
+++ b/arch/mips/generic/board-realtek.c
@@ -0,0 +1,81 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2024 Allied Telesis
+ */
+
+#include <linux/errno.h>
+#include <linux/libfdt.h>
+#include <linux/of_address.h>
+#include <linux/types.h>
+
+#include <asm/fw/fw.h>
+#include <asm/machine.h>
+
+static __init int realtek_add_initrd(void *fdt)
+{
+	int node, err;
+	u32 start, size;
+
+	node = fdt_path_offset(fdt, "/chosen");
+	if (node < 0) {
+		pr_err("/chosen node not found\n");
+		return -ENOENT;
+	}
+
+	start = fw_getenvl("initrd_start");
+	size = fw_getenvl("initrd_size");
+
+	if (start == 0 && size == 0)
+		return 0;
+
+	pr_info("Adding initrd info from environment\n");
+
+	err = fdt_setprop_u32(fdt, node, "linux,initrd-start", start);
+	if (err) {
+		pr_err("unable to set initrd-start: %d\n", err);
+		return err;
+	}
+
+	err = fdt_setprop_u32(fdt, node, "linux,initrd-end", start + size);
+	if (err) {
+		pr_err("unable to set initrd-end: %d\n", err);
+		return err;
+	}
+
+	return 0;
+}
+
+static const struct mips_fdt_fixup realtek_fdt_fixups[] __initconst = {
+	{ realtek_add_initrd, "add initrd" },
+	{},
+};
+
+static __init const void *realtek_fixup_fdt(const void *fdt, const void *match_data)
+{
+	static unsigned char fdt_buf[16 << 10] __initdata;
+	int err;
+
+	if (fdt_check_header(fdt))
+		panic("Corrupt DT");
+
+	fw_init_cmdline();
+
+	err = apply_mips_fdt_fixups(fdt_buf, sizeof(fdt_buf), fdt, realtek_fdt_fixups);
+	if (err)
+		panic("Unable to fixup FDT: %d", err);
+
+	return fdt_buf;
+
+}
+
+static const struct of_device_id realtek_of_match[] __initconst = {
+	{
+		.compatible = "realtek,rtl930x-soc",
+	},
+	{}
+};
+
+MIPS_MACHINE(realtek) = {
+	.matches = realtek_of_match,
+	.fixup_fdt = realtek_fixup_fdt,
+};
-- 
2.45.2


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

* [PATCH 6/6] mips: dts: realtek: Add RTL9302C board
  2024-06-21  4:27 [PATCH 0/6] mips: Support for RTL9302C Chris Packham
                   ` (4 preceding siblings ...)
  2024-06-21  4:27 ` [PATCH 5/6] mips: generic: add fdt fixup for Realtek reference board Chris Packham
@ 2024-06-21  4:27 ` Chris Packham
  2024-06-23  7:15   ` Krzysztof Kozlowski
  5 siblings, 1 reply; 20+ messages in thread
From: Chris Packham @ 2024-06-21  4:27 UTC (permalink / raw)
  To: tglx, robh, krzk+dt, conor+dt, tsbogend, daniel.lezcano,
	paulburton, peterz, mail, bert, john, sander
  Cc: linux-kernel, devicetree, linux-mips, kabel, ericwouds,
	Chris Packham

Add support for the RTL930x SoC and the RTL9302C reference board.

The RTL930x family of SoCs are Realtek switches with an embedded MIPS
core (800MHz 34Kc). Most of the peripherals are similar to the RTL838x
SoC and can make use of many existing drivers.

Add in full DSA switch support is still a work in progress.

Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
---
 arch/mips/boot/dts/realtek/Makefile     |  1 +
 arch/mips/boot/dts/realtek/RTL9302C.dts | 74 +++++++++++++++++++++++
 arch/mips/boot/dts/realtek/rtl930x.dtsi | 78 +++++++++++++++++++++++++
 3 files changed, 153 insertions(+)
 create mode 100644 arch/mips/boot/dts/realtek/RTL9302C.dts
 create mode 100644 arch/mips/boot/dts/realtek/rtl930x.dtsi

diff --git a/arch/mips/boot/dts/realtek/Makefile b/arch/mips/boot/dts/realtek/Makefile
index fba4e93187a6..54dc2d280cd5 100644
--- a/arch/mips/boot/dts/realtek/Makefile
+++ b/arch/mips/boot/dts/realtek/Makefile
@@ -1,2 +1,3 @@
 # SPDX-License-Identifier: GPL-2.0
 dtb-y	+= cisco_sg220-26.dtb
+dtb-y	+= RTL9302C.dtb
diff --git a/arch/mips/boot/dts/realtek/RTL9302C.dts b/arch/mips/boot/dts/realtek/RTL9302C.dts
new file mode 100644
index 000000000000..d921067d5006
--- /dev/null
+++ b/arch/mips/boot/dts/realtek/RTL9302C.dts
@@ -0,0 +1,74 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/dts-v1/;
+
+#include "rtl930x.dtsi"
+
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/leds/common.h>
+#include <dt-bindings/thermal/thermal.h>
+
+/ {
+	compatible = "realtek,RTL9302C", "realtek,rtl930x-soc";
+	model = "RTL9302C Development Board";
+
+	memory@0 {
+		device_type = "memory";
+		reg = <0x0 0x8000000>;
+	};
+
+	chosen {
+		bootargs = "earlycon";
+		stdout-path = "serial0:115200n8";
+	};
+};
+
+&uart0 {
+	status = "okay";
+};
+
+&spi0 {
+	status = "okay";
+	flash@0 {
+		compatible = "jedec,spi-nor";
+		reg = <0>;
+		spi-max-frequency = <10000000>;
+
+		partitions {
+			compatible = "fixed-partitions";
+			#address-cells = <1>;
+			#size-cells = <1>;
+
+			partition@0 {
+				label = "u-boot";
+				reg = <0x0 0xe0000>;
+				read-only;
+			};
+			partition@e0000 {
+				label = "u-boot-env";
+				reg = <0xe0000 0x10000>;
+			};
+			partition@f0000 {
+				label = "u-boot-env2";
+				reg = <0xf0000 0x10000>;
+				read-only;
+			};
+			partition@100000 {
+				label = "jffs";
+				reg = <0x100000 0x100000>;
+			};
+			partition@200000 {
+				label = "jffs2";
+				reg = <0x200000 0x100000>;
+			};
+			partition@300000 {
+				label = "runtime";
+				reg = <0x300000 0xe80000>;
+			};
+			partition@1180000 {
+				label = "runtime2";
+				reg = <0x1180000 0xe80000>;
+			};
+		};
+	};
+};
diff --git a/arch/mips/boot/dts/realtek/rtl930x.dtsi b/arch/mips/boot/dts/realtek/rtl930x.dtsi
new file mode 100644
index 000000000000..5e088c90d2ee
--- /dev/null
+++ b/arch/mips/boot/dts/realtek/rtl930x.dtsi
@@ -0,0 +1,78 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR BSD-2-Clause
+
+#include "rtl83xx.dtsi"
+
+/ {
+	compatible = "realtek,rtl930x-soc";
+
+	cpus {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		cpu@0 {
+			compatible = "mips,mips34Kc";
+			reg = <0>;
+			clocks = <&baseclk 0>;
+			clock-names = "cpu";
+		};
+	};
+
+	baseclk: baseclk {
+		compatible = "fixed-clock";
+		#clock-cells = <0>;
+		clock-frequency = <800000000>;
+	};
+
+	lx_clk: lx_clk {
+		compatible = "fixed-clock";
+		#clock-cells = <0>;
+		clock-frequency  = <175000000>;
+	};
+};
+
+&soc {
+	intc: interrupt-controller@3000 {
+		compatible = "realtek,rtl9300-intc", "realtek,rtl-intc";
+		reg = <0x3000 0x18>, <0x3018 0x18>;
+		interrupt-controller;
+		#interrupt-cells = <2>;
+
+		interrupt-parent = <&cpuintc>;
+		interrupts = <2>, <3>, <4>, <5>, <6>, <7>;
+	};
+
+	spi0: spi@1200 {
+		compatible = "realtek,rtl8380-spi";
+		reg = <0x1200 0x100>;
+
+		#address-cells = <1>;
+		#size-cells = <0>;
+	};
+
+	timer0: timer@3200 {
+		compatible = "realtek,rtl930x-timer", "realtek,otto-timer";
+		reg = <0x3200 0x10>, <0x3210 0x10>, <0x3220 0x10>,
+		    <0x3230 0x10>, <0x3240 0x10>;
+
+		interrupt-parent = <&intc>;
+		interrupts = <7 4>, <8 4>, <9 4>, <10 4>, <11 4>;
+		clocks = <&lx_clk>;
+	};
+};
+
+&uart0 {
+	/delete-property/ clock-frequency;
+	clocks = <&lx_clk>;
+
+	interrupt-parent = <&intc>;
+	interrupts = <30 1>;
+};
+
+&uart1 {
+	/delete-property/ clock-frequency;
+	clocks = <&lx_clk>;
+
+	interrupt-parent = <&intc>;
+	interrupts = <31 0>;
+};
+
-- 
2.45.2


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

* Re: [PATCH 3/6] dt-bindings: interrupt-controller: realtek,rtl-intc: Add rtl9300-intc
  2024-06-21  4:27 ` [PATCH 3/6] dt-bindings: interrupt-controller: realtek,rtl-intc: Add rtl9300-intc Chris Packham
@ 2024-06-22 12:08   ` Conor Dooley
  2024-06-23  7:12   ` Krzysztof Kozlowski
  1 sibling, 0 replies; 20+ messages in thread
From: Conor Dooley @ 2024-06-22 12:08 UTC (permalink / raw)
  To: Chris Packham
  Cc: tglx, robh, krzk+dt, conor+dt, tsbogend, daniel.lezcano,
	paulburton, peterz, mail, bert, john, sander, linux-kernel,
	devicetree, linux-mips, kabel, ericwouds

[-- Attachment #1: Type: text/plain, Size: 277 bytes --]

On Fri, Jun 21, 2024 at 04:27:34PM +1200, Chris Packham wrote:
> Add a compatible string for the interrupt controller found on the
> rtl930x SoCs.
> 
> Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>

Acked-by: Conor Dooley <conor.dooley@microchip.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [PATCH 2/6] dt-bindings: timer: Add schema for realtek,otto-timer
  2024-06-21  4:27 ` [PATCH 2/6] dt-bindings: timer: Add schema for realtek,otto-timer Chris Packham
@ 2024-06-22 12:11   ` Conor Dooley
  2024-06-23 21:23     ` Chris Packham
  2024-06-23  7:19   ` Krzysztof Kozlowski
  1 sibling, 1 reply; 20+ messages in thread
From: Conor Dooley @ 2024-06-22 12:11 UTC (permalink / raw)
  To: Chris Packham
  Cc: tglx, robh, krzk+dt, conor+dt, tsbogend, daniel.lezcano,
	paulburton, peterz, mail, bert, john, sander, linux-kernel,
	devicetree, linux-mips, kabel, ericwouds

[-- Attachment #1: Type: text/plain, Size: 2377 bytes --]

On Fri, Jun 21, 2024 at 04:27:33PM +1200, Chris Packham wrote:
> Add the devicetree schema for the realtek,otto-timer present on a number
> of Realtek SoCs.
> 
> Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
> ---
>  .../bindings/timer/realtek,otto-timer.yaml    | 54 +++++++++++++++++++
>  1 file changed, 54 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/timer/realtek,otto-timer.yaml
> 
> diff --git a/Documentation/devicetree/bindings/timer/realtek,otto-timer.yaml b/Documentation/devicetree/bindings/timer/realtek,otto-timer.yaml
> new file mode 100644
> index 000000000000..b6e85aadbc99
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/timer/realtek,otto-timer.yaml
> @@ -0,0 +1,54 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/timer/realtek,otto-timer.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Realtek Otto SoCs Timer/Counter
> +
> +description:
> +  Realtek SoCs support a number of timers/counters. These are used
> +  as a per CPU clock event generator and an overall CPU clocksource.
> +
> +maintainers:
> +  - Chris Packham <chris.packham@alliedtelesis.co.nz>
> +
> +properties:
> +  $nodename:
> +    pattern: "^timer@[0-9a-f]+$"
> +
> +  compatible:
> +    items:
> +      - enum:
> +          - realtek,rtl930x-timer
> +      - const: realtek,otto-timer
> +  reg:
> +    minItems: 5
> +    maxItems: 5

Since minitems == maxitems, can you just make this a list, and define
what they all are? Ditto interrupts.

reg:
  items:
    - foo
    - bar
    - baz

etc.


> +
> +  clocks:
> +    maxItems: 1
> +
> +  interrupts:
> +    minItems: 5
> +    maxItems: 5
> +
> +required:
> +  - compatible
> +  - reg
> +  - clocks
> +  - interrupts
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    timer0: timer@3200 {

The label here isn't needed FYI.

Thanks,
Conor.

> +      compatible = "realtek,rtl930x-timer", "realtek,otto-timer";
> +      reg = <0x3200 0x10>, <0x3210 0x10>, <0x3220 0x10>,
> +            <0x3230 0x10>, <0x3240 0x10>;
> +
> +      interrupt-parent = <&intc>;
> +      interrupts = <7 4>, <8 4>, <9 4>, <10 4>, <11 4>;
> +      clocks = <&lx_clk>;
> +    };
> -- 
> 2.45.2
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [PATCH 1/6] dt-bindings: mips: realtek: Add rtl930x-soc compatible
  2024-06-21  4:27 ` [PATCH 1/6] dt-bindings: mips: realtek: Add rtl930x-soc compatible Chris Packham
@ 2024-06-22 12:15   ` Conor Dooley
  2024-06-23  7:12   ` Krzysztof Kozlowski
  1 sibling, 0 replies; 20+ messages in thread
From: Conor Dooley @ 2024-06-22 12:15 UTC (permalink / raw)
  To: Chris Packham
  Cc: tglx, robh, krzk+dt, conor+dt, tsbogend, daniel.lezcano,
	paulburton, peterz, mail, bert, john, sander, linux-kernel,
	devicetree, linux-mips, kabel, ericwouds

[-- Attachment #1: Type: text/plain, Size: 1359 bytes --]

On Fri, Jun 21, 2024 at 04:27:32PM +1200, Chris Packham wrote:
> Add the rtl930x-soc and RTL9302C board to the list of Realtek compatible
> strings.
> 
> Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
> ---
>  Documentation/devicetree/bindings/mips/realtek-rtl.yaml | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/mips/realtek-rtl.yaml b/Documentation/devicetree/bindings/mips/realtek-rtl.yaml
> index f8ac309d2994..f59249a2cefe 100644
> --- a/Documentation/devicetree/bindings/mips/realtek-rtl.yaml
> +++ b/Documentation/devicetree/bindings/mips/realtek-rtl.yaml
> @@ -19,6 +19,8 @@ properties:
>        - items:
>            - enum:
>                - cisco,sg220-26
> +              - realtek,RTL9302C

lower case please.

>            - const: realtek,rtl8382-soc
> +          - const: realtek,rtl930x-soc

Please avoid wildcards in compatibles. Can you add the actual compatible
instead please.

Also, I think this patch is wrong. It will disallow
compatible = "cisco,sg220-26", "realtek,rtl8382-soc"
and instead require
compatible = "cisco,sg220-26", "realtek,rtl8382-soc", "realtek,rtl930x-soc"
  or
compatible = "realtek,RTL9302C, "realtek,rtl8382-soc", "realtek,rtl930x-soc"

Cheers,
Conor.

>  
>  additionalProperties: true
> -- 
> 2.45.2
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [PATCH 1/6] dt-bindings: mips: realtek: Add rtl930x-soc compatible
  2024-06-21  4:27 ` [PATCH 1/6] dt-bindings: mips: realtek: Add rtl930x-soc compatible Chris Packham
  2024-06-22 12:15   ` Conor Dooley
@ 2024-06-23  7:12   ` Krzysztof Kozlowski
  1 sibling, 0 replies; 20+ messages in thread
From: Krzysztof Kozlowski @ 2024-06-23  7:12 UTC (permalink / raw)
  To: Chris Packham, tglx, robh, krzk+dt, conor+dt, tsbogend,
	daniel.lezcano, paulburton, peterz, mail, bert, john, sander
  Cc: linux-kernel, devicetree, linux-mips, kabel, ericwouds

On 21/06/2024 06:27, Chris Packham wrote:
> Add the rtl930x-soc and RTL9302C board to the list of Realtek compatible
> strings.

No, you did not do this. You added fallback, without any rationale.

> 
> Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
> ---
>  Documentation/devicetree/bindings/mips/realtek-rtl.yaml | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/mips/realtek-rtl.yaml b/Documentation/devicetree/bindings/mips/realtek-rtl.yaml
> index f8ac309d2994..f59249a2cefe 100644
> --- a/Documentation/devicetree/bindings/mips/realtek-rtl.yaml
> +++ b/Documentation/devicetree/bindings/mips/realtek-rtl.yaml
> @@ -19,6 +19,8 @@ properties:
>        - items:
>            - enum:
>                - cisco,sg220-26
> +              - realtek,RTL9302C
>            - const: realtek,rtl8382-soc
> +          - const: realtek,rtl930x-soc

Does not look right. First: Not tested. Second: does not really make
sense and commit msg does not explain it to me. Also, no wildcards.

Best regards,
Krzysztof


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

* Re: [PATCH 3/6] dt-bindings: interrupt-controller: realtek,rtl-intc: Add rtl9300-intc
  2024-06-21  4:27 ` [PATCH 3/6] dt-bindings: interrupt-controller: realtek,rtl-intc: Add rtl9300-intc Chris Packham
  2024-06-22 12:08   ` Conor Dooley
@ 2024-06-23  7:12   ` Krzysztof Kozlowski
  1 sibling, 0 replies; 20+ messages in thread
From: Krzysztof Kozlowski @ 2024-06-23  7:12 UTC (permalink / raw)
  To: Chris Packham, tglx, robh, krzk+dt, conor+dt, tsbogend,
	daniel.lezcano, paulburton, peterz, mail, bert, john, sander
  Cc: linux-kernel, devicetree, linux-mips, kabel, ericwouds

On 21/06/2024 06:27, Chris Packham wrote:
> Add a compatible string for the interrupt controller found on the
> rtl930x SoCs.
> 
> Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>

Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof


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

* Re: [PATCH 4/6] clocksource: realtek: Add timer driver for rtl-otto platforms
  2024-06-21  4:27 ` [PATCH 4/6] clocksource: realtek: Add timer driver for rtl-otto platforms Chris Packham
@ 2024-06-23  7:13   ` Krzysztof Kozlowski
  2024-06-26  2:01   ` kernel test robot
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 20+ messages in thread
From: Krzysztof Kozlowski @ 2024-06-23  7:13 UTC (permalink / raw)
  To: Chris Packham, tglx, robh, krzk+dt, conor+dt, tsbogend,
	daniel.lezcano, paulburton, peterz, mail, bert, john, sander
  Cc: linux-kernel, devicetree, linux-mips, kabel, ericwouds,
	Markus Stockhausen

On 21/06/2024 06:27, Chris Packham wrote:
> The timer/counter block on the Realtek SoCs provides up to 5 timers. It
> also includes a watchdog timer but this isn't being used currently (it
> will be added as a separate wdt driver).
> 
> One timer will be used per CPU as a local clock event generator. An
> additional timer will be used as an overal stable clocksource.
> 
> Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
> Signed-off-by: Sander Vanheule <sander@svanheule.net>
> Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>

...

> +	pr_err("timer registration failed\n");
> +	for_each_possible_cpu(cpu_rollback) {
> +		if (cpu_rollback == cpu)
> +			break;
> +		to = per_cpu_ptr(&rttm_to, cpu_rollback);
> +		timer_of_cleanup(to);
> +	}
> +
> +	return -EINVAL;
> +}
> +
> +TIMER_OF_DECLARE(otto_timer, "realtek,otto-timer", rttm_probe);

Undocumented compatible.

Best regards,
Krzysztof


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

* Re: [PATCH 6/6] mips: dts: realtek: Add RTL9302C board
  2024-06-21  4:27 ` [PATCH 6/6] mips: dts: realtek: Add RTL9302C board Chris Packham
@ 2024-06-23  7:15   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 20+ messages in thread
From: Krzysztof Kozlowski @ 2024-06-23  7:15 UTC (permalink / raw)
  To: Chris Packham, tglx, robh, krzk+dt, conor+dt, tsbogend,
	daniel.lezcano, paulburton, peterz, mail, bert, john, sander
  Cc: linux-kernel, devicetree, linux-mips, kabel, ericwouds

On 21/06/2024 06:27, Chris Packham wrote:
> Add support for the RTL930x SoC and the RTL9302C reference board.
> 
> The RTL930x family of SoCs are Realtek switches with an embedded MIPS
> core (800MHz 34Kc). Most of the peripherals are similar to the RTL838x
> SoC and can make use of many existing drivers.
> 
> Add in full DSA switch support is still a work in progress.
> 
> Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
> ---
>  arch/mips/boot/dts/realtek/Makefile     |  1 +
>  arch/mips/boot/dts/realtek/RTL9302C.dts | 74 +++++++++++++++++++++++
>  arch/mips/boot/dts/realtek/rtl930x.dtsi | 78 +++++++++++++++++++++++++
>  3 files changed, 153 insertions(+)
>  create mode 100644 arch/mips/boot/dts/realtek/RTL9302C.dts
>  create mode 100644 arch/mips/boot/dts/realtek/rtl930x.dtsi
> 
> diff --git a/arch/mips/boot/dts/realtek/Makefile b/arch/mips/boot/dts/realtek/Makefile
> index fba4e93187a6..54dc2d280cd5 100644
> --- a/arch/mips/boot/dts/realtek/Makefile
> +++ b/arch/mips/boot/dts/realtek/Makefile
> @@ -1,2 +1,3 @@
>  # SPDX-License-Identifier: GPL-2.0
>  dtb-y	+= cisco_sg220-26.dtb
> +dtb-y	+= RTL9302C.dtb
> diff --git a/arch/mips/boot/dts/realtek/RTL9302C.dts b/arch/mips/boot/dts/realtek/RTL9302C.dts
> new file mode 100644
> index 000000000000..d921067d5006
> --- /dev/null
> +++ b/arch/mips/boot/dts/realtek/RTL9302C.dts
> @@ -0,0 +1,74 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/dts-v1/;
> +
> +#include "rtl930x.dtsi"
> +
> +#include <dt-bindings/input/input.h>
> +#include <dt-bindings/gpio/gpio.h>
> +#include <dt-bindings/leds/common.h>
> +#include <dt-bindings/thermal/thermal.h>
> +
> +/ {
> +	compatible = "realtek,RTL9302C", "realtek,rtl930x-soc";

Really, this wasn't ever tested.

> +	model = "RTL9302C Development Board";
> +
> +	memory@0 {
> +		device_type = "memory";
> +		reg = <0x0 0x8000000>;
> +	};
> +
> +	chosen {
> +		bootargs = "earlycon";

Drop. earlycon is debugging tool, not a wide-mainline usage configuration.

> +		stdout-path = "serial0:115200n8";
> +	};
> +};
> +
> +&uart0 {
> +	status = "okay";
> +};
> +
> +&spi0 {
> +	status = "okay";
> +	flash@0 {
> +		compatible = "jedec,spi-nor";
> +		reg = <0>;
> +		spi-max-frequency = <10000000>;
> +
> +		partitions {
> +			compatible = "fixed-partitions";
> +			#address-cells = <1>;
> +			#size-cells = <1>;
> +
> +			partition@0 {
> +				label = "u-boot";
> +				reg = <0x0 0xe0000>;
> +				read-only;
> +			};
> +			partition@e0000 {
> +				label = "u-boot-env";
> +				reg = <0xe0000 0x10000>;
> +			};
> +			partition@f0000 {
> +				label = "u-boot-env2";
> +				reg = <0xf0000 0x10000>;
> +				read-only;
> +			};
> +			partition@100000 {
> +				label = "jffs";
> +				reg = <0x100000 0x100000>;
> +			};
> +			partition@200000 {
> +				label = "jffs2";
> +				reg = <0x200000 0x100000>;
> +			};
> +			partition@300000 {
> +				label = "runtime";
> +				reg = <0x300000 0xe80000>;
> +			};
> +			partition@1180000 {
> +				label = "runtime2";
> +				reg = <0x1180000 0xe80000>;
> +			};
> +		};
> +	};
> +};
> diff --git a/arch/mips/boot/dts/realtek/rtl930x.dtsi b/arch/mips/boot/dts/realtek/rtl930x.dtsi
> new file mode 100644
> index 000000000000..5e088c90d2ee
> --- /dev/null
> +++ b/arch/mips/boot/dts/realtek/rtl930x.dtsi
> @@ -0,0 +1,78 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later OR BSD-2-Clause
> +
> +#include "rtl83xx.dtsi"
> +
> +/ {
> +	compatible = "realtek,rtl930x-soc";
> +
> +	cpus {
> +		#address-cells = <1>;
> +		#size-cells = <0>;
> +
> +		cpu@0 {
> +			compatible = "mips,mips34Kc";
> +			reg = <0>;
> +			clocks = <&baseclk 0>;
> +			clock-names = "cpu";
> +		};
> +	};
> +
> +	baseclk: baseclk {
> +		compatible = "fixed-clock";
> +		#clock-cells = <0>;
> +		clock-frequency = <800000000>;
> +	};
> +
> +	lx_clk: lx_clk {

No underscors in node names.

Use recommended clock names, see:
Documentation/devicetree/bindings/clock/fixed-clock.yaml


> +		compatible = "fixed-clock";
> +		#clock-cells = <0>;
> +		clock-frequency  = <175000000>;
> +	};
> +};
> +
> +&soc {
> +	intc: interrupt-controller@3000 {
> +		compatible = "realtek,rtl9300-intc", "realtek,rtl-intc";
> +		reg = <0x3000 0x18>, <0x3018 0x18>;
> +		interrupt-controller;
> +		#interrupt-cells = <2>;
> +
> +		interrupt-parent = <&cpuintc>;
> +		interrupts = <2>, <3>, <4>, <5>, <6>, <7>;
> +	};
> +
> +	spi0: spi@1200 {
> +		compatible = "realtek,rtl8380-spi";
> +		reg = <0x1200 0x100>;
> +
> +		#address-cells = <1>;
> +		#size-cells = <0>;
> +	};
> +
> +	timer0: timer@3200 {
> +		compatible = "realtek,rtl930x-timer", "realtek,otto-timer";
> +		reg = <0x3200 0x10>, <0x3210 0x10>, <0x3220 0x10>,
> +		    <0x3230 0x10>, <0x3240 0x10>;
> +
> +		interrupt-parent = <&intc>;
> +		interrupts = <7 4>, <8 4>, <9 4>, <10 4>, <11 4>;

Are you open-coding IRQ flags?

> +		clocks = <&lx_clk>;
> +	};
> +};
> +
> +&uart0 {
> +	/delete-property/ clock-frequency;
> +	clocks = <&lx_clk>;
> +
> +	interrupt-parent = <&intc>;
> +	interrupts = <30 1>;

Are you open-coding IRQ flags?


> +};
> +
> +&uart1 {
> +	/delete-property/ clock-frequency;
> +	clocks = <&lx_clk>;
> +
> +	interrupt-parent = <&intc>;
> +	interrupts = <31 0>;

Are you open-coding IRQ flags?

> +};
> +

Best regards,
Krzysztof


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

* Re: [PATCH 2/6] dt-bindings: timer: Add schema for realtek,otto-timer
  2024-06-21  4:27 ` [PATCH 2/6] dt-bindings: timer: Add schema for realtek,otto-timer Chris Packham
  2024-06-22 12:11   ` Conor Dooley
@ 2024-06-23  7:19   ` Krzysztof Kozlowski
  1 sibling, 0 replies; 20+ messages in thread
From: Krzysztof Kozlowski @ 2024-06-23  7:19 UTC (permalink / raw)
  To: Chris Packham, tglx, robh, krzk+dt, conor+dt, tsbogend,
	daniel.lezcano, paulburton, peterz, mail, bert, john, sander
  Cc: linux-kernel, devicetree, linux-mips, kabel, ericwouds

On 21/06/2024 06:27, Chris Packham wrote:
> Add the devicetree schema for the realtek,otto-timer present on a number
> of Realtek SoCs.

Please order your patches correctly: bindings always go before users.

A nit, subject: drop second/last, redundant "schema for". The
"dt-bindings" prefix is already stating that these are bindings (so schema).
See also:
https://elixir.bootlin.com/linux/v6.7-rc8/source/Documentation/devicetree/bindings/submitting-patches.rst#L18

> 
> Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
> ---
>  .../bindings/timer/realtek,otto-timer.yaml    | 54 +++++++++++++++++++
>  1 file changed, 54 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/timer/realtek,otto-timer.yaml
> 
> diff --git a/Documentation/devicetree/bindings/timer/realtek,otto-timer.yaml b/Documentation/devicetree/bindings/timer/realtek,otto-timer.yaml
> new file mode 100644
> index 000000000000..b6e85aadbc99
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/timer/realtek,otto-timer.yaml
> @@ -0,0 +1,54 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/timer/realtek,otto-timer.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Realtek Otto SoCs Timer/Counter
> +
> +description:
> +  Realtek SoCs support a number of timers/counters. These are used
> +  as a per CPU clock event generator and an overall CPU clocksource.
> +
> +maintainers:
> +  - Chris Packham <chris.packham@alliedtelesis.co.nz>
> +
> +properties:
> +  $nodename:
> +    pattern: "^timer@[0-9a-f]+$"
> +
> +  compatible:
> +    items:
> +      - enum:
> +          - realtek,rtl930x-timer

No wildcards.

> +      - const: realtek,otto-timer

Do you have access to datasheet of all Otto SoCs and can you confirm
that all of them have the same timer programming interface? Just drop
generic compatible and use SoCs compatible.

Blank line.

> +  reg:
> +    minItems: 5
> +    maxItems: 5

Instead list and describe the items.

> +
> +  clocks:
> +    maxItems: 1
> +
> +  interrupts:
> +    minItems: 5
> +    maxItems: 5

Instead list and describe the items.


> +
> +required:
> +  - compatible
> +  - reg
> +  - clocks
> +  - interrupts
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    timer0: timer@3200 {

Drop unused label

> +      compatible = "realtek,rtl930x-timer", "realtek,otto-timer";
> +      reg = <0x3200 0x10>, <0x3210 0x10>, <0x3220 0x10>,
> +            <0x3230 0x10>, <0x3240 0x10>;
> +
> +      interrupt-parent = <&intc>;
> +      interrupts = <7 4>, <8 4>, <9 4>, <10 4>, <11 4>;

Use proper defines for the flags.

> +      clocks = <&lx_clk>;
> +    };

Best regards,
Krzysztof


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

* Re: [PATCH 2/6] dt-bindings: timer: Add schema for realtek,otto-timer
  2024-06-22 12:11   ` Conor Dooley
@ 2024-06-23 21:23     ` Chris Packham
  2024-06-24 16:34       ` Conor Dooley
  0 siblings, 1 reply; 20+ messages in thread
From: Chris Packham @ 2024-06-23 21:23 UTC (permalink / raw)
  To: Conor Dooley
  Cc: tglx@linutronix.de, robh@kernel.org, krzk+dt@kernel.org,
	conor+dt@kernel.org, tsbogend@alpha.franken.de,
	daniel.lezcano@linaro.org, paulburton@kernel.org,
	peterz@infradead.org, mail@birger-koblitz.de, bert@biot.com,
	john@phrozen.org, sander@svanheule.net,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
	linux-mips@vger.kernel.org, kabel@kernel.org, ericwouds@gmail.com

(resend as plain text)

On 23/06/24 00:11, Conor Dooley wrote:
> On Fri, Jun 21, 2024 at 04:27:33PM +1200, Chris Packham wrote:
>> Add the devicetree schema for the realtek,otto-timer present on a number
>> of Realtek SoCs.
>>
>> Signed-off-by: Chris Packham<chris.packham@alliedtelesis.co.nz>
>> ---
>>   .../bindings/timer/realtek,otto-timer.yaml    | 54 +++++++++++++++++++
>>   1 file changed, 54 insertions(+)
>>   create mode 100644 Documentation/devicetree/bindings/timer/realtek,otto-timer.yaml
>>
>> diff --git a/Documentation/devicetree/bindings/timer/realtek,otto-timer.yaml b/Documentation/devicetree/bindings/timer/realtek,otto-timer.yaml
>> new file mode 100644
>> index 000000000000..b6e85aadbc99
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/timer/realtek,otto-timer.yaml
>> @@ -0,0 +1,54 @@
>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
>> +%YAML 1.2
>> +---
>> +$id:http://devicetree.org/schemas/timer/realtek,otto-timer.yaml#
>> +$schema:http://devicetree.org/meta-schemas/core.yaml#
>> +
>> +title: Realtek Otto SoCs Timer/Counter
>> +
>> +description:
>> +  Realtek SoCs support a number of timers/counters. These are used
>> +  as a per CPU clock event generator and an overall CPU clocksource.
>> +
>> +maintainers:
>> +  - Chris Packham<chris.packham@alliedtelesis.co.nz>
>> +
>> +properties:
>> +  $nodename:
>> +    pattern: "^timer@[0-9a-f]+$"
>> +
>> +  compatible:
>> +    items:
>> +      - enum:
>> +          - realtek,rtl930x-timer

I'll change this to rtl9302

>> +      - const: realtek,otto-timer
>> +  reg:
>> +    minItems: 5
>> +    maxItems: 5
> Since minitems == maxitems, can you just make this a list, and define
> what they all are? Ditto interrupts.

This is where more conditions might need to be added. The rtl9302 is a 
single core SoC. So technically it only needs 2 timers (the hardware 
still has 5 but 3 would be unused at the moment). The rtl9312 is a dual 
core SoC so needs 3 timers (I won't be looking at that platform for a 
while). So I think maybe maxItems should stay at 5 but minItems should 
be set based on the compatible.

> reg:
>    items:
>      - foo
>      - bar
>      - baz
>
> etc.

I can do. But they'd all be something like cpuN-event. The way the 
driver is written it grabs a timer for each CPU and uses the next one 
for a global timer.

>> +
>> +  clocks:
>> +    maxItems: 1
>> +
>> +  interrupts:
>> +    minItems: 5
>> +    maxItems: 5
>> +
>> +required:
>> +  - compatible
>> +  - reg
>> +  - clocks
>> +  - interrupts
>> +
>> +additionalProperties: false
>> +
>> +examples:
>> +  - |
>> +    timer0: timer@3200 {
> The label here isn't needed FYI.

Will remove.

>> +      compatible = "realtek,rtl930x-timer", "realtek,otto-timer";
>> +      reg = <0x3200 0x10>, <0x3210 0x10>, <0x3220 0x10>,
>> +            <0x3230 0x10>, <0x3240 0x10>;
>> +
>> +      interrupt-parent = <&intc>;
>> +      interrupts = <7 4>, <8 4>, <9 4>, <10 4>, <11 4>;
Will switch to using proper IRQ flags.
>> +      clocks = <&lx_clk>;
>> +    };
>> -- 
>> 2.45.2
>>

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

* Re: [PATCH 2/6] dt-bindings: timer: Add schema for realtek,otto-timer
  2024-06-23 21:23     ` Chris Packham
@ 2024-06-24 16:34       ` Conor Dooley
  0 siblings, 0 replies; 20+ messages in thread
From: Conor Dooley @ 2024-06-24 16:34 UTC (permalink / raw)
  To: Chris Packham
  Cc: tglx@linutronix.de, robh@kernel.org, krzk+dt@kernel.org,
	conor+dt@kernel.org, tsbogend@alpha.franken.de,
	daniel.lezcano@linaro.org, paulburton@kernel.org,
	peterz@infradead.org, mail@birger-koblitz.de, bert@biot.com,
	john@phrozen.org, sander@svanheule.net,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
	linux-mips@vger.kernel.org, kabel@kernel.org, ericwouds@gmail.com

[-- Attachment #1: Type: text/plain, Size: 2761 bytes --]

On Sun, Jun 23, 2024 at 09:23:55PM +0000, Chris Packham wrote:
> (resend as plain text)
> 
> On 23/06/24 00:11, Conor Dooley wrote:
> > On Fri, Jun 21, 2024 at 04:27:33PM +1200, Chris Packham wrote:
> >> Add the devicetree schema for the realtek,otto-timer present on a number
> >> of Realtek SoCs.
> >>
> >> Signed-off-by: Chris Packham<chris.packham@alliedtelesis.co.nz>
> >> ---
> >>   .../bindings/timer/realtek,otto-timer.yaml    | 54 +++++++++++++++++++
> >>   1 file changed, 54 insertions(+)
> >>   create mode 100644 Documentation/devicetree/bindings/timer/realtek,otto-timer.yaml
> >>
> >> diff --git a/Documentation/devicetree/bindings/timer/realtek,otto-timer.yaml b/Documentation/devicetree/bindings/timer/realtek,otto-timer.yaml
> >> new file mode 100644
> >> index 000000000000..b6e85aadbc99
> >> --- /dev/null
> >> +++ b/Documentation/devicetree/bindings/timer/realtek,otto-timer.yaml
> >> @@ -0,0 +1,54 @@
> >> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> >> +%YAML 1.2
> >> +---
> >> +$id:http://devicetree.org/schemas/timer/realtek,otto-timer.yaml#
> >> +$schema:http://devicetree.org/meta-schemas/core.yaml#
> >> +
> >> +title: Realtek Otto SoCs Timer/Counter
> >> +
> >> +description:
> >> +  Realtek SoCs support a number of timers/counters. These are used
> >> +  as a per CPU clock event generator and an overall CPU clocksource.
> >> +
> >> +maintainers:
> >> +  - Chris Packham<chris.packham@alliedtelesis.co.nz>
> >> +
> >> +properties:
> >> +  $nodename:
> >> +    pattern: "^timer@[0-9a-f]+$"
> >> +
> >> +  compatible:
> >> +    items:
> >> +      - enum:
> >> +          - realtek,rtl930x-timer
> 
> I'll change this to rtl9302
> 
> >> +      - const: realtek,otto-timer
> >> +  reg:
> >> +    minItems: 5
> >> +    maxItems: 5
> > Since minitems == maxitems, can you just make this a list, and define
> > what they all are? Ditto interrupts.
> 
> This is where more conditions might need to be added. The rtl9302 is a 
> single core SoC. So technically it only needs 2 timers (the hardware 
> still has 5 but 3 would be unused at the moment). The rtl9312 is a dual 
> core SoC so needs 3 timers (I won't be looking at that platform for a 
> while). So I think maybe maxItems should stay at 5 but minItems should 
> be set based on the compatible.

Sounds good to me.

> > reg:
> >    items:
> >      - foo
> >      - bar
> >      - baz
> >
> > etc.
> 
> I can do. But they'd all be something like cpuN-event. The way the 
> driver is written it grabs a timer for each CPU and uses the next one 
> for a global timer.

I think it's fine if they all have very simplistic names, their roles
should be documented somehow.

Cheers,
Conor.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [PATCH 4/6] clocksource: realtek: Add timer driver for rtl-otto platforms
  2024-06-21  4:27 ` [PATCH 4/6] clocksource: realtek: Add timer driver for rtl-otto platforms Chris Packham
  2024-06-23  7:13   ` Krzysztof Kozlowski
@ 2024-06-26  2:01   ` kernel test robot
  2024-06-26 11:32   ` kernel test robot
  2024-06-26 12:08   ` kernel test robot
  3 siblings, 0 replies; 20+ messages in thread
From: kernel test robot @ 2024-06-26  2:01 UTC (permalink / raw)
  To: Chris Packham, tglx, robh, krzk+dt, conor+dt, tsbogend,
	daniel.lezcano, paulburton, peterz, mail, bert, john, sander
  Cc: oe-kbuild-all, linux-kernel, devicetree, linux-mips, kabel,
	ericwouds, Chris Packham, Markus Stockhausen

Hi Chris,

kernel test robot noticed the following build warnings:

[auto build test WARNING on robh/for-next]
[also build test WARNING on tip/timers/core tip/irq/core tip/smp/core linus/master v6.10-rc5 next-20240625]
[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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Chris-Packham/dt-bindings-mips-realtek-Add-rtl930x-soc-compatible/20240625-160622
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
patch link:    https://lore.kernel.org/r/20240621042737.674128-5-chris.packham%40alliedtelesis.co.nz
patch subject: [PATCH 4/6] clocksource: realtek: Add timer driver for rtl-otto platforms
config: loongarch-allmodconfig (https://download.01.org/0day-ci/archive/20240626/202406260925.EyDSt3VD-lkp@intel.com/config)
compiler: loongarch64-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240626/202406260925.EyDSt3VD-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202406260925.EyDSt3VD-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from include/linux/printk.h:573,
                    from include/linux/kernel.h:31,
                    from include/linux/clk.h:13,
                    from drivers/clocksource/timer-rtl-otto.c:5:
   drivers/clocksource/timer-rtl-otto.c: In function 'rttm_timer_interrupt':
>> drivers/clocksource/timer-rtl-otto.c:97:38: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
      97 |                  smp_processor_id(), (u32)base)
         |                                      ^
   include/linux/dynamic_debug.h:224:29: note: in definition of macro '__dynamic_func_call_cls'
     224 |                 func(&id, ##__VA_ARGS__);                       \
         |                             ^~~~~~~~~~~
   include/linux/dynamic_debug.h:250:9: note: in expansion of macro '_dynamic_func_call_cls'
     250 |         _dynamic_func_call_cls(_DPRINTK_CLASS_DFLT, fmt, func, ##__VA_ARGS__)
         |         ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/dynamic_debug.h:269:9: note: in expansion of macro '_dynamic_func_call'
     269 |         _dynamic_func_call(fmt, __dynamic_pr_debug,             \
         |         ^~~~~~~~~~~~~~~~~~
   include/linux/printk.h:588:9: note: in expansion of macro 'dynamic_pr_debug'
     588 |         dynamic_pr_debug(fmt, ##__VA_ARGS__)
         |         ^~~~~~~~~~~~~~~~
   drivers/clocksource/timer-rtl-otto.c:96:9: note: in expansion of macro 'pr_debug'
      96 |         pr_debug("------------- %d %08x\n",     \
         |         ^~~~~~~~
   drivers/clocksource/timer-rtl-otto.c:105:9: note: in expansion of macro 'RTTM_DEBUG'
     105 |         RTTM_DEBUG(to->of_base.base);
         |         ^~~~~~~~~~
   drivers/clocksource/timer-rtl-otto.c: In function 'rttm_next_event':
>> drivers/clocksource/timer-rtl-otto.c:97:38: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
      97 |                  smp_processor_id(), (u32)base)
         |                                      ^
   include/linux/dynamic_debug.h:224:29: note: in definition of macro '__dynamic_func_call_cls'
     224 |                 func(&id, ##__VA_ARGS__);                       \
         |                             ^~~~~~~~~~~
   include/linux/dynamic_debug.h:250:9: note: in expansion of macro '_dynamic_func_call_cls'
     250 |         _dynamic_func_call_cls(_DPRINTK_CLASS_DFLT, fmt, func, ##__VA_ARGS__)
         |         ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/dynamic_debug.h:269:9: note: in expansion of macro '_dynamic_func_call'
     269 |         _dynamic_func_call(fmt, __dynamic_pr_debug,             \
         |         ^~~~~~~~~~~~~~~~~~
   include/linux/printk.h:588:9: note: in expansion of macro 'dynamic_pr_debug'
     588 |         dynamic_pr_debug(fmt, ##__VA_ARGS__)
         |         ^~~~~~~~~~~~~~~~
   drivers/clocksource/timer-rtl-otto.c:96:9: note: in expansion of macro 'pr_debug'
      96 |         pr_debug("------------- %d %08x\n",     \
         |         ^~~~~~~~
   drivers/clocksource/timer-rtl-otto.c:127:9: note: in expansion of macro 'RTTM_DEBUG'
     127 |         RTTM_DEBUG(to->of_base.base);
         |         ^~~~~~~~~~
   drivers/clocksource/timer-rtl-otto.c: In function 'rttm_state_oneshot':
>> drivers/clocksource/timer-rtl-otto.c:97:38: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
      97 |                  smp_processor_id(), (u32)base)
         |                                      ^
   include/linux/dynamic_debug.h:224:29: note: in definition of macro '__dynamic_func_call_cls'
     224 |                 func(&id, ##__VA_ARGS__);                       \
         |                             ^~~~~~~~~~~
   include/linux/dynamic_debug.h:250:9: note: in expansion of macro '_dynamic_func_call_cls'
     250 |         _dynamic_func_call_cls(_DPRINTK_CLASS_DFLT, fmt, func, ##__VA_ARGS__)
         |         ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/dynamic_debug.h:269:9: note: in expansion of macro '_dynamic_func_call'
     269 |         _dynamic_func_call(fmt, __dynamic_pr_debug,             \
         |         ^~~~~~~~~~~~~~~~~~
   include/linux/printk.h:588:9: note: in expansion of macro 'dynamic_pr_debug'
     588 |         dynamic_pr_debug(fmt, ##__VA_ARGS__)
         |         ^~~~~~~~~~~~~~~~
   drivers/clocksource/timer-rtl-otto.c:96:9: note: in expansion of macro 'pr_debug'
      96 |         pr_debug("------------- %d %08x\n",     \
         |         ^~~~~~~~
   drivers/clocksource/timer-rtl-otto.c:139:9: note: in expansion of macro 'RTTM_DEBUG'
     139 |         RTTM_DEBUG(to->of_base.base);
         |         ^~~~~~~~~~
   drivers/clocksource/timer-rtl-otto.c: In function 'rttm_state_periodic':
>> drivers/clocksource/timer-rtl-otto.c:97:38: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
      97 |                  smp_processor_id(), (u32)base)
         |                                      ^
   include/linux/dynamic_debug.h:224:29: note: in definition of macro '__dynamic_func_call_cls'
     224 |                 func(&id, ##__VA_ARGS__);                       \
         |                             ^~~~~~~~~~~
   include/linux/dynamic_debug.h:250:9: note: in expansion of macro '_dynamic_func_call_cls'
     250 |         _dynamic_func_call_cls(_DPRINTK_CLASS_DFLT, fmt, func, ##__VA_ARGS__)
         |         ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/dynamic_debug.h:269:9: note: in expansion of macro '_dynamic_func_call'
     269 |         _dynamic_func_call(fmt, __dynamic_pr_debug,             \
         |         ^~~~~~~~~~~~~~~~~~
   include/linux/printk.h:588:9: note: in expansion of macro 'dynamic_pr_debug'
     588 |         dynamic_pr_debug(fmt, ##__VA_ARGS__)
         |         ^~~~~~~~~~~~~~~~
   drivers/clocksource/timer-rtl-otto.c:96:9: note: in expansion of macro 'pr_debug'
      96 |         pr_debug("------------- %d %08x\n",     \
         |         ^~~~~~~~
   drivers/clocksource/timer-rtl-otto.c:151:9: note: in expansion of macro 'RTTM_DEBUG'
     151 |         RTTM_DEBUG(to->of_base.base);
         |         ^~~~~~~~~~
   drivers/clocksource/timer-rtl-otto.c: In function 'rttm_state_shutdown':
>> drivers/clocksource/timer-rtl-otto.c:97:38: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
      97 |                  smp_processor_id(), (u32)base)
         |                                      ^
   include/linux/dynamic_debug.h:224:29: note: in definition of macro '__dynamic_func_call_cls'
     224 |                 func(&id, ##__VA_ARGS__);                       \
         |                             ^~~~~~~~~~~
   include/linux/dynamic_debug.h:250:9: note: in expansion of macro '_dynamic_func_call_cls'
     250 |         _dynamic_func_call_cls(_DPRINTK_CLASS_DFLT, fmt, func, ##__VA_ARGS__)
         |         ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/dynamic_debug.h:269:9: note: in expansion of macro '_dynamic_func_call'
     269 |         _dynamic_func_call(fmt, __dynamic_pr_debug,             \
         |         ^~~~~~~~~~~~~~~~~~
   include/linux/printk.h:588:9: note: in expansion of macro 'dynamic_pr_debug'
     588 |         dynamic_pr_debug(fmt, ##__VA_ARGS__)
         |         ^~~~~~~~~~~~~~~~
   drivers/clocksource/timer-rtl-otto.c:96:9: note: in expansion of macro 'pr_debug'
      96 |         pr_debug("------------- %d %08x\n",     \
         |         ^~~~~~~~
   drivers/clocksource/timer-rtl-otto.c:163:9: note: in expansion of macro 'RTTM_DEBUG'
     163 |         RTTM_DEBUG(to->of_base.base);
         |         ^~~~~~~~~~
   drivers/clocksource/timer-rtl-otto.c: In function 'rttm_setup_timer':
>> drivers/clocksource/timer-rtl-otto.c:97:38: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
      97 |                  smp_processor_id(), (u32)base)
         |                                      ^
   include/linux/dynamic_debug.h:224:29: note: in definition of macro '__dynamic_func_call_cls'
     224 |                 func(&id, ##__VA_ARGS__);                       \
         |                             ^~~~~~~~~~~
   include/linux/dynamic_debug.h:250:9: note: in expansion of macro '_dynamic_func_call_cls'
     250 |         _dynamic_func_call_cls(_DPRINTK_CLASS_DFLT, fmt, func, ##__VA_ARGS__)
         |         ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/dynamic_debug.h:269:9: note: in expansion of macro '_dynamic_func_call'
     269 |         _dynamic_func_call(fmt, __dynamic_pr_debug,             \
         |         ^~~~~~~~~~~~~~~~~~
   include/linux/printk.h:588:9: note: in expansion of macro 'dynamic_pr_debug'
     588 |         dynamic_pr_debug(fmt, ##__VA_ARGS__)
         |         ^~~~~~~~~~~~~~~~
   drivers/clocksource/timer-rtl-otto.c:96:9: note: in expansion of macro 'pr_debug'
      96 |         pr_debug("------------- %d %08x\n",     \
         |         ^~~~~~~~
   drivers/clocksource/timer-rtl-otto.c:171:9: note: in expansion of macro 'RTTM_DEBUG'
     171 |         RTTM_DEBUG(base);
         |         ^~~~~~~~~~
   drivers/clocksource/timer-rtl-otto.c: In function 'rttm_cpu_starting':
>> drivers/clocksource/timer-rtl-otto.c:97:38: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
      97 |                  smp_processor_id(), (u32)base)
         |                                      ^
   include/linux/dynamic_debug.h:224:29: note: in definition of macro '__dynamic_func_call_cls'
     224 |                 func(&id, ##__VA_ARGS__);                       \
         |                             ^~~~~~~~~~~
   include/linux/dynamic_debug.h:250:9: note: in expansion of macro '_dynamic_func_call_cls'
     250 |         _dynamic_func_call_cls(_DPRINTK_CLASS_DFLT, fmt, func, ##__VA_ARGS__)
         |         ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/dynamic_debug.h:269:9: note: in expansion of macro '_dynamic_func_call'
     269 |         _dynamic_func_call(fmt, __dynamic_pr_debug,             \
         |         ^~~~~~~~~~~~~~~~~~
   include/linux/printk.h:588:9: note: in expansion of macro 'dynamic_pr_debug'
     588 |         dynamic_pr_debug(fmt, ##__VA_ARGS__)
         |         ^~~~~~~~~~~~~~~~
   drivers/clocksource/timer-rtl-otto.c:96:9: note: in expansion of macro 'pr_debug'
      96 |         pr_debug("------------- %d %08x\n",     \
         |         ^~~~~~~~
   drivers/clocksource/timer-rtl-otto.c:234:9: note: in expansion of macro 'RTTM_DEBUG'
     234 |         RTTM_DEBUG(to->of_base.base);
         |         ^~~~~~~~~~


vim +97 drivers/clocksource/timer-rtl-otto.c

    93	
    94	/* Aggregated control functions for kernel clock framework */
    95	#define RTTM_DEBUG(base)			\
    96		pr_debug("------------- %d %08x\n",	\
  > 97			 smp_processor_id(), (u32)base)
    98	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

* Re: [PATCH 4/6] clocksource: realtek: Add timer driver for rtl-otto platforms
  2024-06-21  4:27 ` [PATCH 4/6] clocksource: realtek: Add timer driver for rtl-otto platforms Chris Packham
  2024-06-23  7:13   ` Krzysztof Kozlowski
  2024-06-26  2:01   ` kernel test robot
@ 2024-06-26 11:32   ` kernel test robot
  2024-06-26 12:08   ` kernel test robot
  3 siblings, 0 replies; 20+ messages in thread
From: kernel test robot @ 2024-06-26 11:32 UTC (permalink / raw)
  To: Chris Packham, tglx, robh, krzk+dt, conor+dt, tsbogend,
	daniel.lezcano, paulburton, peterz, mail, bert, john, sander
  Cc: Paul Gazzillo, Necip Fazil Yildiran, oe-kbuild-all, linux-kernel,
	devicetree, linux-mips, kabel, ericwouds, Chris Packham,
	Markus Stockhausen

Hi Chris,

kernel test robot noticed the following build warnings:

[auto build test WARNING on robh/for-next]
[also build test WARNING on tip/timers/core tip/irq/core tip/smp/core linus/master v6.10-rc5 next-20240625]
[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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Chris-Packham/dt-bindings-mips-realtek-Add-rtl930x-soc-compatible/20240625-160622
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
patch link:    https://lore.kernel.org/r/20240621042737.674128-5-chris.packham%40alliedtelesis.co.nz
patch subject: [PATCH 4/6] clocksource: realtek: Add timer driver for rtl-otto platforms
config: m68k-kismet-CONFIG_COMMON_CLK-CONFIG_REALTEK_OTTO_TIMER-0-0 (https://download.01.org/0day-ci/archive/20240626/202406261928.jfuyByiO-lkp@intel.com/config)
reproduce: (https://download.01.org/0day-ci/archive/20240626/202406261928.jfuyByiO-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202406261928.jfuyByiO-lkp@intel.com/

kismet warnings: (new ones prefixed by >>)
>> kismet: WARNING: unmet direct dependencies detected for COMMON_CLK when selected by REALTEK_OTTO_TIMER
   WARNING: unmet direct dependencies detected for COMMON_CLK
     Depends on [n]: !HAVE_LEGACY_CLK [=y]
     Selected by [y]:
     - REALTEK_OTTO_TIMER [=y] && GENERIC_CLOCKEVENTS [=y]

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

* Re: [PATCH 4/6] clocksource: realtek: Add timer driver for rtl-otto platforms
  2024-06-21  4:27 ` [PATCH 4/6] clocksource: realtek: Add timer driver for rtl-otto platforms Chris Packham
                     ` (2 preceding siblings ...)
  2024-06-26 11:32   ` kernel test robot
@ 2024-06-26 12:08   ` kernel test robot
  3 siblings, 0 replies; 20+ messages in thread
From: kernel test robot @ 2024-06-26 12:08 UTC (permalink / raw)
  To: Chris Packham, tglx, robh, krzk+dt, conor+dt, tsbogend,
	daniel.lezcano, paulburton, peterz, mail, bert, john, sander
  Cc: llvm, oe-kbuild-all, linux-kernel, devicetree, linux-mips, kabel,
	ericwouds, Chris Packham, Markus Stockhausen

Hi Chris,

kernel test robot noticed the following build warnings:

[auto build test WARNING on robh/for-next]
[also build test WARNING on tip/timers/core tip/irq/core tip/smp/core linus/master v6.10-rc5 next-20240625]
[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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Chris-Packham/dt-bindings-mips-realtek-Add-rtl930x-soc-compatible/20240625-160622
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
patch link:    https://lore.kernel.org/r/20240621042737.674128-5-chris.packham%40alliedtelesis.co.nz
patch subject: [PATCH 4/6] clocksource: realtek: Add timer driver for rtl-otto platforms
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20240626/202406261940.lYNjMHKC-lkp@intel.com/config)
compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240626/202406261940.lYNjMHKC-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202406261940.lYNjMHKC-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/clocksource/timer-rtl-otto.c:105:2: warning: cast to smaller integer type 'u32' (aka 'unsigned int') from 'void *' [-Wvoid-pointer-to-int-cast]
     105 |         RTTM_DEBUG(to->of_base.base);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/clocksource/timer-rtl-otto.c:97:24: note: expanded from macro 'RTTM_DEBUG'
      96 |         pr_debug("------------- %d %08x\n",     \
         |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      97 |                  smp_processor_id(), (u32)base)
         |                  ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
   include/linux/printk.h:588:26: note: expanded from macro 'pr_debug'
     588 |         dynamic_pr_debug(fmt, ##__VA_ARGS__)
         |         ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
   include/linux/dynamic_debug.h:270:22: note: expanded from macro 'dynamic_pr_debug'
     269 |         _dynamic_func_call(fmt, __dynamic_pr_debug,             \
         |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     270 |                            pr_fmt(fmt), ##__VA_ARGS__)
         |                            ~~~~~~~~~~~~~~~^~~~~~~~~~~~
   include/linux/dynamic_debug.h:250:59: note: expanded from macro '_dynamic_func_call'
     250 |         _dynamic_func_call_cls(_DPRINTK_CLASS_DFLT, fmt, func, ##__VA_ARGS__)
         |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
   include/linux/dynamic_debug.h:248:65: note: expanded from macro '_dynamic_func_call_cls'
     248 |         __dynamic_func_call_cls(__UNIQUE_ID(ddebug), cls, fmt, func, ##__VA_ARGS__)
         |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
   include/linux/dynamic_debug.h:224:15: note: expanded from macro '__dynamic_func_call_cls'
     224 |                 func(&id, ##__VA_ARGS__);                       \
         |                             ^~~~~~~~~~~
   drivers/clocksource/timer-rtl-otto.c:127:2: warning: cast to smaller integer type 'u32' (aka 'unsigned int') from 'void *' [-Wvoid-pointer-to-int-cast]
     127 |         RTTM_DEBUG(to->of_base.base);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/clocksource/timer-rtl-otto.c:97:24: note: expanded from macro 'RTTM_DEBUG'
      96 |         pr_debug("------------- %d %08x\n",     \
         |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      97 |                  smp_processor_id(), (u32)base)
         |                  ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
   include/linux/printk.h:588:26: note: expanded from macro 'pr_debug'
     588 |         dynamic_pr_debug(fmt, ##__VA_ARGS__)
         |         ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
   include/linux/dynamic_debug.h:270:22: note: expanded from macro 'dynamic_pr_debug'
     269 |         _dynamic_func_call(fmt, __dynamic_pr_debug,             \
         |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     270 |                            pr_fmt(fmt), ##__VA_ARGS__)
         |                            ~~~~~~~~~~~~~~~^~~~~~~~~~~~
   include/linux/dynamic_debug.h:250:59: note: expanded from macro '_dynamic_func_call'
     250 |         _dynamic_func_call_cls(_DPRINTK_CLASS_DFLT, fmt, func, ##__VA_ARGS__)
         |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
   include/linux/dynamic_debug.h:248:65: note: expanded from macro '_dynamic_func_call_cls'
     248 |         __dynamic_func_call_cls(__UNIQUE_ID(ddebug), cls, fmt, func, ##__VA_ARGS__)
         |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
   include/linux/dynamic_debug.h:224:15: note: expanded from macro '__dynamic_func_call_cls'
     224 |                 func(&id, ##__VA_ARGS__);                       \
         |                             ^~~~~~~~~~~
   drivers/clocksource/timer-rtl-otto.c:139:2: warning: cast to smaller integer type 'u32' (aka 'unsigned int') from 'void *' [-Wvoid-pointer-to-int-cast]
     139 |         RTTM_DEBUG(to->of_base.base);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/clocksource/timer-rtl-otto.c:97:24: note: expanded from macro 'RTTM_DEBUG'
      96 |         pr_debug("------------- %d %08x\n",     \
         |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      97 |                  smp_processor_id(), (u32)base)
         |                  ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
   include/linux/printk.h:588:26: note: expanded from macro 'pr_debug'
     588 |         dynamic_pr_debug(fmt, ##__VA_ARGS__)
         |         ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
   include/linux/dynamic_debug.h:270:22: note: expanded from macro 'dynamic_pr_debug'
     269 |         _dynamic_func_call(fmt, __dynamic_pr_debug,             \
         |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     270 |                            pr_fmt(fmt), ##__VA_ARGS__)
         |                            ~~~~~~~~~~~~~~~^~~~~~~~~~~~
   include/linux/dynamic_debug.h:250:59: note: expanded from macro '_dynamic_func_call'
     250 |         _dynamic_func_call_cls(_DPRINTK_CLASS_DFLT, fmt, func, ##__VA_ARGS__)
         |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
   include/linux/dynamic_debug.h:248:65: note: expanded from macro '_dynamic_func_call_cls'
     248 |         __dynamic_func_call_cls(__UNIQUE_ID(ddebug), cls, fmt, func, ##__VA_ARGS__)
         |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
   include/linux/dynamic_debug.h:224:15: note: expanded from macro '__dynamic_func_call_cls'
     224 |                 func(&id, ##__VA_ARGS__);                       \
         |                             ^~~~~~~~~~~
   drivers/clocksource/timer-rtl-otto.c:151:2: warning: cast to smaller integer type 'u32' (aka 'unsigned int') from 'void *' [-Wvoid-pointer-to-int-cast]
     151 |         RTTM_DEBUG(to->of_base.base);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/clocksource/timer-rtl-otto.c:97:24: note: expanded from macro 'RTTM_DEBUG'
      96 |         pr_debug("------------- %d %08x\n",     \
         |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      97 |                  smp_processor_id(), (u32)base)
         |                  ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
   include/linux/printk.h:588:26: note: expanded from macro 'pr_debug'
     588 |         dynamic_pr_debug(fmt, ##__VA_ARGS__)
         |         ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
   include/linux/dynamic_debug.h:270:22: note: expanded from macro 'dynamic_pr_debug'
     269 |         _dynamic_func_call(fmt, __dynamic_pr_debug,             \
         |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     270 |                            pr_fmt(fmt), ##__VA_ARGS__)
         |                            ~~~~~~~~~~~~~~~^~~~~~~~~~~~
   include/linux/dynamic_debug.h:250:59: note: expanded from macro '_dynamic_func_call'
     250 |         _dynamic_func_call_cls(_DPRINTK_CLASS_DFLT, fmt, func, ##__VA_ARGS__)
         |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
   include/linux/dynamic_debug.h:248:65: note: expanded from macro '_dynamic_func_call_cls'
     248 |         __dynamic_func_call_cls(__UNIQUE_ID(ddebug), cls, fmt, func, ##__VA_ARGS__)
         |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
   include/linux/dynamic_debug.h:224:15: note: expanded from macro '__dynamic_func_call_cls'
     224 |                 func(&id, ##__VA_ARGS__);                       \
         |                             ^~~~~~~~~~~
   drivers/clocksource/timer-rtl-otto.c:163:2: warning: cast to smaller integer type 'u32' (aka 'unsigned int') from 'void *' [-Wvoid-pointer-to-int-cast]


vim +105 drivers/clocksource/timer-rtl-otto.c

    93	
    94	/* Aggregated control functions for kernel clock framework */
    95	#define RTTM_DEBUG(base)			\
    96		pr_debug("------------- %d %08x\n",	\
    97			 smp_processor_id(), (u32)base)
    98	
    99	static irqreturn_t rttm_timer_interrupt(int irq, void *dev_id)
   100	{
   101		struct clock_event_device *clkevt = dev_id;
   102		struct timer_of *to = to_timer_of(clkevt);
   103	
   104		rttm_ack_irq(to->of_base.base);
 > 105		RTTM_DEBUG(to->of_base.base);
   106		clkevt->event_handler(clkevt);
   107	
   108		return IRQ_HANDLED;
   109	}
   110	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

end of thread, other threads:[~2024-06-26 12:09 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-21  4:27 [PATCH 0/6] mips: Support for RTL9302C Chris Packham
2024-06-21  4:27 ` [PATCH 1/6] dt-bindings: mips: realtek: Add rtl930x-soc compatible Chris Packham
2024-06-22 12:15   ` Conor Dooley
2024-06-23  7:12   ` Krzysztof Kozlowski
2024-06-21  4:27 ` [PATCH 2/6] dt-bindings: timer: Add schema for realtek,otto-timer Chris Packham
2024-06-22 12:11   ` Conor Dooley
2024-06-23 21:23     ` Chris Packham
2024-06-24 16:34       ` Conor Dooley
2024-06-23  7:19   ` Krzysztof Kozlowski
2024-06-21  4:27 ` [PATCH 3/6] dt-bindings: interrupt-controller: realtek,rtl-intc: Add rtl9300-intc Chris Packham
2024-06-22 12:08   ` Conor Dooley
2024-06-23  7:12   ` Krzysztof Kozlowski
2024-06-21  4:27 ` [PATCH 4/6] clocksource: realtek: Add timer driver for rtl-otto platforms Chris Packham
2024-06-23  7:13   ` Krzysztof Kozlowski
2024-06-26  2:01   ` kernel test robot
2024-06-26 11:32   ` kernel test robot
2024-06-26 12:08   ` kernel test robot
2024-06-21  4:27 ` [PATCH 5/6] mips: generic: add fdt fixup for Realtek reference board Chris Packham
2024-06-21  4:27 ` [PATCH 6/6] mips: dts: realtek: Add RTL9302C board Chris Packham
2024-06-23  7:15   ` Krzysztof Kozlowski

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).