[U-Boot] [PATCH] ulpi: add generic ULPI functionality

Jana Rapava fermata7 at gmail.com
Sat Nov 12 02:09:46 CET 2011


2011/11/8 Igor Grinberg <grinberg at compulab.co.il>

>
> > +/*
> > + * This is a family of wrapper functions which sets bits in ULPI
> registers.
> > + * Access mode could be WRITE, SET or CLEAR.
>
> What about READ?
> I know it can be done from any of those registers, but it is confusing.
>
> > + * For further informations see ULPI 1.1 specification.
> > + */
> > +void ulpi_otg_ctrl_flags
> > +     (struct usb_ehci *ehci, struct ulpi_regs *ulpi, int access_mode,
> u32 flags)
> > +{
> > +     switch (access_mode) {
> > +     case WRITE:
> > +             ulpi_write(ehci, (u32)&ulpi->otg_ctrl_write, flags);
> > +             break;
> > +     case SET:
> > +             ulpi_write(ehci, (u32)&ulpi->otg_ctrl_set, flags);
> > +             break;
> > +     case CLEAR:
> > +             ulpi_write(ehci, (u32)&ulpi->otg_ctrl_clear, flags);
> > +             break;
> > +     }
> > +}
> > +
> > +void ulpi_function_ctrl_flags
> > +     (struct usb_ehci *ehci, struct ulpi_regs *ulpi, int access_mode,
> u32 flags)
> > +{
> > +     switch (access_mode) {
> > +     case WRITE:
> > +             ulpi_write(ehci, (u32)&ulpi->function_ctrl_write, flags);
> > +             break;
> > +     case SET:
> > +             ulpi_write(ehci, (u32)&ulpi->function_ctrl_set, flags);
> > +             break;
> > +     case CLEAR:
> > +             ulpi_write(ehci, (u32)&ulpi->function_ctrl_clear, flags);
> > +             break;
> > +     }
> > +}
> > +
> > +void ulpi_iface_ctrl_flags
> > +     (struct usb_ehci *ehci, struct ulpi_regs *ulpi, int access_mode,
> u32 flags)
> > +{
> > +     switch (access_mode) {
> > +     case WRITE:
> > +             ulpi_write(ehci, (u32)&ulpi->iface_ctrl_write, flags);
> > +             break;
> > +     case SET:
> > +             ulpi_write(ehci, (u32)&ulpi->iface_ctrl_set, flags);
> > +             break;
> > +     case CLEAR:
> > +             ulpi_write(ehci, (u32)&ulpi->iface_ctrl_clear, flags);
> > +             break;
> > +     }
> > +
> > +}
>
> All the above functions are just making users hard to understand
> what they should do and what information they should know and
> supply to the driver.
> More function oriented API would be much more useful here.
>
>
Please, could you be more specific? I would be thankful, because I know
only Linux kernel ULPI API, where driver has to fill otg_transciever
structure with bits it needs to set (if I understand it well) and I would
like to use something more lightweight here.

> > +
> > +void ulpi_init(struct usb_ehci *ehci, struct ulpi_regs *ulpi)
> > +{
> > +     u32 tmp = 0;
> > +     int reg;
> > +
> > +     /* Assemble ID from four ULPI ID registers (8 bits each). */
> > +     for (reg = ULPI_ID_REGS_COUNT - 1; reg >= 0; reg--)
> > +             tmp |= ulpi_read(ehci, reg) << (reg * 8);
> > +
> > +     /* Split ID into vendor and product ID. */
> > +     debug("Found ULPI TX, ID %04x:%04x\n", tmp >> 16, tmp & 0xffff);
>
> What is TX? Is it transceiver or xceiver or both in one?
>
>
According to ULPI 1.1 specification, it is transceiver.

--
> Regards,
> Igor.
>

Regards,
Jana Rapava


More information about the U-Boot mailing list