一步一步解決 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),請進(jìn)行舉報或認(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錯誤: usb 1-1: device descriptor read/64, error -110 追蹤錯誤代碼,我們來看看能不能找到導(dǎo)致這個錯誤的線索。 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. 由此我們可以判斷,這個錯誤與 usb 設(shè)備的超時有關(guān)。報告這個錯誤的地方在drivers/usb/core/hub.c中的hub_port_init部分,由于usb_get_device_descriptor獲取 usb 設(shè)備信息的時候產(chǎn)生了超時。這樣基本可以確定三種情況,1、usb 設(shè)備及接口有問題;2、usb core有問題;3、usb driver有問題。 我們可以很容易地排除1和2的可能性,問題應(yīng)該在usb driver implement部分造成的。2.6的usb driver把usb規(guī)范中對usb接口的操作集中到了core里面,針對不同設(shè)備的implement分別歸為host、gadget、storage等。基本確定問題就在ohci-s3c2410.c里。 跟蹤進(jìn)入ohci-s3c2410.c,這里面主要完成s3c2410 usb host設(shè)備的初始化工作,包括電源、時鐘、寄存器等。 其實很多問題在互聯(lián)網(wǎng)上已經(jīng)被遇到和解決,我們要做的就是多參考別人的成功經(jīng)驗,這樣可以節(jié)省時間,同時能夠幫助我們找到一些思路。借助google這雙強大的翅膀,我們來看看能找到什么: /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é)果中有個建議是設(shè)置old_scheme_first標(biāo)志,讓驅(qū)動程序優(yōu)先處理采用老式結(jié)構(gòu)的設(shè)備: 設(shè)置old_scheme_first=y 測試結(jié)果并沒有太大幫助,不是這個原因引發(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中查了一下這個錯誤代碼: #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.) 這時無論插入什么USB設(shè)備,USB鼠標(biāo)、U盤、USB無線網(wǎng)卡,都報告: 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 看上去這兩個錯誤應(yīng)該存在關(guān)聯(lián),可能前面的115錯誤導(dǎo)致了后面的110錯誤;在跟蹤過程中發(fā)現(xiàn)115錯誤是在GetPortStatus時產(chǎn)生的,從這個情況來看,可以暫時屏蔽0hci-s3c2410.c中GetPortStatus的實現(xiàn)部分,繼續(xù)觀察變化,結(jié)果還是110錯誤,因此可以排除115 造成110錯誤的假設(shè)。 最后懷疑是時鐘設(shè)置的問題,便參照2.4.18的代碼在clk_enable(clk);后面加了個udelay(11);但是錯誤還是沒有解決。 那么需要對ohci-s3c2410.c進(jìn)行詳細(xì)的排查了,2.6把系統(tǒng)資源進(jìn)行了詳細(xì)的分類,這使得驅(qū)動程序要完成初始化相應(yīng)設(shè)備寄存器的工作,查遍 ohci-s3c2410.c,竟然沒有對s3c24102410的UPLLCON進(jìn)行設(shè)置的代碼,問題很可能就在這里,user manual說UPLLCON需要48.00MHz output, 于是在s3c2410_start_hc里增加: _raw_writel(0x7812)|(0x024)|(0x03), S3C2410_UPLLCON); OK!usb host可以工作了,但是在第一次上電還會出現(xiàn)110錯誤,reset后才可以正常,2410上的這個UPLLCON問題由來已久,2

溫馨提示

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

評論

0/150

提交評論