Re: pxa270 udc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi everyone,

I just wanted to report on my progress on getting Linux going on my
still unnameable industrial handheld, and thank you all for your
suggestions.

Just a quick recap:

* The device is based on a Marvell pxa270 SoC, which has had excellent
community / commercial support in the kernel.

* Originally, I was very happy to get a console up on the Standard
UART (STUART), which is NOT the usual UART used for early printk
messages (I believe that's  the Full UART or FUART). That is, until I
realized that I could only read bytes from the STUART and not write to
it because it was spliced in hardware with an RFID transceiver..

* Then, I was able to get the LCD up and running, and saw our
favourite penguin show up (yaay!)

* Needed console access somehow, other than the UART, so opted for
using it as a USB Ethernet Gadget.

* Although the device posted several messages on boot saying that the
handheld usb0 was up and running, my workstation still did not receive
any notification that a USB network device was present, even after
disconnecting / reconnecting.

Which leads us to today.

I just tried working with linux-2.6.git instead of sticking with the
2.6.29 kernel, and I guess there may have been some more debug / error
message code in the pxa27x-udc driver, which led me to the problem.
The error message I finally saw was this:

=========================================
pxa27x-udc pxa27x-udc: Couldn't request gpio 57 : -16
pxa27x-udc: probe of pxa27x-udc failed with error -16
=========================================

Error -16 corresponds to -EBUSY, which I thought was odd. Peaking into
pxa27x-udc, showed me that the driver uses the gpio_request function
to claim the appropriate GPIO.  Actually, gpio_request would only
report this error if that particular gpio descriptor already had the
REQUESTED flag set.

The problem was that I had set the GPIO statically in my pin_config[]
array, like so:

========================================
static unsigned long xxxxx_pin_config[] = {
...
	/*
	 * 	UDC
	 */
MFP_CFG_OUT(GPIO57_nCL_USB_ENABLE,AF0,DRIVE_HIGH),
MFP_CFG_IN(GPIO79_nCL_USB_DETECT,AF0),
...
}
========================================

Removing the declarations from my static pin_config[], while ensuring
that the following code (slightly modified from Robert Jarzmik's
mioa701.c) in my UDC section fixed the problem.

========================================
static int is_usb_connected(void)
{
	return !gpio_get_value(GPIO79_nCL_USB_DETECT);
}
static void udc_command( int cmd ) {
	switch(cmd) {
	case PXA2XX_UDC_CMD_CONNECT:
		gpio_set_value(GPIO57_nCL_USB_ENABLE,0);
		break;
	case PXA2XX_UDC_CMD_DISCONNECT:
		gpio_set_value(GPIO57_nCL_USB_ENABLE,1);
		break;
	default:
		break;
	}
}
static struct pxa2xx_udc_mach_info xxxxxx_udc_info = {
	.udc_is_connected 		= is_usb_connected,
	.udc_command	 		= udc_command,
	.gpio_pullup	  		= GPIO57_nCL_USB_ENABLE,
	.gpio_pullup_inverted 	= 1,
	.gpio_vbus 				= GPIO79_nCL_USB_DETECT,
	.gpio_vbus_inverted 	= 1,
};

static struct gpio_vbus_mach_info gpio_vbus_data = {
	.gpio_vbus = GPIO79_nCL_USB_DETECT,
	.gpio_vbus_inverted = 1,
//	.gpio_pullup = GPIO57_nCL_USB_ENABLE,
//	.gpio_pullup_inverted = 1,
};

static struct platform_device gpio_vbus = {
	.name	= "gpio-vbus",
	.id		= -1,
	.dev	= {
				.platform_data = &gpio_vbus_data,
				.parent	= NULL,
	},
};

static void __init udc_init() {
	pxa_set_udc_info(&xxxxxx_udc_info);
}
========================================

Also note, that the gpio_vbus platform_device should be registered as
part of an array of platform_devices, with

platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));

So to whoever is responsible for inserting those two lines of
debugging / error messages in pxa27x-udc.c: Thanks!!!

Cheers,

Chris
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux