Hi, we want to use the Mini2440 with the gadget g_serial . We configure it with the downloaded sources 2.6.32.2-mini2440_20100113. When booting in NOR in supervivi, the Mini2440 is recognized by the host. Then I press [b] to boot the image, and the Mini2440 is recognized as a serial gadget. It's the correct way. But, when booting directly in NAND, the gadget is mounted by the kernel without any error (/dev/ttyGS0 exists) and the host PC never see anything connected. What is missing in my kernel that is done by supervivi ? Thanks Michel
gadget g_serial on mini2440SDK and kernel 2.6.32
I'm pulling my hair out over the same problem. Let me know if you have any progress. My analysis so far: It seems like the low-level UDC driver isn't setting up the device right. For instance, when I boot through supervivi: [root@forehead0 /]# cat /sys/kernel/debug/s3c2410_udc/registers FUNC_ADDR_REG : 0x000D PWR_REG : 0x0000 EP_INT_REG : 0x0000 USB_INT_REG : 0x0000 EP_INT_EN_REG : 0x001F USB_INT_EN_REG : 0x0004 EP0_CSR : 0x0000 EP1_I_CSR1 : 0x0000 EP1_I_CSR2 : 0x0030 EP1_O_CSR1 : 0x0000 EP1_O_CSR2 : 0x0030 EP2_I_CSR1 : 0x0000 EP2_I_CSR2 : 0x0010 EP2_O_CSR1 : 0x0000 EP2_O_CSR2 : 0x0010 but when I boot directly from nand: [root@forehead0 /]# cat /sys/kernel/debug/s3c2410_udc/registers FUNC_ADDR_REG : 0x0000 PWR_REG : 0x0008 EP_INT_REG : 0x0000 USB_INT_REG : 0x0000 EP_INT_EN_REG : 0x0001 USB_INT_EN_REG : 0x0005 EP0_CSR : 0x0000 EP1_I_CSR1 : 0x0000 EP1_I_CSR2 : 0x0020 EP1_O_CSR1 : 0x0000 EP1_O_CSR2 : 0x0020 EP2_I_CSR1 : 0x0000 EP2_I_CSR2 : 0x0020 EP2_O_CSR1 : 0x0000 EP2_O_CSR2 : 0x0020 Note the bit PWR_REG&0x08, which indicates the USB device interface is receiving reset.
Aha, the problem is that there is a pullup resistor on the USB line which is supported for many boards, but not by the drivers for the mini2440. Here is a patch that seems like the right way of fixing it: Index: linux/arch/arm/mach-s3c2440/mach-mini2440.c =================================================================== --- linux/arch/arm/mach-s3c2440/mach-mini2440.c (revision 5) +++ linux/arch/arm/mach-s3c2440/mach-mini2440.c (working copy) @@ -66,6 +66,7 @@ #include <plat/nand.h> #include <plat/pm.h> #include <plat/mci.h> +#include <plat/udc.h> #include <sound/s3c24xx_uda134x.h> @@ -290,6 +291,34 @@ .ignore_unset_ecc = 1, }; +/* + Enable the pullup resistor for the device-side ("gadget") USB port. According to the + Microarmsystems.com schematic there is a 1.5k resistor (R29) between GPC5 and the D+ + line of the USB. + */ +static void mini2440_udc_pullup(enum s3c2410_udc_cmd_e cmd) +{ + switch (cmd) { + case S3C2410_UDC_P_ENABLE : + printk(KERN_INFO "mini2440_udc_pullup enable\n"); + s3c2410_gpio_setpin(S3C2410_GPC(5), 1); + break; + case S3C2410_UDC_P_DISABLE : + printk(KERN_INFO "mini2440_udc_pullup disable\n"); + s3c2410_gpio_setpin(S3C2410_GPC(5), 0); + break; + case S3C2410_UDC_P_RESET : + printk(KERN_INFO "mini2440_udc_pullup reset\n"); + break; + default: + break; + } +} + +static struct s3c2410_udc_mach_info mini2440_udc_cfg __initdata = { + .udc_command = mini2440_udc_pullup, +}; + /* DM9000AEP 10/100 ethernet controller */ #define MACH_MINI2440_DM9K_BASE (S3C2410_CS4 + 0x300) @@ -369,8 +398,13 @@ #endif s3c_i2c0_set_platdata(NULL); + s3c24xx_udc_set_platdata(&mini2440_udc_cfg); + s3c2410_gpio_cfgpin(S3C2410_GPC(0), S3C2410_GPC0_LEND); + /* pullup for usb device (gadget) port */ + s3c2410_gpio_cfgpin(S3C2410_GPC(5), S3C2410_GPIO_OUTPUT); + s3c_device_nand.dev.platform_data = &friendly_arm_nand_info; s3c_device_sdi.dev.platform_data = &mini2440_mmc_cfg; platform_add_devices(mini2440_devices, ARRAY_SIZE(mini2440_devices));
Hi Trevor, I found there were a power problem but not enough knowledge to solve it. I applied your patch, and now the serial port is mounted in a nand boot process. Thanks