[U-Boot] [PATCH V2 4/5] dm9000: dm9000_initialize stub

Andrew Ruder andrew.ruder at elecsyscorp.com
Wed Aug 12 19:24:05 CEST 2015


Change the dm9000_initialize function to taking arguments for io
address, data address, and availability of srom.  Right now we aren't
actually using any of this inside of drivers/net/dm9000x.c but we are
making way for support for boards that have multiple (or discovered)
numbers of dm9000 devices.

Signed-off-by: Andrew Ruder <andrew.ruder at elecsyscorp.com>
Cc: Joe Hershberger <joe.hershberger at gmail.com>
---
 board/altera/nios2-generic/nios2-generic.c    | 3 +--
 board/atmel/at91sam9261ek/at91sam9261ek.c     | 2 +-
 board/davinci/dm355evm/dm355evm.c             | 2 +-
 board/davinci/dm355leopard/dm355leopard.c     | 2 +-
 board/freescale/m5253demo/m5253demo.c         | 2 +-
 board/icpdas/lp8x4x/lp8x4x.c                  | 2 +-
 board/ip04/ip04.c                             | 2 +-
 board/ronetix/pm9261/pm9261.c                 | 2 +-
 board/scb9328/scb9328.c                       | 2 +-
 board/timll/devkit8000/devkit8000.c           | 2 +-
 board/toradex/colibri_pxa270/colibri_pxa270.c | 2 +-
 board/trizepsiv/conxs.c                       | 2 +-
 board/vpac270/vpac270.c                       | 2 +-
 drivers/net/dm9000x.c                         | 2 +-
 include/configs/M5253DEMO.h                   | 1 +
 include/configs/at91sam9261ek.h               | 3 +--
 include/configs/colibri_pxa270.h              | 1 +
 include/configs/davinci_dm355evm.h            | 1 +
 include/configs/davinci_dm355leopard.h        | 1 +
 include/configs/devkit8000.h                  | 3 +--
 include/configs/ip04.h                        | 2 +-
 include/configs/lp8x4x.h                      | 2 ++
 include/configs/pm9261.h                      | 2 +-
 include/configs/scb9328.h                     | 1 +
 include/configs/trizepsiv.h                   | 1 +
 include/configs/vpac270.h                     | 1 +
 include/netdev.h                              | 2 +-
 27 files changed, 28 insertions(+), 22 deletions(-)

diff --git a/board/altera/nios2-generic/nios2-generic.c b/board/altera/nios2-generic/nios2-generic.c
index 834cbeb..d6ed636 100644
--- a/board/altera/nios2-generic/nios2-generic.c
+++ b/board/altera/nios2-generic/nios2-generic.c
@@ -61,8 +61,7 @@ int board_eth_init(bd_t *bis)
 	rc += smc91111_initialize(0, CONFIG_SMC91111_BASE);
 #endif
 #ifdef CONFIG_DRIVER_DM9000
