Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 58331
b: refs/heads/master
c: 49521f9
h: refs/heads/master
i:
  58329: 6ccb241
  58327: 94b431f
v: v3
  • Loading branch information
Bartlomiej Zolnierkiewicz committed Jul 9, 2007
1 parent 4d24c4c commit 8b367b5
Show file tree
Hide file tree
Showing 26 changed files with 124 additions and 90 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 75b1d97535327d0428c6bffd9d5407e65546fd5d
refs/heads/master: 49521f97ccd3c2bf6e71a91cea8fe65d170fa4fb
2 changes: 1 addition & 1 deletion trunk/drivers/ide/cris/ide-cris.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 6 additions & 2 deletions trunk/drivers/ide/ide-iops.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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;

Expand Down
9 changes: 7 additions & 2 deletions trunk/drivers/ide/ide.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
Expand Down
5 changes: 3 additions & 2 deletions trunk/drivers/ide/pci/aec62xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 5 additions & 4 deletions trunk/drivers/ide/pci/alim15x3.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

/**
Expand Down Expand Up @@ -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;
Expand Down
9 changes: 7 additions & 2 deletions trunk/drivers/ide/pci/amd74xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -431,8 +431,13 @@ static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif)
if ((amd_config->flags & AMD_BAD_SWDMA) == 0)
hwif->swdma_mask = 0x07;

if (!hwif->udma_four)
hwif->udma_four = (amd_80w >> hwif->channel) & 1;
if (hwif->cbl != ATA_CBL_PATA40_SHORT) {
if ((amd_80w >> hwif->channel) & 1)
hwif->cbl = ATA_CBL_PATA80;
else
hwif->cbl = ATA_CBL_PATA40;
}

hwif->ide_dma_check = &amd74xx_ide_dma_check;
if (!noautodma)
hwif->autodma = 1;
Expand Down
5 changes: 3 additions & 2 deletions trunk/drivers/ide/pci/atiixp.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,10 +264,11 @@ static void __devinit init_hwif_atiixp(ide_hwif_t *hwif)
hwif->swdma_mask = 0x04;

pci_read_config_byte(pdev, ATIIXP_IDE_UDMA_MODE + ch, &udma_mode);

if ((udma_mode & 0x07) >= 0x04 || (udma_mode & 0x70) >= 0x40)
hwif->udma_four = 1;
hwif->cbl = ATA_CBL_PATA80;
else
hwif->udma_four = 0;
hwif->cbl = ATA_CBL_PATA40;

hwif->dma_host_on = &atiixp_dma_host_on;
hwif->dma_host_off = &atiixp_dma_host_off;
Expand Down
10 changes: 5 additions & 5 deletions trunk/drivers/ide/pci/cmd64x.c
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ static unsigned int __devinit init_chipset_cmd64x(struct pci_dev *dev, const cha
return 0;
}

static unsigned int __devinit ata66_cmd64x(ide_hwif_t *hwif)
static u8 __devinit ata66_cmd64x(ide_hwif_t *hwif)
{
struct pci_dev *dev = hwif->pci_dev;
u8 bmidecsr = 0, mask = hwif->channel ? 0x02 : 0x01;
Expand All @@ -526,9 +526,9 @@ static unsigned int __devinit ata66_cmd64x(ide_hwif_t *hwif)
case PCI_DEVICE_ID_CMD_648:
case PCI_DEVICE_ID_CMD_649:
pci_read_config_byte(dev, BMIDECSR, &bmidecsr);
return (bmidecsr & mask) ? 1 : 0;
return (bmidecsr & mask) ? ATA_CBL_PATA80 : ATA_CBL_PATA40;
default:
return 0;
return ATA_CBL_PATA40;
}
}

Expand Down Expand Up @@ -568,8 +568,8 @@ static void __devinit init_hwif_cmd64x(ide_hwif_t *hwif)

hwif->ide_dma_check = &cmd64x_config_drive_for_dma;

if (!hwif->udma_four)
hwif->udma_four = ata66_cmd64x(hwif);
if (hwif->cbl != ATA_CBL_PATA40_SHORT)
hwif->cbl = ata66_cmd64x(hwif);

switch (dev->device) {
case PCI_DEVICE_ID_CMD_648:
Expand Down
6 changes: 3 additions & 3 deletions trunk/drivers/ide/pci/cs5535.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ static u8 __devinit cs5535_cable_detect(struct pci_dev *dev)

/* if a 80 wire cable was detected */
pci_read_config_byte(dev, CS5535_CABLE_DETECT, &bit);
return (bit & 1);

return (bit & 1) ? ATA_CBL_PATA80 : ATA_CBL_PATA40;
}

/****
Expand All @@ -212,8 +213,7 @@ static void __devinit init_hwif_cs5535(ide_hwif_t *hwif)
hwif->ultra_mask = 0x1F;
hwif->mwdma_mask = 0x07;


hwif->udma_four = cs5535_cable_detect(hwif->pci_dev);
hwif->cbl = cs5535_cable_detect(hwif->pci_dev);

if (!noautodma)
hwif->autodma = 1;
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/ide/pci/hpt366.c
Original file line number Diff line number Diff line change
Expand Up @@ -1330,8 +1330,8 @@ static void __devinit init_hwif_hpt366(ide_hwif_t *hwif)
} else
pci_read_config_byte (dev, 0x5a, &scr1);

if (!hwif->udma_four)
hwif->udma_four = (scr1 & ata66) ? 0 : 1;
if (hwif->cbl != ATA_CBL_PATA40_SHORT)
hwif->cbl = (scr1 & ata66) ? ATA_CBL_PATA40 : ATA_CBL_PATA80;

hwif->ide_dma_check = &hpt366_config_drive_xfer_rate;

Expand Down
8 changes: 4 additions & 4 deletions trunk/drivers/ide/pci/it8213.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ static int it8213_config_drive_for_dma (ide_drive_t *drive)

static void __devinit init_hwif_it8213(ide_hwif_t *hwif)
{
u8 reg42h = 0, ata66 = 0;
u8 reg42h = 0;

hwif->speedproc = &it8213_tune_chipset;
hwif->tuneproc = &it8213_tuneproc;
Expand All @@ -250,11 +250,11 @@ static void __devinit init_hwif_it8213(ide_hwif_t *hwif)
hwif->swdma_mask = 0x04;

pci_read_config_byte(hwif->pci_dev, 0x42, &reg42h);
ata66 = (reg42h & 0x02) ? 0 : 1;

hwif->ide_dma_check = &it8213_config_drive_for_dma;
if (!(hwif->udma_four))
hwif->udma_four = ata66;

if (hwif->cbl != ATA_CBL_PATA40_SHORT)
hwif->cbl = (reg42h & 0x02) ? ATA_CBL_PATA40 : ATA_CBL_PATA80;

/*
* The BIOS often doesn't set up DMA on this controller
Expand Down
9 changes: 5 additions & 4 deletions trunk/drivers/ide/pci/it821x.c
Original file line number Diff line number Diff line change
Expand Up @@ -491,10 +491,10 @@ static int it821x_config_drive_for_dma (ide_drive_t *drive)
* the needed logic onboard.
*/

static unsigned int __devinit ata66_it821x(ide_hwif_t *hwif)
static u8 __devinit ata66_it821x(ide_hwif_t *hwif)
{
/* The reference driver also only does disk side */
return 1;
return ATA_CBL_PATA80;
}

/**
Expand Down Expand Up @@ -662,8 +662,9 @@ static void __devinit init_hwif_it821x(ide_hwif_t *hwif)
hwif->mwdma_mask = 0x07;

hwif->ide_dma_check = &it821x_config_drive_for_dma;
if (!(hwif->udma_four))
hwif->udma_four = ata66_it821x(hwif);

if (hwif->cbl != ATA_CBL_PATA40_SHORT)
hwif->cbl = ata66_it821x(hwif);

/*
* The BIOS often doesn't set up DMA on this controller
Expand Down
20 changes: 11 additions & 9 deletions trunk/drivers/ide/pci/jmicron.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ typedef enum {
* ata66_jmicron - Cable check
* @hwif: IDE port
*
* Return 1 if the cable is 80pin
* Returns the cable type.
*/

static int __devinit ata66_jmicron(ide_hwif_t *hwif)
static u8 __devinit ata66_jmicron(ide_hwif_t *hwif)
{
struct pci_dev *pdev = hwif->pci_dev;

Expand Down Expand Up @@ -70,16 +70,17 @@ static int __devinit ata66_jmicron(ide_hwif_t *hwif)
{
case PORT_PATA0:
if (control & (1 << 3)) /* 40/80 pin primary */
return 0;
return 1;
return ATA_CBL_PATA40;
return ATA_CBL_PATA80;
case PORT_PATA1:
if (control5 & (1 << 19)) /* 40/80 pin secondary */
return 0;
return 1;
return ATA_CBL_PATA40;
return ATA_CBL_PATA80;
case PORT_SATA:
break;
}
return 1; /* Avoid bogus "control reaches end of non-void function" */
/* Avoid bogus "control reaches end of non-void function" */
return ATA_CBL_PATA80;
}

static void jmicron_tuneproc (ide_drive_t *drive, byte mode_wanted)
Expand Down Expand Up @@ -159,8 +160,9 @@ static void __devinit init_hwif_jmicron(ide_hwif_t *hwif)
hwif->mwdma_mask = 0x07;

hwif->ide_dma_check = &jmicron_config_drive_for_dma;
if (!(hwif->udma_four))
hwif->udma_four = ata66_jmicron(hwif);

if (hwif->cbl != ATA_CBL_PATA40_SHORT)
hwif->cbl = ata66_jmicron(hwif);

hwif->autodma = 1;
hwif->drives[0].autodma = hwif->autodma;
Expand Down
9 changes: 6 additions & 3 deletions trunk/drivers/ide/pci/pdc202xx_new.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,10 @@ static void pdcnew_tune_drive(ide_drive_t *drive, u8 pio)

static u8 pdcnew_cable_detect(ide_hwif_t *hwif)
{
return get_indexed_reg(hwif, 0x0b) & 0x04;
if (get_indexed_reg(hwif, 0x0b) & 0x04)
return ATA_CBL_PATA40;
else
return ATA_CBL_PATA80;
}

static int pdcnew_config_drive_xfer_rate(ide_drive_t *drive)
Expand Down Expand Up @@ -509,8 +512,8 @@ static void __devinit init_hwif_pdc202new(ide_hwif_t *hwif)

hwif->ide_dma_check = &pdcnew_config_drive_xfer_rate;

if (!hwif->udma_four)
hwif->udma_four = pdcnew_cable_detect(hwif) ? 0 : 1;
if (hwif->cbl != ATA_CBL_PATA40_SHORT)
hwif->cbl = pdcnew_cable_detect(hwif);

if (!noautodma)
hwif->autodma = 1;
Expand Down
9 changes: 6 additions & 3 deletions trunk/drivers/ide/pci/pdc202xx_old.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,10 @@ static void pdc202xx_tune_drive(ide_drive_t *drive, u8 pio)
static u8 pdc202xx_old_cable_detect (ide_hwif_t *hwif)
{
u16 CIS = 0, mask = (hwif->channel) ? (1<<11) : (1<<10);

pci_read_config_word(hwif->pci_dev, 0x50, &CIS);
return (CIS & mask) ? 1 : 0;

return (CIS & mask) ? ATA_CBL_PATA40 : ATA_CBL_PATA80;
}

/*
Expand Down Expand Up @@ -357,8 +359,9 @@ static void __devinit init_hwif_pdc202xx(ide_hwif_t *hwif)
hwif->dma_timeout = &pdc202xx_dma_timeout;

if (hwif->pci_dev->device != PCI_DEVICE_ID_PROMISE_20246) {
if (!(hwif->udma_four))
hwif->udma_four = (pdc202xx_old_cable_detect(hwif)) ? 0 : 1;
if (hwif->cbl != ATA_CBL_PATA40_SHORT)
hwif->cbl = pdc202xx_old_cable_detect(hwif);

hwif->dma_start = &pdc202xx_old_ide_dma_start;
hwif->ide_dma_end = &pdc202xx_old_ide_dma_end;
}
Expand Down
8 changes: 4 additions & 4 deletions trunk/drivers/ide/pci/piix.c
Original file line number Diff line number Diff line change
Expand Up @@ -394,14 +394,14 @@ static void piix_dma_clear_irq(ide_drive_t *drive)
hwif->OUTB(dma_stat, hwif->dma_status);
}

static int __devinit piix_cable_detect(ide_hwif_t *hwif)
static u8 __devinit piix_cable_detect(ide_hwif_t *hwif)
{
struct pci_dev *dev = hwif->pci_dev;
u8 reg54h = 0, mask = hwif->channel ? 0xc0 : 0x30;

pci_read_config_byte(dev, 0x54, &reg54h);

return (reg54h & mask) ? 1 : 0;
return (reg54h & mask) ? ATA_CBL_PATA80 : ATA_CBL_PATA40;
}

/**
Expand Down Expand Up @@ -444,8 +444,8 @@ static void __devinit init_hwif_piix(ide_hwif_t *hwif)
hwif->swdma_mask = 0x04;

if (hwif->ultra_mask & 0x78) {
if (!hwif->udma_four)
hwif->udma_four = piix_cable_detect(hwif);
if (hwif->cbl != ATA_CBL_PATA40_SHORT)
hwif->cbl = piix_cable_detect(hwif);
}

if (no_piix_dma)
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/ide/pci/scc_pata.c
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@ static void __devinit init_hwif_scc(ide_hwif_t *hwif)
hwif->atapi_dma = 1;

/* we support 80c cable only. */
hwif->udma_four = 1;
hwif->cbl = ATA_CBL_PATA80;

hwif->autodma = 0;
if (!noautodma)
Expand Down
Loading

0 comments on commit 8b367b5

Please sign in to comment.