Re: [net-next v4 2/5] net: stmmac: Add basic dw25gmac support to stmmac core

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Amit,

On Thu, Aug 22, 2024 at 10:17 AM Amit Singh Tomar
<amitsinght@xxxxxxxxxxx> wrote:
>
> Hi,
>
> > The BCM8958x uses early adaptor version of DWC_xgmac version 4.00a for
> > ethernet MAC. The DW25GMAC introduced in this version adds new DMA
> > architecture called Hyper-DMA (HDMA) for virtualization scalability.
> > This is realized by decoupling physical DMA channels(PDMA) from potentially
> > large number of virtual DMA channels (VDMA). The VDMAs are software
> > abastractions that map to PDMAs for frame transmission and reception.
> You should either run ./scripts/checkpatch.pl --strict --codespell
> --patch or use :set spell in vi to check for spelling mistakes

Thank you, I will do that next time.

> > +static u32 decode_vdma_count(u32 regval)
> > +{
> > +     /* compressed encoding for vdma count
> > +      * regval: VDMA count
> > +      * 0-15  : 1 - 16
> > +      * 16-19 : 20, 24, 28, 32
> > +      * 20-23 : 40, 48, 56, 64
> > +      * 24-27 : 80, 96, 112, 128
> > +      */
> > +     if (regval < 16)
> > +             return regval + 1;
> > +     return (4 << ((regval - 16) / 4)) * ((regval % 4) + 5);
> Is there a potential for regval to be out of bounds (regval > 27)  that
> needed to be handled properly?

The IP core documentation we have only defines support upto 128 VDMAs.
The same formula should for higher values (bound by bitmask).

> > diff --git a/drivers/net/ethernet/stmicro/stmmac/dw25gmac.h b/drivers/net/ethernet/stmicro/stmmac/dw25gmac.h
> > new file mode 100644
> > index 000000000000..c7fdf6624fea
> > --- /dev/null
> > +++ b/drivers/net/ethernet/stmicro/stmmac/dw25gmac.h
> > @@ -0,0 +1,90 @@
> > +/* SPDX-License-Identifier: GPL-2.0-only */
> > +/* Copyright (c) 2024 Broadcom Corporation
> > + * DW25GMAC definitions.
> > + */
> > +
> > +#define XXVGMAC_ADDR_OFFSET          GENMASK(14, 8)
> > +#define XXVGMAC_AUTO_INCR            GENMASK(5, 4)
> > +#define XXVGMAC_CMD_TYPE                     BIT(1)
> > +#define XXVGMAC_OB                   BIT(0)
> > +#define XXVGMAC_DMA_CH_IND_DATA              0X00003084
> nit: lower case please, 0x00003084.

Thanks, will fix it.





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux