Re: [U-Boot] [PATCH 3/3][Net][ARM] Switched dm644x_emac Ethernet driver to use newer API

2009-04-29 Thread Jean-Christophe PLAGNIOL-VILLARD
On 10:12 Tue 28 Apr , Ben Warren wrote:
  Added CONFIG_NET_MULTI to all Davinci boards
  Removed all calls to Davinci network driver from board code
  Added cpu_eth_init() to cpu/arm926ejs/cpu.c
 
 Signed-off-by: Ben Warren biggerbadder...@gmail.com
 ---
  board/davinci/common/misc.h |1 -
  board/davinci/dvevm/dvevm.c |3 -
  board/davinci/schmoogie/schmoogie.c |3 -
  board/davinci/sffsdr/sffsdr.c   |3 -
  board/davinci/sonata/sonata.c   |3 -
  cpu/arm926ejs/cpu.c |   13 ++
  drivers/net/dm644x_emac.c   |   70 
 ---
  include/configs/davinci_dvevm.h |1 +
  include/configs/davinci_schmoogie.h |1 +
  include/configs/davinci_sffsdr.h|1 +
  include/configs/davinci_sonata.h|1 +
  include/netdev.h|1 +
  net/eth.c   |4 --
  13 files changed, 42 insertions(+), 63 deletions(-)
 
 diff --git a/board/davinci/common/misc.h b/board/davinci/common/misc.h
 index 4a57dbb..25b19b8 100644
 --- a/board/davinci/common/misc.h
 +++ b/board/davinci/common/misc.h
 @@ -23,7 +23,6 @@
  #define __MISC_H
  
  extern void timer_init(void);
 -extern int eth_hw_init(void);
  
  void dv_display_clk_infos(void);
  int dvevm_read_mac_address(uint8_t *buf);
 diff --git a/board/davinci/dvevm/dvevm.c b/board/davinci/dvevm/dvevm.c
 index 22308de..9fdfa58 100644
 --- a/board/davinci/dvevm/dvevm.c
 +++ b/board/davinci/dvevm/dvevm.c
 @@ -76,9 +76,6 @@ int misc_init_r(void)
   if (dvevm_read_mac_address(eeprom_enetaddr))
   dv_configure_mac_address(eeprom_enetaddr);
  
 - if (!eth_hw_init())
 - printf(ethernet init failed!\n);
 -
   i2c_read(0x39, 0x00, 1, video_mode, 1);
  
   setenv(videostd, ((video_mode  0x80) ? pal : ntsc));
 diff --git a/board/davinci/schmoogie/schmoogie.c 
 b/board/davinci/schmoogie/schmoogie.c
 index 433769a..738e9dd 100644
 --- a/board/davinci/schmoogie/schmoogie.c
 +++ b/board/davinci/schmoogie/schmoogie.c
 @@ -133,8 +133,5 @@ int misc_init_r(void)
   forceenv(serial#, (char *)tmp[0]);
   }
  
 - if (!eth_hw_init())
 - printf(ethernet init failed!\n);
 -
   return(0);
  }
 diff --git a/board/davinci/sffsdr/sffsdr.c b/board/davinci/sffsdr/sffsdr.c
 index e76f86d..45d0456 100644
 --- a/board/davinci/sffsdr/sffsdr.c
 +++ b/board/davinci/sffsdr/sffsdr.c
 @@ -146,8 +146,5 @@ int misc_init_r(void)
   if (sffsdr_read_mac_address(eeprom_enetaddr))
   dv_configure_mac_address(eeprom_enetaddr);
  
 - if (!eth_hw_init())
 - printf(Ethernet init failed\n);
 -
   return(0);
  }
 diff --git a/board/davinci/sonata/sonata.c b/board/davinci/sonata/sonata.c
 index d56b443..73bd25f 100644
 --- a/board/davinci/sonata/sonata.c
 +++ b/board/davinci/sonata/sonata.c
 @@ -73,8 +73,5 @@ int misc_init_r(void)
   if (dvevm_read_mac_address(eeprom_enetaddr))
   dv_configure_mac_address(eeprom_enetaddr);
  
 - if (!eth_hw_init())
 - printf(ethernet init failed!\n);
 -
   return(0);
  }
 diff --git a/cpu/arm926ejs/cpu.c b/cpu/arm926ejs/cpu.c
 index 6307e33..d711b24 100644
 --- a/cpu/arm926ejs/cpu.c
 +++ b/cpu/arm926ejs/cpu.c
 @@ -31,6 +31,7 @@
  
  #include common.h
  #include command.h
 +#include netdev.h
  #include arm926ejs.h
  #include asm/system.h
  
 @@ -80,3 +81,15 @@ static void cache_flush (void)
  
   asm (mcr p15, 0, %0, c7, c7, 0: :r (i));
  }
 +
 +/*
 + *  * Initializes on-chip ethernet controllers.
 + *   * to override, implement board_eth_init()
 + **/
 +int cpu_eth_init(bd_t *bis)
 +{
 +#if defined(CONFIG_DRIVER_TI_EMAC)
 + dm644x_emac_initialize();
 +#endif
 + return 0;
 +}
