From 253275c52c8f5848df63f140977ef19800f2dfca Mon Sep 17 00:00:00 2001 From: Atsushi Nemoto Date: Wed, 8 Apr 2009 14:12:49 +0200 Subject: tx4939ide: remove wmb() * define CHECK_DMA_MASK * remove use of wmb() Reported-by: Grant Grundler Reviewed-by: Grant Grundler Signed-off-by: Atsushi Nemoto --- drivers/ide/tx4939ide.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/ide/tx4939ide.c') diff --git a/drivers/ide/tx4939ide.c b/drivers/ide/tx4939ide.c index 0040a9a3e26..2e27fcd4186 100644 --- a/drivers/ide/tx4939ide.c +++ b/drivers/ide/tx4939ide.c @@ -327,15 +327,15 @@ static int tx4939ide_dma_end(ide_drive_t *drive) /* read and clear the INTR & ERROR bits */ dma_stat = tx4939ide_clear_dma_status(base); - wmb(); +#define CHECK_DMA_MASK (ATA_DMA_ACTIVE | ATA_DMA_ERR | ATA_DMA_INTR) /* verify good DMA status */ - if ((dma_stat & (ATA_DMA_INTR | ATA_DMA_ERR | ATA_DMA_ACTIVE)) == 0 && + if ((dma_stat & CHECK_DMA_MASK) == 0 && (ctl & (TX4939IDE_INT_XFEREND | TX4939IDE_INT_HOST)) == (TX4939IDE_INT_XFEREND | TX4939IDE_INT_HOST)) /* INT_IDE lost... bug? */ return 0; - return ((dma_stat & (ATA_DMA_INTR | ATA_DMA_ERR | ATA_DMA_ACTIVE)) != + return ((dma_stat & CHECK_DMA_MASK) != ATA_DMA_INTR) ? 0x10 | dma_stat : 0; } -- cgit v1.2.3 From d68bab503e64e87c464c5a27a56877a04e4404b5 Mon Sep 17 00:00:00 2001 From: Atsushi Nemoto Date: Wed, 8 Apr 2009 14:12:52 +0200 Subject: tx493[89]ide: Remove big endian version of tx493[89]ide_tf_{load,read} Now tx493[89]ide_tf_{load,read} do not contain word I/O operations. They are endian-free now. Signed-off-by: Atsushi Nemoto Cc: Sergei Shtylyov , Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/tx4939ide.c | 99 +++---------------------------------------------- 1 file changed, 6 insertions(+), 93 deletions(-) (limited to 'drivers/ide/tx4939ide.c') diff --git a/drivers/ide/tx4939ide.c b/drivers/ide/tx4939ide.c index 2e27fcd4186..f9b68783d39 100644 --- a/drivers/ide/tx4939ide.c +++ b/drivers/ide/tx4939ide.c @@ -434,96 +434,17 @@ static void tx4939ide_tf_load_fixup(ide_drive_t *drive) tx4939ide_writew(sysctl, base, TX4939IDE_Sys_Ctl); } -#ifdef __BIG_ENDIAN - -/* custom iops (independent from SWAP_IO_SPACE) */ -static u8 tx4939ide_inb(unsigned long port) -{ - return __raw_readb((void __iomem *)port); -} - -static void tx4939ide_outb(u8 value, unsigned long port) -{ - __raw_writeb(value, (void __iomem *)port); -} - static void tx4939ide_tf_load(ide_drive_t *drive, struct ide_cmd *cmd) { - ide_hwif_t *hwif = drive->hwif; - struct ide_io_ports *io_ports = &hwif->io_ports; - struct ide_taskfile *tf = &cmd->tf; - u8 HIHI = cmd->tf_flags & IDE_TFLAG_LBA48 ? 0xE0 : 0xEF; - - if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED) - HIHI = 0xFF; - - if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE) - tx4939ide_outb(tf->hob_feature, io_ports->feature_addr); - if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_NSECT) - tx4939ide_outb(tf->hob_nsect, io_ports->nsect_addr); - if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAL) - tx4939ide_outb(tf->hob_lbal, io_ports->lbal_addr); - if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAM) - tx4939ide_outb(tf->hob_lbam, io_ports->lbam_addr); - if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAH) - tx4939ide_outb(tf->hob_lbah, io_ports->lbah_addr); - - if (cmd->tf_flags & IDE_TFLAG_OUT_FEATURE) - tx4939ide_outb(tf->feature, io_ports->feature_addr); - if (cmd->tf_flags & IDE_TFLAG_OUT_NSECT) - tx4939ide_outb(tf->nsect, io_ports->nsect_addr); - if (cmd->tf_flags & IDE_TFLAG_OUT_LBAL) - tx4939ide_outb(tf->lbal, io_ports->lbal_addr); - if (cmd->tf_flags & IDE_TFLAG_OUT_LBAM) - tx4939ide_outb(tf->lbam, io_ports->lbam_addr); - if (cmd->tf_flags & IDE_TFLAG_OUT_LBAH) - tx4939ide_outb(tf->lbah, io_ports->lbah_addr); - - if (cmd->tf_flags & IDE_TFLAG_OUT_DEVICE) { - tx4939ide_outb((tf->device & HIHI) | drive->select, - io_ports->device_addr); + ide_tf_load(drive, cmd); + + if (cmd->tf_flags & IDE_TFLAG_OUT_DEVICE) tx4939ide_tf_load_fixup(drive); - } } -static void tx4939ide_tf_read(ide_drive_t *drive, struct ide_cmd *cmd) -{ - ide_hwif_t *hwif = drive->hwif; - struct ide_io_ports *io_ports = &hwif->io_ports; - struct ide_taskfile *tf = &cmd->tf; - - /* be sure we're looking at the low order bits */ - tx4939ide_outb(ATA_DEVCTL_OBS, io_ports->ctl_addr); - - if (cmd->tf_flags & IDE_TFLAG_IN_ERROR) - tf->error = tx4939ide_inb(io_ports->feature_addr); - if (cmd->tf_flags & IDE_TFLAG_IN_NSECT) - tf->nsect = tx4939ide_inb(io_ports->nsect_addr); - if (cmd->tf_flags & IDE_TFLAG_IN_LBAL) - tf->lbal = tx4939ide_inb(io_ports->lbal_addr); - if (cmd->tf_flags & IDE_TFLAG_IN_LBAM) - tf->lbam = tx4939ide_inb(io_ports->lbam_addr); - if (cmd->tf_flags & IDE_TFLAG_IN_LBAH) - tf->lbah = tx4939ide_inb(io_ports->lbah_addr); - if (cmd->tf_flags & IDE_TFLAG_IN_DEVICE) - tf->device = tx4939ide_inb(io_ports->device_addr); - - if (cmd->tf_flags & IDE_TFLAG_LBA48) { - tx4939ide_outb(ATA_HOB | ATA_DEVCTL_OBS, io_ports->ctl_addr); - - if (cmd->tf_flags & IDE_TFLAG_IN_HOB_ERROR) - tf->hob_error = tx4939ide_inb(io_ports->feature_addr); - if (cmd->tf_flags & IDE_TFLAG_IN_HOB_NSECT) - tf->hob_nsect = tx4939ide_inb(io_ports->nsect_addr); - if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAL) - tf->hob_lbal = tx4939ide_inb(io_ports->lbal_addr); - if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAM) - tf->hob_lbam = tx4939ide_inb(io_ports->lbam_addr); - if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAH) - tf->hob_lbah = tx4939ide_inb(io_ports->lbah_addr); - } -} +#ifdef __BIG_ENDIAN +/* custom iops (independent from SWAP_IO_SPACE) */ static void tx4939ide_input_data_swap(ide_drive_t *drive, struct request *rq, void *buf, unsigned int len) { @@ -558,7 +479,7 @@ static const struct ide_tp_ops tx4939ide_tp_ops = { .dev_select = ide_dev_select, .tf_load = tx4939ide_tf_load, - .tf_read = tx4939ide_tf_read, + .tf_read = ide_tf_read, .input_data = tx4939ide_input_data_swap, .output_data = tx4939ide_output_data_swap, @@ -566,14 +487,6 @@ static const struct ide_tp_ops tx4939ide_tp_ops = { #else /* __LITTLE_ENDIAN */ -static void tx4939ide_tf_load(ide_drive_t *drive, struct ide_cmd *cmd) -{ - ide_tf_load(drive, cmd); - - if (cmd->tf_flags & IDE_TFLAG_OUT_DEVICE) - tx4939ide_tf_load_fixup(drive); -} - static const struct ide_tp_ops tx4939ide_tp_ops = { .exec_command = ide_exec_command, .read_status = ide_read_status, -- cgit v1.2.3 From aa24d9783d1dcba1a25451dadb6fb0ee092bd8df Mon Sep 17 00:00:00 2001 From: Atsushi Nemoto Date: Wed, 8 Apr 2009 14:12:52 +0200 Subject: tx4939ide: Fix tx4939ide_{in,out}put_data_swap argument The commit adb1af9 ("ide: pass command instead of request to ide_pio_datablock()") missed tx4939ide driver. Signed-off-by: Atsushi Nemoto Cc: Sergei Shtylyov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/tx4939ide.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/ide/tx4939ide.c') diff --git a/drivers/ide/tx4939ide.c b/drivers/ide/tx4939ide.c index f9b68783d39..bee9461f13b 100644 --- a/drivers/ide/tx4939ide.c +++ b/drivers/ide/tx4939ide.c @@ -445,7 +445,7 @@ static void tx4939ide_tf_load(ide_drive_t *drive, struct ide_cmd *cmd) #ifdef __BIG_ENDIAN /* custom iops (independent from SWAP_IO_SPACE) */ -static void tx4939ide_input_data_swap(ide_drive_t *drive, struct request *rq, +static void tx4939ide_input_data_swap(ide_drive_t *drive, struct ide_cmd *cmd, void *buf, unsigned int len) { unsigned long port = drive->hwif->io_ports.data_addr; @@ -457,7 +457,7 @@ static void tx4939ide_input_data_swap(ide_drive_t *drive, struct request *rq, __ide_flush_dcache_range((unsigned long)buf, roundup(len, 2)); } -static void tx4939ide_output_data_swap(ide_drive_t *drive, struct request *rq, +static void tx4939ide_output_data_swap(ide_drive_t *drive, struct ide_cmd *cmd, void *buf, unsigned int len) { unsigned long port = drive->hwif->io_ports.data_addr; -- cgit v1.2.3 From 60f85019c6c8c1aebf3485a313e0da094bc95d07 Mon Sep 17 00:00:00 2001 From: Sergei Shtylyov Date: Wed, 8 Apr 2009 14:13:01 +0200 Subject: ide: replace IDE_TFLAG_* flags by IDE_VALID_* Replace IDE_TFLAG_{IN|OUT}_* flags meaning to the taskfile register validity on input/output by the IDE_VALID_* flags and introduce 4 symmetric 8-bit register validity indicator subfields, 'valid.{input/output}.{tf|hob}', into the 'struct ide_cmd' instead of using the 'tf_flags' field for that purpose (this field can then be turned from 32-bit into 8-bit one). Signed-off-by: Sergei Shtylyov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/tx4939ide.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/ide/tx4939ide.c') diff --git a/drivers/ide/tx4939ide.c b/drivers/ide/tx4939ide.c index bee9461f13b..af8b0f68d5c 100644 --- a/drivers/ide/tx4939ide.c +++ b/drivers/ide/tx4939ide.c @@ -438,7 +438,7 @@ static void tx4939ide_tf_load(ide_drive_t *drive, struct ide_cmd *cmd) { ide_tf_load(drive, cmd); - if (cmd->tf_flags & IDE_TFLAG_OUT_DEVICE) + if (cmd->valid.out.tf & IDE_VALID_DEVICE) tx4939ide_tf_load_fixup(drive); } -- cgit v1.2.3 From c9ff9e7b64138d87023b733e618f29a1d58543f7 Mon Sep 17 00:00:00 2001 From: Sergei Shtylyov Date: Wed, 8 Apr 2009 14:13:03 +0200 Subject: ide: refactor tf_load() method Simplify tf_load() method, making it deal only with 'struct ide_taskfile' and the validity flags that the upper layer passes, and moving the code that deals with the high order bytes into the only function interested, do_rw_taskfile(). This should stop the needless code duplication in this method and so make it about twice smaller than it was; along with simplifying the setup for the method call, this should save both time and space... Signed-off-by: Sergei Shtylyov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/tx4939ide.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'drivers/ide/tx4939ide.c') diff --git a/drivers/ide/tx4939ide.c b/drivers/ide/tx4939ide.c index af8b0f68d5c..564422d2397 100644 --- a/drivers/ide/tx4939ide.c +++ b/drivers/ide/tx4939ide.c @@ -434,11 +434,12 @@ static void tx4939ide_tf_load_fixup(ide_drive_t *drive) tx4939ide_writew(sysctl, base, TX4939IDE_Sys_Ctl); } -static void tx4939ide_tf_load(ide_drive_t *drive, struct ide_cmd *cmd) +static void tx4939ide_tf_load(ide_drive_t *drive, struct ide_taskfile *tf, + u8 valid) { - ide_tf_load(drive, cmd); + ide_tf_load(drive, tf, valid); - if (cmd->valid.out.tf & IDE_VALID_DEVICE) + if (valid & IDE_VALID_DEVICE) tx4939ide_tf_load_fixup(drive); } -- cgit v1.2.3