Re: SuperH 7760 OHCI

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, May 26, 2016 at 8:04 PM, Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote:
> On Thu, 26 May 2016, Martin Townsend wrote:
>
>> >> and setting the HCD_MEMORY_LOCAL flag in the HC driver.
>> >
>> > Did you do this correctly?  That is, in the correct driver?
>> >
>> I put the code for the declaring the DMA coherent memory into ohci-platform.c
>> and set the flag in ohci-hcd.c
>
> Okay.  It's not portable, but it's fine for a single system with only
> one controller.
>
>> >> and I get the following error
>> >
>> > ...
>> >> [    1.510000] usb 1-1: new full-speed USB device number 2 using ohci-platform
>> >> [    1.690000] usb 1-1: device descriptor read/64, error -12
>> >> [    1.980000] usb 1-1: device descriptor read/64, error -12
>> >> [    2.270000] usb 1-1: new full-speed USB device number 3 using ohci-platform
>> >> [    2.450000] usb 1-1: device descriptor read/64, error -12
>> >> [    2.740000] usb 1-1: device descriptor read/64, error -12
>> >> [    3.030000] usb 1-1: new full-speed USB device number 4 using ohci-platform
>> >> [    3.450000] usb 1-1: device not accepting address 4, error -12
>> >> [    3.630000] usb 1-1: new full-speed USB device number 5 using ohci-platform
>> >> [    4.050000] usb 1-1: device not accepting address 5, error -12
>> >> [    4.050000] usb usb1-port1: unable to enumerate USB device
>> >
>> > -12 is -ENOMEM on your system?
>> Yes
>> >
>> > ...
>> >> which looks good. Anyone have an idea as to what's wrong or what the
>> >> error messages mean.  I have nothing plugged into the USB ports.
>> >
>> > Nothing plugged into the USB ports?  Then why does the system think
>> > something is plugged in?  It sounds like the driver is not accessing
>> > the right registers.
>> >
>> >>  Also
>> >> any ideas on where to start with debugging this would be appreciated.
>> >
>> > What do you see in /sys/kernel/debug/usb/ohci/*/registers?
>> >
>> root@sh7760:~# cat /sys/kernel/debug/usb/ohci/ohci-platform/registers
>> bus platform, device ohci-platform
>> Generic Platform OHCI controller
>> ohci_hcd
>> OHCI 1.0, NO legacy support registers, rh state running
>> control 0x083 HCFS=operational CBSR=3
>> cmdstatus 0x00000 SOC=0
>> intrstatus 0x00000024 FNO SF
>> intrenable 0x8000005a MIE RHSC UE RD WDH
>> hcca frame 0x0000
>> fmintvl 0xa7782edf FIT FSMPS=0xa778 FI=0x2edf
>> fmremaining 0x800008b0 FRT FR=0x08b0
>> periodicstart 0x2a2f
>> lsthresh 0x0628
>> hub poll timer off
>> roothub.a 02000202 POTPGT=2 NPS NDP=2(2)
>> roothub.b 00000000 PPCM=0000 DR=0000
>> roothub.status 00008002 DRWE OCI
>> roothub.portstatus [0] 0x00000101 PPS CCS
>> roothub.portstatus [1] 0x00000100 PPS
>>
>> Does this look sane?
>
> Yes, except for two things:
>
>         The OCI bit in roothub.status indicates that an OverCurrent
>         condition was present at some point.
>
>         The CCS bit in roothub.portstats[0] indicates that something
>         is plugged into port 1.  If there really is nothing plugged
>         into that port then this is a hardware failure.
>
Hi Alan,

It does look like a HW problem but I just tried the 2.6 kernel image I
have with this dev kit and the USB works fine so I think it's a HW
configuration issue.  I need to understand the HW and 2.6 SH7760 OHCI
driver a bit more especially the SH7760 specific parts.  Like for
instance I noticed that it cleared the NPS and set the PSM bit in the
Root hub config register.  Then looking at the OHCI driver noticed
there was a distrust firmware flag which then alters this again.
Sadly I couldn't get the access to the physical addresses from the 2.6
kernel.  I'll see if I can get some cross tools and get devmem on
there.

The memory problem looks like a silicon bug in the SH7760, we found a
document detailing that the last 4 bytes of each page can be
corrupted.  Also I think the OHCI driver likes to use at least a page
each for the TD and ED caches which leaves nothing for the HCCA.
Anyway I took the memory managment code from the 2.6 OHCI driver I
have and plumbed it in to ohci-mem and then hardcoded ohci->hcca and
ohci->dma_hcca to 0xFE341000 and 0x0 respectively.  Don't know if it
works yet as I'm still getting overcurrent indicator, at least the CCS
bit isn't currently set but then again it doesn't get set when I plug
something in.

I was hoping this could be something that could be merged into
mainline but the more I dig the more it's not looking promising.
Thanks for taking the time to help, I really appreciate it.

- Martin.

> The reason for the ENOMEM errors isn't clear.  You could try adding
> some debugging statements to see exactly where it comes from.  A likely
> spot is the call to hcd_alloc_coherent() in usb_hcd_map_urb_for_dma().
>
> Alan Stern
>
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux