diff mbox series

[v2,1/5] hw/net:ftgmac100: update memory region size to 0x200

Message ID 20240703081623.2740862-2-jamin_lin@aspeedtech.com (mailing list archive)
State New
Headers show
Series support AST2700 network | expand

Commit Message

Jamin Lin July 3, 2024, 8:16 a.m. UTC
According to the datasheet of ASPEED SOCs,
one MAC controller owns 128KB of register space for AST2500.

However, one MAC controller only owns 64KB of register space for AST2600
and AST2700.

It set the memory region size 128KB and it occupied another
controllers Address Spaces.

Currently, the ftgmac100 model use 0x100 register space.
To support DMA 64 bits dram address and new future mode(ftgmac100_high) which
have "Normal Priority Transmit Ring Base Address Register High(0x17C)",
"High Priority Transmit Ring Base Address Register High(0x184)" and
"Receive Ring Base Address Register High(0x18C)" to save the high part physical
address of descriptor manager.

Update memory region size to 0x200.

Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
---
 hw/net/ftgmac100.c         | 2 +-
 include/hw/net/ftgmac100.h | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

Comments

Cédric Le Goater July 3, 2024, 9:12 a.m. UTC | #1
On 7/3/24 10:16 AM, Jamin Lin wrote:
> According to the datasheet of ASPEED SOCs,
> one MAC controller owns 128KB of register space for AST2500.
> 
> However, one MAC controller only owns 64KB of register space for AST2600
> and AST2700.
> 
> It set the memory region size 128KB and it occupied another
> controllers Address Spaces.
> 
> Currently, the ftgmac100 model use 0x100 register space.
> To support DMA 64 bits dram address and new future mode(ftgmac100_high) which
> have "Normal Priority Transmit Ring Base Address Register High(0x17C)",
> "High Priority Transmit Ring Base Address Register High(0x184)" and
> "Receive Ring Base Address Register High(0x18C)" to save the high part physical
> address of descriptor manager.
> 
> Update memory region size to 0x200.
> 
> Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
> ---
>   hw/net/ftgmac100.c         | 2 +-
>   include/hw/net/ftgmac100.h | 2 ++
>   2 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/net/ftgmac100.c b/hw/net/ftgmac100.c
> index 25e4c0cd5b..4e88430b2f 100644
> --- a/hw/net/ftgmac100.c
> +++ b/hw/net/ftgmac100.c
> @@ -1108,7 +1108,7 @@ static void ftgmac100_realize(DeviceState *dev, Error **errp)
>       }
>   
>       memory_region_init_io(&s->iomem, OBJECT(dev), &ftgmac100_ops, s,
> -                          TYPE_FTGMAC100, 0x2000);
> +                          TYPE_FTGMAC100, FTGMAC100_NR_REGS);
>       sysbus_init_mmio(sbd, &s->iomem);
>       sysbus_init_irq(sbd, &s->irq);
>       qemu_macaddr_default_if_unset(&s->conf.macaddr);
> diff --git a/include/hw/net/ftgmac100.h b/include/hw/net/ftgmac100.h
> index 765d1538a4..5a970676da 100644
> --- a/include/hw/net/ftgmac100.h
> +++ b/include/hw/net/ftgmac100.h
> @@ -14,6 +14,8 @@
>   #define TYPE_FTGMAC100 "ftgmac100"
>   OBJECT_DECLARE_SIMPLE_TYPE(FTGMAC100State, FTGMAC100)
>   
> +#define FTGMAC100_NR_REGS   0x200

Since this value will size a memory region, I think the define name should
be changed to FTGMAC100_{MEM,REGION,MMIO}_SIZE. What ever you prefer.


Thanks,

C.


  
> +
>   #include "hw/sysbus.h"
>   #include "net/net.h"
>
Jamin Lin July 3, 2024, 9:21 a.m. UTC | #2
Hi Cedric,

