Skip to contentSkip to conversation

net: dc2114x: Use PCI_DEVICE() to define PCI device compat list

PATCH New Marek Vasut 1 participant 4 messages Jun 20, 2020 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 net: dc2114x: Use PCI_DEVICE() to define PCI device compat list

Use this macro to fully fill the PCI device ID table. This is mandatory for the DM PCI support, which checks all the fields.

Cc Joe Hershberger <[email protected]>
Cc Ramon Fried <[email protected]>
---
 drivers/net/dc2114x.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/dc2114x.c +2 -2
index c55358ef83..e537b29f3d 100644
@@ -568,8 +568,8 @@ static void read_hw_addr(struct eth_device *dev, bd_t *bis)
 }
 
 static struct pci_device_id supported[] = {
-	{ PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_TULIP_FAST },
-	{ PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_21142 },
+	{ PCI_DEVICE(PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_TULIP_FAST) },
+	{ PCI_DEVICE(PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_21142) },
 	{ }
 };
 
Signature · 1 line
2.27.0
#1 lore raw

PATCH 2/4 net: dc2114x: Support all DC2114x

For the usage in this driver, the chips are identical, so support all of them.

Cc Joe Hershberger <[email protected]>
Cc Ramon Fried <[email protected]>
---
 drivers/net/dc2114x.c | 9 ---------
 1 file changed, 9 deletions(-)
drivers/net/dc2114x.c +0 -9
index e537b29f3d..245218080e 100644
@@ -581,7 +581,6 @@ int dc21x4x_initialize(bd_t *bis)
 	unsigned int iobase;
 	int card_number = 0;
 	pci_dev_t devbusfn;
