Merge branch 'for-linus' of git://git390.osdl.marist.edu/pub/scm/linux-2.6
[pandora-kernel.git] / drivers / ide / cris / ide-cris.c
index c306c9f..325e608 100644 (file)
@@ -664,7 +664,6 @@ cris_ide_inb(unsigned long reg)
        return (unsigned char)cris_ide_inw(reg);
 }
 
-static int cris_dma_check (ide_drive_t *drive);
 static int cris_dma_end (ide_drive_t *drive);
 static int cris_dma_setup (ide_drive_t *drive);
 static void cris_dma_exec_cmd (ide_drive_t *drive, u8 command);
@@ -748,9 +747,6 @@ static void cris_set_dma_mode(ide_drive_t *drive, const u8 speed)
                        strobe = ATA_DMA2_STROBE;
                        hold = ATA_DMA2_HOLD;
                        break;
-               default:
-                       BUG();
-                       break;
        }
 
        if (speed >= XFER_UDMA_0)
@@ -775,15 +771,16 @@ init_e100_ide (void)
        /* the IDE control register is at ATA address 6, with CS1 active instead of CS0 */
        ide_offsets[IDE_CONTROL_OFFSET] = cris_ide_reg_addr(6, 1, 0);
 
-       /* first fill in some stuff in the ide_hwifs fields */
+       for (h = 0; h < 4; h++) {
+               ide_hwif_t *hwif = NULL;
 
-       for(h = 0; h < MAX_HWIFS; h++) {
-               ide_hwif_t *hwif = &ide_hwifs[h];
                ide_setup_ports(&hw, cris_ide_base_address(h),
                                ide_offsets,
                                0, 0, cris_ide_ack_intr,
                                ide_default_irq(0));
-               ide_register_hw(&hw, 1, &hwif);
+               ide_register_hw(&hw, NULL, 1, &hwif);
+               if (hwif == NULL)
+                       continue;
                hwif->mmio = 1;
                hwif->chipset = ide_etrax100;
                hwif->set_pio_mode = &cris_set_pio_mode;
@@ -792,7 +789,6 @@ init_e100_ide (void)
                hwif->ata_output_data = &cris_ide_output_data;
                hwif->atapi_input_bytes = &cris_atapi_input_bytes;
                hwif->atapi_output_bytes = &cris_atapi_output_bytes;
-               hwif->ide_dma_check = &cris_dma_check;
                hwif->ide_dma_end = &cris_dma_end;
                hwif->dma_setup = &cris_dma_setup;
                hwif->dma_exec_cmd = &cris_dma_exec_cmd;
@@ -807,12 +803,12 @@ init_e100_ide (void)
                hwif->dma_host_on = &cris_dma_on;
                hwif->dma_off_quietly = &cris_dma_off;
                hwif->cbl = ATA_CBL_PATA40;
+               hwif->host_flags |= IDE_HFLAG_NO_ATAPI_DMA;
                hwif->pio_mask = ATA_PIO4,
+               hwif->drives[0].autotune = 1;
+               hwif->drives[1].autotune = 1;
                hwif->ultra_mask = cris_ultra_mask;
                hwif->mwdma_mask = 0x07; /* Multiword DMA 0-2 */
-               hwif->autodma = 1;
-               hwif->drives[0].autodma = 1;
-               hwif->drives[1].autodma = 1;
        }
 
        /* Reset pulse */
@@ -937,11 +933,11 @@ static int cris_ide_build_dmatable (ide_drive_t *drive)
                 * than two possibly non-adjacent physical 4kB pages.
                 */
                /* group sequential buffers into one large buffer */
-               addr = page_to_phys(sg->page) + sg->offset;
+               addr = sg_phys(sg);
                size = sg_dma_len(sg);
                while (--i) {
                        sg = sg_next(sg);
-                       if ((addr + size) != page_to_phys(sg->page) + sg->offset)
+                       if ((addr + size) != sg_phys(sg))
                                break;
                        size += sg_dma_len(sg);
                }
@@ -1018,14 +1014,6 @@ static ide_startstop_t cris_dma_intr (ide_drive_t *drive)
  * the caller should revert to PIO for the current request.
  */
 
-static int cris_dma_check(ide_drive_t *drive)
-{
-       if (ide_tune_dma(drive))
-               return 0;
-
-       return -1;
-}
-
 static int cris_dma_end(ide_drive_t *drive)
 {
        drive->waiting_for_dma = 0;