* [PATCH] net: dsa: microchip: Add supported ksz9897 port6
@ 2021-12-16 9:24 KARL_TSOU (鄒磊)
2021-12-16 10:17 ` Andrew Lunn
0 siblings, 1 reply; 5+ messages in thread
From: KARL_TSOU (鄒磊) @ 2021-12-16 9:24 UTC (permalink / raw)
To: woojung.huh@microchip.com, UNGLinuxDriver@microchip.com,
andrew@lunn.ch, vivien.didelot@gmail.com, f.fainelli@gmail.com,
olteanv@gmail.com, davem@davemloft.net
Cc: kuba@kernel.org, netdev@vger.kernel.org
[-- Attachment #1: Type: text/plain, Size: 64 bytes --]
This fix driver ksz9897 port6 with PHY ksz8081 by hardware setup
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-net-dsa-microchip-Add-supported-ksz9897-port6.patch --]
[-- Type: text/x-patch; name="0001-net-dsa-microchip-Add-supported-ksz9897-port6.patch", Size: 1540 bytes --]
From 7bb4872241075fb846ef83fa6fdd39193c136b46 Mon Sep 17 00:00:00 2001
From: karlt <karl_tsou@ubiqconn.com>
Date: Thu, 16 Dec 2021 16:23:33 +0800
Subject: [PATCH] net: dsa: microchip: Add supported ksz9897 port6
To: andrew@lunn.ch,
vivien.didelot@gmail.com,
f.fainelli@gmail.com,
olteanv@gmail.com,
davem@davemloft.net,
woojung.huh@microchip.com,
UNGLinuxDriver@microchip.com
Cc: kuba@kernel.org,
netdev@vger.kernel.org
This fix driver ksz9897 port6 with PHY ksz8081 by hardware setup
Signed-off-by: karlt <karl_tsou@ubiqconn.com>
---
drivers/net/dsa/microchip/ksz9477.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c
index abfd3802bb51..f343bfe307bc 100644
--- a/drivers/net/dsa/microchip/ksz9477.c
+++ b/drivers/net/dsa/microchip/ksz9477.c
@@ -1196,7 +1196,7 @@ static void ksz9477_port_setup(struct ksz_device *dev, int port, bool cpu_port)
/* enable 802.1p priority */
ksz_port_cfg(dev, port, P_PRIO_CTRL, PORT_802_1P_PRIO_ENABLE, true);
- if (port < dev->phy_port_cnt) {
+ if (port < dev->phy_port_cnt || !cpu_port) {
/* do not force flow control */
ksz_port_cfg(dev, port, REG_PORT_CTRL_0,
PORT_FORCE_TX_FLOW_CTRL | PORT_FORCE_RX_FLOW_CTRL,
@@ -1339,6 +1339,8 @@ static void ksz9477_config_cpu_port(struct dsa_switch *ds)
/* SGMII PHY detection code is not implemented yet. */
p->phy = 0;
}
+ if (dev->chip_id == 0x00989700 && i == 6)
+ p->phy = 1;
}
}
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] net: dsa: microchip: Add supported ksz9897 port6
2021-12-16 9:24 [PATCH] net: dsa: microchip: Add supported ksz9897 port6 KARL_TSOU (鄒磊)
@ 2021-12-16 10:17 ` Andrew Lunn
2021-12-17 2:53 ` KARL_TSOU (鄒磊)
0 siblings, 1 reply; 5+ messages in thread
From: Andrew Lunn @ 2021-12-16 10:17 UTC (permalink / raw)
To: KARL_TSOU (鄒磊)
Cc: woojung.huh@microchip.com, UNGLinuxDriver@microchip.com,
vivien.didelot@gmail.com, f.fainelli@gmail.com, olteanv@gmail.com,
davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org
On Thu, Dec 16, 2021 at 09:24:13AM +0000, KARL_TSOU (鄒磊) wrote:
> This fix driver ksz9897 port6 with PHY ksz8081 by hardware setup
Please explain in more details what the problem is you are fixing. It
is not clear from the code.
Thanks
Andrew
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] net: dsa: microchip: Add supported ksz9897 port6
2021-12-16 10:17 ` Andrew Lunn
@ 2021-12-17 2:53 ` KARL_TSOU (鄒磊)
2021-12-17 9:57 ` Andrew Lunn
0 siblings, 1 reply; 5+ messages in thread
From: KARL_TSOU (鄒磊) @ 2021-12-17 2:53 UTC (permalink / raw)
To: Andrew Lunn
Cc: woojung.huh@microchip.com, UNGLinuxDriver@microchip.com,
vivien.didelot@gmail.com, f.fainelli@gmail.com, olteanv@gmail.com,
davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org
The Microchip switch ksz9897 support 7 physical port, port 0/1/2/3/4 connect to standard RJ45, port5 connect to PHY via MII to CPU and port6 connect to PHY via RMII (PHY ksz8081) on my custom board.
I am facing a problem that I am not able to verify port6 via ping command even though the link is up, port 0/1/2/3/4 are all works fine by verifying with ping command expect port6
When I go through port initialization code, a "if condition" below that aren't included port6 initialization.
dev->phy_port_cnt = 5
# This allows port 0/1/2/3/4 but not 6
if (port < dev->phy_port_cnt)
# Add one more condition if port is not cpu port
if (port < dev->phy_port_cnt || !cpu_port)
# Add a if condition checking and updating for specified product and port number
if (dev->chip_id == 0x00989700 && i == 6)
Thanks
-Karl
From: Andrew Lunn <andrew@lunn.ch>
Sent: Thursday, December 16, 2021 6:17 PM
To: KARL_TSOU (鄒磊) <KARL_TSOU@UBIQCONN.COM>
Cc: woojung.huh@microchip.com <woojung.huh@microchip.com>; UNGLinuxDriver@microchip.com <UNGLinuxDriver@microchip.com>; vivien.didelot@gmail.com <vivien.didelot@gmail.com>; f.fainelli@gmail.com <f.fainelli@gmail.com>; olteanv@gmail.com <olteanv@gmail.com>; davem@davemloft.net <davem@davemloft.net>; kuba@kernel.org <kuba@kernel.org>; netdev@vger.kernel.org <netdev@vger.kernel.org>
Subject: Re: [PATCH] net: dsa: microchip: Add supported ksz9897 port6
On Thu, Dec 16, 2021 at 09:24:13AM +0000, KARL_TSOU (鄒磊) wrote:
> This fix driver ksz9897 port6 with PHY ksz8081 by hardware setup
Please explain in more details what the problem is you are fixing. It
is not clear from the code.
Thanks
Andrew
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] net: dsa: microchip: Add supported ksz9897 port6
2021-12-17 2:53 ` KARL_TSOU (鄒磊)
@ 2021-12-17 9:57 ` Andrew Lunn
2021-12-20 3:24 ` KARL_TSOU (鄒磊)
0 siblings, 1 reply; 5+ messages in thread
From: Andrew Lunn @ 2021-12-17 9:57 UTC (permalink / raw)
To: KARL_TSOU (鄒磊)
Cc: woojung.huh@microchip.com, UNGLinuxDriver@microchip.com,
vivien.didelot@gmail.com, f.fainelli@gmail.com, olteanv@gmail.com,
davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org
On Fri, Dec 17, 2021 at 02:53:15AM +0000, KARL_TSOU (鄒磊) wrote:
> The Microchip switch ksz9897 support 7 physical port, port 0/1/2/3/4 connect to standard RJ45, port5 connect to PHY via MII to CPU and port6 connect to PHY via RMII (PHY ksz8081) on my custom board.
Please don't top post. Also, wrap your emails so lines around 70
characters.
> I am facing a problem that I am not able to verify port6 via ping command even though the link is up, port 0/1/2/3/4 are all works fine by verifying with ping command expect port6
>
> When I go through port initialization code, a "if condition" below that aren't included port6 initialization.
This initialization is for the internal PHYs. They have to
exist. External PHYs the switch driver should not assume exist. You
normally connect to the CPU directly, not via back to back PHYs. Any
there could be boards which use port 6 direct to the CPU without a
PHY. So this change as is, is wrong.
You should be using a phy-handle in DT for port6, or port5, to
indicate if a PHY is connected to the port. Do you have this property?
Andrew
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH] net: dsa: microchip: Add supported ksz9897 port6
2021-12-17 9:57 ` Andrew Lunn
@ 2021-12-20 3:24 ` KARL_TSOU (鄒磊)
0 siblings, 0 replies; 5+ messages in thread
From: KARL_TSOU (鄒磊) @ 2021-12-20 3:24 UTC (permalink / raw)
To: Andrew Lunn
Cc: woojung.huh@microchip.com, UNGLinuxDriver@microchip.com,
vivien.didelot@gmail.com, f.fainelli@gmail.com, olteanv@gmail.com,
davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org
> -----Original Message-----
> From: Andrew Lunn <andrew@lunn.ch>
> Sent: Friday, December 17, 2021 5:58 PM
> To: KARL_TSOU (鄒磊) <KARL_TSOU@UBIQCONN.COM>
> Cc: woojung.huh@microchip.com; UNGLinuxDriver@microchip.com;
> vivien.didelot@gmail.com; f.fainelli@gmail.com; olteanv@gmail.com;
> davem@davemloft.net; kuba@kernel.org; netdev@vger.kernel.org
> Subject: Re: [PATCH] net: dsa: microchip: Add supported ksz9897 port6
>
> On Fri, Dec 17, 2021 at 02:53:15AM +0000, KARL_TSOU (鄒磊) wrote:
> > The Microchip switch ksz9897 support 7 physical port, port 0/1/2/3/4
> connect to standard RJ45, port5 connect to PHY via MII to CPU and
> port6 connect to PHY via RMII (PHY ksz8081) on my custom board.
>
> Please don't top post. Also, wrap your emails so lines around 70
> characters.
>
> > I am facing a problem that I am not able to verify port6 via ping
> > command even though the link is up, port 0/1/2/3/4 are all works
> fine
> > by verifying with ping command expect port6
> >
> > When I go through port initialization code, a "if condition" below
> that aren't included port6 initialization.
>
> This initialization is for the internal PHYs. They have to exist. External
> PHYs the switch driver should not assume exist. You normally connect
> to the CPU directly, not via back to back PHYs. Any there could be
> boards which use port 6 direct to the CPU without a PHY. So this
> change as is, is wrong.
>
> You should be using a phy-handle in DT for port6, or port5, to indicate
> if a PHY is connected to the port. Do you have this property?
>
> Andrew
I understand how to use phy-handle in DT. But it seems DSA in kernel 5.10.y doesn't support connecting to external PHYs correct?
I have been studying parse DT code in net/dsa/dsa2.c
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-12-20 3:24 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-16 9:24 [PATCH] net: dsa: microchip: Add supported ksz9897 port6 KARL_TSOU (鄒磊)
2021-12-16 10:17 ` Andrew Lunn
2021-12-17 2:53 ` KARL_TSOU (鄒磊)
2021-12-17 9:57 ` Andrew Lunn
2021-12-20 3:24 ` KARL_TSOU (鄒磊)
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).