Tiny210 USB Camera 自动断开

现象:

使用usb camera 在lcd上显示图像时,偶尔发生USB ROOT HUB reset, 导致camera停止工作,

然后发生usb camera自动断开,然后又重新识别,断开又识别。

如果不使用usb camera,就不会发生 usb reset。


分析:

1、怀疑USB供电问题,导致usb不稳定,但是,使用带外接电源的usb,没有任何改善;

2、分析log,是usb异常中断导致,但是仍然无法判断异常的来源;

3、怀疑是驱动问题,更换linux 内核版本,3.4.2、3.7、3.9.7、3.10、3.13几个版本都有同样问题;

4、使用官方kernel 3.0.8就没有问题,确认还是驱动配置问题。但是仍然找不到原因。

使用排除法,移植3.0.8内核,一步一步添加官方驱动,无论与camera usb相关不相关,都要测试。

最终发现问题在LCD的GPIO配置上。


结果:

从Linux主线下载的新版本的kernel后,配置好LCD的时序,发生lcd能够正常工作,所以就没有继续关系LCD的配置,

尤其是 RGB的GPIO配置,甚至都没有把LCD的GPIO配置成功能引脚,但恰巧是这方面的问题。

最终重新配置LCD的gpio 为功能,并设置驱动能力, 经过很长时间的测试USB没有发生reset。


问题log:

[liujia@210]#[  171.257109] lj:port 1, status 0100, change 0001, 12 Mb/s
[  171.257174] usb 1-1: USB disconnect, device number 23
[  171.257219] usb 1-1.2: USB disconnect, device number 24
[  171.522012] usb 1-1: new high-speed USB device number 25 using s5p-ehci
[  171.652422] usb 1-1: New USB device found, idVendor=0424, idProduct=2514
[  171.652480] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[  171.657089] hub 1-1:1.0: USB hub found
[  171.657294] hub 1-1:1.0: 4 ports detected
[  171.857405] lj:port 2, status 0101, change 0000, 12 Mb/s
[  171.942257] usb 1-1.2: new high-speed USB device number 26 using s5p-ehci
[  172.265034] usb 1-1.2: New USB device found, idVendor=046d, idProduct=0825
[  172.265093] usb 1-1.2: New USB device strings: Mfr=0, Product=0, SerialNumber=2
[  172.265154] usb 1-1.2: SerialNumber: F46BE640
[  172.269636] uvcvideo: Found UVC 1.00 device <unnamed> (046d:0825)
[  172.291195] input: UVC Camera (046d:0825) as /devices/platform/s5p-ehci/usb1/1-1/1-1.2/1-1.2:1.0/input/input10
[  174.309219] lj:port 1, status 0100, change 0001, 12 Mb/s
[  174.309283] usb 1-1: USB disconnect, device number 25
[  174.309328] usb 1-1.2: USB disconnect, device number 26
[  174.572011] usb 1-1: new high-speed USB device number 27 using s5p-ehci
[  174.702413] usb 1-1: New USB device found, idVendor=0424, idProduct=2514
[  174.702471] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[  174.706912] hub 1-1:1.0: USB hub found
[  174.707163] hub 1-1:1.0: 4 ports detected
[  174.907402] lj:port 2, status 0101, change 0000, 12 Mb/s
[  174.992252] usb 1-1.2: new high-speed USB device number 28 using s5p-ehci
[  175.315403] usb 1-1.2: New USB device found, idVendor=046d, idProduct=0825
[  175.315462] usb 1-1.2: New USB device strings: Mfr=0, Product=0, SerialNumber=2
[  175.315524] usb 1-1.2: SerialNumber: F46BE640
[  175.320003] uvcvideo: Found UVC 1.00 device <unnamed> (046d:0825)
[  175.341248] input: UVC Camera (046d:0825) as /devices/platform/s5p-ehci/usb1/1-1/1-1.2/1-1.2:1.0/input/input11
[  183.131082] lj:port 1, status 0100, change 0001, 12 Mb/s
[  183.131146] usb 1-1: USB disconnect, device number 27
[  183.131191] usb 1-1.2: USB disconnect, device number 28
[  183.397012] usb 1-1: new high-speed USB device number 29 using s5p-ehci
[  183.527401] usb 1-1: New USB device found, idVendor=0424, idProduct=2514
[  183.527458] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[  183.531947] hub 1-1:1.0: USB hub found
[  183.532271] hub 1-1:1.0: 4 ports detected
[  183.732386] lj:port 2, status 0101, change 0000, 12 Mb/s
[  183.817231] usb 1-1.2: new high-speed USB device number 30 using s5p-ehci
[  184.140261] usb 1-1.2: New USB device found, idVendor=046d, idProduct=0825
[  184.140320] usb 1-1.2: New USB device strings: Mfr=0, Product=0, SerialNumber=2
[  184.140382] usb 1-1.2: SerialNumber: F46BE640
[  184.144692] uvcvideo: Found UVC 1.00 device <unnamed> (046d:0825)
[  184.166384] input: UVC Camera (046d:0825) as /devices/platform/s5p-ehci/usb1/1-1/1-1.2/1-1.2:1.0/input/input12

