
Introduction:
+++++++++++++
This is a USB gadget driver for Marvell Orion chip:
There are two Linux Gadget examples are working above the gadget driver
mv_udc.ko  - an Orion USB device Gadget driver module.
g_file_storage.ko - a Kernel USB file storage gadget module.
g_ether.ko        - a Kernel USB Ethernet gadget module

In order to use this module make sure that one of USB Controllers on the board 
is configured as a USB device. It means that the UBoot environment variable usb0Mode 
(or usb1Mode if exist) is set to "device".

Compile:
++++++++

To compile mv_udc.ko:
1. Go to linux Kernel directory
2. Choose in the config option 'USB Gadget Support' 
   and choose 'USB Peripheral Controller' to be 'Marvell USB Device Port'.
   Select 'USB Gadget Drivers' as a module and select 'File-backed Storage Gadget' as a module.
3. make modules
4. Copy g_file_storage.ko and g_ether.ko from drivers/usb/gadget/
5. Copy mv_udc.ko from arch/arm/plat-orion/mv_hal_drivers/mv_drivers_lsp/mv_udc/


Run g_file_storage.ko example:
++++
Under the ARM FS:
    On the first time we need to create a file which will be use as the gadget file storage:
    'dd bs=1M count=64 if=/dev/zero of=/root/diskFile'   # 64M file storage initialized with zeros 

    Load modules:
    'insmod mv_udc.ko'

    With NFS:
    --------
    'insmod g_file_storage.ko file=/root/diskFile use_directio=0'

    With HD:
    --------
    'insmod g_file_storage.ko file=/root/diskFile'	

Connect a USB cable from the device connector on the Orion to a Host computer.

On the first connection we need to initialize the disk:
----------------------
 on windows :
	    choose my computer + right_click -> manage:
	    choose Disk management:	
	    initialize the new Disk and create a partition on it.
 on Linux :
  X - storage id (a,b,c ..)  Y - partition id (1,2,..) DIR - directory name.
  --create partition table:
        'fdisk /dev/sdX' (check help for more info, p - display all partition
                                                n - create a new partition (use primary)
                                                d - delete a partition
                                                w - write changes made to the HD)
  --create a new FS on one of the partitions:
        'mkfs.ext3 /dev/sdXY'

  --mount one of the partitions:
        'mkdir /root/mnt/DIR'
        'mount /dev/sdXY /root/mnt/DIR'


Run g_ether.ko example:
++++
Under the ARM FS:
-----------------
    Load modules:
    'insmod mv_udc.ko'
    'insmod g_ether.ko'

    Configure USB interface:
    'ifconfig usb0 11.4.0.1'

Connect a USB cable from the device connector on the Orion to a Host computer.

On Host computer:
-----------------
on windows :
    choose My Network Places + right_click -> Properties
    choose Linux USB Ethernet/RNDIS Gadget connection + right_click -> Properties
    Configure specific IP address for this interface (e.g. 11.4.0.100)


