Re: [U-Boot] [PATCH v2] net: davinci_emac: convert to using the driver model

2019-07-24 Thread Bartosz Golaszewski
śr., 24 lip 2019 o 01:22 Joe Hershberger  napisał(a):
>
> On Mon, Jun 24, 2019 at 9:22 AM Bartosz Golaszewski  wrote:
> >
> > From: Bartosz Golaszewski 
> >
> > Now that we removed all legacy boards selecting TI_EMAC we can
> > completely convert the driver code to using the driver model.
> > This patch also updates all remaining users of davinci_emac.
> >
> > Signed-off-by: Bartosz Golaszewski 
> > ---
> > v1 -> v2:
> > - moved the packetp assignment to the top of the recv() callback which fixes
> >   a crash on am3517_evm
> > - dropped a redundant call to net_process_received_packet(): this is already
> >   called from eth core
> >
> > Thanks goes to Adam Ford for much appreciated testing and help.
> >
> > Tested on da850-lcdk and da850-evm.
>
> Looks like a build failure on this patch...
>
> https://travis-ci.org/jhershbe/u-boot/jobs/562799958
>
> Can you have a look?
>
> Thanks,
> -Joe

This board was missing CONFIG_DM_ETH=y in my patch. I fixed it and v2
of the integration series is on the way.

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


Re: [U-Boot] [PATCH v2] net: davinci_emac: convert to using the driver model

2019-07-23 Thread Joe Hershberger
On Mon, Jun 24, 2019 at 9:22 AM Bartosz Golaszewski  wrote:
>
> From: Bartosz Golaszewski 
>
> Now that we removed all legacy boards selecting TI_EMAC we can
> completely convert the driver code to using the driver model.
> This patch also updates all remaining users of davinci_emac.
>
> Signed-off-by: Bartosz Golaszewski 
> ---
> v1 -> v2:
> - moved the packetp assignment to the top of the recv() callback which fixes
>   a crash on am3517_evm
> - dropped a redundant call to net_process_received_packet(): this is already
>   called from eth core
>
> Thanks goes to Adam Ford for much appreciated testing and help.
>
> Tested on da850-lcdk and da850-evm.

Looks like a build failure on this patch...

https://travis-ci.org/jhershbe/u-boot/jobs/562799958

Can you have a look?

Thanks,
-Joe
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2] net: davinci_emac: convert to using the driver model

2019-07-22 Thread Joe Hershberger
On Mon, Jun 24, 2019 at 9:22 AM Bartosz Golaszewski  wrote:
>
> From: Bartosz Golaszewski 
>
> Now that we removed all legacy boards selecting TI_EMAC we can
> completely convert the driver code to using the driver model.
> This patch also updates all remaining users of davinci_emac.
>
> Signed-off-by: Bartosz Golaszewski 

Acked-by: Joe Hershberger 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2] net: davinci_emac: convert to using the driver model

2019-06-24 Thread Ramon Fried

On 6/24/19 5:21 PM, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski 
>
> Now that we removed all legacy boards selecting TI_EMAC we can
> completely convert the driver code to using the driver model.
> This patch also updates all remaining users of davinci_emac.
>
> Signed-off-by: Bartosz Golaszewski 
> ---
> v1 -> v2:
> - moved the packetp assignment to the top of the recv() callback which fixes
>   a crash on am3517_evm
> - dropped a redundant call to net_process_received_packet(): this is already
>   called from eth core
>
> Thanks goes to Adam Ford for much appreciated testing and help.
>
> Tested on da850-lcdk and da850-evm.
>
>  arch/arm/mach-davinci/cpu.c| 13 -
>  arch/arm/mach-omap2/omap3/emac.c   |  3 +-
>  board/davinci/da8xxevm/da850evm.c  |  6 --
>  board/davinci/da8xxevm/omapl138_lcdk.c | 14 -
>  board/logicpd/am3517evm/am3517evm.c|  1 -
>  board/ti/ti816x/evm.c  |  3 +-
>  configs/am3517_evm_defconfig   |  1 +
>  configs/da850evm_defconfig |  1 +
>  configs/da850evm_direct_nor_defconfig  |  1 +
>  configs/da850evm_nand_defconfig|  1 +
>  configs/omapl138_lcdk_defconfig|  1 +
>  configs/ti816x_evm_defconfig   |  1 +
>  drivers/net/ti/davinci_emac.c  | 77 ++
>  include/netdev.h   |  1 -
>  14 files changed, 50 insertions(+), 74 deletions(-)
>
> diff --git a/arch/arm/mach-davinci/cpu.c b/arch/arm/mach-davinci/cpu.c
> index f97ad3fc74..9fd6564d04 100644
> --- a/arch/arm/mach-davinci/cpu.c
> +++ b/arch/arm/mach-davinci/cpu.c
> @@ -5,7 +5,6 @@
>   */
>  
>  #include 
> -#include 
>  #include 
>  #include 
>  
> @@ -90,15 +89,3 @@ int set_cpu_clk_info(void)
>   gd->bd->bi_dsp_freq = 0;
>   return 0;
>  }
> -
> -/*
> - * Initializes on-chip ethernet controllers.
> - * to override, implement board_eth_init()
> - */
> -int cpu_eth_init(bd_t *bis)
> -{
> -#if defined(CONFIG_DRIVER_TI_EMAC)
> - davinci_emac_initialize();
> -#endif
> - return 0;
> -}
> diff --git a/arch/arm/mach-omap2/omap3/emac.c 
> b/arch/arm/mach-omap2/omap3/emac.c
> index c79e870183..fb0c9188f5 100644
> --- a/arch/arm/mach-omap2/omap3/emac.c
> +++ b/arch/arm/mach-omap2/omap3/emac.c
> @@ -7,7 +7,6 @@
>   */
>  
>  #include 
> -#include 
>  #include 
>  #include 
>  
> @@ -24,5 +23,5 @@ int cpu_eth_init(bd_t *bis)
>   reset &= ~CPGMACSS_SW_RST;
>   writel(reset, _scm_general_regs->ip_sw_reset);
>  
> - return davinci_emac_initialize();
> + return 0;
>  }
> diff --git a/board/davinci/da8xxevm/da850evm.c 
> b/board/davinci/da8xxevm/da850evm.c
> index a90b7a3538..a5c583444d 100644
> --- a/board/davinci/da8xxevm/da850evm.c
> +++ b/board/davinci/da8xxevm/da850evm.c
> @@ -13,7 +13,6 @@
>  #include 
>  #include 
>  #include 
> -#include 
>  #include 
>  #include 
>  #include 
> @@ -472,11 +471,6 @@ int board_eth_init(bd_t *bis)
>   if (rmii_hw_init())
>   printf("RMII hardware init failed!!!\n");
>  #endif
> - if (!davinci_emac_initialize()) {
> - printf("Error: Ethernet init failed!\n");
> - return -1;
> - }
> -
>   return 0;
>  }
>  #endif /* CONFIG_DRIVER_TI_EMAC */
> diff --git a/board/davinci/da8xxevm/omapl138_lcdk.c 
> b/board/davinci/da8xxevm/omapl138_lcdk.c
> index fe1bf44101..dd11551428 100644
> --- a/board/davinci/da8xxevm/omapl138_lcdk.c
> +++ b/board/davinci/da8xxevm/omapl138_lcdk.c
> @@ -11,7 +11,6 @@
>  #include 
>  #include 
>  #include 
> -#include 
>  #include 
>  #include 
>  #include 
> @@ -229,19 +228,6 @@ int board_init(void)
>  
>  #ifdef CONFIG_DRIVER_TI_EMAC
>  
> -/*
> - * Initializes on-board ethernet controllers.
> - */
> -int board_eth_init(bd_t *bis)
> -{
> - if (!davinci_emac_initialize()) {
> - printf("Error: Ethernet init failed!\n");
> - return -1;
> - }
> -
> - return 0;
> -}
> -
>  #endif /* CONFIG_DRIVER_TI_EMAC */
>  
>  #define CFG_MAC_ADDR_SPI_BUS 0
> diff --git a/board/logicpd/am3517evm/am3517evm.c 
> b/board/logicpd/am3517evm/am3517evm.c
> index 10031a4801..bfd4e78274 100644
> --- a/board/logicpd/am3517evm/am3517evm.c
> +++ b/board/logicpd/am3517evm/am3517evm.c
> @@ -28,7 +28,6 @@
>  #include 
>  #include 
>  #include 
> -#include 
>  #include "am3517evm.h"
>  
>  DECLARE_GLOBAL_DATA_PTR;
> diff --git a/board/ti/ti816x/evm.c b/board/ti/ti816x/evm.c
> index 07a084bab8..240df8cbe1 100644
> --- a/board/ti/ti816x/evm.c
> +++ b/board/ti/ti816x/evm.c
> @@ -9,7 +9,6 @@
>  #include 
>  #include 
>  #include 
> -#include 
>  #include 
>  #include 
>  #include 
> @@ -56,7 +55,7 @@ int board_eth_init(bd_t *bis)
>   printf("Unable to read MAC address. Set \n");
>   }
>  
> - return davinci_emac_initialize();
> + return 0;
>  }
>  
>  #ifdef CONFIG_SPL_BUILD
> diff --git a/configs/am3517_evm_defconfig b/configs/am3517_evm_defconfig
> index b9f59f3291..5cb76322df 100644
> --- a/configs/am3517_evm_defconfig
> +++ 