-	unsigned int cfrv;
 	int idx = 0;
 
 	while (1) {
@@ -589,14 +588,6 @@ int dc21x4x_initialize(bd_t *bis)
 		if (devbusfn == -1)
 			break;
 
-		/* Get the chip configuration revision register. */
-		pci_read_config_dword(devbusfn, PCI_REVISION_ID, &cfrv);
-
-		if ((cfrv & CFRV_RN) < DC2114x_BRK) {
-			printf("Error: The chip is not DC21143.\n");
-			continue;
-		}
-
 		pci_read_config_word(devbusfn, PCI_COMMAND, &status);
 		status |= PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER;
 		pci_write_config_word(devbusfn, PCI_COMMAND, status);
Signature · 1 line
2.27.0
#2 lore raw

PATCH 3/4 net: dc2114x: Add Kconfig entries

In reply to Marek Vasut

Add Kconfig entries for the dc2114x driver and convert various boards.

Cc Joe Hershberger <[email protected]>
Cc Ramon Fried <[email protected]>
---
 README                                  | 3 ---
 configs/integratorap_cm720t_defconfig   | 1 +
 configs/integratorap_cm920t_defconfig   | 1 +
 configs/integratorap_cm926ejs_defconfig | 1 +
 configs/integratorap_cm946es_defconfig  | 1 +
 drivers/net/Kconfig                     | 6 ++++++
 include/configs/MPC8349EMDS.h           | 1 -
 include/configs/MPC8349EMDS_SDRAM.h     | 1 -
 include/configs/MPC8536DS.h             | 1 -
 include/configs/MPC8540ADS.h            | 1 -
 include/configs/MPC8541CDS.h            | 1 -
 include/configs/MPC8544DS.h             | 1 -
 include/configs/MPC8548CDS.h            | 1 -
 include/configs/MPC8555CDS.h            | 1 -
 include/configs/MPC8560ADS.h            | 1 -
 include/configs/MPC8568MDS.h            | 1 -
 include/configs/MPC8569MDS.h            | 1 -
 include/configs/MPC8572DS.h             | 1 -
 include/configs/MPC8641HPCN.h           | 1 -
 include/configs/TQM834x.h               | 1 -
 include/configs/caddy2.h                | 1 -
 include/configs/integratorap.h          | 1 -
 include/configs/sbc8349.h               | 1 -
 include/configs/sbc8548.h               | 1 -
 include/configs/sbc8641d.h              | 1 -
 include/configs/vme8349.h               | 1 -
 scripts/config_whitelist.txt            | 1 -
 27 files changed, 10 insertions(+), 24 deletions(-)
README +0 -3
index 62f6019f43..2924090e0c 100644
@@ -889,9 +889,6 @@ The following options need to be configured:
 		Allow generic access to the SPI bus on the Intel 8257x, for
 		example with the "sspi" command.
 
-		CONFIG_TULIP
-		Support for Digital 2114x chips.
-
 		CONFIG_NATSEMI
 		Support for National dp83815 chips.
 
configs/integratorap_cm720t_defconfig +1 -0
index 1b7d672bcb..0d9746b485 100644
@@ -25,6 +25,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
 CONFIG_EEPRO100=y
+CONFIG_TULIP=y
 CONFIG_PCI=y
 CONFIG_BAUDRATE=38400
 CONFIG_OF_LIBFDT=y
configs/integratorap_cm920t_defconfig +1 -0
index 116ac015a0..7d71648a86 100644
@@ -25,6 +25,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
 CONFIG_EEPRO100=y
+CONFIG_TULIP=y
 CONFIG_PCI=y
 CONFIG_BAUDRATE=38400
 CONFIG_OF_LIBFDT=y
configs/integratorap_cm926ejs_defconfig +1 -0
index 9c1a3fa2f5..921a75e326 100644
@@ -25,6 +25,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
 CONFIG_EEPRO100=y
+CONFIG_TULIP=y
 CONFIG_PCI=y
 CONFIG_BAUDRATE=38400
 CONFIG_OF_LIBFDT=y
configs/integratorap_cm946es_defconfig +1 -0
index ee9c69bce0..4032da97b4 100644
@@ -25,6 +25,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
 CONFIG_EEPRO100=y
+CONFIG_TULIP=y
 CONFIG_PCI=y
 CONFIG_BAUDRATE=38400
 CONFIG_OF_LIBFDT=y
drivers/net/Kconfig +6 -0
index 1566b3bda1..9da64bae4c 100644
@@ -484,6 +484,12 @@ config SH_ETHER
 
 source "drivers/net/ti/Kconfig"
 
+config TULIP
+	bool "DEC Tulip DC2114x Ethernet support"
+	depends on (DM_ETH && DM_PCI) || !DM_ETH
+	help
+	  This driver supports DEC DC2114x Fast ethernet chips.
+
 config XILINX_AXIEMAC
 	depends on DM_ETH && (MICROBLAZE || ARCH_ZYNQ || ARCH_ZYNQMP)
 	select PHYLIB
include/configs/MPC8349EMDS.h +0 -1
index 41ef3d80e1..c2f44416b9 100644
@@ -220,7 +220,6 @@
 
 #define CONFIG_83XX_PCI_STREAMING
 
-#undef CONFIG_TULIP
 
 #if !defined(CONFIG_PCI_PNP)
 	#define PCI_ENET0_IOADDR	0xFIXME
include/configs/MPC8349EMDS_SDRAM.h +0 -1
index 4b43ee1d44..618e210e4e 100644
@@ -275,7 +275,6 @@
 
 #define CONFIG_83XX_PCI_STREAMING
 
-#undef CONFIG_TULIP
 
 #if !defined(CONFIG_PCI_PNP)
 	#define PCI_ENET0_IOADDR	0xFIXME
include/configs/MPC8536DS.h +0 -1
index 62da11e4a1..15d5159203 100644
@@ -466,7 +466,6 @@
 #define CONFIG_SYS_ISA_IO_BASE_ADDRESS CONFIG_SYS_PCIE3_IO_VIRT
 #endif
 
-#undef CONFIG_TULIP
 
 #ifndef CONFIG_PCI_PNP
 	#define PCI_ENET0_IOADDR	CONFIG_SYS_PCI1_IO_BUS
include/configs/MPC8540ADS.h +0 -1
index 19859671cd..927b59a553 100644
@@ -236,7 +236,6 @@
 #define CONFIG_SYS_PCI1_IO_SIZE	0x100000	/* 1M */
 
 #if defined(CONFIG_PCI)
-#undef CONFIG_TULIP
 
 #if !defined(CONFIG_PCI_PNP)
     #define PCI_ENET0_IOADDR	0xe0000000
include/configs/MPC8541CDS.h +0 -1
index 013bd775dd..b93899e504 100644
@@ -282,7 +282,6 @@ extern unsigned long get_clock_freq(void);
 
 #define CONFIG_MPC85XX_PCI2
 
-#undef CONFIG_TULIP
 
 #undef CONFIG_PCI_SCAN_SHOW		/* show pci devices on startup */
 #define CONFIG_SYS_PCI_SUBSYS_VENDORID 0x1057  /* Motorola */
include/configs/MPC8544DS.h +0 -1
index 1dd030842a..6aabf5432e 100644
@@ -258,7 +258,6 @@ extern unsigned long get_board_sys_clk(unsigned long dummy);
 #define CONFIG_SYS_ISA_IO_BASE_ADDRESS VIDEO_IO_OFFSET
 #endif
 
-#undef CONFIG_TULIP
 
 #ifndef CONFIG_PCI_PNP
 	#define PCI_ENET0_IOADDR	CONFIG_SYS_PCI1_IO_BUS
include/configs/MPC8548CDS.h +0 -1
index e3044f0ae6..70f5dc5608 100644
@@ -380,7 +380,6 @@ extern unsigned long get_clock_freq(void);
 #endif
 
 #if defined(CONFIG_PCI)
-#undef CONFIG_TULIP
 
 #if !defined(CONFIG_DM_PCI)
 #define CONFIG_FSL_PCI_INIT		1	/* Use common FSL init code */
include/configs/MPC8555CDS.h +0 -1
index 70289f570a..57919cd51c 100644
@@ -280,7 +280,6 @@ extern unsigned long get_clock_freq(void);
 
 #define CONFIG_MPC85XX_PCI2
 
-#undef CONFIG_TULIP
 
 #define CONFIG_PCI_SCAN_SHOW		/* show pci devices on startup */
 #define CONFIG_SYS_PCI_SUBSYS_VENDORID 0x1057  /* Motorola */
include/configs/MPC8560ADS.h +0 -1
index fc4040907a..1048b58ae1 100644
@@ -233,7 +233,6 @@
 #define CONFIG_SYS_PCI1_IO_SIZE	0x100000	/* 1M */
 
 #if defined(CONFIG_PCI)
-#undef CONFIG_TULIP
 
 #if !defined(CONFIG_PCI_PNP)
     #define PCI_ENET0_IOADDR	0xe0000000
include/configs/MPC8568MDS.h +0 -1
index 60caea4a4c..00bd5ee8ef 100644
@@ -290,7 +290,6 @@ extern unsigned long get_clock_freq(void);
 #endif /* CONFIG_QE */
 
 #if defined(CONFIG_PCI)
-#undef CONFIG_TULIP
 
 #undef CONFIG_PCI_SCAN_SHOW		/* show pci devices on startup */
 #define CONFIG_SYS_PCI_SUBSYS_VENDORID 0x1057  /* Motorola */
include/configs/MPC8569MDS.h +0 -1
index 4d6a3d0a7d..a99db0c8fc 100644
@@ -396,7 +396,6 @@ extern unsigned long get_clock_freq(void);
 #endif /* CONFIG_QE */
 
 #if defined(CONFIG_PCI)
-#undef CONFIG_TULIP
 
 #undef CONFIG_PCI_SCAN_SHOW		/* show pci devices on startup */
 
include/configs/MPC8572DS.h +0 -1
index bad9142921..9bba4dcd79 100644
@@ -443,7 +443,6 @@
 #define CONFIG_SYS_ISA_IO_BASE_ADDRESS VIDEO_IO_OFFSET
 #endif
 
-#undef CONFIG_TULIP
 
 #ifndef CONFIG_PCI_PNP
 	#define PCI_ENET0_IOADDR	CONFIG_SYS_PCIE3_IO_BUS
include/configs/MPC8641HPCN.h +0 -1
index 78d1dd2c37..0ed1415de4 100644
@@ -334,7 +334,6 @@ extern unsigned long get_board_sys_clk(unsigned long dummy);
 
 #define CONFIG_PCI_SCAN_SHOW		/* show pci devices on startup */
 
-#undef CONFIG_TULIP
 
 /************************************************************
  * USB support
include/configs/TQM834x.h +0 -1
index d43d217956..aa70f01ddd 100644
@@ -167,7 +167,6 @@
 #define CONFIG_SYS_PCI1_IO_PHYS		CONFIG_SYS_PCI1_IO_BASE
 #define CONFIG_SYS_PCI1_IO_SIZE		0x1000000	/* 16M */
 
-#undef CONFIG_TULIP
 
 #if !defined(CONFIG_PCI_PNP)
 	#define PCI_ENET0_IOADDR	CONFIG_SYS_PCI1_IO_BASE
include/configs/caddy2.h +0 -1
index a7c667711b..e51398d531 100644
@@ -155,7 +155,6 @@
 
 #if defined(CONFIG_PCI)
 
-#undef CONFIG_TULIP
 
 #if !defined(CONFIG_PCI_PNP)
 	#define PCI_ENET0_IOADDR	0xFIXME
include/configs/integratorap.h +0 -1
index 96c1d53b9b..2f8ac20a76 100644
@@ -34,7 +34,6 @@
  * PCI definitions
  */
 
-#define CONFIG_TULIP
 #define CONFIG_SYS_RX_ETH_BUFFER	8	/* use 8 rx buffer on eepro100	*/
 
 /*-----------------------------------------------------------------------
include/configs/sbc8349.h +0 -1
index cca596d43a..0561ec2024 100644
@@ -180,7 +180,6 @@
 
 #if defined(CONFIG_PCI)
 
-#undef CONFIG_TULIP
 
 #if !defined(CONFIG_PCI_PNP)
 	#define PCI_ENET0_IOADDR	0xFIXME
include/configs/sbc8548.h +0 -1
index 503b9b1cb5..e38e61719c 100644
@@ -434,7 +434,6 @@
 #endif
 
 #if defined(CONFIG_PCI)
-#undef CONFIG_TULIP
 
 #define CONFIG_PCI_SCAN_SHOW		/* show pci devices on startup */
 
include/configs/sbc8641d.h +0 -1
index 66c1f3595b..b2b65f64c4 100644
@@ -276,7 +276,6 @@
 
 #define CONFIG_PCI_SCAN_SHOW            /* show pci devices on startup */
 
-#undef CONFIG_TULIP
 
 #if !defined(CONFIG_PCI_PNP)
     #define PCI_ENET0_IOADDR	0xe0000000
include/configs/vme8349.h +0 -1
index 52d632ba0a..bd94352179 100644
@@ -155,7 +155,6 @@
 
 #if defined(CONFIG_PCI)
 
-#undef CONFIG_TULIP
 
 #if !defined(CONFIG_PCI_PNP)
 	#define PCI_ENET0_IOADDR	0xFIXME
scripts/config_whitelist.txt +0 -1
index 1165e88c28..3e115acdf7 100644
@@ -4049,7 +4049,6 @@ CONFIG_TSECV2
 CONFIG_TSECV2_1
 CONFIG_TSEC_TBI
 CONFIG_TSEC_TBICR_SETTINGS
-CONFIG_TULIP
 CONFIG_TWL6030_INPUT
 CONFIG_TWL6030_POWER
 CONFIG_TWR
Signature · 1 line
2.27.0
#3 lore raw

PATCH 4/4 net: dc2114x: Drop update_srom()

In reply to Marek Vasut

This code is never used, remove it.

Cc Joe Hershberger <[email protected]>
Cc Ramon Fried <[email protected]>
---
 drivers/net/dc2114x.c | 91 -------------------------------------------
 1 file changed, 91 deletions(-)
drivers/net/dc2114x.c +0 -91
index 245218080e..af582c5415 100644
@@ -11,8 +11,6 @@
 
 #define SROM_DLEVEL	0
 
-#undef UPDATE_SROM
-
 /* PCI Registers. */
 #define PCI_CFDA_PSM	0x43
 
@@ -270,92 +268,6 @@ static int read_srom(struct eth_device *dev, u_long ioaddr, int index)
 			     3 + ee_addr_size + 16);
 }
 
