
Introduction:
+++++++++++++
This is a USB gadget driver for Marvell SoC:
There are two Linux Gadget examples are working above the gadget driver
mv_usb_gadget.ko  - an 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_usb_gadget.ko:
1. Go to linux Kernel directory
...
To compile g_file_storage.ko and g_ether.ko:
1. Choose in the config option 'Support for USB Gadgets' to be module 'M' 
   and choose 'USB Peripheral Controller' to be 'Dummy HCD'
2. => M=arch/arm/plat-feroceon/mv_drivers_lsp/mv_udc
3. Copy g_file_storage.ko and g_ether.ko from drivers/usb/gadget/


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 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_usb_gadget.ko'
    'insmod g_ether.ko'

    Configure USB interface:
    'ifconfig usb0 11.4.0.1'

Connect a USB cable from the device connector 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)


