Skip to contentSkip to conversation

Microchip LAN966x USB device support

PATCH Superseded Herve Codina 2 participants 9 messages Jul 1, 2022 – Jul 4, 2022

Subsystems (4)

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v4 cover Microchip LAN966x USB device support

Hi,

This series add support for the USB device controller available on the Microchip LAN966x SOCs (LAN9662 and LAN9668).

Both SOCs have the same controller and this controller is also the same as the one present on the SAMAD3 SOC.

Regards,
Herve

Changes v2:
- Avoid wildcards in the DT compatible string
- Rename the DT node

Changes v3:
- Add Krzysztof's 'Acked-by' on patch 2/3
- Change node insertion point (sort nodes by base addresses) on patch 3/3

Changes v4:
- rebase on top of v5.19-rc1

Herve Codina (3):
clk: lan966x: Fix the lan966x clock gate register address
dt-bindings: usb: atmel: Add Microchip LAN9662 compatible string
ARM: dts: lan966x: Add UDPHS support

 Documentation/devicetree/bindings/usb/atmel-usb.txt |  3 +++
 arch/arm/boot/dts/lan966x.dtsi                      | 11 +++++++++++
 drivers/clk/clk-lan966x.c                           |  2 +-
 3 files changed, 15 insertions(+), 1 deletion(-)
Signature · 1 line
2.35.3
#1 lore raw

PATCH v4 1/3 clk: lan966x: Fix the lan966x clock gate register address

The register address used for the clock gate register is the base register address coming from first reg map (ie. the generic clock registers) instead of the second reg map defining the clock gate register.

Use the correct clock gate register address.

Fixes 5ad5915dea00 ("clk: lan966x: Extend lan966x clock driver for clock gating support")
---
 drivers/clk/clk-lan966x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/clk-lan966x.c +1 -1
