Re: [net-next PATCH v2 08/15] dt-bindings: net: dsa: qca8k: Add MAC swap and clock phase properties

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Oct 09, 2021 at 09:47:57PM +0200, Andrew Lunn wrote:
> > Problem here is that from Documentation falling edge can be set only on
> > PAD0. PAD5 and PAD6 have the related bit reserved.
> 
> Meaning in future, they could be used for this, if those ports get
> support for SGMII.
>

Ok. Then I will move all to DT port. Consider falling is set to PAD0 for
both cpu port0 and cpu port6, should I make it hardcoded or should I add
a condition and force the reg to PAD0 only for the current supported
switch? Hope you understand what I mean.
(Yes we have some config with cpu port6 set to sgmii and that require
falling edge)

> > But anyway qca8k support only single sgmii and it's not supported a
> > config with multiple sgmii.
> 
> Yet, until such hardware appears. We do see more support for SFPs. And
> more support for multi-gigi ports. Both of which use a SERDES
> interface which can support SGMII. So i would not be too surprised if
> future versions of the switch have more ports like this.
> 
> > Do we have standard binding for this?
> 
> No, there is no standard binding for this. This seems specific to
> these devices, maybe a proprietary extension to SGMII?
> 

Then we are stuck to the special qca,... naming.

> > About the mac swap. Do we really need to implement a complex thing for
> > something that is really implemented internally to the switch?
> 
> If it was truly internal to the switch, no. But i don't think it
> is. The DSA core has no idea the ports are swapped, and so i think
> will put the names on the wrong ports. Does devlink understand the
> ports are swapped? How about .ndo_get_phys_port_name? Will udev mix up
> the ports?
> 
> The way you wanted to look in the other ports DT properties suggests
> it is not internal to the switch.
> 
> I think to help my understanding, we need some examples of DTS files
> with and without the swap, where the properties are read from, what
> the interface names are, etc.
> 

Here is 2 configuration one from an Netgear r7800 qca8337:

	switch@10 {
		compatible = "qca,qca8337";
		#address-cells = <1>;
		#size-cells = <0>;
		reg = <0x10>;

		qca8k,rgmii0_1_8v;
		qca8k,rgmii56_1_8v;

		ports {
			#address-cells = <1>;
			#size-cells = <0>;

			port@0 {
				reg = <0>;
				label = "cpu";
				ethernet = <&gmac1>;
				phy-mode = "rgmii-id";

				fixed-link {
					speed = <1000>;
					full-duplex;
				};
			};

			port@1 {
				reg = <1>;
				label = "lan1";
				phy-mode = "internal";
				phy-handle = <&phy_port1>;
			};

			port@2 {
				reg = <2>;
				label = "lan2";
				phy-mode = "internal";
				phy-handle = <&phy_port2>;
			};

			port@3 {
				reg = <3>;
				label = "lan3";
				phy-mode = "internal";
				phy-handle = <&phy_port3>;
			};

			port@4 {
				reg = <4>;
				label = "lan4";
				phy-mode = "internal";
				phy-handle = <&phy_port4>;
			};

			port@5 {
				reg = <5>;
				label = "wan";
				phy-mode = "internal";
				phy-handle = <&phy_port5>;
			};

			port@6 {
				reg = <6>;
				label = "cpu";
				ethernet = <&gmac2>;
				phy-mode = "sgmii";

				fixed-link {
					speed = <1000>;
					full-duplex;
				};
			};
		};

And here is one with mac swap Tp-Link Archer c7 v4 qca8327 

	switch0@10 {
		compatible = "qca,qca8337";
		#address-cells = <1>;
		#size-cells = <0>;

		reg = <0>;
		qca,sgmii-rxclk-falling-edge;
		qca,mac6-exchange;

		ports {
			#address-cells = <1>;
			#size-cells = <0>;

			port@0 {
				reg = <0>;
				label = "cpu";
				ethernet = <&eth0>;
				phy-mode = "sgmii";

				fixed-link {
					speed = <1000>;
					full-duplex;
				};
			};

			port@1 {
				reg = <1>;
				label = "wan";
				phy-mode = "internal";
				phy-handle = <&phy_port1>;
			};

			port@2 {
				reg = <2>;
				label = "lan1";
				phy-mode = "internal";
				phy-handle = <&phy_port2>;
			};

			port@3 {
				reg = <3>;
				label = "lan2";
				phy-mode = "internal";
				phy-handle = <&phy_port3>;
			};

			port@4 {
				reg = <4>;
				label = "lan3";
				phy-mode = "internal";
				phy-handle = <&phy_port4>;
			};

			port@5 {
				reg = <5>;
				label = "lan4";
				phy-mode = "internal";
				phy-handle = <&phy_port5>;
			};
		};

As you can see we use the mac06_exchange but we declare it as port0. DSA
see it as port0 (as it should as it's internall swapped). We also don't
need to apply some special function or stuff to apply the correct port
in the ACL/regs/VLAN. The switch will treat MAC6 as MAC0 and MAC6 as
MAC0. That is what we observed.
Someone would say... Considering this switch is 2 port... and currently
we use only one port. Why not drop this and use whatever is connected to
port 0. Problem is that some device have the secondary cpu port NOT
connected and they use mac6-exchange and that would result in no
connection since cpu port 0 is not connected and cpu port 6 is never
swapped.

> > I will move the falling binding to the port DT node and move the
> > configuration to mac_config. Should I keep the
> > dedicated function to setup PAD0 swap or I can directly add the check in
> > the qca8k_setup for only the bit related to enable the swap?
> 
> That does not matter too much. DT is an ABI, we should not change it
> later, so we need to look forward. C code is not ABI, it can be
> changed if/when more SGMII ports actually arrive.
> 
> 	Andrew

-- 
	Ansuel



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux