[U-Boot] [PATCH v3] net: ll_temac: Add LL TEMAC driver to u-boot
Wolfgang Denk
wd at denx.de
Thu Sep 1 16:09:04 CEST 2011
Dear Michal Simek,
In message <4E5F85DA.4080403 at monstr.eu> you wrote:
>
> >> +static void sdma_out_be32(struct ll_priv *priv, u32 offset, u32 val)
> >> +{
> >> + if (priv->mode & DCR_BIT)
> >> + mtdcr_local(priv->ctrl + offset, val);
> >> + else
> >> + out_be32((u32 *)(priv->ctrl + offset * 4), val);
> >> +}
> >> +
> >> +static u32 sdma_in_be32(struct ll_priv *priv, u32 offset)
> >> +{
> >> + if (priv->mode & DCR_BIT)
> >> + return mfdcr_local(priv->ctrl + offset);
> >> +
> >> + return in_be32((u32 *)(priv->ctrl + offset * 4));
> >> +}
> >
> > Can we please get rid of these functions? As mentioned many, many
> > times before, we discourage all use of "base address plus offset" to
> > access any device registers etc.
> >
> > These functions here re-introduce such accesses, and this is something
> > I will not accept.
>
> Ok. How to do it?
>
> For bus access it is necessary to use 4B offsets for DCR just 1B
> and one system can contains two MACs where the first use 4B offset and the second
> 1B.
I don't think your description here matches the code above. With "1
byte offsets" you would be doing all unaligned bus accesses.
I think you should use an array of structs and an index to select the
right one.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"A dirty mind is a joy forever." - Randy Kunkee
More information about the U-Boot
mailing list