Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 49521f97 authored by Bartlomiej Zolnierkiewicz's avatar Bartlomiej Zolnierkiewicz
Browse files

ide: add short cables support



This patch allows users to override both host and device side cable detection
with "ideX=ata66" kernel parameter.  Thanks to this it should be now possible
to use UDMA > 2 modes on systems (laptops mainly) which use short 40-pin cable
instead of 80-pin one.

Next patches add automatic detection of some systems using short cables.

Changes:

* Rename hwif->udma_four to hwif->cbl and make it u8.

* Convert all existing users accordingly (use ATA_CBL_* defines while at it).  

* Add ATA_CBL_PATA40_SHORT support to ide-iops.c:eighty_ninty_three().

* Use ATA_CBL_PATA40_SHORT for "ideX=ata66" kernel parameter.

Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Reviewed-by: default avatarSergei Shtylyov <sshtylyov@ru.mvista.com>
parent 75b1d975
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -819,7 +819,7 @@ init_e100_ide (void)
		hwif->dma_host_off = &cris_dma_off;
		hwif->dma_host_on = &cris_dma_on;
		hwif->dma_off_quietly = &cris_dma_off;
		hwif->udma_four = 0;
		hwif->cbl = ATA_CBL_PATA40;
		hwif->ultra_mask = cris_ultra_mask;
		hwif->mwdma_mask = 0x07; /* Multiword DMA 0-2 */
		hwif->autodma = 1;
+6 −2
Original line number Diff line number Diff line
@@ -574,7 +574,10 @@ u8 eighty_ninty_three (ide_drive_t *drive)
	ide_hwif_t *hwif = drive->hwif;
	struct hd_driveid *id = drive->id;

	if (hwif->udma_four == 0)
	if (hwif->cbl == ATA_CBL_PATA40_SHORT)
		return 1;

	if (hwif->cbl != ATA_CBL_PATA80)
		goto no_80w;

	/* Check for SATA but only if we are ATA5 or higher */
@@ -600,7 +603,8 @@ u8 eighty_ninty_three (ide_drive_t *drive)

	printk(KERN_WARNING "%s: %s side 80-wire cable detection failed, "
			    "limiting max speed to UDMA33\n",
			    drive->name, hwif->udma_four ? "drive" : "host");
			    drive->name,
			    hwif->cbl == ATA_CBL_PATA80 ? "drive" : "host");

	drive->udma33_warned = 1;

+7 −2
Original line number Diff line number Diff line
@@ -460,6 +460,8 @@ static void ide_hwif_restore(ide_hwif_t *hwif, ide_hwif_t *tmp_hwif)
	hwif->mwdma_mask		= tmp_hwif->mwdma_mask;
	hwif->swdma_mask		= tmp_hwif->swdma_mask;

	hwif->cbl			= tmp_hwif->cbl;

	hwif->chipset			= tmp_hwif->chipset;
	hwif->hold			= tmp_hwif->hold;

@@ -533,7 +535,6 @@ static void ide_hwif_restore(ide_hwif_t *hwif, ide_hwif_t *tmp_hwif)
	hwif->extra_base		= tmp_hwif->extra_base;
	hwif->extra_ports		= tmp_hwif->extra_ports;
	hwif->autodma			= tmp_hwif->autodma;
	hwif->udma_four			= tmp_hwif->udma_four;

	hwif->hwif_data			= tmp_hwif->hwif_data;
}
@@ -1548,7 +1549,11 @@ static int __init ide_setup(char *s)
				goto bad_option;
			case -7: /* ata66 */
#ifdef CONFIG_BLK_DEV_IDEPCI
				hwif->udma_four = 1;
				/*
				 * Use ATA_CBL_PATA40_SHORT so drive side
				 * cable detection is also overriden.
				 */
				hwif->cbl = ATA_CBL_PATA40_SHORT;
				goto obsolete_option;
#else
				goto bad_hwif;
+3 −2
Original line number Diff line number Diff line
@@ -234,11 +234,12 @@ static void __devinit init_hwif_aec62xx(ide_hwif_t *hwif)
		pci_read_config_byte (dev, 0x54, &reg54);
		pci_write_config_byte(dev, 0x54, (reg54 & ~mask));
		spin_unlock_irqrestore(&ide_lock, flags);
	} else if (!hwif->udma_four) {
	} else if (hwif->cbl != ATA_CBL_PATA40_SHORT) {
		u8 ata66 = 0, mask = hwif->channel ? 0x02 : 0x01;

		pci_read_config_byte(hwif->pci_dev, 0x49, &ata66);
		hwif->udma_four = (ata66 & mask) ? 0 : 1;

		hwif->cbl = (ata66 & mask) ? ATA_CBL_PATA40 : ATA_CBL_PATA80;
	}

	if (!noautodma)
+5 −4
Original line number Diff line number Diff line
@@ -594,7 +594,7 @@ static unsigned int __devinit init_chipset_ali15x3 (struct pci_dev *dev, const c
 *	FIXME: frobs bits that are not defined on newer ALi devicea
 */

static unsigned int __devinit ata66_ali15x3 (ide_hwif_t *hwif)
static u8 __devinit ata66_ali15x3(ide_hwif_t *hwif)
{
	struct pci_dev *dev	= hwif->pci_dev;
	unsigned int ata66	= 0;
@@ -657,7 +657,7 @@ static unsigned int __devinit ata66_ali15x3 (ide_hwif_t *hwif)

	local_irq_restore(flags);

	return(ata66);
	return ata66 ? ATA_CBL_PATA80 : ATA_CBL_PATA40;
}

/**
@@ -708,8 +708,9 @@ static void __devinit init_hwif_common_ali15x3 (ide_hwif_t *hwif)
		hwif->dma_setup = &ali15x3_dma_setup;
		if (!noautodma)
			hwif->autodma = 1;
		if (!(hwif->udma_four))
			hwif->udma_four = ata66_ali15x3(hwif);

		if (hwif->cbl != ATA_CBL_PATA40_SHORT)
			hwif->cbl = ata66_ali15x3(hwif);
	}
	hwif->drives[0].autodma = hwif->autodma;
	hwif->drives[1].autodma = hwif->autodma;
Loading