#include <linux/blkdev.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/libata.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <scsi/scsi_cmnd.h>
#include <scsi/scsi_host.h>
#include <asm/amigaints.h>
#include <asm/amigayle.h>
#define DRV_NAME "pata_gayle"
#define DRV_VERSION "0.1.0"
#define GAYLE_CONTROL 0x101a
static struct scsi_host_template pata_gayle_sht = {
static unsigned int pata_gayle_data_xfer(struct ata_queued_cmd *qc,
unsigned int buflen, int rw)
struct ata_device *dev = qc->dev;
struct ata_port *ap = dev->link->ap;
void __iomem *data_addr = ap->ioaddr.data_addr;
unsigned int words = buflen >> 1;
raw_insw((u16 *)data_addr, (u16 *)buf, words);
raw_outsw((u16 *)data_addr, (u16 *)buf, words);
if (unlikely(buflen & 0x01)) {
unsigned char pad[2] = { };
raw_insw((u16 *)data_addr, (u16 *)pad, 1);
raw_outsw((u16 *)data_addr, (u16 *)pad, 1);
static int pata_gayle_set_mode(struct ata_link *link,
struct ata_device **unused)
ata_for_each_dev(dev, link, ENABLED) {
dev->pio_mode = dev->xfer_mode = XFER_PIO_0;
dev->xfer_shift = ATA_SHIFT_PIO;
dev->flags |= ATA_DFLAG_PIO;
ata_dev_info(dev, "configured for PIO\n");