Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Valued Contributor III
1,293 Views

USB device!

I have a usb flash disk, I want to using it on my board, I choose USB Mass storage and SCSI disk and ISA116X driver support in menuconfig. Start uClinux on NIOS II SDK shell, using dmesg, I got these message: 

 

# dmesg 

Linux version 2.6.11-uc0 (root@localhost.localdomain) (gcc version 3.4.6)# 11 Sa 

t Apr 15 17:52:30 CST 2006 

 

 

uClinux/Nios II 

Altera Nios II support © 2004 Microtronix Datacom Ltd. 

 

setup_arch: No persistant network settings signature at 008F0000 

On node 0 totalpages: 2048 

DMA zone: 2048 pages, LIFO batch:1 

Normal zone: 0 pages, LIFO batch:1 

HighMem zone: 0 pages, LIFO batch:1 

Built 1 zonelists 

Kernel command line: 

PID hash table entries: 64 (order: 6, 1024 bytes) 

Dentry cache hash table entries: 2048 (order: 1, 8192 bytes) 

Inode-cache hash table entries: 1024 (order: 0, 4096 bytes) 

Memory available: 6188k/8192k RAM, 0k/0k ROM (1334k kernel code, 551k data) 

Calibrating delay loop... 24.72 BogoMIPS (lpj=123648) 

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 

Serial: JTAG UART driver $Revision: 1.4 $ 

ttyJ0 at MMIO 0x81004000 (irq = 1) is a jtag_uart 

io scheduler noop registered 

io scheduler deadline registered 

dmfe_probe:eth0, 50000 Khz Nios 

<DM9000> eth0 I/O: 80900090, VID: 90000a46 

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

dmfe_probe:eth1, 50000 Khz Nios 

Linux video capture interface: v1.00 

116x: driver isp116x-hcd, 08 Apr 2005 

116x: ISP116x Host Controller, irq 4 

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

116x: Invalid chip ID 3630 

isp116x-hcd isp116x-hcd: USB bus 1 deregistered 

116x: init error, -19 

Initializing USB Mass Storage driver... 

usbcore: registered new driver usb-storage 

USB Mass Storage support registered. 

NET: Registered protocol family 2 

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

TCP established hash table entries: 512 (order: 0, 4096 bytes) 

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

TCP: Hash tables configured (established 512 bind 512) 

NET: Registered protocol family 1 

NET: Registered protocol family 17 

Freeing unused kernel memory: 436k freed (0x15e000 - 0x1ca000)#  

 

I plug my usb flash disk in my board usb host port, there is no message appear! 

How could I to find the usb disk?
0 Kudos
43 Replies
Highlighted
Valued Contributor III

Re: USB device!

the usb chip in DE2 is not isp116x, it is isp1362. 

reply in new thread, 

http://forum.niosforum.com/forum/index.php?showtopic=3707 (http://forum.niosforum.com/forum/index.php?showtopic=3707)
0 Kudos
Highlighted
Valued Contributor III

Re: USB device!

Thanks for your help, I will try it. If have done, I will tell you!

0 Kudos
Highlighted
Valued Contributor III

Re: USB device!

hi all 

 

I have the same problem,too. 

this is my booting messages.................... 

 

uClinux/Nios II 

Altera Nios II support © 2004 Microtronix Datacom Ltd. 

 

setup_arch: No persistant network settings signature at 008F0000 

Built 1 zonelists 

Kernel command line: 

PID hash table entries: 64 (order: 6, 1024 bytes) 

Dentry cache hash table entries: 2048 (order: 1, 8192 bytes) 

Inode-cache hash table entries: 1024 (order: 0, 4096 bytes) 

Memory available: 5904k/8192k RAM, 0k/0k ROM (1612k kernel code, 580k data) 

Mount-cache hash table entries: 512 

NET: Registered protocol family 16 

SCSI subsystem initialized 

usbcore: registered new driver usbfs 

usbcore: registered new driver hub 

io scheduler noop registered 

io scheduler deadline registered (default) 

Serial: JTAG UART driver $Revision: 1.4 $ 

ttyJ0 at MMIO 0x81004000 (irq = 1) is a jtag_uart 

dmfe_probe:eth0, 50000 Khz Nios 

<DM9000> eth0 I/O: 80900090, VID: 90000a46 

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

dmfe_probe:eth1, 50000 Khz Nios 

usbmon: debugfs is not available 

driver isp1362-hcd, 2005-04-04 

isp1362-hcd isp1362-hcd: ISP1362 Host Controller 

isp1362_hc_reset: 

Clock not ready after 20ms 

isp1362-hcd isp1362-hcd: can&#39;t reset 

init error, -19 

Initializing USB Mass Storage driver... 

usbcore: registered new driver usb-storage 

USB Mass Storage support registered. 

i2c /dev entries driver 

NET: Registered protocol family 2 

IP route cache hash table entries: 128 (order: -3, 512 bytes) 

TCP established hash table entries: 512 (order: -1, 2048 bytes) 

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

TCP: Hash tables configured (established 512 bind 512) 

TCP reno registered 

TCP bic registered 

NET: Registered protocol family 1 

NET: Registered protocol family 10 

IPv6 over IPv4 tunneling driver 

NET: Registered protocol family 17 

Freeing unused kernel memory: 448k freed (0x1a6000 - 0x215000) 

init started: BusyBox v1.1.1-pre0 (2006.04.14-14:34+0000) multi-call binary 

 

 

BusyBox v1.1.1-pre0 (2006.04.14-14:34+0000) Built-in shell (msh) 

Enter &#39;help&#39; for a list of built-in commands. 

 

# cd /proc# more mounts 

rootfs / rootfs rw 0 0 

