Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12618 Discussions

Developing USB Mass storage drivers..

Altera_Forum
Honored Contributor II
1,174 Views

Hi guys, 

 

I'm tasked to make our FPGA board (Altera Stratix II with NiosII core w/ Microtronix uCLinux version 1.4) able to write data out to a USB hard drive (like a LaCie drive). The USB port is OTG. Currently, the driver for writing data out to the USB port has been written, but it doesn't have the mass-storage protocol yet. I was wondering where can I learn how to so (newbie to developing drivers)? 

 

We use CAST USB core. When I boot up the uCLinux, this is the message we are getting. (Just FYI ..if it provides any info about our board at all) 

 

nios2-terminal: connected to hardware target using JTAG UART on cable 

nios2-terminal: "USB-Blaster [USB-0]", device 2, instance 3 

nios2-terminal: (Use the IDE stop button or Ctrl-C to terminate) 

 

Linux version 2.6.11-uc0 (jeff@Andromeda) (gcc version 3.4.1 (Altera Nios II 5.1 

b73))# 938 Fri Aug 11 21:23:31 EDT 2006 

 

 

uClinux/Nios II 

Altera Nios II support © 2004 Microtronix Datacom Ltd. 

 

setup_arch: No persistant network settings signature at 03FF0000 

Built 1 zonelists 

Kernel command line: root=/dev/mtdblock3 ro 

PID hash table entries: 256 (order: 8, 4096 bytes) 

Dentry cache hash table entries: 8192 (order: 3, 32768 bytes) 

Inode-cache hash table entries: 4096 (order: 2, 16384 bytes) 

Memory available: 30368k/32768k RAM, 0k/0k ROM (1709k kernel code, 316k data) 

Mount-cache hash table entries: 512 (order: 0, 4096 bytes) 

NET: Registered protocol family 16 

SCSI subsystem initialized 

usbcore: registered new driver usbfs 

usbcore: registered new driver hub 

comms: FPGA version: 1.2.9 

 

JFFS2 version 2.2. (NAND) © 2001-2003 Red Hat, Inc. 

NIOS serial driver version 0.0 

ttyS0 (irq = 10) is a builtin NIOS UART 

Serial: JTAG UART driver $Revision: 1.4 $ 

ttyJ0 at MMIO 0x87000000 (irq = 9) is a jtag_uart 

io scheduler noop registered 

io scheduler anticipatory registered 

io scheduler deadline registered 

io scheduler cfq registered 

RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize 

mtip_probe:eth0, 100000 Khz Nios (VSC8211) (PIO) 

MoreThanIP 10/100/1000 Driver(v1.0), Linux 2.6.5 Apr2004 

mtip_find_phy: found target PHY at address 2 

mtip_probe:PHY reg17 = 0x1a34 

mtip_probe:eth0, REV=0x00010023, (VSC8211) Phyaddr:0x02 

WARNING: No MAC address found in flash at address 0x07fc0000. Using non-unique 

MAC address of 00:07:ed:00:00:00 

ADDR: 00:07:ed:00:00:00: 

mtip_probe:eth1, 100000 Khz Nios (VSC8211) (PIO) 

Altera NDK flash (AMD): Found 1 x16 devices at 0x0 in 8-bit bank 

Amd/Fujitsu Extended Query Table at 0x0040 

Altera NDK flash (AMD): CFI does not contain boot bank location. Assuming top. 

number of CFI chips: 1 

cfi_cmdset_0002: Disabling erase-suspend-program due to code brokenness. 

cmdlinepart partition parsing not available 

RedBoot partition parsing not available 

Using Altera NDK partition definition 

Creating 7 MTD partitions on "Altera NDK flash (AMD)": 

0x00300000-0x00b00000 : "COP - romfs" 

0x00000000-0x00300000 : "COP - loader/kernel" 

0x00b00000-0x02000000 : "COP - jffs2" 

0x02300000-0x02b00000 : "FEP - romfs" 

0x02000000-0x02300000 : "FEP - loader/kernel" 

0x02b00000-0x03000000 : "FEP - jffs2" 

0x03000000-0x04000000 : "FPGA Code" 

cast_usb: driver cast-hcd, 15 Jan 2006 

cast_usb: USB Host Controller, irq 0 

cast_usb: USB Host Controller, irq 2 

cast-hcd cast-hcd: new USB bus registered, assigned bus number 1 

usb usb1: Product: USB Host Controller 