Re: [U-Boot] [PATCH v2] net: davinci_emac: convert to using the driver model

2019-06-24 Thread Adam Ford
On Mon, Jun 24, 2019 at 9:21 AM Bartosz Golaszewski  wrote:
>
> From: Bartosz Golaszewski 
>
> Now that we removed all legacy boards selecting TI_EMAC we can
> completely convert the driver code to using the driver model.
> This patch also updates all remaining users of davinci_emac.
>
> Signed-off-by: Bartosz Golaszewski 

Tested-by: Adam Ford  #am3517-evm & da850-evm
> ---
> v1 -> v2:
> - moved the packetp assignment to the top of the recv() callback which fixes
>   a crash on am3517_evm
> - dropped a redundant call to net_process_received_packet(): this is already
>   called from eth core
>
> Thanks goes to Adam Ford for much appreciated testing and help.
>
> Tested on da850-lcdk and da850-evm.
>
>  arch/arm/mach-davinci/cpu.c| 13 -
>  arch/arm/mach-omap2/omap3/emac.c   |  3 +-
>  board/davinci/da8xxevm/da850evm.c  |  6 --
>  board/davinci/da8xxevm/omapl138_lcdk.c | 14 -
>  board/logicpd/am3517evm/am3517evm.c|  1 -
>  board/ti/ti816x/evm.c  |  3 +-
>  configs/am3517_evm_defconfig   |  1 +
>  configs/da850evm_defconfig |  1 +
>  configs/da850evm_direct_nor_defconfig  |  1 +
>  configs/da850evm_nand_defconfig|  1 +
>  configs/omapl138_lcdk_defconfig|  1 +
>  configs/ti816x_evm_defconfig   |  1 +
>  drivers/net/ti/davinci_emac.c  | 77 ++
>  include/netdev.h   |  1 -
>  14 files changed, 50 insertions(+), 74 deletions(-)
>
> diff --git a/arch/arm/mach-davinci/cpu.c b/arch/arm/mach-davinci/cpu.c
> index f97ad3fc74..9fd6564d04 100644
> --- a/arch/arm/mach-davinci/cpu.c
> +++ b/arch/arm/mach-davinci/cpu.c
> @@ -5,7 +5,6 @@
>   */
>
>  #include 
> -#include 
>  #include 
>  #include 
>
> @@ -90,15 +89,3 @@ int set_cpu_clk_info(void)
> gd->bd->bi_dsp_freq = 0;
> return 0;
>  }
> -
> -/*
> - * Initializes on-chip ethernet controllers.
> - * to override, implement board_eth_init()
> - */
> -int cpu_eth_init(bd_t *bis)
> -{
> -#if defined(CONFIG_DRIVER_TI_EMAC)
> -   davinci_emac_initialize();
> -#endif
> -   return 0;
> -}
> diff --git a/arch/arm/mach-omap2/omap3/emac.c 
> b/arch/arm/mach-omap2/omap3/emac.c
> index c79e870183..fb0c9188f5 100644
> --- a/arch/arm/mach-omap2/omap3/emac.c
> +++ b/arch/arm/mach-omap2/omap3/emac.c
> @@ -7,7 +7,6 @@
>   */
>
>  #include 
> -#include 
>  #include 
>  #include 
>
> @@ -24,5 +23,5 @@ int cpu_eth_init(bd_t *bis)
> reset &= ~CPGMACSS_SW_RST;
> writel(reset, _scm_general_regs->ip_sw_reset);
>
> -   return davinci_emac_initialize();
> +   return 0;
>  }
> diff --git a/board/davinci/da8xxevm/da850evm.c 
> b/board/davinci/da8xxevm/da850evm.c
> index a90b7a3538..a5c583444d 100644
> --- a/board/davinci/da8xxevm/da850evm.c
> +++ b/board/davinci/da8xxevm/da850evm.c
> @@ -13,7 +13,6 @@
>  #include 
>  #include 
>  #include 
> -#include 
>  #include 
>  #include 
>  #include 
> @@ -472,11 +471,6 @@ int board_eth_init(bd_t *bis)
> if (rmii_hw_init())
> printf("RMII hardware init failed!!!\n");
>  #endif
> -   if (!davinci_emac_initialize()) {
> -   printf("Error: Ethernet init failed!\n");
> -   return -1;
> -   }
> -
> return 0;
>  }
>  #endif /* CONFIG_DRIVER_TI_EMAC */
> diff --git a/board/davinci/da8xxevm/omapl138_lcdk.c 
> b/board/davinci/da8xxevm/omapl138_lcdk.c
> index fe1bf44101..dd11551428 100644
> --- a/board/davinci/da8xxevm/omapl138_lcdk.c
> +++ b/board/davinci/da8xxevm/omapl138_lcdk.c
> @@ -11,7 +11,6 @@
>  #include 
>  #include 
>  #include 
> -#include 
>  #include 
>  #include 
>  #include 
> @@ -229,19 +228,6 @@ int board_init(void)
>
>  #ifdef CONFIG_DRIVER_TI_EMAC
>
> -/*
> - * Initializes on-board ethernet controllers.
> - */
> -int board_eth_init(bd_t *bis)
> -{
> -   if (!davinci_emac_initialize()) {
> -   printf("Error: Ethernet init failed!\n");
> -   return -1;
> -   }
> -
> -   return 0;
> -}
> -
>  #endif /* CONFIG_DRIVER_TI_EMAC */
>
>  #define CFG_MAC_ADDR_SPI_BUS   0
> diff --git a/board/logicpd/am3517evm/am3517evm.c 
> b/board/logicpd/am3517evm/am3517evm.c
> index 10031a4801..bfd4e78274 100644
> --- a/board/logicpd/am3517evm/am3517evm.c
> +++ b/board/logicpd/am3517evm/am3517evm.c
> @@ -28,7 +28,6 @@
>  #include 
>  #include 
>  #include 
> -#include 
>  #include "am3517evm.h"
>
>  DECLARE_GLOBAL_DATA_PTR;
> diff --git a/board/ti/ti816x/evm.c b/board/ti/ti816x/evm.c
> index 07a084bab8..240df8cbe1 100644
> --- a/board/ti/ti816x/evm.c
> +++ b/board/ti/ti816x/evm.c
> @@ -9,7 +9,6 @@
>  #include 
>  #include 
>  #include 
> -#include 
>  #include 
>  #include 
>  #include 
> @@ -56,7 +55,7 @@ int board_eth_init(bd_t *bis)
> printf("Unable to read MAC address. Set \n");
> }
>
> -   return davinci_emac_initialize();
> +   return 0;
>  }
>
>  #ifdef CONFIG_SPL_BUILD
> diff --git a/configs/am3517_evm_defconfig 

