* [PATCH v2 1/8] mips: dts: realtek: use "serial" instead of "uart" in node name
2024-06-24 1:22 [PATCH v2 0/8] mips: Support for RTL9302C Chris Packham
@ 2024-06-24 1:22 ` Chris Packham
2024-06-24 1:22 ` [PATCH v2 2/8] mips: dts: realtek: add device_type property to cpu node Chris Packham
` (6 subsequent siblings)
7 siblings, 0 replies; 20+ messages in thread
From: Chris Packham @ 2024-06-24 1:22 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
Update the node name for the UARTs to resolve the following dtbs_check
complaints:
uart@2000: $nodename:0: 'uart@2000' does not match '^serial(@.*)?$'
uart@2100: $nodename:0: 'uart@2100' does not match '^serial(@.*)?$'
Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
---
Notes:
Changes in v2:
- New
arch/mips/boot/dts/realtek/rtl83xx.dtsi | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/mips/boot/dts/realtek/rtl83xx.dtsi b/arch/mips/boot/dts/realtek/rtl83xx.dtsi
index de65a111b626..03ddc61f7c9e 100644
--- a/arch/mips/boot/dts/realtek/rtl83xx.dtsi
+++ b/arch/mips/boot/dts/realtek/rtl83xx.dtsi
@@ -22,7 +22,7 @@ soc: soc {
#size-cells = <1>;
ranges = <0x0 0x18000000 0x10000>;
- uart0: uart@2000 {
+ uart0: serial@2000 {
compatible = "ns16550a";
reg = <0x2000 0x100>;
@@ -39,7 +39,7 @@ uart0: uart@2000 {
status = "disabled";
};
- uart1: uart@2100 {
+ uart1: serial@2100 {
compatible = "ns16550a";
reg = <0x2100 0x100>;
--
2.45.2
^ permalink raw reply related [flat|nested] 20+ messages in thread* [PATCH v2 2/8] mips: dts: realtek: add device_type property to cpu node
2024-06-24 1:22 [PATCH v2 0/8] mips: Support for RTL9302C Chris Packham
2024-06-24 1:22 ` [PATCH v2 1/8] mips: dts: realtek: use "serial" instead of "uart" in node name Chris Packham
@ 2024-06-24 1:22 ` Chris Packham
2024-06-24 1:22 ` [PATCH v2 3/8] dt-bindings: mips: realtek: Add rtl930x-soc compatible Chris Packham
` (5 subsequent siblings)
7 siblings, 0 replies; 20+ messages in thread
From: Chris Packham @ 2024-06-24 1:22 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 device_type = "cpu" to the cpu node for the rtl838x SoC. This
resolves the following dtbs_check complaint:
cpus: cpu@0: 'cache-level' is a required property
Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
---
Notes:
Changes in v2:
- New
arch/mips/boot/dts/realtek/rtl838x.dtsi | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/mips/boot/dts/realtek/rtl838x.dtsi b/arch/mips/boot/dts/realtek/rtl838x.dtsi
index 6cc4ff5c0d19..722106e39194 100644
--- a/arch/mips/boot/dts/realtek/rtl838x.dtsi
+++ b/arch/mips/boot/dts/realtek/rtl838x.dtsi
@@ -6,6 +6,7 @@ cpus {
#size-cells = <0>;
cpu@0 {
+ device_type = "cpu";
compatible = "mips,mips4KEc";
reg = <0>;
clocks = <&baseclk 0>;
--
2.45.2
^ permalink raw reply related [flat|nested] 20+ messages in thread* [PATCH v2 3/8] dt-bindings: mips: realtek: Add rtl930x-soc compatible
2024-06-24 1:22 [PATCH v2 0/8] mips: Support for RTL9302C Chris Packham
2024-06-24 1:22 ` [PATCH v2 1/8] mips: dts: realtek: use "serial" instead of "uart" in node name Chris Packham
2024-06-24 1:22 ` [PATCH v2 2/8] mips: dts: realtek: add device_type property to cpu node Chris Packham
@ 2024-06-24 1:22 ` Chris Packham
2024-06-24 4:48 ` Krzysztof Kozlowski
2024-06-24 1:22 ` [PATCH v2 4/8] dt-bindings: timer: Add schema for realtek,otto-timer Chris Packham
` (4 subsequent siblings)
7 siblings, 1 reply; 20+ messages in thread
From: Chris Packham @ 2024-06-24 1:22 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>
---
Notes:
Changes in v2:
- Use specific compatible for rtl9302-soc
- Fix to allow correct board, soc compatible
Documentation/devicetree/bindings/mips/realtek-rtl.yaml | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/Documentation/devicetree/bindings/mips/realtek-rtl.yaml b/Documentation/devicetree/bindings/mips/realtek-rtl.yaml
index f8ac309d2994..05daa53417e5 100644
--- a/Documentation/devicetree/bindings/mips/realtek-rtl.yaml
+++ b/Documentation/devicetree/bindings/mips/realtek-rtl.yaml
@@ -20,5 +20,9 @@ properties:
- enum:
- cisco,sg220-26
- const: realtek,rtl8382-soc
+ - items:
+ - enum:
+ - realtek,rtl9302c
+ - const: realtek,rtl9302-soc
additionalProperties: true
--
2.45.2
^ permalink raw reply related [flat|nested] 20+ messages in thread* Re: [PATCH v2 3/8] dt-bindings: mips: realtek: Add rtl930x-soc compatible
2024-06-24 1:22 ` [PATCH v2 3/8] dt-bindings: mips: realtek: Add rtl930x-soc compatible Chris Packham
@ 2024-06-24 4:48 ` Krzysztof Kozlowski
2024-06-24 5:00 ` Chris Packham
0 siblings, 1 reply; 20+ messages in thread
From: Krzysztof Kozlowski @ 2024-06-24 4:48 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 24/06/2024 03:22, Chris Packham wrote:
> Add the rtl930x-soc and RTL9302C board to the list of Realtek compatible
930x or 9302?
> strings.
>
> Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
> ---
>
> Notes:
> Changes in v2:
> - Use specific compatible for rtl9302-soc
> - Fix to allow correct board, soc compatible
>
> Documentation/devicetree/bindings/mips/realtek-rtl.yaml | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/mips/realtek-rtl.yaml b/Documentation/devicetree/bindings/mips/realtek-rtl.yaml
> index f8ac309d2994..05daa53417e5 100644
> --- a/Documentation/devicetree/bindings/mips/realtek-rtl.yaml
> +++ b/Documentation/devicetree/bindings/mips/realtek-rtl.yaml
> @@ -20,5 +20,9 @@ properties:
> - enum:
> - cisco,sg220-26
> - const: realtek,rtl8382-soc
> + - items:
> + - enum:
> + - realtek,rtl9302c
Why board has the name of SoC?
> + - const: realtek,rtl9302-soc
Drop the -soc suffix. The rtl9302 is the soc.
>
> additionalProperties: true
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v2 3/8] dt-bindings: mips: realtek: Add rtl930x-soc compatible
2024-06-24 4:48 ` Krzysztof Kozlowski
@ 2024-06-24 5:00 ` Chris Packham
2024-06-26 7:12 ` Krzysztof Kozlowski
0 siblings, 1 reply; 20+ messages in thread
From: Chris Packham @ 2024-06-24 5:00 UTC (permalink / raw)
To: Krzysztof Kozlowski, 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
Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
linux-mips@vger.kernel.org, kabel@kernel.org, ericwouds@gmail.com
Hi Krzysztof,
On 24/06/24 16:48, Krzysztof Kozlowski wrote:
> On 24/06/2024 03:22, Chris Packham wrote:
>> Add the rtl930x-soc and RTL9302C board to the list of Realtek compatible
> 930x or 9302?
Oops. Will fix.
>> strings.
>>
>> Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
>> ---
>>
>> Notes:
>> Changes in v2:
>> - Use specific compatible for rtl9302-soc
>> - Fix to allow correct board, soc compatible
>>
>> Documentation/devicetree/bindings/mips/realtek-rtl.yaml | 4 ++++
>> 1 file changed, 4 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/mips/realtek-rtl.yaml b/Documentation/devicetree/bindings/mips/realtek-rtl.yaml
>> index f8ac309d2994..05daa53417e5 100644
>> --- a/Documentation/devicetree/bindings/mips/realtek-rtl.yaml
>> +++ b/Documentation/devicetree/bindings/mips/realtek-rtl.yaml
>> @@ -20,5 +20,9 @@ properties:
>> - enum:
>> - cisco,sg220-26
>> - const: realtek,rtl8382-soc
>> + - items:
>> + - enum:
>> + - realtek,rtl9302c
> Why board has the name of SoC?
What I have is actually a reference board with the name
RTL9302C_2xRTL8224_2XGE. If found that a bit incomprehensible so I
(over) shortened it. Technically it would be something like
cameo,rtl9302c-2x-rtl8224-2xge which I can include in the next round.
>> + - const: realtek,rtl9302-soc
> Drop the -soc suffix. The rtl9302 is the soc.
On that. I hope to eventually add "realtek,rtl9302-switch" for the DSA
switch block in the same chip. So keeping the -soc suffix was
intentional to try to disambiguate things. I can drop the -soc if the
consensus is that there is no need to disambiguate the two.
>>
>> additionalProperties: true
> Best regards,
> Krzysztof
>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v2 3/8] dt-bindings: mips: realtek: Add rtl930x-soc compatible
2024-06-24 5:00 ` Chris Packham
@ 2024-06-26 7:12 ` Krzysztof Kozlowski
2024-06-26 21:01 ` Chris Packham
0 siblings, 1 reply; 20+ messages in thread
From: Krzysztof Kozlowski @ 2024-06-26 7:12 UTC (permalink / raw)
To: Chris Packham, 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
Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
linux-mips@vger.kernel.org, kabel@kernel.org, ericwouds@gmail.com
On 24/06/2024 07:00, Chris Packham wrote:
> Hi Krzysztof,
>
> On 24/06/24 16:48, Krzysztof Kozlowski wrote:
>> On 24/06/2024 03:22, Chris Packham wrote:
>>> Add the rtl930x-soc and RTL9302C board to the list of Realtek compatible
>> 930x or 9302?
>
> Oops. Will fix.
>
>>> strings.
>>>
>>> Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
>>> ---
>>>
>>> Notes:
>>> Changes in v2:
>>> - Use specific compatible for rtl9302-soc
>>> - Fix to allow correct board, soc compatible
>>>
>>> Documentation/devicetree/bindings/mips/realtek-rtl.yaml | 4 ++++
>>> 1 file changed, 4 insertions(+)
>>>
>>> diff --git a/Documentation/devicetree/bindings/mips/realtek-rtl.yaml b/Documentation/devicetree/bindings/mips/realtek-rtl.yaml
>>> index f8ac309d2994..05daa53417e5 100644
>>> --- a/Documentation/devicetree/bindings/mips/realtek-rtl.yaml
>>> +++ b/Documentation/devicetree/bindings/mips/realtek-rtl.yaml
>>> @@ -20,5 +20,9 @@ properties:
>>> - enum:
>>> - cisco,sg220-26
>>> - const: realtek,rtl8382-soc
>>> + - items:
>>> + - enum:
>>> + - realtek,rtl9302c
>> Why board has the name of SoC?
>
> What I have is actually a reference board with the name
> RTL9302C_2xRTL8224_2XGE. If found that a bit incomprehensible so I
> (over) shortened it. Technically it would be something like
> cameo,rtl9302c-2x-rtl8224-2xge which I can include in the next round.
Looks fine to me.
>
>>> + - const: realtek,rtl9302-soc
>> Drop the -soc suffix. The rtl9302 is the soc.
>
> On that. I hope to eventually add "realtek,rtl9302-switch" for the DSA
> switch block in the same chip. So keeping the -soc suffix was
> intentional to try to disambiguate things. I can drop the -soc if the
> consensus is that there is no need to disambiguate the two.
Thanks for explanation, kind of depends on what exactly is this. Most of
SoCs comprise of several items. The entire chip is the soc, e.g.
"qcom,foo1234". It might have MAC/Ethernet/whatever inside, controllable
by the SoC (Linux, bootloader, TF, hypervisor, other VM guest) and that
part is "qcom,foo1234-ethernet". Regardless whether Linux OS actually
controls it or not.
The question is whether DSA switch is part of the SoC or not.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v2 3/8] dt-bindings: mips: realtek: Add rtl930x-soc compatible
2024-06-26 7:12 ` Krzysztof Kozlowski
@ 2024-06-26 21:01 ` Chris Packham
2024-06-27 6:59 ` Krzysztof Kozlowski
0 siblings, 1 reply; 20+ messages in thread
From: Chris Packham @ 2024-06-26 21:01 UTC (permalink / raw)
To: Krzysztof Kozlowski, 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
Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
linux-mips@vger.kernel.org, kabel@kernel.org, ericwouds@gmail.com
On 26/06/24 19:12, Krzysztof Kozlowski wrote:
> On 24/06/2024 07:00, Chris Packham wrote:
>> Hi Krzysztof,
>>
>> On 24/06/24 16:48, Krzysztof Kozlowski wrote:
>>> On 24/06/2024 03:22, Chris Packham wrote:
>>>> Add the rtl930x-soc and RTL9302C board to the list of Realtek compatible
>>> 930x or 9302?
>> Oops. Will fix.
>>
>>>> strings.
>>>>
>>>> Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
>>>> ---
>>>>
>>>> Notes:
>>>> Changes in v2:
>>>> - Use specific compatible for rtl9302-soc
>>>> - Fix to allow correct board, soc compatible
>>>>
>>>> Documentation/devicetree/bindings/mips/realtek-rtl.yaml | 4 ++++
>>>> 1 file changed, 4 insertions(+)
>>>>
>>>> diff --git a/Documentation/devicetree/bindings/mips/realtek-rtl.yaml b/Documentation/devicetree/bindings/mips/realtek-rtl.yaml
>>>> index f8ac309d2994..05daa53417e5 100644
>>>> --- a/Documentation/devicetree/bindings/mips/realtek-rtl.yaml
>>>> +++ b/Documentation/devicetree/bindings/mips/realtek-rtl.yaml
>>>> @@ -20,5 +20,9 @@ properties:
>>>> - enum:
>>>> - cisco,sg220-26
>>>> - const: realtek,rtl8382-soc
>>>> + - items:
>>>> + - enum:
>>>> + - realtek,rtl9302c
>>> Why board has the name of SoC?
>> What I have is actually a reference board with the name
>> RTL9302C_2xRTL8224_2XGE. If found that a bit incomprehensible so I
>> (over) shortened it. Technically it would be something like
>> cameo,rtl9302c-2x-rtl8224-2xge which I can include in the next round.
> Looks fine to me.
>
>>>> + - const: realtek,rtl9302-soc
>>> Drop the -soc suffix. The rtl9302 is the soc.
>> On that. I hope to eventually add "realtek,rtl9302-switch" for the DSA
>> switch block in the same chip. So keeping the -soc suffix was
>> intentional to try to disambiguate things. I can drop the -soc if the
>> consensus is that there is no need to disambiguate the two.
> Thanks for explanation, kind of depends on what exactly is this. Most of
> SoCs comprise of several items. The entire chip is the soc, e.g.
> "qcom,foo1234". It might have MAC/Ethernet/whatever inside, controllable
> by the SoC (Linux, bootloader, TF, hypervisor, other VM guest) and that
> part is "qcom,foo1234-ethernet". Regardless whether Linux OS actually
> controls it or not.
>
> The question is whether DSA switch is part of the SoC or not.
The RTL9302C is a single package but I'd assume internally it has
multiple dies.
From the block diagram in the datasheet they do have a portion they
call the "SoC" which has the CPU and peripherals like UARTs, GPIOs, SPI
etc. That is separate from the switch block which has a bunch of MACs,
SERDES and various network switch tables. So based on that
"realtek,rtl9302-soc" and "realtek,rtl9302-switch" as two separate
things make sense to me.
I'm still trying to figure out a bit more of the details. The block
diagram looks a lot like you'd expect to see with a traditional DSA
switch where you have a SoC Ethernet NIC/MAC connected to one port of a
switch. But getting into the datasheet it looks like what they call the
NIC is actually just the DMA portion of the switch as the registers are
all in that second block. As is the MDIO interface. I'm considering that
maybe the DSA model isn't right for this and I should be looking at
switchdev instead.
>
> Best regards,
> Krzysztof
>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v2 3/8] dt-bindings: mips: realtek: Add rtl930x-soc compatible
2024-06-26 21:01 ` Chris Packham
@ 2024-06-27 6:59 ` Krzysztof Kozlowski
0 siblings, 0 replies; 20+ messages in thread
From: Krzysztof Kozlowski @ 2024-06-27 6:59 UTC (permalink / raw)
To: Chris Packham, 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
Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
linux-mips@vger.kernel.org, kabel@kernel.org, ericwouds@gmail.com
On 26/06/2024 23:01, Chris Packham wrote:
>>>>> + - realtek,rtl9302c
>>>> Why board has the name of SoC?
>>> What I have is actually a reference board with the name
>>> RTL9302C_2xRTL8224_2XGE. If found that a bit incomprehensible so I
>>> (over) shortened it. Technically it would be something like
>>> cameo,rtl9302c-2x-rtl8224-2xge which I can include in the next round.
>> Looks fine to me.
>>
>>>>> + - const: realtek,rtl9302-soc
>>>> Drop the -soc suffix. The rtl9302 is the soc.
>>> On that. I hope to eventually add "realtek,rtl9302-switch" for the DSA
>>> switch block in the same chip. So keeping the -soc suffix was
>>> intentional to try to disambiguate things. I can drop the -soc if the
>>> consensus is that there is no need to disambiguate the two.
>> Thanks for explanation, kind of depends on what exactly is this. Most of
>> SoCs comprise of several items. The entire chip is the soc, e.g.
>> "qcom,foo1234". It might have MAC/Ethernet/whatever inside, controllable
>> by the SoC (Linux, bootloader, TF, hypervisor, other VM guest) and that
>> part is "qcom,foo1234-ethernet". Regardless whether Linux OS actually
>> controls it or not.
>>
>> The question is whether DSA switch is part of the SoC or not.
>
> The RTL9302C is a single package but I'd assume internally it has
> multiple dies.
>
> From the block diagram in the datasheet they do have a portion they
> call the "SoC" which has the CPU and peripherals like UARTs, GPIOs, SPI
> etc. That is separate from the switch block which has a bunch of MACs,
> SERDES and various network switch tables. So based on that
> "realtek,rtl9302-soc" and "realtek,rtl9302-switch" as two separate
> things make sense to me.
>
OK, -soc and -switch are fine with me.
> I'm still trying to figure out a bit more of the details. The block
> diagram looks a lot like you'd expect to see with a traditional DSA
> switch where you have a SoC Ethernet NIC/MAC connected to one port of a
> switch. But getting into the datasheet it looks like what they call the
> NIC is actually just the DMA portion of the switch as the registers are
> all in that second block. As is the MDIO interface. I'm considering that
> maybe the DSA model isn't right for this and I should be looking at
> switchdev instead.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH v2 4/8] dt-bindings: timer: Add schema for realtek,otto-timer
2024-06-24 1:22 [PATCH v2 0/8] mips: Support for RTL9302C Chris Packham
` (2 preceding siblings ...)
2024-06-24 1:22 ` [PATCH v2 3/8] dt-bindings: mips: realtek: Add rtl930x-soc compatible Chris Packham
@ 2024-06-24 1:22 ` Chris Packham
2024-06-24 4:49 ` Krzysztof Kozlowski
2024-06-24 1:22 ` [PATCH v2 5/8] dt-bindings: interrupt-controller: realtek,rtl-intc: Add rtl9300-intc Chris Packham
` (3 subsequent siblings)
7 siblings, 1 reply; 20+ messages in thread
From: Chris Packham @ 2024-06-24 1:22 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>
---
Notes:
Changes in v2:
- Use specific compatible
- Remove unnecessary label
- Remove unused irq flags (interrupt controller is one-cell)
- Set minItems for reg and interrupts based on compatible
.../bindings/timer/realtek,otto-timer.yaml | 66 +++++++++++++++++++
1 file changed, 66 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..13ea7aa946fe
--- /dev/null
+++ b/Documentation/devicetree/bindings/timer/realtek,otto-timer.yaml
@@ -0,0 +1,66 @@
+# 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,rtl9302-timer
+ - const: realtek,otto-timer
+
+ reg:
+ maxItems: 5
+
+ clocks:
+ maxItems: 1
+
+ interrupts:
+ maxItems: 5
+
+allOf:
+ - if:
+ properties:
+ compatible:
+ contains:
+ const: realtek,rtl9302-timer
+ then:
+ properties:
+ reg:
+ minItems: 2
+ interrupts:
+ minItems: 2
+
+required:
+ - compatible
+ - reg
+ - clocks
+ - interrupts
+
+additionalProperties: false
+
+examples:
+ - |
+ timer@3200 {
+ compatible = "realtek,rtl9302-timer", "realtek,otto-timer";
+ reg = <0x3200 0x10>, <0x3210 0x10>, <0x3220 0x10>,
+ <0x3230 0x10>, <0x3240 0x10>;
+
+ interrupt-parent = <&intc>;
+ interrupts = <7>, <8>, <9>, <10>, <11>;
+ clocks = <&lx_clk>;
+ };
--
2.45.2
^ permalink raw reply related [flat|nested] 20+ messages in thread* Re: [PATCH v2 4/8] dt-bindings: timer: Add schema for realtek,otto-timer
2024-06-24 1:22 ` [PATCH v2 4/8] dt-bindings: timer: Add schema for realtek,otto-timer Chris Packham
@ 2024-06-24 4:49 ` Krzysztof Kozlowski
2024-06-24 5:21 ` Chris Packham
0 siblings, 1 reply; 20+ messages in thread
From: Krzysztof Kozlowski @ 2024-06-24 4:49 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 24/06/2024 03:22, 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>
> ---
>
> Notes:
> Changes in v2:
> - Use specific compatible
Where? I do not see changes.
> - Remove unnecessary label
> - Remove unused irq flags (interrupt controller is one-cell)
> - Set minItems for reg and interrupts based on compatible
>
> .../bindings/timer/realtek,otto-timer.yaml | 66 +++++++++++++++++++
> 1 file changed, 66 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..13ea7aa946fe
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/timer/realtek,otto-timer.yaml
> @@ -0,0 +1,66 @@
> +# 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,rtl9302-timer
> + - const: realtek,otto-timer
> +
> + reg:
> + maxItems: 5
Nothing improved.
> +
> + clocks:
> + maxItems: 1
> +
> + interrupts:
> + maxItems: 5
Nothing improved.
> +
> +allOf:
> + - if:
> + properties:
> + compatible:
> + contains:
> + const: realtek,rtl9302-timer
> + then:
> + properties:
> + reg:
> + minItems: 2
> + interrupts:
> + minItems: 2
No, that's just incorrect. You do not have more than one variant, so it
is just 2 items. Or 5 items, not 2-5.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v2 4/8] dt-bindings: timer: Add schema for realtek,otto-timer
2024-06-24 4:49 ` Krzysztof Kozlowski
@ 2024-06-24 5:21 ` Chris Packham
2024-06-26 7:13 ` Krzysztof Kozlowski
0 siblings, 1 reply; 20+ messages in thread
From: Chris Packham @ 2024-06-24 5:21 UTC (permalink / raw)
To: Krzysztof Kozlowski, 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
Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
linux-mips@vger.kernel.org, kabel@kernel.org, ericwouds@gmail.com
On 24/06/24 16:49, Krzysztof Kozlowski wrote:
> On 24/06/2024 03:22, 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>
>> ---
>>
>> Notes:
>> Changes in v2:
>> - Use specific compatible
> Where? I do not see changes.
In v1 it was rtl930x-timer, I've updated it to rtl9302-timer
>> - Remove unnecessary label
>> - Remove unused irq flags (interrupt controller is one-cell)
>> - Set minItems for reg and interrupts based on compatible
>>
>> .../bindings/timer/realtek,otto-timer.yaml | 66 +++++++++++++++++++
>> 1 file changed, 66 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..13ea7aa946fe
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/timer/realtek,otto-timer.yaml
>> @@ -0,0 +1,66 @@
>> +# 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,rtl9302-timer
>> + - const: realtek,otto-timer
>> +
>> + reg:
>> + maxItems: 5
> Nothing improved.
>
>> +
>> + clocks:
>> + maxItems: 1
>> +
>> + interrupts:
>> + maxItems: 5
> Nothing improved.
>
>> +
>> +allOf:
>> + - if:
>> + properties:
>> + compatible:
>> + contains:
>> + const: realtek,rtl9302-timer
>> + then:
>> + properties:
>> + reg:
>> + minItems: 2
>> + interrupts:
>> + minItems: 2
> No, that's just incorrect. You do not have more than one variant, so it
> is just 2 items. Or 5 items, not 2-5.
I've been told in the past that the device-tree should describe the
hardware. Which in this case has 5 timers. But I'm also told to give
them names which I struggle to do because some of them aren't used.
So do you want something like this:
clocks:
items:
- description: CPU0 event clock
- description: system clock source
- description: unused
- description: unused
- description: unused
interrupts:
items:
- description: CPU0 event clock interrupt
- description: system clock source interrupt
- description: unused
- description: unused
- description: unused
>
>
> Best regards,
> Krzysztof
>
>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v2 4/8] dt-bindings: timer: Add schema for realtek,otto-timer
2024-06-24 5:21 ` Chris Packham
@ 2024-06-26 7:13 ` Krzysztof Kozlowski
2024-06-26 21:07 ` Chris Packham
0 siblings, 1 reply; 20+ messages in thread
From: Krzysztof Kozlowski @ 2024-06-26 7:13 UTC (permalink / raw)
To: Chris Packham, 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
Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
linux-mips@vger.kernel.org, kabel@kernel.org, ericwouds@gmail.com
On 24/06/2024 07:21, Chris Packham wrote:
>
> On 24/06/24 16:49, Krzysztof Kozlowski wrote:
>> On 24/06/2024 03:22, 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>
>>> ---
>>>
>>> Notes:
>>> Changes in v2:
>>> - Use specific compatible
>> Where? I do not see changes.
>
> In v1 it was rtl930x-timer, I've updated it to rtl9302-timer
Ah, I thought you wanted to switch from generic fallback to specific
compatible... fine.
>
>>> - Remove unnecessary label
>>> - Remove unused irq flags (interrupt controller is one-cell)
>>> - Set minItems for reg and interrupts based on compatible
>>>
>>> .../bindings/timer/realtek,otto-timer.yaml | 66 +++++++++++++++++++
>>> 1 file changed, 66 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..13ea7aa946fe
>>> --- /dev/null
>>> +++ b/Documentation/devicetree/bindings/timer/realtek,otto-timer.yaml
>>> @@ -0,0 +1,66 @@
>>> +# 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,rtl9302-timer
>>> + - const: realtek,otto-timer
>>> +
>>> + reg:
>>> + maxItems: 5
>> Nothing improved.
>>
>>> +
>>> + clocks:
>>> + maxItems: 1
>>> +
>>> + interrupts:
>>> + maxItems: 5
>> Nothing improved.
>>
>>> +
>>> +allOf:
>>> + - if:
>>> + properties:
>>> + compatible:
>>> + contains:
>>> + const: realtek,rtl9302-timer
>>> + then:
>>> + properties:
>>> + reg:
>>> + minItems: 2
>>> + interrupts:
>>> + minItems: 2
>> No, that's just incorrect. You do not have more than one variant, so it
>> is just 2 items. Or 5 items, not 2-5.
>
> I've been told in the past that the device-tree should describe the
> hardware. Which in this case has 5 timers. But I'm also told to give
> them names which I struggle to do because some of them aren't used.
Used as in Linux driver? Does not matter.
>
> So do you want something like this:
>
> clocks:
> items:
> - description: CPU0 event clock
> - description: system clock source
> - description: unused
> - description: unused
> - description: unused
No, if your datasheet or any other source of information (e.g.
downstream sources) mention 5 items, then name properly 5 items.
Otherwise how do you know that there are 5, not 2, clocks/interrupts/reg?
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v2 4/8] dt-bindings: timer: Add schema for realtek,otto-timer
2024-06-26 7:13 ` Krzysztof Kozlowski
@ 2024-06-26 21:07 ` Chris Packham
0 siblings, 0 replies; 20+ messages in thread
From: Chris Packham @ 2024-06-26 21:07 UTC (permalink / raw)
To: Krzysztof Kozlowski, 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
Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
linux-mips@vger.kernel.org, kabel@kernel.org, ericwouds@gmail.com
On 26/06/24 19:13, Krzysztof Kozlowski wrote:
> On 24/06/2024 07:21, Chris Packham wrote:
>> On 24/06/24 16:49, Krzysztof Kozlowski wrote:
>>> On 24/06/2024 03:22, 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>
>>>> ---
>>>>
>>>> Notes:
>>>> Changes in v2:
>>>> - Use specific compatible
>>> Where? I do not see changes.
>> In v1 it was rtl930x-timer, I've updated it to rtl9302-timer
> Ah, I thought you wanted to switch from generic fallback to specific
> compatible... fine.
>
>>>> - Remove unnecessary label
>>>> - Remove unused irq flags (interrupt controller is one-cell)
>>>> - Set minItems for reg and interrupts based on compatible
>>>>
>>>> .../bindings/timer/realtek,otto-timer.yaml | 66 +++++++++++++++++++
>>>> 1 file changed, 66 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..13ea7aa946fe
>>>> --- /dev/null
>>>> +++ b/Documentation/devicetree/bindings/timer/realtek,otto-timer.yaml
>>>> @@ -0,0 +1,66 @@
>>>> +# 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,rtl9302-timer
>>>> + - const: realtek,otto-timer
>>>> +
>>>> + reg:
>>>> + maxItems: 5
>>> Nothing improved.
>>>
>>>> +
>>>> + clocks:
>>>> + maxItems: 1
>>>> +
>>>> + interrupts:
>>>> + maxItems: 5
>>> Nothing improved.
>>>
>>>> +
>>>> +allOf:
>>>> + - if:
>>>> + properties:
>>>> + compatible:
>>>> + contains:
>>>> + const: realtek,rtl9302-timer
>>>> + then:
>>>> + properties:
>>>> + reg:
>>>> + minItems: 2
>>>> + interrupts:
>>>> + minItems: 2
>>> No, that's just incorrect. You do not have more than one variant, so it
>>> is just 2 items. Or 5 items, not 2-5.
>> I've been told in the past that the device-tree should describe the
>> hardware. Which in this case has 5 timers. But I'm also told to give
>> them names which I struggle to do because some of them aren't used.
> Used as in Linux driver? Does not matter.
>
>> So do you want something like this:
>>
>> clocks:
>> items:
>> - description: CPU0 event clock
>> - description: system clock source
>> - description: unused
>> - description: unused
>> - description: unused
> No, if your datasheet or any other source of information (e.g.
> downstream sources) mention 5 items, then name properly 5 items.
> Otherwise how do you know that there are 5, not 2, clocks/interrupts/reg?
So just timer0, timer2, ... timer5?
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH v2 5/8] dt-bindings: interrupt-controller: realtek,rtl-intc: Add rtl9300-intc
2024-06-24 1:22 [PATCH v2 0/8] mips: Support for RTL9302C Chris Packham
` (3 preceding siblings ...)
2024-06-24 1:22 ` [PATCH v2 4/8] dt-bindings: timer: Add schema for realtek,otto-timer Chris Packham
@ 2024-06-24 1:22 ` Chris Packham
2024-06-24 4:50 ` Krzysztof Kozlowski
2024-06-24 1:22 ` [PATCH v2 6/8] clocksource: realtek: Add timer driver for rtl-otto platforms Chris Packham
` (2 subsequent siblings)
7 siblings, 1 reply; 20+ messages in thread
From: Chris Packham @ 2024-06-24 1:22 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. The interrupt controller has registers for VPE1 so these
are added as a second reg cell.
Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
---
Notes:
Changes in v2:
- Set reg:maxItems to 2 to allow for VPE1 registers on the rtl9300. Add
a condition to enforce the old limit on other SoCs.
- Connor and Krzysztof offered acks on v1 but I think the changes here
are big enough to void those.
.../interrupt-controller/realtek,rtl-intc.yaml | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/interrupt-controller/realtek,rtl-intc.yaml b/Documentation/devicetree/bindings/interrupt-controller/realtek,rtl-intc.yaml
index fb5593724059..ff2f2acea87e 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
@@ -35,7 +36,8 @@ properties:
const: 1
reg:
- maxItems: 1
+ minItems: 1
+ maxItems: 2
interrupts:
minItems: 1
@@ -71,6 +73,19 @@ allOf:
else:
required:
- interrupts
+ - if:
+ properties:
+ compatible:
+ contains:
+ const: realtek,rtl9300-intc
+ then:
+ properties:
+ reg:
+ maxItems: 2
+ else:
+ properties:
+ reg:
+ maxItems: 1
additionalProperties: false
--
2.45.2
^ permalink raw reply related [flat|nested] 20+ messages in thread* Re: [PATCH v2 5/8] dt-bindings: interrupt-controller: realtek,rtl-intc: Add rtl9300-intc
2024-06-24 1:22 ` [PATCH v2 5/8] dt-bindings: interrupt-controller: realtek,rtl-intc: Add rtl9300-intc Chris Packham
@ 2024-06-24 4:50 ` Krzysztof Kozlowski
0 siblings, 0 replies; 20+ messages in thread
From: Krzysztof Kozlowski @ 2024-06-24 4:50 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 24/06/2024 03:22, Chris Packham wrote:
> Add a compatible string for the interrupt controller found on the
> rtl930x SoCs. The interrupt controller has registers for VPE1 so these
> are added as a second reg cell.
>
> Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
> ---
>
> Notes:
> Changes in v2:
> - Set reg:maxItems to 2 to allow for VPE1 registers on the rtl9300. Add
> a condition to enforce the old limit on other SoCs.
> - Connor and Krzysztof offered acks on v1 but I think the changes here
> are big enough to void those.
>
> .../interrupt-controller/realtek,rtl-intc.yaml | 17 ++++++++++++++++-
> 1 file changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/devicetree/bindings/interrupt-controller/realtek,rtl-intc.yaml b/Documentation/devicetree/bindings/interrupt-controller/realtek,rtl-intc.yaml
> index fb5593724059..ff2f2acea87e 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
> @@ -35,7 +36,8 @@ properties:
> const: 1
>
> reg:
> - maxItems: 1
> + minItems: 1
> + maxItems: 2
>
> interrupts:
> minItems: 1
> @@ -71,6 +73,19 @@ allOf:
> else:
> required:
> - interrupts
> + - if:
> + properties:
> + compatible:
> + contains:
> + const: realtek,rtl9300-intc
> + then:
> + properties:
> + reg:
> + maxItems: 2
Just like in v1. You need to describe the items.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH v2 6/8] clocksource: realtek: Add timer driver for rtl-otto platforms
2024-06-24 1:22 [PATCH v2 0/8] mips: Support for RTL9302C Chris Packham
` (4 preceding siblings ...)
2024-06-24 1:22 ` [PATCH v2 5/8] dt-bindings: interrupt-controller: realtek,rtl-intc: Add rtl9300-intc Chris Packham
@ 2024-06-24 1:22 ` Chris Packham
2024-06-26 21:22 ` kernel test robot
2024-06-24 1:22 ` [PATCH v2 7/8] mips: generic: add fdt fixup for Realtek reference board Chris Packham
2024-06-24 1:23 ` [PATCH v2 8/8] mips: dts: realtek: Add RTL9302C board Chris Packham
7 siblings, 1 reply; 20+ messages in thread
From: Chris Packham @ 2024-06-24 1:22 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* Re: [PATCH v2 6/8] clocksource: realtek: Add timer driver for rtl-otto platforms
2024-06-24 1:22 ` [PATCH v2 6/8] clocksource: realtek: Add timer driver for rtl-otto platforms Chris Packham
@ 2024-06-26 21:22 ` kernel test robot
0 siblings, 0 replies; 20+ messages in thread
From: kernel test robot @ 2024-06-26 21:22 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/mips-dts-realtek-use-serial-instead-of-uart-in-node-name/20240626-054938
base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
patch link: https://lore.kernel.org/r/20240624012300.1713290-7-chris.packham%40alliedtelesis.co.nz
patch subject: [PATCH v2 6/8] clocksource: realtek: Add timer driver for rtl-otto platforms
config: m68k-randconfig-r081-20240627 (https://download.01.org/0day-ci/archive/20240627/202406270511.czjiMAQk-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240627/202406270511.czjiMAQk-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/202406270511.czjiMAQk-lkp@intel.com/
All warnings (new ones prefixed by >>):
In file included from drivers/gpu/drm/tegra/hdmi.c:35:
>> drivers/gpu/drm/tegra/hdmi.h:122: warning: "ACR_ENABLE" redefined
122 | #define ACR_ENABLE (1 << 31)
|
In file included from arch/m68k/include/asm/m520xsim.h:19,
from arch/m68k/include/asm/mcfsim.h:24,
from arch/m68k/include/asm/io_no.h:35,
from arch/m68k/include/asm/io.h:6,
from include/linux/io.h:14,
from include/linux/irq.h:20,
from include/asm-generic/hardirq.h:17,
from ./arch/m68k/include/generated/asm/hardirq.h:1,
from include/linux/hardirq.h:11,
from include/linux/interrupt.h:11,
from include/linux/kernel_stat.h:9,
from include/linux/cgroup.h:26,
from include/linux/memcontrol.h:13,
from include/linux/swap.h:9,
from include/linux/suspend.h:5,
from include/linux/regulator/consumer.h:35,
from drivers/gpu/drm/tegra/hdmi.c:17:
arch/m68k/include/asm/m52xxacr.h:47: note: this is the location of the previous definition
47 | #define ACR_ENABLE 0x00008000 /* Enable this ACR */
|
Kconfig warnings: (for reference only)
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]
vim +/ACR_ENABLE +122 drivers/gpu/drm/tegra/hdmi.h
edec4af4c3d6d22 Thierry Reding 2012-11-15 119
edec4af4c3d6d22 Thierry Reding 2012-11-15 120 #define ACR_SUBPACK_CTS(x) (((x) & 0xffffff) << 8)
edec4af4c3d6d22 Thierry Reding 2012-11-15 121 #define ACR_SUBPACK_N(x) (((x) & 0xffffff) << 0)
edec4af4c3d6d22 Thierry Reding 2012-11-15 @122 #define ACR_ENABLE (1 << 31)
edec4af4c3d6d22 Thierry Reding 2012-11-15 123
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH v2 7/8] mips: generic: add fdt fixup for Realtek reference board
2024-06-24 1:22 [PATCH v2 0/8] mips: Support for RTL9302C Chris Packham
` (5 preceding siblings ...)
2024-06-24 1:22 ` [PATCH v2 6/8] clocksource: realtek: Add timer driver for rtl-otto platforms Chris Packham
@ 2024-06-24 1:22 ` Chris Packham
2024-06-24 1:23 ` [PATCH v2 8/8] mips: dts: realtek: Add RTL9302C board Chris Packham
7 siblings, 0 replies; 20+ messages in thread
From: Chris Packham @ 2024-06-24 1:22 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>
---
Notes:
Changes in v2:
- update compatible string
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..29234ab9bc64
--- /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,rtl9302-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 v2 8/8] mips: dts: realtek: Add RTL9302C board
2024-06-24 1:22 [PATCH v2 0/8] mips: Support for RTL9302C Chris Packham
` (6 preceding siblings ...)
2024-06-24 1:22 ` [PATCH v2 7/8] mips: generic: add fdt fixup for Realtek reference board Chris Packham
@ 2024-06-24 1:23 ` Chris Packham
7 siblings, 0 replies; 20+ messages in thread
From: Chris Packham @ 2024-06-24 1:23 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>
---
Notes:
Changes in v2:
- Use specific compatibles instead of rtl930x
- Remove unnecessary irq flags (interrupt controller is one-cell)
- Remove earlycon
- Name clocks as recommended in dt schema
arch/mips/boot/dts/realtek/Makefile | 1 +
arch/mips/boot/dts/realtek/rtl9302c.dts | 73 +++++++++++++++++++++++
arch/mips/boot/dts/realtek/rtl930x.dtsi | 79 +++++++++++++++++++++++++
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..8b991c6a5d6f 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..67adcc472da2
--- /dev/null
+++ b/arch/mips/boot/dts/realtek/rtl9302c.dts
@@ -0,0 +1,73 @@
+// 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,rtl9302-soc";
+ model = "RTL9302C Development Board";
+
+ memory@0 {
+ device_type = "memory";
+ reg = <0x0 0x8000000>;
+ };
+
+ chosen {
+ 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..f271940f82be
--- /dev/null
+++ b/arch/mips/boot/dts/realtek/rtl930x.dtsi
@@ -0,0 +1,79 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR BSD-2-Clause
+
+#include "rtl83xx.dtsi"
+
+/ {
+ compatible = "realtek,rtl9302-soc";
+
+ cpus {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ cpu@0 {
+ device_type = "cpu";
+ compatible = "mips,mips34Kc";
+ reg = <0>;
+ clocks = <&baseclk 0>;
+ clock-names = "cpu";
+ };
+ };
+
+ baseclk: clock-800mhz {
+ compatible = "fixed-clock";
+ #clock-cells = <0>;
+ clock-frequency = <800000000>;
+ };
+
+ lx_clk: clock-175mhz {
+ 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 = <1>;
+
+ 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,rtl9302-timer", "realtek,otto-timer";
+ reg = <0x3200 0x10>, <0x3210 0x10>, <0x3220 0x10>,
+ <0x3230 0x10>, <0x3240 0x10>;
+
+ interrupt-parent = <&intc>;
+ interrupts = <7>, <8>, <9>, <10>, <11>;
+ clocks = <&lx_clk>;
+ };
+};
+
+&uart0 {
+ /delete-property/ clock-frequency;
+ clocks = <&lx_clk>;
+
+ interrupt-parent = <&intc>;
+ interrupts = <30>;
+};
+
+&uart1 {
+ /delete-property/ clock-frequency;
+ clocks = <&lx_clk>;
+
+ interrupt-parent = <&intc>;
+ interrupts = <31>;
+};
+
--
2.45.2
^ permalink raw reply related [flat|nested] 20+ messages in thread