Ejemplo n.º 1
0
static int config_chipset_for_dma (ide_drive_t *drive)
{
	struct hd_driveid *id	= drive->id;
	ide_hwif_t *hwif	= HWIF(drive);
	u8 speed		= -1;
	u8 cable;

	u8 ultra_66		= ((id->dma_ultra & 0x0010) ||
				   (id->dma_ultra & 0x0008)) ? 1 : 0;

	cable = pdcnew_new_cable_detect(hwif);

	if (ultra_66 && cable) {
		printk(KERN_WARNING "Warning: %s channel requires an 80-pin cable for operation.\n", hwif->channel ? "Secondary":"Primary");
		printk(KERN_WARNING "%s reduced to Ultra33 mode.\n", drive->name);
	}

	if (drive->media != ide_disk)
		return 0;
	if (id->capability & 4) {	/* IORDY_EN & PREFETCH_EN */
		hwif->OUTB((0x13 + ((drive->dn%2) ? 0x08 : 0x00)), hwif->dma_vendor1);
		hwif->OUTB((hwif->INB(hwif->dma_vendor3)|0x03), hwif->dma_vendor3);
	}

	speed = ide_dma_speed(drive, pdcnew_ratemask(drive));

	if (!(speed)) {
		hwif->tuneproc(drive, 5);
		return 0;
	}

	(void) hwif->speedproc(drive, speed);
	return ide_dma_enable(drive);
}
Ejemplo n.º 2
0
static int slc90e66_config_drive_for_dma (ide_drive_t *drive)
{
	u8 speed = ide_dma_speed(drive, slc90e66_ratemask(drive));

	if (!speed)
		return 0;

	(void) slc90e66_tune_chipset(drive, speed);
	return ide_dma_enable(drive);
}
Ejemplo n.º 3
0
static int config_chipset_for_dma (ide_drive_t *drive)
{
	u8 speed = ide_dma_speed(drive, aec62xx_ratemask(drive));	

	if (!(speed))
		return 0;

	(void) aec62xx_tune_chipset(drive, speed);
	return ide_dma_enable(drive);
}
Ejemplo n.º 4
0
static int config_chipset_for_dma(ide_drive_t *drive)
{
	u8 speed = ide_dma_speed(drive, tc86c001_ratemask(drive));

	if (!speed)
		return 0;

	(void) tc86c001_tune_chipset(drive, speed);
	return ide_dma_enable(drive);
}
Ejemplo n.º 5
0
static int slc90e66_config_drive_for_dma (ide_drive_t *drive)
{
    u8 speed = ide_dma_speed(drive, slc90e66_ratemask(drive));

    if (!(speed)) {
        u8 tspeed = ide_get_best_pio_mode(drive, 255, 5, NULL);
        speed = slc90e66_dma_2_pio(XFER_PIO_0 + tspeed);
    }

    (void) slc90e66_tune_chipset(drive, speed);
    return ide_dma_enable(drive);
}
Ejemplo n.º 6
0
static int triflex_config_drive_for_dma(ide_drive_t *drive)
{
    int speed = ide_dma_speed(drive, 0); /* No ultra speeds */

    if (!speed) {
        u8 pspeed = ide_get_best_pio_mode(drive, 255, 4, NULL);
        speed = XFER_PIO_0 + pspeed;
    }

    (void) triflex_tune_chipset(drive, speed);
    return ide_dma_enable(drive);
}
Ejemplo n.º 7
0
Archivo: piix.c Proyecto: ivucica/linux
static int piix_config_drive_for_dma (ide_drive_t *drive)
{
	u8 speed = ide_dma_speed(drive, piix_ratemask(drive));

	/*
	 * If no DMA speed was available or the chipset has DMA bugs
	 * then disable DMA and use PIO
	 */
	if (!speed || no_piix_dma)
		return 0;

	(void) piix_tune_chipset(drive, speed);
	return ide_dma_enable(drive);
}
Ejemplo n.º 8
0
static int config_chipset_for_dma (ide_drive_t *drive)
{
    u8 speed	= ide_dma_speed(drive, cmd64x_ratemask(drive));

    config_chipset_for_pio(drive, !speed);

    if (!speed)
        return 0;

    if(ide_set_xfer_rate(drive, speed))
        return 0;

    if (!drive->init_speed)
        drive->init_speed = speed;

    return ide_dma_enable(drive);
}
Ejemplo n.º 9
0
static int piix_config_drive_for_dma (ide_drive_t *drive)
{
	u8 speed = ide_dma_speed(drive, piix_ratemask(drive));
	
	/* Some ICH devices cannot support DMA mode 0 */
	if(speed == XFER_MW_DMA_0 && piix_faulty_dma0(HWIF(drive)))
		speed = 0;

	/* If no DMA speed was available or the chipset has DMA bugs
	   then disable DMA and use PIO */
	   
	if (!speed || no_piix_dma) {
		u8 tspeed = ide_get_best_pio_mode(drive, 255, 5, NULL);
		speed = piix_dma_2_pio(XFER_PIO_0 + tspeed);
	}

	(void) piix_tune_chipset(drive, speed);
	return ide_dma_enable(drive);
}
Ejemplo n.º 10
0
static int config_chipset_for_dma(ide_drive_t *drive)
{
	struct hd_driveid *id	= drive->id;
	ide_hwif_t *hwif	= HWIF(drive);
	u8 ultra_66		= (id->dma_ultra & 0x0078) ? 1 : 0;
	u8 cable		= pdcnew_cable_detect(hwif);
	u8 speed;

	if (ultra_66 && cable) {
		printk(KERN_WARNING "Warning: %s channel "
		       "requires an 80-pin cable for operation.\n",
		       hwif->channel ? "Secondary" : "Primary");
		printk(KERN_WARNING "%s reduced to Ultra33 mode.\n", drive->name);
	}

	if (drive->media != ide_disk)
		return 0;

	if (id->capability & 4) {
		/*
		 * Set IORDY_EN & PREFETCH_EN (this seems to have
		 * NO real effect since this register is reloaded
		 * by hardware when the transfer mode is selected)
		 */
		u8 tmp, adj = (drive->dn & 1) ? 0x08 : 0x00;

		tmp = get_indexed_reg(hwif, 0x13 + adj);
		set_indexed_reg(hwif, 0x13 + adj, tmp | 0x03);
	}

	speed = ide_dma_speed(drive, pdcnew_ratemask(drive));

	if (!speed)
		return 0;

	(void) hwif->speedproc(drive, speed);
	return ide_dma_enable(drive);
}