From 45e0a55ff69fea0c986f36ab3f9462d6b11c4383 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Mon, 30 Jun 2025 20:51:10 +0200 Subject: net: sh_eth: Pass struct port_info around The struct sh_eth_dev .port member is always set to 0, therefore only single-ported SH Ethernet is ever used. Support for multiple SH Ethernet ports implemented on driver level is a remnant from before U-Boot DM existed. Pass struct sh_eth_info port_info around directly and remove the struct sh_eth_dev entirely. Handling of multiple ports should be done by U-Boot DM and multiple per-driver-instance private data. No functional change intended. Signed-off-by: Marek Vasut --- drivers/net/sh_eth.h | 8 -------- 1 file changed, 8 deletions(-) (limited to 'drivers/net/sh_eth.h') diff --git a/drivers/net/sh_eth.h b/drivers/net/sh_eth.h index ecf4a697e27..6b7f8ae5154 100644 --- a/drivers/net/sh_eth.h +++ b/drivers/net/sh_eth.h @@ -33,9 +33,6 @@ #define CFG_SH_ETHER_ALIGNE_SIZE 16 #endif -/* Number of supported ports */ -#define MAX_PORT_NUM 2 - /* Buffers must be big enough to hold the largest ethernet frame. Also, rx buffers must be a multiple of 32 bytes */ #define MAX_BUF_SIZE (48 * 32) @@ -90,11 +87,6 @@ struct sh_eth_info { void __iomem *iobase; }; -struct sh_eth_dev { - int port; - struct sh_eth_info port_info[MAX_PORT_NUM]; -}; - /* from linux/drivers/net/ethernet/renesas/sh_eth.h */ enum { /* E-DMAC registers */ -- cgit v1.2.3 From 16a900210956fe7c476b2355c7090c2cc078f71d Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Mon, 30 Jun 2025 20:51:12 +0200 Subject: net: sh_eth: Convert cache operations to static functions Turn the current cache operation macros into static functions to improve compiler coverage checking. This does change the driver behavior slightly, the driver now expects those cache operation functions to be available on all architectures on which it is used. This should pose no problem, as the driver is only used on 32bit and 64bit ARM, which both have those operations. The CFG_SH_ETHER_ALIGNE_SIZE is converted to SH_ETHER_ALIGN_SIZE and defined as either 64 on ARM or 16 on SH. Signed-off-by: Marek Vasut --- drivers/net/sh_eth.h | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'drivers/net/sh_eth.h') diff --git a/drivers/net/sh_eth.h b/drivers/net/sh_eth.h index 6b7f8ae5154..006f12a37b9 100644 --- a/drivers/net/sh_eth.h +++ b/drivers/net/sh_eth.h @@ -19,20 +19,17 @@ /* The ethernet controller needs to use physical addresses */ #define ADDR_TO_PHY(addr) ((uintptr_t)(addr) & ~0xe0000000) +#define SH_ETHER_ALIGN_SIZE 16 #elif defined(CONFIG_ARM) #ifndef inl #define inl readl #define outl writel +#define SH_ETHER_ALIGN_SIZE 64 #endif #define ADDR_TO_PHY(addr) ((uintptr_t)(addr)) #define ADDR_TO_P2(addr) (addr) #endif /* defined(CONFIG_SH) */ -/* base padding size is 16 */ -#ifndef CFG_SH_ETHER_ALIGNE_SIZE -#define CFG_SH_ETHER_ALIGNE_SIZE 16 -#endif - /* Buffers must be big enough to hold the largest ethernet frame. Also, rx buffers must be a multiple of 32 bytes */ #define MAX_BUF_SIZE (48 * 32) @@ -44,7 +41,7 @@ /* The size of the tx descriptor is determined by how much padding is used. 4, 20, or 52 bytes of padding can be used */ -#define TX_DESC_PADDING (CFG_SH_ETHER_ALIGNE_SIZE - 12) +#define TX_DESC_PADDING (SH_ETHER_ALIGN_SIZE - 12) /* Tx descriptor. We always use 3 bytes of padding */ struct tx_desc_s { @@ -59,9 +56,9 @@ struct tx_desc_s { /* The size of the rx descriptor is determined by how much padding is used. 4, 20, or 52 bytes of padding can be used */ -#define RX_DESC_PADDING (CFG_SH_ETHER_ALIGNE_SIZE - 12) +#define RX_DESC_PADDING (SH_ETHER_ALIGN_SIZE - 12) /* aligned cache line size */ -#define RX_BUF_ALIGNE_SIZE (CFG_SH_ETHER_ALIGNE_SIZE > 32 ? 64 : 32) +#define RX_BUF_ALIGNE_SIZE (SH_ETHER_ALIGN_SIZE > 32 ? 64 : 32) /* Rx descriptor. We always use 4 bytes of padding */ struct rx_desc_s { @@ -380,11 +377,11 @@ enum DMAC_M_BIT { #endif }; -#if CFG_SH_ETHER_ALIGNE_SIZE == 64 +#if SH_ETHER_ALIGN_SIZE == 64 # define EMDR_DESC EDMR_DL1 -#elif CFG_SH_ETHER_ALIGNE_SIZE == 32 +#elif SH_ETHER_ALIGN_SIZE == 32 # define EMDR_DESC EDMR_DL0 -#elif CFG_SH_ETHER_ALIGNE_SIZE == 16 /* Default */ +#elif SH_ETHER_ALIGN_SIZE == 16 /* Default */ # define EMDR_DESC 0 #endif -- cgit v1.2.3 From 397b5e9ce4896dfa20451bf3a5a41ba03208d61d Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Mon, 30 Jun 2025 20:51:14 +0200 Subject: net: sh_eth: Drop phy_addr assignment Drop unused struct sh_eth_info *port_info .phy_addr member assignment. PHY address is extracted from control DT. No functional change intended. Signed-off-by: Marek Vasut --- drivers/net/sh_eth.h | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/net/sh_eth.h') diff --git a/drivers/net/sh_eth.h b/drivers/net/sh_eth.h index 006f12a37b9..c395e6e8fc7 100644 --- a/drivers/net/sh_eth.h +++ b/drivers/net/sh_eth.h @@ -78,7 +78,6 @@ struct sh_eth_info { u8 *rx_buf_alloc; u8 *rx_buf_base; u8 mac_addr[6]; - u8 phy_addr; struct eth_device *dev; struct phy_device *phydev; void __iomem *iobase; -- cgit v1.2.3