[U-Boot] [PATCH 5/6] net: macb: add dma_burst_length config

2019-07-16 Thread Ramon Fried
GEM support higher DMA burst writes/reads than the default (4).
add configuration structure with dma burst length so it could be
applied later to DMA configuration.

Signed-off-by: Ramon Fried 
Reviewed-by: Anup Patel 
Tested-by: Anup Patel 
Acked-by: Joe Hershberger 
---
v2: nothing.
 drivers/net/macb.c | 22 +-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index cf76270ad8..dc6aa6deda 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -82,6 +82,7 @@ struct macb_dma_desc {
 
 struct macb_device {
void*regs;
+   unsigned intdma_burst_length;
 
unsigned intrx_tail;
unsigned inttx_head;
@@ -118,6 +119,11 @@ struct macb_device {
phy_interface_t phy_interface;
 #endif
 };
+
+struct macb_config {
+   unsigned intdma_burst_length;
+};
+
 #ifndef CONFIG_DM_ETH
 #define to_macb(_nd) container_of(_nd, struct macb_device, netdev)
 #endif
@@ -1135,8 +1141,13 @@ static int macb_enable_clk(struct udevice *dev)
 }
 #endif
 
+static const struct macb_config default_gem_config = {
+   .dma_burst_length = 16,
+};
+
 static int macb_eth_probe(struct udevice *dev)
 {
+   const struct macb_config *macb_config;
struct eth_pdata *pdata = dev_get_platdata(dev);
struct macb_device *macb = dev_get_priv(dev);
const char *phy_mode;
@@ -1153,6 +1164,11 @@ static int macb_eth_probe(struct udevice *dev)
 
macb->regs = (void *)pdata->iobase;
 
+   macb_config = (struct macb_config *)dev_get_driver_data(dev);
+   if (!macb_config)
+   macb_config = _gem_config;
+
+   macb->dma_burst_length = macb_config->dma_burst_length;
 #ifdef CONFIG_CLK
ret = macb_enable_clk(dev);
if (ret)
@@ -1213,12 +1229,16 @@ static int macb_eth_ofdata_to_platdata(struct udevice 
*dev)
return macb_late_eth_ofdata_to_platdata(dev);
 }
 
+static const struct macb_config sama5d4_config = {
+   .dma_burst_length = 4,
+};
+
 static const struct udevice_id macb_eth_ids[] = {
{ .compatible = "cdns,macb" },
{ .compatible = "cdns,at91sam9260-macb" },
{ .compatible = "atmel,sama5d2-gem" },
{ .compatible = "atmel,sama5d3-gem" },
-   { .compatible = "atmel,sama5d4-gem" },
+   { .compatible = "atmel,sama5d4-gem", .data = (ulong)_config },
{ .compatible = "cdns,zynq-gem" },
{ }
 };
-- 
2.22.0

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


Re: [U-Boot] [PATCH 5/6] net: macb: add dma_burst_length config

2019-07-08 Thread Joe Hershberger
On Tue, Jun 11, 2019 at 10:39 AM Ramon Fried  wrote:
>
> GEM support higher DMA burst writes/reads than the default (4).
> add configuration structure with dma burst length so it could be
> applied later to DMA configuration.
>
> Signed-off-by: Ramon Fried 

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


Re: [U-Boot] [PATCH 5/6] net: macb: add dma_burst_length config

2019-07-02 Thread Anup Patel


> -Original Message-
> From: U-Boot  On Behalf Of Ramon Fried
> Sent: Tuesday, June 11, 2019 8:49 PM
> To: u-boot@lists.denx.de
> Cc: Joe Hershberger 
> Subject: [U-Boot] [PATCH 5/6] net: macb: add dma_burst_length config
> 
> GEM support higher DMA burst writes/reads than the default (4).
> add configuration structure with dma burst length so it could be applied later
> to DMA configuration.
> 
> Signed-off-by: Ramon Fried 
> ---
> 
>  drivers/net/macb.c | 22 +-
>  1 file changed, 21 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/macb.c b/drivers/net/macb.c index
> ae8937bbb1..fb42172520 100644
> --- a/drivers/net/macb.c
> +++ b/drivers/net/macb.c
> @@ -82,6 +82,7 @@ struct macb_dma_desc {
> 
>  struct macb_device {
>   void*regs;
> + unsigned intdma_burst_length;
> 
>   unsigned intrx_tail;
>   unsigned inttx_head;
> @@ -118,6 +119,11 @@ struct macb_device {
>   phy_interface_t phy_interface;
>  #endif
>  };
> +
> +struct macb_config {
> + unsigned intdma_burst_length;
> +};
> +
>  #ifndef CONFIG_DM_ETH
>  #define to_macb(_nd) container_of(_nd, struct macb_device, netdev)
> #endif @@ -1133,8 +1139,13 @@ static int macb_enable_clk(struct udevice
> *dev)  }  #endif
> 
> +static const struct macb_config default_gem_config = {
> + .dma_burst_length = 16,
> +};
> +
>  static int macb_eth_probe(struct udevice *dev)  {
> + const struct macb_config *macb_config;
>   struct eth_pdata *pdata = dev_get_platdata(dev);
>   struct macb_device *macb = dev_get_priv(dev);
>   const char *phy_mode;
> @@ -1151,6 +1162,11 @@ static int macb_eth_probe(struct udevice *dev)
> 
>   macb->regs = (void *)pdata->iobase;
> 
> + macb_config = (struct macb_config *)dev_get_driver_data(dev);
> + if (!macb_config)
> + macb_config = _gem_config;
> +
> + macb->dma_burst_length = macb_config->dma_burst_length;
>  #ifdef CONFIG_CLK
>   ret = macb_enable_clk(dev);
>   if (ret)
> @@ -1211,12 +1227,16 @@ static int macb_eth_ofdata_to_platdata(struct
> udevice *dev)
>   return macb_late_eth_ofdata_to_platdata(dev);
>  }
> 
> +static const struct macb_config sama5d4_config = {
> + .dma_burst_length = 4,
> +};
> +
>  static const struct udevice_id macb_eth_ids[] = {
>   { .compatible = "cdns,macb" },
>   { .compatible = "cdns,at91sam9260-macb" },
>   { .compatible = "atmel,sama5d2-gem" },
>   { .compatible = "atmel,sama5d3-gem" },
> - { .compatible = "atmel,sama5d4-gem" },
> + { .compatible = "atmel,sama5d4-gem", .data =
> (ulong)_config },
>   { .compatible = "cdns,zynq-gem" },
>   { }
>  };
> --
> 2.21.0
> 
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://lists.denx.de/listinfo/u-boot

Reviewed-by: Anup Patel 
Tested-by: Anup Patel 

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


[U-Boot] [PATCH 5/6] net: macb: add dma_burst_length config

2019-06-11 Thread Ramon Fried
GEM support higher DMA burst writes/reads than the default (4).
add configuration structure with dma burst length so it could be
applied later to DMA configuration.

Signed-off-by: Ramon Fried 
---

 drivers/net/macb.c | 22 +-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index ae8937bbb1..fb42172520 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -82,6 +82,7 @@ struct macb_dma_desc {
 
 struct macb_device {
void*regs;
+   unsigned intdma_burst_length;
 
unsigned intrx_tail;
unsigned inttx_head;
@@ -118,6 +119,11 @@ struct macb_device {
phy_interface_t phy_interface;
 #endif
 };
+
+struct macb_config {
+   unsigned intdma_burst_length;
+};
+
 #ifndef CONFIG_DM_ETH
 #define to_macb(_nd) container_of(_nd, struct macb_device, netdev)
 #endif
@@ -1133,8 +1139,13 @@ static int macb_enable_clk(struct udevice *dev)
 }
 #endif
 
+static const struct macb_config default_gem_config = {
+   .dma_burst_length = 16,
+};
+
 static int macb_eth_probe(struct udevice *dev)
 {
+   const struct macb_config *macb_config;
struct eth_pdata *pdata = dev_get_platdata(dev);
struct macb_device *macb = dev_get_priv(dev);
const char *phy_mode;
@@ -1151,6 +1162,11 @@ static int macb_eth_probe(struct udevice *dev)
 
macb->regs = (void *)pdata->iobase;
 
+   macb_config = (struct macb_config *)dev_get_driver_data(dev);
+   if (!macb_config)
+   macb_config = _gem_config;
+
+   macb->dma_burst_length = macb_config->dma_burst_length;
 #ifdef CONFIG_CLK
ret = macb_enable_clk(dev);
if (ret)
@@ -1211,12 +1227,16 @@ static int macb_eth_ofdata_to_platdata(struct udevice 
*dev)
return macb_late_eth_ofdata_to_platdata(dev);
 }
 
+static const struct macb_config sama5d4_config = {
+   .dma_burst_length = 4,
+};
+
 static const struct udevice_id macb_eth_ids[] = {
{ .compatible = "cdns,macb" },
{ .compatible = "cdns,at91sam9260-macb" },
{ .compatible = "atmel,sama5d2-gem" },
{ .compatible = "atmel,sama5d3-gem" },
-   { .compatible = "atmel,sama5d4-gem" },
+   { .compatible = "atmel,sama5d4-gem", .data = (ulong)_config },
{ .compatible = "cdns,zynq-gem" },
{ }
 };
-- 
2.21.0

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