Commit 01488a0c authored by Rafał Miłecki's avatar Rafał Miłecki Committed by David S. Miller

net: dsa: bcm_sf2: store PHY interface/mode in port structure

It's needed later for proper switch / crossbar setup.
Signed-off-by: default avatarRafał Miłecki <rafal@milecki.pl>
Acked-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 6ad08600
...@@ -443,10 +443,11 @@ static void bcm_sf2_intr_disable(struct bcm_sf2_priv *priv) ...@@ -443,10 +443,11 @@ static void bcm_sf2_intr_disable(struct bcm_sf2_priv *priv)
static void bcm_sf2_identify_ports(struct bcm_sf2_priv *priv, static void bcm_sf2_identify_ports(struct bcm_sf2_priv *priv,
struct device_node *dn) struct device_node *dn)
{ {
struct device *dev = priv->dev->ds->dev;
struct bcm_sf2_port_status *port_st;
struct device_node *port; struct device_node *port;
unsigned int port_num; unsigned int port_num;
struct property *prop; struct property *prop;
phy_interface_t mode;
int err; int err;
priv->moca_port = -1; priv->moca_port = -1;
...@@ -455,19 +456,26 @@ static void bcm_sf2_identify_ports(struct bcm_sf2_priv *priv, ...@@ -455,19 +456,26 @@ static void bcm_sf2_identify_ports(struct bcm_sf2_priv *priv,
if (of_property_read_u32(port, "reg", &port_num)) if (of_property_read_u32(port, "reg", &port_num))
continue; continue;
if (port_num >= DSA_MAX_PORTS) {
dev_err(dev, "Invalid port number %d\n", port_num);
continue;
}
port_st = &priv->port_sts[port_num];
/* Internal PHYs get assigned a specific 'phy-mode' property /* Internal PHYs get assigned a specific 'phy-mode' property
* value: "internal" to help flag them before MDIO probing * value: "internal" to help flag them before MDIO probing
* has completed, since they might be turned off at that * has completed, since they might be turned off at that
* time * time
*/ */
err = of_get_phy_mode(port, &mode); err = of_get_phy_mode(port, &port_st->mode);
if (err) if (err)
continue; continue;
if (mode == PHY_INTERFACE_MODE_INTERNAL) if (port_st->mode == PHY_INTERFACE_MODE_INTERNAL)
priv->int_phy_mask |= 1 << port_num; priv->int_phy_mask |= 1 << port_num;
if (mode == PHY_INTERFACE_MODE_MOCA) if (port_st->mode == PHY_INTERFACE_MODE_MOCA)
priv->moca_port = port_num; priv->moca_port = port_num;
if (of_property_read_bool(port, "brcm,use-bcm-hdr")) if (of_property_read_bool(port, "brcm,use-bcm-hdr"))
......
...@@ -44,6 +44,7 @@ struct bcm_sf2_hw_params { ...@@ -44,6 +44,7 @@ struct bcm_sf2_hw_params {
#define BCM_SF2_REGS_NUM 6 #define BCM_SF2_REGS_NUM 6
struct bcm_sf2_port_status { struct bcm_sf2_port_status {
phy_interface_t mode;
unsigned int link; unsigned int link;
bool enabled; bool enabled;
}; };
......
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