diff mbox series

[v2] net: axi_emac: Use reg property for DMA registers

Message ID 20231111173604.93103-2-mchitale@ventanamicro.com
State Superseded
Delegated to: Michal Simek
Headers show
Series [v2] net: axi_emac: Use reg property for DMA registers | expand

Commit Message

Mayuresh Chitale Nov. 11, 2023, 5:36 p.m. UTC
As per the xlnx,axi-ethernet-1.00.a DT documentation in linux, the AXI
DMA registers can be obtained via the reg property or via a separate
node for the axistream DMA controller. Currently only the latter is
supported, so add support to fetch the DMA controller registers from the
"reg" property.

Signed-off-by: Mayuresh Chitale <mchitale@ventanamicro.com>
Reviewed-by: Michal Simek <michal.simek@amd.com>
---
Changes in v2:
====
Add Reviewed-by Tag.

 drivers/net/xilinx_axi_emac.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

Comments

Michal Simek Nov. 13, 2023, 9:10 a.m. UTC | #1
On 11/11/23 18:36, Mayuresh Chitale wrote:
> As per the xlnx,axi-ethernet-1.00.a DT documentation in linux, the AXI
> DMA registers can be obtained via the reg property or via a separate
> node for the axistream DMA controller. Currently only the latter is
> supported, so add support to fetch the DMA controller registers from the
> "reg" property.
> 
> Signed-off-by: Mayuresh Chitale <mchitale@ventanamicro.com>
> Reviewed-by: Michal Simek <michal.simek@amd.com>
> ---
> Changes in v2:
> ====
> Add Reviewed-by Tag.
> 
>   drivers/net/xilinx_axi_emac.c | 9 ++++-----
>   1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/xilinx_axi_emac.c b/drivers/net/xilinx_axi_emac.c
> index 54f2232768..ef151ee51b 100644
> --- a/drivers/net/xilinx_axi_emac.c
> +++ b/drivers/net/xilinx_axi_emac.c
> @@ -903,12 +903,11 @@ static int axi_emac_of_to_plat(struct udevice *dev)
>   
>   	ret = dev_read_phandle_with_args(dev, "axistream-connected", NULL, 0, 0,
>   					 &axistream_node);
> -	if (ret) {
> -		printf("%s: axistream is not found\n", __func__);
> -		return -EINVAL;
> -	}
> +	if (!ret)
> +		plat->dmatx = (struct axidma_reg *)ofnode_get_addr(axistream_node.node);
> +	else
> +		plat->dmatx = (struct axidma_reg *)dev_read_addr_index(dev, 1);
>   
> -	plat->dmatx = (struct axidma_reg *)ofnode_get_addr(axistream_node.node);
>   	if (!plat->dmatx) {
>   		printf("%s: axi_dma register space not found\n", __func__);
>   		return -EINVAL;


This is the part of pcie series but it has nothing to do with it. Can you please 
send it separately?

M
mchitale@gmail.com Nov. 16, 2023, 1:22 p.m. UTC | #2
Hi Michal,
On Mon, 2023-11-13 at 10:10 +0100, Michal Simek wrote:
> 
> On 11/11/23 18:36, Mayuresh Chitale wrote:
> > As per the xlnx,axi-ethernet-1.00.a DT documentation in linux, the
> > AXI
> > DMA registers can be obtained via the reg property or via a
> > separate
> > node for the axistream DMA controller. Currently only the latter is
> > supported, so add support to fetch the DMA controller registers
> > from the
> > "reg" property.
> > 
> > Signed-off-by: Mayuresh Chitale <mchitale@ventanamicro.com>
> > Reviewed-by: Michal Simek <michal.simek@amd.com>
> > ---
> > Changes in v2:
> > ====
> > Add Reviewed-by Tag.
> > 
> >   drivers/net/xilinx_axi_emac.c | 9 ++++-----
> >   1 file changed, 4 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/net/xilinx_axi_emac.c
> > b/drivers/net/xilinx_axi_emac.c
> > index 54f2232768..ef151ee51b 100644
> > --- a/drivers/net/xilinx_axi_emac.c
> > +++ b/drivers/net/xilinx_axi_emac.c
> > @@ -903,12 +903,11 @@ static int axi_emac_of_to_plat(struct udevice
> > *dev)
> >   
> >   	ret = dev_read_phandle_with_args(dev, "axistream-connected",
> > NULL, 0, 0,
> >   					 &axistream_node);
> > -	if (ret) {
> > -		printf("%s: axistream is not found\n", __func__);
> > -		return -EINVAL;
> > -	}
> > +	if (!ret)
> > +		plat->dmatx = (struct axidma_reg
> > *)ofnode_get_addr(axistream_node.node);
> > +	else
> > +		plat->dmatx = (struct axidma_reg
> > *)dev_read_addr_index(dev, 1);
> >   
> > -	plat->dmatx = (struct axidma_reg
> > *)ofnode_get_addr(axistream_node.node);
> >   	if (!plat->dmatx) {
> >   		printf("%s: axi_dma register space not found\n",
> > __func__);
> >   		return -EINVAL;
> 
> This is the part of pcie series but it has nothing to do with it. Can
> you please 
> send it separately?
Yes, actually I intended to send this patch as well as the PCIe patches
as individual patches but the way I invoked send-email caused those to
become a series.
> 
> M
diff mbox series

Patch

diff --git a/drivers/net/xilinx_axi_emac.c b/drivers/net/xilinx_axi_emac.c
index 54f2232768..ef151ee51b 100644
--- a/drivers/net/xilinx_axi_emac.c
+++ b/drivers/net/xilinx_axi_emac.c
@@ -903,12 +903,11 @@  static int axi_emac_of_to_plat(struct udevice *dev)
 
 	ret = dev_read_phandle_with_args(dev, "axistream-connected", NULL, 0, 0,
 					 &axistream_node);
-	if (ret) {
-		printf("%s: axistream is not found\n", __func__);
-		return -EINVAL;
-	}
+	if (!ret)
+		plat->dmatx = (struct axidma_reg *)ofnode_get_addr(axistream_node.node);
+	else
+		plat->dmatx = (struct axidma_reg *)dev_read_addr_index(dev, 1);
 
-	plat->dmatx = (struct axidma_reg *)ofnode_get_addr(axistream_node.node);
 	if (!plat->dmatx) {
 		printf("%s: axi_dma register space not found\n", __func__);
 		return -EINVAL;