Lines Matching +full:drive +full:- +full:mode
9 * (C) Copyright TOSHIBA CORPORATION 2005-2007
25 /* ATA Shadow Registers (8-bit except for Data which is 16-bit) */
36 #define TX4939IDE_DMA_Cmd 0x800 /* 8-bit */
37 #define TX4939IDE_DMA_Stat 0x802 /* 8-bit */
38 #define TX4939IDE_PRD_Ptr 0x804 /* 32-bit */
39 /* ATA100 CORE Registers (16-bit) */
105 #define TX4939IDE_BASE(hwif) ((void __iomem *)(hwif)->extra_base)
107 static void tx4939ide_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive) in tx4939ide_set_pio_mode() argument
109 int is_slave = drive->dn; in tx4939ide_set_pio_mode()
111 const u8 pio = drive->pio_mode - XFER_PIO_0; in tx4939ide_set_pio_mode()
115 pair = ide_get_pair_dev(drive); in tx4939ide_set_pio_mode()
117 safe = min_t(u8, safe, pair->pio_mode - XFER_PIO_0); in tx4939ide_set_pio_mode()
119 * Update Command Transfer Mode for master/slave and Data in tx4939ide_set_pio_mode()
120 * Transfer Mode for this drive. in tx4939ide_set_pio_mode()
124 hwif->select_data = (hwif->select_data & ~mask) | val; in tx4939ide_set_pio_mode()
128 static void tx4939ide_set_dma_mode(ide_hwif_t *hwif, ide_drive_t *drive) in tx4939ide_set_dma_mode() argument
131 const u8 mode = drive->dma_mode; in tx4939ide_set_dma_mode() local
133 /* Update Data Transfer Mode for this drive. */ in tx4939ide_set_dma_mode()
134 if (mode >= XFER_UDMA_0) in tx4939ide_set_dma_mode()
135 val = mode - XFER_UDMA_0 + 8; in tx4939ide_set_dma_mode()
137 val = mode - XFER_MW_DMA_0 + 5; in tx4939ide_set_dma_mode()
138 if (drive->dn) { in tx4939ide_set_dma_mode()
145 hwif->select_data = (hwif->select_data & ~mask) | val; in tx4939ide_set_dma_mode()
166 hwif->name, ctl, in tx4939ide_check_error_ints()
167 ctl & TX4939IDE_INT_ADDRERR ? " Address-Error" : "", in tx4939ide_check_error_ints()
168 ctl & TX4939IDE_INT_DEVTIMING ? " DEV-Timing" : "", in tx4939ide_check_error_ints()
169 ctl & TX4939IDE_INT_BUSERR ? " Bus-Error" : ""); in tx4939ide_check_error_ints()
173 static void tx4939ide_clear_irq(ide_drive_t *drive) in tx4939ide_clear_irq() argument
183 if (drive->waiting_for_dma) in tx4939ide_clear_irq()
185 hwif = drive->hwif; in tx4939ide_clear_irq()
200 static void tx4939ide_dma_host_set(ide_drive_t *drive, int on) in tx4939ide_dma_host_set() argument
202 ide_hwif_t *hwif = drive->hwif; in tx4939ide_dma_host_set()
203 u8 unit = drive->dn; in tx4939ide_dma_host_set()
234 static int tx4939ide_build_dmatable(ide_drive_t *drive, struct ide_cmd *cmd) in tx4939ide_build_dmatable() argument
236 ide_hwif_t *hwif = drive->hwif; in tx4939ide_build_dmatable()
237 u32 *table = (u32 *)hwif->dmatable_cpu; in tx4939ide_build_dmatable()
242 for_each_sg(hwif->sg_table, sg, cmd->sg_nents, i) { in tx4939ide_build_dmatable()
256 bcount = 0x10000 - (cur_addr & 0xffff); in tx4939ide_build_dmatable()
268 cur_len -= bcount; in tx4939ide_build_dmatable()
273 *(table - 2) |= 0x80000000; in tx4939ide_build_dmatable()
278 printk(KERN_ERR "%s: %s\n", drive->name, in tx4939ide_build_dmatable()
287 static int tx4939ide_dma_setup(ide_drive_t *drive, struct ide_cmd *cmd) in tx4939ide_dma_setup() argument
289 ide_hwif_t *hwif = drive->hwif; in tx4939ide_dma_setup()
291 u8 rw = (cmd->tf_flags & IDE_TFLAG_WRITE) ? 0 : ATA_DMA_WR; in tx4939ide_dma_setup()
294 if (tx4939ide_build_dmatable(drive, cmd) == 0) in tx4939ide_dma_setup()
298 tx4939ide_writel(hwif->dmatable_dma, base, TX4939IDE_PRD_Ptr); in tx4939ide_dma_setup()
306 tx4939ide_writew(SECTOR_SIZE / 2, base, drive->dn ? in tx4939ide_dma_setup()
309 tx4939ide_writew(blk_rq_sectors(cmd->rq), base, TX4939IDE_Sec_Cnt); in tx4939ide_dma_setup()
314 static int tx4939ide_dma_end(ide_drive_t *drive) in tx4939ide_dma_end() argument
316 ide_hwif_t *hwif = drive->hwif; in tx4939ide_dma_end()
321 /* get DMA command mode */ in tx4939ide_dma_end()
342 static int tx4939ide_dma_test_irq(ide_drive_t *drive) in tx4939ide_dma_test_irq() argument
344 ide_hwif_t *hwif = drive->hwif; in tx4939ide_dma_test_irq()
368 hwif->name, dma_stat, ctl); in tx4939ide_dma_test_irq()
411 hwif->dma_base = in tx4939ide_init_dma()
412 hwif->extra_base + tx4939ide_swizzleb(TX4939IDE_DMA_Cmd); in tx4939ide_init_dma()
420 static void tx4939ide_tf_load_fixup(ide_drive_t *drive) in tx4939ide_tf_load_fixup() argument
422 ide_hwif_t *hwif = drive->hwif; in tx4939ide_tf_load_fixup()
424 u16 sysctl = hwif->select_data >> (drive->dn ? 16 : 0); in tx4939ide_tf_load_fixup()
435 static void tx4939ide_tf_load(ide_drive_t *drive, struct ide_taskfile *tf, in tx4939ide_tf_load() argument
438 ide_tf_load(drive, tf, valid); in tx4939ide_tf_load()
441 tx4939ide_tf_load_fixup(drive); in tx4939ide_tf_load()
447 static void tx4939ide_input_data_swap(ide_drive_t *drive, struct ide_cmd *cmd, in tx4939ide_input_data_swap() argument
450 unsigned long port = drive->hwif->io_ports.data_addr; in tx4939ide_input_data_swap()
454 while (count--) in tx4939ide_input_data_swap()
459 static void tx4939ide_output_data_swap(ide_drive_t *drive, struct ide_cmd *cmd, in tx4939ide_output_data_swap() argument
462 unsigned long port = drive->hwif->io_ports.data_addr; in tx4939ide_output_data_swap()
466 while (count--) { in tx4939ide_output_data_swap()
546 return -ENODEV; in tx4939ide_probe()
549 return -ENODEV; in tx4939ide_probe()
551 if (!devm_request_mem_region(&pdev->dev, res->start, in tx4939ide_probe()
553 return -EBUSY; in tx4939ide_probe()
554 mapbase = (unsigned long)devm_ioremap(&pdev->dev, res->start, in tx4939ide_probe()
557 return -EBUSY; in tx4939ide_probe()
578 hw.dev = &pdev->dev; in tx4939ide_probe()
583 return -ENOMEM; in tx4939ide_probe()
585 host->ports[0]->extra_base = mapbase; in tx4939ide_probe()
607 ide_hwif_t *hwif = host->ports[0]; in tx4939ide_resume()