Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Jun 1999 12:47:10 -0400
From:      Christopher Masto <chris@netmonger.net>
To:        Warner Losh <imp@harmony.village.org>, Olaf Erb <erb@inss1.etec.uni-karlsruhe.de>
Cc:        freebsd-mobile@FreeBSD.ORG
Subject:   Re: SanDisk Compact Flash Card on Dell Inspiron 3500
Message-ID:  <19990630124710.A5690@netmonger.net>
In-Reply-To: <199906300335.VAA25199@harmony.village.org>; from Warner Losh on Tue, Jun 29, 1999 at 09:35:15PM -0600
References:  <19990629135945.A35510@erb.nu> <199906300335.VAA25199@harmony.village.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Jun 29, 1999 at 09:35:15PM -0600, Warner Losh wrote:
> In message <19990629135945.A35510@erb.nu> Olaf Erb writes:
> : how do I attach a SanDisk CF Card? 
> 
> w/o pao, you can't.  With PAO you can do this, only if you can somehow
> disable one of the them.

Actually, I'm using a SanDisk flash card under -current.  I posted
this to -hardware a while back..

It's a pain to hook up the port replicator, serial cable, etc. every
time I want to download some pictures from my camera, so I hacked the
pccard support back into the -current wd driver.  I know that Warner
is working on the pccard newbus stuff; this was just an interim
workaround.  Anyway, I did it for me, but this subject comes up once
in a while, so I thought I'd mention it here so it'll at least be in
the archives if someone needs it.

The actual patch is on http://www.netmonger.net/~chris/freebsd/

The README follows:

This is an ugly hack to make my SanDisk PC card compact flash adapter
work on current (as of 1-Jun-1999).  It probably work with other ATA
flash cards as well.  The following things are done:

1. PCCARD interface added
   Minor adjustments for -current.  I removed the static configuration
   thing since I didn't understand it.

2. Attempts to allow removal/reinsertion
   This is based on code that I believe came from Tatsumi Hosokawa at
   some point.  I took out some of the TODOs because this whole thing is
   going away soon anyway.  In my experimentation, if the flash card is
   unmounted before being ejected, it's perfectly safe.  I have switched
   between a 3C509 and the SanDisk card several times with no ill
   effects.  It appears to be Good Enough For Now.

3. Workaround for funky I/O ports
   This is the really ugly part.  The wd driver makes assumptions that
   pretty much limit you to having two IDE controllers, at 0x1f0 and
   0x170.  While my VAIO only has one IDE controller onboard, and the
   SanDisk card is able to appear at 0x170, it didn't seem to work
   properly unless I booted with the card in.  Perhaps the VAIO reserves
   that space for the optional CDROM.  In any event, the SanDisk card has
   a configuration that allows it to be put at any location.  The catch
   is that wd also assumes that the alternate status register is located
   0x206 above the base port.  In the case of the SanDisk's "anywhere"
   configuration, this is not true - the ports are all lumped together.
   So there's a little hack that uses a different offset if the base
   port is not 0x170 or 0x1f0.

To use (assuming your hardware is identical to mine):

Patch.
Configure kernel.  Add an extra wdc, disabled.  Add a drive to it.
> controller      wdc1    at isa? disable port IO_WD2 irq 15
> disk            wd2     at wdc1 drive 0
Configure pccard.conf.  If you have the SanDisk card I have, it would
  go like this:
> card "SunDisk" "SDP"
>         config  0x1 "wdc1" 15
>         insert  echo SunDisk Flash ATA Inserted
>         remove  echo SunDisk Flash ATA Removed
Note that the configuration is changed from the sample file's 3 to 1.
  config 3 has it at 0x170, which isn't happy on my laptop.

That should do it.  On my machine, when I pop the Compact Flash from
my Kodak DC210 into the SanDisk adapter, and into the card slot,
I see:

> Card inserted, slot 0
> wdc1: unit 0 (wd2): <SunDisk SDCFB-8>
> wd2: 7MB (15680 sectors), 245 cyls, 2 heads, 32 S/T, 512 B/S
> wd2: ATA INQUIRE valid = 0001, dmamword = 0000, apio = 0000, udma = 0000

I can then mount -t msdos /dev/wd2s1 /flash   and access the files.

As I said, this works _for me_.  My primary objective was to regain
convenient use of my digital camera under -current while waiting for
the pccard newbusification.  I know this is ugly and wrong and
incomplete, but it does what I need for now.  I am putting it here in
case it is of use to someone else.

And thanks to SanDisk for putting extremely detailed documentation on
their web site, and for making such a nifty adapter.
-- 
Christopher Masto         Senior Network Monkey      NetMonger Communications
chris@netmonger.net        info@netmonger.net        http://www.netmonger.net

Free yourself, free your machine, free the daemon -- http://www.freebsd.org/


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-mobile" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990630124710.A5690>