]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/ata/pata_pcmcia.c
net: convert BUG_TRAP to generic WARN_ON
[linux-2.6-omap-h63xx.git] / drivers / ata / pata_pcmcia.c
index bbd4d70b92deedd0ff93a8703b5f86c0fe739c4b..41b4361bbf6ed86788634223ce855734f79ada89 100644 (file)
@@ -42,7 +42,7 @@
 
 
 #define DRV_NAME "pata_pcmcia"
-#define DRV_VERSION "0.3.2"
+#define DRV_VERSION "0.3.3"
 
 /*
  *     Private data structure to glue stuff together
@@ -102,10 +102,10 @@ static int pcmcia_set_mode_8bit(struct ata_link *link,
 
 /**
  *     ata_data_xfer_8bit       -      Transfer data by 8bit PIO
- *     @adev: device to target
+ *     @dev: device to target
  *     @buf: data buffer
  *     @buflen: buffer length
- *     @write_data: read/write
+ *     @rw: read/write
  *
  *     Transfer data from/to the device data register by 8 bit PIO.
  *
@@ -113,83 +113,36 @@ static int pcmcia_set_mode_8bit(struct ata_link *link,
  *     Inherited from caller.
  */
 
-static void ata_data_xfer_8bit(struct ata_device *adev, unsigned char *buf,
-                  unsigned int buflen, int write_data)
+static unsigned int ata_data_xfer_8bit(struct ata_device *dev,
+                               unsigned char *buf, unsigned int buflen, int rw)
 {
-       struct ata_port *ap = adev->link->ap;
-       if (write_data)
-               iowrite8_rep(ap->ioaddr.data_addr, buf, buflen);
-       else
+       struct ata_port *ap = dev->link->ap;
+
+       if (rw == READ)
                ioread8_rep(ap->ioaddr.data_addr, buf, buflen);
+       else
+               iowrite8_rep(ap->ioaddr.data_addr, buf, buflen);
+
+       return buflen;
 }
 
 
 static struct scsi_host_template pcmcia_sht = {
-       .module                 = THIS_MODULE,
-       .name                   = DRV_NAME,
-       .ioctl                  = ata_scsi_ioctl,
-       .queuecommand           = ata_scsi_queuecmd,
-       .can_queue              = ATA_DEF_QUEUE,
-       .this_id                = ATA_SHT_THIS_ID,
-       .sg_tablesize           = LIBATA_MAX_PRD,
-       .cmd_per_lun            = ATA_SHT_CMD_PER_LUN,
-       .emulated               = ATA_SHT_EMULATED,
-       .use_clustering         = ATA_SHT_USE_CLUSTERING,
-       .proc_name              = DRV_NAME,
-       .dma_boundary           = ATA_DMA_BOUNDARY,
-       .slave_configure        = ata_scsi_slave_config,
-       .slave_destroy          = ata_scsi_slave_destroy,
-       .bios_param             = ata_std_bios_param,
+       ATA_PIO_SHT(DRV_NAME),
 };
 
 static struct ata_port_operations pcmcia_port_ops = {
-       .set_mode       = pcmcia_set_mode,
-       .tf_load        = ata_tf_load,
-       .tf_read        = ata_tf_read,
-       .check_status   = ata_check_status,
-       .exec_command   = ata_exec_command,
-       .dev_select     = ata_std_dev_select,
-
-       .freeze         = ata_bmdma_freeze,
-       .thaw           = ata_bmdma_thaw,
-       .error_handler  = ata_bmdma_error_handler,
-       .post_internal_cmd = ata_bmdma_post_internal_cmd,
+       .inherits       = &ata_sff_port_ops,
+       .sff_data_xfer  = ata_sff_data_xfer_noirq,
        .cable_detect   = ata_cable_40wire,
-
-       .qc_prep        = ata_qc_prep,
-       .qc_issue       = ata_qc_issue_prot,
-
-       .data_xfer      = ata_data_xfer_noirq,
-
-       .irq_clear      = ata_bmdma_irq_clear,
-       .irq_on         = ata_irq_on,
-
-       .port_start     = ata_sff_port_start,
+       .set_mode       = pcmcia_set_mode,
 };
 
 static struct ata_port_operations pcmcia_8bit_port_ops = {
-       .set_mode       = pcmcia_set_mode_8bit,
-       .tf_load        = ata_tf_load,
-       .tf_read        = ata_tf_read,
-       .check_status   = ata_check_status,
-       .exec_command   = ata_exec_command,
-       .dev_select     = ata_std_dev_select,
-
-       .freeze         = ata_bmdma_freeze,
-       .thaw           = ata_bmdma_thaw,
-       .error_handler  = ata_bmdma_error_handler,
-       .post_internal_cmd = ata_bmdma_post_internal_cmd,
+       .inherits       = &ata_sff_port_ops,
+       .sff_data_xfer  = ata_data_xfer_8bit,
        .cable_detect   = ata_cable_40wire,
-
-       .qc_prep        = ata_qc_prep,
-       .qc_issue       = ata_qc_issue_prot,
-
-       .data_xfer      = ata_data_xfer_8bit,
-
-       .irq_clear      = ata_bmdma_irq_clear,
-       .irq_on         = ata_irq_on,
-
-       .port_start     = ata_sff_port_start,
+       .set_mode       = pcmcia_set_mode_8bit,
 };
 
 #define CS_CHECK(fn, ret) \
