Re: [RFC PATCH v2 11/11] riscv: soc: Allwinner D1 GMAC driver only for temp use

From: Jernej Škrabec
Date: Sun Jun 06 2021 - 11:39:27 EST


Hi!

Dne nedelja, 06. junij 2021 ob 17:32:22 CEST je Guo Ren napisal(a):
> ,
>
> On Sun, Jun 6, 2021 at 6:50 PM Andre Przywara <andre.przywara@xxxxxxx>
wrote:
> > On Sun, 6 Jun 2021 09:04:09 +0000
> > guoren@xxxxxxxxxx wrote:
> >
> > Hi,
> >
> > > From: liush <liush@xxxxxxxxxxxxxxxxx>
> > >
> > > This is a temporary driver, only guaranteed to work on allwinner
> > > D1. In order to ensure the developer's demand for network usage.
> >
> > That looks like some Allwinner BSP driver, please don't endorse code
> > of this quality (just look at all that commented code and the attempt
> > for compile-time configuration).
> >
> > > It only could work at 1Gps mode.
> > >
> > > The correct gmac driver should follow (I guess)
> > > drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
> > >
> > > If anyone is familiar with it and can help porting, I would be
> > > very grateful.
> >
> > Have you tried compiling and using that driver? Ideally it should just
> > work, Linux drivers are meant to be portable, by design. And the driver
> > is already enabled by COMPILE_TEST.
>
> It still needs some work with dwmac-sun8i.c glue layer, eg:
> tx/rx-delay setting, clk & pinmux drivers.
>
> The patch is just to help people using D1 with GMAC temporarily with
> network function.

It should be marked "DO NOT MERGE" or similar then.

Best regards,
Jernej

>
> > But I guess you need some extra care to make the non-coherent DMA work?
> > I haven't looked in detail, but are those new CMOs hooked into the
> > generic DMA framework?
>
> Yes, we have the simliar principle with arm & csky for non-coherent:
> - Using PTE attributes setting Using PTE attributes to support
> _PAGE_IOREMAP & _PAGE_WRITECOMBINE
> - Using CMO instructions deal SYNC_DMA_FOR_CPU/DEVICE.
>
> > Cheers,
> > Andre
> >
> > > Signed-off-by: Liu Shaohua <liush@xxxxxxxxxxxxxxxxx>
> > > Tested-by: Guo Ren <guoren@xxxxxxxxxx>
> > > Signed-off-by: Guo Ren <guoren@xxxxxxxxxx>
> > > Cc: Maxime Ripard <mripard@xxxxxxxxxx>
> > > Cc: Corentin Labbe <clabbe@xxxxxxxxxxxx>
> > > Cc: Samuel Holland <samuel@xxxxxxxxxxxx>
> > > Cc: Icenowy Zheng <icenowy@xxxxxxx>
> > > Cc: LABBE Corentin <clabbe.montjoie@xxxxxxxxx>
> > > Cc: Michael Walle <michael@xxxxxxxx>
> > > Cc: Chen-Yu Tsai <wens@xxxxxxxx>
> > > Cc: Maxime Ripard <maxime@xxxxxxxxxx>
> > > Cc: Wei Fu <wefu@xxxxxxxxxx>
> > > Cc: Wei Wu <lazyparser@xxxxxxxxx>
> > > Signed-off-by: Guo Ren <guoren@xxxxxxxxxxxxxxxxx>