please move this to the soc
arm926ejs/davinci/cpu.c

the cpu.c is destinated to be removed in most of the case
or at least all the soc specific code

Best Regards,
J.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 3/3][Net][ARM] Switched dm644x_emac Ethernet driver to use newer API

2009-04-29 Thread Ben Warren
Hi J-C,

Jean-Christophe PLAGNIOL-VILLARD wrote:
snip
 +/*
 + *  * Initializes on-chip ethernet controllers.
 + *   * to override, implement board_eth_init()
 + **/
 +int cpu_eth_init(bd_t *bis)
 +{
 +#if defined(CONFIG_DRIVER_TI_EMAC)
 +dm644x_emac_initialize();
 +#endif
 +return 0;
 +}
 
 please move this to the soc
 arm926ejs/davinci/cpu.c

 the cpu.c is destinated to be removed in most of the case
 or at least all the soc specific code

 Best Regards,
 J.
   
There is currently no such file (not even in arm/next), or that's where 
this would have gone.  This function needs to be in a source file that 
already has strongly-linked symbols or it won't override the weak 
version in net/eth.c.  I'm certainly open to suggestions.

regards,
Ben
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 3/3][Net][ARM] Switched dm644x_emac Ethernet driver to use newer API

2009-04-29 Thread Jean-Christophe PLAGNIOL-VILLARD
On 13:29 Wed 29 Apr , Ben Warren wrote:
 Hi J-C,

 Jean-Christophe PLAGNIOL-VILLARD wrote:
 snip
 +/*
 + *  * Initializes on-chip ethernet controllers.
 + *   * to override, implement board_eth_init()
 + **/
 +int cpu_eth_init(bd_t *bis)
 +{
 +#if defined(CONFIG_DRIVER_TI_EMAC)
 +   dm644x_emac_initialize();
 +#endif
 +   return 0;
 +}
 
 please move this to the soc
 arm926ejs/davinci/cpu.c

 the cpu.c is destinated to be removed in most of the case
 or at least all the soc specific code

 Best Regards,
 J.
   
 There is currently no such file (not even in arm/next), or that's where  
 this would have gone.  This function needs to be in a source file that  
 already has strongly-linked symbols or it won't override the weak  
 version in net/eth.c.  I'm certainly open to suggestions.
or simply add an entry in the lds this will force the file to be evaluated
first

Best Regards,
J.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 3/3][Net][ARM] Switched dm644x_emac Ethernet driver to use newer API

2009-04-29 Thread Ben Warren
Jean-Christophe PLAGNIOL-VILLARD wrote:
 On 13:29 Wed 29 Apr , Ben Warren wrote:
   
 Hi J-C,

 Jean-Christophe PLAGNIOL-VILLARD wrote:
 snip
 
 +/*
 + *  * Initializes on-chip ethernet controllers.
 + *   * to override, implement board_eth_init()
 + **/
 +int cpu_eth_init(bd_t *bis)
 +{
 +#if defined(CONFIG_DRIVER_TI_EMAC)
 +  dm644x_emac_initialize();
 +#endif
 +  return 0;
 +}
 
 
 please move this to the soc
 arm926ejs/davinci/cpu.c

 the cpu.c is destinated to be removed in most of the case
 or at least all the soc specific code

 Best Regards,
 J.
   
   
 There is currently no such file (not even in arm/next), or that's where  
 this would have gone.  This function needs to be in a source file that  
 already has strongly-linked symbols or it won't override the weak  
 version in net/eth.c.  I'm certainly open to suggestions.
 
 or simply add an entry in the lds this will force the file to be evaluated
 first

   