-#ifdef UPDATE_SROM
-static int write_srom(struct eth_device *dev, u_long ioaddr, int index,
-		      int new_value)
-{
-	unsigned short newval;
-	int ee_addr_size;
-	int i;
-
-	ee_addr_size = (do_read_eeprom(dev, ioaddr, 0xff, 8) & BIT(18)) ? 8 : 6;
-
-	udelay(10 * 1000); /* test-only */
-
-	debug_cond(SROM_DLEVEL >= 1, "ee_addr_size=%d.\n", ee_addr_size);
-	debug_cond(SROM_DLEVEL >= 1,
-		   "Writing new entry 0x%4.4x to offset %d.\n",
-		   new_value, index);
-
-	/* Enable programming modes. */
-	do_eeprom_cmd(dev, ioaddr, 0x4f << (ee_addr_size - 4),
-		      3 + ee_addr_size);
-
-	/* Do the actual write. */
-	do_eeprom_cmd(dev, ioaddr, new_value |
-		      (((SROM_WRITE_CMD << ee_addr_size) | index) << 16),
-		      3 + ee_addr_size + 16);
-
-	/* Poll for write finished. */
-	sendto_srom(dev, SROM_RD | SROM_SR | DT_CS, ioaddr);
-	for (i = 0; i < 10000; i++) {	/* Typical 2000 ticks */
-		if (getfrom_srom(dev, ioaddr) & EE_DATA_READ)
-			break;
-	}
-
-	debug_cond(SROM_DLEVEL >= 1, " Write finished after %d ticks.\n", i);
-
-	/* Disable programming. */
-	do_eeprom_cmd(dev, ioaddr, (0x40 << (ee_addr_size - 4)),
-		      3 + ee_addr_size);
-
-	/* And read the result. */
-	newval = do_eeprom_cmd(dev, ioaddr,
-			       (((SROM_READ_CMD << ee_addr_size) | index) << 16)
-			       | 0xffff, 3 + ee_addr_size + 16);
-
-	debug_cond(SROM_DLEVEL >= 1, "  New value at offset %d is %4.4x.\n",
-		   index, newval);
-
-	return 1;
-}
-
-static void update_srom(struct eth_device *dev, bd_t *bis)
-{
-	static unsigned short eeprom[0x40] = {
-		0x140b, 0x6610, 0x0000, 0x0000,	/* 00 */
-		0x0000, 0x0000, 0x0000, 0x0000,	/* 04 */
-		0x00a3, 0x0103, 0x0000, 0x0000,	/* 08 */
-		0x0000, 0x1f00, 0x0000, 0x0000,	/* 0c */
-		0x0108, 0x038d, 0x0000, 0x0000,	/* 10 */
-		0xe078, 0x0001, 0x0040, 0x0018,	/* 14 */
-		0x0000, 0x0000, 0x0000, 0x0000,	/* 18 */
-		0x0000, 0x0000, 0x0000, 0x0000,	/* 1c */
-		0x0000, 0x0000, 0x0000, 0x0000,	/* 20 */
-		0x0000, 0x0000, 0x0000, 0x0000,	/* 24 */
-		0x0000, 0x0000, 0x0000, 0x0000,	/* 28 */
-		0x0000, 0x0000, 0x0000, 0x0000,	/* 2c */
-		0x0000, 0x0000, 0x0000, 0x0000,	/* 30 */
-		0x0000, 0x0000, 0x0000, 0x0000,	/* 34 */
-		0x0000, 0x0000, 0x0000, 0x0000,	/* 38 */
-		0x0000, 0x0000, 0x0000, 0x4e07,	/* 3c */
-	};
-	uchar enetaddr[6];
-	int i;
-
-	/* Ethernet Addr... */
-	if (!eth_env_get_enetaddr("ethaddr", enetaddr))
-		return;
-
-	eeprom[0x0a] = (enetaddr[1] << 8) | enetaddr[0];
-	eeprom[0x0b] = (enetaddr[3] << 8) | enetaddr[2];
-	eeprom[0x0c] = (enetaddr[5] << 8) | enetaddr[4];
-
-	for (i = 0; i < 0x40; i++)
-		write_srom(dev, DE4X5_APROM, i, eeprom[i]);
-}
-#endif /* UPDATE_SROM */
-
 static void send_setup_frame(struct eth_device *dev, bd_t *bis)
 {
 	char setup_frame[SETUP_FRAME_LEN];
@@ -561,9 +473,6 @@ static void read_hw_addr(struct eth_device *dev, bd_t *bis)
 	if (!j || j == 0x2fffd) {
 		memset(dev->enetaddr, 0, ETH_ALEN);
 		debug("Warning: can't read HW address from SROM.\n");
-#ifdef UPDATE_SROM
-		update_srom(dev, bis);
-#endif
 	}
 }
 
Signature · 1 line
2.27.0