Commit 42fc6a4c authored by Tristram Ha's avatar Tristram Ha Committed by David S. Miller

net: dsa: microchip: prepare PHY for proper advertisement

Prepare PHY for proper advertisement as sometimes the PHY in the switch
has its own problems even though it may share the PHY id from regular PHY
but the fixes in the PHY driver do not apply.
Signed-off-by: default avatarTristram Ha <Tristram.Ha@microchip.com>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 84f29264
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/* /*
* Microchip KSZ9477 switch driver main logic * Microchip KSZ9477 switch driver main logic
* *
* Copyright (C) 2017-2018 Microchip Technology Inc. * Copyright (C) 2017-2019 Microchip Technology Inc.
*/ */
#include <linux/delay.h> #include <linux/delay.h>
...@@ -966,6 +966,16 @@ static void ksz9477_port_mirror_del(struct dsa_switch *ds, int port, ...@@ -966,6 +966,16 @@ static void ksz9477_port_mirror_del(struct dsa_switch *ds, int port,
PORT_MIRROR_SNIFFER, false); PORT_MIRROR_SNIFFER, false);
} }
static void ksz9477_phy_setup(struct ksz_device *dev, int port,
struct phy_device *phy)
{
if (port < dev->phy_port_cnt) {
/* The MAC actually cannot run in 1000 half-duplex mode. */
phy_remove_link_mode(phy,
ETHTOOL_LINK_MODE_1000baseT_Half_BIT);
}
}
static void ksz9477_port_setup(struct ksz_device *dev, int port, bool cpu_port) static void ksz9477_port_setup(struct ksz_device *dev, int port, bool cpu_port)
{ {
u8 data8; u8 data8;
...@@ -1299,6 +1309,7 @@ static const struct ksz_dev_ops ksz9477_dev_ops = { ...@@ -1299,6 +1309,7 @@ static const struct ksz_dev_ops ksz9477_dev_ops = {
.get_port_addr = ksz9477_get_port_addr, .get_port_addr = ksz9477_get_port_addr,
.cfg_port_member = ksz9477_cfg_port_member, .cfg_port_member = ksz9477_cfg_port_member,
.flush_dyn_mac_table = ksz9477_flush_dyn_mac_table, .flush_dyn_mac_table = ksz9477_flush_dyn_mac_table,
.phy_setup = ksz9477_phy_setup,
.port_setup = ksz9477_port_setup, .port_setup = ksz9477_port_setup,
.shutdown = ksz9477_reset_switch, .shutdown = ksz9477_reset_switch,
.detect = ksz9477_switch_detect, .detect = ksz9477_switch_detect,
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/* /*
* Microchip switch driver main logic * Microchip switch driver main logic
* *
* Copyright (C) 2017-2018 Microchip Technology Inc. * Copyright (C) 2017-2019 Microchip Technology Inc.
*/ */
#include <linux/delay.h> #include <linux/delay.h>
...@@ -238,6 +238,7 @@ int ksz_enable_port(struct dsa_switch *ds, int port, struct phy_device *phy) ...@@ -238,6 +238,7 @@ int ksz_enable_port(struct dsa_switch *ds, int port, struct phy_device *phy)
/* setup slave port */ /* setup slave port */
dev->dev_ops->port_setup(dev, port, false); dev->dev_ops->port_setup(dev, port, false);
dev->dev_ops->phy_setup(dev, port, phy);
/* port_stp_state_set() will be called after to enable the port so /* port_stp_state_set() will be called after to enable the port so
* there is no need to do anything. * there is no need to do anything.
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* *
* Microchip KSZ series switch common definitions * Microchip KSZ series switch common definitions
* *
* Copyright (C) 2017-2018 Microchip Technology Inc. * Copyright (C) 2017-2019 Microchip Technology Inc.
*/ */
#ifndef __KSZ_PRIV_H #ifndef __KSZ_PRIV_H
...@@ -137,6 +137,8 @@ struct ksz_dev_ops { ...@@ -137,6 +137,8 @@ struct ksz_dev_ops {
u32 (*get_port_addr)(int port, int offset); u32 (*get_port_addr)(int port, int offset);
void (*cfg_port_member)(struct ksz_device *dev, int port, u8 member); void (*cfg_port_member)(struct ksz_device *dev, int port, u8 member);
void (*flush_dyn_mac_table)(struct ksz_device *dev, int port); void (*flush_dyn_mac_table)(struct ksz_device *dev, int port);
void (*phy_setup)(struct ksz_device *dev, int port,
struct phy_device *phy);
void (*port_setup)(struct ksz_device *dev, int port, bool cpu_port); void (*port_setup)(struct ksz_device *dev, int port, bool cpu_port);
void (*r_phy)(struct ksz_device *dev, u16 phy, u16 reg, u16 *val); void (*r_phy)(struct ksz_device *dev, u16 phy, u16 reg, u16 *val);
void (*w_phy)(struct ksz_device *dev, u16 phy, u16 reg, u16 val); void (*w_phy)(struct ksz_device *dev, u16 phy, u16 reg, u16 val);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment