Commit c0cc37a5 authored by Bartlomiej Zolnierkiewicz's avatar Bartlomiej Zolnierkiewicz Committed by Linus Torvalds

[PATCH] DMA mode setup fixes for piix.c/ata_piix.c

From: Go Taniguchi <go@turbolinux.co.jp> (Turbolinx Inc.)

Change reg48 and reg54 in 8bit access and remove unused reg44.

Jeff acked ata_piix.c part.
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@elka.pw.edu.pl>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 727a7f73
...@@ -49,9 +49,9 @@ ...@@ -49,9 +49,9 @@
* pci_read_config_word(HWIF(drive)->pci_dev, 0x40, &reg40); * pci_read_config_word(HWIF(drive)->pci_dev, 0x40, &reg40);
* pci_read_config_word(HWIF(drive)->pci_dev, 0x42, &reg42); * pci_read_config_word(HWIF(drive)->pci_dev, 0x42, &reg42);
* pci_read_config_word(HWIF(drive)->pci_dev, 0x44, &reg44); * pci_read_config_word(HWIF(drive)->pci_dev, 0x44, &reg44);
* pci_read_config_word(HWIF(drive)->pci_dev, 0x48, &reg48); * pci_read_config_byte(HWIF(drive)->pci_dev, 0x48, &reg48);
* pci_read_config_word(HWIF(drive)->pci_dev, 0x4a, &reg4a); * pci_read_config_word(HWIF(drive)->pci_dev, 0x4a, &reg4a);
* pci_read_config_word(HWIF(drive)->pci_dev, 0x54, &reg54); * pci_read_config_byte(HWIF(drive)->pci_dev, 0x54, &reg54);
* *
* Documentation * Documentation
* Publically available from Intel web site. Errata documentation * Publically available from Intel web site. Errata documentation
...@@ -432,15 +432,14 @@ static int piix_tune_chipset (ide_drive_t *drive, u8 xferspeed) ...@@ -432,15 +432,14 @@ static int piix_tune_chipset (ide_drive_t *drive, u8 xferspeed)
int w_flag = 0x10 << drive->dn; int w_flag = 0x10 << drive->dn;
int u_speed = 0; int u_speed = 0;
int sitre; int sitre;
u16 reg4042, reg44, reg48, reg4a, reg54; u16 reg4042, reg4a;
u8 reg55; u8 reg48, reg54, reg55;
pci_read_config_word(dev, maslave, &reg4042); pci_read_config_word(dev, maslave, &reg4042);
sitre = (reg4042 & 0x4000) ? 1 : 0; sitre = (reg4042 & 0x4000) ? 1 : 0;
pci_read_config_word(dev, 0x44, &reg44); pci_read_config_byte(dev, 0x48, &reg48);
pci_read_config_word(dev, 0x48, &reg48);
pci_read_config_word(dev, 0x4a, &reg4a); pci_read_config_word(dev, 0x4a, &reg4a);
pci_read_config_word(dev, 0x54, &reg54); pci_read_config_byte(dev, 0x54, &reg54);
pci_read_config_byte(dev, 0x55, &reg55); pci_read_config_byte(dev, 0x55, &reg55);
switch(speed) { switch(speed) {
...@@ -462,30 +461,26 @@ static int piix_tune_chipset (ide_drive_t *drive, u8 xferspeed) ...@@ -462,30 +461,26 @@ static int piix_tune_chipset (ide_drive_t *drive, u8 xferspeed)
if (speed >= XFER_UDMA_0) { if (speed >= XFER_UDMA_0) {
if (!(reg48 & u_flag)) if (!(reg48 & u_flag))
pci_write_config_word(dev, 0x48, reg48|u_flag); pci_write_config_byte(dev, 0x48, reg48 | u_flag);
if (speed == XFER_UDMA_5) { if (speed == XFER_UDMA_5) {
pci_write_config_byte(dev, 0x55, (u8) reg55|w_flag); pci_write_config_byte(dev, 0x55, (u8) reg55|w_flag);
} else { } else {
pci_write_config_byte(dev, 0x55, (u8) reg55 & ~w_flag); pci_write_config_byte(dev, 0x55, (u8) reg55 & ~w_flag);
} }
if (!(reg4a & u_speed)) { if ((reg4a & a_speed) != u_speed)
pci_write_config_word(dev, 0x4a, reg4a & ~a_speed); pci_write_config_word(dev, 0x4a, (reg4a & ~a_speed) | u_speed);
pci_write_config_word(dev, 0x4a, reg4a|u_speed);
}
if (speed > XFER_UDMA_2) { if (speed > XFER_UDMA_2) {
if (!(reg54 & v_flag)) { if (!(reg54 & v_flag))
pci_write_config_word(dev, 0x54, reg54|v_flag); pci_write_config_byte(dev, 0x54, reg54 | v_flag);
} } else
} else { pci_write_config_byte(dev, 0x54, reg54 & ~v_flag);
pci_write_config_word(dev, 0x54, reg54 & ~v_flag);
}
} else { } else {
if (reg48 & u_flag) if (reg48 & u_flag)
pci_write_config_word(dev, 0x48, reg48 & ~u_flag); pci_write_config_byte(dev, 0x48, reg48 & ~u_flag);
if (reg4a & a_speed) if (reg4a & a_speed)
pci_write_config_word(dev, 0x4a, reg4a & ~a_speed); pci_write_config_word(dev, 0x4a, reg4a & ~a_speed);
if (reg54 & v_flag) if (reg54 & v_flag)
pci_write_config_word(dev, 0x54, reg54 & ~v_flag); pci_write_config_byte(dev, 0x54, reg54 & ~v_flag);
if (reg55 & w_flag) if (reg55 & w_flag)
pci_write_config_byte(dev, 0x55, (u8) reg55 & ~w_flag); pci_write_config_byte(dev, 0x55, (u8) reg55 & ~w_flag);
} }
......
...@@ -424,16 +424,15 @@ static void piix_set_udmamode (struct ata_port *ap, struct ata_device *adev, ...@@ -424,16 +424,15 @@ static void piix_set_udmamode (struct ata_port *ap, struct ata_device *adev,
int w_flag = 0x10 << drive_dn; int w_flag = 0x10 << drive_dn;
int u_speed = 0; int u_speed = 0;
int sitre; int sitre;
u16 reg4042, reg44, reg48, reg4a, reg54; u16 reg4042, reg4a;
u8 reg55; u8 reg48, reg54, reg55;
pci_read_config_word(dev, maslave, &reg4042); pci_read_config_word(dev, maslave, &reg4042);
DPRINTK("reg4042 = 0x%04x\n", reg4042); DPRINTK("reg4042 = 0x%04x\n", reg4042);
sitre = (reg4042 & 0x4000) ? 1 : 0; sitre = (reg4042 & 0x4000) ? 1 : 0;
pci_read_config_word(dev, 0x44, &reg44); pci_read_config_byte(dev, 0x48, &reg48);
pci_read_config_word(dev, 0x48, &reg48);
pci_read_config_word(dev, 0x4a, &reg4a); pci_read_config_word(dev, 0x4a, &reg4a);
pci_read_config_word(dev, 0x54, &reg54); pci_read_config_byte(dev, 0x54, &reg54);
pci_read_config_byte(dev, 0x55, &reg55); pci_read_config_byte(dev, 0x55, &reg55);
switch(speed) { switch(speed) {
...@@ -450,23 +449,19 @@ static void piix_set_udmamode (struct ata_port *ap, struct ata_device *adev, ...@@ -450,23 +449,19 @@ static void piix_set_udmamode (struct ata_port *ap, struct ata_device *adev,
} }
if (!(reg48 & u_flag)) if (!(reg48 & u_flag))
pci_write_config_word(dev, 0x48, reg48|u_flag); pci_write_config_byte(dev, 0x48, reg48 | u_flag);
if (speed == XFER_UDMA_5) { if (speed == XFER_UDMA_5) {
pci_write_config_byte(dev, 0x55, (u8) reg55|w_flag); pci_write_config_byte(dev, 0x55, (u8) reg55|w_flag);
} else { } else {
pci_write_config_byte(dev, 0x55, (u8) reg55 & ~w_flag); pci_write_config_byte(dev, 0x55, (u8) reg55 & ~w_flag);
} }
if (!(reg4a & u_speed)) { if ((reg4a & a_speed) != u_speed)
pci_write_config_word(dev, 0x4a, reg4a & ~a_speed); pci_write_config_word(dev, 0x4a, (reg4a & ~a_speed) | u_speed);
pci_write_config_word(dev, 0x4a, reg4a|u_speed);
}
if (speed > XFER_UDMA_2) { if (speed > XFER_UDMA_2) {
if (!(reg54 & v_flag)) { if (!(reg54 & v_flag))
pci_write_config_word(dev, 0x54, reg54|v_flag); pci_write_config_byte(dev, 0x54, reg54 | v_flag);
} } else
} else { pci_write_config_byte(dev, 0x54, reg54 & ~v_flag);
pci_write_config_word(dev, 0x54, reg54 & ~v_flag);
}
} }
/* move to PCI layer, integrate w/ MSI stuff */ /* move to PCI layer, integrate w/ MSI stuff */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment