[U-Boot] [PATCH v2] Support for PXA27X UDC.

Kim Phillips kim.phillips at freescale.com
Tue Mar 10 00:46:20 CET 2009


On Mon,  9 Mar 2009 18:38:47 +0530
Vivek Kutal <vivek.kutal at azingo.com> wrote:

> +#ifdef USBDDBG
> +static void udc_dump_buffer(char *name, u8 *buf, int len)
> +{
> +	int i, p, flag = 1;
> +
> +	usbdbg("%s - buf %p, len %d", name, buf, len);
> +	for (i = p = 0; i < len; i++, p++) {
> +		if (p == 0) {
> +			flag = 0;
> +			usbdbg("\t");
> +		}
> +
> +		usbdbg("%02x ", buf[i]);
> +
> +		if (p == 15) {
> +			flag = 1;
> +			usbdbg("\n");
> +			p = -1;
> +		}
> +	}
> +	if (!flag)
> +		usbdbg("\n");
> +}
> +#else
> +#define udc_dump_buffer(name, buf, len)		/* void */
> +#endif

can we not reinvent the wheel here and use
lib_generic/display_options.c's print_buffer()?

> +static int udc_write_urb(struct usb_endpoint_instance *endpoint)
> +{
> +	struct urb *urb = endpoint->tx_urb;
> +	int ep_num = endpoint->endpoint_address & USB_ENDPOINT_NUMBER_MASK;
> +

no blank line here please.

> +	u32 *addr32 = (u32 *) &UDCDN(ep_num),
> +		*data32 = (u32 *) urb->buffer;
> +	u8  *addr8 = (u8 *) &UDCDN(ep_num),
> +		*data8 = (u8 *) urb->buffer;

alignment (or give data* their own entire line).

> +				/* Check direction */
> +				if (ep0_urb->device_request.bmRequestType &
> +				USB_REQ_DIRECTION_MASK == USB_REQ_HOST2DEVICE) {

alignment.  Might need to add parens for clarity.

Kim


More information about the U-Boot mailing list