That's not a scalable solution and isn't how we did it with other 
controllers.  If there's no file that's guaranteed to be included in all 
Davinci boards that will have this MAC, an alternative is to implement 
board_eth_init() on each board, but IMHO that's worse architecturally.
 Best Regards,
 J.
   
regards,
Ben
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 3/3][Net][ARM] Switched dm644x_emac Ethernet driver to use newer API

2009-04-29 Thread Jean-Christophe PLAGNIOL-VILLARD
On 15:11 Wed 29 Apr , Ben Warren wrote:
 Jean-Christophe PLAGNIOL-VILLARD wrote:
 On 13:29 Wed 29 Apr , Ben Warren wrote:
   
 Hi J-C,

 Jean-Christophe PLAGNIOL-VILLARD wrote:
 snip
 
 +/*
 + *  * Initializes on-chip ethernet controllers.
 + *   * to override, implement board_eth_init()
 + **/
 +int cpu_eth_init(bd_t *bis)
 +{
 +#if defined(CONFIG_DRIVER_TI_EMAC)
 + dm644x_emac_initialize();
 +#endif
 + return 0;
 +}
 
 please move this to the soc
 arm926ejs/davinci/cpu.c

 the cpu.c is destinated to be removed in most of the case
 or at least all the soc specific code

 Best Regards,
 J.
 
 There is currently no such file (not even in arm/next), or that's 
 where  this would have gone.  This function needs to be in a source 
 file that  already has strongly-linked symbols or it won't override 
 the weak  version in net/eth.c.  I'm certainly open to suggestions.
 
 or simply add an entry in the lds this will force the file to be evaluated
 first

   
 That's not a scalable solution and isn't how we did it with other  
 controllers.  If there's no file that's guaranteed to be included in all  
 Davinci boards that will have this MAC, an alternative is to implement  
 board_eth_init() on each board, but IMHO that's worse architecturally.
maybe sync with David

as the clock function could be move to cpu.c it will have the stringly-link
function

Best Regards,
J.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 3/3][Net][ARM] Switched dm644x_emac Ethernet driver to use newer API

2009-04-29 Thread David Brownell
On Wednesday 29 April 2009, Jean-Christophe PLAGNIOL-VILLARD wrote:
 as the clock function could be move to cpu.c it will have the stringly-link
 function

I'll stuff that in a new cpu.c file, but those
clock status display routines aren't mandatory.


___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 3/3][Net][ARM] Switched dm644x_emac Ethernet driver to use newer API

2009-04-28 Thread Ben Warren
 Added CONFIG_NET_MULTI to all Davinci boards
 Removed all calls to Davinci network driver from board code
 Added cpu_eth_init() to cpu/arm926ejs/cpu.c

Signed-off-by: Ben Warren biggerbadder...@gmail.com
---
 board/davinci/common/misc.h |1 -
 board/davinci/dvevm/dvevm.c |3 -
 board/davinci/schmoogie/schmoogie.c |3 -
 board/davinci/sffsdr/sffsdr.c   |3 -
 board/davinci/sonata/sonata.c   |3 -
 cpu/arm926ejs/cpu.c |   13 ++
 drivers/net/dm644x_emac.c   |   70 ---
 include/configs/davinci_dvevm.h |1 +
 include/configs/davinci_schmoogie.h |1 +
 include/configs/davinci_sffsdr.h|1 +
 include/configs/davinci_sonata.h|1 +
 include/netdev.h|1 +
 net/eth.c   |4 --
 13 files changed, 42 insertions(+), 63 deletions(-)

diff --git a/board/davinci/common/misc.h b/board/davinci/common/misc.h
index 4a57dbb..25b19b8 100644
--- a/board/davinci/common/misc.h
+++ b/board/davinci/common/misc.h
@@ -23,7 +23,6 @@
 #define __MISC_H
 
 extern void timer_init(void);
-extern int eth_hw_init(void);
 
 void dv_display_clk_infos(void);
 int dvevm_read_mac_address(uint8_t *buf);
diff --git a/board/davinci/dvevm/dvevm.c b/board/davinci/dvevm/dvevm.c
index 22308de..9fdfa58 100644
--- a/board/davinci/dvevm/dvevm.c
+++ b/board/davinci/dvevm/dvevm.c
@@ -76,9 +76,6 @@ int misc_init_r(void)
if (dvevm_read_mac_address(eeprom_enetaddr))
dv_configure_mac_address(eeprom_enetaddr);
 
