[U-Boot] [PATCH v5 2/8] usb: ehci-marvell: add support for second USB controller

Wolfgang Denk wd at denx.de
Wed Jun 26 16:04:03 CEST 2013


Dear Sascha Silbe,

In message <1372195668-25496-3-git-send-email-t-uboot at infra-silbe.de> you wrote:
> From: Sascha Silbe <sascha-pgp at silbe.org>
> 
> Marvell 88AP510 (Armada 510, dove) has two separate USB
> controllers. Use the index parameter that already gets passed in to
> calculate the base address of the controller.
...
> -#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.

>  	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)" ?


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
Syntactic sugar causes cancer of the semicolon.
                - Epigrams in Programming, ACM SIGPLAN Sept. 1982


More information about the U-Boot mailing list