[U-Boot] [PATCH 05/11] usb-gadget: add FOTG210 USB gadget support

Kuo-Jung Su
2013-04-01T01:20:22Z

2013/3/30 Marek Vasut <marex@denx.de>:
> Dear Kuo-Jung Su,
>
>> From: Kuo-Jung Su <dantesu@faraday-tech.com>
>>
>> This patch would try to use Faraday FOTG210 to implement
>> a USB RNDIS Ethernet.
>>
>> Signed-off-by: Kuo-Jung Su <dantesu@faraday-tech.com>
>
> [...]
>
>> +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
>

Got it, thanks

> [...]
>
>> +/*
>> + * 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, &regs->reg1);

Got it, thanks

--
Best wishes,
Kuo-Jung Su