> Subject: Re: [PATCH v2 1/5] hw/net:ftgmac100: update memory region size to
> 0x200
> 
> On 7/3/24 10:16 AM, Jamin Lin wrote:
> > According to the datasheet of ASPEED SOCs, one MAC controller owns
> > 128KB of register space for AST2500.
> >
> > However, one MAC controller only owns 64KB of register space for
> > AST2600 and AST2700.
> >
> > It set the memory region size 128KB and it occupied another
> > controllers Address Spaces.
> >
> > Currently, the ftgmac100 model use 0x100 register space.
> > To support DMA 64 bits dram address and new future
> > mode(ftgmac100_high) which have "Normal Priority Transmit Ring Base
> > Address Register High(0x17C)", "High Priority Transmit Ring Base
> > Address Register High(0x184)" and "Receive Ring Base Address Register
> > High(0x18C)" to save the high part physical address of descriptor manager.
> >
> > Update memory region size to 0x200.
> >
> > Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
> > ---
> >   hw/net/ftgmac100.c         | 2 +-
> >   include/hw/net/ftgmac100.h | 2 ++
> >   2 files changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/hw/net/ftgmac100.c b/hw/net/ftgmac100.c index
> > 25e4c0cd5b..4e88430b2f 100644
> > --- a/hw/net/ftgmac100.c
> > +++ b/hw/net/ftgmac100.c
> > @@ -1108,7 +1108,7 @@ static void ftgmac100_realize(DeviceState *dev,
> Error **errp)
> >       }
> >
> >       memory_region_init_io(&s->iomem, OBJECT(dev), &ftgmac100_ops,
> s,
> > -                          TYPE_FTGMAC100, 0x2000);
> > +                          TYPE_FTGMAC100,
> FTGMAC100_NR_REGS);
> >       sysbus_init_mmio(sbd, &s->iomem);
> >       sysbus_init_irq(sbd, &s->irq);
> >       qemu_macaddr_default_if_unset(&s->conf.macaddr);
> > diff --git a/include/hw/net/ftgmac100.h b/include/hw/net/ftgmac100.h
> > index 765d1538a4..5a970676da 100644
> > --- a/include/hw/net/ftgmac100.h
> > +++ b/include/hw/net/ftgmac100.h
> > @@ -14,6 +14,8 @@
> >   #define TYPE_FTGMAC100 "ftgmac100"
> >   OBJECT_DECLARE_SIMPLE_TYPE(FTGMAC100State, FTGMAC100)
> >
> > +#define FTGMAC100_NR_REGS   0x200
> 
> Since this value will size a memory region, I think the define name should be
> changed to FTGMAC100_{MEM,REGION,MMIO}_SIZE. What ever you prefer.
> 

Will fix
Thanks-Jamin
> 
> Thanks,
> 
> C.
> 
> 
> 
> > +
> >   #include "hw/sysbus.h"
> >   #include "net/net.h"
> >
diff mbox series

Patch

diff --git a/hw/net/ftgmac100.c b/hw/net/ftgmac100.c
index 25e4c0cd5b..4e88430b2f 100644
--- a/hw/net/ftgmac100.c
+++ b/hw/net/ftgmac100.c
@@ -1108,7 +1108,7 @@  static void ftgmac100_realize(DeviceState *dev, Error **errp)
     }
 
     memory_region_init_io(&s->iomem, OBJECT(dev), &ftgmac100_ops, s,
-                          TYPE_FTGMAC100, 0x2000);
+                          TYPE_FTGMAC100, FTGMAC100_NR_REGS);
     sysbus_init_mmio(sbd, &s->iomem);
     sysbus_init_irq(sbd, &s->irq);
     qemu_macaddr_default_if_unset(&s->conf.macaddr);
diff --git a/include/hw/net/ftgmac100.h b/include/hw/net/ftgmac100.h
index 765d1538a4..5a970676da 100644
--- a/include/hw/net/ftgmac100.h
+++ b/include/hw/net/ftgmac100.h
@@ -14,6 +14,8 @@ 
 #define TYPE_FTGMAC100 "ftgmac100"
 OBJECT_DECLARE_SIMPLE_TYPE(FTGMAC100State, FTGMAC100)
 
+#define FTGMAC100_NR_REGS   0x200
+
 #include "hw/sysbus.h"
 #include "net/net.h"