-	rc += dm9000_initialize(bis);
-#endif
+	rc += dm9000_initialize(0, DM9000_IO, DM9000_DATA, DM9000_HAS_SROM);
 #ifdef CONFIG_ALTERA_TSE
 	rc += altera_tse_initialize(0,
 				    CONFIG_SYS_ALTERA_TSE_MAC_BASE,
diff --git a/board/atmel/at91sam9261ek/at91sam9261ek.c b/board/atmel/at91sam9261ek/at91sam9261ek.c
index 5250474..551f612 100644
--- a/board/atmel/at91sam9261ek/at91sam9261ek.c
+++ b/board/atmel/at91sam9261ek/at91sam9261ek.c
@@ -255,7 +255,7 @@ int board_init(void)
 #ifdef CONFIG_DRIVER_DM9000
 int board_eth_init(bd_t *bis)
 {
-	return dm9000_initialize(bis);
+	return dm9000_initialize(0, DM9000_IO, DM9000_DATA, DM9000_HAS_SROM);
 }
 #endif
 
diff --git a/board/davinci/dm355evm/dm355evm.c b/board/davinci/dm355evm/dm355evm.c
index e5a958f..c37595d 100644
--- a/board/davinci/dm355evm/dm355evm.c
+++ b/board/davinci/dm355evm/dm355evm.c
@@ -74,7 +74,7 @@ int board_init(void)
 #ifdef CONFIG_DRIVER_DM9000
 int board_eth_init(bd_t *bis)
 {
-	return dm9000_initialize(bis);
+	return dm9000_initialize(0, DM9000_IO, DM9000_DATA, DM9000_HAS_SROM);
 }
 #endif
 
diff --git a/board/davinci/dm355leopard/dm355leopard.c b/board/davinci/dm355leopard/dm355leopard.c
index 53902f9..e8c99f0 100644
--- a/board/davinci/dm355leopard/dm355leopard.c
+++ b/board/davinci/dm355leopard/dm355leopard.c
@@ -72,7 +72,7 @@ int board_init(void)
 #ifdef CONFIG_DRIVER_DM9000
 int board_eth_init(bd_t *bis)
 {
-	return dm9000_initialize(bis);
+	return dm9000_initialize(0, DM9000_IO, DM9000_DATA, DM9000_HAS_SROM);
 }
 #endif
 
diff --git a/board/freescale/m5253demo/m5253demo.c b/board/freescale/m5253demo/m5253demo.c
index 7e516bf..dfe3c0c 100644
--- a/board/freescale/m5253demo/m5253demo.c
+++ b/board/freescale/m5253demo/m5253demo.c
@@ -135,6 +135,6 @@ void ide_set_reset(int idereset)
 #ifdef CONFIG_DRIVER_DM9000
 int board_eth_init(bd_t *bis)
 {
-	return dm9000_initialize(bis);
+	return dm9000_initialize(0, DM9000_IO, DM9000_DATA, DM9000_HAS_SROM);
 }
 #endif
diff --git a/board/icpdas/lp8x4x/lp8x4x.c b/board/icpdas/lp8x4x/lp8x4x.c
index a136dc4..88099fe 100644
--- a/board/icpdas/lp8x4x/lp8x4x.c
+++ b/board/icpdas/lp8x4x/lp8x4x.c
@@ -123,6 +123,6 @@ int board_usb_cleanup(int index, enum usb_init_type init)
 #ifdef CONFIG_DRIVER_DM9000
 int board_eth_init(bd_t *bis)
 {
-	return dm9000_initialize(bis);
+	return dm9000_initialize(0, DM9000_IO, DM9000_DATA, DM9000_HAS_SROM);
 }
 #endif
diff --git a/board/ip04/ip04.c b/board/ip04/ip04.c
index 70765bc..0de71aa 100644
--- a/board/ip04/ip04.c
+++ b/board/ip04/ip04.c
@@ -24,6 +24,6 @@ int checkboard(void)
 #ifdef CONFIG_DRIVER_DM9000
 int board_eth_init(bd_t *bis)
 {
-	return dm9000_initialize(bis);
+	return dm9000_initialize(0, DM9000_IO, DM9000_DATA, DM9000_HAS_SROM);
 }
 #endif
diff --git a/board/ronetix/pm9261/pm9261.c b/board/ronetix/pm9261/pm9261.c
index b96f745..a5f1781 100644
--- a/board/ronetix/pm9261/pm9261.c
+++ b/board/ronetix/pm9261/pm9261.c
@@ -262,7 +262,7 @@ int board_init(void)
 #ifdef CONFIG_DRIVER_DM9000
 int board_eth_init(bd_t *bis)
 {
-	return dm9000_initialize(bis);
+	return dm9000_initialize(0, DM9000_IO, DM9000_DATA, DM9000_HAS_SROM);
 }
 #endif
 
diff --git a/board/scb9328/scb9328.c b/board/scb9328/scb9328.c
index 3463f52..93f843e 100644
--- a/board/scb9328/scb9328.c
+++ b/board/scb9328/scb9328.c
@@ -49,6 +49,6 @@ void show_boot_progress (int status)
 #ifdef CONFIG_DRIVER_DM9000
 int board_eth_init(bd_t *bis)
 {
-	return dm9000_initialize(bis);
+	return dm9000_initialize(0, DM9000_IO, DM9000_DATA, DM9000_HAS_SROM);
 }
 #endif
diff --git a/board/timll/devkit8000/devkit8000.c b/board/timll/devkit8000/devkit8000.c
index 4d07313..ff0b43b 100644
--- a/board/timll/devkit8000/devkit8000.c
+++ b/board/timll/devkit8000/devkit8000.c
@@ -151,7 +151,7 @@ void board_mmc_power_init(void)
  */
 int board_eth_init(bd_t *bis)
 {
-	return dm9000_initialize(bis);
+	return dm9000_initialize(0, DM9000_IO, DM9000_DATA, DM9000_HAS_SROM);
 }
 #endif
 
diff --git a/board/toradex/colibri_pxa270/colibri_pxa270.c b/board/toradex/colibri_pxa270/colibri_pxa270.c
index 3def0a6..a5039eb 100644
--- a/board/toradex/colibri_pxa270/colibri_pxa270.c
+++ b/board/toradex/colibri_pxa270/colibri_pxa270.c
@@ -94,7 +94,7 @@ void usb_board_stop(void)
 #ifdef CONFIG_DRIVER_DM9000
 int board_eth_init(bd_t *bis)
 {
-	return dm9000_initialize(bis);
+	return dm9000_initialize(0, DM9000_IO, DM9000_DATA, DM9000_HAS_SROM);
 }
 #endif
 
diff --git a/board/trizepsiv/conxs.c b/board/trizepsiv/conxs.c
index 1ddf05d..e174861 100644
--- a/board/trizepsiv/conxs.c
+++ b/board/trizepsiv/conxs.c
@@ -135,7 +135,7 @@ void dram_init_banksize(void)
 #ifdef CONFIG_DRIVER_DM9000
 int board_eth_init(bd_t *bis)
 {
-	return dm9000_initialize(bis);
+	return dm9000_initialize(0, DM9000_IO, DM9000_DATA, DM9000_HAS_SROM);
 }
 #endif
 
diff --git a/board/vpac270/vpac270.c b/board/vpac270/vpac270.c
index 8d777df..76ed3be 100644
--- a/board/vpac270/vpac270.c
+++ b/board/vpac270/vpac270.c
@@ -121,6 +121,6 @@ void usb_board_stop(void)
 #ifdef CONFIG_DRIVER_DM9000
 int board_eth_init(bd_t *bis)
 {
-	return dm9000_initialize(bis);
+	return dm9000_initialize(0, DM9000_IO, DM9000_DATA, DM9000_HAS_SROM);
 }
 #endif
diff --git a/drivers/net/dm9000x.c b/drivers/net/dm9000x.c
index e1a10b5..9778ef9 100644
--- a/drivers/net/dm9000x.c
+++ b/drivers/net/dm9000x.c
@@ -616,7 +616,7 @@ dm9000_phy_write(int reg, u16 value)
 	DM9000_DBG("dm9000_phy_write(reg:0x%x, value:0x%x)\n", reg, value);
 }
 
