From: Wolfgang Denk Date: Wed, 26 Jun 2013 16:04:03 +0200 Subject: [U-Boot] [PATCH v5 2/8] usb: ehci-marvell: add support for second USB controller In-Reply-To: <1372195668-25496-3-git-send-email-t-uboot@infra-silbe.de> References: <51C9F64B.1020107@gmail.com> <1372195668-25496-1-git-send-email-t-uboot@infra-silbe.de> <1372195668-25496-3-git-send-email-t-uboot@infra-silbe.de> Message-ID: <20130626140403.1434738047D@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Sascha Silbe, In message <1372195668-25496-3-git-send-email-t-uboot@infra-silbe.de> you wrote: > From: Sascha Silbe > > 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