- 论坛徽章:
- 0
|
isp1160芯片的驱动终于移植成功了,在这个过程中也遇到了很多困难,感受最大的是要做好linux设备驱动移植必须很好的利用google这个宝库。我的感觉是google可以找到你想要的任何信息,如果你没有找到那么90%是因为搜索的方法不对。
我的平台是诚拓科技的IXP425开发板,系统用的是snapgear-3.4.0,里面的内核版本是2.6.17。
下面是我在网上找到的一些资源:
http://www.artecdesign.ee/~ok/isp116x/
http://www.mail-archive.com/linux-usb-devel@lists.sourceforge.net/msg44127.html
我在这说一下我遇到的一些问题,以及它们是如何解决的:
如果提示:
116x: Invalid chip ID b2c8
isp116x-hcd isp116x-hcd.0: startup error -19
116x: init error, -19
或者
116x: Clock not ready after 15ms
116x: Please make sure that the H_WAKEUP pin is pulled low!
isp116x-hcd isp116x-hcd.0 : can't setup
116x: init error, -19
在 include/asm-generic/error-base.h中可以找到error 19的定义:
#define ENODEV 19 /* No such device */
是说找不到设备。问题可能出在两个方面,一个是 isp116x_pfm_resources中USB_IO_PHYS定义的地址和实际开发板上面的不一致;另一个是驱动程序中读写寄存器的命令有问题。
仔细确认过ixp425扩展总线的地址以后问题还是存在,在linux-usb-devel 邮件列表上找到一个相关的问题,有人回复说是大小端的问题。于是将isp116x.h中读写寄存器的命令做相应的修改:
用 __raw_readw/writew 代替原来的 readw/writew。
但是结果仍然有116x: Invalid chip ID b2c8的错误,参考诚拓提供的2.4内核的驱动,在驱动初始化时先进行扩展总线寄存器的配置:
*(unsigned long *)IXP4XX_EXP_CS5 = 0x985f3c42;
这样上面提到的错误算是解决了,但加载驱动模块之后会提示端口过流的提示:
isp116x-hcd isp116x-hcd.0: irq 24, io base 0x55800002
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 2 ports detected
hub 1-0:1.0: over-current change on port 1
# hub 1-0:1.0: over-current change on port 2
hub 1-0:1.0: over-current change on port 1
hub 1-0:1.0: over-current change on port 2
hub 1-0:1.0: over-current change on port 1
hub 1-0:1.0: over-current change on port 2
hub 1-0:1.0: over-current change on port 1
hub 1-0:1.0: over-current change on port 2
......
仔细阅读了ISP1160的datasheet以及相关文档后发现,内核提供的驱动没有按芯片厂商的建议关掉端口电源选择管理(Power Switch Manage),可能正是这个原因造成过流报警。于是按照参考设计重新设置了寄存器,过流警告不在出现了。
// val |= RH_A_PSM;
val |= RH_A_NPS;
// val |= RH_A_OCPM;
val |= RH_A_NOCP;
// val = RH_B_PPCM;
// isp116x_write_reg32(isp116x, HCRHDESCB, val);
isp116x_write_reg32(isp116x, HCRHSTATUS, RH_HS_LPSC);
现在加载模块正常了,但插入U盘之后又会报错:
usb 1-2: new full speed USB device using isp116x-hcd and address 10
usb 1-2: device descriptor read/64, error -32
usb 1-2: device descriptor read/64, error -32
usb 1-2: new full speed USB device using isp116x-hcd and address 11
usb 1-2: device descriptor read/64, error -32
usb 1-2: device descriptor read/64, error -32
usb 1-2: new full speed USB device using isp116x-hcd and address 12
usb 1-2: device not accepting address 12, error -32
usb 1-2: new full speed USB device using isp116x-hcd and address 13
usb 1-2: device not accepting address 13, error -32
error-base.h中对error的定义是:
#define EPIPE 32 /* Broken pipe */
说明isp1160芯片在和U盘之间传送数据的时候出了问题,经过google以及多次尝试发现还是大小端的问题!
将isp116x.h中的 __raw_readw/writew 改为 readw/writew。
修改ram读写函数后问题终于解决,下面是完整的系统信息:
116x: driver isp116x-hcd, 03 Nov 2005
isp116x-hcd isp116x-hcd.0: ISP116x Host Controller
isp116x-hcd isp116x-hcd.0: new USB bus registered, assigned bus number 1
isp116x-hcd isp116x-hcd.0: irq 24, io base 0x55800002
usb usb1: Product: ISP116x Host Controller
usb usb1: Manufacturer: Linux 2.6.17-uc1 isp116x-hcd
usb usb1: SerialNumber: isp116x-hcd.0
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 2 ports detected
usb 1-2: new full speed USB device using isp116x-hcd and address 2
usb 1-2: Product: USB Flash Memory
usb 1-2: SerialNumber: 04B0727141505923
usb 1-2: configuration #1 chosen from 1 choice
ub(1.2): GetMaxLUN returned 0, using 1 LUNs
/dev/ub/a: p1
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/39236/showart_309294.html |
|