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++
12600 Discussions

libata-core Disabling IRQ with new Compact Flash

Altera_Forum
Honored Contributor II
1,733 Views

We use compact flashes a lot on Altera evaluations boards with CF - with a custom daughter card (on DE115 Terasic) and on custom PBCs.

 

But -- have run into a problem. I'm attempting to track this down myself but would appreciate any leads. 

 

Previously: 32 GByte SwissBit Series 320 (UDMA/66) works fine in non-mmu systems and the latest MMU release.

Previously: 64 GByte SanDisk (UDMA7) works fine too.

 

Now: 64 GBypte SwissBit Series 440 (UDMA/133) -- WILL NOT

I HAVE FOUND OUT THAT THIS NEW SERIES UTILIZES -- 

48-bit Logical Block Addressing (LBA) is a technology which extends the capacity of IDE ATA/ATAPI devices beyond a previous limit of 137.4 GB.

http://www.48bitLBA.com

Which appears to be the problem

 

PROBLEM IS (piece of boot messages): 

 

scsi0 : pata_altera_cf

ata1: PATA max PIO4 mmio cmd 0x8425040 ctl 0x8425078 irq 5

irq 5: nobody cared (try booting with the "irqpoll" option)

 

the ---> STACK DUMP

 

Disabling IRQ #5

 

************************************************** ********************

Here are the PROBLEM boot messages for the 64GByte SwissBit

************************************************** ********************

 

Uncompressing Linux... Ok, booting the kernel.

Linux version 2.6.Ok, booting the kernel.

Linux version 2.6.30 (janet@localhost.localdomain) (gcc version 3.4.6) #4297 PREEMPT Tue Apr 16 09:49:45 PDT 2013

 

 

uClinux/Nios II

Built 1 zonelists in Zone order, mobility grouping off. Total pages: 8128

Kernel command line: 

NR_IRQS:32

PID hash table entries: 128 (order: 7, 512 bytes)

I-pipe 1.2-00: pipeline enabled.

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

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

Memory available: 29304k/3165k RAM, 0k/0k ROM (1911k kernel code, 1254k data)

Calibrating delay loop... 49.25 BogoMIPS (lpj=246272)

Mount-cache hash table entries: 512

net_namespace: 264 bytes

NET: Registered protocol family 16

init_BSP(): registering device resources

bio: create slab <bio-0> at 0

SCSI subsystem initialized

NET: Registered protocol family 2

IP route cache hash table entries: 1024 (order: 0, 4096 bytes)

TCP established hash table entries: 1024 (order: 1, 8192 bytes)

TCP bind hash table entries: 1024 (order: 0, 4096 bytes)

TCP: Hash tables configured (established 1024 bind 1024)

TCP reno registered

NET: Registered protocol family 1

io scheduler noop registered

io scheduler deadline registered (default)

ttyJ0 at MMIO 0x8425218 (irq = 11) is a Altera JTAG UART

console [ttyJ0] enabled

b1 0x04600000 buf1VertAddr 0x84600000

b2 0x04800000 buf2VertAddr 0x84800000

IRQ requested 1 successfully 

OUT OF BOARD RESET 0x0 

sharedMem 0x04a00000 sharedMemVertAddr 0x84a00000

SERIAL-->OUT OF BOARD RESET 0x0 

Driver 'sd' needs updating - please use bus_type methods

smc91x.c: v1.1, sep 22 2004 by Nicolas Pitre <nico@cam.org>

eth0: SMC91C11xFD (rev 2) at 88410300 IRQ 3 [nowait]

eth0: Invalid ethernet MAC address. Please set using ifconfig

TCP cubic registered

NET: Registered protocol family 17

RPC: Registered udp transport module.

RPC: Registered tcp transport module.

Freeing unused kernel memory: 956k freed (0x4228000 - 0x4316000)

Shell invoked to run file: /etc/rc

Command: hostname uClinux

Command: mount -t proc proc /proc -o noexec,nosuid,nodev

Command: mount -t sysfs sysfs /sys -o noexec,nosuid,nodev

Command: mount -t devpts devpts /dev/pts -o noexec,nosuid

scsi0 : pata_altera_cf

ata1: PATA max PIO4 mmio cmd 0x8425040 ctl 0x8425078 irq 5

Command: mkdir /var/tmp

irq 5: nobody cared (try booting with the "irqpoll" option)

Stack from 043adddc:<0>

<0> 00000000<0> 0403db64<0> 0421d500<0> 0403dd6c<0> 0403c314<0> 00000000<0> 04210ea4<0> 00000005<0>

<0> 045b8b20<0> ffffe000<0> 0421d500<0> 0403edf8<0> 00000000<0> 00000000<0> 04220d88<0> 00000005<0>

<0> 04005300<0> 00000000<0> 00000005<0> 04210ef4<0> 04041140<0> ffffffff<0> 04210ef4<0> 0421df20<0>

