We welcome your feedback. Send it to wired.support@philips.com
Philips Semiconductors - Asia Product Innovation Centre
Visit www.semiconductors.philips.com/buses/usb
or www.flexiusb.com
.
Philips Semiconductors ISP1362 Linux Stack User’s Guide
This is a legal agreement between you (either an individual or an entity) and Philips Semiconductors. By accepting
this product, you indicate your agreement to the disclaimer specified as follows:
DISCLAIMER
PRODUCT IS DEEMED ACCEPTED BY RECIPIENT. THE PRODUCT IS PROVIDED “AS IS” WITHOUT
WARRANTY OF ANY KIND. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, PHILIPS
SEMICONDUCTORS FURTHER DISCLAIMS ALL WARRANTIES, INCLUDING WITHOUT LIMITATION ANY
IMPLIED WARRANTIES OF MERCHANT ABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND
NONINFRINGEMENT. THE ENTIRE RISK ARISING OUT OF THE USE OR PERFORMANCE OF THE
PRODUCT AND DOCUMENTATION REMAINS WITH THE RECIPIENT. TO THE MAXIMUM EXTENT
PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL PHILIPS SEMICONDUCTORS OR ITS SUPPLIERS BE
LIABLE FOR ANY CONSEQUENTIAL, INCIDENTAL, DIRECT, INDIRECT, SPECIAL, PUNITIVE, OR OTHER
DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS)
ARISING OUT OF THIS AGREEMENT OR THE USE OF OR INABILITY TO USE THE PRODUCT, EVEN IF
PHILIPS SEMICONDUCTORS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
2.4.1. Mass Storage Disk Emulation ............................................................................................................................................... 8
2.4.2. OTG Applications (OTG Mass Storage Demo/OTG Tools) ........................................................................................... 8
3.1.1. Setting Up the PC and OS...................................................................................................................................................... 9
3.1.2. Setting Up the ISP1362 Evaluation Kit............................................................................................................................... 9
3.1.3. Setting Up the Software.......................................................................................................................................................... 9
3.2. ISP1362 ADD-ON CARD FOR INTEL PXA250 BASED ACCELENT IDP (REV 04).................................................... 11
3.2.1. Setting Up the ISP1362 Add-On Card ..............................................................................................................................11
3.2.2. Host PC Setup..........................................................................................................................................................................11
3.3. ISP1362 ADD-ON CARD FOR INTEL PXA250 BASED ACCELENT IDP (REV 02).................................................... 14
3.3.1. Setting Up the ISP1362 Add-On Card ..............................................................................................................................15
3.3.2. Host PC Setup..........................................................................................................................................................................15
4.1.1. Loading the Stack....................................................................................................................................................................19
4.1.2. Unloading the Stack ...............................................................................................................................................................20
4.2. ISP1362 ADD-ON CARD FOR INTEL PXA250 BASED ACCELENT IDP (REV 04).................................................... 20
4.2.1. Loading the Stack....................................................................................................................................................................20
4.2.2. Unloading the Stack ...............................................................................................................................................................20
4.3. ISP1362 ADD-ON CARD FOR INTEL PXA250 BASED ACCELENT IDP (REV 02).................................................... 20
4.3.1. Initializing the Stack ...............................................................................................................................................................20
4.3.2. Loading the Stack....................................................................................................................................................................21
4.3.3. Unloading the Stack ...............................................................................................................................................................21
4.3.4. Closing the ISP1362 Stack ...................................................................................................................................................21
5.1.1. Global .........................................................................................................................................................................................30
Philips Semiconductors ISP1362 Linux Stack User’s Guide
Figures
Figure 2-1: ISP1362 Linux Stack Architecture ....................................................................................................................................................7
Figure 3-1: ISP1362 Linux Setup Example............................................................................................................................................................9
Figure 3-2 Development setup for Intel PXA250 Based Accelent IDP ..................................................................................................... 11
Figure 3-3 Development setup for Intel PXA250 Based Accelent IDP ..................................................................................................... 15
Figure 4-1: Host Stack Evaluation Example Setup .......................................................................................................................................... 22
Figure 4-4: OTG Mass Storage Application in the IDLE State Snapshot................................................................................................... 24
Figure 4-5: OTG Mass Storage Application in the HOST State Snapshot................................................................................................ 24
Figure 4-7: OTG Application as a Device Snapshot....................................................................................................................................... 26
Figure 4-8 OTG B device accessing remote OTG mass storage device files........................................................................................... 27
Figure 4-9 OTG B closing the session after connected device data access ............................................................................................. 28
Figure 4-10 Operations with OTG A and B devices...................................................................................................................................... 29
Ta b l e s
Table 4-1: OTG Command Line tool Options ............................................................................................................................................... 26
Table 5-1: Global Compilation Flags.................................................................................................................................................................. 30
Table 6-2: Contents of the host Directory...................................................................................................................................................... 31
Table 6-3: Contents of the phci Directory ...................................................................................................................................................... 31
Table 6-4: Contents of the device Directory .................................................................................................................................................. 32
Table 6-5: Contents of the pdc Directory ....................................................................................................................................................... 32
Table 6-6: Contents of the devmscd Directory.............................................................................................................................................. 32
Table 6-7: Contents of the diskemu Directory............................................................................................................................................... 32
Table 6-8: Contents of the otg Directory........................................................................................................................................................ 33
Table 6-9: Contents of the hal Directory......................................................................................................................................................... 33
Table 6-10: Contents of the x86pci Directory ............................................................................................................................................... 33
Table 6-11: Contents of the appl Directory .................................................................................................................................................... 33
Table 6-12: Contents of the otgmsdemo Directory...................................................................................................................................... 33
Table 6-13: Contents of the tools Directory .................................................................................................................................................. 34
Table 6-14: Contents of the objs Directory.................................................................................................................................................... 34
The names of actual companies and products mentioned herein may be the trademarks of their respective owners.
All other names, products, and trademarks are the property of their respective owners.
Philips Semiconductors ISP1362 Linux Stack User’s Guide
1. Introduction
1.1. Purpose
This document explains how to install, configure and use the ISP1362 Linux stack.
1.2. Scope
This document is intended for the users of the ISP1362 evaluation kit on Linux.
1.3. Abbreviations
DCD Device Controller Driver
FSM Finite State Machine
HCD Host Controller Driver
IDP Integrated Development Platform
OS Operating System
OTG On-The-Go
USB Universal Serial Bus
2. Concept
2.1. Overview
The ISP1362 is a single-chip Universal Serial Bus (USB) On-The-Go (OTG) Controller integrated with the USB
Host Controller and the USB Device Controller. The ISP1362 Linux stack is the software for the ISP1362
evaluation kit that operates as an OTG mass storage device.
Using the ISP1362 Linux stack, the ISP1362 can function as:
• A standard USB full-speed mass storage device when connected to a PC running any OS
• A USB full-speed OTG mass storage device when connected to any OTG device
• A USB host when connected to USB peripherals (OTG and non OTG).
The ISP1362 Linux stack is a group of kernel and application modules arranged such that the code can be easily
ported to any other platform running the Linux OS. All the platform-specific modules are made as separate
modules. Besides, the ISP1362 Linux stack can be used as reference code to build OTG device firmware. The
ISP1362 Linux stack is distributed with the complete source code files.
2.2. Stack Architecture
Figure 2-1 shows the software model of the ISP1362 Linux stack. The software stack consists of three modules,
shown in three colors:
• Core modules (these modules are platform-independent)
• Application demo modules
• Porting modules (these are platform-specific or product-specific modules that require porting).
The following subsections briefly explain each module.
Philips Semiconductors ISP1362 Linux Stack User’s Guide
2.3. Core Modules
2.3.1. Host Stack
The host stack consists of the Host Controller Driver (HCD) module. The driver is used for data transfer on the
USB bus for the connected devices. This driver can work in parallel with other HCDs (OHCI HCD, UHCI HCD,
EHCI HCD) present in the kernel. This is a kernel module and the Linux OS has support for USB, connected USB
device class drivers and suitable applications.
Mass Storage disk
emulation
Mass Storage bridge
Mass Storage class driver
USB protocol driver
Device Controller Driver
OTG Mass storage demo/
OTG tools
Linux File System
OTG driver
ISP1362 Hardware Access Layer Driver
Linux operating system
Linux kernel
basic device drivers
USB class drivers
USB core
Host Controller Driver
ISP1362 stack core modules
ISP1362 application modules
Linux kernel drivers
ISP1362 porting modules
ISP1362 Hardware
Figure 2-1: ISP1362 Linux Stack Architecture
2.3.2. Device Stack
The device stack consists of the Device Controller Driver (DCD), the USB protocol driver, and the mass storage
class driver. The DCD is responsible for data transfer over the USB bus. The USB protocol driver responds to the
standard USB protocol requests. The mass storage class driver adds the mass storage functionality to the USB
device, and responds to the mass storage class commands and protocol. The mass storage needs to interface with
the physical mass storage device to perform its operations, and the physical disk is customer platform-specific and
Philips Semiconductors ISP1362 Linux Stack User’s Guide
product-specific. Therefore, this driver communicates with a mass storage bridge (portable). For more information
on the device stack interface, refer to API ISP1362 Device Stack.
2.3.3. OTG Stack
The OTG stack consists of the OTG driver. This driver maintains the OTG software FSM, and coordinates the
host and device functionality switching. It interfaces with OTG applications through the Linux file system. For
more information on this interface, refer to API ISP1362 OTG Stack.
2.4. Application Modules
2.4.1. Mass Storage Disk Emulation
This module is an application module and emulates a physical disk. It responds to a minimal set of SCSI-II
commands, and uses a file system interface to store the physical disk data. This is developed for the OTG mass
storage demo purpose.
2.4.2. OTG Applications (OTG Mass Storage Demo/OTG Tools)
There are two OTG applications:
• A GUI-based application (for PC evaluation kits only)
• A command-line-based application
These applications are used to test the OTG mass storage functionality. These are written for the demo.
2.5. Porting Modules
2.5.1. Hardware Access Layer Driver
The core modules of the ISP1362 (Host Controller Driver, Device Controller Driver and OTG driver)
communicate with the ISP1362 hardware through this driver. Since hardware access is mostly platform-dependent,
this module must be ported to the target platform. This driver provides an interface to the ISP1362 registers and
buffers, to the ISP1362 I/O ports and interrupts, and configures the ISP1362 based on the platform.
2.5.2. Mass Storage Bridge
As physical storage disk is specific to the product, a mass storage bridge is needed. Also, as the mass storage disk
is an emulator in the application space, this layer provides an interface to the application module. You need to
port this layer to interface with the physical disk driver (kernel/application).
3. Installation
The ISP1362 evaluation boards are available in the following platforms:
• ISP1362 PCI evaluation kit
• ISP1362 ISA evaluation kit
TM
• ISP1362 add-on card for Intel PXA250-based Accelent® IDP
.
The ISP1362 Linux stack currently supports the ISP1362 PCI evaluation kit and ISP1362 add-on card for Accelent
IDP. Support for other platforms will soon be added to the stack. The same source code will work for all
platforms by changing the compile time options. The following diagram shows the evaluation kit setup example for
the ISP1362 Linux stack.
Philips Semiconductors ISP1362 Linux Stack User’s Guide
ISP1362 Evaluation
Kit on Machine 1
OTG Cable
ISP1362 Evaluation
Kit on Machine 2
USB Peripherals on Machine 1
USB Peripherals on Machine 2
Figure 3-1: ISP1362 Linux Setup Example
3.1. ISP1362 PCI Evaluation Kit
3.1.1. Setting Up the PC and OS
For one evaluation kit, prepare one PC. The ISP1362 Linux stack does not support two or more boards on one
PC at the same time. Therefore, for the ISP1362 OTG evaluation, you must have two PCs.
The ISP1362 Linux stack can run on any X86 CPU (preferably, Intel
environment). The ISP1362 Linux stack on X86 PCI platform has been tested with Linux kernel version 2.4.20 on
Red Hat distribution. The stack should work with other distributions as well. Linux kernel versions 2.4.21 or
above need a different kernel patch for OTG. Therefore, it is preferable to have a PC running kernel version
2.4.20.
3.1.2. Setting Up the ISP1362 Evaluation Kit
The ISP1362 PCI evaluation kit can be configured in various modes of the ISP1362: the host-only mode, the
peripheral-only mode and the OTG mode. The OTG mode is the default mode for the evaluation kit as well as the
ISP1362 Linux stack. Make sure that the ISP1362 evaluation kit is configured in the OTG mode before using the
software. If you want to use any other mode of the ISP1362, refer to ISP1362 PCI Evaluation Board User’s Guide for
the hardware setup and Section
3.1.3. Setting Up the Software
5.1.1 for the software setup.
This section explains how to install the ISP1362 Linux stack. Explanation on the installation or setting up of USB
device-specific software is beyond the scope of this document.
®
Pentium® or above, for the desktop
3.1.3.1.Setting Up the Linux Kernel
1. Install the Linux kernel source code in a directory (This installation uses /usr/src/linux-otg/). If you do
not have the Linux kernel source code, you can download it from http://www.kernel.org/
Philips Semiconductors ISP1362 Linux Stack User’s Guide
2. Copy the ISP1362 Linux stack (isp1362_linux_sw_stack.tar.gz) to a local directory (This installation
uses
/usr/src/linux-otg).
3. Apply the OTG patch to the kernel:
# cd /usr/src/linux-otg
# tar –zxvf /mnt/cdrom/isp1362_linux_sw_stack.tar.gz
# patch -p1 < 1362/misc/pci/otg_kernel_patch_pci
4. Configure, compile, install and run the new kernel. You can get information on how to configure, compile and
install the new kernel at http://www.tldp.org/HOWTO/kernel-HOWTO.html
. While configuring the kernel,
enable the following options for the ISP1362 Linux stack:
a. Code maturity level options
b. Loadable module support (enable all options)
c. Loop back device support (in block devices)
d. Any other USB options that need to be enabled
5. Reboot the PC, with the new kernel and the ISP1362 PCI evaluation kit.
3.1.3.2.Setting Up the ISP1362 Linux Stack
1. Go to the ISP1362 Linux software stack source top directory.
#cd /usr/src/linux-otg/1362/source
2. Edit the Rules.Make file for any changes in the compilation rules. The changes could be:
a. The kernel source directory is different from the one specified above.
b. Compile time flags, see Section 5.1. If you want any configuration changes. Make sure that PCI_KIT
hardware option is enabled.
3. Compile the ISP1362 Linux stack source code.
#make clean all install
Note: If the compilation fails due to non-existence of the glibconfig.h file, create a dummy file in the
/usr/include directory.
4. Make the setup for the OTG mass storage demo environment
Philips Semiconductors ISP1362 Linux Stack User’s Guide
g
3.2. ISP1362 Add-on Card for Intel PXA250 based Accelent IDP (Rev 04)
Accelent Systems developed the IDP - Integrated Development Platform to speed up the embedded device
development cycles. Accelent IDP provides a feature-rich, cost-effective development platform for embedded
device application and product development.
The ISP1362 Linux stack and the Accelent IDP do not support two or more boards at the same time. Therefore,
for the ISP1362 OTG evaluation, you must have two Accelent IDPs. The ISP1362 Linux stack on Intel PXA250based Accelent IDP platform has been tested with AccelLinux kernel version 2.4.18. Linux kernel versions 2.4.19
or above need a different kernel patch for OTG. Therefore, it is preferable to have Accelent IDP running on
kernel version 2.4.18.
The following figure shows the development environment for Intel PXA250 based Accelent IDP with the ISP1362
evaluation kit.
LAN
Ethernet Cable
Accelent IDP
Runnin
Serial Port Cable
Linux
PC Host
Running Linux
Figure 3-2 Development setup for Intel PXA250 Based Accelent IDP
The following are the requirements for evaluating the ISP1362 stack on Accelent IDP:
• Two Intel PXA250-based Accelents IDPs
• PC host running the Linux operating system
• Installation CD for Accelent IDP
3.2.1. Setting Up the ISP1362 Add-On Card
The ISP1362 add-on card can be configured in various modes of the ISP1362: the host-only mode and the OTG
mode. The OTG mode is the default mode for the add-on card as well as the ISP1362 Linux stack. Make sure that
the ISP1362 add-on card is configured in the OTG mode before using the software. For more information on
hardware setup, refer to the ISP1362 OTG Add-On Evaluation Kit with Intel PXA250 IDP document.
3.2.2. Host PC Setup
Keep the Intel PXA250 based Accelent IDP installation CD on the CDROM drive.
3.2.2.3.Kernel Requirements
The Linux kernel on the Host PC should support ncurses library.
3.2.2.4.ARM Cross Compiler
The ARM toolchain can be copied from the CD provided by the Accelent (arm-linux-gcc2953.tar.bz2).
Don't bother trying to build the tool chain from scratch. The toolchain version 2.95.3 works very well. Don’t use
any of the gcc-3x compilers yet- they generate bad code for ARM in certain instances. Usually the ARM toolchain
should be unzipped in the root directory / of the host PC, using command: