net: macb: convert to phylink
Subsystems (3)
PATCH v2 1/1 net: macb: convert to phylink
This patch converts the MACB Ethernet driver to the Phylink framework. The MAC configuration is moved to the Phylink ops and Phylink helpers are now used in the ethtools functions. This helps to access the flow control and pauseparam logic and this will be helpful in the future for boards using this controller with SFP cages.
---
Since v1:
- Stopped using state->link in mac_config and moved macb_set_tx_clk to the link_up helper..
- Fixed the node given to phylink_of_phy_connect.
- Removed netif_carrier_off from macb_open.
- Fixed the macb_get_wol logic.
- Rewored macb_ioctl as suggested.
- Added a call to phylink_destroy in macb_remove.
- Fixed the suspend/resume case by calling phylink_start/stop in the resume/suspend helpers. I had to take the rtnl lock to do this, which might be something to discuss.
drivers/net/ethernet/cadence/Kconfig | 2 +- drivers/net/ethernet/cadence/macb.h | 9 +- drivers/net/ethernet/cadence/macb_main.c | 484 ++++++++++++----------- 3 files changed, 261 insertions(+), 234 deletions(-)
drivers/net/ethernet/cadence/Kconfig +1 -1
@@ -22,7 +22,7 @@ if NET_VENDOR_CADENCE config MACB tristate "Cadence MACB/GEM support" depends on HAS_DMA && COMMON_CLK - select PHYLIB + select PHYLINK ---help--- The Cadence MACB ethernet interface is found on many Atmel AT32 and AT91 parts. This driver also supports the Cadence GEM (Gigabit
drivers/net/ethernet/cadence/macb.h +4 -5
@@ -7,7 +7,7 @@#ifndef _MACB_H#define _MACB_H -#include <linux/phy.h> +#include <linux/phylink.h> #include <linux/ptp_clock_kernel.h> #include <linux/net_tstamp.h> #include <linux/interrupt.h>
@@ -1185,15 +1185,14 @@ struct macb {struct macb_or_gem_ops macbgem_ops;struct mii_bus *mii_bus; -struct device_node *phy_node; -int link; -int speed; -int duplex; +struct phylink *phylink; +struct phylink_config phylink_config;u32 caps;unsigned int dma_burst_length;phy_interface_t phy_interface; +int speed;/* AT91RM9200 transmit */ struct sk_buff *skb;/* holds skb until xmit interrupt completes */
drivers/net/ethernet/cadence/macb_main.c +256 -228
742 lines not on this page · raw message
Signature · 1 line
2.23.0
David Miller
maintainerFrom: Antoine Tenart <[email protected]>
Date: Tue, 12 Nov 2019 15:25:48 +0100
Quoted 8 lines
This patch converts the MACB Ethernet driver to the Phylink framework. The MAC configuration is moved to the Phylink ops and Phylink helpers are now used in the ethtools functions. This helps to access the flow control and pauseparam logic and this will be helpful in the future for boards using this controller with SFP cages.
Tested-by Alexandre Belloni <[email protected]>Signed-off-by Antoine Tenart <[email protected]>
Things like pulling out the buffer init code into a helper function are separate from the actual phylink conversion, so please split these changes out into separate patches and make this a bonafide patch series.
Please do not forget to provide an appropriate patch series header posting when you do this.
Thank you.
Hi David,
Quoted 12 lines · David Miller
From: Antoine Tenart <[email protected]>
Date: Tue, 12 Nov 2019 15:25:48 +0100Quoted 8 lines
This patch converts the MACB Ethernet driver to the Phylink framework. The MAC configuration is moved to the Phylink ops and Phylink helpers are now used in the ethtools functions. This helps to access the flow control and pauseparam logic and this will be helpful in the future for boards using this controller with SFP cages.
Tested-by Alexandre Belloni <[email protected]>Signed-off-by Antoine Tenart <[email protected]>
Quoted 6 lines
Things like pulling out the buffer init code into a helper function are separate from the actual phylink conversion, so please split these changes out into separate patches and make this a bonafide patch series.
Please do not forget to provide an appropriate patch series header posting when you do this.
Will do for v3.
Thanks,
Antoine
Signature · 3 lines
Antoine Ténart, Bootlin Embedded Linux and Kernel engineering https://bootlin.com