From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marek Vasut Date: Sat, 30 Mar 2013 07:27:27 +0100 Subject: [U-Boot] [PATCH 05/11] usb-gadget: add FOTG210 USB gadget support In-Reply-To: <1364540788-13943-6-git-send-email-dantesu@gmail.com> References: <1364540788-13943-1-git-send-email-dantesu@gmail.com> <1364540788-13943-6-git-send-email-dantesu@gmail.com> Message-ID: <201303300727.27593.marex@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 Kuo-Jung Su, > From: Kuo-Jung Su > > This patch would try to use Faraday FOTG210 to implement > a USB RNDIS Ethernet. > > Signed-off-by: Kuo-Jung Su [...] > +static inline int > +ep_reset(struct fotg210_chip *chip, uint8_t ep_addr) > +{ > + int ep = ep_addr & USB_ENDPOINT_NUMBER_MASK; > + > + if (ep_addr & USB_DIR_IN) { > + /* input */ > + USB_REG32(chip, REG_IEP1 + (ep - 1) * 4) |= BIT(12); > + USB_REG32(chip, REG_IEP1 + (ep - 1) * 4) &= ~BIT(12); > + USB_REG32(chip, REG_IEP1 + (ep - 1) * 4) &= ~BIT(11); > + } else { > + /* output */ > + USB_REG32(chip, REG_OEP1 + (ep - 1) * 4) |= BIT(12); > + USB_REG32(chip, REG_OEP1 + (ep - 1) * 4) &= BIT(12); > + USB_REG32(chip, REG_OEP1 + (ep - 1) * 4) &= BIT(11); > + } Use readl(), writel(), clrsetbits_le32() etc. For example see drivers/i2c/mxs_i2c.c [...] > +/* > + * Global Registers > + */ > +#define REG_ISR 0x0C0 /* Interrupt Status */ > +#define REG_IMR 0x0C4 /* Interrupt Control */ Use structure based access, ie. arch/arm/include/asm/arch-mxs/regs-i2c.h struct regs { uint32_t reg1; uint32_t reg2; ... }; writel(val, ®s->reg1);