This is not really a driver per se, but rather a collection of architecture-dependent patches necessary to access CompactFlash storage cards using the standard pata_pcmcia driver. The overall picture looks something like this:
The at32_cf driver has also been tested with the orinoco_cs driver and a Linksys 801.11b CF card. It should also be usable with the legacy ide-cs driver, but this has not been tested (yet.) CardBus? devices will most likely not work.
For the driver to work on STK1000, one minor hack is necessary. An additional hack is necessary for card detection to work.
On the STK1000, the -READY interrupt is connected to EIM_EXTINT_5, which doesn't exist on the AT32AP7000. Both EIM_EXTINT_5 and EIM_EXTINT_3 (which the driver is set up to use as default) are present on the J29 header, located between the ATSTK1002 daughterboard and the LCD panel. To route the -READY interrupt to the AP7000 external interrupt module, simply connect pins 27 and 29 on J29 together using a jumper or a short piece of wire.
On a standard STK1000 card, the CF RESET signal is hooked up to the board reset. Some cards may be able to cope with this, but for the driver to be able to reset the card, RESET must be re-wired to a GPIO signal. The 2.6.20 patches are hard-wired to use GPIO14 for RESET, while the 2.6.22 patches default to not controlling the RESET line.
To use RESET, set CONFIG_BOARD_ATSTK1002_CF_HACKS = y and select the GPIO pin to use. The you need to lift the -CD1 pin at the CF connector from the PCB and strap it to the selected GPIO line (i.e. pin 7 on J2, one of the four 10-pin GPIO headers, when using GPIO14.)
This hack isn't entirely necessary -- if you set the detect_pin member of cf0_data in arch/avr32/boards/atstk1000/atstk1002.c to 0, the driver will simply assume the card is always present.
On a standard STK1000 card, the -CD1 signal is connected to GPIO29, which is multiplexed with MACB0_RXER on the STK1002. Unfortunately, this means that if you want CompactFlash card detection to work, you need to disable MACB0.
If you want to both have card detection work, and still be able to use MACB0, you need to wire the -CD1 to a different GPIO line. The driver is set up to not use card detection by default, but this can be changed by running "make menuconfig" by setting CONFIG_BOARD_ATSTK1002_CF_HACKS = y. For example, to use GPIO15 for -CD1 (the default when the hack option is enabled) you need to lift the -CD1 pin at the CF connector from the PCB and strap it to pin 8 on J2 (one of the four 10-pin GPIO headers.) Don't forget to add a pull-up resistor to 3.3V.
Note that the 2.6.20 and 2.6.21 patches use different defaults and aren't as configurable.
The patches for 2.6.22.atmel.1 should apply with some minor rejects. In addition, the following patch is needed:
The latest atmel-2.6.22, atmel-2.6.23 and master branches from git includes the latest incarnation of the at32_cf driver, including the above patch.
Note: These patches uses EXTINT3 as an external interrupt and are hardwired to use RESET pm GPIO14 and -CD1 on GPIO13. This has changed in the newer patches above.
Older kernels should work as well, with a few minor changes. The platform code (i.e. the platform_device definitions) is most likely to cause conflicts. If you do the necessary tweaking to apply these patches on top of older kernel, feel free to attach the modified patches here.
Note that avr32-make-i-o-access-macros-work-with-external-devices.patch breaks the serial driver in the 2.6.20-avr1 kernel, and possibly other kernels as well. The atmel_serial driver has been fixed upstream, so 2.6.21-rc should be fine.
Also note that some CompactFlash cards may be buggy in various ways. Some cards refuse PIO mode setting; a workaround for this has been merged in the upstream kernel, but not in time for the 2.6.20 release. Yet other cards may come up as both master and slave. No workarounds exists for this problem AFAIK, but such cards should work just fine apart from the fact that they show up as two different devices.
Do as above, but drop the patch "avr32-make-i-o-access-macros-work-with-external-devices.patch" and apply at32_cf-fix-compile-errors-and-warnings-for-2.6.21.1.patch.