@@ -198,7 +151,6 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
 /**
  *     pcmcia_init_one         -       attach a PCMCIA interface
  *     @pdev: pcmcia device
- *     @ops: operations for this device
  *
  *     Register a PCMCIA IDE interface. Such interfaces are PIO 0 and
  *     shared IRQ.
@@ -217,9 +169,10 @@ static int pcmcia_init_one(struct pcmcia_device *pdev)
                cistpl_cftable_entry_t dflt;
        } *stk = NULL;
        cistpl_cftable_entry_t *cfg;
-       int pass, last_ret = 0, last_fn = 0, is_kme = 0, ret = -ENOMEM;
+       int pass, last_ret = 0, last_fn = 0, is_kme = 0, ret = -ENOMEM, p;
        unsigned long io_base, ctl_base;
        void __iomem *io_addr, *ctl_addr;
+       int n_ports = 1;
 
        struct ata_port_operations *ops = &pcmcia_port_ops;
 
@@ -348,7 +301,7 @@ next_entry:
        /* FIXME: Could be more ports at base + 0x10 but we only deal with
           one right now */
        if (pdev->io.NumPorts1 >= 0x20)
-               printk(KERN_WARNING DRV_NAME ": second channel not yet supported.\n");
+               n_ports = 2;
 
        if (pdev->manf_id == 0x0097 && pdev->card_id == 0x1620)
                ops = &pcmcia_8bit_port_ops;
@@ -357,23 +310,26 @@ next_entry:
         *      sane.
         */
        ret = -ENOMEM;
-       host = ata_host_alloc(&pdev->dev, 1);
+       host = ata_host_alloc(&pdev->dev, n_ports);
        if (!host)
                goto failed;
-       ap = host->ports[0];
 
-       ap->ops = ops;
-       ap->pio_mask = 1;               /* ISA so PIO 0 cycles */
-       ap->flags |= ATA_FLAG_SLAVE_POSS;
-       ap->ioaddr.cmd_addr = io_addr;
-       ap->ioaddr.altstatus_addr = ctl_addr;
-       ap->ioaddr.ctl_addr = ctl_addr;
-       ata_std_ports(&ap->ioaddr);
+       for (p = 0; p < n_ports; p++) {
+               ap = host->ports[p];
 
-       ata_port_desc(ap, "cmd 0x%lx ctl 0x%lx", io_base, ctl_base);
+               ap->ops = ops;
+               ap->pio_mask = 1;               /* ISA so PIO 0 cycles */
+               ap->flags |= ATA_FLAG_SLAVE_POSS;
+               ap->ioaddr.cmd_addr = io_addr + 0x10 * p;
+               ap->ioaddr.altstatus_addr = ctl_addr + 0x10 * p;
+               ap->ioaddr.ctl_addr = ctl_addr + 0x10 * p;
+               ata_sff_std_ports(&ap->ioaddr);
+
+               ata_port_desc(ap, "cmd 0x%lx ctl 0x%lx", io_base, ctl_base);
+       }
 
        /* activate */
-       ret = ata_host_activate(host, pdev->irq.AssignedIRQ, ata_interrupt,
+       ret = ata_host_activate(host, pdev->irq.AssignedIRQ, ata_sff_interrupt,
                                IRQF_SHARED, &pcmcia_sht);
        if (ret)
                goto failed;
@@ -458,6 +414,7 @@ static struct pcmcia_device_id pcmcia_devices[] = {
        PCMCIA_DEVICE_PROD_ID12("IO DATA", "PCIDE", 0x547e66dc, 0x5c5ab149),
        PCMCIA_DEVICE_PROD_ID12("IO DATA", "PCIDEII", 0x547e66dc, 0xb3662674),
        PCMCIA_DEVICE_PROD_ID12("LOOKMEET", "CBIDE2      ", 0xe37be2b5, 0x8671043b),
+       PCMCIA_DEVICE_PROD_ID12("M-Systems", "CF300", 0x7ed2ad87, 0x7e9e78ee),
        PCMCIA_DEVICE_PROD_ID12("M-Systems", "CF500", 0x7ed2ad87, 0x7a13045c),
        PCMCIA_DEVICE_PROD_ID2("NinjaATA-", 0xebe0bd79),
        PCMCIA_DEVICE_PROD_ID12("PCMCIA", "CD-ROM", 0x281f1c5d, 0x66536591),
@@ -468,6 +425,7 @@ static struct pcmcia_device_id pcmcia_devices[] = {
        PCMCIA_DEVICE_PROD_ID12("SMI VENDOR", "SMI PRODUCT", 0x30896c92, 0x703cc5f6),
        PCMCIA_DEVICE_PROD_ID12("TOSHIBA", "MK2001MPL", 0xb4585a1a, 0x3489e003),
        PCMCIA_DEVICE_PROD_ID1("TRANSCEND    512M   ", 0xd0909443),
+       PCMCIA_DEVICE_PROD_ID12("TRANSCEND", "TS1GCF45", 0x709b1bf1, 0xf68b6f32),
        PCMCIA_DEVICE_PROD_ID12("TRANSCEND", "TS1GCF80", 0x709b1bf1, 0x2a54d4b1),
        PCMCIA_DEVICE_PROD_ID12("TRANSCEND", "TS2GCF120", 0x709b1bf1, 0x969aa4f2),
        PCMCIA_DEVICE_PROD_ID12("TRANSCEND", "TS4GCF120", 0x709b1bf1, 0xf54a91c8),