All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marco Lazzarotto <m.lazzarotto@robox.it>
To: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>,
	Pavel Machek <pavel@ucw.cz>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Trouble using some (fast) compact flash as ide device on an embedded system
Date: Tue, 06 Mar 2007 10:19:20 +0100	[thread overview]
Message-ID: <45ED3218.5000406@robox.it> (raw)
In-Reply-To: <200703052316.50257.bzolnier@gmail.com>

Ciao!

Bartlomiej Zolnierkiewicz ha scritto:
> On Friday 02 March 2007, Pavel Machek wrote:
> 
>>Hi!
>>
>>
>>>As I reported in bug 8036 in bugzilla.kernel.org,
>>>
>>>Hardware Environment:
>>>
>>> - Use a compact flash SanDisk SDCFB-128 Firmware revision HDX 2.15
>>>   (we used other compact flashes with the same hw ad sw for years
>>>    with  no trouble)
>>>
>>>It happens on both etx boards:
>>> - VIA SOM-ETX (4475)
>>> - Gene-4312

ERRATA CORRIGE: Gene-4312 is not a etx board ;-) but a pc/104

>>>
>>>Doing the command
>>>sfdisk -R /dev/hdc
>>>
>>>gives:
>>>
>>> * * *
>>>ide1: start_request: current=0xc6ebe754 (rq->sect=0,block 0)
>>>hdc: status error: status=0x58 { DriveReady SeekComplete DataRequest }
>>>ide: failed opcode was: unknown
>>>hdc: drive not ready for command
>>>ide1: start_request: current=0xc6ebe754 (rq->sect=0,block 0)
>>>hdc: do_special: 0x02
>>>hdc: do_special: recalibrate
>>>ide1: start_request: current=0xc6ebe754 (rq->sect=0,block 0)
>>>hdc: reading: block=0 sectors=8, buffer = 0xc6cd40000
>>>ide1: end_request: current=0xc6ebe754
>>> * * *
>>>
>>>the 'bad bit' in status error is DataRequest
>>>
>>>
>>>
>>>doing
>>>sfdisk -l /dev/hdc
>>>
>>>gives:
>>>
>>> * * *
>>>ide1: start_request: current=0xc6ebecd4 (rq->sect=0,block 0)
>>>hdc: reading: block=0, sectors=32, buffer=0xc6f37000
>>>hdc: lost interrupt
>>>hdc: lost interrupt [and so on several times]
>>> * * *
>>>
>>>I have no knowledge of the internals of the linux kernel, but I'm a
>>>programmer and have both hardware and time to spend on solving this issue.
>>
>>Debug it, then :-). Try limiting its speed with hdparm to see if it
>>helps.

I tried hdparm -p 0 /dev/hdc but nothing changes

> I would suggest trying booting with "ide=nodma" first.

I tried this too, without success.
I disabled 'Use PCI DMA by default when available' in the kernel, if
this is enabled the message 'hdc: lost interrupt' comes when the kernel
tries to access the CF for the first time.

 * * * Other information : * * *

If I try hdparm -I /dev/hdc immediately after boot I receive:

/ # hdparm -I /dev/hdc

/dev/hdc:
hdc: ide_cmd_ioctl()
hdc: ide_do_drive_cmd()
ide1: start_request: current=0xc6e1dcc8 (rq->sect=0,block0)
hdc: status error: status=0x58 { DriveReady SeekComplete DataRequest }
ide: failed opcode was: 0xec
hdc: drive not ready for command

ATA device, with non-removable media
Standards:
	Likely used: 1
Configuration:
	Logical		max	current
	cylinders	0	0
	heads		0	0
	sectors/track	0	0
	--
	device size with M = 1024*1024:           0 MBytes
	device size with M = 1000*1000:           0 MBytes
Capabilities:
	IORDY not likely
	Cannot perform double-word IO
	R/W multiple sector transfer: not supported
	DMA: not supported
	PIO: pio0
/ #

Then, I must do for example

/ # dd if=/dev/hdc of=/dev/null bs=512 count=1 skip=128

