Add support for mv88e6393x family of Marvell
Subsystems (6)
v14 cover Add support for mv88e6393x family of Marvell
Hello,
so I took Pavana's patches for Amethyst and did some more work on this. I am sending version 14, which should apply cleanly on net-next.
This series is tested on Marvell CN9130-CRB.
Changes from v13:
- added patch that wraps .set_egress_port into mv88e6xxx_set_egress_port, so that we do not have to set chip->*gress_dest_port members in every implementation of this method
- for the patch that adds Amethyst support:
- added more information into commit message
- added these methods for mv88e6393x_ops:
.port_sync_link
.port_setup_message_port
.port_max_speed_mode (new implementation needed) .atu_get_hash
.atu_set_hash
.serdes_pcs_config
.serdes_pcs_an_restart
.serdes_pcs_link_up
- this device can set upstream port per port, so implement .port_set_upstream_port
instead of
.set_cpu_port
- removed USXGMII cmode (not yet supported, working on it)
- added debug messages into mv88e6393x_port_set_speed_duplex
- added Amethyst errata 4.5 (EEE should be disabled on SERDES ports)
- fixed 5gbase-r serdes configuration and interrupt handling
- refactored mv88e6393x_serdes_setup_errata
- refactored mv88e6393x_port_policy_write
- added patch implementing .port_set_policy for Amethyst
Marek
Marek Behún (2):
net: dsa: mv88e6xxx: wrap .set_egress_port method
net: dsa: mv88e6xxx: implement .port_set_policy for Amethyst
Pavana Sharma (4):
dt-bindings: net: Add 5GBASER phy interface
net: phy: Add 5GBASER interface mode
net: dsa: mv88e6xxx: Change serdes lane parameter type from u8 type to
int
net: dsa: mv88e6xxx: Add support for mv88e6393x family of Marvell
.../bindings/net/ethernet-controller.yaml | 1 + drivers/net/dsa/mv88e6xxx/chip.c | 227 ++++++++-- drivers/net/dsa/mv88e6xxx/chip.h | 20 +- drivers/net/dsa/mv88e6xxx/global1.c | 19 +- drivers/net/dsa/mv88e6xxx/global1.h | 2 + drivers/net/dsa/mv88e6xxx/global2.h | 8 + drivers/net/dsa/mv88e6xxx/port.c | 398 ++++++++++++++++-- drivers/net/dsa/mv88e6xxx/port.h | 50 ++- drivers/net/dsa/mv88e6xxx/serdes.c | 398 ++++++++++++++++-- drivers/net/dsa/mv88e6xxx/serdes.h | 108 +++-- include/linux/phy.h | 4 + 11 files changed, 1072 insertions(+), 163 deletions(-)
base-commit: 73b7a6047971aa6ce4a70fc4901964d14f077171
Signature · 1 line
2.26.2
PATCH v14 1/6 dt-bindings: net: Add 5GBASER phy interface
From: Pavana Sharma <[email protected]>
Add 5gbase-r PHY interface mode.
--- Documentation/devicetree/bindings/net/ethernet-controller.yaml | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/net/ethernet-controller.yaml +1 -0
@@ -89,6 +89,7 @@ properties: - trgmii - 1000base-x - 2500base-x + - 5gbase-r - rxaui - xaui
Signature · 1 line
2.26.2
PATCH v14 2/6 net: phy: Add 5GBASER interface mode
In reply to Marek BehúnFrom: Pavana Sharma <[email protected]>
Add 5GBASE-R phy interface mode
--- include/linux/phy.h | 4 ++++ 1 file changed, 4 insertions(+)
include/linux/phy.h +4 -0
@@ -106,6 +106,7 @@ extern const int phy_10gbit_features_array[1];* @PHY_INTERFACE_MODE_TRGMII: Turbo RGMII * @PHY_INTERFACE_MODE_1000BASEX: 1000 BaseX * @PHY_INTERFACE_MODE_2500BASEX: 2500 BaseX +* @PHY_INTERFACE_MODE_5GBASER: 5G BaseR * @PHY_INTERFACE_MODE_RXAUI: Reduced XAUI * @PHY_INTERFACE_MODE_XAUI: 10 Gigabit Attachment Unit Interface * @PHY_INTERFACE_MODE_10GBASER: 10G BaseR
@@ -137,6 +138,7 @@ typedef enum {PHY_INTERFACE_MODE_TRGMII ,PHY_INTERFACE_MODE_1000BASEX ,PHY_INTERFACE_MODE_2500BASEX , +PHY_INTERFACE_MODE_5GBASER ,PHY_INTERFACE_MODE_RXAUI , PHY_INTERFACE_MODE_XAUI,/* 10GBASE-R, XFI, SFI - single lane 10G Serdes */
@@ -207,6 +209,8 @@ static inline const char *phy_modes(phy_interface_t interface)return "1000base-x" ;case PHY_INTERFACE_MODE_2500BASEX :return "2500base-x" ; +case PHY_INTERFACE_MODE_5GBASER : +return "5gbase-r" ;case PHY_INTERFACE_MODE_RXAUI :return "rxaui" ;case PHY_INTERFACE_MODE_XAUI :
Signature · 1 line
2.26.2
PATCH v14 3/6 net: dsa: mv88e6xxx: Change serdes lane parameter type from u8 type to int
In reply to Marek BehúnFrom: Pavana Sharma <[email protected]>
Returning 0 is no more an error case with MV88E6393 family which has serdes lane numbers 0, 9 or 10.
So with this change .serdes_get_lane will return lane number or -errno (-ENODEV or -EOPNOTSUPP).
--- drivers/net/dsa/mv88e6xxx/chip.c | 28 +++++----- drivers/net/dsa/mv88e6xxx/chip.h | 16 +++--- drivers/net/dsa/mv88e6xxx/port.c | 8 +-- drivers/net/dsa/mv88e6xxx/serdes.c | 82 +++++++++++++++--------------- drivers/net/dsa/mv88e6xxx/serdes.h | 64 +++++++++++------------ 5 files changed, 99 insertions(+), 99 deletions(-)
drivers/net/dsa/mv88e6xxx/chip.c +14 -14
@@ -485,12 +485,12 @@ static int mv88e6xxx_serdes_pcs_get_state(struct dsa_switch *ds, int port, struct phylink_link_state *state) {struct mv88e6xxx_chip *chip = ds->priv; -u8 lane; +int lane;int err;mv88e6xxx_reg_lock (chip); lane =mv88e6xxx_serdes_get_lane (chip, port); -if (lane && chip->info->ops->serdes_pcs_get_state) +if (lane >=0 && chip->info->ops->serdes_pcs_get_state) err = chip->info->ops->serdes_pcs_get_state (chip, port, lane, state);else
@@ -506,11 +506,11 @@ static int mv88e6xxx_serdes_pcs_config(struct mv88e6xxx_chip *chip, int port, const unsigned long *advertise) {const struct mv88e6xxx_ops *ops = chip->info->ops; -u8 lane; +int lane;if (ops->serdes_pcs_config) { lane =mv88e6xxx_serdes_get_lane (chip, port); -if (lane) +if (lane >=0 )return ops->serdes_pcs_config (chip, port, lane, mode, interface, advertise); }
@@ -523,14 +523,14 @@ static void mv88e6xxx_serdes_pcs_an_restart(struct dsa_switch *ds, int port)struct mv88e6xxx_chip *chip = ds->priv;const struct mv88e6xxx_ops *ops;int err =0 ; -u8 lane; +int lane; ops = chip->info->ops;if (ops->serdes_pcs_an_restart) {mv88e6xxx_reg_lock (chip); lane =mv88e6xxx_serdes_get_lane (chip, port); -if (lane) +if (lane >=0 ) err = ops->serdes_pcs_an_restart (chip, port, lane);mv88e6xxx_reg_unlock (chip);
@@ -544,11 +544,11 @@ static int mv88e6xxx_serdes_pcs_link_up(struct mv88e6xxx_chip *chip, int port, int speed, int duplex) {const struct mv88e6xxx_ops *ops = chip->info->ops; -u8 lane; +int lane;if (!phylink_autoneg_inband (mode) && ops->serdes_pcs_link_up) { lane =mv88e6xxx_serdes_get_lane (chip, port); -if (lane) +if (lane >=0 )return ops->serdes_pcs_link_up (chip, port, lane, speed, duplex); }
@@ -2431,11 +2431,11 @@ static irqreturn_t mv88e6xxx_serdes_irq_thread_fn(int irq, void *dev_id)struct mv88e6xxx_chip *chip = mvp->chip;irqreturn_t ret =IRQ_NONE ;int port = mvp->port; -u8 lane; +int lane;mv88e6xxx_reg_lock (chip); lane =mv88e6xxx_serdes_get_lane (chip, port); -if (lane) +if (lane >=0 ) ret =mv88e6xxx_serdes_irq_status (chip, port, lane);mv88e6xxx_reg_unlock (chip);
@@ -2443,7 +2443,7 @@ static irqreturn_t mv88e6xxx_serdes_irq_thread_fn(int irq, void *dev_id) }static int mv88e6xxx_serdes_irq_request (struct mv88e6xxx_chip *chip,int port, -u8 lane) +int lane) {struct mv88e6xxx_port *dev_id = &chip->ports[port];unsigned int irq;
@@ -2472,7 +2472,7 @@ static int mv88e6xxx_serdes_irq_request(struct mv88e6xxx_chip *chip, int port, }static int mv88e6xxx_serdes_irq_free (struct mv88e6xxx_chip *chip,int port, -u8 lane) +int lane) {struct mv88e6xxx_port *dev_id = &chip->ports[port];unsigned int irq = dev_id->serdes_irq;
@@ -2497,11 +2497,11 @@ static int mv88e6xxx_serdes_irq_free(struct mv88e6xxx_chip *chip, int port,static int mv88e6xxx_serdes_power (struct mv88e6xxx_chip *chip,int port,bool on) { -u8 lane; +int lane;int err; lane =mv88e6xxx_serdes_get_lane (chip, port); -if (!lane) +if (lane <0 )return 0 ;if (on) {
drivers/net/dsa/mv88e6xxx/chip.h +8 -8
@@ -511,30 +511,30 @@ struct mv88e6xxx_ops {int (*mgmt_rsvd2cpu)(struct mv88e6xxx_chip *chip);/* Power on/off a SERDES interface */ -int (*serdes_power)(struct mv88e6xxx_chip *chip,int port,u8 lane, +int (*serdes_power)(struct mv88e6xxx_chip *chip,int port,int lane,bool up);/* SERDES lane mapping */ -u8 (*serdes_get_lane)(struct mv88e6xxx_chip *chip,int port); +int (*serdes_get_lane)(struct mv88e6xxx_chip *chip,int port);int (*serdes_pcs_get_state)(struct mv88e6xxx_chip *chip,int port, -u8 lane,struct phylink_link_state *state); +int lane,struct phylink_link_state *state);int (*serdes_pcs_config)(struct mv88e6xxx_chip *chip,int port, -u8 lane,unsigned int mode, +int lane,unsigned int mode,phy_interface_t interface,const unsigned long *advertise);int (*serdes_pcs_an_restart)(struct mv88e6xxx_chip *chip,int port, -u8 lane); +int lane);int (*serdes_pcs_link_up)(struct mv88e6xxx_chip *chip,int port, -u8 lane,int speed,int duplex); +int lane,int speed,int duplex);/* SERDES interrupt handling */ unsigned int (*serdes_irq_mapping)(struct mv88e6xxx_chip *chip,int port); -int (*serdes_irq_enable)(struct mv88e6xxx_chip *chip,int port,u8 lane, +int (*serdes_irq_enable)(struct mv88e6xxx_chip *chip,int port,int lane,bool enable);irqreturn_t (*serdes_irq_status)(struct mv88e6xxx_chip *chip,int port, -u8 lane); +int lane);/* Statistics from the SERDES interface */ int (*serdes_get_sset_count)(struct mv88e6xxx_chip *chip,int port);
drivers/net/dsa/mv88e6xxx/port.c +4 -4
@@ -429,8 +429,8 @@ phy_interface_t mv88e6390x_port_max_speed_mode(int port)static int mv88e6xxx_port_set_cmode (struct mv88e6xxx_chip *chip,int port,phy_interface_t mode,bool force) { -u8 lane;u16 cmode; +int lane;u16 reg;int err;
@@ -466,7 +466,7 @@ static int mv88e6xxx_port_set_cmode(struct mv88e6xxx_chip *chip, int port,return 0 ; lane =mv88e6xxx_serdes_get_lane (chip, port); -if (lane) { +if (lane >=0 ) {if (chip->ports[port].serdes_irq) { err =mv88e6xxx_serdes_irq_disable (chip, port, lane);if (err)
@@ -495,8 +495,8 @@ static int mv88e6xxx_port_set_cmode(struct mv88e6xxx_chip *chip, int port, chip->ports[port].cmode = cmode; lane =mv88e6xxx_serdes_get_lane (chip, port); -if (!lane) -return -ENODEV ; +if (lane <0 ) +return lane; err =mv88e6xxx_serdes_power_up (chip, port, lane);if (err)
drivers/net/dsa/mv88e6xxx/serdes.c +41 -41
314 lines not on this page · raw message
drivers/net/dsa/mv88e6xxx/serdes.h +32 -32
133 lines not on this page · raw message
Signature · 1 line
2.26.2
PATCH v14 4/6 net: dsa: mv88e6xxx: wrap .set_egress_port method
In reply to Marek BehúnThere are two implementations of the .set_egress_port method, and both of them, if successful, set chip->*gress_dest_port variable.
To avoid code repetition, wrap this method intomv88e6xxx_set_egress_port.
--- drivers/net/dsa/mv88e6xxx/chip.c | 48 ++++++++++++++++++----------- drivers/net/dsa/mv88e6xxx/global1.c | 19 ++---------- 2 files changed, 32 insertions(+), 35 deletions(-)
drivers/net/dsa/mv88e6xxx/chip.c +30 -18
@@ -2521,6 +2521,26 @@ static int mv88e6xxx_serdes_power(struct mv88e6xxx_chip *chip, int port,return err; } +static int mv88e6xxx_set_egress_port (struct mv88e6xxx_chip *chip, +enum mv88e6xxx_egress_direction direction, +int port) +{ +int err = -EOPNOTSUPP ; + +if (chip->info->ops->set_egress_port) { + err = chip->info->ops->set_egress_port (chip, direction, port); +if (err) +return err; + +if (direction ==MV88E6XXX_EGRESS_DIR_INGRESS ) + chip->ingress_dest_port = port; +else + chip->egress_dest_port = port; + } + +return err; +} +static int mv88e6xxx_setup_upstream_port (struct mv88e6xxx_chip *chip,int port) {struct dsa_switch *ds = chip->ds;
@@ -2543,19 +2563,17 @@ static int mv88e6xxx_setup_upstream_port(struct mv88e6xxx_chip *chip, int port)return err; } -if (chip->info->ops->set_egress_port) { - err = chip->info->ops->set_egress_port (chip, + err =mv88e6xxx_set_egress_port (chip,MV88E6XXX_EGRESS_DIR_INGRESS , upstream_port); -if (err) -return err; +if (err && err != -EOPNOTSUPP ) +return err; - err = chip->info->ops->set_egress_port (chip, + err =mv88e6xxx_set_egress_port (chip,MV88E6XXX_EGRESS_DIR_EGRESS , upstream_port); -if (err) -return err; - } +if (err && err != -EOPNOTSUPP ) +return err; }return 0 ;
@@ -5297,9 +5315,6 @@ static int mv88e6xxx_port_mirror_add(struct dsa_switch *ds, int port,int i;int err; -if (!chip->info->ops->set_egress_port) -return -EOPNOTSUPP ; -mutex_lock (&chip->reg_lock);if ((ingress ? chip->ingress_dest_port : chip->egress_dest_port) != mirror->to_local_port) {
@@ -5314,9 +5329,8 @@ static int mv88e6xxx_port_mirror_add(struct dsa_switch *ds, int port, goto out; } - err = chip->info->ops->set_egress_port (chip, - direction, - mirror->to_local_port); + err =mv88e6xxx_set_egress_port (chip, direction, + mirror->to_local_port);if (err) goto out; }
@@ -5349,10 +5363,8 @@ static void mv88e6xxx_port_mirror_del(struct dsa_switch *ds, int port,/* Reset egress port when no other mirror is active */ if (!other_mirrors) { -if (chip->info->ops->set_egress_port (chip, - direction, -dsa_upstream_port (ds, - port))) +if (mv88e6xxx_set_egress_port (chip, direction, +dsa_upstream_port (ds, port)))dev_err (ds->dev,"failed to set egress port\n" ); }
drivers/net/dsa/mv88e6xxx/global1.c +2 -17
@@ -315,7 +315,6 @@ int mv88e6095_g1_set_egress_port(struct mv88e6xxx_chip *chip, enum mv88e6xxx_egress_direction direction, int port) { - int *dest_port_chip;u16 reg;int err;
@@ -325,13 +324,11 @@ int mv88e6095_g1_set_egress_port(struct mv88e6xxx_chip *chip,switch (direction) {case MV88E6XXX_EGRESS_DIR_INGRESS : - dest_port_chip = &chip->ingress_dest_port; reg &= ~MV88E6185_G1_MONITOR_CTL_INGRESS_DEST_MASK ; reg |= port <<__bf_shf (MV88E6185_G1_MONITOR_CTL_INGRESS_DEST_MASK );break ;case MV88E6XXX_EGRESS_DIR_EGRESS : - dest_port_chip = &chip->egress_dest_port; reg &= ~MV88E6185_G1_MONITOR_CTL_EGRESS_DEST_MASK ; reg |= port <<__bf_shf (MV88E6185_G1_MONITOR_CTL_EGRESS_DEST_MASK );
@@ -340,11 +337,7 @@ int mv88e6095_g1_set_egress_port(struct mv88e6xxx_chip *chip,return -EINVAL ; } - err =mv88e6xxx_g1_write (chip,MV88E6185_G1_MONITOR_CTL , reg); -if (!err) - *dest_port_chip = port; - -return err; +return mv88e6xxx_g1_write (chip,MV88E6185_G1_MONITOR_CTL , reg); }/* Older generations also call this the ARP destination. It has been
@@ -380,28 +373,20 @@ int mv88e6390_g1_set_egress_port(struct mv88e6xxx_chip *chip, enum mv88e6xxx_egress_direction direction, int port) { - int *dest_port_chip;u16 ptr; -int err;switch (direction) {case MV88E6XXX_EGRESS_DIR_INGRESS : - dest_port_chip = &chip->ingress_dest_port; ptr =MV88E6390_G1_MONITOR_MGMT_CTL_PTR_INGRESS_DEST ;break ;case MV88E6XXX_EGRESS_DIR_EGRESS : - dest_port_chip = &chip->egress_dest_port; ptr =MV88E6390_G1_MONITOR_MGMT_CTL_PTR_EGRESS_DEST ;break ;default :return -EINVAL ; } - err =mv88e6390_g1_monitor_write (chip, ptr, port); -if (!err) - *dest_port_chip = port; - -return err; +return mv88e6390_g1_monitor_write (chip, ptr, port); }int mv88e6390_g1_set_cpu_port (struct mv88e6xxx_chip *chip,int port)
Signature · 1 line
2.26.2
PATCH v14 6/6 net: dsa: mv88e6xxx: implement .port_set_policy for Amethyst
In reply to Marek BehúnThe 16-bit Port Policy CTL register from older chips is on 6393x changed to Port Policy MGMT CTL, which can access more data, but indirectly and via 8-bit registers.
The original 16-bit value is divided into first two 8-bit register in the Port Policy MGMT CTL.
We can therefore use the previous code to compute the mask and shift, and then
- if 0 <= shift < 8, we access register 0 in Port Policy MGMT CTL
- if 8 <= shift < 16, we access register 1 in Port Policy MGMT CTL
There are in fact other possible policy settings for Amethyst which could be added here, but this can be done in the future.
--- drivers/net/dsa/mv88e6xxx/chip.c | 1 + drivers/net/dsa/mv88e6xxx/port.c | 122 ++++++++++++++++++++++++------- drivers/net/dsa/mv88e6xxx/port.h | 3 + 3 files changed, 99 insertions(+), 27 deletions(-)
drivers/net/dsa/mv88e6xxx/chip.c +1 -0
@@ -4572,6 +4572,7 @@ static const struct mv88e6xxx_ops mv88e6393x_ops = { .port_set_speed_duplex = mv88e6393x_port_set_speed_duplex, .port_max_speed_mode = mv88e6393x_port_max_speed_mode, .port_tag_remap = mv88e6390_port_tag_remap, + .port_set_policy = mv88e6393x_port_set_policy, .port_set_frame_mode = mv88e6351_port_set_frame_mode, .port_set_egress_floods = mv88e6352_port_set_egress_floods, .port_set_ether_type = mv88e6393x_port_set_ether_type,
drivers/net/dsa/mv88e6xxx/port.c +95 -27
171 lines not on this page · raw message
drivers/net/dsa/mv88e6xxx/port.h +3 -0
@@ -380,6 +380,9 @@ int mv88e6352_port_set_egress_floods(struct mv88e6xxx_chip *chip, int port,int mv88e6352_port_set_policy (struct mv88e6xxx_chip *chip,int port,enum mv88e6xxx_policy_mapping mapping,enum mv88e6xxx_policy_action action); +int mv88e6393x_port_set_policy (struct mv88e6xxx_chip *chip,int port, +enum mv88e6xxx_policy_mapping mapping, +enum mv88e6xxx_policy_action action);int mv88e6351_port_set_ether_type (struct mv88e6xxx_chip *chip,int port,u16 etype); int mv88e6393x_set_egress_port(struct mv88e6xxx_chip *chip,
Signature · 1 line
2.26.2
PATCH v14 5/6 net: dsa: mv88e6xxx: Add support for mv88e6393x family of Marvell
In reply to Marek BehúnFrom: Pavana Sharma <[email protected]>
The Marvell 88E6393X device is a single-chip integration of a 11-port Ethernet switch with eight integrated Gigabit Ethernet (GbE) transceivers and three 10-Gigabit interfaces.
This patch adds functionalities specific to mv88e6393x family (88E6393X, 88E6193X and 88E6191X).
The main differences between previous devices and this one are:
- port 0 can be a SERDES port
- all SERDESes are one-lane, eg. no XAUI nor RXAUI
- on the other hand the SERDESes can do USXGMII, 10GBASER and 5GBASER (on 6191X only one SERDES is capable of more than 1g; USXGMII is not yet supported with this change)
- Port Policy CTL register is changed to Port Policy MGMT CTL register, via which serveral more registers can be accessed indirectly
- egress monitor port is configured differently
- ingress monitor/CPU/mirror ports are configured differently and can be configured per port (ie. each port can have different ingress monitor port, for example)
- port speed AltBit works differently than previously
- PHY registers can be also accessed via MDIO address 0x18 and 0x19 (on previous devices they could be accessed only via Global 2 offsets 0x18 and 0x19, which means two indirections; this feature is not yet leveraged with this patch)
--- drivers/net/dsa/mv88e6xxx/chip.c | 150 +++++++++++++ drivers/net/dsa/mv88e6xxx/chip.h | 4 + drivers/net/dsa/mv88e6xxx/global1.h | 2 + drivers/net/dsa/mv88e6xxx/global2.h | 8 + drivers/net/dsa/mv88e6xxx/port.c | 268 +++++++++++++++++++++++ drivers/net/dsa/mv88e6xxx/port.h | 47 ++++- drivers/net/dsa/mv88e6xxx/serdes.c | 316 ++++++++++++++++++++++++++++ drivers/net/dsa/mv88e6xxx/serdes.h | 44 ++++ 8 files changed, 837 insertions(+), 2 deletions(-)
drivers/net/dsa/mv88e6xxx/chip.c +150 -0
@@ -635,6 +635,29 @@ static void mv88e6390x_phylink_validate(struct mv88e6xxx_chip *chip, int port,mv88e6390_phylink_validate (chip, port, mask, state); } +static void mv88e6393x_phylink_validate (struct mv88e6xxx_chip *chip,int port, +unsigned long *mask, +struct phylink_link_state *state) +{ +if (port ==0 || port ==9 || port ==10 ) { + phylink_set(mask, 10000baseT_Full); + phylink_set(mask, 10000baseKR_Full); + phylink_set(mask, 10000baseCR_Full); + phylink_set(mask, 10000baseSR_Full); + phylink_set(mask, 10000baseLR_Full); + phylink_set(mask, 10000baseLRM_Full); + phylink_set(mask, 10000baseER_Full); + phylink_set(mask, 5000baseT_Full); + phylink_set(mask, 2500baseX_Full); + phylink_set(mask, 2500baseT_Full); + } + + phylink_set(mask, 1000baseT_Full); + phylink_set(mask, 1000baseX_Full); + +mv88e6065_phylink_validate (chip, port, mask, state); +} +static void mv88e6xxx_validate (struct dsa_switch *ds,int port,unsigned long *supported,struct phylink_link_state *state)
@@ -4534,6 +4557,64 @@ static const struct mv88e6xxx_ops mv88e6390x_ops = { .phylink_validate = mv88e6390x_phylink_validate, }; +static const struct mv88e6xxx_ops mv88e6393x_ops = { +/* MV88E6XXX_FAMILY_6393 */ + .setup_errata = mv88e6393x_serdes_setup_errata, + .irl_init_all = mv88e6390_g2_irl_init_all, + .get_eeprom = mv88e6xxx_g2_get_eeprom8, + .set_eeprom = mv88e6xxx_g2_set_eeprom8, + .set_switch_mac = mv88e6xxx_g2_set_switch_mac, + .phy_read = mv88e6xxx_g2_smi_phy_read, + .phy_write = mv88e6xxx_g2_smi_phy_write, + .port_set_link = mv88e6xxx_port_set_link, + .port_sync_link = mv88e6xxx_port_sync_link, + .port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay, + .port_set_speed_duplex = mv88e6393x_port_set_speed_duplex, + .port_max_speed_mode = mv88e6393x_port_max_speed_mode, + .port_tag_remap = mv88e6390_port_tag_remap, + .port_set_frame_mode = mv88e6351_port_set_frame_mode, + .port_set_egress_floods = mv88e6352_port_set_egress_floods, + .port_set_ether_type = mv88e6393x_port_set_ether_type, + .port_set_jumbo_size = mv88e6165_port_set_jumbo_size, + .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting, + .port_pause_limit = mv88e6390_port_pause_limit, + .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, + .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, + .port_get_cmode = mv88e6352_port_get_cmode, + .port_set_cmode = mv88e6393x_port_set_cmode, + .port_setup_message_port = mv88e6xxx_setup_message_port, + .port_set_upstream_port = mv88e6393x_port_set_upstream_port, + .stats_snapshot = mv88e6390_g1_stats_snapshot, + .stats_set_histogram = mv88e6390_g1_stats_set_histogram, + .stats_get_sset_count = mv88e6320_stats_get_sset_count, + .stats_get_strings = mv88e6320_stats_get_strings, + .stats_get_stats = mv88e6390_stats_get_stats, + .set_egress_port = mv88e6393x_set_egress_port, + .watchdog_ops = &mv88e6390_watchdog_ops, + .mgmt_rsvd2cpu = mv88e6393x_port_mgmt_rsvd2cpu, + .pot_clear = mv88e6xxx_g2_pot_clear, + .reset = mv88e6352_g1_reset, + .rmu_disable = mv88e6390_g1_rmu_disable, + .atu_get_hash = mv88e6165_g1_atu_get_hash, + .atu_set_hash = mv88e6165_g1_atu_set_hash, + .vtu_getnext = mv88e6390_g1_vtu_getnext, + .vtu_loadpurge = mv88e6390_g1_vtu_loadpurge, + .serdes_power = mv88e6393x_serdes_power, + .serdes_get_lane = mv88e6393x_serdes_get_lane, + .serdes_pcs_get_state = mv88e6393x_serdes_pcs_get_state, + .serdes_pcs_config = mv88e6390_serdes_pcs_config, + .serdes_pcs_an_restart = mv88e6390_serdes_pcs_an_restart, + .serdes_pcs_link_up = mv88e6390_serdes_pcs_link_up, + .serdes_irq_mapping = mv88e6390_serdes_irq_mapping, + .serdes_irq_enable = mv88e6393x_serdes_irq_enable, + .serdes_irq_status = mv88e6393x_serdes_irq_status, +/* TODO: serdes stats */ + .gpio_ops = &mv88e6352_gpio_ops, + .avb_ops = &mv88e6390_avb_ops, + .ptp_ops = &mv88e6352_ptp_ops, + .phylink_validate = mv88e6393x_phylink_validate, +}; +static const struct mv88e6xxx_info mv88e6xxx_table[] = { [MV88E6085 ] = { .prod_num =MV88E6XXX_PORT_SWITCH_ID_PROD_6085 ,
@@ -4905,6 +4986,52 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { .ops = &mv88e6191_ops, }, + [MV88E6191X] = { + .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6191X, + .family = MV88E6XXX_FAMILY_6393, + .name = "Marvell 88E6191X", + .num_databases = 4096, + .num_ports = 11, /* 10 + Z80 */ + .num_internal_phys = 9, + .max_vid = 8191, + .port_base_addr = 0x0, + .phy_base_addr = 0x0, + .global1_addr = 0x1b, + .global2_addr = 0x1c, + .age_time_coeff = 3750, + .g1_irqs = 10, + .g2_irqs = 14, + .atu_move_port_mask = 0x1f, + .pvt = true, + .multi_chip = true, + .tag_protocol = DSA_TAG_PROTO_DSA, + .ptp_support = true, + .ops = &mv88e6393x_ops, + }, + + [MV88E6193X] = { + .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6193X, + .family = MV88E6XXX_FAMILY_6393, + .name = "Marvell 88E6193X", + .num_databases = 4096, + .num_ports = 11, /* 10 + Z80 */ + .num_internal_phys = 9, + .max_vid = 8191, + .port_base_addr = 0x0, + .phy_base_addr = 0x0, + .global1_addr = 0x1b, + .global2_addr = 0x1c, + .age_time_coeff = 3750, + .g1_irqs = 10, + .g2_irqs = 14, + .atu_move_port_mask = 0x1f, + .pvt = true, + .multi_chip = true, + .tag_protocol = DSA_TAG_PROTO_DSA, + .ptp_support = true, + .ops = &mv88e6393x_ops, + }, + [MV88E6220] = { .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6220, .family = MV88E6XXX_FAMILY_6250,
@@ -5195,6 +5322,29 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { .ptp_support = true, .ops = &mv88e6390x_ops, }, + + [MV88E6393X] = { + .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6393X, + .family = MV88E6XXX_FAMILY_6393, + .name = "Marvell 88E6393X", + .num_databases = 4096, + .num_ports = 11, /* 10 + Z80 */ + .num_internal_phys = 9, + .max_vid = 8191, + .port_base_addr = 0x0, + .phy_base_addr = 0x0, + .global1_addr = 0x1b, + .global2_addr = 0x1c, + .age_time_coeff = 3750, + .g1_irqs = 10, + .g2_irqs = 14, + .atu_move_port_mask = 0x1f, + .pvt = true, + .multi_chip = true, + .tag_protocol = DSA_TAG_PROTO_DSA, + .ptp_support = true, + .ops = &mv88e6393x_ops, + }, };static const struct mv88e6xxx_info *mv88e6xxx_lookup_info (unsigned int prod_num)
drivers/net/dsa/mv88e6xxx/chip.h +4 -0
@@ -63,6 +63,8 @@ enum mv88e6xxx_model {MV88E6190 ,MV88E6190X ,MV88E6191 , +MV88E6191X , +MV88E6193X ,MV88E6220 ,MV88E6240 , MV88E6250,
@@ -75,6 +77,7 @@ enum mv88e6xxx_model {MV88E6352 ,MV88E6390 ,MV88E6390X , + MV88E6393X, }; enum mv88e6xxx_family {
@@ -90,6 +93,7 @@ enum mv88e6xxx_family {MV88E6XXX_FAMILY_6351 ,/* 6171 6175 6350 6351 */ MV88E6XXX_FAMILY_6352 ,/* 6172 6176 6240 6352 */ MV88E6XXX_FAMILY_6390 ,/* 6190 6190X 6191 6290 6390 6390X */ + MV88E6XXX_FAMILY_6393, /* 6191X 6193X 6393X */ };struct mv88e6xxx_ops ;
drivers/net/dsa/mv88e6xxx/global1.h +2 -0
@@ -22,6 +22,7 @@#define MV88E6185_G1_STS_PPU_STATE_DISABLED 0x8000#define MV88E6185_G1_STS_PPU_STATE_POLLING 0xc000#define MV88E6XXX_G1_STS_INIT_READY 0x0800 +#define MV88E6393X_G1_STS_IRQ_DEVICE_2 9#define MV88E6XXX_G1_STS_IRQ_AVB 8#define MV88E6XXX_G1_STS_IRQ_DEVICE 7#define MV88E6XXX_G1_STS_IRQ_STATS 6
@@ -59,6 +60,7 @@#define MV88E6185_G1_CTL1_SCHED_PRIO 0x0800#define MV88E6185_G1_CTL1_MAX_FRAME_1632 0x0400#define MV88E6185_G1_CTL1_RELOAD_EEPROM 0x0200 +#define MV88E6393X_G1_CTL1_DEVICE2_EN 0x0200#define MV88E6XXX_G1_CTL1_DEVICE_EN 0x0080#define MV88E6XXX_G1_CTL1_STATS_DONE_EN 0x0040#define MV88E6XXX_G1_CTL1_VTU_PROBLEM_EN 0x0020
drivers/net/dsa/mv88e6xxx/global2.h +8 -0
@@ -38,9 +38,15 @@/* Offset 0x02: MGMT Enable Register 2x */ #define MV88E6XXX_G2_MGMT_EN_2X 0x02 +/* Offset 0x02: MAC LINK change IRQ Register for MV88E6393X */ +#define MV88E6393X_G2_MACLINK_INT_SRC 0x02 +/* Offset 0x03: MGMT Enable Register 0x */ #define MV88E6XXX_G2_MGMT_EN_0X 0x03 +/* Offset 0x03: MAC LINK change IRQ Mask Register for MV88E6393X */ +#define MV88E6393X_G2_MACLINK_INT_MASK 0x03 +/* Offset 0x04: Flow Control Delay Register */ #define MV88E6XXX_G2_FLOW_CTL 0x04
@@ -52,6 +58,8 @@#define MV88E6XXX_G2_SWITCH_MGMT_FORCE_FLOW_CTL_PRI 0x0080#define MV88E6XXX_G2_SWITCH_MGMT_RSVD2CPU 0x0008 +#define MV88E6393X_G2_EGRESS_MONITOR_DEST 0x05 +/* Offset 0x06: Device Mapping Table Register */ #define MV88E6XXX_G2_DEVICE_MAPPING 0x06#define MV88E6XXX_G2_DEVICE_MAPPING_UPDATE 0x8000
drivers/net/dsa/mv88e6xxx/port.c +268 -0
310 lines not on this page · raw message
drivers/net/dsa/mv88e6xxx/port.h +45 -2
110 lines not on this page · raw message
drivers/net/dsa/mv88e6xxx/serdes.c +316 -0
349 lines not on this page · raw message
drivers/net/dsa/mv88e6xxx/serdes.h +44 -0
90 lines not on this page · raw message
Signature · 1 line
2.26.2
PATCH v14 4/6 net: dsa: mv88e6xxx: wrap .set_egress_port method
In reply to Marek BehúnPATCH v14 6/6 net: dsa: mv88e6xxx: implement .port_set_policy for Amethyst
In reply to Marek BehúnAndrew Lunn
maintainerRe: [PATCH net-next v14 1/6] dt-bindings: net: Add 5GBASER phy interface
In reply to Marek BehúnQuoted 8 lines · Marek Behún
From: Pavana Sharma <[email protected]>
Add 5gbase-r PHY interface mode.
Signed-off-by Pavana Sharma <[email protected]>Reviewed-by Andrew Lunn <[email protected]>Reviewed-by Marek Behún <[email protected]>Acked-by Rob Herring <[email protected]>
Hi Marek
Now that you are posting these patches, they need your Signed-off-by:
as well as Pavana.
Andrew
Russell King - ARM Linux admin
reviewerRe: [PATCH net-next v14 2/6] net: phy: Add 5GBASER interface mode
In reply to Marek BehúnQuoted 7 lines · Marek Behún
From: Pavana Sharma <[email protected]>
Add 5GBASE-R phy interface mode
Signed-off-by Pavana Sharma <[email protected]>Reviewed-by Andrew Lunn <[email protected]>Reviewed-by Marek Behún <[email protected]>
Please document this in Documentation/networking/phy.rst under the "PHY interface modes" section. Thanks.
Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
Re: [PATCH net-next v14 2/6] net: phy: Add 5GBASER interface mode
Quoted 2 lines · On Mon, 11 Jan 2021 16:48:03 +0000 Russell King - ARM Linux admin…
Please document this in
Documentation/networking/phy.rstunder the "PHY interface modes" section. Thanks.
Should this documentation come in a separate patch? Or can it be embedded in this one?
Vladimir Oltean
maintainerRe: [PATCH net-next v14 4/6] net: dsa: mv88e6xxx: wrap .set_egress_port method
In reply to Marek BehúnQuoted 17 lines · Marek Behún
There are two implementations of the .set_egress_port method, and both of them, if successful, set chip->*gress_dest_port variable.
To avoid code repetition, wrap this method into
mv88e6xxx_set_egress_port.Signed-off-by Marek Behún <[email protected]>--- drivers/net/dsa/mv88e6xxx/chip.c | 48 ++++++++++++++++++----------- drivers/net/dsa/mv88e6xxx/global1.c | 19 ++---------- 2 files changed, 32 insertions(+), 35 deletions(-)drivers/net/dsa/mv88e6xxx/chip.c +0
-0
drivers/net/dsa/mv88e6xxx/chip.c static int mv88e6xxx_serdes_power(struct mv88e6xxx_chip *chip, int port, · line 2530
Quoted 10 lines
drivers/net/dsa/mv88e6xxx/chip.c +7
-0@@ -2521,6 +2521,26 @@ static int mv88e6xxx_serdes_power(struct mv88e6xxx_chip *chip, int port,return err; } +static int mv88e6xxx_set_egress_port (struct mv88e6xxx_chip *chip, +enum mv88e6xxx_egress_direction direction, +int port) +{ +int err = -EOPNOTSUPP ; + +if (chip->info->ops->set_egress_port) {
I would probably return -EOPNOTSUPP early and reduce the indentation level by one:
if (!chip->info->ops->set_egress_port) return -EOPNOTSUPP;
Re: [PATCH net-next v14 3/6] net: dsa: mv88e6xxx: Change serdes lane parameter type from u8 type to int
In reply to Marek BehúnQuoted 11 lines · Marek Behún
From: Pavana Sharma <[email protected]>
Returning 0 is no more an error case with MV88E6393 family which has serdes lane numbers 0, 9 or 10.
So with this change .serdes_get_lane will return lane number or -errno (-ENODEVor-EOPNOTSUPP).Signed-off-by Pavana Sharma <[email protected]>Reviewed-by Andrew Lunn <[email protected]>Reviewed-by Marek Behún <[email protected]>---
Vladimir Oltean
maintainerRe: [PATCH net-next v14 5/6] net: dsa: mv88e6xxx: Add support for mv88e6393x family of Marvell
In reply to Marek BehúnQuoted 9 lines · Marek Behún
From: Pavana Sharma <[email protected]>
The Marvell 88E6393X device is a single-chip integration of a 11-port Ethernet switch with eight integrated Gigabit Ethernet (GbE) transceivers and three 10-Gigabit interfaces.
This patch adds functionalities specific to mv88e6393x family (88E6393X, 88E6193X and 88E6191X).
Quoted 8 lines
The main differences between previous devices and this one are:
- port 0 can be a SERDES port
- all SERDESes are one-lane, eg. no XAUI nor RXAUI
- on the other hand the SERDESes can do USXGMII, 10GBASER and 5GBASER (on 6191X only one SERDES is capable of more than 1g; USXGMII is not yet supported with this change)
- Port Policy CTL register is changed to Port Policy MGMT CTL register, via which serveral more registers can be accessed indirectly
~~~~~~~~
severalQuoted 16 lines
- egress monitor port is configured differently
- ingress monitor/CPU/mirror ports are configured differently and can be configured per port (ie. each port can have different ingress monitor port, for example)
- port speed AltBit works differently than previously
- PHY registers can be also accessed via MDIO address0x18and0x19(on previous devices they could be accessed only via Global 2 offsets0x18and0x19, which means two indirections; this feature is not yet leveraged with this patch)Co-developed-by Ashkan Boldaji <[email protected]>Signed-off-by Ashkan Boldaji <[email protected]>Signed-off-by Pavana Sharma <[email protected]>Co-developed-by Marek Behún <[email protected]>Signed-off-by Marek Behún <[email protected]>---
drivers/net/dsa/mv88e6xxx/chip.c static void mv88e6390x_phylink_validate(struct mv88e6xxx_chip *chip, int port, · line 644
Quoted 7 lines
drivers/net/dsa/mv88e6xxx/chip.c +7
-0+static void mv88e6393x_phylink_validate (struct mv88e6xxx_chip *chip,int port, +unsigned long *mask, +struct phylink_link_state *state) +{ +if (port ==0 || port ==9 || port ==10 ) { + phylink_set(mask, 10000baseT_Full); + phylink_set(mask, 10000baseKR_Full);
I think I understand the reason for declaring 10GBase-KR support in phylink_validate, in case the PHY supports that link mode on the media side, but...
Quoted 27 lines
drivers/net/dsa/mv88e6xxx/chip.c +19
-0+ phylink_set(mask, 10000baseCR_Full); + phylink_set(mask, 10000baseSR_Full); + phylink_set(mask, 10000baseLR_Full); + phylink_set(mask, 10000baseLRM_Full); + phylink_set(mask, 10000baseER_Full); + phylink_set(mask, 5000baseT_Full); + phylink_set(mask, 2500baseX_Full); + phylink_set(mask, 2500baseT_Full); + } + + phylink_set(mask, 1000baseT_Full); + phylink_set(mask, 1000baseX_Full); + +mv88e6065_phylink_validate (chip, port, mask, state); +} +@@ -450,6 +559,9 @@ static int mv88e6xxx_port_set_cmode(struct mv88e6xxx_chip *chip, int port,case PHY_INTERFACE_MODE_2500BASEX : cmode =MV88E6XXX_PORT_STS_CMODE_2500BASEX ;break ; +case PHY_INTERFACE_MODE_5GBASER : + cmode =MV88E6393X_PORT_STS_CMODE_5GBASER ; +break ;case PHY_INTERFACE_MODE_XGMII :case PHY_INTERFACE_MODE_XAUI : cmode =MV88E6XXX_PORT_STS_CMODE_XAUI ;
drivers/net/dsa/mv88e6xxx/chip.c static int mv88e6xxx_port_set_cmode(struct mv88e6xxx_chip *chip, int port, · line 573
Quoted 5 lines
drivers/net/dsa/mv88e6xxx/chip.c +2
-0@@ -457,6 +569,10 @@ static int mv88e6xxx_port_set_cmode(struct mv88e6xxx_chip *chip, int port,case PHY_INTERFACE_MODE_RXAUI : cmode =MV88E6XXX_PORT_STS_CMODE_RXAUI ;break ; +case PHY_INTERFACE_MODE_10GBASER : +case PHY_INTERFACE_MODE_10GKR :
Does the SERDES actually support 10GBase-KR (aka 10GBase-R for copper backplanes)? It is different than plain 10GBase-R (abusingly called XFI) by the need of a link training procedure to negotiate SERDES eye parameters. There have been discussion in the past where it turned out that drivers which didn't really support 10GBase-KR incorrectly reported that they did.
Quoted 37 lines
drivers/net/dsa/mv88e6xxx/port.c +25
-0+ cmode =MV88E6393X_PORT_STS_CMODE_10GBASER ; +break ;default : cmode =0 ; }@@ -541,6 +657,29 @@ int mv88e6390_port_set_cmode(struct mv88e6xxx_chip *chip, int port,return mv88e6xxx_port_set_cmode (chip, port, mode, false); } +int mv88e6393x_port_set_cmode (struct mv88e6xxx_chip *chip,int port, +phy_interface_t mode) +{ +int err; +u16 reg; + +if (port !=0 && port !=9 && port !=10 ) +return -EOPNOTSUPP ; + +/* mv88e6393x errata 4.5: EEE should be disabled on SERDES ports */ + err =mv88e6xxx_port_read (chip, port,MV88E6XXX_PORT_MAC_CTL , ®); +if (err) +return err; + + reg &= ~MV88E6XXX_PORT_MAC_CTL_EEE ; + reg |=MV88E6XXX_PORT_MAC_CTL_FORCE_EEE ; + err =mv88e6xxx_port_write (chip, port,MV88E6XXX_PORT_MAC_CTL , reg); +if (err) +return err; + +return mv88e6xxx_port_set_cmode (chip, port, mode, false); +} +static int mv88e6341_port_set_cmode_writable (struct mv88e6xxx_chip *chip,int port) {@@ -1164,6 +1303,135 @@ int mv88e6xxx_port_disable_pri_override(struct mv88e6xxx_chip *chip, int port)return mv88e6xxx_port_write (chip, port,MV88E6XXX_PORT_PRI_OVERRIDE ,0 );
drivers/net/dsa/mv88e6xxx/port.c int mv88e6xxx_port_disable_pri_override(struct mv88e6xxx_chip *chip, int port) · line 1313
Quoted 10 lines
drivers/net/dsa/mv88e6xxx/port.c +8
-0} +/* Offset 0x0E: Policy & MGMT Control Register for FAMILY 6191X 6193X 6393X */ + +static int mv88e6393x_port_policy_write (struct mv88e6xxx_chip *chip,int port, +u16 pointer,u8 data) +{ +u16 reg; + + reg =MV88E6393X_PORT_POLICY_MGMT_CTL_UPDATE | pointer | data;
I think the assignment fits on the same line as the declaration?
Quoted 18 lines
drivers/net/dsa/mv88e6xxx/serdes.c +18
-0+ +return mv88e6xxx_port_write (chip, port,MV88E6393X_PORT_POLICY_MGMT_CTL , + reg); +} + +int mv88e6393x_serdes_setup_errata (struct mv88e6xxx_chip *chip) +{ +int err; + + err =mv88e6393x_serdes_port_errata (chip,MV88E6393X_PORT0_LANE ); +if (err) +return err; + + err =mv88e6393x_serdes_port_errata (chip,MV88E6393X_PORT9_LANE ); +if (err) +return err; + +return mv88e6393x_serdes_port_errata (chip,MV88E6393X_PORT10_LANE );
drivers/net/dsa/mv88e6xxx/serdes.c void mv88e6390_serdes_get_regs(struct mv88e6xxx_chip *chip, int port, void *_p) · line 1330
Quoted 10 lines
drivers/net/dsa/mv88e6xxx/serdes.c +10
-0+} + +static int mv88e6393x_serdes_port_config (struct mv88e6xxx_chip *chip,int lane, +bool on) +{ +u8 cmode = chip->ports[lane].cmode; +u16 reg, pcs; +int err; + +if (on) {
And if "on" is false? Nothing? Why even pass it as an argument then? Why even call mv88e6393x_serdes_port_config?
Quoted 100 lines
drivers/net/dsa/mv88e6xxx/serdes.c +100
-0+switch (cmode) { +case MV88E6XXX_PORT_STS_CMODE_SGMII : + pcs =MV88E6393X_PCS_SELECT_SGMII_MAC ; +break ; +case MV88E6XXX_PORT_STS_CMODE_1000BASEX : + pcs =MV88E6393X_PCS_SELECT_1000BASEX ; +break ; +case MV88E6XXX_PORT_STS_CMODE_2500BASEX : + pcs =MV88E6393X_PCS_SELECT_2500BASEX ; +break ; +case MV88E6393X_PORT_STS_CMODE_5GBASER : + pcs =MV88E6393X_PCS_SELECT_5GBASER ; +break ; +case MV88E6393X_PORT_STS_CMODE_10GBASER : + pcs =MV88E6393X_PCS_SELECT_10GBASER ; +break ; +default : + pcs =MV88E6393X_PCS_SELECT_1000BASEX ; +break ; + } + +/* mv88e6393x family errata 3.6 : +* When changing c_mode on Port 0 from [x]MII mode to any +* SERDES mode SERDES will not be operational. +* Workaround: Set Port0 SERDES register 4.F002.5=0 +*/ + err =mv88e6390_serdes_read (chip, lane,MDIO_MMD_PHYXS , +MV88E6393X_SERDES_POC , ®); +if (err) +return err; + + reg &= ~(MV88E6393X_SERDES_POC_PCS_MODE_MASK | +MV88E6393X_SERDES_POC_PDOWN ); + reg |= pcs; + + err =mv88e6390_serdes_write (chip, lane,MDIO_MMD_PHYXS , +MV88E6393X_SERDES_POC , reg); +if (err) +return err; + + reg |=MV88E6393X_SERDES_POC_RESET ; + err =mv88e6390_serdes_write (chip, lane,MDIO_MMD_PHYXS , +MV88E6393X_SERDES_POC , reg); +if (err) +return err; + +/* mv88e6393x family errata 3.7 : +* When changing cmode on SERDES port from any other mode to +* 1000BASE-X mode the link may not come up due to invalid +* 1000BASE-X advertisement. +* Workaround: Correct advertisement and reset PHY core. +*/ +if (cmode ==MV88E6XXX_PORT_STS_CMODE_1000BASEX ) { + reg =MV88E6390_SGMII_ANAR_1000BASEX_FD ; + err =mv88e6390_serdes_write (chip, lane,MDIO_MMD_PHYXS , +MV88E6390_SGMII_ANAR , reg); +if (err) +return err; + +/* soft reset the PCS/PMA */ + err =mv88e6390_serdes_read (chip, lane,MDIO_MMD_PHYXS , +MV88E6390_SGMII_CONTROL , + ®); +if (err) +return err; + + reg |=MV88E6390_SGMII_CONTROL_RESET ; + err =mv88e6390_serdes_write (chip, lane,MDIO_MMD_PHYXS , +MV88E6390_SGMII_CONTROL , + reg); +if (err) +return err; + } + } + +return 0 ; +} + +int mv88e6393x_serdes_power (struct mv88e6xxx_chip *chip,int port,int lane, +bool on) +{ +u8 cmode = chip->ports[port].cmode; + +if (port !=0 && port !=9 && port !=10 ) +return -EOPNOTSUPP ; + +mv88e6393x_serdes_port_config (chip, lane, on); + +switch (cmode) { +case MV88E6XXX_PORT_STS_CMODE_SGMII : +case MV88E6XXX_PORT_STS_CMODE_1000BASEX : +case MV88E6XXX_PORT_STS_CMODE_2500BASEX : +return mv88e6390_serdes_power_sgmii (chip, lane, on); +case MV88E6393X_PORT_STS_CMODE_5GBASER : +case MV88E6393X_PORT_STS_CMODE_10GBASER : +return mv88e6390_serdes_power_10g (chip, lane, on); + } + +return 0 ; +}
Re: [PATCH net-next v14 5/6] net: dsa: mv88e6xxx: Add support for mv88e6393x family of Marvell
Hi Vladimir,
Quoted 4 lines · On Tue, 12 Jan 2021 13:11:39 +0200 Vladimir Oltean <[email protected]> wrote:
Quoted 1 line · Marek Behún
via which serveral more registers can be accessed indirectly
~~~~~~~~ several
Thanks.
Quoted 11 lines
drivers/net/dsa/mv88e6xxx/chip.c static void mv88e6390x_phylink_validate(struct mv88e6xxx_chip *chip, int port, · line 644
Quoted 7 lines
drivers/net/dsa/mv88e6xxx/chip.c +7
-0+static void mv88e6393x_phylink_validate (struct mv88e6xxx_chip *chip,int port, +unsigned long *mask, +struct phylink_link_state *state) +{ +if (port ==0 || port ==9 || port ==10 ) { + phylink_set(mask, 10000baseT_Full); + phylink_set(mask, 10000baseKR_Full);I think I understand the reason for declaring 10GBase-KR support in
phylink_validate, in case the PHY supports that link mode on the media side, but...
Hmm, yes, maybe KR shouldn't be here, but then why is it in mv88e6390x_phylink_validate?
Quoted 14 lines
Quoted 14 lines
drivers/net/dsa/mv88e6xxx/port.c +4
-0case PHY_INTERFACE_MODE_2500BASEX : cmode =MV88E6XXX_PORT_STS_CMODE_2500BASEX ;break ; +case PHY_INTERFACE_MODE_5GBASER : + cmode =MV88E6393X_PORT_STS_CMODE_5GBASER ; +break ;case PHY_INTERFACE_MODE_XGMII :case PHY_INTERFACE_MODE_XAUI : cmode =MV88E6XXX_PORT_STS_CMODE_XAUI ;@@ -457,6 +569,10 @@ static int mv88e6xxx_port_set_cmode(struct mv88e6xxx_chip *chip, int port,case PHY_INTERFACE_MODE_RXAUI : cmode =MV88E6XXX_PORT_STS_CMODE_RXAUI ;break ; +case PHY_INTERFACE_MODE_10GBASER :
Quoted 8 lines
drivers/net/dsa/mv88e6xxx/port.c static int mv88e6xxx_port_set_cmode(struct mv88e6xxx_chip *chip, int port, · line 573
Quoted 1 line
drivers/net/dsa/mv88e6xxx/port.c +1
-0+case PHY_INTERFACE_MODE_10GKR :Does the SERDES actually support 10GBase-KR (aka 10GBase-R for copper backplanes)? It is different than plain 10GBase-R (abusingly called XFI) by the need of a link training procedure to negotiate SERDES eye parameters. There have been discussion in the past where it turned out that drivers which didn't really support 10GBase-KR incorrectly reported that they did.
Yes, PHY_INTERFACE_MODE_10GKR should probably not be here. I think some other drivers still support it because of old device trees, but this driver does not need to.
Quoted 9 lines
drivers/net/dsa/mv88e6xxx/port.c int mv88e6xxx_port_disable_pri_override(struct mv88e6xxx_chip *chip, int port) · line 1313
Quoted 6 lines
drivers/net/dsa/mv88e6xxx/port.c +6
-0+static int mv88e6393x_port_policy_write (struct mv88e6xxx_chip *chip,int port, +u16 pointer,u8 data) +{ +u16 reg; + + reg =MV88E6393X_PORT_POLICY_MGMT_CTL_UPDATE | pointer | data;I think the assignment fits on the same line as the declaration?
And I think it read better this way. But even if it was not, this structure of code was copied from mv88e6390_g1_monitor_write in global1.c, where it is written this way. I prefer this patch to do a new thing in the same style. If you want, you can then send a patch that changes it in all places at once.
Quoted 11 lines
drivers/net/dsa/mv88e6xxx/serdes.c void mv88e6390_serdes_get_regs(struct mv88e6xxx_chip *chip, int port, void *_p) · line 1330
Quoted 8 lines
drivers/net/dsa/mv88e6xxx/serdes.c +8
-0+static int mv88e6393x_serdes_port_config (struct mv88e6xxx_chip *chip,int lane, +bool on) +{ +u8 cmode = chip->ports[lane].cmode; +u16 reg, pcs; +int err; + +if (on) {And if "on" is false? Nothing? Why even pass it as an argument then? Why even call
mv88e6393x_serdes_port_config?
You are right, I will change it.
Thanks, Vladimir.
Russell King - ARM Linux admin
reviewerRe: [PATCH net-next v14 5/6] net: dsa: mv88e6xxx: Add support for mv88e6393x family of Marvell
Quoted 12 lines · Marek Behún
Quoted 11 lines
drivers/net/dsa/mv88e6xxx/chip.c static void mv88e6390x_phylink_validate(struct mv88e6xxx_chip *chip, int port, · line 644
Quoted 7 lines
drivers/net/dsa/mv88e6xxx/chip.c +7
-0+static void mv88e6393x_phylink_validate (struct mv88e6xxx_chip *chip,int port, +unsigned long *mask, +struct phylink_link_state *state) +{ +if (port ==0 || port ==9 || port ==10 ) { + phylink_set(mask, 10000baseT_Full); + phylink_set(mask, 10000baseKR_Full);I think I understand the reason for declaring 10GBase-KR support in
phylink_validate, in case the PHY supports that link mode on the media side, but...
Quoted 2 lines
Hmm, yes, maybe KR shouldn't be here, but then why is it in
mv88e6390x_phylink_validate?
I'm seriously thinking about changing the phylink_validate() interface such that the question of which link _modes_ are supported no longer comes up with MAC drivers, but instead MAC drivers say what interface modes, speeds for each interface mode, duplexes for each speed are supported.
There are certainly PHYs out there that take XAUI/RXAUI on the host side and provide 10GBASE-KR on the "media" side. VSC8489 is an example of such a PHY.
Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
Re: [PATCH net-next v14 5/6] net: dsa: mv88e6xxx: Add support for mv88e6393x family of Marvell
Quoted 13 lines · On Tue, 12 Jan 2021 16:29:09 +0000 Russell King - ARM Linux admin…
Quoted 12 lines · Marek Behún
Quoted 11 lines
drivers/net/dsa/mv88e6xxx/chip.c static void mv88e6390x_phylink_validate(struct mv88e6xxx_chip *chip, int port, · line 644
Quoted 7 lines
drivers/net/dsa/mv88e6xxx/chip.c +7
-0+static void mv88e6393x_phylink_validate (struct mv88e6xxx_chip *chip,int port, +unsigned long *mask, +struct phylink_link_state *state) +{ +if (port ==0 || port ==9 || port ==10 ) { + phylink_set(mask, 10000baseT_Full); + phylink_set(mask, 10000baseKR_Full);I think I understand the reason for declaring 10GBase-KR support in
phylink_validate, in case the PHY supports that link mode on the media side, but...
Quoted 8 lines
Quoted 2 lines
Hmm, yes, maybe KR shouldn't be here, but then why is it in
mv88e6390x_phylink_validate?I'm seriously thinking about changing the
phylink_validate()interface such that the question of which link _modes_ are supported no longer comes up with MAC drivers, but instead MAC drivers say what interface modes, speeds for each interface mode, duplexes for each speed are supported.
Russell, I would be happy to help with such endeavour.
Re: [PATCH net-next v14 5/6] net: dsa: mv88e6xxx: Add support for mv88e6393x family of Marvell
In reply to Russell King - ARM Linux adminQuoted 5 lines · On Tue, 12 Jan 2021 16:29:09 +0000 Russell King - ARM Linux admin…
I'm seriously thinking about changing the
phylink_validate()interface such that the question of which link _modes_ are supported no longer comes up with MAC drivers, but instead MAC drivers say what interface modes, speeds for each interface mode, duplexes for each speed are supported.
BTW this would also solve the situation where DSA needs to know which interface modes are supported on a particular port to know which modes we can try on SFP connected to a DSA port.
Vladimir Oltean
maintainerRe: [PATCH net-next v14 5/6] net: dsa: mv88e6xxx: Add support for mv88e6393x family of Marvell
Quoted 9 lines · Marek Behún
Quoted 5 lines · On Tue, 12 Jan 2021 16:29:09 +0000 Russell King - ARM Linux admin…
I'm seriously thinking about changing the
phylink_validate()interface such that the question of which link _modes_ are supported no longer comes up with MAC drivers, but instead MAC drivers say what interface modes, speeds for each interface mode, duplexes for each speed are supported.
Quoted 3 lines
BTW this would also solve the situation where DSA needs to know which interface modes are supported on a particular port to know which modes we can try on SFP connected to a DSA port.
What do you mean here? What makes this specific to DSA?
Re: [PATCH net-next v14 5/6] net: dsa: mv88e6xxx: Add support for mv88e6393x family of Marvell
Quoted 10 lines · On Tue, 12 Jan 2021 23:58:24 +0200 Vladimir Oltean <[email protected]> wrote:
Quoted 9 lines · Marek Behún
Quoted 5 lines · On Tue, 12 Jan 2021 16:29:09 +0000 Russell King - ARM Linux admin…
I'm seriously thinking about changing the
phylink_validate()interface such that the question of which link _modes_ are supported no longer comes up with MAC drivers, but instead MAC drivers say what interface modes, speeds for each interface mode, duplexes for each speed are supported.
Quoted 5 lines
Quoted 3 lines
BTW this would also solve the situation where DSA needs to know which interface modes are supported on a particular port to know which modes we can try on SFP connected to a DSA port.
What do you mean here? What makes this specific to DSA?