<dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><small id="yhprb"></small><dfn id="yhprb"></dfn><small id="yhprb"><delect id="yhprb"></delect></small><small id="yhprb"></small><small id="yhprb"></small> <delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"></dfn><dfn id="yhprb"></dfn><s id="yhprb"><noframes id="yhprb"><small id="yhprb"><dfn id="yhprb"></dfn></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><small id="yhprb"></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn> <small id="yhprb"></small><delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn>

新聞中心

EEPW首頁(yè) > 嵌入式系統 > 設計應用 > S5PV210(TQ210)學(xué)習筆記——USB HOST移植

S5PV210(TQ210)學(xué)習筆記——USB HOST移植

作者: 時(shí)間:2016-11-28 來(lái)源:網(wǎng)絡(luò ) 收藏
在寫(xiě)USB驅動(dòng)程序的時(shí)候意外發(fā)現默認狀態(tài)下內核沒(méi)有驅動(dòng)S5PV210的USB HOST控制器,于是,我自己動(dòng)手移植了一下S5PV210的USB HOST模塊,S5PV210的USB HOST控制器跟S3C2440的有些不同,S5PV210同時(shí)支持EHCI和OHCI接口(兩者的區別自己谷歌搜一下),這樣,S5PV210在功能上就完全支持USB2.0接口了。

Linux內核(以3.8.3為例)默認僅提供了ehci-s5p.c,但是提供了很多其他平臺的ohci源碼,因此,我們可以參考ohci-exynos.c來(lái)編寫(xiě)自己的ohci-s5p.c,然后參考ehci-s5p.c的代碼組織方式添加到內核就可以了。下面廢話(huà)少說(shuō),直接進(jìn)入正題,開(kāi)始USB HOST的EHCI和OHCI移植。

本文引用地址:http://dyxdggzs.com/article/201611/322811.htm

一 編寫(xiě)自己的ohci-s5p.c

我們以ohci-exynos.c為模板,修改以適合我們的S5P平臺。

(1)拷貝ohci-exynos.c為ohci-s5p.c

(2)替換所有的exynos為s5p

(3)由于有些地方是exynos4,所以,還需要將s5p4替換為s5p

(4)如果是3.4版本的內核不需要修改頭文件,但是3.8.3內核對文件結構作了調整,還是將ohci-exynos.h頭文件改為:

  1. #include

二 修改drivers/usb/host目錄下的相關(guān)文件

(1)打開(kāi)ohci-hcd.c文件,找到ohci-exynos,然后再其前面添加S5P平臺支持,修改后如下:

  1. #ifdefCONFIG_USB_OHCI_S5P
  2. #include"ohci-s5p.c"
  3. #definePLATFORM_DRIVERs5p_ohci_driver
  4. #endif
  5. #ifdefCONFIG_USB_OHCI_EXYNOS
  6. #include"ohci-exynos.c"
  7. #definePLATFORM_DRIVERexynos_ohci_driver
  8. #endif
(2)打開(kāi)Kconfig文件,在config USB_OHCI_EXYNOS前面添加S5P配置支持,修改后如下:
  1. configUSB_OHCI_S5P
  2. boolean"S5POHCIsupport"
  3. dependsonUSB_OHCI_HCD&&PLAT_S5P
  4. help
  5. EnablesupportfortheS5PSOCson-chipOHCIcontroller.
  6. configUSB_OHCI_EXYNOS
  7. boolean"OHCIsupportforSamsungEXYNOSSoCSeries"
  8. dependsonUSB_OHCI_HCD&&ARCH_EXYNOS
  9. help
  10. EnablesupportfortheSamsungExynosSOCson-chipOHCIcontroller.

三 編寫(xiě)usb-ohci-s5p.h頭文件

(1)切換目錄到include/linux/platform_data/,然后拷貝usb-exynos.h到usb-ohci-s5p.h。

(2)打開(kāi)usb-ohci-s5p.h,將所有的exynos4替換為s5p。

(3)將EXYNOS替換為S5P。

完成這三步,ohci的驅動(dòng)就已經(jīng)做好了,但是還需要添加平臺支持。