<0> 00000001<0> 04210ea4<0> 0421df28<0> 0421df2c<0> 04210ea4<0> 04210ea4<0> 000001b8<0> 04041574<0>

<0> 04210ea8<0> 00000050<0> 00000005<0> 04210ea4<0> 04005148<0> deadbeef<0> 04396c28<0> 043c12dc<0>

<0> 0421b6ac<0> 000000ff<0> 0421df28<0> 04210ea4<0> 043adea8<0> deadbeef<0> 040051f0<0> 00004a38<0>

Call Trace:<0>

<0> [<04000aa4>]<0> [<04148508>]<0> [<041484e8>]<0> [<04148498>]<0>

<0> [<04025ba4>]<0> [<0402af4c>]<0> [<0402af4c>]<0> [<040259f8>]<0>

<0> [<0402a3fc>]<0> [<04001fbc>]<0> [<04007e7c>]<0> [<04000c38>]<0>

<0> [<0402a364>]<0> [<0402a848>]<0> [<04001fac>]<0>

handlers:

[<04148bac>]

Disabling IRQ #5

 

Command: mkdir /var/log

Command: mkdir /var/run

Command: mkdir /var/lock

Command: mkdir /var/empty

Command: cat /etc/motd

Welcome to

____ _ _

/ __| ||_| 

_ _| | | | _ ____ _ _ _ _ 

| | | | | | || | _ \| | | |\ \/ /

| |_| | |__| || | | | | |_| |/ \

| ___\____|_||_|_| |_|\____|\_/\_/

| |

|_|

 

For further information check:

http://www.uclinux.org/

 

Command: cd /home

Execution Finished, Exiting

 

Sash command shell (version ata1.00: CFA: SFCF64GBH2BU4TO-I-NU-517-STD, 120504, max UDMA/133

ata1.00: 125313024 sectors, multi 0: LBA48 

ata1.00: configured for PIO0

1.1.1)

/> scsi 0:0:0:0: Direct-Access ATA SFCF64GBH2BU4TO- 1205 PQ: 0 ANSI: 5

sd 0:0:0:0: [sda] 125313024 512-byte hardware sectors: (64.1 GB/59.7 Gi

sd 0:0:0:0: [sda] Write Protect is off

sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA

sda:<4>ata1: lost interrupt (Status 0x58)

ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen

ata1.00: cmd 20/00:08:00:00:00/00:00:00:00:00/e0 tag 0 pio 4096 in

res 40/00:00:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout)

ata1.00: status: { DRDY }

ata1: soft resetting link

ata1.00: configured for PIO0

ata1: EH complete

ata1: lost interrupt (Status 0x58)

ata1.00: limiting speed to UDMA7:PIO5

ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen

ata1.00: cmd 20/00:08:00:00:00/00:00:00:00:00/e0 tag 0 pio 4096 in

res 40/00:00:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout)

ata1.00: status: { DRDY }

ata1: soft resetting link

ata1.00: configured for PIO0

ata1: EH complete

ata1: lost interrupt (Status 0x58)

ata1.00: limiting speed to PIO0

ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen

ata1.00: cmd 20/00:08:00:00:00/00:00:00:00:00/e0 tag 0 pio 4096 in

res 40/00:00:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout)

ata1.00: status: { DRDY }

ata1: soft resetting link

ata1.00: configured for PIO0

ata1: EH complete

ata1: lost interrupt (Status 0x58)

ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen

ata1.00: cmd 20/00:08:00:00:00/00:00:00:00:00/e0 tag 0 pio 4096 in

res 40/00:00:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout)

ata1.00: status: { DRDY }

ata1: soft resetting link

ata1.00: configured for PIO0

ata1: EH complete

ata1: lost interrupt (Status 0x58)

ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen

ata1.00: cmd 20/00:08:00:00:00/00:00:00:00:00/e0 tag 0 pio 4096 in

res 40/00:00:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout)

ata1.00: status: { DRDY }

ata1: soft resetting link

ata1.00: configured for PIO0

ata1: EH complete

************************************************** ********************

************************************************** ********************

************************************************** ********************

************************************************** ********************

 

************************************************** ********************

Here are the GOOD boot messages for 32 GByte SwissBit

************************************************** ********************

DON'T HAVE ROOM --

 

************************************************** ******************

If anyone could help me understand where to look, what interactions may cause this, etc. I would greatly appreciate it.

0 Kudos
8 Replies
Altera_Forum
Honored Contributor II
477 Views

Hi, 

 

How about the 32 GByte SwissBit Series 320 (UDMA/66) or 64 GByte SanDisk (UDMA7) cases. Do they use interruptions? Please check it, for example by 'cat /proc/interrupts', etc. 

It seems that the kernel can't detect the interrupt handler for IRQ5. Do you use the IRQ No.5 line for your ATA interface? 

 

Kazu
0 Kudos
Altera_Forum
Honored Contributor II
477 Views

