diff options
author | Felix Fietkau <nbd@nbd.name> | 2017-02-06 11:46:48 +0100 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2017-02-16 17:17:15 +0100 |
commit | 2bf9ea6a31736db059aa97addce3a34b933dacc1 (patch) | |
tree | ecfe628aabaf38e6bd40ca841443d19079105a83 /target/linux/mvebu/patches-4.9/411-net-phy-split-out-PHY-speed-and-duplex-string-genera.patch | |
parent | 237454991618e0e8b7ceb8a8a2a43fca12c1a454 (diff) | |
download | upstream-2bf9ea6a31736db059aa97addce3a34b933dacc1.tar.gz upstream-2bf9ea6a31736db059aa97addce3a34b933dacc1.tar.bz2 upstream-2bf9ea6a31736db059aa97addce3a34b933dacc1.zip |
mvebu: add linux 4.9 support
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
Diffstat (limited to 'target/linux/mvebu/patches-4.9/411-net-phy-split-out-PHY-speed-and-duplex-string-genera.patch')
-rw-r--r-- | target/linux/mvebu/patches-4.9/411-net-phy-split-out-PHY-speed-and-duplex-string-genera.patch | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/target/linux/mvebu/patches-4.9/411-net-phy-split-out-PHY-speed-and-duplex-string-genera.patch b/target/linux/mvebu/patches-4.9/411-net-phy-split-out-PHY-speed-and-duplex-string-genera.patch new file mode 100644 index 0000000000..4111b004d2 --- /dev/null +++ b/target/linux/mvebu/patches-4.9/411-net-phy-split-out-PHY-speed-and-duplex-string-genera.patch @@ -0,0 +1,103 @@ +From: Russell King <rmk+kernel@armlinux.org.uk> +Date: Mon, 2 Jan 2017 17:52:18 +0000 +Subject: [PATCH] net: phy: split out PHY speed and duplex string + generation + +Other code would like to make use of this, so make the speed and duplex +string generation visible, and place it in a separate file. + +Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> +--- + +--- a/drivers/net/phy/phy.c ++++ b/drivers/net/phy/phy.c +@@ -38,26 +38,6 @@ + + #include <asm/irq.h> + +-static const char *phy_speed_to_str(int speed) +-{ +- switch (speed) { +- case SPEED_10: +- return "10Mbps"; +- case SPEED_100: +- return "100Mbps"; +- case SPEED_1000: +- return "1Gbps"; +- case SPEED_2500: +- return "2.5Gbps"; +- case SPEED_10000: +- return "10Gbps"; +- case SPEED_UNKNOWN: +- return "Unknown"; +- default: +- return "Unsupported (update phy.c)"; +- } +-} +- + #define PHY_STATE_STR(_state) \ + case PHY_##_state: \ + return __stringify(_state); \ +@@ -93,7 +73,7 @@ void phy_print_status(struct phy_device + netdev_info(phydev->attached_dev, + "Link is Up - %s/%s - flow control %s\n", + phy_speed_to_str(phydev->speed), +- DUPLEX_FULL == phydev->duplex ? "Full" : "Half", ++ phy_duplex_to_str(phydev->duplex), + phydev->pause ? "rx/tx" : "off"); + } else { + netdev_info(phydev->attached_dev, "Link is Down\n"); +--- a/drivers/net/phy/phy-core.c ++++ b/drivers/net/phy/phy-core.c +@@ -9,6 +9,39 @@ + #include <linux/export.h> + #include <linux/phy.h> + ++const char *phy_speed_to_str(int speed) ++{ ++ switch (speed) { ++ case SPEED_10: ++ return "10Mbps"; ++ case SPEED_100: ++ return "100Mbps"; ++ case SPEED_1000: ++ return "1Gbps"; ++ case SPEED_2500: ++ return "2.5Gbps"; ++ case SPEED_10000: ++ return "10Gbps"; ++ case SPEED_UNKNOWN: ++ return "Unknown"; ++ default: ++ return "Unsupported (update phy-core.c)"; ++ } ++} ++EXPORT_SYMBOL_GPL(phy_speed_to_str); ++ ++const char *phy_duplex_to_str(unsigned int duplex) ++{ ++ if (duplex == DUPLEX_HALF) ++ return "Half"; ++ if (duplex == DUPLEX_FULL) ++ return "Full"; ++ if (duplex == DUPLEX_UNKNOWN) ++ return "Unknown"; ++ return "Unsupported (update phy-core.c)"; ++} ++EXPORT_SYMBOL_GPL(phy_duplex_to_str); ++ + static inline void mmd_phy_indirect(struct mii_bus *bus, int prtad, int devad, + int addr) + { +--- a/include/linux/phy.h ++++ b/include/linux/phy.h +@@ -642,6 +642,9 @@ struct phy_fixup { + int (*run)(struct phy_device *phydev); + }; + ++const char *phy_speed_to_str(int speed); ++const char *phy_duplex_to_str(unsigned int duplex); ++ + /** + * phy_read_mmd - Convenience function for reading a register + * from an MMD on a given PHY. |