[U-Boot] [PATCH v5 2/8] usb: ehci-marvell: add support for second USB controller
Marek Vasut
marex at denx.de
Sun Jun 30 00:26:42 CEST 2013
Dear Sascha Silbe,
> Dear Wolfgang Denk,
>
> Wolfgang Denk <wd at denx.de> writes:
> >> -#define rdl(off) readl(MVUSB0_BASE + (off))
> >> -#define wrl(off, val) writel((val), MVUSB0_BASE + (off))
> >> +#define rdl(base, off) readl((base) + (off))
> >> +#define wrl(base, off, val) writel((val), (base) + (off))
> >
> > Instead of extending this, can we eventually clean this up and use C
> > structs instead? U-Boot does not allow device accesses through a
> > based plus offset notation.
>
> Thanks for the review. I've given the clean-up a stab today, as a
> separate patch that the CuBox support series can build on.
>
> >> u32 size, base, attrib;
> >>
> >> +#ifdef MVUSB1_BASE
> >> + u32 usb_base = (index == 0) ? MVUSB0_BASE : MVUSB1_BASE;
> >> +#else
> >> + u32 usb_base = MVUSB0_BASE;
> >> +#endif
> >
> > Can we please also avoid this #ifdef's ? Eventually you can use
> > something like "base_0 + index * sizeof(struct usb_something)" ?
>
> The two USB host controllers on Dove are separate entities at
> different base offsets (0x50000 vs. 0x51000). We could fill up the
> register struct to have a size of 0x1000, but then the next SoC to be
> supported could come up with a different offset.
Check drivers/usb/host/ehci-mxs.c for handling of such a case ;-)
Best regards,
Marek Vasut
More information about the U-Boot
mailing list