[adm5120] RB153 CF driver fixes

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@9708 3c298f89-4303-0410-b956-a3cf2f4a3e73
master
Gabor Juhos 2007-12-11 16:46:55 +00:00
parent a6f6c97b57
commit 5273e5143d
1 changed files with 18 additions and 11 deletions

View File

@ -32,7 +32,7 @@
#include <asm/gpio.h> #include <asm/gpio.h>
#define DRV_NAME "pata-rb153-cf" #define DRV_NAME "pata-rb153-cf"
#define DRV_VERSION "0.1" #define DRV_VERSION "0.2"
#define DRV_DESC "PATA driver for RouterBOARD 153 Compact Flash" #define DRV_DESC "PATA driver for RouterBOARD 153 Compact Flash"
#define RB153_CF_MAXPORTS 1 #define RB153_CF_MAXPORTS 1
@ -45,7 +45,7 @@
struct rb153_cf_info { struct rb153_cf_info {
void __iomem *iobase; void __iomem *iobase;
unsigned int gpio_line; unsigned int gpio_line;
int error; int frozen;
}; };
/* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */
@ -70,25 +70,31 @@ static void rb153_pata_exec_command(struct ata_port *ap,
static void rb153_pata_data_xfer(struct ata_device *adev, unsigned char *buf, static void rb153_pata_data_xfer(struct ata_device *adev, unsigned char *buf,
unsigned int buflen, int write_data) unsigned int buflen, int write_data)
{ {
struct ata_port *ap = adev->ap; void __iomem *ioaddr = adev->ap->ioaddr.data_addr;
unsigned int i;
if (write_data) { if (write_data) {
for (i = 0; i < buflen; i++) for (; buflen > 0; buflen--, buf++)
writeb(buf[i], ap->ioaddr.data_addr); writeb(*buf, ioaddr);
} else { } else {
for (; buflen > 0; buflen--) for (; buflen > 0; buflen--, buf++)
buf[i] = readb(ap->ioaddr.data_addr); *buf = readb(ioaddr);
} }
rb153_pata_finish_io(ap); rb153_pata_finish_io(adev->ap);
}
static void rb153_pata_freeze(struct ata_port *ap)
{
struct rb153_cf_info *info = ap->host->private_data;
info->frozen = 1;
} }
static void rb153_pata_thaw(struct ata_port *ap) static void rb153_pata_thaw(struct ata_port *ap)
{ {
struct rb153_cf_info *info = ap->host->private_data; struct rb153_cf_info *info = ap->host->private_data;
info->error = 0; info->frozen = 0;
} }
static irqreturn_t rb153_pata_irq_handler(int irq, void *dev_instance) static irqreturn_t rb153_pata_irq_handler(int irq, void *dev_instance)
@ -98,7 +104,7 @@ static irqreturn_t rb153_pata_irq_handler(int irq, void *dev_instance)
if (gpio_get_value(info->gpio_line)) { if (gpio_get_value(info->gpio_line)) {
set_irq_type(ah->irq, IRQ_TYPE_LEVEL_LOW); set_irq_type(ah->irq, IRQ_TYPE_LEVEL_LOW);
if (!info->error) if (!info->frozen)
ata_interrupt(irq, dev_instance); ata_interrupt(irq, dev_instance);
} else { } else {
set_irq_type(ah->irq, IRQ_TYPE_LEVEL_HIGH); set_irq_type(ah->irq, IRQ_TYPE_LEVEL_HIGH);
@ -131,6 +137,7 @@ static struct ata_port_operations rb153_pata_port_ops = {
.qc_prep = ata_qc_prep, .qc_prep = ata_qc_prep,
.qc_issue = ata_qc_issue_prot, .qc_issue = ata_qc_issue_prot,
.freeze = rb153_pata_freeze,
.thaw = rb153_pata_thaw, .thaw = rb153_pata_thaw,
.error_handler = ata_bmdma_error_handler, .error_handler = ata_bmdma_error_handler,