Skip to content

Commit 9885d01

Browse files
elkablodavem330
authored andcommitted
net: phy: marvell10g: add separate structure for 88X3340
The 88X3340 contains 4 cores similar to 88X3310, but there is a difference: it does not support xaui host mode. Instead the corresponding MACTYPE means rxaui / 5gbase-r / 2500base-x / sgmii without AN Signed-off-by: Marek Behún <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent ccbf289 commit 9885d01

File tree

2 files changed

+61
-3
lines changed

2 files changed

+61
-3
lines changed

drivers/net/phy/marvell10g.c

Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,21 @@ static int mv3310_init_interface(struct phy_device *phydev, int mactype)
557557
return 0;
558558
}
559559

560+
static int mv3340_init_interface(struct phy_device *phydev, int mactype)
561+
{
562+
struct mv3310_priv *priv = dev_get_drvdata(&phydev->mdio.dev);
563+
int err = 0;
564+
565+
priv->rate_match = false;
566+
567+
if (mactype == MV_V2_3340_PORT_CTRL_MACTYPE_RXAUI_NO_SGMII_AN)
568+
priv->const_interface = PHY_INTERFACE_MODE_RXAUI;
569+
else
570+
err = mv3310_init_interface(phydev, mactype);
571+
572+
return err;
573+
}
574+
560575
static int mv3310_config_init(struct phy_device *phydev)
561576
{
562577
struct mv3310_priv *priv = dev_get_drvdata(&phydev->mdio.dev);
@@ -884,6 +899,16 @@ static void mv3310_init_supported_interfaces(unsigned long *mask)
884899
__set_bit(PHY_INTERFACE_MODE_USXGMII, mask);
885900
}
886901

902+
static void mv3340_init_supported_interfaces(unsigned long *mask)
903+
{
904+
__set_bit(PHY_INTERFACE_MODE_SGMII, mask);
905+
__set_bit(PHY_INTERFACE_MODE_2500BASEX, mask);
906+
__set_bit(PHY_INTERFACE_MODE_5GBASER, mask);
907+
__set_bit(PHY_INTERFACE_MODE_RXAUI, mask);
908+
__set_bit(PHY_INTERFACE_MODE_10GBASER, mask);
909+
__set_bit(PHY_INTERFACE_MODE_USXGMII, mask);
910+
}
911+
887912
static void mv2110_init_supported_interfaces(unsigned long *mask)
888913
{
889914
__set_bit(PHY_INTERFACE_MODE_SGMII, mask);
@@ -903,6 +928,16 @@ static const struct mv3310_chip mv3310_type = {
903928
#endif
904929
};
905930

931+
static const struct mv3310_chip mv3340_type = {
932+
.init_supported_interfaces = mv3340_init_supported_interfaces,
933+
.get_mactype = mv3310_get_mactype,
934+
.init_interface = mv3340_init_interface,
935+
936+
#ifdef CONFIG_HWMON
937+
.hwmon_read_temp_reg = mv3310_hwmon_read_temp_reg,
938+
#endif
939+
};
940+
906941
static const struct mv3310_chip mv2110_type = {
907942
.init_supported_interfaces = mv2110_init_supported_interfaces,
908943
.get_mactype = mv2110_get_mactype,
@@ -916,7 +951,7 @@ static const struct mv3310_chip mv2110_type = {
916951
static struct phy_driver mv3310_drivers[] = {
917952
{
918953
.phy_id = MARVELL_PHY_ID_88X3310,
919-
.phy_id_mask = MARVELL_PHY_ID_MASK,
954+
.phy_id_mask = MARVELL_PHY_ID_88X33X0_MASK,
920955
.name = "mv88x3310",
921956
.driver_data = &mv3310_type,
922957
.get_features = mv3310_get_features,
@@ -932,6 +967,24 @@ static struct phy_driver mv3310_drivers[] = {
932967
.remove = mv3310_remove,
933968
.set_loopback = genphy_c45_loopback,
934969
},
970+
{
971+
.phy_id = MARVELL_PHY_ID_88X3340,
972+
.phy_id_mask = MARVELL_PHY_ID_88X33X0_MASK,
973+
.name = "mv88x3340",
974+
.driver_data = &mv3340_type,
975+
.get_features = mv3310_get_features,
976+
.config_init = mv3310_config_init,
977+
.probe = mv3310_probe,
978+
.suspend = mv3310_suspend,
979+
.resume = mv3310_resume,
980+
.config_aneg = mv3310_config_aneg,
981+
.aneg_done = mv3310_aneg_done,
982+
.read_status = mv3310_read_status,
983+
.get_tunable = mv3310_get_tunable,
984+
.set_tunable = mv3310_set_tunable,
985+
.remove = mv3310_remove,
986+
.set_loopback = genphy_c45_loopback,
987+
},
935988
{
936989
.phy_id = MARVELL_PHY_ID_88E2110,
937990
.phy_id_mask = MARVELL_PHY_ID_MASK,
@@ -954,7 +1007,8 @@ static struct phy_driver mv3310_drivers[] = {
9541007
module_phy_driver(mv3310_drivers);
9551008

9561009
static struct mdio_device_id __maybe_unused mv3310_tbl[] = {
957-
{ MARVELL_PHY_ID_88X3310, MARVELL_PHY_ID_MASK },
1010+
{ MARVELL_PHY_ID_88X3310, MARVELL_PHY_ID_88X33X0_MASK },
1011+
{ MARVELL_PHY_ID_88X3340, MARVELL_PHY_ID_88X33X0_MASK },
9581012
{ MARVELL_PHY_ID_88E2110, MARVELL_PHY_ID_MASK },
9591013
{ },
9601014
};

include/linux/marvell_phy.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,14 @@
2222
#define MARVELL_PHY_ID_88E1545 0x01410ea0
2323
#define MARVELL_PHY_ID_88E1548P 0x01410ec0
2424
#define MARVELL_PHY_ID_88E3016 0x01410e60
25-
#define MARVELL_PHY_ID_88X3310 0x002b09a0
2625
#define MARVELL_PHY_ID_88E2110 0x002b09b0
2726
#define MARVELL_PHY_ID_88X2222 0x01410f10
2827

28+
/* PHY IDs and mask for Alaska 10G PHYs */
29+
#define MARVELL_PHY_ID_88X33X0_MASK 0xfffffff8
30+
#define MARVELL_PHY_ID_88X3310 0x002b09a0
31+
#define MARVELL_PHY_ID_88X3340 0x002b09a8
32+
2933
/* Marvel 88E1111 in Finisar SFP module with modified PHY ID */
3034
#define MARVELL_PHY_ID_88E1111_FINISAR 0x01ff0cc0
3135

0 commit comments

Comments
 (0)