net: fs_enet: Driver cleanup
Subsystems (5)
v2 cover net: fs_enet: Driver cleanup
Over the years, platform and driver initialisation have evolved into more generic ways, and driver or platform specific stuff has gone away, leaving stale objects behind.
This series aims at cleaning all that up for fs_enet ethernet driver.
Changes in v2:
- Remove a trailing whitespace in the old struct moved in patch 7.
- Include powerpc people and list that I forgot when sending v1 (and Rob as expected by Patchwork for patch 6, not sure why)
Christophe Leroy (10):
net: fs_enet: Remove set but not used variable
net: fs_enet: Fix address space and base types mismatches
net: fs_enet: Remove fs_get_id()
net: fs_enet: Remove unused fields in fs_platform_info struct
net: fs_enet: Remove has_phy field in fs_platform_info struct
net: fs_enet: Remove stale prototypes from fsl_soc.c
net: fs_enet: Move struct fs_platform_info into fs_enet.h
net: fs_enet: Don't include fs_enet_pd.h when not needed
net: fs_enet: Remove linux/fs_enet_pd.h
net: fs_enet: Use cpm_muram_xxx() functions instead of cpm_dpxxx()
macros
MAINTAINERS | 1 - arch/powerpc/platforms/8xx/adder875.c | 1 - arch/powerpc/platforms/8xx/mpc885ads_setup.c | 1 - arch/powerpc/platforms/8xx/tqm8xx_setup.c | 1 - arch/powerpc/sysdev/fsl_soc.c | 3 - .../ethernet/freescale/fs_enet/fs_enet-main.c | 2 - .../net/ethernet/freescale/fs_enet/fs_enet.h | 19 +- .../net/ethernet/freescale/fs_enet/mac-fcc.c | 4 +- .../net/ethernet/freescale/fs_enet/mac-fec.c | 14 -- .../net/ethernet/freescale/fs_enet/mac-scc.c | 8 +- .../ethernet/freescale/fs_enet/mii-bitbang.c | 4 +- .../net/ethernet/freescale/fs_enet/mii-fec.c | 1 + include/linux/fs_enet_pd.h | 165 ------------------ 13 files changed, 27 insertions(+), 197 deletions(-) delete mode 100644 include/linux/fs_enet_pd.h
Signature · 1 line
2.41.0
PATCH v2 1/10 net: fs_enet: Remove set but not used variable
CC drivers/net/ethernet/freescale/fs_enet/fs_enet-main.odrivers/net/ethernet/freescale/fs_enet/fs_enet-main.c: In function 'fs_enet_interrupt':drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c:321:40: warning: variable 'fpi' set but not used [-Wunused-but-set-variable]
Remove that variable.
--- drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c | 2 -- 1 file changed, 2 deletions(-)
drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c +0 -2
@@ -318,14 +318,12 @@ fs_enet_interrupt(int irq, void *dev_id) {struct net_device *dev = dev_id;struct fs_enet_private *fep; -const struct fs_platform_info *fpi;u32 int_events;u32 int_clr_events;int nr, napi_ok;int handled; fep =netdev_priv (dev); - fpi = fep->fpi; nr =0 ;while ((int_events = (*fep->ops->get_int_events)(dev)) !=0 ) {
Signature · 1 line
2.41.0
PATCH v2 2/10 net: fs_enet: Fix address space and base types mismatches
In reply to Christophe Leroy CHECK drivers/net/ethernet/freescale/fs_enet/mac-fcc.cdrivers/net/ethernet/freescale/fs_enet/mac-fcc.c:550:9: warning: cast removes address space '__iomem' of expression drivers/net/ethernet/freescale/fs_enet/mac-fcc.c:550:9: error: subtraction of different types can't work (different address spaces)
CC drivers/net/ethernet/freescale/fs_enet/mii-bitbang.o
CHECK drivers/net/ethernet/freescale/fs_enet/mii-bitbang.cdrivers/net/ethernet/freescale/fs_enet/mii-bitbang.c:95:31: warning: incorrect type in argument 1 (different base types)drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c:95:31: expected unsigned int [noderef] [usertype] __iomem *pdrivers/net/ethernet/freescale/fs_enet/mii-bitbang.c:95:31: got restricted __be32 [noderef] [usertype] __iomem *dat
...drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c:63:31: warning: incorrect type in argument 1 (different base types)drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c:63:31: expected unsigned int [noderef] [usertype] __iomem *pdrivers/net/ethernet/freescale/fs_enet/mii-bitbang.c:63:31: got restricted __be32 [noderef] [usertype] __iomem *dir
...
Fix those address space and base type mismatches reported by sparse.
--- drivers/net/ethernet/freescale/fs_enet/mac-fcc.c | 2 +- drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/freescale/fs_enet/mac-fcc.c +1 -1
@@ -547,7 +547,7 @@ static void tx_restart(struct net_device *dev) }/* Now update the TBPTR and dirty flag to the current buffer */ W32 (ep, fen_genfcc.fcc_tbptr, - (uint) (((void *)recheck_bd - fep->ring_base) + + (uint)(((void __iomem *)recheck_bd - fep->ring_base) + fep->ring_mem_addr)); fep->dirty_tx = recheck_bd;
drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c +2 -2
@@ -29,8 +29,8 @@struct bb_info {struct mdiobb_ctrl ctrl; -__be32 __iomem *dir; -__be32 __iomem *dat; +u32 __iomem *dir; +u32 __iomem *dat;u32 mdio_msk;u32 mdc_msk; };
Signature · 1 line
2.41.0
PATCH v2 3/10 net: fs_enet: Remove fs_get_id()
In reply to Christophe Leroyfs_get_id() hasn't been used since commit b219108cbace ("fs_enet:
Remove !CONFIG_PPC_CPM_NEW_BINDING code")
Remove it.
--- include/linux/fs_enet_pd.h | 11 ----------- 1 file changed, 11 deletions(-)
include/linux/fs_enet_pd.h +0 -11
@@ -151,15 +151,4 @@ struct fs_mii_fec_platform_info { u32 mii_speed; }; -static inline int fs_get_id (struct fs_platform_info *fpi) -{ -if (strstr (fpi->fs_type,"SCC" )) -return fs_scc_index2id (fpi->fs_no); -if (strstr (fpi->fs_type,"FCC" )) -return fs_fcc_index2id (fpi->fs_no); -if (strstr (fpi->fs_type,"FEC" )) -return fs_fec_index2id (fpi->fs_no); -return fpi->fs_no; -} -#endif
Signature · 1 line
2.41.0
PATCH v2 4/10 net: fs_enet: Remove unused fields in fs_platform_info struct
In reply to Christophe LeroySince commit 3dd82a1ea724 ("[POWERPC] CPM: Always use new binding.") many fields of fs_platform_info structure are not used anymore.
Remove them.
--- include/linux/fs_enet_pd.h | 19 ------------------- 1 file changed, 19 deletions(-)
include/linux/fs_enet_pd.h +0 -19
@@ -111,33 +111,14 @@ struct fs_mii_bb_platform_info { };struct fs_platform_info { - -void (*init_ioports)(struct fs_platform_info *);/* device specific information */ -int fs_no;/* controller index */ -char fs_type[4 ];/* controller type */ - -u32 cp_page;/* CPM page */ -u32 cp_block;/* CPM sblock */ u32 cp_command;/* CPM page/sblock/mcn */ -u32 clk_trx;/* some stuff for pins & mux configuration*/ -u32 clk_rx; -u32 clk_tx; -u32 clk_route; -u32 clk_mask; - -u32 mem_offset;u32 dpram_offset; -u32 fcc_regs_c; -u32 device_flags; -struct device_node *phy_node; -const struct fs_mii_bus_info *bus_info;int rx_ring, tx_ring;/* number of buffers on rx */ -__u8 macaddr[ETH_ALEN ];/* mac address */ int rx_copybreak;/* limit we copy small frames */ int napi_weight;/* NAPI weight */
Signature · 1 line
2.41.0
PATCH v2 5/10 net: fs_enet: Remove has_phy field in fs_platform_info struct
In reply to Christophe LeroySince commit 3dd82a1ea724 ("[POWERPC] CPM: Always use new binding.") has_phy field is never set.
Remove dead code and remove the field.
--- drivers/net/ethernet/freescale/fs_enet/mac-fec.c | 14 -------------- include/linux/fs_enet_pd.h | 1 - 2 files changed, 15 deletions(-)
drivers/net/ethernet/freescale/fs_enet/mac-fec.c +0 -14
@@ -339,11 +339,7 @@ static void restart(struct net_device *dev)static void stop (struct net_device *dev) {struct fs_enet_private *fep =netdev_priv (dev); -const struct fs_platform_info *fpi = fep->fpi;struct fec __iomem *fecp = fep->fec.fecp; - -struct fec_info *feci = dev->phydev->mdio.bus->priv; -int i;if ((FR (fecp, ecntrl) &FEC_ECNTRL_ETHER_EN ) ==0 )
@@ -363,16 +359,6 @@ static void stop(struct net_device *dev)FC (fecp, ecntrl,FEC_ECNTRL_ETHER_EN );fs_cleanup_bds (dev); - -/* shut down FEC1? that's where the mii bus is */ -if (fpi->has_phy) { -FS (fecp, r_cntrl, fpi->use_rmii ? -FEC_RCNTRL_RMII_MODE : -FEC_RCNTRL_MII_MODE );/* MII/RMII enable */ -FS (fecp, ecntrl,FEC_ECNTRL_PINMUX |FEC_ECNTRL_ETHER_EN ); -FW (fecp, ievent,FEC_ENET_MII ); -FW (fecp, mii_speed, feci->mii_speed); - } }static void napi_clear_event_fs (struct net_device *dev)
include/linux/fs_enet_pd.h +0 -1
@@ -123,7 +123,6 @@ struct fs_platform_info {int napi_weight;/* NAPI weight */ int use_rmii;/* use RMII mode */ -int has_phy;/* if the network is phy container as well...*/ struct clk *clk_per;/* 'per' clock for register access */ };
Signature · 1 line
2.41.0
PATCH v2 6/10 net: fs_enet: Remove stale prototypes from fsl_soc.c
In reply to Christophe LeroyCommit 3dd82a1ea724 ("[POWERPC] CPM: Always use new binding.") removed last use of init_fec_ioports() and init_fcc_ioports().
Remove stale prototypes then don't include anymore fs_enet_pd.h which was only included to provide fs_platform_info structure for the prototypes.
--- arch/powerpc/sysdev/fsl_soc.c | 3 --- 1 file changed, 3 deletions(-)
arch/powerpc/sysdev/fsl_soc.c +0 -3
@@ -23,7 +23,6 @@#include <linux/phy.h> #include <linux/spi/spi.h> #include <linux/fsl_devices.h> -#include <linux/fs_enet_pd.h> #include <linux/fs_uart_pd.h> #include <linux/reboot.h>
@@ -37,8 +36,6 @@#include <asm/cpm2.h> #include <asm/fsl_hcalls.h> /* For the Freescale hypervisor */ -extern void init_fcc_ioports (struct fs_platform_info *); -extern void init_fec_ioports (struct fs_platform_info *);extern void init_smc_ioports (struct fs_uart_platform_info *);static phys_addr_t immrbase =-1 ;
Signature · 1 line
2.41.0
PATCH v2 7/10 net: fs_enet: Move struct fs_platform_info into fs_enet.h
In reply to Christophe Leroystruct fs_platform_info is only used in fs_enet ethernet driver since commit 3dd82a1ea724 ("[POWERPC] CPM: Always use new binding.").
Stale prototypes using fs_platform_info were left over in arch/powerpc/sysdev/fsl_soc.c but they are now removed by previous patch.
Move struct fs_platform_info into fs_enet.h
--- .../net/ethernet/freescale/fs_enet/fs_enet.h | 19 ++++++++++++++++++- .../net/ethernet/freescale/fs_enet/mii-fec.c | 1 + include/linux/fs_enet_pd.h | 16 ---------------- 3 files changed, 19 insertions(+), 17 deletions(-)
drivers/net/ethernet/freescale/fs_enet/fs_enet.h +18 -1
@@ -2,6 +2,7 @@#ifndef FS_ENET_H #define FS_ENET_H +#include <linux/clk.h> #include <linux/mii.h> #include <linux/netdevice.h> #include <linux/types.h>
@@ -9,7 +10,6 @@#include <linux/phy.h> #include <linux/dma-mapping.h> -#include <linux/fs_enet_pd.h> #include <asm/fs_pd.h> #ifdef CONFIG_CPM1
@@ -118,6 +118,23 @@ struct phy_info {#define ENET_RX_ALIGN 16#define ENET_RX_FRSIZE L1_CACHE_ALIGN(PKT_MAXBUF_SIZE + ENET_RX_ALIGN - 1) +struct fs_platform_info { +/* device specific information */ +u32 cp_command;/* CPM page/sblock/mcn */ + +u32 dpram_offset; + +struct device_node *phy_node; + +int rx_ring, tx_ring;/* number of buffers on rx */ +int rx_copybreak;/* limit we copy small frames */ +int napi_weight;/* NAPI weight */ + +int use_rmii;/* use RMII mode */ + +struct clk *clk_per;/* 'per' clock for register access */ +}; +struct fs_enet_private {struct napi_struct napi;struct device *dev;/* pointer back to the device (must be initialized first) */
drivers/net/ethernet/freescale/fs_enet/mii-fec.c +1 -0
@@ -31,6 +31,7 @@#include <linux/bitops.h> #include <linux/platform_device.h> #include <linux/of_address.h> +#include <linux/of_mdio.h> #include <linux/of_platform.h> #include <linux/pgtable.h>
include/linux/fs_enet_pd.h +0 -16
@@ -110,22 +110,6 @@ struct fs_mii_bb_platform_info {int irq[32 ];/* irqs per phy's */ }; -struct fs_platform_info { -/* device specific information */ -u32 cp_command;/* CPM page/sblock/mcn */ - -u32 dpram_offset; - -struct device_node *phy_node; - -int rx_ring, tx_ring;/* number of buffers on rx */ -int rx_copybreak;/* limit we copy small frames */ -int napi_weight;/* NAPI weight */ - -int use_rmii;/* use RMII mode */ - -struct clk *clk_per;/* 'per' clock for register access */ -};struct fs_mii_fec_platform_info {u32 irq[32 ];u32 mii_speed;
Signature · 1 line
2.41.0
PATCH v2 8/10 net: fs_enet: Don't include fs_enet_pd.h when not needed
In reply to Christophe LeroyThree platforms in arch/powerpc/platforms/8xx/ include fs_enet_pd.h but don't use anything from it.
Remove the includes.
--- arch/powerpc/platforms/8xx/adder875.c | 1 - arch/powerpc/platforms/8xx/mpc885ads_setup.c | 1 - arch/powerpc/platforms/8xx/tqm8xx_setup.c | 1 - 3 files changed, 3 deletions(-)
arch/powerpc/platforms/8xx/adder875.c +0 -1
@@ -7,7 +7,6 @@*/ #include <linux/init.h> -#include <linux/fs_enet_pd.h> #include <linux/of_platform.h> #include <asm/time.h>
arch/powerpc/platforms/8xx/mpc885ads_setup.c +0 -1
@@ -21,7 +21,6 @@#include <linux/device.h> #include <linux/delay.h> -#include <linux/fs_enet_pd.h> #include <linux/fs_uart_pd.h> #include <linux/fsl_devices.h> #include <linux/mii.h>
arch/powerpc/platforms/8xx/tqm8xx_setup.c +0 -1
@@ -24,7 +24,6 @@#include <linux/device.h> #include <linux/delay.h> -#include <linux/fs_enet_pd.h> #include <linux/fs_uart_pd.h> #include <linux/fsl_devices.h> #include <linux/mii.h>
Signature · 1 line
2.41.0
PATCH v2 9/10 net: fs_enet: Remove linux/fs_enet_pd.h
In reply to Christophe Leroylinux/fs_enet_pd.h is not used anymore.
Remove it.
--- MAINTAINERS | 1 - include/linux/fs_enet_pd.h | 118 ------------------------------------- 2 files changed, 119 deletions(-) delete mode 100644 include/linux/fs_enet_pd.h
MAINTAINERS +0 -1
@@ -8371,7 +8371,6 @@ L: [email protected] L: [email protected] S: Maintained F: drivers/net/ethernet/freescale/fs_enet/ -F: include/linux/fs_enet_pd.h FREESCALE SOC SOUND DRIVERS M: Shengjiu Wang <[email protected]>
include/linux/fs_enet_pd.h deleted +0 -118
118 lines not on this page · raw message
Signature · 1 line
2.41.0
PATCH v2 10/10 net: fs_enet: Use cpm_muram_xxx() functions instead of cpm_dpxxx() macros
In reply to Christophe Leroycpm_dpxxx() macros are now always referring to cpm_muram_xxx() fonctions directly since commit 3dd82a1ea724 ("[POWERPC] CPM: Always use new binding.")
Use cpm_muram_xxx() functions directly so that the cpm_dpxxx() macros can be removed in the near future.
--- drivers/net/ethernet/freescale/fs_enet/mac-fcc.c | 2 +- drivers/net/ethernet/freescale/fs_enet/mac-scc.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/net/ethernet/freescale/fs_enet/mac-fcc.c +1 -1
@@ -105,7 +105,7 @@ static int do_pd_setup(struct fs_enet_private *fep) goto out_ep; fep->fcc.mem = (void __iomem *)cpm2_immr; - fpi->dpram_offset =cpm_dpalloc (128 ,32 ); + fpi->dpram_offset =cpm_muram_alloc (128 ,32 );if (IS_ERR_VALUE (fpi->dpram_offset)) { ret = fpi->dpram_offset; goto out_fcccp;
drivers/net/ethernet/freescale/fs_enet/mac-scc.c +4 -4
@@ -133,13 +133,13 @@ static int allocate_bd(struct net_device *dev)struct fs_enet_private *fep =netdev_priv (dev);const struct fs_platform_info *fpi = fep->fpi; - fep->ring_mem_addr =cpm_dpalloc ((fpi->tx_ring + fpi->rx_ring) * -sizeof (cbd_t),8 ); + fep->ring_mem_addr =cpm_muram_alloc ((fpi->tx_ring + fpi->rx_ring) * +sizeof (cbd_t),8 );if (IS_ERR_VALUE (fep->ring_mem_addr))return -ENOMEM ; fep->ring_base = (void __iomem __force *) -cpm_dpram_addr (fep->ring_mem_addr); +cpm_muram_addr (fep->ring_mem_addr);return 0 ; }
@@ -149,7 +149,7 @@ static void free_bd(struct net_device *dev)struct fs_enet_private *fep =netdev_priv (dev);if (fep->ring_base) -cpm_dpfree (fep->ring_mem_addr); +cpm_muram_free (fep->ring_mem_addr); }static void cleanup_data (struct net_device *dev)
Signature · 1 line
2.41.0
Simon Horman
reviewerRe: [PATCH net-next v2 10/10] net: fs_enet: Use cpm_muram_xxx() functions instead of cpm_dpxxx() macros
Quoted 1 line · Christophe Leroy
cpm_dpxxx()macros are now always referring tocpm_muram_xxx()fonctions
nit: fonctions -> functions
Thanks Christophe,
This minor nit notwithstanding, this series looks good to me. I'll send a reviewed-by tag for the whole series in response to the cover letter.
...
Quoted 10 lines · Christophe Leroy
Over the years, platform and driver initialisation have evolved into more generic ways, and driver or platform specific stuff has gone away, leaving stale objects behind.
This series aims at cleaning all that up for
fs_enetethernet driver.Changes in v2:
- Remove a trailing whitespace in the old struct moved in patch 7.
- Include powerpc people and list that I forgot when sending v1 (and Rob as expected by Patchwork for patch 6, not sure why)
Thanks, this looks good to me.
For the series,
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 4 lines · On Fri, 4 Aug 2023 15:30:10 +0200 you wrote:
Over the years, platform and driver initialisation have evolved into more generic ways, and driver or platform specific stuff has gone away, leaving stale objects behind.
Quoted 8 lines
This series aims at cleaning all that up for
fs_enetethernet driver.Changes in v2:
- Remove a trailing whitespace in the old struct moved in patch 7.
- Include powerpc people and list that I forgot when sending v1 (and Rob as expected by Patchwork for patch 6, not sure why)[...]
Here is the summary with links:
- [net-next,v2,01/10] net: fs_enet: Remove set but not used variable
https://git.kernel.org/netdev/net-next/c/78d3902795f0 - [net-next,v2,02/10] net: fs_enet: Fix address space and base types mismatches https://git.kernel.org/netdev/net-next/c/ae9e78a9dc88 - [net-next,v2,03/10] net: fs_enet: Remove fs_get_id() https://git.kernel.org/netdev/net-next/c/26bbbef8ff40 - [net-next,v2,04/10] net: fs_enet: Remove unused fields in fs_platform_info struct https://git.kernel.org/netdev/net-next/c/caaf482e2654 - [net-next,v2,05/10] net: fs_enet: Remove has_phy field in fs_platform_info struct https://git.kernel.org/netdev/net-next/c/9359a48c65a3 - [net-next,v2,06/10] net: fs_enet: Remove stale prototypes from fsl_soc.c https://git.kernel.org/netdev/net-next/c/62e106c802c5 - [net-next,v2,07/10] net: fs_enet: Move struct fs_platform_info into fs_enet.h https://git.kernel.org/netdev/net-next/c/7a76918371fe - [net-next,v2,08/10] net: fs_enet: Don't include fs_enet_pd.h when not needed https://git.kernel.org/netdev/net-next/c/33deffc9f19f - [net-next,v2,09/10] net: fs_enet: Remove linux/fs_enet_pd.h https://git.kernel.org/netdev/net-next/c/7149b38dc7cb - [net-next,v2,10/10] net: fs_enet: Use cpm_muram_xxx() functions instead of cpm_dpxxx() macros https://git.kernel.org/netdev/net-next/c/5e6cb39a256d
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html