ide: remove obsoleted "idex=serialize" kernel parameter
[firefly-linux-kernel-4.4.55.git] / drivers / ide / ide.c
index 3be049067520ec52f6625b86c33bada164d61a19..3cac96f3b0aa02e51a2c7be7b41311d015a03131 100644 (file)
@@ -227,79 +227,6 @@ static int ide_system_bus_speed(void)
        return pci_dev_present(pci_default) ? 33 : 50;
 }
 
-static struct resource* hwif_request_region(ide_hwif_t *hwif,
-                                           unsigned long addr, int num)
-{
-       struct resource *res = request_region(addr, num, hwif->name);
-
-       if (!res)
-               printk(KERN_ERR "%s: I/O resource 0x%lX-0x%lX not free.\n",
-                               hwif->name, addr, addr+num-1);
-       return res;
-}
-
-/**
- *     ide_hwif_request_regions - request resources for IDE
- *     @hwif: interface to use
- *
- *     Requests all the needed resources for an interface.
- *     Right now core IDE code does this work which is deeply wrong.
- *     MMIO leaves it to the controller driver,
- *     PIO will migrate this way over time.
- */
-
-int ide_hwif_request_regions(ide_hwif_t *hwif)
-{
-       unsigned long addr;
-
-       if (hwif->mmio)
-               return 0;
-
-       addr = hwif->io_ports[IDE_CONTROL_OFFSET];
-
-       if (addr && !hwif_request_region(hwif, addr, 1))
-               goto control_region_busy;
-
-       addr = hwif->io_ports[IDE_DATA_OFFSET];
-       BUG_ON((addr | 7) != hwif->io_ports[IDE_STATUS_OFFSET]);
-
-       if (!hwif_request_region(hwif, addr, 8))
-               goto data_region_busy;
-
-       return 0;
-
-data_region_busy:
-       addr = hwif->io_ports[IDE_CONTROL_OFFSET];
-       if (addr)
-               release_region(addr, 1);
-control_region_busy:
-       /* If any errors are return, we drop the hwif interface. */
-       return -EBUSY;
-}
-
-/**
- *     ide_hwif_release_regions - free IDE resources
- *
- *     Note that we only release the standard ports,
- *     and do not even try to handle any extra ports
- *     allocated for weird IDE interface chipsets.
- *
- *     Note also that we don't yet handle mmio resources here. More
- *     importantly our caller should be doing this so we need to 
- *     restructure this as a helper function for drivers.
- */
-
-void ide_hwif_release_regions(ide_hwif_t *hwif)
-{
-       if (hwif->mmio)
-               return;
-
-       if (hwif->io_ports[IDE_CONTROL_OFFSET])
-               release_region(hwif->io_ports[IDE_CONTROL_OFFSET], 1);
-
-       release_region(hwif->io_ports[IDE_DATA_OFFSET], 8);
-}
-
 void ide_remove_port_from_hwgroup(ide_hwif_t *hwif)
 {
        ide_hwgroup_t *hwgroup = hwif->hwgroup;
@@ -436,9 +363,7 @@ void ide_unregister(unsigned int index)
        spin_lock_irq(&ide_lock);
 
        if (hwif->dma_base)
-               (void)ide_release_dma(hwif);
-
-       ide_hwif_release_regions(hwif);
+               ide_release_dma_engine(hwif);
 
        /* restore hwif data to pristine status */
        ide_init_port_data(hwif, index);
@@ -544,7 +469,7 @@ int set_using_dma(ide_drive_t *drive, int arg)
        if (!drive->id || !(drive->id->capability & 1))
                goto out;
 
-       if (hwif->dma_host_set == NULL)
+       if (hwif->dma_ops == NULL)
                goto out;
 
        err = -EBUSY;
@@ -1070,7 +995,7 @@ static int __init ide_setup(char *s)
                 * (-8, -9, -10) are reserved to ease the hardcoding.
                 */
                static const char *ide_words[] = {
-                       "minus1", "serialize", "minus3", "minus4",
+                       "minus1", "minus2", "minus3", "minus4",
                        "reset", "minus6", "ata66", "minus8", "minus9",
                        "minus10", "four", "qd65xx", "ht6560b", "cmd640_vlb",
                        "dtc2278", "umc8672", "ali14xx", NULL };
@@ -1151,12 +1076,7 @@ static int __init ide_setup(char *s)
                        case -5: /* "reset" */
                                hwif->reset = 1;
                                goto obsolete_option;
-                       case -2: /* "serialize" */
-                               hwif->mate = &ide_hwifs[hw^1];
-                               hwif->mate->mate = hwif;
-                               hwif->serialized = hwif->mate->serialized = 1;
-                               goto obsolete_option;
-
+                       case -2:
                        case -1:
                        case 0:
                        case 1:
@@ -1314,6 +1234,38 @@ static void ide_port_class_release(struct device *portdev)
        put_device(&hwif->gendev);
 }
 
+static unsigned int ide_ignore_cable;
+
+static int ide_set_ignore_cable(const char *s, struct kernel_param *kp)
+{
+       int i, j = 1;
+
+       if (sscanf(s, "%d:%d", &i, &j) != 2 && sscanf(s, "%d", &i) != 1)
+               return -EINVAL;
+
+       if (i >= MAX_HWIFS || j < 0 || j > 1)
+               return -EINVAL;
+
+       if (j)
+               ide_ignore_cable |= (1 << i);
+       else
+               ide_ignore_cable &= (1 << i);
+
+       return 0;
+}
+
+module_param_call(ignore_cable, ide_set_ignore_cable, NULL, NULL, 0);
+MODULE_PARM_DESC(ignore_cable, "ignore cable detection");
+
+void ide_port_apply_params(ide_hwif_t *hwif)
+{
+       if (ide_ignore_cable & (1 << hwif->index)) {
+               printk(KERN_INFO "ide: ignoring cable detection for %s\n",
+                                hwif->name);
+               hwif->cbl = ATA_CBL_PATA40_SHORT;
+       }
+}
+
 /*
  * This is gets invoked once during initialization, to set *everything* up
  */