[U-Boot] [PATCH v2] net: davinci_emac: convert to using the driver model

2019-06-24 Thread Bartosz Golaszewski
From: Bartosz Golaszewski 

Now that we removed all legacy boards selecting TI_EMAC we can
completely convert the driver code to using the driver model.
This patch also updates all remaining users of davinci_emac.

Signed-off-by: Bartosz Golaszewski 
---
v1 -> v2:
- moved the packetp assignment to the top of the recv() callback which fixes
  a crash on am3517_evm
- dropped a redundant call to net_process_received_packet(): this is already
  called from eth core

Thanks goes to Adam Ford for much appreciated testing and help.

Tested on da850-lcdk and da850-evm.

 arch/arm/mach-davinci/cpu.c| 13 -
 arch/arm/mach-omap2/omap3/emac.c   |  3 +-
 board/davinci/da8xxevm/da850evm.c  |  6 --
 board/davinci/da8xxevm/omapl138_lcdk.c | 14 -
 board/logicpd/am3517evm/am3517evm.c|  1 -
 board/ti/ti816x/evm.c  |  3 +-
 configs/am3517_evm_defconfig   |  1 +
 configs/da850evm_defconfig |  1 +
 configs/da850evm_direct_nor_defconfig  |  1 +
 configs/da850evm_nand_defconfig|  1 +
 configs/omapl138_lcdk_defconfig|  1 +
 configs/ti816x_evm_defconfig   |  1 +
 drivers/net/ti/davinci_emac.c  | 77 ++
 include/netdev.h   |  1 -
 14 files changed, 50 insertions(+), 74 deletions(-)

diff --git a/arch/arm/mach-davinci/cpu.c b/arch/arm/mach-davinci/cpu.c
index f97ad3fc74..9fd6564d04 100644
--- a/arch/arm/mach-davinci/cpu.c
+++ b/arch/arm/mach-davinci/cpu.c
@@ -5,7 +5,6 @@
  */
 
 #include 
-#include 
 #include 
 #include 
 