index d1535ac13e89..81cb90955d68 100644
@@ -213,7 +213,7 @@ static int lan966x_gate_clk_register(struct device *dev,
 
 		hw_data->hws[i] =
 			devm_clk_hw_register_gate(dev, clk_gate_desc[idx].name,
-						  "lan966x", 0, base,
+						  "lan966x", 0, gate_base,
 						  clk_gate_desc[idx].bit_idx,
 						  0, &clk_gate_lock);
 
Signature · 1 line
2.35.3
#2 lore raw

PATCH v4 2/3 dt-bindings: usb: atmel: Add Microchip LAN9662 compatible string

In reply to Herve Codina

The USB device controller available in the Microchip LAN9662 SOC is the same IP as the one present in the SAMA5D3 SOC.

Add the LAN9662 compatible string and set the SAMA5D3 compatible string as a fallback for the LAN9662.

---
 Documentation/devicetree/bindings/usb/atmel-usb.txt | 3 +++
 1 file changed, 3 insertions(+)
Documentation/devicetree/bindings/usb/atmel-usb.txt +3 -0
index f512f0290728..12183ef47ee4 100644
@@ -87,6 +87,9 @@ Required properties:
 	       "atmel,at91sam9g45-udc"
 	       "atmel,sama5d3-udc"
 	       "microchip,sam9x60-udc"
+	       "microchip,lan9662-udc"
+	       For "microchip,lan9662-udc" the fallback "atmel,sama5d3-udc"
+	       is required.
  - reg: Address and length of the register set for the device
  - interrupts: Should contain usba interrupt
  - clocks: Should reference the peripheral and host clocks
Signature · 1 line
2.35.3
#3 lore raw

PATCH v4 3/3 ARM: dts: lan966x: Add UDPHS support

In reply to Herve Codina

Add UDPHS (the USB High Speed Device Port controller) support.

The both lan966x SOCs (LAN9662 and LAN9668) have the same UDPHS IP. This IP is also the same as the one present in the SAMA5D3 SOC.

---
 arch/arm/boot/dts/lan966x.dtsi | 11 +++++++++++
 1 file changed, 11 insertions(+)
arch/arm/boot/dts/lan966x.dtsi +11 -0
index 3cb02fffe716..c98e7075c2b4 100644
@@ -458,6 +458,17 @@ cpu_ctrl: syscon@e00c0000 {
 			reg = <0xe00c0000 0x350>;
 		};
 
+		udc: usb@e0808000 {
+			compatible = "microchip,lan9662-udc",
+				     "atmel,sama5d3-udc";
+			reg = <0x00200000 0x80000>,
+			      <0xe0808000 0x400>;
+			interrupts = <GIC_SPI 76 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&clks GCK_GATE_UDPHS>, <&nic_clk>;
+			clock-names = "pclk", "hclk";
+			status = "disabled";
+		};
+
 		can0: can@e081c000 {
 			compatible = "bosch,m_can";
 			reg = <0xe081c000 0xfc>, <0x00100000 0x4000>;
Signature · 1 line
2.35.3
#4 lore raw

Re: [PATCH v4 3/3] ARM: dts: lan966x: Add UDPHS support

Quoted 22 lines · Herve Codina

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Add UDPHS (the USB High Speed Device Port controller) support.

The both lan966x SOCs (LAN9662 and LAN9668) have the same UDPHS IP. This IP is also the same as the one present in the SAMA5D3 SOC.

---
 arch/arm/boot/dts/lan966x.dtsi | 11 +++++++++++
 1 file changed, 11 insertions(+)
arch/arm/boot/dts/lan966x.dtsi +1 -0
index 3cb02fffe716..c98e7075c2b4 100644
@@ -458,6 +458,17 @@ cpu_ctrl: syscon@e00c0000 {
                        reg = <0xe00c0000 0x350>;
                };
 
+               udc: usb@e0808000 {

arch/arm/boot/dts/lan966x.dtsi cpu_ctrl: syscon@e00c0000 { · line 471

Quoted 10 lines
arch/arm/boot/dts/lan966x.dtsi +10 -0
+                       compatible = "microchip,lan9662-udc",
+                                    "atmel,sama5d3-udc";
+                       reg = <0x00200000 0x80000>,
+                             <0xe0808000 0x400>;
+                       interrupts = <GIC_SPI 76 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&clks GCK_GATE_UDPHS>, <&nic_clk>;
+                       clock-names = "pclk", "hclk";
+                       status = "disabled";
+               };
+

I have these compilation warnings:

DTC arch/arm/boot/dts/lan966x-pcb8291.dtb
arch/arm/boot/dts/lan966x.dtsi:461.21-470.5: Warning (simple_bus_reg):
/soc/usb@e0808000: simple-bus unit address format error, expected "200000"
DTC arch/arm/boot/dts/lan966x-kontron-kswitch-d10-mmt-6g-2gs.dtb
arch/arm/boot/dts/lan966x.dtsi:461.21-470.5: Warning (simple_bus_reg):
/soc/usb@e0808000: simple-bus unit address format error, expected "200000"
DTC arch/arm/boot/dts/lan966x-kontron-kswitch-d10-mmt-8g.dtb
arch/arm/boot/dts/lan966x.dtsi:461.21-470.5: Warning (simple_bus_reg):
/soc/usb@e0808000: simple-bus unit address format error, expected "200000"

Quoted 6 lines
arch/arm/boot/dts/lan966x.dtsi +0 -1
                can0: can@e081c000 {
                        compatible = "bosch,m_can";
                        reg = <0xe081c000 0xfc>, <0x00100000 0x4000>;
--

2.35.3

#5 lore raw

Re: [PATCH v4 3/3] ARM: dts: lan966x: Add UDPHS support

Hi Claudiu,

Quoted 36 lines · On Fri, 1 Jul 2022 10:56:46 +0000 <[email protected]> wrote:
Quoted 22 lines · Herve Codina

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Add UDPHS (the USB High Speed Device Port controller) support.

The both lan966x SOCs (LAN9662 and LAN9668) have the same UDPHS IP. This IP is also the same as the one present in the SAMA5D3 SOC.

---
 arch/arm/boot/dts/lan966x.dtsi | 11 +++++++++++
 1 file changed, 11 insertions(+)
arch/arm/boot/dts/lan966x.dtsi +1 -0
index 3cb02fffe716..c98e7075c2b4 100644
@@ -458,6 +458,17 @@ cpu_ctrl: syscon@e00c0000 {
                        reg = <0xe00c0000 0x350>;
                };
 
+               udc: usb@e0808000 {

arch/arm/boot/dts/lan966x.dtsi cpu_ctrl: syscon@e00c0000 { · line 471

Quoted 10 lines
arch/arm/boot/dts/lan966x.dtsi +10 -0
+                       compatible = "microchip,lan9662-udc",
+                                    "atmel,sama5d3-udc";
+                       reg = <0x00200000 0x80000>,
+                             <0xe0808000 0x400>;
+                       interrupts = <GIC_SPI 76 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&clks GCK_GATE_UDPHS>, <&nic_clk>;
+                       clock-names = "pclk", "hclk";
+                       status = "disabled";
+               };
+  

I have these compilation warnings:

Quoted 9 lines

DTC arch/arm/boot/dts/lan966x-pcb8291.dtb
arch/arm/boot/dts/lan966x.dtsi:461.21-470.5: Warning (simple_bus_reg):
/soc/usb@e0808000: simple-bus unit address format error, expected "200000"
DTC arch/arm/boot/dts/lan966x-kontron-kswitch-d10-mmt-6g-2gs.dtb
arch/arm/boot/dts/lan966x.dtsi:461.21-470.5: Warning (simple_bus_reg):
/soc/usb@e0808000: simple-bus unit address format error, expected "200000"
DTC arch/arm/boot/dts/lan966x-kontron-kswitch-d10-mmt-8g.dtb
arch/arm/boot/dts/lan966x.dtsi:461.21-470.5: Warning (simple_bus_reg):
/soc/usb@e0808000: simple-bus unit address format error, expected "200000"

I am a bit confused but these warnings do not appear on my side (patches based on v5.19-rc1).
What is the exact command that leads to these warning ?

Thanks,
Hervé

Signature · 3 lines
Hervé Codina, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#6 lore raw

Re: [PATCH v4 3/3] ARM: dts: lan966x: Add UDPHS support

Hi, Herve,

Quoted 52 lines · Herve Codina

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Hi Claudiu,>

Quoted 36 lines · On Fri, 1 Jul 2022 10:56:46 +0000 <[email protected]> wrote:
Quoted 22 lines · Herve Codina

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Add UDPHS (the USB High Speed Device Port controller) support.

The both lan966x SOCs (LAN9662 and LAN9668) have the same UDPHS IP. This IP is also the same as the one present in the SAMA5D3 SOC.

---
 arch/arm/boot/dts/lan966x.dtsi | 11 +++++++++++
 1 file changed, 11 insertions(+)
arch/arm/boot/dts/lan966x.dtsi +1 -0
index 3cb02fffe716..c98e7075c2b4 100644
@@ -458,6 +458,17 @@ cpu_ctrl: syscon@e00c0000 {
                        reg = <0xe00c0000 0x350>;
                };
 
+               udc: usb@e0808000 {

arch/arm/boot/dts/lan966x.dtsi cpu_ctrl: syscon@e00c0000 { · line 471

Quoted 10 lines
arch/arm/boot/dts/lan966x.dtsi +10 -0
+                       compatible = "microchip,lan9662-udc",
+                                    "atmel,sama5d3-udc";
+                       reg = <0x00200000 0x80000>,
+                             <0xe0808000 0x400>;
+                       interrupts = <GIC_SPI 76 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&clks GCK_GATE_UDPHS>, <&nic_clk>;
+                       clock-names = "pclk", "hclk";
+                       status = "disabled";
+               };
+

I have these compilation warnings:

Quoted 9 lines

DTC arch/arm/boot/dts/lan966x-pcb8291.dtb
arch/arm/boot/dts/lan966x.dtsi:461.21-470.5: Warning (simple_bus_reg):
/soc/usb@e0808000: simple-bus unit address format error, expected "200000"
DTC arch/arm/boot/dts/lan966x-kontron-kswitch-d10-mmt-6g-2gs.dtb
arch/arm/boot/dts/lan966x.dtsi:461.21-470.5: Warning (simple_bus_reg):
/soc/usb@e0808000: simple-bus unit address format error, expected "200000"
DTC arch/arm/boot/dts/lan966x-kontron-kswitch-d10-mmt-8g.dtb
arch/arm/boot/dts/lan966x.dtsi:461.21-470.5: Warning (simple_bus_reg):
/soc/usb@e0808000: simple-bus unit address format error, expected "200000"

Quoted 3 lines

I am a bit confused but these warnings do not appear on my side (patches based on v5.19-rc1).
What is the exact command that leads to these warning ?

Have you tried with CONFIG_SOC_LAN966 enabled?

Thank you,
Claudiu Beznea

Quoted 8 lines

Thanks,
Hervé

--
Hervé Codina, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

#7 lore raw

Re: [PATCH v4 3/3] ARM: dts: lan966x: Add UDPHS support

In reply to Herve Codina
Quoted 53 lines · Herve Codina

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Hi Claudiu,

Quoted 36 lines · On Fri, 1 Jul 2022 10:56:46 +0000 <[email protected]> wrote:
Quoted 22 lines · Herve Codina

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Add UDPHS (the USB High Speed Device Port controller) support.

The both lan966x SOCs (LAN9662 and LAN9668) have the same UDPHS IP. This IP is also the same as the one present in the SAMA5D3 SOC.

---
 arch/arm/boot/dts/lan966x.dtsi | 11 +++++++++++
 1 file changed, 11 insertions(+)
arch/arm/boot/dts/lan966x.dtsi +1 -0
index 3cb02fffe716..c98e7075c2b4 100644
@@ -458,6 +458,17 @@ cpu_ctrl: syscon@e00c0000 {
                        reg = <0xe00c0000 0x350>;
                };
 
+               udc: usb@e0808000 {

arch/arm/boot/dts/lan966x.dtsi cpu_ctrl: syscon@e00c0000 { · line 471

Quoted 10 lines
arch/arm/boot/dts/lan966x.dtsi +10 -0
+                       compatible = "microchip,lan9662-udc",
+                                    "atmel,sama5d3-udc";
+                       reg = <0x00200000 0x80000>,
+                             <0xe0808000 0x400>;
+                       interrupts = <GIC_SPI 76 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&clks GCK_GATE_UDPHS>, <&nic_clk>;
+                       clock-names = "pclk", "hclk";
+                       status = "disabled";
+               };
+

I have these compilation warnings:

Quoted 9 lines

DTC arch/arm/boot/dts/lan966x-pcb8291.dtb
arch/arm/boot/dts/lan966x.dtsi:461.21-470.5: Warning (simple_bus_reg):
/soc/usb@e0808000: simple-bus unit address format error, expected "200000"
DTC arch/arm/boot/dts/lan966x-kontron-kswitch-d10-mmt-6g-2gs.dtb
arch/arm/boot/dts/lan966x.dtsi:461.21-470.5: Warning (simple_bus_reg):
/soc/usb@e0808000: simple-bus unit address format error, expected "200000"
DTC arch/arm/boot/dts/lan966x-kontron-kswitch-d10-mmt-8g.dtb
arch/arm/boot/dts/lan966x.dtsi:461.21-470.5: Warning (simple_bus_reg):
/soc/usb@e0808000: simple-bus unit address format error, expected "200000"

Quoted 3 lines

I am a bit confused but these warnings do not appear on my side (patches based on v5.19-rc1).
What is the exact command that leads to these warning ?

Oh, and the set of commands I'm using:
make sama7_defconfig
make menuconfig + enable CONFIG_SOC_LAN966
make W=1 dtbs

Quoted 8 lines

Thanks,
Hervé

--
Hervé Codina, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

#8 lore raw

Re: [PATCH v4 3/3] ARM: dts: lan966x: Add UDPHS support

Hi Claudiu,

Quoted 54 lines · On Mon, 4 Jul 2022 05:41:33 +0000 <[email protected]> wrote:
Quoted 53 lines · Herve Codina

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Hi Claudiu,

Quoted 45 lines · On Fri, 1 Jul 2022 10:56:46 +0000 <[email protected]> wrote:
Quoted 22 lines · Herve Codina

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Add UDPHS (the USB High Speed Device Port controller) support.

The both lan966x SOCs (LAN9662 and LAN9668) have the same UDPHS IP. This IP is also the same as the one present in the SAMA5D3 SOC.

---
 arch/arm/boot/dts/lan966x.dtsi | 11 +++++++++++
 1 file changed, 11 insertions(+)
arch/arm/boot/dts/lan966x.dtsi +1 -0
index 3cb02fffe716..c98e7075c2b4 100644
@@ -458,6 +458,17 @@ cpu_ctrl: syscon@e00c0000 {
                        reg = <0xe00c0000 0x350>;
                };
 
+               udc: usb@e0808000 {

arch/arm/boot/dts/lan966x.dtsi cpu_ctrl: syscon@e00c0000 { · line 471

Quoted 10 lines
arch/arm/boot/dts/lan966x.dtsi +10 -0
+                       compatible = "microchip,lan9662-udc",
+                                    "atmel,sama5d3-udc";
+                       reg = <0x00200000 0x80000>,
+                             <0xe0808000 0x400>;
+                       interrupts = <GIC_SPI 76 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&clks GCK_GATE_UDPHS>, <&nic_clk>;
+                       clock-names = "pclk", "hclk";
+                       status = "disabled";
+               };
+  

I have these compilation warnings:

DTC arch/arm/boot/dts/lan966x-pcb8291.dtb
arch/arm/boot/dts/lan966x.dtsi:461.21-470.5: Warning (simple_bus_reg):
/soc/usb@e0808000: simple-bus unit address format error, expected "200000"
DTC arch/arm/boot/dts/lan966x-kontron-kswitch-d10-mmt-6g-2gs.dtb
arch/arm/boot/dts/lan966x.dtsi:461.21-470.5: Warning (simple_bus_reg):
/soc/usb@e0808000: simple-bus unit address format error, expected "200000"
DTC arch/arm/boot/dts/lan966x-kontron-kswitch-d10-mmt-8g.dtb
arch/arm/boot/dts/lan966x.dtsi:461.21-470.5: Warning (simple_bus_reg):
/soc/usb@e0808000: simple-bus unit address format error, expected "200000"

Quoted 8 lines
Quoted 3 lines

I am a bit confused but these warnings do not appear on my side (patches based on v5.19-rc1).
What is the exact command that leads to these warning ?

Oh, and the set of commands I'm using:
make sama7_defconfig
make menuconfig + enable CONFIG_SOC_LAN966
make W=1 dtbs

I have the warnings.
They are present with 'W=1' set.

I remove them and send a v5.

Thanks,
Hervé

Signature · 3 lines
Hervé Codina, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com