Please note as of Wednesday, August 15th, 2018 this wiki has been set to read only. If you are a TI Employee and require Edit ability please contact x0211426 from the company directory.

DM816x C6A816x AM389x PCIeToUSB

From Texas Instruments Wiki
Jump to: navigation, search

PCIe to USB on DM816x/C6A816x/AM389x Evaluation Board

ABSTRACT

This application note describes using PCI Express (PCIe) to USB Host Controller card on DM816x DaVinci, C6A816x Integra and AM389x Sitara family of devices running Linux kernel from PSP package. This solution addresses the limitation on these devices of not supporting multi-point operation when acting as USB Host, which prevents using USB Hub. In this document, we will consider a third party PCIe-USB Host Controller card having Pericom PCI Express-to-USB 2.0 (PI7C9X442SL) device connected to PCI Express port on DM816x/C6A816x/AM389x Evaluation Board (EVM).

Note: Though this document uses PI7C9X442SL example for PCIe to USB Host Controller, most of the details covered will also be applicable when using any other PCIe to USB Host Controller hardware. Wherever necessary, attention will be brought to specific areas of consideration if going for an alternative PCIe to USB Host solution. Similarly, all the details are applicable to any custom DM816x/C6A816x/AM389x boards provided they have at least x1 PCI Express slot.

For rest of the document, we will refer DM816x, C6A816x and AM389x devices just as DM816x since all of them have PCI Express Root Complex port.

OVERVIEW

DM816x devices have support for PCI Express Root Complex (RC) with up to x2 GEN 2 mode of operation. The PCIe RC Driver included in PSP Linux package integrates into Linux PCI Framework and provides transparent interface to PCI/PCIe drivers to operation on respective target devices. This opens up possibility of connecting wide range of PCI Express peripherals to the DM816x devices.

For rest of the document, we assume that a Linux Host with complete build environment for building the Linux kernel from PSP package is available to the user. This document also assumes that the reader is aware about building Linux kernel, PCIe and USB concepts.

SETUP

The hardware setup involves plugging PCIe card with Pericom PI7C9X442SL into the PCI Express slot on DM816x EVM. It is advisable to have a USB device such as a USB Pen Drive handy to verify that the system is working. We assume that the kernel from latest PSP release 04.00.00.07 or later is flashed into the persistent memory (e.g., NAND) on the board and kernel root shell is available after EVM is powerd on. Note that, some PCIe-USB card may require external power to be supplied. In such case, ensure that the PCIe card is supplied power before turing on the EVM.

PCIe Topology

The figure below shows simplified topology when using PCI Extress to USB card. The Linux PCI framework provides transparent interface for USB over PCIe.

PCIe Topology RC PCI Bridge DM816x C6A816x AM389x.png

Building Kernel Modules for USB Support

The PI7C9X442SL device has OHCI and EHCI compliant USB Controllers which are not built into default PSP kernel. So we either need to rebuild the kernel with EHCI and OHCI drivers included or build them as loadable modules and use with pre-built kernel.

  • Note 1: For custom DM816x boards, the kernel from release package may not work and need to be ported.
  • Note 2: You will need to select different USB host driver(s) if the selected PCIe-USB card is not based on PI7C9X442SL and has non EHCI/OHCI USB Controller.
  • Note 3: The USB host driver should support access over PCI

Follow steps listed below for building the required USB drivers as modules:

  1. Navigate to PSP kernel source directory on Linux Host
  2. Ensure that the default kernel configuration is created. For example, the default EVM configuration is done with make ti8168_evm_defconfig
  3. Enter the kernel interactive configuration menu with make menuconfig.
  4. Select following USB Host Controller drivers to be built as modules by navigating to Device Drivers ---> USB support --->
    • EHCI HCD (USB 2.0) support
    • OHCI HCD support
  5. Exit the kernel configuration, you will be prompted to save the configuration, select "Yes"
  6. Build modules using make modules
  7. This will build ehci-hcd.ko and ohci-hcd.ko

Verifying PCIe Device Detection

Assuming the setup is powered on, the DM816x kernel should already have detected the USB card connected over PCIe. This can be validated by using 'lspci -v' command at shell. In case 'lspci' command is not available, you can simply dump the contents inside "c" directory to confirm PCIe/PCI devices are detected on the PCIe port.

An empty output of lspci or /sys/bus/pci/devices without any sub-directories would mean that the PCIe device is not detected and it may be good to verify setup and try power cycling.

Once you confirm that the PCIe-USB card is successfully detected, proceed to next step as described below.

Enabling USB over PCIe

Now we are ready to load the USB modules and enable access to USB ports over PCIe. Note that if the kernel was rebuilt with USB Host drivers built into kernel (that is not as loadable modules), then the steps for loading modules are not necessary and you can proceed to use the USB ports.

  1. Ensure that the USB Host modules built are copied to a TFTP/FTP server directory or to NFS directory if using NFS mounted root filesystem. We assume the modules ehci-hcd.ko and ohci-hcd.ko are present in modules directory.
  2. Execute following commands at the shell:
    insmod ehci-hcd.ko
    insmod ohci-hcd.ko
  3. Connect the USB pendrive to one of the USB ports
  4. USB devices will be detected and mounted/activated automatically if a device manager such as 'udev' is running

References

  • TI816X PSP User Guide: TI816x-PSP-[version]_UserGuide.pdf in the release package document directory describes steps for building and booting the kernel. Here [version] can be 04.00.00.07, 04.00.00.08 and so on.
  • Pericom PI7C9X442SL information available at http://www.pericom.com/products/packetswitch/PI7C9X442SL/


DISCLAIMER: Various trademarks used in this document are copyrights of respective owners