@@ -90,15 +89,3 @@ int set_cpu_clk_info(void)
gd->bd->bi_dsp_freq = 0;
return 0;
 }
-
-/*
- * Initializes on-chip ethernet controllers.
- * to override, implement board_eth_init()
- */
-int cpu_eth_init(bd_t *bis)
-{
-#if defined(CONFIG_DRIVER_TI_EMAC)
-   davinci_emac_initialize();
-#endif
-   return 0;
-}
diff --git a/arch/arm/mach-omap2/omap3/emac.c b/arch/arm/mach-omap2/omap3/emac.c
index c79e870183..fb0c9188f5 100644
--- a/arch/arm/mach-omap2/omap3/emac.c
+++ b/arch/arm/mach-omap2/omap3/emac.c
@@ -7,7 +7,6 @@
  */
 
 #include 
-#include 
 #include 
 #include 
 
@@ -24,5 +23,5 @@ int cpu_eth_init(bd_t *bis)
reset &= ~CPGMACSS_SW_RST;
writel(reset, _scm_general_regs->ip_sw_reset);
 
-   return davinci_emac_initialize();
+   return 0;
 }
diff --git a/board/davinci/da8xxevm/da850evm.c 
b/board/davinci/da8xxevm/da850evm.c
index a90b7a3538..a5c583444d 100644
--- a/board/davinci/da8xxevm/da850evm.c
+++ b/board/davinci/da8xxevm/da850evm.c
@@ -13,7 +13,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -472,11 +471,6 @@ int board_eth_init(bd_t *bis)
if (rmii_hw_init())
printf("RMII hardware init failed!!!\n");
 #endif
-   if (!davinci_emac_initialize()) {
-   printf("Error: Ethernet init failed!\n");
-   return -1;
-   }
-
return 0;
 }
 #endif /* CONFIG_DRIVER_TI_EMAC */
diff --git a/board/davinci/da8xxevm/omapl138_lcdk.c 
b/board/davinci/da8xxevm/omapl138_lcdk.c
index fe1bf44101..dd11551428 100644
--- a/board/davinci/da8xxevm/omapl138_lcdk.c
+++ b/board/davinci/da8xxevm/omapl138_lcdk.c
@@ -11,7 +11,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -229,19 +228,6 @@ int board_init(void)
 
 #ifdef CONFIG_DRIVER_TI_EMAC
 
-/*
- * Initializes on-board ethernet controllers.
- */
-int board_eth_init(bd_t *bis)
-{
-   if (!davinci_emac_initialize()) {
-   printf("Error: Ethernet init failed!\n");
-   return -1;
-   }
-
-   return 0;
-}
-
 #endif /* CONFIG_DRIVER_TI_EMAC */
 
 #define CFG_MAC_ADDR_SPI_BUS   0
diff --git a/board/logicpd/am3517evm/am3517evm.c 
b/board/logicpd/am3517evm/am3517evm.c
index 10031a4801..bfd4e78274 100644
--- a/board/logicpd/am3517evm/am3517evm.c
+++ b/board/logicpd/am3517evm/am3517evm.c
@@ -28,7 +28,6 @@
 #include 
 #include 
 #include 
-#include 
 #include "am3517evm.h"
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/board/ti/ti816x/evm.c b/board/ti/ti816x/evm.c
index 07a084bab8..240df8cbe1 100644
--- a/board/ti/ti816x/evm.c
+++ b/board/ti/ti816x/evm.c
@@ -9,7 +9,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -56,7 +55,7 @@ int board_eth_init(bd_t *bis)
printf("Unable to read MAC address. Set \n");
}
 
-   return davinci_emac_initialize();
+   return 0;
 }
 
 #ifdef CONFIG_SPL_BUILD
diff --git a/configs/am3517_evm_defconfig b/configs/am3517_evm_defconfig
index b9f59f3291..5cb76322df 100644
--- a/configs/am3517_evm_defconfig
+++ b/configs/am3517_evm_defconfig
@@ -44,6 +44,7 @@ CONFIG_SYS_NAND_BUSWIDTH_16BIT=y
 CONFIG_SYS_NAND_U_BOOT_LOCATIONS=y
 CONFIG_SYS_NAND_U_BOOT_OFFS=0x8
 CONFIG_SPL_NAND_SIMPLE=y
+CONFIG_DM_ETH=y
 CONFIG_MII=y
 CONFIG_DRIVER_TI_EMAC=y
 CONFIG_PINCTRL=y
diff --git a/configs/da850evm_defconfig b/configs/da850evm_defconfig
index c095058282..f7c679d3b5