-   if (!eth_hw_init())
-   printf(ethernet init failed!\n);
-
i2c_read(0x39, 0x00, 1, video_mode, 1);
 
setenv(videostd, ((video_mode  0x80) ? pal : ntsc));
diff --git a/board/davinci/schmoogie/schmoogie.c 
b/board/davinci/schmoogie/schmoogie.c
index 433769a..738e9dd 100644
--- a/board/davinci/schmoogie/schmoogie.c
+++ b/board/davinci/schmoogie/schmoogie.c
@@ -133,8 +133,5 @@ int misc_init_r(void)
forceenv(serial#, (char *)tmp[0]);
}
 
-   if (!eth_hw_init())
-   printf(ethernet init failed!\n);
-
return(0);
 }
diff --git a/board/davinci/sffsdr/sffsdr.c b/board/davinci/sffsdr/sffsdr.c
index e76f86d..45d0456 100644
--- a/board/davinci/sffsdr/sffsdr.c
+++ b/board/davinci/sffsdr/sffsdr.c
@@ -146,8 +146,5 @@ int misc_init_r(void)
if (sffsdr_read_mac_address(eeprom_enetaddr))
dv_configure_mac_address(eeprom_enetaddr);
 
-   if (!eth_hw_init())
-   printf(Ethernet init failed\n);
-
return(0);
 }
diff --git a/board/davinci/sonata/sonata.c b/board/davinci/sonata/sonata.c
index d56b443..73bd25f 100644
--- a/board/davinci/sonata/sonata.c
+++ b/board/davinci/sonata/sonata.c
@@ -73,8 +73,5 @@ int misc_init_r(void)
if (dvevm_read_mac_address(eeprom_enetaddr))
dv_configure_mac_address(eeprom_enetaddr);
 
-   if (!eth_hw_init())
-   printf(ethernet init failed!\n);
-
return(0);
 }
diff --git a/cpu/arm926ejs/cpu.c b/cpu/arm926ejs/cpu.c
index 6307e33..d711b24 100644
--- a/cpu/arm926ejs/cpu.c
+++ b/cpu/arm926ejs/cpu.c
@@ -31,6 +31,7 @@
 
 #include common.h
 #include command.h
+#include netdev.h
 #include arm926ejs.h
 #include asm/system.h
 
@@ -80,3 +81,15 @@ static void cache_flush (void)
 
asm (mcr p15, 0, %0, c7, c7, 0: :r (i));
 }
+
+/*
+ *  * Initializes on-chip ethernet controllers.
+ *   * to override, implement board_eth_init()
+ **/
+int cpu_eth_init(bd_t *bis)
+{
+#if defined(CONFIG_DRIVER_TI_EMAC)
+   dm644x_emac_initialize();
+#endif
+   return 0;
+}
diff --git a/drivers/net/dm644x_emac.c b/drivers/net/dm644x_emac.c
index f5cec05..7c5dace 100644
--- a/drivers/net/dm644x_emac.c
+++ b/drivers/net/dm644x_emac.c
@@ -40,17 +40,12 @@
 #include command.h
 #include net.h
 #include miiphy.h
+#include malloc.h
 #include asm/arch/emac_defs.h
 
 unsigned int   emac_dbg = 0;
 #define debug_emac(fmt,args...)if (emac_dbg) printf(fmt,##args)
 
-/* Internal static functions */
-static int davinci_eth_hw_init (void);
-static int davinci_eth_open (void);
-static int davinci_eth_close (void);
-static int davinci_eth_send_packet (volatile void *packet, int length);
-static int davinci_eth_rcv_packet (void);
 static void davinci_eth_mdio_enable(void);
 
 static int gen_init_phy(int phy_addr);
@@ -58,38 +53,10 @@ static int gen_is_phy_connected(int phy_addr);
 static int gen_get_link_speed(int phy_addr);
 static int gen_auto_negotiate(int phy_addr);
 
-/* Wrappers exported to the U-Boot proper */
-int eth_hw_init(void)
-{
-   return(davinci_eth_hw_init());
-}
-
-int eth_init(bd_t * bd)
-{
-   return(davinci_eth_open());
-}
-
-void eth_halt(void)
-{
-   davinci_eth_close();
-}
-
-int eth_send(volatile void *packet, int length)
-{
-   return(davinci_eth_send_packet(packet, length));
-}
-
-int eth_rx(void)
-{
-   return(davinci_eth_rcv_packet());
-}
-
 void