proc /proc proc rw 0 0 

sysfs /sys sysfs rw 0 0# mount -t vft /dev/hda /mount 

mount: Mounting /dev/hda on /mount failed: No such file or directory#  

 

when I plug my usb disk on my uClinux then no response .  

so , i can&#39;t mount my usb flash disk.......... http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/sad.gif  

 

thank in advance! 

 

jay
0 Kudos
Highlighted
Valued Contributor III

Re: USB device!

The isp1362 is not working. You have to check the regs and irq of the chip. Study the regs map from the data sheet of the chip.  

 

We will debug the driver code.  

 

First, you should setup source code version control with subversion. 

We will have to update or revert the code during debug. 

# remove old linux source rm -rf ~/linux-2.6.x ~/mysvn/2.6.11-uc0# kernel 2.6.11-uc0 source ported by microtronix cp -a ~/download/mx140/plugins/com.microtronix.nios2linux.kernel_1.4.0/linux-2.6.x ~ cd ~/linux-2.6.x patch -p0 <~/download/kernel.diff cp ~/download/kernel.config ~/linux-2.6.x/.config cd ~ mkdir mysvn# setup svn svnadmin create mysvn/2.6.11-uc0 svn import linux-2.6.x file:///home/jack/mysvn/2.6.11-uc0/linux-2.6.x -m="initial" rm -rf ~/linux-2.6.x svn co file:///home/jack/mysvn/2.6.11-uc0/linux-2.6.x patch -p0 <~/download/isp1362.diff svn add drivers/usb/host/isp1362.h drivers/usb/host/isp1362-hcd.c include/linux/usb_isp1362.h svn commit -m="add isp1362 hcd" 

Then in function isp1362_hc_reset() of ~/linux-2.6.x/drivers/usb/host/isp1362_hcd.c 

add some printk() to display the io ports of data, addr and irq. 

add a dump_regs() to display the regs. 

try some write / read compare to the regs. 

add some dump_regs during the clock test. 

 

We have to make sure the chip can be accessed by the driver correctly. 

Check the clock, data... etc with a scope. 

Check irq pin during the clokc test.
0 Kudos
Highlighted
Valued Contributor III

Re: USB device!

hi hippo 

 

Before i was uesd the patch "isp1362-nios2-01.diff" and compiled ok. 

now,i am using patch "isp1362" and complie ok,but i can&#39;t find the "isp1362-hcd.o" in ~/linux2.6.x/drivers/usb/host dir. 

i find the "(CONFIG_USB_ISP362X_HCD)" at line 14 in ~/linux2.6.x/drivers/usb/makefile and replace it to "(CONFIG_USB_ISP1362_HCD)".. 

final , when i have rebuild kernel then occur error messages........ 

 

CHK include/asm-nios2nommu/asm-offsets.h 

CHK include/linux/compile.h 

CHK usr/initramfs_list 

CC drivers/usb/host/isp1362-hcd.o 

drivers/usb/host/isp1362-hcd.c:1293: error: syntax error before "gfp_t" 

drivers/usb/host/isp1362-hcd.c:1294: warning: function declaration isn&#39;t a prototype 

drivers/usb/host/isp1362-hcd.c: In function `isp1362_urb_enqueue&#39;: 

drivers/usb/host/isp1362-hcd.c:1295: error: `hcd&#39; undeclared (first use in this function) 

drivers/usb/host/isp1362-hcd.c:1295: error: (Each undeclared identifier is reported only once 

drivers/usb/host/isp1362-hcd.c:1295: error: for each function it appears in.) 

drivers/usb/host/isp1362-hcd.c:1296: error: `urb&#39; undeclared (first use in this function) 

drivers/usb/host/isp1362-hcd.c:1333: error: `hep&#39; undeclared (first use in this function) 

drivers/usb/host/isp1362-hcd.c:1334: error: `mem_flags&#39; undeclared (first use in this function) 

drivers/usb/host/isp1362-hcd.c:1341: warning: implicit declaration of function `HC_IS_RUNNING&#39; 

drivers/usb/host/isp1362-hcd.c: In function `isp1362_mem_config&#39;: 

drivers/usb/host/isp1362-hcd.c:2415: warning: int format, long unsigned int arg (arg 5) 

drivers/usb/host/isp1362-hcd.c:2418: warning: int format, long unsigned int arg (arg 5) 

drivers/usb/host/isp1362-hcd.c: In function `isp1362_hc_start&#39;: 

drivers/usb/host/isp1362-hcd.c:2776: error: `HC_STATE_RUNNING&#39; undeclared (first use in this function) 

drivers/usb/host/isp1362-hcd.c: At top level: 

drivers/usb/host/isp1362-hcd.c:2818: error: unknown field `bus_suspend&#39; specified in initializer 

drivers/usb/host/isp1362-hcd.c:2819: error: unknown field `bus_resume&#39; specified in initializer 

drivers/usb/host/isp1362-hcd.c: In function `isp1362_remove&#39;: 

drivers/usb/host/isp1362-hcd.c:2828: warning: implicit declaration of function `platform_get_drvdata&#39; 

drivers/usb/host/isp1362-hcd.c:2828: warning: initialization makes pointer from integer without a cast 

drivers/usb/host/isp1362-hcd.c:2834: warning: implicit declaration of function `usb_remove_hcd&#39; 

drivers/usb/host/isp1362-hcd.c: In function `isp1362_probe&#39;: 

drivers/usb/host/isp1362-hcd.c:2927: error: too many arguments to function `usb_create_hcd&#39; 

drivers/usb/host/isp1362-hcd.c:2932: error: structure has no member named `rsrc_start&#39; 

drivers/usb/host/isp1362-hcd.c:2958: warning: implicit declaration of function `usb_add_hcd&#39; 