四 配置平臺支持

(1)切換到目錄arch/arm/plat-samsung,然后打開(kāi)devs.c文件

(2)在CONFIG_S5P_DEV_USB_EHCI模塊后面添加如下內容:

  1. #ifdefCONFIG_S5P_DEV_USB_OHCI
  2. staticstructresources5p_ohci_resource[]={
  3. [0]=DEFINE_RES_MEM(0xEC300000,SZ_256),
  4. [1]=DEFINE_RES_IRQ(S5P_IRQ_VIC1(23)),
  5. };
  6. structplatform_devices5p_device_ohci={
  7. .name="s5p-ohci",
  8. .id=-1,
  9. .num_resources=ARRAY_SIZE(s5p_ohci_resource),
  10. .resource=s5p_ohci_resource,
  11. .dev={
  12. .dma_mask=&samsung_device_dma_mask,
  13. .coherent_dma_mask=DMA_BIT_MASK(32),
  14. }
  15. };
  16. void__inits5p_ohci_set_platdata(structs5p_ohci_platdata*pd)
  17. {
  18. structs5p_ohci_platdata*npd;
  19. npd=s3c_set_platdata(pd,sizeof(structs5p_ohci_platdata),
  20. &s5p_device_ohci);
  21. if(!npd->phy_init)
  22. npd->phy_init=s5p_usb_phy_init;
  23. if(!npd->phy_exit)
  24. npd->phy_exit=s5p_usb_phy_exit;
  25. }
  26. #endif/*CONFIG_S5P_DEV_USB_OHCI*/
(2)添加ohci的頭文件
  1. #include
(3)打開(kāi)Kconfig文件,在S5P_DEV_USB_EHCI模塊后面添加OHCI支持,修改后如下
  1. configS5P_DEV_USB_EHCI
  2. bool
  3. help
  4. CompileinplatformdevicedefinitionforUSBEHCI
  5. configS5P_DEV_USB_OHCI
  6. bool
  7. help
  8. CompileinplatformdevicedefinitionforUSBOHCI
(4)切換到arch/arm/mach-s5pv210目錄,打開(kāi)mach-smdkv210.c,在smdkv210_devices的定義中添加ehci和ohci設備,如下:
  1. #ifdefCONFIG_S5P_DEV_USB_EHCI
  2. &s5p_device_ehci,
  3. #endif
  4. #ifdefCONFIG_S5P_DEV_USB_OHCI
  5. &s5p_device_ohci,
  6. #endif
然后定義platform_data文件,內容如下:
  1. #ifdefCONFIG_S5P_DEV_USB_EHCI
  2. staticstructs5p_ehci_platdatas5p_ehci_platdata;
  3. #endif
  4. #ifdefCONFIG_S5P_DEV_USB_OHCI
  5. staticstructs5p_ohci_platdatas5p_ohci_platdata;
  6. #endif
最后,設置platform_data,在smdkv210_machine_init函數中添加如下內容:
  1. #ifdefCONFIG_S5P_DEV_USB_EHCI
  2. s5p_ehci_set_platdata(&s5p_ehci_platdata);
  3. #endif
  4. #ifdefCONFIG_S5P_DEV_USB_OHCI
  5. s5p_ohci_set_platdata(&s5p_ohci_platdata);
  6. #endif
這樣,就將平臺設備注冊給內核了。


上一頁(yè) 1 2 下一頁(yè)

關(guān)鍵詞: S5PV210USBHOST移

評論


技術(shù)專(zhuān)區

關(guān)閉
国产精品自在自线亚洲|国产精品无圣光一区二区|国产日产欧洲无码视频|久久久一本精品99久久K精品66|欧美人与动牲交片免费播放
<dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><small id="yhprb"></small><dfn id="yhprb"></dfn><small id="yhprb"><delect id="yhprb"></delect></small><small id="yhprb"></small><small id="yhprb"></small> <delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"></dfn><dfn id="yhprb"></dfn><s id="yhprb"><noframes id="yhprb"><small id="yhprb"><dfn id="yhprb"></dfn></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><small id="yhprb"></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn> <small id="yhprb"></small><delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn>