* [PATCH 0/2] net: phy: micrel: add Microchip KSZ 9897 Switch PHY support
@ 2022-02-04 13:36 Enguerrand de Ribaucourt
2022-02-04 13:36 ` [PATCH 1/2] " Enguerrand de Ribaucourt
2022-02-04 13:36 ` [PATCH 2/2] net: phy: micrel: add Microchip KSZ 9477 to the device table Enguerrand de Ribaucourt
0 siblings, 2 replies; 7+ messages in thread
From: Enguerrand de Ribaucourt @ 2022-02-04 13:36 UTC (permalink / raw)
To: netdev; +Cc: andrew, hkallweit1, linux
Hi,
I've recently used a KSZ9897 DSA switch that was connected to an i.MX6 CPU
through SPI for the DSA control, and RMII as the data cpu-port. The SPI/DSA was
well supported in drivers/net/dsa/microchip/ksz9477.c, but the RMII connection
was not working. I would like to upstream the patch I developped to add support
for the KSZ9897 RMII bus. This is required for the cpu-port capability of
the DSA switch and have a complete support of this DSA switch.
Since PHY_ID_KSZ9897 and PHY_ID_KSZ8081 are very close, I had to modify the mask
used for the latter. I don't have this one, so it would be very appreciated if
someone could test this patch with the KSZ8081 or KSZ8091. In particular, I'd
like to know the exact phy_id used by those models to check that the new mask is
valid, and that they don't collide with the KSZ9897. The phy_ids cannot be found
in the datasheet, so I couldn't verify that myself.
My definition of the struct phy_driver was copied from the similar
PHY_ID_KSZ8873MLL and proved to work on a 5.4 kernel. However, my patch may not
support the Gigabit Ethernet but works reliably otherwise.
The second patch fixes an issue with the KSZ9477 declaration I noticed. I
couldn't find PHY_ID_KSZ9477, or an equivalent mask in the MODULE_DEVICE_TABLE
declaration. I fear the driver is not initialized properly with this PHY. I
don't have this model either so it would be great if someone could test this.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] net: phy: micrel: add Microchip KSZ 9897 Switch PHY support
2022-02-04 13:36 [PATCH 0/2] net: phy: micrel: add Microchip KSZ 9897 Switch PHY support Enguerrand de Ribaucourt
@ 2022-02-04 13:36 ` Enguerrand de Ribaucourt
2022-02-04 14:05 ` Andrew Lunn
2022-02-04 13:36 ` [PATCH 2/2] net: phy: micrel: add Microchip KSZ 9477 to the device table Enguerrand de Ribaucourt
1 sibling, 1 reply; 7+ messages in thread
From: Enguerrand de Ribaucourt @ 2022-02-04 13:36 UTC (permalink / raw)
To: netdev; +Cc: andrew, hkallweit1, linux, Enguerrand de Ribaucourt
Adding Microchip 9897 Phy included in KSZ9897 Switch.
The KSZ9897 shares the same prefix as the KSZ8081. The phy_id_mask was
updated to allow the KSZ9897 to be matched.
Signed-off-by: Enguerrand de Ribaucourt <enguerrand.de-ribaucourt@savoirfairelinux.com>
---
drivers/net/phy/micrel.c | 15 +++++++++++++--
include/linux/micrel_phy.h | 1 +
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index 44a24b99c894..9b2047e26449 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -1726,7 +1726,7 @@ static struct phy_driver ksphy_driver[] = {
}, {
.phy_id = PHY_ID_KSZ8081,
.name = "Micrel KSZ8081 or KSZ8091",
- .phy_id_mask = MICREL_PHY_ID_MASK,
+ .phy_id_mask = 0x00ffffff,
.flags = PHY_POLL_CABLE_TEST,
/* PHY_BASIC_FEATURES */
.driver_data = &ksz8081_type,
@@ -1869,6 +1869,16 @@ static struct phy_driver ksphy_driver[] = {
.config_init = kszphy_config_init,
.suspend = genphy_suspend,
.resume = genphy_resume,
+}, {
+ .phy_id = PHY_ID_KSZ9897,
+ .phy_id_mask = 0x00ffffff,
+ .name = "Microchip KSZ9897",
+ /* PHY_BASIC_FEATURES */
+ .config_init = kszphy_config_init,
+ .config_aneg = ksz8873mll_config_aneg,
+ .read_status = ksz8873mll_read_status,
+ .suspend = genphy_suspend,
+ .resume = genphy_resume,
} };
module_phy_driver(ksphy_driver);
@@ -1888,11 +1898,12 @@ static struct mdio_device_id __maybe_unused micrel_tbl[] = {
{ PHY_ID_KSZ8041, MICREL_PHY_ID_MASK },
{ PHY_ID_KSZ8051, MICREL_PHY_ID_MASK },
{ PHY_ID_KSZ8061, MICREL_PHY_ID_MASK },
- { PHY_ID_KSZ8081, MICREL_PHY_ID_MASK },
+ { PHY_ID_KSZ8081, 0x00ffffff },
{ PHY_ID_KSZ8873MLL, MICREL_PHY_ID_MASK },
{ PHY_ID_KSZ886X, MICREL_PHY_ID_MASK },
{ PHY_ID_LAN8814, MICREL_PHY_ID_MASK },
{ PHY_ID_LAN8804, MICREL_PHY_ID_MASK },
+ { PHY_ID_KSZ9897, 0x00ffffff },
{ }
};
diff --git a/include/linux/micrel_phy.h b/include/linux/micrel_phy.h
index 1f7c33b2f5a3..8d09a732ddf3 100644
--- a/include/linux/micrel_phy.h
+++ b/include/linux/micrel_phy.h
@@ -36,6 +36,7 @@
#define PHY_ID_KSZ87XX 0x00221550
#define PHY_ID_KSZ9477 0x00221631
+#define PHY_ID_KSZ9897 0x00221561
/* struct phy_device dev_flags definitions */
#define MICREL_PHY_50MHZ_CLK 0x00000001
--
2.25.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] net: phy: micrel: add Microchip KSZ 9477 to the device table
2022-02-04 13:36 [PATCH 0/2] net: phy: micrel: add Microchip KSZ 9897 Switch PHY support Enguerrand de Ribaucourt
2022-02-04 13:36 ` [PATCH 1/2] " Enguerrand de Ribaucourt
@ 2022-02-04 13:36 ` Enguerrand de Ribaucourt
2022-02-04 14:06 ` Andrew Lunn
1 sibling, 1 reply; 7+ messages in thread
From: Enguerrand de Ribaucourt @ 2022-02-04 13:36 UTC (permalink / raw)
To: netdev; +Cc: andrew, hkallweit1, linux, Enguerrand de Ribaucourt
PHY_ID_KSZ9477 was supported but not added to the device table passed to
MODULE_DEVICE_TABLE.
Signed-off-by: Enguerrand de Ribaucourt <enguerrand.de-ribaucourt@savoirfairelinux.com>
---
drivers/net/phy/micrel.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index 9b2047e26449..4502a4a7e03e 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -1903,6 +1903,7 @@ static struct mdio_device_id __maybe_unused micrel_tbl[] = {
{ PHY_ID_KSZ886X, MICREL_PHY_ID_MASK },
{ PHY_ID_LAN8814, MICREL_PHY_ID_MASK },
{ PHY_ID_LAN8804, MICREL_PHY_ID_MASK },
+ { PHY_ID_KSZ9477, MICREL_PHY_ID_MASK },
{ PHY_ID_KSZ9897, 0x00ffffff },
{ }
};
--
2.25.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] net: phy: micrel: add Microchip KSZ 9897 Switch PHY support
2022-02-04 13:36 ` [PATCH 1/2] " Enguerrand de Ribaucourt
@ 2022-02-04 14:05 ` Andrew Lunn
2022-02-04 15:17 ` Enguerrand de Ribaucourt
0 siblings, 1 reply; 7+ messages in thread
From: Andrew Lunn @ 2022-02-04 14:05 UTC (permalink / raw)
To: Enguerrand de Ribaucourt; +Cc: netdev, hkallweit1, linux
On Fri, Feb 04, 2022 at 02:36:34PM +0100, Enguerrand de Ribaucourt wrote:
> Adding Microchip 9897 Phy included in KSZ9897 Switch.
> The KSZ9897 shares the same prefix as the KSZ8081. The phy_id_mask was
> updated to allow the KSZ9897 to be matched.
>
> Signed-off-by: Enguerrand de Ribaucourt <enguerrand.de-ribaucourt@savoirfairelinux.com>
> ---
> drivers/net/phy/micrel.c | 15 +++++++++++++--
> include/linux/micrel_phy.h | 1 +
> 2 files changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
> index 44a24b99c894..9b2047e26449 100644
> --- a/drivers/net/phy/micrel.c
> +++ b/drivers/net/phy/micrel.c
> @@ -1726,7 +1726,7 @@ static struct phy_driver ksphy_driver[] = {
> }, {
> .phy_id = PHY_ID_KSZ8081,
> .name = "Micrel KSZ8081 or KSZ8091",
> - .phy_id_mask = MICREL_PHY_ID_MASK,
> + .phy_id_mask = 0x00ffffff,
You can probably use PHY_ID_MATCH_EXACT().
> .flags = PHY_POLL_CABLE_TEST,
> /* PHY_BASIC_FEATURES */
> .driver_data = &ksz8081_type,
> @@ -1869,6 +1869,16 @@ static struct phy_driver ksphy_driver[] = {
> .config_init = kszphy_config_init,
> .suspend = genphy_suspend,
> .resume = genphy_resume,
> +}, {
> + .phy_id = PHY_ID_KSZ9897,
> + .phy_id_mask = 0x00ffffff,
Here as well.
> + .name = "Microchip KSZ9897",
> + /* PHY_BASIC_FEATURES */
> + .config_init = kszphy_config_init,
> + .config_aneg = ksz8873mll_config_aneg,
> + .read_status = ksz8873mll_read_status,
> + .suspend = genphy_suspend,
> + .resume = genphy_resume,
> } };
>
> module_phy_driver(ksphy_driver);
> @@ -1888,11 +1898,12 @@ static struct mdio_device_id __maybe_unused micrel_tbl[] = {
> { PHY_ID_KSZ8041, MICREL_PHY_ID_MASK },
> { PHY_ID_KSZ8051, MICREL_PHY_ID_MASK },
> { PHY_ID_KSZ8061, MICREL_PHY_ID_MASK },
> - { PHY_ID_KSZ8081, MICREL_PHY_ID_MASK },
> + { PHY_ID_KSZ8081, 0x00ffffff },
And here.
> { PHY_ID_KSZ8873MLL, MICREL_PHY_ID_MASK },
> { PHY_ID_KSZ886X, MICREL_PHY_ID_MASK },
> { PHY_ID_LAN8814, MICREL_PHY_ID_MASK },
> { PHY_ID_LAN8804, MICREL_PHY_ID_MASK },
> + { PHY_ID_KSZ9897, 0x00ffffff },
etc.
Andrew
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] net: phy: micrel: add Microchip KSZ 9477 to the device table
2022-02-04 13:36 ` [PATCH 2/2] net: phy: micrel: add Microchip KSZ 9477 to the device table Enguerrand de Ribaucourt
@ 2022-02-04 14:06 ` Andrew Lunn
0 siblings, 0 replies; 7+ messages in thread
From: Andrew Lunn @ 2022-02-04 14:06 UTC (permalink / raw)
To: Enguerrand de Ribaucourt; +Cc: netdev, hkallweit1, linux
On Fri, Feb 04, 2022 at 02:36:35PM +0100, Enguerrand de Ribaucourt wrote:
> PHY_ID_KSZ9477 was supported but not added to the device table passed to
> MODULE_DEVICE_TABLE.
>
> Signed-off-by: Enguerrand de Ribaucourt <enguerrand.de-ribaucourt@savoirfairelinux.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] net: phy: micrel: add Microchip KSZ 9897 Switch PHY support
2022-02-04 14:05 ` Andrew Lunn
@ 2022-02-04 15:17 ` Enguerrand de Ribaucourt
2022-02-04 17:04 ` Andrew Lunn
0 siblings, 1 reply; 7+ messages in thread
From: Enguerrand de Ribaucourt @ 2022-02-04 15:17 UTC (permalink / raw)
To: Andrew Lunn; +Cc: netdev, hkallweit1, linux
----- Original Message -----
> From: "Andrew Lunn" <andrew@lunn.ch>
> To: "Enguerrand de Ribaucourt" <enguerrand.de-ribaucourt@savoirfairelinux.com>
> Cc: netdev@vger.kernel.org, hkallweit1@gmail.com, linux@armlinux.org.uk
> Sent: Friday, February 4, 2022 3:05:05 PM
> Subject: Re: [PATCH 1/2] net: phy: micrel: add Microchip KSZ 9897 Switch PHY support
> On Fri, Feb 04, 2022 at 02:36:34PM +0100, Enguerrand de Ribaucourt wrote:
> > Adding Microchip 9897 Phy included in KSZ9897 Switch.
> > The KSZ9897 shares the same prefix as the KSZ8081. The phy_id_mask was
> > updated to allow the KSZ9897 to be matched.
>> Signed-off-by: Enguerrand de Ribaucourt
> > <enguerrand.de-ribaucourt@savoirfairelinux.com>
> > ---
> > drivers/net/phy/micrel.c | 15 +++++++++++++--
> > include/linux/micrel_phy.h | 1 +
> > 2 files changed, 14 insertions(+), 2 deletions(-)
> > diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
> > index 44a24b99c894..9b2047e26449 100644
> > --- a/drivers/net/phy/micrel.c
> > +++ b/drivers/net/phy/micrel.c
> > @@ -1726,7 +1726,7 @@ static struct phy_driver ksphy_driver[] = {
> > }, {
> > .phy_id = PHY_ID_KSZ8081,
> > .name = "Micrel KSZ8081 or KSZ8091",
> > - .phy_id_mask = MICREL_PHY_ID_MASK,
> > + .phy_id_mask = 0x00ffffff,
> You can probably use PHY_ID_MATCH_EXACT().
Thank you for your feedback! The rest of the driver always uses
this style instead of PHY_ID_MATCH_EXACT().
Shouldn't I stick to it for consistency in micrel.c ?
Example:
.phy_id = PHY_ID_KSZ8031,
.phy_id_mask = 0x00ffffff,
.name = "Micrel KSZ8031",
> > .flags = PHY_POLL_CABLE_TEST,
> > /* PHY_BASIC_FEATURES */
> > .driver_data = &ksz8081_type,
> > @@ -1869,6 +1869,16 @@ static struct phy_driver ksphy_driver[] = {
> > .config_init = kszphy_config_init,
> > .suspend = genphy_suspend,
> > .resume = genphy_resume,
> > +}, {
> > + .phy_id = PHY_ID_KSZ9897,
> > + .phy_id_mask = 0x00ffffff,
> Here as well.
> > + .name = "Microchip KSZ9897",
> > + /* PHY_BASIC_FEATURES */
> > + .config_init = kszphy_config_init,
> > + .config_aneg = ksz8873mll_config_aneg,
> > + .read_status = ksz8873mll_read_status,
> > + .suspend = genphy_suspend,
> > + .resume = genphy_resume,
> > } };
> > module_phy_driver(ksphy_driver);
>> @@ -1888,11 +1898,12 @@ static struct mdio_device_id __maybe_unused micrel_tbl[]
> > = {
> > { PHY_ID_KSZ8041, MICREL_PHY_ID_MASK },
> > { PHY_ID_KSZ8051, MICREL_PHY_ID_MASK },
> > { PHY_ID_KSZ8061, MICREL_PHY_ID_MASK },
> > - { PHY_ID_KSZ8081, MICREL_PHY_ID_MASK },
> > + { PHY_ID_KSZ8081, 0x00ffffff },
> And here.
> > { PHY_ID_KSZ8873MLL, MICREL_PHY_ID_MASK },
> > { PHY_ID_KSZ886X, MICREL_PHY_ID_MASK },
> > { PHY_ID_LAN8814, MICREL_PHY_ID_MASK },
> > { PHY_ID_LAN8804, MICREL_PHY_ID_MASK },
> > + { PHY_ID_KSZ9897, 0x00ffffff },
> etc.
> Andrew
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] net: phy: micrel: add Microchip KSZ 9897 Switch PHY support
2022-02-04 15:17 ` Enguerrand de Ribaucourt
@ 2022-02-04 17:04 ` Andrew Lunn
0 siblings, 0 replies; 7+ messages in thread
From: Andrew Lunn @ 2022-02-04 17:04 UTC (permalink / raw)
To: Enguerrand de Ribaucourt; +Cc: netdev, hkallweit1, linux
> > You can probably use PHY_ID_MATCH_EXACT().
>
> Thank you for your feedback! The rest of the driver always uses
> this style instead of PHY_ID_MATCH_EXACT().
You could add another patch converting them. It looks like some could
also use PHY_ID_MATCH_MODEL(). Up to you, depending on how much time
you want to spend on this.
Andrew
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2022-02-04 17:04 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-04 13:36 [PATCH 0/2] net: phy: micrel: add Microchip KSZ 9897 Switch PHY support Enguerrand de Ribaucourt
2022-02-04 13:36 ` [PATCH 1/2] " Enguerrand de Ribaucourt
2022-02-04 14:05 ` Andrew Lunn
2022-02-04 15:17 ` Enguerrand de Ribaucourt
2022-02-04 17:04 ` Andrew Lunn
2022-02-04 13:36 ` [PATCH 2/2] net: phy: micrel: add Microchip KSZ 9477 to the device table Enguerrand de Ribaucourt
2022-02-04 14:06 ` Andrew Lunn
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.