Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1482070
| From | Andrew Lunn <andrew@lunn.ch> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 3/3] net-next: dsa: add new driver for qca8xxx family |
| Date | 2016-09-13 02:50 +0200 |
| Message-ID | <sgK5b-2Cj-5@gated-at.bofh.it> (permalink) |
| References | <sguWt-OS-3@gated-at.bofh.it> <sguWu-OS-33@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Hi John
> +static u16
> +qca8k_phy_mmd_read(struct qca8k_priv *priv, int phy_addr, u16 addr, u16 reg)
> +{
> + u16 data;
> +
> + mutex_lock(&priv->bus->mdio_lock);
> +
> + priv->bus->write(priv->bus, phy_addr, MII_ATH_MMD_ADDR, addr);
> + priv->bus->write(priv->bus, phy_addr, MII_ATH_MMD_DATA, reg);
> + priv->bus->write(priv->bus, phy_addr, MII_ATH_MMD_ADDR, addr | 0x4000);
> + data = priv->bus->read(priv->bus, phy_addr, MII_ATH_MMD_DATA);
> +
> + mutex_unlock(&priv->bus->mdio_lock);
> +
> + return data;
> +}
snip
> +static int
> +qca8k_get_eee(struct dsa_switch *ds, int port,
> + struct ethtool_eee *e)
> +{
> + struct qca8k_priv *priv = qca8k_to_priv(ds);
> + struct ethtool_eee *p = &priv->port_sts[qca8k_phy_to_port(port)].eee;
> + u32 lp, adv, supported;
> + u16 val;
> +
> + /* The switch has no way to tell the result of the AN so we need to
> + * read the result directly from the PHYs MMD registers
> + */
> + val = qca8k_phy_mmd_read(priv, port, MDIO_MMD_PCS, MDIO_PCS_EEE_ABLE);
> + supported = mmd_eee_cap_to_ethtool_sup_t(val);
> +
> + val = qca8k_phy_mmd_read(priv, port, MDIO_MMD_AN, MDIO_AN_EEE_ADV);
> + adv = mmd_eee_adv_to_ethtool_adv_t(val);
> +
> + val = qca8k_phy_mmd_read(priv, port, MDIO_MMD_AN, MDIO_AN_EEE_LPABLE);
> + lp = mmd_eee_adv_to_ethtool_adv_t(val);
> +
> + e->eee_enabled = p->eee_enabled;
> + e->eee_active = !!(supported & adv & lp);
> +
> + return 0;
> +}
Couldn't you just call phy_ethtool_get_eee(phydev)? Then you don't
need qca8k_phy_mmd_read()?
Andrew
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/3] net-next: dsa: add QCA8K support John Crispin <john@phrozen.org> - 2016-09-12 10:40 +0200
[PATCH 2/3] net-next: dsa: add Qualcomm tag RX/TX handler John Crispin <john@phrozen.org> - 2016-09-12 10:40 +0200
Re: [PATCH 2/3] net-next: dsa: add Qualcomm tag RX/TX handler Andrew Lunn <andrew@lunn.ch> - 2016-09-12 14:30 +0200
[PATCH 3/3] net-next: dsa: add new driver for qca8xxx family John Crispin <john@phrozen.org> - 2016-09-12 10:40 +0200
Re: [PATCH 3/3] net-next: dsa: add new driver for qca8xxx family Andrew Lunn <andrew@lunn.ch> - 2016-09-12 15:20 +0200
Re: [PATCH 3/3] net-next: dsa: add new driver for qca8xxx family Andrew Lunn <andrew@lunn.ch> - 2016-09-13 01:00 +0200
Re: [PATCH 3/3] net-next: dsa: add new driver for qca8xxx family Andrew Lunn <andrew@lunn.ch> - 2016-09-13 02:50 +0200
Re: [PATCH 3/3] net-next: dsa: add new driver for qca8xxx family John Crispin <john@phrozen.org> - 2016-09-13 10:10 +0200
Re: [PATCH 3/3] net-next: dsa: add new driver for qca8xxx family Andrew Lunn <andrew@lunn.ch> - 2016-09-13 18:00 +0200
Re: [PATCH 3/3] net-next: dsa: add new driver for qca8xxx family Florian Fainelli <f.fainelli@gmail.com> - 2016-09-13 19:20 +0200
Re: [PATCH 3/3] net-next: dsa: add new driver for qca8xxx family John Crispin <john@phrozen.org> - 2016-09-13 20:10 +0200
Re: [PATCH 3/3] net-next: dsa: add new driver for qca8xxx family Florian Fainelli <f.fainelli@gmail.com> - 2016-09-13 20:20 +0200
Re: [PATCH 3/3] net-next: dsa: add new driver for qca8xxx family Andrew Lunn <andrew@lunn.ch> - 2016-09-13 03:30 +0200
Re: [PATCH 3/3] net-next: dsa: add new driver for qca8xxx family John Crispin <john@phrozen.org> - 2016-09-13 11:50 +0200
Re: [PATCH 3/3] net-next: dsa: add new driver for qca8xxx family Andrew Lunn <andrew@lunn.ch> - 2016-09-13 15:20 +0200
Re: [PATCH 3/3] net-next: dsa: add new driver for qca8xxx family Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2016-09-13 19:20 +0200
Re: [PATCH 3/3] net-next: dsa: add new driver for qca8xxx family Andrew Lunn <andrew@lunn.ch> - 2016-09-13 21:10 +0200
Re: [PATCH 3/3] net-next: dsa: add new driver for qca8xxx family John Crispin <john@phrozen.org> - 2016-09-13 21:20 +0200
csiph-web