-int dm9000_initialize(bd_t *bis)
+int dm9000_initialize(u8 dev_num, ulong addr, ulong data, u8 has_srom)
 {
 	struct eth_device *dev = &(dm9000_info.netdev);
 
diff --git a/include/configs/M5253DEMO.h b/include/configs/M5253DEMO.h
index ddb5cda..02adb79 100644
--- a/include/configs/M5253DEMO.h
+++ b/include/configs/M5253DEMO.h
@@ -71,6 +71,7 @@
 #	define CONFIG_DM9000_BASE	(CONFIG_SYS_CS1_BASE | 0x300)
 #	define DM9000_IO		CONFIG_DM9000_BASE
 #	define DM9000_DATA		(CONFIG_DM9000_BASE + 4)
+#	define DM9000_HAS_SROM		1
 #	undef CONFIG_DM9000_DEBUG
 #	define CONFIG_DM9000_BYTE_SWAPPED
 
diff --git a/include/configs/at91sam9261ek.h b/include/configs/at91sam9261ek.h
index 42461d2..7b4e63d 100644
--- a/include/configs/at91sam9261ek.h
+++ b/include/configs/at91sam9261ek.h
@@ -131,8 +131,7 @@
 #define CONFIG_DM9000_BASE		0x30000000
 #define DM9000_IO			CONFIG_DM9000_BASE
 #define DM9000_DATA			(CONFIG_DM9000_BASE + 4)
-#define CONFIG_DM9000_USE_16BIT
-#define CONFIG_DM9000_NO_SROM
+#define DM9000_HAS_SROM			0
 #define CONFIG_NET_RETRY_COUNT		20
 #define CONFIG_RESET_PHY_R
 
diff --git a/include/configs/colibri_pxa270.h b/include/configs/colibri_pxa270.h
index e3f0ab0..e7db8cf 100644
--- a/include/configs/colibri_pxa270.h
+++ b/include/configs/colibri_pxa270.h
@@ -67,6 +67,7 @@
 #define CONFIG_DM9000_BASE		0x08000000
 #define DM9000_IO			(CONFIG_DM9000_BASE)
 #define DM9000_DATA			(CONFIG_DM9000_BASE + 4)
+#define DM9000_HAS_SROM			1
 #define	CONFIG_NET_RETRY_COUNT		10
 
 #define	CONFIG_BOOTP_BOOTFILESIZE
diff --git a/include/configs/davinci_dm355evm.h b/include/configs/davinci_dm355evm.h
index e873fa4..b3f5a28 100644
--- a/include/configs/davinci_dm355evm.h
+++ b/include/configs/davinci_dm355evm.h
@@ -38,6 +38,7 @@
 #define CONFIG_DM9000_BASE		0x04014000
 #define DM9000_IO			CONFIG_DM9000_BASE
 #define DM9000_DATA			(CONFIG_DM9000_BASE + 2)
+#define DM9000_HAS_SROM			1
 
 /* I2C */
 #define CONFIG_SYS_I2C
diff --git a/include/configs/davinci_dm355leopard.h b/include/configs/davinci_dm355leopard.h
index d4b994a..0f27e86 100644
--- a/include/configs/davinci_dm355leopard.h
+++ b/include/configs/davinci_dm355leopard.h
@@ -37,6 +37,7 @@
 #define CONFIG_DM9000_BASE		0x04000000
 #define DM9000_IO			CONFIG_DM9000_BASE
 #define DM9000_DATA			(CONFIG_DM9000_BASE + 16)
+#define DM9000_HAS_SROM			1
 
 /* I2C */
 #define CONFIG_SYS_I2C
diff --git a/include/configs/devkit8000.h b/include/configs/devkit8000.h
index 215dc30..78f7f11 100644
--- a/include/configs/devkit8000.h
+++ b/include/configs/devkit8000.h
@@ -61,8 +61,7 @@
 #define	CONFIG_DM9000_BASE		0x2c000000
 #define	DM9000_IO			CONFIG_DM9000_BASE
 #define	DM9000_DATA			(CONFIG_DM9000_BASE + 0x400)
-#define	CONFIG_DM9000_USE_16BIT		1
-#define CONFIG_DM9000_NO_SROM		1
+#define	DM9000_HAS_SROM			0
 #undef	CONFIG_DM9000_DEBUG
 
 /* SPI */
diff --git a/include/configs/ip04.h b/include/configs/ip04.h
index dd2a618..1ae92af 100644
--- a/include/configs/ip04.h
+++ b/include/configs/ip04.h
@@ -72,10 +72,10 @@
 #define CONFIG_HOSTNAME		IP04
 
 #define CONFIG_DRIVER_DM9000	1
-#define CONFIG_DM9000_NO_SROM
 #define CONFIG_DM9000_BASE	0x20100000
 #define DM9000_IO		CONFIG_DM9000_BASE
 #define DM9000_DATA		(CONFIG_DM9000_BASE + 2)
+#define DM9000_HAS_SROM		0
 
 
 /*
diff --git a/include/configs/lp8x4x.h b/include/configs/lp8x4x.h
index e9ee3fb..17f8558 100644
--- a/include/configs/lp8x4x.h
+++ b/include/configs/lp8x4x.h
@@ -62,8 +62,10 @@
 #define	CONFIG_DM9000_BASE		0x0C000000
 #define	DM9000_IO			0x0C000000
 #define	DM9000_DATA			0x0C004000
+#define	DM9000_HAS_SROM			1
 #define	DM9000_IO_2			0x0D000000
 #define	DM9000_DATA_2			0x0D004000
+#define	DM9000_HAS_SROM_2		1
 #define	CONFIG_NET_RETRY_COUNT		10
 
 #define	CONFIG_BOOTP_BOOTFILESIZE
diff --git a/include/configs/pm9261.h b/include/configs/pm9261.h
index f9a1d51..41c540d 100644
--- a/include/configs/pm9261.h
+++ b/include/configs/pm9261.h
@@ -229,7 +229,7 @@
 #define CONFIG_DM9000_BASE			0x30000000
 #define DM9000_IO				CONFIG_DM9000_BASE
 #define DM9000_DATA				(CONFIG_DM9000_BASE + 4)
-#define CONFIG_DM9000_USE_16BIT			1
+#define DM9000_HAS_SROM				1
 #define CONFIG_NET_RETRY_COUNT			20
 #define CONFIG_RESET_PHY_R			1
 
diff --git a/include/configs/scb9328.h b/include/configs/scb9328.h
index f367d62..091c0ee 100644
--- a/include/configs/scb9328.h
+++ b/include/configs/scb9328.h
@@ -214,6 +214,7 @@
 #define CONFIG_DM9000_BASE		0x16000000
 #define DM9000_IO			CONFIG_DM9000_BASE
 #define DM9000_DATA			(CONFIG_DM9000_BASE+4)
+#define DM9000_HAS_SROM			1
 
 /* f_{dpll}=2*f{ref}*(MFI+MFN/(MFD+1))/(PD+1)
    f_ref=16,777MHz
diff --git a/include/configs/trizepsiv.h b/include/configs/trizepsiv.h
index 8368931..1dcc03e 100644
--- a/include/configs/trizepsiv.h
+++ b/include/configs/trizepsiv.h
@@ -263,6 +263,7 @@
 
 #define DM9000_IO			CONFIG_DM9000_BASE
 #define DM9000_DATA			(CONFIG_DM9000_BASE+0x8004)
+#define DM9000_HAS_SROM			1
 
 #define CONFIG_USB_OHCI_NEW	1
 #define CONFIG_SYS_USB_OHCI_BOARD_INIT	1
diff --git a/include/configs/vpac270.h b/include/configs/vpac270.h
index 95a69b3..2a765f9 100644
--- a/include/configs/vpac270.h
+++ b/include/configs/vpac270.h
@@ -91,6 +91,7 @@
 #define	CONFIG_DM9000_BASE		0x08000300	/* CS2 */
 #define	DM9000_IO			(CONFIG_DM9000_BASE)
 #define	DM9000_DATA			(CONFIG_DM9000_BASE + 4)
+#define	DM9000_HAS_SROM			1
 #define	CONFIG_NET_RETRY_COUNT		10
 
 #define	CONFIG_BOOTP_BOOTFILESIZE
diff --git a/include/netdev.h b/include/netdev.h
index 662d173..971fde1 100644
--- a/include/netdev.h
+++ b/include/netdev.h
@@ -38,7 +38,7 @@ int cs8900_initialize(u8 dev_num, int base_addr);
 int davinci_emac_initialize(void);
 int dc21x4x_initialize(bd_t *bis);
 int designware_initialize(ulong base_addr, u32 interface);
-int dm9000_initialize(bd_t *bis);
+int dm9000_initialize(u8 dev_num, ulong addr, ulong data, u8 has_srom);
 int dnet_eth_initialize(int id, void *regs, unsigned int phy_addr);
 int e1000_initialize(bd_t *bis);
 int eepro100_initialize(bd_t *bis);
-- 
2.1.4



More information about the U-Boot mailing list