解决patch:

static void s5pv210_fb_cfg_gpios(unsigned int base, unsigned int nr)
{
	s3c_gpio_cfgrange_nopull(base, nr, S3C_GPIO_SFN(2));

	for (; nr > 0; nr--, base++)
		s5p_gpio_set_drvstr(base, S5P_GPIO_DRVSTR_LV4);
}


void s5pv210_fb_gpio_setup_24bpp(void)
{
#if 0
	s5pv210_fb_cfg_gpios(S5PV210_GPF0(0), 8);
	s5pv210_fb_cfg_gpios(S5PV210_GPF1(0), 8);
	s5pv210_fb_cfg_gpios(S5PV210_GPF2(0), 8);
	s5pv210_fb_cfg_gpios(S5PV210_GPF3(0), 4);

	/* Set DISPLAY_CONTROL register for Display path selection.
	 *
	 * ouput   |   RGB   |   I80   |   ITU
	 * -----------------------------------
	 *  00     |   MIE   |  FIMD   |  FIMD
	 *  01     | MDNIE   | MDNIE   |  FIMD
	 *  10     |  FIMD   |  FIMD   |  FIMD
	 *  11     |  FIMD   |  FIMD   |  FIMD
	 */
	writel(0x2, S5P_MDNIE_SEL);
#endif
	int i;

	for (i = 0; i < 8; i++) {
		s3c_gpio_cfgpin(S5PV210_GPF0(i), S3C_GPIO_SFN(2));
		s3c_gpio_setpull(S5PV210_GPF0(i), S3C_GPIO_PULL_NONE);
	}

	for (i = 0; i < 8; i++) {
		s3c_gpio_cfgpin(S5PV210_GPF1(i), S3C_GPIO_SFN(2));
		s3c_gpio_setpull(S5PV210_GPF1(i), S3C_GPIO_PULL_NONE);
	}

	for (i = 0; i < 8; i++) {
		s3c_gpio_cfgpin(S5PV210_GPF2(i), S3C_GPIO_SFN(2));
		s3c_gpio_setpull(S5PV210_GPF2(i), S3C_GPIO_PULL_NONE);
	}

	for (i = 0; i < 4; i++) {
		s3c_gpio_cfgpin(S5PV210_GPF3(i), S3C_GPIO_SFN(2));
		s3c_gpio_setpull(S5PV210_GPF3(i), S3C_GPIO_PULL_NONE);
	}

	/* mDNIe SEL: why we shall write 0x2 ? */
	writel(0x2, S5P_MDNIE_SEL);

	/* drive strength to 2x ....(max for smdkv210) */
	writel(0xaaaaaaaa, S5PV210_GPF0_BASE + 0xc);
	writel(0xaaaaaaaa, S5PV210_GPF1_BASE + 0xc);
	writel(0xaaaaaaaa, S5PV210_GPF2_BASE + 0xc);
	writel(0x000000aa, S5PV210_GPF3_BASE + 0xc);
}



你可能感兴趣的:(Tiny210 USB Camera 自动断开)