Kazu, 

 

Yes the 32 GByte SwissBit Series 320 (UDMA/66) or 64 GByte SanDisk (UDMA7) DO USE THE SAME INTERRUPT. 

 

HERE IS WHAT I KNOW NOW after working on this more: 

 

1. The ata driver enables interrupts during boot process to identify the device as it is going through the identification of "what is out there" process. 

 

2. The Compact Flashes that WORK generate their first interrupt approximately 25 msec later than the 64 GByte Swiss Bit. (We have hooked a logic analyzer up to our Terasic Board with our PCB daughter card with CF) - SO SOME CRITIAL BOOT SETUP HAS NOT HAPPENED AND the OS does not indicate that this interrupt has been ENABLED -- so eventually the error --  

 

irq 5: nobody cared (try booting with the "irqpoll" option) 

 

I have asked the firmware designer to "hold off" the first interrupt for 30 msec to see if we can at least get the system to boot. Hopefully we'll look at that today. 

 

3. The 64 GByte SwissBit 440 Series default setting IS LBA48. I'm not sure that will be a problem IF we can get through the boot process. IF ANYONE HAS ANY INSIGHT INTO WHETHER the nios2 can handle devices with LBA48 enabled I'd apprecate it. I'm thinking this will be a problem. 

 

ANY OTHER insight is welcome - Thanks in Advance
0 Kudos
Altera_Forum
Honored Contributor II
477 Views

Hi, 

 

At first, please check whether the IRQ 5 is registered or not. It may be registered by the function 'ata_host_activate' and this is called in the ' altcf_detect_cf' of 'pata_altera_cf.c'. 

 

Kazu
0 Kudos
Altera_Forum
Honored Contributor II
477 Views

Kazu, 

I have spent a lot of time understanding this and YES the IRQ is being registered. I put printk's in to understand things better.  

 

Talking to SwissBit this --> CF IS NOT backward compatible as the ATA Spec says that it should have been designed - I believe that eventhough I'm under the magic 137 GBbyte limit I need to write like I'm in 48-bit address mode. So, I modified the driver to write to the fifos in the Sector Count Sector,LBA Low LBA, LBA Mid LBA and LBA High LBA twice with the first write being ZEROS. This is in the routine "ata_sff_tf_load" and some others. I am working on this and will post when I get my results. 

 

If I fail I would really like some more insight into the ATA and what I am missing. 

 

Thanks
0 Kudos
Altera_Forum
Honored Contributor II
477 Views

Hi, 

 

 

--- Quote Start ---  

 

I have spent a lot of time understanding this and YES the IRQ is being registered. I put printk's in to understand things better.  

 

--- Quote End ---  

 

 

If the handler is well registered, please check whether it is called or not when the IDE interruption occurs. Maybe the function 'ata_sff_interrupt' will be called, so check its return value 'handled'.  

 

Kazu
0 Kudos
Altera_Forum
Honored Contributor II
477 Views

Kazu, 

The interrupt IS NOT getting handled, so not cleared (we see that on the o-scope too). 

It just is stuck going in & out of ata_sff_interrupt. When the system finally give up, 

And I do a "cat /proc/interrupts" there have been 100,000 interrupt calls! On a normal boot there are only 9.
0 Kudos
Altera_Forum
Honored Contributor II
477 Views

I went back to the NIOS II IDE and verified that this new CF has a controller problem, the interrupt IS NOT cleared when the status register is read. This goes against the ATA spec. We will be contacting the company.

0 Kudos
Altera_Forum
Honored Contributor II
477 Views

 

--- Quote Start ---  

I went back to the NIOS II IDE and verified that this new CF has a controller problem, the interrupt IS NOT cleared when the status register is read. This goes against the ATA spec. We will be contacting the company. 

--- Quote End ---  

 

 

Hi jpe1313 and Kazuyasu, 

 

as I understand the C-440 cards have following behaviour: 

After 500ms host inactivity the card goes in idle mode to save energy. 

In idle mode it does not clear the interrupt line, even if the status register is read. 

The card wakes up from idle mode only by writing the command register. 

In normal cases the host always starts with an idle command after a longer inactivity. 

 

  • could your problem be related to this inactivity time? 

 

 

I investigated the behaviour of a Swissbit C-440 card at a standard mainboard with debug environment of DOS and recorded the trace: 

 

https://www.alteraforum.com/forum/attachment.php?attachmentid=7317  

 

After writing the command register with 0xEC  

DASP down 

PDIAG down 

PDIA up 

interrupt up 

read status register (780µs after the command) -->0x58 

interrupt down (56ns after rising iord-edge) 

 

During this  

IORDY, PDIAG-, IOCS16, RESET-, DMACK-, CS1, IOWR- high 

DMARQ, DASP low 

CS0 high, low before reading the status register 

 

  • what are the differences in your system? 

  • could you make a trace? 

 

 

Marco
0 Kudos
Reply