This patch adds an interface to the ethtool subsystem and
implements read/write functionality for handling settings with the
ethtool_cmd structure. "Speed" is the only setting implemented so far.
Other settings (like reading the duplex value) can be easily implemented
later on.
One can read the speed of the link by reading /sys/class/net/eth0/speed.
It seems that you can't write to /sys/class/net/eth0/speed, so the
"ethtool" command line utility must be used to set the speed.
So far, it is tested only in the DMA mode, since I don't have hardware
with DCR available.
Signed-off-by: Ville Sundell <ville.sundell@digilent.ro>
---
When using a non-static PHY and 100Mbit connection in Temac, the speed
is not changed and stays at the reset value (1000Mbit). This leads to a
situation where data is not sent or received correctly since
temac_adjust_link() is not called due to lack of static PHY. Therefore
the link speed retains the reset value.
There is also no possibility to read or set the link speed from the user
space.
The patch is done against the newest version of ll_temac_main.cc and
ll_temac.h of the linux-next tree.
Thanks to Michal Simek for his feedback on this patch!
Regards,
Ville Sundell
Digilent Inc.
drivers/net/ll_temac.h | 3 ++
drivers/net/ll_temac_main.c | 76 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 79 insertions(+), 0 deletions(-)
diff --git a/drivers/net/ll_temac.h b/drivers/net/ll_temac.h
index 522abe2..ddd00cc 100644
--- a/drivers/net/ll_temac.h
+++ b/drivers/net/ll_temac.h
@@ -247,6 +247,9 @@ This option defaults to enabled (set) */
#define XTE_EMCFG_LINKSPD_10 0x00000000 /* 10 Mbit LINKSPD_MASK */
#define XTE_EMCFG_LINKSPD_100 (1 << 30) /* 100 Mbit LINKSPD_MASK */
#define XTE_EMCFG_LINKSPD_1000 (1 << 31) /* 1000 Mbit LINKSPD_MASK */
+#define XTE_EMCFG_LINKSPD_NA 0xC0000000 /* For undefined speed */
+
+#define TEMAC_SPEED_NA 0 /* To indicate XTE_EMCFG_LINKSPD_NA */
#define ...