一步一步解決 kernel 2.6 usb host driver.doc_第1頁
一步一步解決 kernel 2.6 usb host driver.doc_第2頁
一步一步解決 kernel 2.6 usb host driver.doc_第3頁
一步一步解決 kernel 2.6 usb host driver.doc_第4頁
全文預(yù)覽已結(jié)束

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

一步一步解決 kernel 2.6 usb host driver (以下討論基于kernel 2.6.11,ARM9 s3c2410,arm-linux-gcc 3.4.1 ) = 2.6在s3c2410上usb host不工作的直接結(jié)果就是提示110錯(cuò)誤: usb 1-1: device descriptor read/64, error -110 追蹤錯(cuò)誤代碼,我們來看看能不能找到導(dǎo)致這個(gè)錯(cuò)誤的線索。 include/asm-generic/errno.h #define EPROTO 71 /* Protocol error */ #define EILSEQ 84 /* Illegal byte sequence */ #define ETIMEDOUT 110 /* Connection timed out */ Documentation/usb/error-codes.txt -EPROTO (*, *) a) bitstuff error b) no response packet received within the prescribed bus turn-around time c) unknown USB error -EILSEQ (*, *) a) CRC mismatch b) no response packet received within the prescribed bus turn-around time c) unknown USB error -ETIMEDOUT (*) No response packet received within the prescribed bus turn-around time. This error may instead be reported as -EPROTO or -EILSEQ. 由此我們可以判斷,這個(gè)錯(cuò)誤與 usb 設(shè)備的超時(shí)有關(guān)。報(bào)告這個(gè)錯(cuò)誤的地方在drivers/usb/core/hub.c中的hub_port_init部分,由于usb_get_device_descriptor獲取 usb 設(shè)備信息的時(shí)候產(chǎn)生了超時(shí)。這樣基本可以確定三種情況,1、usb 設(shè)備及接口有問題;2、usb core有問題;3、usb driver有問題。 我們可以很容易地排除1和2的可能性,問題應(yīng)該在usb driver implement部分造成的。2.6的usb driver把usb規(guī)范中對(duì)usb接口的操作集中到了core里面,針對(duì)不同設(shè)備的implement分別歸為host、gadget、storage等?;敬_定問題就在ohci-s3c2410.c里。 跟蹤進(jìn)入ohci-s3c2410.c,這里面主要完成s3c2410 usb host設(shè)備的初始化工作,包括電源、時(shí)鐘、寄存器等。 其實(shí)很多問題在互聯(lián)網(wǎng)上已經(jīng)被遇到和解決,我們要做的就是多參考別人的成功經(jīng)驗(yàn),這樣可以節(jié)省時(shí)間,同時(shí)能夠幫助我們找到一些思路。借助google這雙強(qiáng)大的翅膀,我們來看看能找到什么: /FAQ.html#ts6 Q: Why doesnt USB work at all? I get “device not accepting address”. A: You may have some problem with your PCI setup thats preventing your USB host controller from getting hardware interrupts. When Linux submits a request, but never hears back from the controller, this is the diagnostic youll see. To see if this is the problem, look at /proc/interrupts to see if the interrupt count for your host controller driver ever goes up. If it doesnt, this is the problem: either your BIOS isnt telling the truth to Linux (ACPI sometimes confuses these things, or setting the expected OS to windows in your BIOS), or Linux doesnt understand what its saying. Sometimes a BIOS fix will be available for your motherboard, and in other cases a more recent kernel will have a Linux fix. You may be able to work around this by passing the noapic boot option to your kernel, or (when youre using an add-in PCI card) moving the USB adapter to some other PCI slot. If youre using a current kernel and BIOS, report this problem to the Linux-kernel mailing list, with details about your motherboard and BIOS. google返回的大量結(jié)果中有個(gè)建議是設(shè)置old_scheme_first標(biāo)志,讓驅(qū)動(dòng)程序優(yōu)先處理采用老式結(jié)構(gòu)的設(shè)備: 設(shè)置old_scheme_first=y 測試結(jié)果并沒有太大幫助,不是這個(gè)原因引發(fā)的。 linux-usb-devel mail list 上Ben大哥正在不斷更新他的ohci-s3c2410 driver,但好像還沒最終完成。 /linux-usb-devel%40/msg33670.html 跟蹤ohci-s3c2410.c,發(fā)現(xiàn)to_s3c2410_info返回NULL,很明顯,是platform_data沒有定義,在 include/asm/arch/usb-control.h中已經(jīng)有struct s3c2410_hcd_info,那么仿照simtec的usb-simtec.c,來構(gòu)造自己的platform_data。 static struct s3c2410_hcd_info smdk2410_usbcfg = .port0 = .flags = S3C_HCDFLG_USED , ; 然后在smdk2410_init中完成初始化: s3c_device_usb.dev.platform_data = &smdk2410_usbcfg; 重新make zImage,情況有所變化: 初始化usb controller的過程中有一行debug信息: s3c2410-ohci: CTRL: TypeReq=0x2303 val=0x8 idx=0x1 len=0 = -115 在include/asm-generic/errno.h中查了一下這個(gè)錯(cuò)誤代碼: #define EINPROGRESS 115 /* Operation now in progress */ 在Documentation/usb/error-codes.txt中的解釋是: -EINPROGRESS URB still pending, no results yet (That is, if drivers see this its a bug.) 這時(shí)無論插入什么USB設(shè)備,USB鼠標(biāo)、U盤、USB無線網(wǎng)卡,都報(bào)告: usb 1-1: new full speed USB device using s3c2410-ohci and address 2 s3c2410-ohci s3c2410-ohci: urb c3c430c0 path 1 ep0in 5ec20000 cc 5 status -110 看上去這兩個(gè)錯(cuò)誤應(yīng)該存在關(guān)聯(lián),可能前面的115錯(cuò)誤導(dǎo)致了后面的110錯(cuò)誤;在跟蹤過程中發(fā)現(xiàn)115錯(cuò)誤是在GetPortStatus時(shí)產(chǎn)生的,從這個(gè)情況來看,可以暫時(shí)屏蔽0hci-s3c2410.c中GetPortStatus的實(shí)現(xiàn)部分,繼續(xù)觀察變化,結(jié)果還是110錯(cuò)誤,因此可以排除115 造成110錯(cuò)誤的假設(shè)。 最后懷疑是時(shí)鐘設(shè)置的問題,便參照2.4.18的代碼在clk_enable(clk);后面加了個(gè)udelay(11);但是錯(cuò)誤還是沒有解決。 那么需要對(duì)ohci-s3c2410.c進(jìn)行詳細(xì)的排查了,2.6把系統(tǒng)資源進(jìn)行了詳細(xì)的分類,這使得驅(qū)動(dòng)程序要完成初始化相應(yīng)設(shè)備寄存器的工作,查遍 ohci-s3c2410.c,竟然沒有對(duì)s3c24102410的UPLLCON進(jìn)行設(shè)置的代碼,問題很可能就在這里,user manual說UPLLCON需要48.00MHz output, 于是在s3c2410_start_hc里增加: _raw_writel(0x7812)|(0x024)|(0x03), S3C2410_UPLLCON); OK!usb host可以工作了,但是在第一次上電還會(huì)出現(xiàn)110錯(cuò)誤,reset后才可以正常,2410上的這個(gè)UPLLCON問題由來已久,2

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論