Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 22942498 authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'net-stmmac-Improvements-and-Selftests'



Jose Abreu says:

====================
net: stmmac: Improvements and Selftests

[ Thanks to the introducion of selftests this series ended up being a misc
of improvements and the selftests additions per-se. ]

This introduces selftests support in stmmac driver. We add 9 basic sanity
checks and MAC loopback support for all cores within the driver. This way
more tests can easily be added in the future and can be run in virtually
any MAC/GMAC/QoS/XGMAC platform.

Having this we can find regressions and missing features in the driver
while at the same time we can check if the IP is correctly working.

We have been using this for some time now and I do have more tests to
submit in the feature. My experience is that although writing the tests
adds more development time, the gain results are obvious.

I let this feature optional within the driver under a Kconfig option.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 33a74bf4 a976ca79
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -13,6 +13,15 @@ config STMMAC_ETH

if STMMAC_ETH

config STMMAC_SELFTESTS
	bool "Support for STMMAC Selftests"
	depends on STMMAC_ETH
	default n
	---help---
	  This adds support for STMMAC Selftests using ethtool. Enable this
	  feature if you are facing problems with your HW and submit the test
	  results to the netdev Mailing List.

config STMMAC_PLATFORM
	tristate "STMMAC Platform bus support"
	depends on STMMAC_ETH
+2 −0
Original line number Diff line number Diff line
@@ -8,6 +8,8 @@ stmmac-objs:= stmmac_main.o stmmac_ethtool.o stmmac_mdio.o ring_mode.o \
	      stmmac_tc.o dwxgmac2_core.o dwxgmac2_dma.o dwxgmac2_descs.o \
	      $(stmmac-y)

stmmac-$(CONFIG_STMMAC_SELFTESTS) += stmmac_selftests.o

# Ordering matters. Generic driver must be last.
obj-$(CONFIG_STMMAC_PLATFORM)	+= stmmac-platform.o
obj-$(CONFIG_DWMAC_ANARION)	+= dwmac-anarion.o
+1 −0
Original line number Diff line number Diff line
@@ -424,6 +424,7 @@ struct mac_device_info {
	const struct stmmac_mode_ops *mode;
	const struct stmmac_hwtimestamp *ptp;
	const struct stmmac_tc_ops *tc;
	const struct stmmac_mmc_ops *mmc;
	struct mii_regs mii;	/* MII register Addresses */
	struct mac_link link;
	void __iomem *pcsr;     /* vpointer to device CSRs */
+13 −0
Original line number Diff line number Diff line
@@ -986,6 +986,18 @@ static void sun8i_dwmac_exit(struct platform_device *pdev, void *priv)
		regulator_disable(gmac->regulator);
}

static void sun8i_dwmac_set_mac_loopback(void __iomem *ioaddr, bool enable)
{
	u32 value = readl(ioaddr + EMAC_BASIC_CTL0);

	if (enable)
		value |= EMAC_LOOPBACK;
	else
		value &= ~EMAC_LOOPBACK;

	writel(value, ioaddr + EMAC_BASIC_CTL0);
}

static const struct stmmac_ops sun8i_dwmac_ops = {
	.core_init = sun8i_dwmac_core_init,
	.set_mac = sun8i_dwmac_set_mac,
@@ -995,6 +1007,7 @@ static const struct stmmac_ops sun8i_dwmac_ops = {
	.flow_ctrl = sun8i_dwmac_flow_ctrl,
	.set_umac_addr = sun8i_dwmac_set_umac_addr,
	.get_umac_addr = sun8i_dwmac_get_umac_addr,
	.set_mac_loopback = sun8i_dwmac_set_mac_loopback,
};

static struct mac_device_info *sun8i_dwmac_setup(void *ppriv)
+1 −0
Original line number Diff line number Diff line
@@ -146,6 +146,7 @@ enum inter_frame_gap {
#define GMAC_FRAME_FILTER_DAIF	0x00000008	/* DA Inverse Filtering */
#define GMAC_FRAME_FILTER_PM	0x00000010	/* Pass all multicast */
#define GMAC_FRAME_FILTER_DBF	0x00000020	/* Disable Broadcast frames */
#define GMAC_FRAME_FILTER_PCF	0x00000080	/* Pass Control frames */
#define GMAC_FRAME_FILTER_SAIF	0x00000100	/* Inverse Filtering */
#define GMAC_FRAME_FILTER_SAF	0x00000200	/* Source Address Filter */
#define GMAC_FRAME_FILTER_HPF	0x00000400	/* Hash or perfect Filter */
Loading