Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 77232
b: refs/heads/master
c: aea5d37
h: refs/heads/master
v: v3
  • Loading branch information
Bartlomiej Zolnierkiewicz committed Jan 26, 2008
1 parent 2a5ff60 commit 3626e6c
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 17 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: 29ec683f019608ca0cb6cf69011426ecb5daa69e
refs/heads/master: aea5d375600f132537adf45942c0fbdcd25eb995
2 changes: 1 addition & 1 deletion trunk/drivers/ide/ide-iops.c
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,7 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed)

skip:
#ifdef CONFIG_BLK_DEV_IDEDMA
if (speed >= XFER_SW_DMA_0)
if (speed >= XFER_SW_DMA_0 || (hwif->host_flags & IDE_HFLAG_VDMA))
hwif->dma_host_on(drive);
else if (hwif->ide_dma_on) /* check if host supports DMA */
hwif->dma_off_quietly(drive);
Expand Down
29 changes: 17 additions & 12 deletions trunk/drivers/ide/pci/cs5520.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ static void cs5520_set_pio_mode(ide_drive_t *drive, const u8 pio)
ide_hwif_t *hwif = HWIF(drive);
struct pci_dev *pdev = hwif->pci_dev;
int controller = drive->dn > 1 ? 1 : 0;
u8 reg;

/* FIXME: if DMA = 1 do we need to set the DMA bit here ? */

Expand All @@ -91,11 +90,6 @@ static void cs5520_set_pio_mode(ide_drive_t *drive, const u8 pio)
pci_write_config_byte(pdev, 0x66 + 4*controller + (drive->dn&1),
(cs5520_pio_clocks[pio].recovery << 4) |
(cs5520_pio_clocks[pio].assert));

/* Set the DMA enable/disable flag */
reg = inb(hwif->dma_base + 0x02 + 8*controller);
reg |= 1<<((drive->dn&1)+5);
outb(reg, hwif->dma_base + 0x02 + 8*controller);
}

static void cs5520_set_dma_mode(ide_drive_t *drive, const u8 speed)
Expand All @@ -109,13 +103,23 @@ static void cs5520_set_dma_mode(ide_drive_t *drive, const u8 speed)
* We wrap the DMA activate to set the vdma flag. This is needed
* so that the IDE DMA layer issues PIO not DMA commands over the
* DMA channel
*
* ATAPI is harder so disable it for now using IDE_HFLAG_NO_ATAPI_DMA
*/
static int cs5520_dma_on(ide_drive_t *drive)

static void cs5520_dma_host_on(ide_drive_t *drive)
{
/* ATAPI is harder so leave it for now */
drive->vdma = 1;
return 0;
if (drive->using_dma)
drive->vdma = 1;

ide_dma_host_on(drive);
}

static void cs5520_dma_host_off(ide_drive_t *drive)
{
drive->vdma = 0;

ide_dma_host_off(drive);
}

static void __devinit init_hwif_cs5520(ide_hwif_t *hwif)
Expand All @@ -126,7 +130,8 @@ static void __devinit init_hwif_cs5520(ide_hwif_t *hwif)
if (hwif->dma_base == 0)
return;

hwif->ide_dma_on = &cs5520_dma_on;
hwif->dma_host_on = &cs5520_dma_host_on;
hwif->dma_host_off = &cs5520_dma_host_off;
}

#define DECLARE_CS_DEV(name_str) \
Expand Down
10 changes: 7 additions & 3 deletions trunk/drivers/ide/setup-pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,17 @@ static unsigned long ide_get_or_set_dma_base(const struct ide_port_info *d, ide_

dma_base = pci_resource_start(dev, baridx);

if (dma_base == 0)
if (dma_base == 0) {
printk(KERN_ERR "%s: DMA base is invalid\n", d->name);
return 0;
}
}

if ((d->host_flags & IDE_HFLAG_CS5520) == 0 && dma_base) {
if (hwif->channel)
dma_base += 8;

if ((d->host_flags & IDE_HFLAG_CS5520) == 0) {
u8 simplex_stat = 0;
dma_base += hwif->channel ? 8 : 0;

switch(dev->device) {
case PCI_DEVICE_ID_AL_M5219:
Expand Down

0 comments on commit 3626e6c

Please sign in to comment.