ide1: start_request: current=0xc6e7fcd4 (rq->sect=128,block 128)
hdc: status error: status=0x58 { DriveReady SeekComplete DataRequest }
ide: failed opcode was: unknown
hdc: GOOD BITS   : ATA status=0x40 { DriveReady }
ide: failed opcode was: unknown
hdc: BAD BITS    : ATA status=0x08 { DataRequest }
ide: failed opcode was: unknown
hdc: drive not ready for command
ide1: start_request: current=0xc6e7fcd4 (rq->sect=128,block 128)
hdc: do_special: 0x02
hdc: do_special: recalibrate
ide1: start_request: current=0xc6e7fcd4 (rq->sect=128,block 128)
hdc: reading: block=128, sectors=8, buffer=0xc1306000
ide1: end_request:   current=0xc6e7fcd4
1+0 record in
1+0 record out
/ #

The lines with 'GOOD BITS' and 'BAD BITS' is debugging made by me in
drivers/ide/ide-iops.c :
    *startstop = ide_error(drive, "status error", stat);
+   *startstop = ide_error(drive, "GOOD BITS   ", (stat & good));
+   *startstop = ide_error(drive, "BAD BITS    ", (stat & bad));

After that, redoing the command
/ # dd if=/dev/hdc of=/dev/null bs=512 count=1 skip=128
does not give an error, and

/ # hdparm -I /dev/hdc	# gives:

CompactFlash ATA device, with removable media
	Model Number:       SanDisk SDCFB-128
	Serial Number:      012101G0604F3431
	Firmware Revision:  HDX 2.15
Standards:
	Supported: 10
	Likely used: 10
Configuration:
	Logical		max	current
	cylinders	980	497
	heads		8	8
	sectors/track	32	63
	--
	CHS current addressable sectors:     250488
	LBA    user addressable sectors:     250880
	device size with M = 1024*1024:         122 MBytes
	device size with M = 1000*1000:         128 MBytes
Capabilities:
	LBA, IORDY(may be)(cannot be disabled)
	Standby timer values: spec'd by Vendor
	R/W multiple sector transfer: Max = 1	Current = 1
	DMA: mdma0 mdma1 *mdma2
	     Cycle time: min=120ns recommended=120ns
	PIO: pio0 pio1 pio2 pio3 pio4
	     Cycle time: no flow control=120ns  IORDY flow control=120ns
	Integrity word not set (found 0x0000, expected 0x10a5)

/ #

after that,

/ # dd if=/dev/hdc of=/dev/null bs=512 count=1
ide1: start_request: current=0xc6e7fc24 (rq->sect=0,block=0)
hdc: reading: block=0, sectors=32, buffer=0xc1104000

hdc: lost interrupt
hdc: lost interrupt
...

> Should help if this is CF adapter without DMA support with DMA capable CF.
> [ Hmm, this should be in the documentation somewhere but actually isn't. ]
> 
> Thanks,
> Bart

Tanks
	Marco Lazzarotto

-- 
 *------------------------------------------------------------------*
 | Vi preghiamo, se questo messaggio fosse ricevuto per errore,     |
 | di avvisare il mittente e, tenuto conto delle responsabilita'    |
 | connesse all'indebito utilizzo e/o divulgazione del messaggio    |
 | e/o delle informazioni in esso contenute, di cancellare          |
 | l'originale e distruggere le varie copie o stampe. Grazie        |
 *------------------------------------------------------------------*
 | The information in this e-mail is solely for the addressee.      |
 | Please delete this e-mail if you are not the intended recipient. |
 | Do not disclose or distribute the communication in any form.     |
 *------------------------------------------------------------------*

  reply	other threads:[~2007-03-06  9:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-01 13:40 Trouble using some (fast) compact flash as ide device on an embedded system Marco Lazzarotto
2007-03-02 19:56 ` Pavel Machek
2007-03-05 22:16   ` Bartlomiej Zolnierkiewicz
2007-03-06  9:19     ` Marco Lazzarotto [this message]
2007-03-08 21:37       ` Bartlomiej Zolnierkiewicz
2007-03-09 17:22         ` Marco Lazzarotto
2007-03-09 22:53           ` Bartlomiej Zolnierkiewicz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45ED3218.5000406@robox.it \
    --to=m.lazzarotto@robox.it \
    --cc=bzolnier@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pavel@ucw.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.