[PATCH 2/3] net: tsec: Access eTSEC registers using virtual address

Z.q. Hou zhiqiang.hou at nxp.com
Sun May 3 15:50:17 CEST 2020


Hi Vladimir,

Thanks a lot for your review and test!

Thanks,
Zhiqiang

> -----Original Message-----
> From: Vladimir Oltean <olteanv at gmail.com>
> Sent: 2020年5月3日 19:36
> To: Z.q. Hou <zhiqiang.hou at nxp.com>
> Cc: u-boot <u-boot at lists.denx.de>; Joe Hershberger
> <joe.hershberger at ni.com>; Bin Meng <bmeng.cn at gmail.com>; Priyanka
> Jain <priyanka.jain at nxp.com>
> Subject: Re: [PATCH 2/3] net: tsec: Access eTSEC registers using virtual
> address
> 
> Hi Zhiqiang,
> 
> On Sun, 3 May 2020 at 09:28, Zhiqiang Hou <Zhiqiang.Hou at nxp.com>
> wrote:
> >
> > From: Hou Zhiqiang <Zhiqiang.Hou at nxp.com>
> >
> > The current code accesses eTSEC registers using physical address
> > directly, it's not correct, though no problem on current platforms. It
> > won't work on platforms, which does not support 1:1 virtual-physical
> > address map.
> >
> > Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou at nxp.com>
> > ---
> 
> Reviewed-by: Vladimir Oltean <vladimir.oltean at nxp.com>
> Tested-by: Vladimir Oltean <vladimir.oltean at nxp.com>
> 
> (on LS1021A)
> 
> >  drivers/net/tsec.c | 9 ++++++---
> >  1 file changed, 6 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c index
> > f85cdcb97e..ce41aec5cf 100644
> > --- a/drivers/net/tsec.c
> > +++ b/drivers/net/tsec.c
> > @@ -798,7 +798,7 @@ int tsec_probe(struct udevice *dev)
> >         int ret;
> >
> >         pdata->iobase = (phys_addr_t)dev_read_addr(dev);
> > -       priv->regs = (struct tsec *)pdata->iobase;
> > +       priv->regs = dev_remap_addr(dev);
> >
> >         if (dev_read_phandle_with_args(dev, "phy-handle", NULL, 0, 0,
> >                                        &phandle_args)) { @@
> -817,8
> > +817,11 @@ int tsec_probe(struct udevice *dev)
> >         }
> >
> >         reg = ofnode_get_addr_index(parent, 0);
> > -       priv->phyregs_sgmii = (struct tsec_mii_mng *)
> > -                       (reg + TSEC_MDIO_REGS_OFFSET);
> > +       if (reg == FDT_ADDR_T_NONE)
> > +               return -ENOENT;
> > +
> > +       priv->phyregs_sgmii = map_physmem(reg +
> TSEC_MDIO_REGS_OFFSET, 0,
> > +                                         MAP_NOCACHE);
> >
> >         ret = dev_read_phandle_with_args(dev, "tbi-handle", NULL, 0,
> 0,
> >                                          &phandle_args);
> > --
> > 2.17.1
> >


More information about the U-Boot mailing list