All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Thomas Kleffel (LKML)" <lkml@maintech.de>
To: B.Zolnierkiewicz@elka.pw.edu.pl
Cc: linux-kernel@vger.kernel.org, linux-ide@vger.kernel.org,
	linux-pcmcia@lists.infradead.org
Subject: [PATCH] Make ide-cs work for hardware with 8-bit CF-Interface
Date: Tue, 06 Sep 2005 18:47:08 +0200	[thread overview]
Message-ID: <431DC80C.8030706@maintech.de> (raw)

Hello,

it is technically possible to access a CF-Card with an 8-bit width bus.

The problem with the current code is that the IDE code does a 16 (or 32) 
bit read on the IDE data register. If the bus interface for a 8-bit bus 
would then do two reads to offsets 0 and 1.

The second read (to offset 1) then reads the error register instead of 
the data register's odd byte.

To fix this problem I've changed the ide-cs code to use the duplicated 
data registers at offset 8 and 9 which are not overlapped with anything.

According to the specs, those registers should be there in every CF 
card. I've tested this with a couple of CFs, including SanDisk, 
Microdrive and several NoNames.

The specific architechture I'm using this on is a AT91RM9200 with kernel 
2.6.13 and the patches from http://maxim.org.za/AT91RM9200/2.6/.

For more information on the overlapped / non-overlapped registers see 
http://www.compactflash.org/cfspc3_0.pdf - page 96

The following patch is against vanilla 2.6.13.

ldiff -uprN a/drivers/ide/legacy/ide-cs.c b/drivers/ide/legacy/ide-cs.c
--- a/drivers/ide/legacy/ide-cs.c       2005-08-08 15:30:35.000000000 +0200
+++ b/drivers/ide/legacy/ide-cs.c       2005-09-05 02:09:47.000000000 +0200
@@ -186,7 +186,8 @@ static int idecs_register(unsigned long
  {
      hw_regs_t hw;
      memset(&hw, 0, sizeof(hw));
-    ide_init_hwif_ports(&hw, io, ctl, NULL);
+    ide_std_init_ports(&hw, io, ctl);
+    hw.io_ports[IDE_DATA_OFFSET] = io + 0x08;
      hw.irq = irq;
      hw.chipset = ide_pci;
      return ide_register_hw_with_fixup(&hw, NULL, ide_undecoded_slave);


Signed-off-by: Thomas Kleffel <tk@maintech.de>


Best regards,

Thomas

             reply	other threads:[~2005-09-06 16:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-06 16:47 Thomas Kleffel (LKML) [this message]
2005-09-06 22:20 ` [PATCH] Make ide-cs work for hardware with 8-bit CF-Interface David Hinds
2005-09-06 23:30 ` Alan Cox

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=431DC80C.8030706@maintech.de \
    --to=lkml@maintech.de \
    --cc=B.Zolnierkiewicz@elka.pw.edu.pl \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pcmcia@lists.infradead.org \
    /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.