* [PATCH 1/2] net: dsa: mv88e6xxx: Add EEE support
@ 2015-03-07 6:23 Guenter Roeck
2015-03-07 6:23 ` [PATCH 2/2] net: dsa: mv88e6352: Add support for EEE Guenter Roeck
2015-03-08 3:34 ` [PATCH 1/2] net: dsa: mv88e6xxx: Add EEE support David Miller
0 siblings, 2 replies; 4+ messages in thread
From: Guenter Roeck @ 2015-03-07 6:23 UTC (permalink / raw)
To: netdev
Cc: David S. Miller, Andrew Lunn, Florian Fainelli, linux-kernel,
Guenter Roeck
EEE configuration is similar for the various MV88E6xxx chips.
Add generic support for it.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
---
Changes since RFT:
- Additional testing; no code changes
- Dropped comment about phy_init_eee
drivers/net/dsa/mv88e6xxx.c | 51 +++++++++++++++++++++++++++++++++++++++++++++
drivers/net/dsa/mv88e6xxx.h | 3 +++
2 files changed, 54 insertions(+)
diff --git a/drivers/net/dsa/mv88e6xxx.c b/drivers/net/dsa/mv88e6xxx.c
index a83ace0..c18ffc9 100644
--- a/drivers/net/dsa/mv88e6xxx.c
+++ b/drivers/net/dsa/mv88e6xxx.c
@@ -649,6 +649,57 @@ int mv88e6xxx_phy_write_indirect(struct dsa_switch *ds, int addr, int regnum,
return mv88e6xxx_phy_wait(ds);
}
+int mv88e6xxx_get_eee(struct dsa_switch *ds, int port, struct ethtool_eee *e)
+{
+ int reg;
+
+ reg = mv88e6xxx_phy_read_indirect(ds, port, 16);
+ if (reg < 0)
+ return -EOPNOTSUPP;
+
+ e->eee_enabled = !!(reg & 0x0200);
+ e->tx_lpi_enabled = !!(reg & 0x0100);
+
+ reg = REG_READ(REG_PORT(port), 0);
+ e->eee_active = !!(reg & 0x0040);
+
+ return 0;
+}
+
+static int mv88e6xxx_eee_enable_set(struct dsa_switch *ds, int port,
+ bool eee_enabled, bool tx_lpi_enabled)
+{
+ int reg, nreg;
+
+ reg = mv88e6xxx_phy_read_indirect(ds, port, 16);
+ if (reg < 0)
+ return reg;
+
+ nreg = reg & ~0x0300;
+ if (eee_enabled)
+ nreg |= 0x0200;
+ if (tx_lpi_enabled)
+ nreg |= 0x0100;
+
+ if (nreg != reg)
+ return mv88e6xxx_phy_write_indirect(ds, port, 16, nreg);
+
+ return 0;
+}
+
+int mv88e6xxx_set_eee(struct dsa_switch *ds, int port,
+ struct phy_device *phydev, struct ethtool_eee *e)
+{
+ int ret;
+
+ ret = mv88e6xxx_eee_enable_set(ds, port, e->eee_enabled,
+ e->tx_lpi_enabled);
+ if (ret)
+ return -EOPNOTSUPP;
+
+ return 0;
+}
+
static int __init mv88e6xxx_init(void)
{
#if IS_ENABLED(CONFIG_NET_DSA_MV88E6131)
diff --git a/drivers/net/dsa/mv88e6xxx.h b/drivers/net/dsa/mv88e6xxx.h
index 7294227..5fd42ce 100644
--- a/drivers/net/dsa/mv88e6xxx.h
+++ b/drivers/net/dsa/mv88e6xxx.h
@@ -88,6 +88,9 @@ int mv88e6xxx_eeprom_busy_wait(struct dsa_switch *ds);
int mv88e6xxx_phy_read_indirect(struct dsa_switch *ds, int addr, int regnum);
int mv88e6xxx_phy_write_indirect(struct dsa_switch *ds, int addr, int regnum,
u16 val);
+int mv88e6xxx_get_eee(struct dsa_switch *ds, int port, struct ethtool_eee *e);
+int mv88e6xxx_set_eee(struct dsa_switch *ds, int port,
+ struct phy_device *phydev, struct ethtool_eee *e);
extern struct dsa_switch_driver mv88e6131_switch_driver;
extern struct dsa_switch_driver mv88e6123_61_65_switch_driver;
--
2.1.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/2] net: dsa: mv88e6352: Add support for EEE
2015-03-07 6:23 [PATCH 1/2] net: dsa: mv88e6xxx: Add EEE support Guenter Roeck
@ 2015-03-07 6:23 ` Guenter Roeck
2015-03-08 3:34 ` David Miller
2015-03-08 3:34 ` [PATCH 1/2] net: dsa: mv88e6xxx: Add EEE support David Miller
1 sibling, 1 reply; 4+ messages in thread
From: Guenter Roeck @ 2015-03-07 6:23 UTC (permalink / raw)
To: netdev
Cc: David S. Miller, Andrew Lunn, Florian Fainelli, linux-kernel,
Guenter Roeck
Enable EEE support for MV88E6352.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
Changes since RFT:
- Additional testing; no code changes.
drivers/net/dsa/mv88e6352.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/dsa/mv88e6352.c b/drivers/net/dsa/mv88e6352.c
index 1ebd8f9..7bc5998 100644
--- a/drivers/net/dsa/mv88e6352.c
+++ b/drivers/net/dsa/mv88e6352.c
@@ -717,6 +717,8 @@ struct dsa_switch_driver mv88e6352_switch_driver = {
.get_strings = mv88e6352_get_strings,
.get_ethtool_stats = mv88e6352_get_ethtool_stats,
.get_sset_count = mv88e6352_get_sset_count,
+ .set_eee = mv88e6xxx_set_eee,
+ .get_eee = mv88e6xxx_get_eee,
#ifdef CONFIG_NET_DSA_HWMON
.get_temp = mv88e6352_get_temp,
.get_temp_limit = mv88e6352_get_temp_limit,
--
2.1.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] net: dsa: mv88e6xxx: Add EEE support
2015-03-07 6:23 [PATCH 1/2] net: dsa: mv88e6xxx: Add EEE support Guenter Roeck
2015-03-07 6:23 ` [PATCH 2/2] net: dsa: mv88e6352: Add support for EEE Guenter Roeck
@ 2015-03-08 3:34 ` David Miller
1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2015-03-08 3:34 UTC (permalink / raw)
To: linux; +Cc: netdev, andrew, f.fainelli, linux-kernel
From: Guenter Roeck <linux@roeck-us.net>
Date: Fri, 6 Mar 2015 22:23:51 -0800
> EEE configuration is similar for the various MV88E6xxx chips.
> Add generic support for it.
>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Applied.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] net: dsa: mv88e6352: Add support for EEE
2015-03-07 6:23 ` [PATCH 2/2] net: dsa: mv88e6352: Add support for EEE Guenter Roeck
@ 2015-03-08 3:34 ` David Miller
0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2015-03-08 3:34 UTC (permalink / raw)
To: linux; +Cc: netdev, andrew, f.fainelli, linux-kernel
From: Guenter Roeck <linux@roeck-us.net>
Date: Fri, 6 Mar 2015 22:23:52 -0800
> Enable EEE support for MV88E6352.
>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Applied.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-03-08 3:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-07 6:23 [PATCH 1/2] net: dsa: mv88e6xxx: Add EEE support Guenter Roeck
2015-03-07 6:23 ` [PATCH 2/2] net: dsa: mv88e6352: Add support for EEE Guenter Roeck
2015-03-08 3:34 ` David Miller
2015-03-08 3:34 ` [PATCH 1/2] net: dsa: mv88e6xxx: Add EEE support David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®