Hello,

We have a problems in connecting CompactFlash memory card to
AT91RM9200-based board.

The board schematic in part of CF-interface is equal to AT91RM9200DK.
The Linux Kernel version is
2.6.17 with applied 2.6.17-at91.patch from
http://maxim.org.za/at91_26.html. The CompactFlash
card is SanDisk 128MB. On the board is installed pcmciautils-014 and
udev-094.

With enabled "PCCARD (PCMCIA/CardBus) support" and disabled
"ATA/ATAPI/MFM/RLL support"
in kernel's configuration, pcmciautils shows the following:

# pccardctl ident
Socket 0:
product info: "SanDisk", "SDP", "5/3 0.6", ""
manfid: 0x0045, 0x0401
function: 4 (fixed disk)
/
# pccardctl ls
Socket 0 Bridge: [at91_cf] (bus ID: at91_cf)
Socket 0 Device 0: [-- no driver --] (bus ID: 0.0)

After enabled "ATA/ATAPI/MFM/RLL support", messages on the terminal
(after insert of CF-card):

at91_cf: card present
cs: pcmcia_socket0: parse_events: events 00000080
cs: pcmcia_socket0: insert
cs: pcmcia_socket0: setup
at91_cf: Vcc 33, io_irq 0, flags 0000 csc 0080
cs: pcmcia_socket0: reset
at91_cf: Vcc 33, io_irq 0, flags 0240 csc 0080
at91_cf: Vcc 33, io_irq 0, flags 0200 csc 0080
pccard: PCMCIA card inserted into slot 0
cs: pcmcia_socket0: insert done
cs: pcmcia_socket0: send_event(event 4, pri 0, callback 0xc019fc58)
ds: ds_event(0x000004, 0, 0xc0cc2400)
cs: pcmcia_socket0: pcmcia_read_cis_mem(1, 0x0, 2)
....
pcmcia: registering new device pcmcia0.0
...
at91_cf: Vcc 33, io_irq 0, flags 0200 csc 0080
at91_cf: Vcc 33, io_irq 161, flags 0220 csc 0080
cs: pcmcia_socket0: pcmcia_write_cis_mem(1, 0x103, 1)
cs: pcmcia_socket0: pcmcia_write_cis_mem(1, 0x100, 1)
cs: pcmcia_socket0: pcmcia_write_cis_mem(1, 0x101, 1)
cs: pcmcia_socket0: pcmcia_write_cis_mem(1, 0x102, 1)
at91_cf: 16bit i/o bus
Probing IDE interface ide0...
'#^3nv#`$, ATA DISK drive
Unable to handle kernel NULL pointer dereference at virtual address
00000008
pgd = c0004000
[00000008] *pgd=00000000
Internal error: Oops: 17 [#1]
Modules linked in:
CPU: 0
PC is at enable_irq+0x6c/0xe4
LR is at enable_irq+0x70/0xe4

So something goes wrong. My question is: How I can mount this CF-card
on our board?
What goes wrong?

Thanks in advice.

The kernel configuration related to PCMCIA is:

#
# PCCARD (PCMCIA/CardBus) support
#
CONFIG_PCCARD=y
CONFIG_PCMCIA_DEBUG=y
CONFIG_PCMCIA=y
CONFIG_PCMCIA_LOAD_CIS=y
CONFIG_PCMCIA_IOCTL=y

#
# PC-card bridges
#
CONFIG_AT91_CF=y

The kernel configuration relaited to ATA is:

#
# ATA/ATAPI/MFM/RLL support
#
CONFIG_IDE=y
CONFIG_BLK_DEV_IDE=y

CONFIG_BLK_DEV_IDECS=y
#
# IDE chipset support/bugfixes
#
CONFIG_IDE_GENERIC=y

The kernel boot messages:

Linux version 2.6.17 (dmitriy@localhost) (gcc version 3.4.3) #86 Mon
Nov 20 12:3
6:52 EET 2006
CPU: ARM920Tid(wb) [41129200] revision 0 (ARMv4T)
Machine: uCrouter EVM9200
Memory policy: ECC disabled, Data cache writeback
On node 0 totalpages: 4096
DMA zone: 4096 pages, LIFO batch:0
Clocks: CPU 179 MHz, master 44 MHz, main 18.432 MHz
CPU0: D VIVT write-back cache
CPU0: I cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets
CPU0: D cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets
Built 1 zonelists
Kernel command line: root=/dev/ram rw initrd=0x20500000,0x500000
ramdisk_size=10
000 console=ttyS0,115200 mem=16M debug pcmcia_core.pc_debug=9
pcmcia.pc_debug=9
AT91: 128 gpio irqs in 4 banks
PID hash table entries: 128 (order: 7, 512 bytes)
Console: colour dummy device 80x30
Dentry cache hash table entries: 2048 (order: 1, 8192 bytes)
Inode-cache hash table entries: 1024 (order: 0, 4096 bytes)
Memory: 16MB = 16MB total
Memory: 9136KB available (1464K code, 381K data, 88K init)
Calibrating delay loop... 89.70 BogoMIPS (lpj=448512)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
checking if image is initramfs...it isn't (bad gzip magic numbers);
looks like a
n initrd
Freeing initrd memory: 5120K
NET: Registered protocol family 16
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: 256 (order: -2, 1024 bytes)
TCP: Hash tables configured (established 512 bind 256)
TCP reno registered
NetWinder Floating Point Emulator V0.97 (double precision)
io scheduler noop registered
io scheduler anticipatory registered (default)
AT91 Watchdog Timer enabled (5 seconds, nowayout)
at91_usart.0: ttyS0 at MMIO 0xfefff200 (irq = 1) is a AT91_SERIAL
at91_usart.1: ttyS1 at MMIO 0xfffc4000 (irq = 7) is a AT91_SERIAL
RAMDISK driver initialized: 16 RAM disks of 10000K size 1024 blocksize
eth0: Link now 10ernet at 0efbc000 int=24 100-FullDuplex (12:34:56:c)
eth0: ealtek RTL8201(B)L PHY
Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2
ide: Assuming 50MHz system bus speed for PIO modes; override with
idebus=xx
at91_cf: irqs det #1110
cs: : pmcia_register_socket(0xc019fda8)
at91_cf: Vcc 0, io_irq 0, flags 0000 csc 0080
cs: pcmcia_socket0: parse_events: events 00000080
mice: PS/2 mouse device common for all mice
at91_rtc at91_rtc: rtc intf: sysfs
at91_rtc at91_rtc: rtc intf: proc
at91_rtc at91_rtc: rtc intf: dev (253:0)
at91_rtc at91_rtc: rtc core: registered at91_rtc as rtc0
AT91 Real Time Clock driver.
MMC: 4 wire bus mode not supported by this driver - using 1 wire
TCP bic registered
NET: Registered protocol family 1
NET: Registered protocol family 17
RAMDISK: ext2 filesystem found at block 0
RAMDISK: Loading 5000KiB [1 disk] into ram disk... done.
VFS: Mounted root (ext2 filesystem).