drivers/usb/host/isp1362-hcd.c: At top level: 

drivers/usb/host/isp1362-hcd.c:3043: error: variable `isp1362_driver&#39; has initializer but incomplete type 

drivers/usb/host/isp1362-hcd.c:3044: error: unknown field `probe&#39; specified in initializer 

drivers/usb/host/isp1362-hcd.c:3044: warning: excess elements in struct initializer 

drivers/usb/host/isp1362-hcd.c:3044: warning: (near initialization for `isp1362_driver&#39;) 

drivers/usb/host/isp1362-hcd.c:3045: error: unknown field `remove&#39; specified in initializer 

drivers/usb/host/isp1362-hcd.c:3045: warning: excess elements in struct initializer 

drivers/usb/host/isp1362-hcd.c:3045: warning: (near initialization for `isp1362_driver&#39;) 

drivers/usb/host/isp1362-hcd.c:3047: error: unknown field `suspend&#39; specified in initializer 

drivers/usb/host/isp1362-hcd.c:3047: warning: excess elements in struct initializer 

drivers/usb/host/isp1362-hcd.c:3047: warning: (near initialization for `isp1362_driver&#39;) 

drivers/usb/host/isp1362-hcd.c:3048: error: unknown field `resume&#39; specified in initializer 

drivers/usb/host/isp1362-hcd.c:3048: warning: excess elements in struct initializer 

drivers/usb/host/isp1362-hcd.c:3048: warning: (near initialization for `isp1362_driver&#39;) 

drivers/usb/host/isp1362-hcd.c:3049: error: unknown field `driver&#39; specified in initializer 

drivers/usb/host/isp1362-hcd.c:3049: error: extra brace group at end of initializer 

drivers/usb/host/isp1362-hcd.c:3049: error: (near initialization for `isp1362_driver&#39;) 

drivers/usb/host/isp1362-hcd.c:3052: warning: excess elements in struct initializer 

drivers/usb/host/isp1362-hcd.c:3052: warning: (near initialization for `isp1362_driver&#39;) 

drivers/usb/host/isp1362-hcd.c: In function `isp1362_init&#39;: 

drivers/usb/host/isp1362-hcd.c:3063: warning: implicit declaration of function `platform_driver_register&#39; 

drivers/usb/host/isp1362-hcd.c: In function `isp1362_cleanup&#39;: 

drivers/usb/host/isp1362-hcd.c:3070: warning: implicit declaration of function `platform_driver_unregister&#39; 

drivers/usb/host/isp1362-hcd.c: At top level: 

drivers/usb/host/isp1362-hcd.c:3043: error: storage size of `isp1362_driver&#39; isn&#39;t known 

drivers/usb/host/isp1362-hcd.c:1581: warning: &#39;isp1362_bus_suspend&#39; declared `static&#39; but never defined 

make[3]: *** [drivers/usb/host/isp1362-hcd.o] Error 1 

make[2]: *** [drivers/usb/host] Error 2 

make[1]: *** [drivers/usb] Error 2 

make: *** [drivers] Error 2 http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/sad.gif  

 

Is diffenence between the isp1362-nios2-01.diff and the isp1362.diff ? 

thx in advance !
0 Kudos
Highlighted
Valued Contributor III

Re: USB device!

It is the trouble of back porting. http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/sad.gif  

The driver code is for 2.6.16.1 . 

The include files and data structures are different between 2.6.11 and 2.6.16.1 . 

 

You have to choose to work on either linux-2.6.16.1 or linux-2.6.x (ie 2.6.11-uc0). 

More works are required to back port to 2.6.11 .  

I am busy now, and can&#39;t help. Sorry. 

I have updated the steps of svn. You can use svn to track the debuging.
0 Kudos
Highlighted
Valued Contributor III

Re: USB device!

hi hippo 

 

I have worked on linux-2.6.16.1(using patch isp1362-nios2-01.diff ) that compiled kernel successfully.  

i can see isp1362 device form booting messages,but usb device don&#39;t work on my uClinux. 

 

I am working on linux-2.6.x that using patch isp1362.diff right now. 

 

i will try your suggestion on linux-2.6.x,again. 

 

thx in advance!!  

 

jay
0 Kudos
Highlighted
Valued Contributor III

Re: USB device!

hi hippo 

I have installed svn on linux-2.6.x and met a problem. 

i can&#39;t used the patch "isp1362.diff" in ~/ dir. why? 

 

[jay@localhost ~]$ patch -p0 <~/download/isp1362.diff 

patching file include/linux/usb_isp1362.h 

can&#39;t find file to patch at input line 52 

Perhaps you used the wrong -p or --strip option? 

The text leading up to this was: 

-------------------------- 

|Index: arch/nios2nommu/kernel/usb.c 

|=================================================================== 

|--- arch/nios2nommu/kernel/usb.c (revision 12) 

|+++ arch/nios2nommu/kernel/usb.c (revision 14) 

-------------------------- 

File to patch: 

 

how to solve this problem? 

if i complete the installation of svn. 

Is the make kernel also in ~/linux-2.6.x?  

 

thx
0 Kudos
Highlighted
Valued Contributor III

Re: USB device!

 

--- Quote Start ---  

originally posted by jay_1025@Apr 19 2006, 11:00 PM 

hi hippo 

i have installed svn on linux-2.6.x  and met a problem. 

i  can&#39;t used  the patch "isp1362.diff" in ~/ dir. why? 

 

[jay@localhost ~]$ patch -p0 <~/download/isp1362.diff 

patching file include/linux/usb_isp1362.h 

can&#39;t find file to patch at input line 52 

perhaps you used the wrong -p or --strip option? 

the text leading up to this was: 

-------------------------- 

|index: arch/nios2nommu/kernel/usb.c 

|=================================================================== 

|--- arch/nios2nommu/kernel/usb.c    (revision 12) 

|+++ arch/nios2nommu/kernel/usb.c    (revision 14) 

-------------------------- 

file to patch: 

 

how to solve this problem? 

if i complete the installation of svn. 

is the make kernel also in ~/linux-2.6.x?   

 

thx 

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

--- quote end ---  

 

--- Quote End ---  

 

please do the patch in kernel dir, 

cd ~/linux-2.6.x 

patch -p0 <....... 

 

You should check the header when you received a patch to know the patch point.
0 Kudos
Highlighted
Valued Contributor III

Re: USB device!

 

--- Quote Start ---  

originally posted by jay_1025@Apr 19 2006, 04:49 PM 

hi hippo 

 

i have worked on linux-2.6.16.1(using patch isp1362-nios2-01.diff ) that compiled kernel successfully.  

i can see isp1362 device form booting messages,but usb device don&#39;t work on my uclinux. 

 

i am working on linux-2.6.x that using patch isp1362.diff right now. 

 

i will try your suggestion  on linux-2.6.x,again. 

 

thx in advance!!  

 

jay 

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

--- quote end ---  

 

--- Quote End ---  

 

Maybe you should work on 2.6.16.1 , because the isp1362 driver was fro 2.6.16.1 . 

Try debug the driver in 2.6.16.1 . 

 

It is not easy to back port to 2.6.11 , really.
0 Kudos
Highlighted
Valued Contributor III

Re: USB device!

hi hippo 

 

So far, i don&#39;t solve this problem for usb isp1362.  

i find two problematic places in isp1362-hcd.c form booting messages to konw , it is "isp1362_hc_reset" and "isp1362_probe". such as following:  

 

Booting messages for usb isp1362 

driver isp1362-hcd, 2005-04-04 

isp1362-hcd isp1362-hcd: ISP1362 Host Controller 

isp1362_hc_reset: 

Clock not ready after 20ms 

isp1362-hcd isp1362-hcd: can&#39;t reset 

init error, -19 

 

static int isp1362_hc_reset(struct usb_hcd *hcd) 

int ret = 0; 

struct isp1362_hcd *isp1362_hcd = hcd_to_isp1362_hcd(hcd); 

unsigned long t; 

unsigned long timeout = 20; 

unsigned long flags; 

int clkrdy = 0; 

 

INFO("%s:\n", __FUNCTION__); 

// dump_regs(s, isp1362_hcd); 

if (isp1362_hcd->board && isp1362_hcd->board->reset) { 

isp1362_hcd->board->reset(hcd->self.controller, 1); 

msleep(20); 

if (isp1362_hcd->board->clock) { 

isp1362_hcd->board->clock(hcd->self.controller, 1); 

isp1362_hcd->board->reset(hcd->self.controller, 0); 

} else { 

isp1362_sw_reset(isp1362_hcd); 

 

// chip has been reset. First we need to see a clock 

t = jiffies + msecs_to_jiffies(timeout); 

while (!clkrdy && time_before_eq(jiffies, t)) { 

spin_lock_irqsave(&isp1362_hcd->lock, flags); 

clkrdy = isp1362_read_reg16(isp1362_hcd, HCuPINT) & HCuPINT_CLKRDY; 

spin_unlock_irqrestore(&isp1362_hcd->lock, flags); 

if (!clkrdy) { 

msleep(4); 

 

spin_lock_irqsave(&isp1362_hcd->lock, flags); 

isp1362_write_reg16(isp1362_hcd, HCuPINT, HCuPINT_CLKRDY); 

spin_unlock_irqrestore(&isp1362_hcd->lock, flags); 

if (!clkrdy) { 

ERR("Clock not ready after %lums\n", timeout); 

ret = -ENODEV; 

 

return ret; 

 

//////////////////////////////////////////////////////////////////////////////////////////// 

 

static int __init isp1362_probe(struct platform_device *pdev) 

struct usb_hcd *hcd; 

struct isp1362_hcd *isp1362_hcd; 

struct resource *addr, *data; 

void __iomem *addr_reg; 

void __iomem *data_reg; 

int irq; 

int retval = 0; 

 

/* basic sanity checks first. board-specific init logic should 

* have initialized this the three resources and probably board 

* specific platform_data. we don&#39;t probe for IRQs, and do only 

* minimal sanity checking. 

*/ 

if (pdev->num_resources < 3) { 

retval = -ENODEV; 

goto err1; 

 

data = platform_get_resource(pdev, IORESOURCE_MEM, 0); 

addr = platform_get_resource(pdev, IORESOURCE_MEM, 1); 

irq = platform_get_irq(pdev, 0); 

if (!addr || !data || irq < 0) { 

retval = -ENODEV; 

goto err1; 

# ifdef CONFIG_USB_HCD_DMA 

if (pdev->dev.dma_mask) { 

struct resource *dma_res = platform_get_resource(pdev, IORESOURCE_MEM, 2); 

 

if (!dma_res) { 

retval = -ENODEV; 

goto err1; 

isp1362_hcd->data_dma = dma_res->start; 

isp1362_hcd->max_dma_size = resource_len(dma_res); 

}# else 

if (pdev->dev.dma_mask) { 

DBG(1, "won&#39;t do DMA"); 

retval = -ENODEV; 

goto err1; 

}# endif 

 

if (!request_mem_region(addr->start, resource_len(addr), hcd_name)) { 

retval = -EBUSY; 

goto err1; 

err1: 

printk("init error, %d\n", retval); 

return retval; 

 

i am not good in usb driver. http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/sad.gif  

Can you tell more detail how to debug it ? 

 

Thx in advance ! 

 

jay
0 Kudos
Highlighted
Valued Contributor III

Re: USB device!

 

--- Quote Start ---  

originally posted by jay_1025@Apr 25 2006, 08:48 PM 

hi hippo 

 

so far, i don&#39;t solve this problem for usb isp1362.  

i find two problematic places in isp1362-hcd.c form booting messages to konw , it is "isp1362_hc_reset" and "isp1362_probe". such as following:   

 

booting messages for  usb isp1362 

driver isp1362-hcd, 2005-04-04 

isp1362-hcd isp1362-hcd: isp1362 host controller 

isp1362_hc_reset: 

clock not ready after 20ms 

isp1362-hcd isp1362-hcd: can&#39;t reset 

init error, -19 

 

static int isp1362_hc_reset(struct usb_hcd *hcd) 

int ret = 0; 

struct isp1362_hcd *isp1362_hcd = hcd_to_isp1362_hcd(hcd); 

unsigned long t; 

unsigned long timeout = 20; 

unsigned long flags; 

int clkrdy = 0; 

 

info("%s:\n", __function__); 

      // dump_regs(s, isp1362_hcd); 

if (isp1362_hcd->board && isp1362_hcd->board->reset) { 

  isp1362_hcd->board->reset(hcd->self.controller, 1); 

  msleep(20); 

  if (isp1362_hcd->board->clock) { 

isp1362_hcd->board->clock(hcd->self.controller, 1); 

  } 

  isp1362_hcd->board->reset(hcd->self.controller, 0); 

} else { 

  isp1362_sw_reset(isp1362_hcd); 

 

// chip has been reset. first we need to see a clock 

t = jiffies + msecs_to_jiffies(timeout); 

while (!clkrdy && time_before_eq(jiffies, t)) { 

  spin_lock_irqsave(&isp1362_hcd->lock, flags); 

  clkrdy = isp1362_read_reg16(isp1362_hcd, hcupint) & hcupint_clkrdy; 

  spin_unlock_irqrestore(&isp1362_hcd->lock, flags); 

  if (!clkrdy) { 

msleep(4); 

  } 

 

spin_lock_irqsave(&isp1362_hcd->lock, flags); 

isp1362_write_reg16(isp1362_hcd, hcupint, hcupint_clkrdy); 

spin_unlock_irqrestore(&isp1362_hcd->lock, flags); 

if (!clkrdy) { 

  err("clock not ready after %lums\n", timeout); 

  ret = -enodev; 

   

return ret; 

 

//////////////////////////////////////////////////////////////////////////////////////////// 

 

static int __init isp1362_probe(struct platform_device *pdev) 

struct usb_hcd *hcd; 

struct isp1362_hcd *isp1362_hcd; 

struct resource *addr, *data; 

void __iomem *addr_reg; 

void __iomem *data_reg; 

int irq; 

int retval = 0; 

 

/* basic sanity checks first.  board-specific init logic should 

  * have initialized this the three resources and probably board 

  * specific platform_data.  we don&#39;t probe for irqs, and do only 

  * minimal sanity checking. 

  */ 

if (pdev->num_resources < 3) { 

  retval = -enodev; 

  goto err1; 

 

data = platform_get_resource(pdev, ioresource_mem, 0); 

addr = platform_get_resource(pdev, ioresource_mem, 1); 

irq = platform_get_irq(pdev, 0); 

if (!addr || !data || irq < 0) { 

  retval = -enodev; 

  goto err1; 

# ifdef config_usb_hcd_dma 

if (pdev->dev.dma_mask) { 

  struct resource *dma_res = platform_get_resource(pdev, ioresource_mem, 2); 

 

  if (!dma_res) { 

retval = -enodev; 

goto err1; 

  } 

  isp1362_hcd->data_dma = dma_res->start; 

  isp1362_hcd->max_dma_size = resource_len(dma_res); 

}# else 

if (pdev->dev.dma_mask) { 

  dbg(1, "won&#39;t do dma"); 

  retval = -enodev; 

  goto err1; 

}# endif 

 

if (!request_mem_region(addr->start, resource_len(addr), hcd_name)) { 

  retval = -ebusy; 

  goto err1; 

        . 

        . 

        . 

        err1: 

printk("init error, %d\n", retval); 

return retval; 

        . 

        . 

 

i am not good in usb driver.    http://forum.niosforum.com/work2/style_emoticons/<#emo_dir#>/sad.gif  

can you tell more detail how to debug it ? 

 

thx in advance ! 

 

jay 

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

--- quote end ---  

 

--- Quote End ---  

 

 

Please check isp1362 registers access first. 

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

<div class='quotetop'>QUOTE  

--- Quote End ---  

 

--- Quote Start ---  

 

Then in function isp1362_hc_reset() of ~/linux-2.6.x/drivers/usb/host/isp1362_hcd.c 

add some printk() to display the io ports of data, addr and irq. 

add a dump_regs() to display the regs. 

try some write / read compare to the regs. 

add some dump_regs during the clock test. 

 

We have to make sure the chip can be accessed by the driver correctly. 

Check the clock, data... etc with a scope. 

Check irq pin during the clokc test.[/b] 

--- Quote End ---  

[/b] 

--- Quote End ---  

0 Kudos
Highlighted
Valued Contributor III

Re: USB device!

Hi: 

I&#39;ve changed a little code in ISP1362-hcd.c, these is my boot message: 

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

 

[SOPC Builder]$ nios2-terminal.exe 

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

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

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

 

Uncompressing Linux... Ok, booting the kernel. 

Linux version 2.6.16-uc0 (root@141.71.193.202.in-addr.arpa) (gcc version 3.4.6)# 10 PREEMPT Thu Apr 27 21:18:42 CST 2006 

 

 

uClinux/Nios II 

Altera Nios II support © 2004 Microtronix Datacom Ltd. 

Built 1 zonelists 

Kernel command line: 

PID hash table entries: 64 (order: 6, 1024 bytes) 

Dentry cache hash table entries: 2048 (order: 1, 8192 bytes) 

Inode-cache hash table entries: 1024 (order: 0, 4096 bytes) 

Memory available: 6676k/8192k RAM, 0k/0k ROM (982k kernel code, 437k data) 

Mount-cache hash table entries: 512 

SCSI subsystem initialized 

usbcore: registered new driver usbfs 

usbcore: registered new driver hub 

io scheduler noop registered 

io scheduler deadline registered (default) 

Serial: JTAG UART driver $Revision: 1.4 $ 

ttyJ0 at MMIO 0x81004000 (irq = 1) is a jtag_uart 

usbmon: debugfs is not available 

driver isp1362-hcd, 2005-04-04 

isp1362-hcd isp1362-hcd: ISP1362 Host Controller 

isp1362_hc_reset: 

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

isp1362-hcd isp1362-hcd: irq 4, io mem 0x80900080 

isp1362_hc_start: 

isp1362-hcd isp1362-hcd: ISP1362 Memory usage: 

isp1362-hcd isp1362-hcd: ISTL:    2 *  256:      512 @ $0000:$0100 

isp1362-hcd isp1362-hcd: INTL: 16 * ( 64+8):  1152 @ $0200 

isp1362-hcd isp1362-hcd: ATL : 32 * ( 64+8):  2304 @ $0680 

isp1362-hcd isp1362-hcd: USED/FREE: 3968    128 

usb usb1: Product: ISP1362 Host Controller 

usb usb1: Manufacturer: uClinux 2.6.16-uc0 isp1362-hcd 

usb usb1: SerialNumber: isp1362-hcd 

usb usb1: configuration# 1 chosen from 1 choice 

hub 1-0:1.0: USB hub found 

hub 1-0:1.0: 2 ports detected 

ISP1362 Host Controller, irq 4 

Initializing USB Mass Storage driver... 

usbcore: registered new driver usb-storage 

USB Mass Storage support registered. 

Freeing unused kernel memory: 348k freed (0x102000 - 0x158000) 

init started:  BusyBox v1.1.1-pre0 (2006.04.21-12:33+0000) multi-call binary 

 

 

BusyBox v1.1.1-pre0 (2006.04.21-12:33+0000) Built-in shell (msh) 

Enter &#39;help&#39; for a list of built-in commands. 

# [/b] 

--- Quote End ---  

 

 

After I plug my usb flash disk, I got these message: 

 

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

]# usb 1-2: new full speed USB device using isp1362-hcd and address 2 

usb 1-2: Product: USB Mass Storage 

usb 1-2: Manufacturer: USB Mass Storage 

usb 1-2: SerialNumber: ABCDEF123456789 

usb 1-2: configuration# 1 chosen from 1 choice 

scsi0 : SCSI emulation for USB Mass Storage devices 

  Vendor: USB-disk  Model: FREEDIK-LWFORMAT  Rev: 1.06 

  Type: Direct-Access                      ANSI SCSI revision: 00 

SCSI device sda: 261856 512-byte hdwr sectors (134 MB) 

sda: Write Protect is off 

sda: assuming drive cache: write through 

SCSI device sda: 261856 512-byte hdwr sectors (134 MB) 

sda: Write Protect is off 

sda: assuming drive cache: write through 

sda:<7>usb-storage: queuecommand called 

sda1 

sd 0:0:0:0: Attached scsi removable disk sda 

sd 0:0:0:0: Attached scsi generic sg0 type 0 

#  

[/b] 

--- Quote End ---  

 

 

I don&#39;t sure the ISP1362 was working. 

I want to access my usb disk by nios2-sdk-shell, what I need to next step? 

THX
0 Kudos
Highlighted
Valued Contributor III

Re: USB device!

 

--- Quote Start ---  

originally posted by goral@Apr 27 2006, 09:42 PM 

hi: 

i&#39;ve changed a little code in isp1362-hcd.c,  these is my boot message: 

<div class='quotetop'>quote  

--- quote end ---  

 

--- quote start ---  

 

[sopc builder]$ nios2-terminal.exe 

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

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

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

 

uncompressing linux... ok, booting the kernel. 

linux version 2.6.16-uc0 (root@141.71.193.202.in-addr.arpa) (gcc version 3.4.6)# 10 preempt thu apr 27 21:18:42 cst 2006 

 

 

uclinux/nios ii 

altera nios ii support © 2004 microtronix datacom ltd. 

built 1 zonelists 

kernel command line: 

pid hash table entries: 64 (order: 6, 1024 bytes) 

dentry cache hash table entries: 2048 (order: 1, 8192 bytes) 

inode-cache hash table entries: 1024 (order: 0, 4096 bytes) 

memory available: 6676k/8192k ram, 0k/0k rom (982k kernel code, 437k data) 

mount-cache hash table entries: 512 

scsi subsystem initialized 

usbcore: registered new driver usbfs 

usbcore: registered new driver hub 

io scheduler noop registered 

io scheduler deadline registered (default) 

serial: jtag uart driver $revision: 1.4 $ 

ttyj0 at mmio 0x81004000 (irq = 1) is a jtag_uart 

usbmon: debugfs is not available 

driver isp1362-hcd, 2005-04-04 

isp1362-hcd isp1362-hcd: isp1362 host controller 

isp1362_hc_reset: 

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

isp1362-hcd isp1362-hcd: irq 4, io mem 0x80900080 

isp1362_hc_start: 

isp1362-hcd isp1362-hcd: isp1362 memory usage: 

isp1362-hcd isp1362-hcd: istl:    2 *  256:      512 @ $0000:$0100 

isp1362-hcd isp1362-hcd: intl: 16 * ( 64+8):  1152 @ $0200 

isp1362-hcd isp1362-hcd: atl : 32 * ( 64+8):  2304 @ $0680 

isp1362-hcd isp1362-hcd: used/free: 3968    128 

usb usb1: product: isp1362 host controller 

usb usb1: manufacturer: uclinux 2.6.16-uc0 isp1362-hcd 

usb usb1: serialnumber: isp1362-hcd 

usb usb1: configuration# 1 chosen from 1 choice 

hub 1-0:1.0: usb hub found 

hub 1-0:1.0: 2 ports detected 

isp1362 host controller, irq 4 

initializing usb mass storage driver... 

usbcore: registered new driver usb-storage 

usb mass storage support registered. 

freeing unused kernel memory: 348k freed (0x102000 - 0x158000) 

init started:  busybox v1.1.1-pre0 (2006.04.21-12:33+0000) multi-call binary 

 

 

busybox v1.1.1-pre0 (2006.04.21-12:33+0000) built-in shell (msh) 

enter &#39;help&#39; for a list of built-in commands. 

#  

--- Quote End ---  

 

 

After I plug my usb flash disk, I got these message: 

 

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

]# usb 1-2: new full speed USB device using isp1362-hcd and address 2 

usb 1-2: Product: USB Mass Storage 

usb 1-2: Manufacturer: USB Mass Storage 

usb 1-2: SerialNumber: ABCDEF123456789 

usb 1-2: configuration# 1 chosen from 1 choice 

scsi0 : SCSI emulation for USB Mass Storage devices 

  Vendor: USB-disk  Model: FREEDIK-LWFORMAT  Rev: 1.06 

  Type: Direct-Access                      ANSI SCSI revision: 00 

SCSI device sda: 261856 512-byte hdwr sectors (134 MB) 

sda: Write Protect is off 

sda: assuming drive cache: write through 

SCSI device sda: 261856 512-byte hdwr sectors (134 MB) 

sda: Write Protect is off 

sda: assuming drive cache: write through 

sda:<7>usb-storage: queuecommand called 

sda1 

sd 0:0:0:0: Attached scsi removable disk sda 

sd 0:0:0:0: Attached scsi generic sg0 type 0 

#  

[/b] 

--- Quote End ---  

 

 

I don&#39;t sure the ISP1362 was working. 

I want to access my usb disk by nios2-sdk-shell, what I need to next step? 

THX 

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

[/b] 

--- Quote End ---  

 

Very Good, http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/smile.gif  

 

It seems to working. The usb disk is detected. /dev/sda1 

You can try "mount -t vfat /dev/sda1 /mnt" .  

 

You don&#39;t need scsi sg device. Only scsi disk is required for usb disk. 

 

Would you attach your updated isp1362-hcd.c (zipped) to my buildroot guide?
0 Kudos
Highlighted
Valued Contributor III

Re: USB device!

Ok, My Lab was closed now , So I haven&#39;t update the program now, I&#39;ll update quickly! 

THX for your help!
0 Kudos
Highlighted
Valued Contributor III

Re: USB device!

hi hippo 

 

i can detect the usb flash from booting messages that can&#39;t mount usb flash. 

 

uClinux/Nios II 

Altera Nios II support © 2004 Microtronix Datacom Ltd. 

 

setup_arch: No persistant network settings signature at 00BF0000 

Built 1 zonelists 

Kernel command line: 

PID hash table entries: 64 (order: 6, 1024 bytes) 

Dentry cache hash table entries: 2048 (order: 1, 8192 bytes) 

Inode-cache hash table entries: 1024 (order: 0, 4096 bytes) 

Memory available: 5968k/8192k RAM, 0k/0k ROM (1577k kernel code, 554k data) 

Mount-cache hash table entries: 512 

NET: Registered protocol family 16 

SCSI subsystem initialized 

usbcore: registered new driver usbfs 

usbcore: registered new driver hub 

io scheduler noop registered 

io scheduler deadline registered (default) 

Serial: JTAG UART driver $Revision: 1.4 $ 

ttyJ0 at MMIO 0x80c81120 (irq = 1) is a jtag_uart 

dmfe_probe:eth0, 50000 Khz Nios 

<DM9000> eth0 I/O: 80c81130, VID: 90000a46 

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

dmfe_probe:eth1, 50000 Khz Nios 

usbmon: debugfs is not available 

driver isp1362-hcd, 2005-04-04 

isp1362-hcd isp1362-hcd: ISP1362 Host Controller 

isp1362_hc_reset: 

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

isp1362-hcd isp1362-hcd: irq 4, io mem 0x80c810d0 

isp1362_hc_start: 

isp1362-hcd isp1362-hcd: ISP1362 Memory usage: 

isp1362-hcd isp1362-hcd: ISTL: 2 * 256: 512 @ $0000:$0100 

isp1362-hcd isp1362-hcd: INTL: 16 * ( 64+8): 1152 @ $0200 

isp1362-hcd isp1362-hcd: ATL : 32 * ( 64+8): 2304 @ $0680 

isp1362-hcd isp1362-hcd: USED/FREE: 3968 128 

usb usb1: configuration# 1 chosen from 1 choice 

hub 1-0:1.0: USB hub found 

hub 1-0:1.0: 2 ports detected 

ISP1362 Host Controller, irq 4 

Initializing USB Mass Storage driver... 

usbcore: registered new driver usb-storage 

USB Mass Storage support registered. 

NET: Registered protocol family 2 

IP route cache hash table entries: 128 (order: -3, 512 bytes) 

TCP established hash table entries: 512 (order: -1, 2048 bytes) 

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

TCP: Hash tables configured (established 512 bind 512) 

TCP reno registered 

TCP bic registered 

NET: Registered protocol family 1 

NET: Registered protocol family 10 

IPv6 over IPv4 tunneling driver 

NET: Registered protocol family 17 

Freeing unused kernel memory: 436k freed (0x19c000 - 0x208000) 

init started: BusyBox v1.1.1-pre0 (2006.04.20-12:52+0000) multi-call binary 

usb 1-2: new full speed USB device using isp1362-hcd and address 2 

usb 1-2: configuration# 1 chosen from 1 choice 

scsi0 : SCSI emulation for USB Mass Storage devices 

 

 

BusyBox v1.1.1-pre0 (2006.04.20-12:52+0000) Built-in shell (msh) 

Enter &#39;help&#39; for a list of built-in commands. 

# Vendor: SigmaTel Model: MSCN Rev: 0001 

Type: Direct-Access ANSI SCSI revision: 04 

# mount -t vfat /dev/sda1 /mnt 

mount: Mounting /dev/sda1 on /mnt failed: No such device# mount -t vfat /dev/hda1 /mnt 

mount: Mounting /dev/hda1 on /mnt failed: No such device#  

 

thank in advance ! 

 

jay
0 Kudos
Highlighted
Valued Contributor III

Re: USB device!

 

--- Quote Start ---  

originally posted by jay_1025@Apr 27 2006, 11:16 PM 

hi hippo 

 

i can detect the usb flash from booting messages that can&#39;t mount usb flash. 

 

uclinux/nios ii 

altera nios ii support © 2004 microtronix datacom ltd. 

 

setup_arch: no persistant network settings signature at 00bf0000 

built 1 zonelists 

kernel command line: 

pid hash table entries: 64 (order: 6, 1024 bytes) 

dentry cache hash table entries: 2048 (order: 1, 8192 bytes) 

inode-cache hash table entries: 1024 (order: 0, 4096 bytes) 

memory available: 5968k/8192k ram, 0k/0k rom (1577k kernel code, 554k data) 

mount-cache hash table entries: 512 

net: registered protocol family 16 

scsi subsystem initialized 

usbcore: registered new driver usbfs 

usbcore: registered new driver hub 

io scheduler noop registered 

io scheduler deadline registered (default) 

serial: jtag uart driver $revision: 1.4 $ 

ttyj0 at mmio 0x80c81120 (irq = 1) is a jtag_uart 

dmfe_probe:eth0, 50000 khz nios 

<dm9000> eth0 i/o: 80c81130, vid: 90000a46 

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

dmfe_probe:eth1, 50000 khz nios 

usbmon: debugfs is not available 

driver isp1362-hcd, 2005-04-04 

isp1362-hcd isp1362-hcd: isp1362 host controller 

isp1362_hc_reset: 

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

isp1362-hcd isp1362-hcd: irq 4, io mem 0x80c810d0 

isp1362_hc_start: 

isp1362-hcd isp1362-hcd: isp1362 memory usage: 

isp1362-hcd isp1362-hcd: istl:    2 *  256:      512 @ $0000:$0100 

isp1362-hcd isp1362-hcd: intl: 16 * ( 64+8):  1152 @ $0200 

isp1362-hcd isp1362-hcd: atl : 32 * ( 64+8):  2304 @ $0680 

isp1362-hcd isp1362-hcd: used/free: 3968    128 

usb usb1: configuration# 1 chosen from 1 choice 

hub 1-0:1.0: usb hub found 

hub 1-0:1.0: 2 ports detected 

isp1362 host controller, irq 4 

initializing usb mass storage driver... 

usbcore: registered new driver usb-storage 

usb mass storage support registered. 

net: registered protocol family 2 

ip route cache hash table entries: 128 (order: -3, 512 bytes) 

tcp established hash table entries: 512 (order: -1, 2048 bytes) 

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

tcp: hash tables configured (established 512 bind 512) 

tcp reno registered 

tcp bic registered 

net: registered protocol family 1 

net: registered protocol family 10 

ipv6 over ipv4 tunneling driver 

net: registered protocol family 17 

freeing unused kernel memory: 436k freed (0x19c000 - 0x208000) 

init started:  busybox v1.1.1-pre0 (2006.04.20-12:52+0000) multi-call binary 

usb 1-2: new full speed usb device using isp1362-hcd and address 2 

usb 1-2: configuration# 1 chosen from 1 choice 

scsi0 : scsi emulation for usb mass storage devices 

 

 

busybox v1.1.1-pre0 (2006.04.20-12:52+0000) built-in shell (msh) 

enter &#39;help&#39; for a list of built-in commands. 

# vendor: sigmatel  model: mscn              rev: 0001 

  type: direct-access                      ansi scsi revision: 04 

# mount -t vfat /dev/sda1 /mnt 

mount: mounting /dev/sda1 on /mnt failed: no such device# mount -t vfat /dev/hda1 /mnt 

mount: mounting /dev/hda1 on /mnt failed: no such device#  

 

thank in advance ! 

 

jay 

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

--- quote end ---  

 

--- Quote End ---  

 

 

There isn&#39;t sda or sda1 detected. 

Did you select scsi disk , and usb mass storage in kernel config?
0 Kudos
Highlighted
Valued Contributor III

Re: USB device!

TO_BE_DONE

0 Kudos
Highlighted
Valued Contributor III

Re: USB device!

TO_BE_DONE

0 Kudos