USB xHCI-EHCI

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
bigbob
Member
Member
Posts: 122
Joined: Tue Oct 01, 2013 2:50 am
Location: Budapest, Hungary
Contact:

USB xHCI-EHCI

Post by bigbob »

Hi,

I have a working EHCI-driver, that can read files from FAT32 on a Dell D820 (maybe it was manufactured in 2008).
I bought a Dell Inspiron 5559 in august this year.
The problem is that according to its datasheet (the new Dell), it has one USB3.0 and two USB2.0 ports, so I thought that there were one xHCI and one EHCI controllers in this laptop.
The lspci(see below) on Linux shows only one USB controller: an xHCI.
It seems that the xHCI controller exposes its EHCI-interface. The USB-enumeration found nothing with my EHCI-driver.
I tried to simply change USB-type in the detection/enumeration process of my EHCI driver (check for 0x30(xHCI) instead of 0x20(EHCI) in the Prog-IF of PCI-config-space), but it didn't work (endless loop!?).
I have only run through the xHCI-chapters in Ben Lunt's USB book so far, but I suspect that I have to write the xHCI-driver in order to have USB-support in my OS on this laptop because EHCI doesn't seem to work.
I followed closely Ben's book and source-code (e.g. I didn't modify reserved bits).

The question is that do I have to write an xHCI driver or can I use my current EHCI driver somehow on this laptop?

Regards,
rob
  • 00:00.0 Host bridge: Intel Corporation Sky Lake Host Bridge/DRAM Registers (rev 08)
    00:02.0 VGA compatible controller: Intel Corporation Sky Lake Integrated Graphics (rev 07)
    00:14.0 USB controller: Intel Corporation Sunrise Point-LP USB 3.0 xHCI Controller (rev 21)
    00:14.2 Signal processing controller: Intel Corporation Sunrise Point-LP Thermal subsystem (rev 21)
    00:15.0 Signal processing controller: Intel Corporation Sunrise Point-LP Serial IO I2C Controller (rev 21)
    00:15.1 Signal processing controller: Intel Corporation Sunrise Point-LP Serial IO I2C Controller (rev 21)
    00:16.0 Communication controller: Intel Corporation Sunrise Point-LP CSME HECI (rev 21)
    00:17.0 SATA controller: Intel Corporation Sunrise Point-LP SATA Controller [AHCI mode] (rev 21)
    00:1c.0 PCI bridge: Intel Corporation Device 9d10 (rev f1)
    00:1c.4 PCI bridge: Intel Corporation Sunrise Point-LP PCI Express Root Port (rev f1)
    00:1c.5 PCI bridge: Intel Corporation Sunrise Point-LP PCI Express Root Port (rev f1)
    00:1f.0 ISA bridge: Intel Corporation Sunrise Point-LP LPC Controller (rev 21)
    00:1f.2 Memory controller: Intel Corporation Sunrise Point-LP PMC (rev 21)
    00:1f.3 Audio device: Intel Corporation Sunrise Point-LP HD Audio (rev 21)
    00:1f.4 SMBus: Intel Corporation Sunrise Point-LP SMBus (rev 21)
    01:00.0 Display controller: Advanced Micro Devices, Inc. [AMD/ATI] Sun XT [Radeon HD 8670A/8670M/8690M / R5 M330] (rev ff)
    02:00.0 Network controller: Intel Corporation Wireless 3160 (rev 83)
    03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8101/2/6E PCI Express Fast/Gigabit Ethernet controller (rev 07)
User avatar
BenLunt
Member
Member
Posts: 941
Joined: Sat Nov 22, 2014 6:33 pm
Location: USA
Contact:

Re: USB xHCI-EHCI

Post by BenLunt »

bigbob wrote: The question is that do I have to write an xHCI driver or can I use my current EHCI driver somehow on this laptop?
And the answer is, yes, you have to write an xHCI driver. The xHCI will have a number of USB 3.0 register ports and may have a number of USB 2.0 register ports, though the count of register ports may not match the physical count of sockets (actual ports).

Page 14-4 in my book, section "Is it a USB 2.0 or a USB 3.0 Port?", describes why and how to detect the USB 2.0 and USB 3.0 ports. There are some code examples as well as a binary register dump and a diagram of how this works.

For an example, the xHCI controller may have four (4) register sets, yet only two (2) sockets. Register Set 1 and Set 3 control the first socket while Register Set 2 and 4 control the second. However, this is just an example. The xHCI has a Protocol Capability area that indicates which port register set controls what socket also indicating which set controls USB 2.0 devices and which set controls USB 3.0 devices.

Chapter 14 explains how to extract this information and how and why you must use different register sets depending on the device attached.

Hope this helps, and of course if you have any more questions, please feel free to post here.

Ben
bigbob
Member
Member
Posts: 122
Joined: Tue Oct 01, 2013 2:50 am
Location: Budapest, Hungary
Contact:

Re: USB xHCI-EHCI

Post by bigbob »

BenLunt wrote: And the answer is, yes, you have to write an xHCI driver.
Thanks Ben.
Now I know that I don't have to debug my EHCI-driver.
What I read about xHCI in your book is interesting, so I am looking forward to implementing the xHCI-driver.
I knew that sooner or later I would have to do it.
The source-code that accompanies the book will be very useful.
I thank you again, and hopefully the book and the source-code will be enough without further help.

Regards,
rob
Post Reply