diff mbox

[net-next,v6,4/4] phy: marvell: Add support for the PHY embedded in the topaz switch

Message ID f8526f4a5d99223fc90fe5579b4958eaa0950a3a.1485288602.git-series.gregory.clement@free-electrons.com
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Gregory CLEMENT Jan. 24, 2017, 8:10 p.m. UTC
The PHY with the ID 0x1410C00 can be found embedded in the Marvell Topaz
switches (88E6141/88E6341). It is compatible with the 88E1510 (at least for
the temperature information), so add support for it, using the 88E1510
specific functions.

Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
---
 drivers/net/phy/marvell.c   | 21 +++++++++++++++++++++
 include/linux/marvell_phy.h |  1 +
 2 files changed, 22 insertions(+)

Comments

Andrew Lunn Jan. 24, 2017, 8:28 p.m. UTC | #1
On Tue, Jan 24, 2017 at 09:10:26PM +0100, Gregory CLEMENT wrote:
> The PHY with the ID 0x1410C00

:-(

I don't have a better reference, but
Linux/Documentation/devicetree/bindings/net/phy.txt says:

 22   If the phy's identifier is known then the list may contain an entry
 23   of the form: "ethernet-phy-idAAAA.BBBB" where
 24      AAAA - The value of the 16 bit Phy Identifier 1 register as
 25             4 hex digits. This is the chip vendor OUI bits 3:18
 26      BBBB - The value of the 16 bit Phy Identifier 2 register as
 27             4 hex digits. This is the chip vendor OUI bits 19:24,
 28             followed by 10 bits of a vendor specific ID.

So the lower 10 bits of 0x1410C00 are 0. So we know it is a Marvell
PHY from the OUI, but the vendor specific bits are all 0.

Please take a look at:

https://marc.info/?l=linux-netdev&m=148495522620757&w=1

and

https://marc.info/?l=linux-netdev&m=148495510320714&w=1

Maybe i should submit these two independently, so you can extend it
for the 88E6341 family.

    Andrew
Gregory CLEMENT Jan. 24, 2017, 8:55 p.m. UTC | #2
Hi Andrew,
 
 On mar., janv. 24 2017, Andrew Lunn <andrew@lunn.ch> wrote:

> On Tue, Jan 24, 2017 at 09:10:26PM +0100, Gregory CLEMENT wrote:
>> The PHY with the ID 0x1410C00
>
> :-(
>
> I don't have a better reference, but
> Linux/Documentation/devicetree/bindings/net/phy.txt says:
>
>  22   If the phy's identifier is known then the list may contain an entry
>  23   of the form: "ethernet-phy-idAAAA.BBBB" where
>  24      AAAA - The value of the 16 bit Phy Identifier 1 register as
>  25             4 hex digits. This is the chip vendor OUI bits 3:18
>  26      BBBB - The value of the 16 bit Phy Identifier 2 register as
>  27             4 hex digits. This is the chip vendor OUI bits 19:24,
>  28             followed by 10 bits of a vendor specific ID.
>
> So the lower 10 bits of 0x1410C00 are 0. So we know it is a Marvell
> PHY from the OUI, but the vendor specific bits are all 0.

In your previous email you mention a value of 0x01410000, so when I saw
the "C00" at the end I was happy and I didn't look for further.

>
> Please take a look at:
>
> https://marc.info/?l=linux-netdev&m=148495522620757&w=1
>
> and
>
> https://marc.info/?l=linux-netdev&m=148495510320714&w=1
>
> Maybe i should submit these two independently, so you can extend it
> for the 88E6341 family.

Please do it :)

The feedback from Florian and Vivian was good about it so I see no
reason to not apply them.

Add me in CC so I will now when to rebase my series.

Thanks,

Gregory

>
>     Andrew
diff mbox

Patch

diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index 64229976ace1..8b9338a746b8 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -2141,6 +2141,26 @@  static struct phy_driver marvell_drivers[] = {
 		.get_strings = marvell_get_strings,
 		.get_stats = marvell_get_stats,
 	},
+	{
+		.phy_id = MARVELL_PHY_ID_88E6141,
+		.phy_id_mask = MARVELL_PHY_ID_MASK,
+		.name = "Marvell 88E6141",
+		.probe = m88e1510_probe,
+		.remove = &marvell_remove,
+		.features = PHY_GBIT_FEATURES,
+		.flags = PHY_HAS_INTERRUPT,
+		.config_init = &marvell_config_init,
+		.config_aneg = &m88e1510_config_aneg,
+		.read_status = &marvell_read_status,
+		.ack_interrupt = &marvell_ack_interrupt,
+		.config_intr = &marvell_config_intr,
+		.did_interrupt = &m88e1121_did_interrupt,
+		.resume = &genphy_resume,
+		.suspend = &genphy_suspend,
+		.get_sset_count = marvell_get_sset_count,
+		.get_strings = marvell_get_strings,
+		.get_stats = marvell_get_stats,
+	},
 };
 
 module_phy_driver(marvell_drivers);
@@ -2159,6 +2179,7 @@  static struct mdio_device_id __maybe_unused marvell_tbl[] = {
 	{ MARVELL_PHY_ID_88E1510, MARVELL_PHY_ID_MASK },
 	{ MARVELL_PHY_ID_88E1540, MARVELL_PHY_ID_MASK },
 	{ MARVELL_PHY_ID_88E3016, MARVELL_PHY_ID_MASK },
+	{ MARVELL_PHY_ID_88E6141, MARVELL_PHY_ID_MASK },
 	{ }
 };
 
diff --git a/include/linux/marvell_phy.h b/include/linux/marvell_phy.h
index a57f0dfb6db7..6f33b73f2044 100644
--- a/include/linux/marvell_phy.h
+++ b/include/linux/marvell_phy.h
@@ -5,6 +5,7 @@ 
 #define MARVELL_PHY_ID_MASK		0xfffffff0
 
 /* Known PHY IDs */
+#define MARVELL_PHY_ID_88E6141		0x01410c00
 #define MARVELL_PHY_ID_88E1101		0x01410c60
 #define MARVELL_PHY_ID_88E1112		0x01410c90
 #define MARVELL_PHY_ID_88E1111		0x01410cc0