am335x otg配置

这段时间在搞am335的东西,在配置otg的时候摔了个大跟头,搞了好久都没有搞出来。

最终皇天不负有心人 还是被我搞定了。

大概讲讲过程

首先是dts
am335x-evm.dts

 798 &usb0 {
 799     status = "okay";
 800     dr_mode = "otg";
 801 };

没有修改33xx的dtsi

然后出来就这这幅德行:

[   57.890442] Unable to handle kernel NULL pointer dereference 
at virtual address 00000004
[   57.898569] pgd = c0004000
[   57.901294] [00000004] *pgd=00000000
[   57.904915] Internal error: Oops: 5 [#1] PREEMPT ARM
[   57.909881] Modules linked in:
[   57.912968] CPU: 0    Not tainted  (3.6.0-rc2-00223-g5bbc5fb #21)
[   57.919095] PC is at musb_g_giveback+0x1c/0x120
[   57.923646] LR is at musb_g_ep0_giveback+0x1c/0x20
[   57.928452] pc : []    lr : []    psr: 80000093
[   57.928452] sp : c06efcd0  ip : 00000000  fp : c06efd04
[   57.939907] r10: fee00400  r9 : fee00500  r8 : fee00500
[   57.945132] r7 : 00000001  r6 : c18160f8  r5 : 00000008  r4 : ffffffcc
[   57.951652] r3 : c18163a8  r2 : 00000000  r1 : ffffffcc  r0 : c1816360
[   57.958175] Flags: Nzcv  IRQs off  FIQs on  Mode SVC_32  ISA ARM 
Segment kernel
[   57.965562] Control: 0005317f  Table: c0c74000  DAC: 00000017
[   57.971307] Process swapper (pid: 0, stack limit = 0xc06ee270)
[   57.977138] Stack: (0xc06efcd0 to 0xc06f0000)
[   57.981515] fcc0:                                     c002dce8 00000000 
40000093 00000008
[   57.989706] fce0: c06efd2e 00000001 00000008 c18160f8 00000001 fee00500 
c06efd14 c06efd08
[   57.997897] fd00: c029ca2c c029dc2c c06efd64 c06efd18 c029d120 c029ca20 
c06efd3c c06efd28
[   58.006088] fd20: c0035988 c0035580 c1816294 06800001 00000100 c06e0040 
c0036420 00000000
[   58.014274] fd40: c18160f8 00000000 00000000 000000f0 00000099 00000008 
c06efdb4 c06efd68
[   58.022463] fd60: c029bd24 c029cd38 c06efd94 c06efd78 c0051988 e8000000 
000000f0 00000099
[   58.030649] fd80: 00000008 c1b61c00 c06efe1c 00000000 c1b61b80 c18160f8 
00080001 00000000
[   58.038838] fda0: 60000093 c0707500 c06efdfc c06efdb8 c02a35dc c029b170 
0003a980 00000000
[   58.047025] fdc0: 005fef40 00000000 fee00000 00000000 0003a980 c1b61b80 
c1b61b80 c06ee000
[   58.055211] fde0: 0000003a 00000000 00000000 c0707500 c06efe3c c06efe00 
c00627cc c02a33dc
[   58.063399] fe00: 0000000d c077b460 c0700580 00000000 c06efe44 c1b61b80 
c0707500 febfd000
[   58.071587] fe20: c06efee4 00000000 c0700580 c06efef8 c06efe54 c06efe40 
c0062a24 c0062734
[   58.079774] fe40: c0707500 00000000 c06efe6c c06efe58 c0065370 c00629d8 
c0022794 0000003a
[   58.087964] fe60: c06efe84 c06efe70 c0062354 c006525c c0023390 0000003a 
c06efe9c c06efe88
[   58.096154] fe80: c0009df4 c006232c c02c2398 00000013 c06efeac c06efea0 
c0008704 c0009d98
[   58.104342] fea0: c06eff34 c06efeb0 c0009078 c0008700 c06efef8 00000013 
75abeb0c 0000000d
[   58.112529] fec0: 74d80b77 0000000d c0700308 00000000 00000000 c0700580 
c06efef8 c06eff34
[   58.120718] fee0: c06efef8 c06efef8 c00502c8 c02c2398 00000013 ffffffff 
75abeb0c 0000000d
[   58.128905] ff00: 00000000 00e6ed3a 00000000 c06ee000 c0700580 c0700580 
00000000 c07687ec
[   58.137095] ff20: 41069265 c0700308 c06eff44 c06eff38 c02c2404 c02c2348 
c06eff64 c06eff48
[   58.145282] ff40: c02c1dfc c02c2400 c06ee000 c0700580 00000000 00000000 
c06eff8c c06eff68
[   58.153474] ff60: c02c25b4 c02c1dec c06ee000 c06f9f74 c06f9ba0 c07743d4 
c0004000 c06cf9ec
[   58.161662] ff80: c06effac c06eff90 c000a674 c02c241c 00000002 c077439c 
c06d1340 c06f9b18
[   58.169852] ffa0: c06effc4 c06effb0 c0404698 c000a604 c06d1340 c06f6ec8 
c06efff4 c06effc8
[   58.178040] ffc0: c06aa9d0 c0404634 ffffffff ffffffff c06aa280 00000000 
00000000 c06d0f3c
[   58.186228] ffe0: 00053175 c06f6018 00000000 c06efff8 c0008040 c06aa70c 
00000000 00000000
[   58.194475] [] (musb_g_giveback+0x1c/0x120) from [] 
(musb_g_ep0_giveback+0x1c/0x20)
[   58.203915] [] (musb_g_ep0_giveback+0x1c/0x20) from 
[] (musb_g_ep0_irq+0x3f8/0xc8c)
[   58.213349] [] (musb_g_ep0_irq+0x3f8/0xc8c) from [] 
(musb_interrupt+0xbc4/0xd98)
[   58.222530] [] (musb_interrupt+0xbc4/0xd98) from [] 
(da8xx_musb_interrupt+0x210/0x2ec)
[   58.232243] [] (da8xx_musb_interrupt+0x210/0x2ec) from 
[] (handle_irq_event_percpu+0xa8/0x2a4)
[   58.242633] [] (handle_irq_event_percpu+0xa8/0x2a4) from 
[] (handle_irq_event+0x5c/0x7c)
[   58.252505] [] (handle_irq_event+0x5c/0x7c) from [] 
(handle_edge_irq+0x124/0x164)
[   58.261774] [] (handle_edge_irq+0x124/0x164) from 
[] (generic_handle_irq+0x38/0x40)
[   58.271209] [] (generic_handle_irq+0x38/0x40) from 
[] (handle_IRQ+0x6c/0x90)
[   58.280029] [] (handle_IRQ+0x6c/0x90) from [] 
(asm_do_IRQ+0x14/0x18)
[   58.288151] [] (asm_do_IRQ+0x14/0x18) from [] 
(__irq_svc+0x38/0x84)
[   58.296147] Exception stack(0xc06efeb0 to 0xc06efef8)
[   58.301216] fea0:                                     c06efef8 00000013 
75abeb0c 0000000d
[   58.309405] fec0: 74d80b77 0000000d c0700308 00000000 00000000 c0700580 
c06efef8 c06eff34
[   58.317584] fee0: c06efef8 c06efef8 c00502c8 c02c2398 00000013 ffffffff
[   58.324253] [] (__irq_svc+0x38/0x84) from [] 
(cpuidle_wrap_enter+0x60/0xb8)
[   58.332994] [] (cpuidle_wrap_enter+0x60/0xb8) from 
[] (cpuidle_enter_tk+0x14/0x1c)
[   58.342335] [] (cpuidle_enter_tk+0x14/0x1c) from [] 
(cpuidle_enter_state+0x20/0x74)
[   58.351764] [] (cpuidle_enter_state+0x20/0x74) from 
[] (cpuidle_idle_call+0x1a8/0x30c)
[   58.361457] [] (cpuidle_idle_call+0x1a8/0x30c) from 
[] (cpu_idle+0x80/0xf0)
[   58.370218] [] (cpu_idle+0x80/0xf0) from [] 
(rest_init+0x74/0x8c)
[   58.378130] [] (rest_init+0x74/0x8c) from [] 
(start_kernel+0x2d4/0x33c)
[   58.386505] Code: e24dd014 e1a00000 e1a04001 e281c034 (e59c1004) 
[   58.392613] ---[ end trace 48691b979d3d6004 ]---
[   58.397239] Kernel panic - not syncing: Fatal exception in interrupt
[   58.403595] Rebooting in 1 seconds..OMAP-L138 initialization passed!

这个不是我的具体的调试记录,但是基本差不多,主要问题还是在

[   57.919095] PC is at musb_g_giveback+0x1c/0x120
[   57.923646] LR is at musb_g_ep0_giveback+0x1c/0x20

这一块

后来在网上找到解决方案

Just coming back to say that I solved this issue by editing the Device Tree. Change dr_mode of usb0 in am335x-bone-common.dtsi to “peripheral” (was “host”) and then recompile the dtb. I’m not sure why, but when I tried specifying “otg”, it still didn’t work.

         usb@47401000 {
            status = "okay";
            dr_mode = "peripheral";   
         };

FYI, by configuring the USB0 port as peripheral in the device tree, I was able to get the ethernet-over-usb gadgets to work.
« Last Edit: August 28, 2015, 08:42:21 AM by BrianBrianBrian »

以上回答来自BrianBrianBrian 在此表示感谢

dr_mode = "otg";   

变成

dr_mode = "peripheral";   

以下是我linux,usb部分的内核选项,内核版本linux-3.12.10-ti2013.12.01


#
# USB Host Controller Drivers
#
# CONFIG_USB_C67X00_HCD is not set
CONFIG_USB_XHCI_HCD=y
CONFIG_USB_XHCI_PLATFORM=m
CONFIG_USB_EHCI_HCD=y
CONFIG_USB_EHCI_ROOT_HUB_TT=y
CONFIG_USB_EHCI_TT_NEWSCHED=y
CONFIG_USB_EHCI_PCI=y
CONFIG_USB_EHCI_HCD_OMAP=y
# CONFIG_USB_EHCI_HCD_PLATFORM is not set
# CONFIG_USB_OXU210HP_HCD is not set
# CONFIG_USB_ISP116X_HCD is not set
# CONFIG_USB_ISP1760_HCD is not set
# CONFIG_USB_ISP1362_HCD is not set
# CONFIG_USB_FUSBH200_HCD is not set
# CONFIG_USB_FOTG210_HCD is not set
CONFIG_USB_OHCI_HCD=y
CONFIG_USB_OHCI_HCD_OMAP3=y
CONFIG_USB_OHCI_HCD_PCI=y
CONFIG_USB_OHCI_HCD_PLATFORM=y
# CONFIG_USB_UHCI_HCD is not set
# CONFIG_USB_SL811_HCD is not set
# CONFIG_USB_R8A66597_HCD is not set
# CONFIG_USB_HCD_TEST_MODE is not set
CONFIG_USB_MUSB_HDRC=y
# CONFIG_USB_MUSB_HOST is not set
# CONFIG_USB_MUSB_GADGET is not set
CONFIG_USB_MUSB_DUAL_ROLE=y
# CONFIG_USB_MUSB_TUSB6010 is not set
# CONFIG_USB_MUSB_OMAP2PLUS is not set
# CONFIG_USB_MUSB_AM35X is not set
CONFIG_USB_MUSB_DSPS=y
# CONFIG_USB_MUSB_UX500 is not set
CONFIG_USB_MUSB_AM335X_CHILD=y
# CONFIG_USB_TI_CPPI41_DMA is not set
CONFIG_MUSB_PIO_ONLY=y
# CONFIG_USB_RENESAS_USBHS is not set

#
# USB Device Class drivers
#
# CONFIG_USB_ACM is not set
# CONFIG_USB_PRINTER is not set
# CONFIG_USB_WDM is not set
# CONFIG_USB_TMC is not set

#
# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may
#

#
# also be needed; see USB_STORAGE Help for more info
#
CONFIG_USB_STORAGE=y
CONFIG_USB_STORAGE_DEBUG=y
# CONFIG_USB_STORAGE_REALTEK is not set
# CONFIG_USB_STORAGE_DATAFAB is not set
CONFIG_USB_STORAGE_FREECOM=y
CONFIG_USB_STORAGE_ISD200=m
# CONFIG_USB_STORAGE_USBAT is not set
CONFIG_USB_STORAGE_SDDR09=y
# CONFIG_USB_STORAGE_SDDR55 is not set
CONFIG_USB_STORAGE_JUMPSHOT=y
# CONFIG_USB_STORAGE_ALAUDA is not set
# CONFIG_USB_STORAGE_ONETOUCH is not set
# CONFIG_USB_STORAGE_KARMA is not set
# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
# CONFIG_USB_STORAGE_ENE_UB6250 is not set

谢谢。

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值