diff options
Diffstat (limited to 'drivers/ide/alim15x3.c')
-rw-r--r-- | drivers/ide/alim15x3.c | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/drivers/ide/alim15x3.c b/drivers/ide/alim15x3.c index 99c355e87850..4b47896df9f9 100644 --- a/drivers/ide/alim15x3.c +++ b/drivers/ide/alim15x3.c | |||
@@ -48,6 +48,19 @@ static u8 m5229_revision; | |||
48 | static u8 chip_is_1543c_e; | 48 | static u8 chip_is_1543c_e; |
49 | static struct pci_dev *isa_dev; | 49 | static struct pci_dev *isa_dev; |
50 | 50 | ||
51 | static void ali_fifo_control(ide_hwif_t *hwif, ide_drive_t *drive, int on) | ||
52 | { | ||
53 | struct pci_dev *pdev = to_pci_dev(hwif->dev); | ||
54 | int pio_fifo = 0x54 + hwif->channel; | ||
55 | u8 fifo; | ||
56 | int shift = 4 * (drive->dn & 1); | ||
57 | |||
58 | pci_read_config_byte(pdev, pio_fifo, &fifo); | ||
59 | fifo &= ~(0x0F << shift); | ||
60 | fifo |= (on << shift); | ||
61 | pci_write_config_byte(pdev, pio_fifo, fifo); | ||
62 | } | ||
63 | |||
51 | /** | 64 | /** |
52 | * ali_set_pio_mode - set host controller for PIO mode | 65 | * ali_set_pio_mode - set host controller for PIO mode |
53 | * @drive: drive | 66 | * @drive: drive |
@@ -64,8 +77,7 @@ static void ali_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
64 | int bus_speed = ide_pci_clk ? ide_pci_clk : 33; | 77 | int bus_speed = ide_pci_clk ? ide_pci_clk : 33; |
65 | unsigned long T = 1000000 / bus_speed; /* PCI clock based */ | 78 | unsigned long T = 1000000 / bus_speed; /* PCI clock based */ |
66 | int port = hwif->channel ? 0x5c : 0x58; | 79 | int port = hwif->channel ? 0x5c : 0x58; |
67 | int portFIFO = hwif->channel ? 0x55 : 0x54; | 80 | u8 unit = drive->dn & 1; |
68 | u8 cd_dma_fifo = 0, unit = drive->dn & 1; | ||
69 | struct ide_timing t; | 81 | struct ide_timing t; |
70 | 82 | ||
71 | ide_timing_compute(drive, XFER_PIO_0 + pio, &t, T, 1); | 83 | ide_timing_compute(drive, XFER_PIO_0 + pio, &t, T, 1); |
@@ -79,20 +91,7 @@ static void ali_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
79 | /* | 91 | /* |
80 | * PIO mode => ATA FIFO on, ATAPI FIFO off | 92 | * PIO mode => ATA FIFO on, ATAPI FIFO off |
81 | */ | 93 | */ |
82 | pci_read_config_byte(dev, portFIFO, &cd_dma_fifo); | 94 | ali_fifo_control(hwif, drive, (drive->media == ide_disk) ? 0x05 : 0x00); |
83 | if (drive->media==ide_disk) { | ||
84 | if (unit) { | ||
85 | pci_write_config_byte(dev, portFIFO, (cd_dma_fifo & 0x0F) | 0x50); | ||
86 | } else { | ||
87 | pci_write_config_byte(dev, portFIFO, (cd_dma_fifo & 0xF0) | 0x05); | ||
88 | } | ||
89 | } else { | ||
90 | if (unit) { | ||
91 | pci_write_config_byte(dev, portFIFO, cd_dma_fifo & 0x0F); | ||
92 | } else { | ||
93 | pci_write_config_byte(dev, portFIFO, cd_dma_fifo & 0xF0); | ||
94 | } | ||
95 | } | ||
96 | 95 | ||
97 | pci_write_config_byte(dev, port, t.setup); | 96 | pci_write_config_byte(dev, port, t.setup); |
98 | pci_write_config_byte(dev, port + unit + 2, | 97 | pci_write_config_byte(dev, port + unit + 2, |