usb usb1: Manufacturer: uClinux 2.6.11-uc0 cast-hcd 

usb usb1: SerialNumber: cast-hcd 

hub 1-0:1.0: USB hub found 

hub 1-0:1.0: 1 port detected 

CASTUSB: Timeout waiting for OTG negotiation 

cast_hub_control: Jumper 3 installed 

cast_hub_control: JUMPERREG: c0060000 

cast_hub_control: JUMPERREG: c0060000 

Initializing USB Mass Storage driver... 

usbcore: registered new driver usb-storage 

USB Mass Storage support registered. 

cast-udc-sas: loaded. 

cast-udc-veh: loaded. 

miser_sas gadget: Miser SAS, version: 15 Jan 2006 

cast-udc-sas: registered gadget driver 'miser_sas' 

cast-udc-sas: Entered IDLE state 

cast-udc-sas: Entered PERIPHERAL state 

cast-udc-sas: Entered PERIPHERAL state 

miser_veh gadget: Miser VEH, version: 15 Jan 2006 

cast-udc-veh: registered gadget driver 'miser_veh' 

cast-udc-veh: Entered IDLE state 

cast-udc-veh: Entered PERIPHERAL state 

cast-udc-veh: Entered PERIPHERAL state 

NET: Registered protocol family 2 

IP: routing cache hash table of 512 buckets, 4Kbytes 

TCP established hash table entries: 2048 (order: 2, 16384 bytes) 

TCP bind hash table entries: 2048 (order: 1, 8192 bytes) 

TCP: Hash tables configured (established 2048 bind 2048) 

VFS: Mounted root (romfs filesystem) readonly. 

Freeing unused kernel memory: 68k freed (0x41da000 - 0x41ea000) 

expand: from=/ramfs.img to=/dev/ram0 

expand: from=/ramfs.img to=/dev/ram1 

mtip_phy_configure:eth0, autoneg complete 

PhyCtl0: 1000 PhySts1: 796D PhyID1: 000F 

PhyID2: C4B1 PhyAdv4: 01E1 PhyRemcap5: 0020 

 

mtip_phymac_synch:eth0 MR1: 0x0000796D 

Autoneg'd 

Link OK: 

HalfD 

10BASE-T 

CMDCF: 0x00000603
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
350 Views

 

--- Quote Start ---  

originally posted by shachris23@Aug 14 2006, 09:11 AM 

hi guys, 

 

i'm tasked to make our fpga board (altera stratix ii with niosii core w/ microtronix uclinux version 1.4) able to write data out to a usb hard drive (like a lacie drive). the usb port is otg. currently, the driver for writing data out to the usb port has been written, but it doesn't have the mass-storage protocol yet. i was wondering where can i learn how to so (newbie to developing drivers)? 

 

we use cast usb core. when i boot up the uclinux, this is the message we are getting. (just fyi ..if it provides any info about our board at all) 

 

nios2-terminal: connected to hardware target using jtag uart on cable 

nios2-terminal: "usb-blaster [usb-0]", device 2, instance 3 

nios2-terminal: (use the ide stop button or ctrl-c to terminate) 

 

linux version 2.6.11-uc0 (jeff@andromeda) (gcc version 3.4.1 (altera nios ii 5.1 

b73))# 938 fri aug 11 21:23:31 edt 2006 

 

send me your config file pls 

 

uclinux/nios ii 

altera nios ii support © 2004 microtronix datacom ltd. 

 

setup_arch: no persistant network settings signature at 03ff0000 

built 1 zonelists 

kernel command line: root=/dev/mtdblock3 ro 

pid hash table entries: 256 (order: 8, 4096 bytes) 

dentry cache hash table entries: 8192 (order: 3, 32768 bytes) 

inode-cache hash table entries: 4096 (order: 2, 16384 bytes) 

memory available: 30368k/32768k ram, 0k/0k rom (1709k kernel code, 316k data) 

mount-cache hash table entries: 512 (order: 0, 4096 bytes) 

net: registered protocol family 16 

scsi subsystem initialized 

usbcore: registered new driver usbfs 

usbcore: registered new driver hub 

comms: fpga version: 1.2.9 

 

jffs2 version 2.2. (nand) © 2001-2003 red hat, inc. 

nios serial driver version 0.0 

ttys0 (irq = 10) is a builtin nios uart 

serial: jtag uart driver $revision: 1.4 $ 

ttyj0 at mmio 0x87000000 (irq = 9) is a jtag_uart 

io scheduler noop registered 

io scheduler anticipatory registered 

io scheduler deadline registered 

io scheduler cfq registered 

ramdisk driver initialized: 16 ram disks of 4096k size 1024 blocksize 

mtip_probe:eth0, 100000 khz nios (vsc8211) (pio) 

morethanip 10/100/1000 driver(v1.0), linux 2.6.5 apr2004 

    mtip_find_phy: found target phy at address 2 

    mtip_probe:phy reg17 = 0x1a34 

mtip_probe:eth0, rev=0x00010023, (vsc8211) phyaddr:0x02 

warning: no mac address found in flash at address 0x07fc0000.  using non-unique 

mac address of 00:07:ed:00:00:00 

    addr: 00:07:ed:00:00:00: 

mtip_probe:eth1, 100000 khz nios (vsc8211) (pio) 

altera ndk flash (amd): found 1 x16 devices at 0x0 in 8-bit bank 

amd/fujitsu extended query table at 0x0040 

altera ndk flash (amd): cfi does not contain boot bank location. assuming top. 

number of cfi chips: 1 

cfi_cmdset_0002: disabling erase-suspend-program due to code brokenness. 

cmdlinepart partition parsing not available 

redboot partition parsing not available 

using altera ndk partition definition 

creating 7 mtd partitions on "altera ndk flash (amd)": 

0x00300000-0x00b00000 : "cop - romfs" 

0x00000000-0x00300000 : "cop - loader/kernel" 

0x00b00000-0x02000000 : "cop - jffs2" 

0x02300000-0x02b00000 : "fep - romfs" 

0x02000000-0x02300000 : "fep - loader/kernel" 

0x02b00000-0x03000000 : "fep - jffs2" 

0x03000000-0x04000000 : "fpga code" 

cast_usb: driver cast-hcd, 15 jan 2006 

cast_usb: usb host controller, irq 0 

cast_usb: usb host controller, irq 2 

cast-hcd cast-hcd: new usb bus registered, assigned bus number 1 

usb usb1: product: usb host controller 

usb usb1: manufacturer: uclinux 2.6.11-uc0 cast-hcd 

usb usb1: serialnumber: cast-hcd 

hub 1-0:1.0: usb hub found 

hub 1-0:1.0: 1 port detected 

castusb: timeout waiting for otg negotiation 

cast_hub_control: jumper 3 installed 

cast_hub_control: jumperreg: c0060000 

cast_hub_control: jumperreg: c0060000 

initializing usb mass storage driver... 

usbcore: registered new driver usb-storage 

usb mass storage support registered. 

cast-udc-sas: loaded. 

cast-udc-veh: loaded. 

miser_sas gadget: miser sas, version: 15 jan 2006 

cast-udc-sas: registered gadget driver 'miser_sas' 

cast-udc-sas: entered idle state 

cast-udc-sas: entered peripheral state 

cast-udc-sas: entered peripheral state 

miser_veh gadget: miser veh, version: 15 jan 2006 

cast-udc-veh: registered gadget driver 'miser_veh' 

cast-udc-veh: entered idle state 

cast-udc-veh: entered peripheral state 

cast-udc-veh: entered peripheral state 

net: registered protocol family 2 

ip: routing cache hash table of 512 buckets, 4kbytes 

tcp established hash table entries: 2048 (order: 2, 16384 bytes) 

tcp bind hash table entries: 2048 (order: 1, 8192 bytes) 

tcp: hash tables configured (established 2048 bind 2048) 

vfs: mounted root (romfs filesystem) readonly. 

freeing unused kernel memory: 68k freed (0x41da000 - 0x41ea000) 

expand: from=/ramfs.img to=/dev/ram0 

expand: from=/ramfs.img to=/dev/ram1 

mtip_phy_configure:eth0, autoneg complete 

    phyctl0: 1000  physts1:  796d  phyid1:    000f 

    phyid2:  c4b1  phyadv4:  01e1  phyremcap5: 0020 

 

mtip_phymac_synch:eth0  mr1: 0x0000796d 

            autoneg'd 

            link ok: 

            halfd 

            10base-t 

            cmdcf: 0x00000603 

<div align='right'><{post_snapback}> (index.php?act=findpost&pid=17577) 

--- quote end ---  

 

--- Quote End ---  

0 Kudos
Reply