ide: delete filenames/versions from comments
[pandora-kernel.git] / drivers / ide / cris / ide-cris.c
index 9a96a10..0640a38 100644 (file)
@@ -1,5 +1,4 @@
-/* $Id: cris-ide-driver.patch,v 1.1 2005/06/29 21:39:07 akpm Exp $
- *
+/*
  * Etrax specific IDE functions, like init and PIO-mode setting etc.
  * Almost the entire ide.c is used for the rest of the Etrax ATA driver.
  * Copyright (c) 2000-2005 Axis Communications AB
@@ -673,9 +672,8 @@ static void cris_ide_input_data (ide_drive_t *drive, void *, unsigned int);
 static void cris_ide_output_data (ide_drive_t *drive, void *, unsigned int);
 static void cris_atapi_input_bytes(ide_drive_t *drive, void *, unsigned int);
 static void cris_atapi_output_bytes(ide_drive_t *drive, void *, unsigned int);
-static int cris_dma_on (ide_drive_t *drive);
 
-static void cris_dma_off(ide_drive_t *drive)
+static void cris_dma_host_set(ide_drive_t *drive, int on)
 {
 }
 
@@ -747,9 +745,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)
@@ -758,13 +753,11 @@ static void cris_set_dma_mode(ide_drive_t *drive, const u8 speed)
                cris_ide_set_speed(TYPE_DMA, 0, strobe, hold);
 }
 
-void __init
-init_e100_ide (void)
+static int __init init_e100_ide(void)
 {
        hw_regs_t hw;
-       int ide_offsets[IDE_NR_PORTS];
-       int h;
-       int i;
+       int ide_offsets[IDE_NR_PORTS], h, i;
+       u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
 
        printk("ide: ETRAX FS built-in ATA DMA controller\n");
 
@@ -774,15 +767,18 @@ 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);
+               hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]);
+               if (hwif == NULL)
+                       continue;
+               ide_init_port_data(hwif, hwif->index);
+               ide_init_port_hw(hwif, &hw);
                hwif->mmio = 1;
                hwif->chipset = ide_etrax100;
                hwif->set_pio_mode = &cris_set_pio_mode;
@@ -791,6 +787,7 @@ 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->dma_host_set = &cris_dma_host_set;
                hwif->ide_dma_end = &cris_dma_end;
                hwif->dma_setup = &cris_dma_setup;
                hwif->dma_exec_cmd = &cris_dma_exec_cmd;
@@ -801,9 +798,6 @@ init_e100_ide (void)
                hwif->OUTBSYNC = &cris_ide_outbsync;
                hwif->INB = &cris_ide_inb;
                hwif->INW = &cris_ide_inw;
-               hwif->dma_host_off = &cris_dma_off;
-               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,
@@ -811,6 +805,8 @@ init_e100_ide (void)
                hwif->drives[1].autotune = 1;
                hwif->ultra_mask = cris_ultra_mask;
                hwif->mwdma_mask = 0x07; /* Multiword DMA 0-2 */
+
+               idx[h] = hwif->index;
        }
 
        /* Reset pulse */
@@ -823,14 +819,12 @@ init_e100_ide (void)
        cris_ide_set_speed(TYPE_PIO, ATA_PIO4_SETUP, ATA_PIO4_STROBE, ATA_PIO4_HOLD);
        cris_ide_set_speed(TYPE_DMA, 0, ATA_DMA2_STROBE, ATA_DMA2_HOLD);
        cris_ide_set_speed(TYPE_UDMA, ATA_UDMA2_CYC, ATA_UDMA2_DVS, 0);
-}
 
-static int cris_dma_on (ide_drive_t *drive)
-{
+       ide_device_add(idx);
+
        return 0;
 }
 
-
 static cris_dma_descr_type mydescr __attribute__ ((__aligned__(16)));
 
 /*
@@ -935,11 +929,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);
                }
@@ -1062,3 +1056,5 @@ static void cris_dma_start(ide_drive_t *drive)
                LED_DISK_READ(1);
        }
 }
+
+module_init(init_e100_ide);