Add config option for disabling DM9000-SROM support.
Subsystems (2)
PATCH 1/1 Add config option for disabling DM9000-SROM support.
Some boards do not have SROM support for the DM9000 network adapter. Instead of listing these board names in the driver code, make this option configurable from the board config file.
It also removes a build warning for the at91sam9261ek board:
'dm9000x.c:545: warning: 'read_srom_word' defined but not used'
And it repaires the trizepsiv board build which was broken around the same routines
--- board/trizepsiv/eeprom.c | 14 +++++++------- drivers/net/dm9000x.c | 16 ++++++++-------- include/configs/at91sam9261ek.h | 1 + include/dm9000.h | 11 +++++++++++ 4 files changed, 27 insertions(+), 15 deletions(-) create mode 100644 include/dm9000.h
board/trizepsiv/eeprom.c +7 -7
@@ -23,17 +23,17 @@#include <common.h> #include <command.h> - -extern u16 read_srom_word (int ); -extern void write_srom_word (int offset,u16 val); +#include <dm9000.h> static int do_read_dm9000_eeprom (cmd_tbl_t *cmdtp,int flag,int argc,char *argv[]) { -int i; +unsigned int i; +u8 data[2 ];for (i=0 ; i <0x40 ; i++) {if (!(i %0x10 )) -printf ("\n%08lx:" , i); -printf (" %04x" ,read_srom_word (i)); +printf ("\n%08x:" , i); +dm9000_read_srom_word (i, data); +printf (" %02x%02x" , data[1 ], data[0 ]); }printf ("\n" );return (0 );
@@ -54,7 +54,7 @@ static int do_write_dm9000_eeprom ( cmd_tbl_t *cmdtp, int flag, int argc, char *cmd_usage (cmdtp);return 1 ; } -write_srom_word (offset, value); +dm9000_write_srom_word (offset, value);return (0 ); }
drivers/net/dm9000x.c +8 -8
@@ -53,7 +53,7 @@ v1.2 03/18/2003 Weilun Huang <[email protected]>:notes (i.e. double reset) - some minor code cleanups These changes are tested with DM9000{A,EP,E} together -with a 200MHz Atmel AT91SAM92161 core +with a 200MHz Atmel AT91SAM9261 core TODO: external MII is not functional, only internal at the moment. */
@@ -62,6 +62,7 @@ TODO: external MII is not functional, only internal at the moment.#include <command.h> #include <net.h> #include <asm/io.h> +#include <dm9000.h> #include "dm9000x.h"
@@ -113,7 +114,6 @@ void eth_halt(void);static int dm9000_probe (void );static u16 phy_read (int );static void phy_write (int ,u16 ); -static void read_srom_word (int ,u8 *);static u8 DM9000_ior (int );static void DM9000_iow (int reg,u8 value);
@@ -347,9 +347,9 @@ eth_init(bd_t * bd)/* Set Node address */ if (!eth_getenv_enetaddr ("ethaddr" , enetaddr)) { -#if !defined(CONFIG_AT91SAM9261EK ) +#if !defined(CONFIG_DM9000_NO_SROM_AVAIL )for (i =0 ; i <3 ; i++) -read_srom_word (i, enetaddr +2 * i); +dm9000_read_srom_word (i, enetaddr +2 * i);eth_setenv_enetaddr ("ethaddr" , enetaddr);#endif }
@@ -541,7 +541,8 @@ eth_rx(void)/* Read a word data from SROM */ -static void read_srom_word (int offset,u8 *to) +#if !defined(CONFIG_DM9000_NO_SROM_AVAIL ) +void dm9000_read_srom_word (int offset,u8 *to) {DM9000_iow (DM9000_EPAR , offset);DM9000_iow (DM9000_EPCR ,0x4 );
@@ -551,8 +552,7 @@ static void read_srom_word(int offset, u8 *to) to[1 ] =DM9000_ior (DM9000_EPDRH ); } -void -write_srom_word (int offset,u16 val) +void dm9000_write_srom_word (int offset,u16 val) {DM9000_iow (DM9000_EPAR , offset);DM9000_iow (DM9000_EPDRH , ((val >>8 ) &0xff ));
@@ -561,7 +561,7 @@ write_srom_word(int offset, u16 val)udelay (8000 ); DM9000_iow(DM9000_EPCR, 0); } - +#endif /* Read a byte from I/O port
include/configs/at91sam9261ek.h +1 -0
@@ -137,6 +137,7 @@#define DM9000_IO CONFIG_DM9000_BASE#define DM9000_DATA (CONFIG_DM9000_BASE + 4)#define CONFIG_DM9000_USE_16BIT 1 +#define CONFIG_DM9000_NO_SROM_AVAIL 1#define CONFIG_NET_RETRY_COUNT 20#define CONFIG_RESET_PHY_R 1
include/dm9000.h new file +11 -0
@@ -0,0 +1,11 @@ + +#ifndef __DM9000_H__ +#define __DM9000_H__ + +/****************** function prototypes **********************/ +#if !defined(CONFIG_DM9000_NO_SROM_AVAIL ) +void dm9000_write_srom_word (int offset,u16 val); +void dm9000_read_srom_word (int offset,u8 *to); +#endif + +#endif /* __DM9000_H__ */
Signature · 1 line
1.6.0.4
PATCH 1/1 Add config option for disabling DM9000-SROM support.
Quoted 9 lines · Remy Bohmer
Some boards do not have SROM support for the DM9000 network adapter. Instead of listing these board names in the driver code, make this option configurable from the board config file.
It also removes a build warning for the at91sam9261ek board:
'dm9000x.c:545: warning: 'read_srom_word' defined but not used'And it repaires the trizepsiv board build which was broken around the same routines
please put Stelian in Cc
Quoted 22 lines
Signed-off-by Remy Bohmer <[email protected]>--- board/trizepsiv/eeprom.c | 14 +++++++------- drivers/net/dm9000x.c | 16 ++++++++-------- include/configs/at91sam9261ek.h | 1 + include/dm9000.h | 11 +++++++++++ 4 files changed, 27 insertions(+), 15 deletions(-) create mode 100644 include/dm9000.hboard/trizepsiv/eeprom.c +0
-1@@ -23,17 +23,17 @@#include <common.h> #include <command.h> -
board/trizepsiv/eeprom.c eth_init(bd_t * bd) · line 350
Quoted 5 lines
board/trizepsiv/eeprom.c +1
-1@@ -347,9 +347,9 @@ eth_init(bd_t * bd)/* Set Node address */ if (!eth_getenv_enetaddr ("ethaddr" , enetaddr)) { -#if !defined(CONFIG_AT91SAM9261EK ) +#if !defined(CONFIG_DM9000_NO_SROM_AVAIL )
CONFIG_DM9000_NO_SROM will be shorter and the same
include/dm9000.h
Quoted 13 lines
board/trizepsiv/eeprom.c +1
-1for (i =0 ; i <3 ; i++) -read_srom_word (i, enetaddr +2 * i); +dm9000_read_srom_word (i, enetaddr +2 * i);eth_setenv_enetaddr ("ethaddr" , enetaddr);#endif include/dm9000.h new file +0
-0
Ben what do you think to do as usb have a dir to store all net header include/net/
include/dm9000.h
Quoted 1 line
include/dm9000.h new file +0
-0@@ -0,0 +1,11 @@
Copyrigth?
include/dm9000.h line 3
Quoted 3 lines
include/dm9000.h new file +3
-0+ +#ifndef __DM9000_H__ +#define __DM9000_H__
Best Regards,
J.
PATCH 1/1 Add config option for disabling DM9000-SROM support.
Hello,
2009/5/3 Jean-Christophe PLAGNIOL-VILLARD <[email protected]>:
Quoted 11 lines · Remy Bohmer
Quoted 9 lines
Some boards do not have SROM support for the DM9000 network adapter. Instead of listing these board names in the driver code, make this option configurable from the board config file.
It also removes a build warning for the at91sam9261ek board:
'dm9000x.c:545: warning: 'read_srom_word' defined but not used'And it repaires the trizepsiv board build which was broken around the same routines
please put Stelian in Cc
Done!
Quoted 20 lines
Quoted 18 lines
Signed-off-by Remy Bohmer <[email protected]>---
?board/trizepsiv/eeprom.c ? ? ? ?| ? 14 +++++++------- ?drivers/net/dm9000x.c ? ? ? ? ? | ? 16 ++++++++-------- ?include/configs/at91sam9261ek.h | ? ?1 + ?include/dm9000.h ? ? ? ? ? ? ? ?| ? 11 +++++++++++?4 files changed, 27 insertions(+), 15 deletions(-) ?create mode 100644
include/dm9000.hboard/trizepsiv/eeprom.c +0
-0@@ -23,17 +23,17 @@?#include <
common.h>
?#include <command.h>
-
Quoted 7 lines
board/trizepsiv/eeprom.c
Quoted 6 lines
board/trizepsiv/eeprom.c +0
-0@@ -347,9 +347,9 @@ eth_init(bd_t * bd)? ? ? /* Set Node address */
? ? ? if (!eth_getenv_enetaddr("ethaddr", enetaddr)) {board/trizepsiv/eeprom.c +1
-1-#if !defined(CONFIG_AT91SAM9261EK ) +#if !defined(CONFIG_DM9000_NO_SROM_AVAIL )
CONFIG_DM9000_NO_SROMwill be shorter and the same
OK
Quoted 8 lines
Quoted 8 lines
? ? ? ? ? ? ? for (i = 0; i < 3; i++)
- ? ? ? ? ? ? ? ? ? ?read_srom_word(i, enetaddr + 2 * i);
+ ? ? ? ? ? ? ? ? ? ?dm9000_read_srom_word(i, enetaddr + 2 * i); ? ? ? ? ? ? ?eth_setenv_enetaddr("ethaddr", enetaddr); ?#endif
Quoted 7 lines
include/dm9000.h
Quoted 5 lines
include/dm9000.h new file +0
-0Ben what do you think to do as usb have a dir to store all net header
include/net/
I have chosen the same location as the dm9161.h, other similar headers are there as well.
If it has to be changed, I suggest making it a separate patch.
Quoted 2 lines
include/dm9000.h
Quoted 1 line
include/dm9000.h new file +0
-0@@ -0,0 +1,11 @@Copyrigth?
OK.
Quoted 7 lines
include/dm9000.h line 3
Quoted 3 lines
include/dm9000.h new file +3
-0+ +#ifndef __DM9000_H__ +#define __DM9000_H__Best Regards,
J.
PATCH 1/1 V2 Add config option for disabling DM9000-SROM support.
In reply to Jean-Christophe PLAGNIOL-VILLARDV2: reworked comments from Jean-Christophe PLAGNIOL-VILLARD
Some boards do not have SROM support for the DM9000 network adapter. Instead of listing these board names in the driver code, make this option configurable from the board config file.
It also removes a build warning for the at91sam9261ek board:
'dm9000x.c:545: warning: 'read_srom_word' defined but not used'
And it repaires the trizepsiv board build which was broken around the same routines
--- board/trizepsiv/eeprom.c | 14 +++++++------- drivers/net/dm9000x.c | 16 ++++++++-------- include/configs/at91sam9261ek.h | 1 + include/dm9000.h | 20 ++++++++++++++++++++ 4 files changed, 36 insertions(+), 15 deletions(-) create mode 100644 include/dm9000.h
board/trizepsiv/eeprom.c +7 -7
@@ -23,17 +23,17 @@#include <common.h> #include <command.h> - -extern u16 read_srom_word (int ); -extern void write_srom_word (int offset,u16 val); +#include <dm9000.h> static int do_read_dm9000_eeprom (cmd_tbl_t *cmdtp,int flag,int argc,char *argv[]) { -int i; +unsigned int i; +u8 data[2 ];for (i=0 ; i <0x40 ; i++) {if (!(i %0x10 )) -printf ("\n%08lx:" , i); -printf (" %04x" ,read_srom_word (i)); +printf ("\n%08x:" , i); +dm9000_read_srom_word (i, data); +printf (" %02x%02x" , data[1 ], data[0 ]); }printf ("\n" );return (0 );
@@ -54,7 +54,7 @@ static int do_write_dm9000_eeprom ( cmd_tbl_t *cmdtp, int flag, int argc, char *cmd_usage (cmdtp);return 1 ; } -write_srom_word (offset, value); +dm9000_write_srom_word (offset, value);return (0 ); }
drivers/net/dm9000x.c +8 -8
@@ -53,7 +53,7 @@ v1.2 03/18/2003 Weilun Huang <[email protected]>:notes (i.e. double reset) - some minor code cleanups These changes are tested with DM9000{A,EP,E} together -with a 200MHz Atmel AT91SAM92161 core +with a 200MHz Atmel AT91SAM9261 core TODO: external MII is not functional, only internal at the moment. */
@@ -62,6 +62,7 @@ TODO: external MII is not functional, only internal at the moment.#include <command.h> #include <net.h> #include <asm/io.h> +#include <dm9000.h> #include "dm9000x.h"
@@ -113,7 +114,6 @@ void eth_halt(void);static int dm9000_probe (void );static u16 phy_read (int );static void phy_write (int ,u16 ); -static void read_srom_word (int ,u8 *);static u8 DM9000_ior (int );static void DM9000_iow (int reg,u8 value);
@@ -347,9 +347,9 @@ eth_init(bd_t * bd)/* Set Node address */ if (!eth_getenv_enetaddr ("ethaddr" , enetaddr)) { -#if !defined(CONFIG_AT91SAM9261EK ) +#if !defined(CONFIG_DM9000_NO_SROM )for (i =0 ; i <3 ; i++) -read_srom_word (i, enetaddr +2 * i); +dm9000_read_srom_word (i, enetaddr +2 * i);eth_setenv_enetaddr ("ethaddr" , enetaddr);#endif }
@@ -541,7 +541,8 @@ eth_rx(void)/* Read a word data from SROM */ -static void read_srom_word (int offset,u8 *to) +#if !defined(CONFIG_DM9000_NO_SROM ) +void dm9000_read_srom_word (int offset,u8 *to) {DM9000_iow (DM9000_EPAR , offset);DM9000_iow (DM9000_EPCR ,0x4 );
@@ -551,8 +552,7 @@ static void read_srom_word(int offset, u8 *to) to[1 ] =DM9000_ior (DM9000_EPDRH ); } -void -write_srom_word (int offset,u16 val) +void dm9000_write_srom_word (int offset,u16 val) {DM9000_iow (DM9000_EPAR , offset);DM9000_iow (DM9000_EPDRH , ((val >>8 ) &0xff ));
@@ -561,7 +561,7 @@ write_srom_word(int offset, u16 val)udelay (8000 ); DM9000_iow(DM9000_EPCR, 0); } - +#endif /* Read a byte from I/O port
include/configs/at91sam9261ek.h +1 -0
@@ -137,6 +137,7 @@#define DM9000_IO CONFIG_DM9000_BASE#define DM9000_DATA (CONFIG_DM9000_BASE + 4)#define CONFIG_DM9000_USE_16BIT 1 +#define CONFIG_DM9000_NO_SROM 1#define CONFIG_NET_RETRY_COUNT 20#define CONFIG_RESET_PHY_R 1
include/dm9000.h new file +20 -0
@@ -0,0 +1,20 @@ +/* +* NOTE: DAVICOM DM9000 ethernet driver interface +* +* Authors: Remy Bohmer <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version +* 2 of the License, or (at your option) any later version. +*/ +#ifndef __DM9000_H__ +#define __DM9000_H__ + +/****************** function prototypes **********************/ +#if !defined(CONFIG_DM9000_NO_SROM ) +void dm9000_write_srom_word (int offset,u16 val); +void dm9000_read_srom_word (int offset,u8 *to); +#endif + +#endif /* __DM9000_H__ */
Signature · 1 line
1.6.0.4
PATCH 1/1 Add config option for disabling DM9000-SROM support.
In reply to Remy BohmerQuoted 8 lines
Quoted 4 lines
include/dm9000.h
Quoted 2 lines
include/dm9000.h new file +0
-0Ben what do you think to do as usb have a dir to store all net header
include/net/I have chosen the same location as the
dm9161.h, other similar headers are there as well.
If it has to be changed, I suggest making it a separate patch.
sure
I've in mind this
include/{ => net}/at91rm9200_net.hinclude/{ => net}/bcm5221.hinclude/{ => net}/dm9161.hinclude/{ => net}/dp83848.hinclude/{ => net}/lxt971a.hinclude/{ => net}/mii_phy.hinclude/{ => net}/miiphy.hinclude/{ => net}/ns7520_eth.hinclude/{ => net}/ns9750_eth.hinclude/{ => net}/ppc4xx_enet.hinclude/{ => net}/tsec.h
or
include/{ => net}/at91rm9200_net.hinclude/{ => net}/ns7520_eth.hinclude/{ => net}/ns9750_eth.hinclude/{ => net}/ppc4xx_enet.hinclude/{ => net}/tsec.hinclude/{ => net/phy}/bcm5221.hinclude/{ => net/phy}/dm9161.hinclude/{ => net/phy}/dp83848.hinclude/{ => net/phy}/lxt971a.hinclude/{ => net/phy}/mii_phy.hinclude/{ => net/phy}/miiphy.h
and maybeinclude/{ => net}/netdev.h
Best Regards,
J.
PATCH 1/1 V2 Add config option for disabling DM9000-SROM support.
In reply to Remy BohmerQuoted 11 lines · Remy Bohmer
Some boards do not have SROM support for the DM9000 network adapter. Instead of listing these board names in the driver code, make this option configurable from the board config file.
It also removes a build warning for the at91sam9261ek board:
'dm9000x.c:545: warning: 'read_srom_word' defined but not used'And it repaires the trizepsiv board build which was broken around the same routines
Signed-off-by Remy Bohmer <[email protected]>
FWIW:
Thanks,
Signature · 1 line
Stelian Pop <[email protected]>
PATCH 1/1 Add config option for disabling DM9000-SROM support.
In reply to Jean-Christophe PLAGNIOL-VILLARDHi J-C,
Quoted 38 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 8 lines
Quoted 4 lines
include/dm9000.h
Quoted 2 lines
include/dm9000.h new file +0
-0Ben what do you think to do as usb have a dir to store all net header
include/net/I have chosen the same location as the
dm9161.h, other similar headers are there as well.
If it has to be changed, I suggest making it a separate patch.sure
I've in mind this
include/{=>net}/at91rm9200_net.hinclude/{=>net}/bcm5221.hinclude/{=>net}/dm9161.hinclude/{=>net}/dp83848.hinclude/{=>net}/lxt971a.hinclude/{=>net}/mii_phy.hinclude/{=>net}/miiphy.hinclude/{=>net}/ns7520_eth.hinclude/{=>net}/ns9750_eth.hinclude/{=>net}/ppc4xx_enet.hinclude/{=>net}/tsec.hor
include/{=>net}/at91rm9200_net.hinclude/{=>net}/ns7520_eth.hinclude/{=>net}/ns9750_eth.hinclude/{=>net}/ppc4xx_enet.hinclude/{=>net}/tsec.hinclude/{=>net/phy}/bcm5221.hinclude/{=>net/phy}/dm9161.hinclude/{=>net/phy}/dp83848.hinclude/{=>net/phy}/lxt971a.hinclude/{=>net/phy}/mii_phy.hinclude/{=>net/phy}/miiphy.h
Quoted 6 lines
and maybe
include/{=>net}/netdev.hBest Regards,
J.
I'm not crazy about this idea - it seems like unnecessary hierarchy when efforts could be diverted elsewhere. There are very few net-related public header files (as you've shown) and browsing through them, there's a lot of duplication of 802.3-defined PHY stuff and register definitions that are really private to the drivers themselves. Ideally we would have very little in the way of device-specific public functions apart from xxx_initialize().
I'm OK with having device-specific prototypes and struct definitions innetdev.h - that's what it was created for in the first place. As long as there's no code there (including static inlines) it seems appropriate.
regards,
Ben
PATCH 1/1 V2 Add config option for disabling DM9000-SROM support.
In reply to Remy BohmerQuoted 1 line · On Sunday 03 May 2009 06:11:40 Remy Bohmer wrote:
V2: reworked comments from Jean-Christophe PLAGNIOL-VILLARD
this should be below the "---" marker so that it doesnt show up in the changelog
similar comment with subject summary: no need for "1/1", the "v2" should be more in the "[PATCH v2]", and summaries do not get periods ...
Quoted 1 line
And it repaires the trizepsiv board build which was broken around the
there is no "e" in "repairs" ...
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090504/d6db7f79/attachment.pgp