1 From 0836d9fb41ed90090ef4af0d7abe784ee7706f80 Mon Sep 17 00:00:00 2001
2 From: Russell King <rmk+kernel@armlinux.org.uk>
3 Date: Fri, 14 Apr 2017 14:21:25 +0100
4 Subject: [PATCH 636/660] net: phy: marvell10g: add SFP+ support
6 Add support for SFP+ cages to the Marvell 10G PHY driver. This is
7 slightly complicated by the way phylib works in that we need to use
8 a multi-step process to attach the SFP bus, and we also need to track
9 the phylink state machine to know when the module's transmit disable
10 signal should change state.
12 With appropriate DT changes, this allows the SFP+ canges on the
13 Macchiatobin platform to be functional.
15 Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
17 drivers/net/phy/marvell10g.c | 25 ++++++++++++++++++++++++-
18 1 file changed, 24 insertions(+), 1 deletion(-)
20 --- a/drivers/net/phy/marvell10g.c
21 +++ b/drivers/net/phy/marvell10g.c
23 #include <linux/hwmon.h>
24 #include <linux/marvell_phy.h>
25 #include <linux/phy.h>
26 +#include <linux/sfp.h>
30 @@ -219,6 +220,28 @@ static int mv3310_hwmon_probe(struct phy
34 +static int mv3310_sfp_insert(void *upstream, const struct sfp_eeprom_id *id)
36 + struct phy_device *phydev = upstream;
37 + __ETHTOOL_DECLARE_LINK_MODE_MASK(support) = { 0, };
38 + phy_interface_t iface;
40 + sfp_parse_support(phydev->sfp_bus, id, support);
41 + iface = sfp_select_interface(phydev->sfp_bus, id, support);
43 + if (iface != PHY_INTERFACE_MODE_10GKR) {
44 + dev_err(&phydev->mdio.dev, "incompatible SFP module inserted\n");
50 +static const struct sfp_upstream_ops mv3310_sfp_ops = {
51 + .attach = phy_sfp_attach,
52 + .detach = phy_sfp_detach,
53 + .module_insert = mv3310_sfp_insert,
56 static int mv3310_probe(struct phy_device *phydev)
58 struct mv3310_priv *priv;
59 @@ -249,7 +272,7 @@ static int mv3310_probe(struct phy_devic
64 + return phy_sfp_probe(phydev, &mv3310_sfp_ops);
67 static int mv3310_suspend(struct phy_device *phydev)