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

Kuo-Jung Su dantesu at gmail.com
Mon Apr 1 03:20:22 CEST 2013


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


More information about the U-Boot mailing list