1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-11-24 00:14:05 +02:00

fix the IXP4xx CF driver patch for 2.6.30

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@17996 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
kaloz 2009-10-08 10:43:45 +00:00
parent 334bbe009a
commit 4acf29788d

View File

@ -1,6 +1,6 @@
--- a/drivers/ata/pata_ixp4xx_cf.c --- a/drivers/ata/pata_ixp4xx_cf.c
+++ b/drivers/ata/pata_ixp4xx_cf.c +++ b/drivers/ata/pata_ixp4xx_cf.c
@@ -24,18 +24,61 @@ @@ -24,16 +24,58 @@
#include <scsi/scsi_host.h> #include <scsi/scsi_host.h>
#define DRV_NAME "pata_ixp4xx_cf" #define DRV_NAME "pata_ixp4xx_cf"
@ -9,17 +9,14 @@
static int ixp4xx_set_mode(struct ata_link *link, struct ata_device **error) static int ixp4xx_set_mode(struct ata_link *link, struct ata_device **error)
{ {
struct ata_device *dev;
+ struct ixp4xx_pata_data *data = link->ap->host->dev->platform_data; + struct ixp4xx_pata_data *data = link->ap->host->dev->platform_data;
+ unsigned int pio_mask; + unsigned int pio_mask;
struct ata_device *dev;
- ata_for_each_dev(dev, link, ENABLED) { ata_for_each_dev(dev, link, ENABLED) {
- ata_dev_printk(dev, KERN_INFO, "configured for PIO0\n"); - ata_dev_printk(dev, KERN_INFO, "configured for PIO0\n");
- dev->pio_mode = XFER_PIO_0; - dev->pio_mode = XFER_PIO_0;
- dev->xfer_mode = XFER_PIO_0; - dev->xfer_mode = XFER_PIO_0;
- dev->xfer_shift = ATA_SHIFT_PIO;
- dev->flags |= ATA_DFLAG_PIO;
+ ata_link_for_each_dev(dev, link) {
+ if (dev->id[ATA_ID_FIELD_VALID] & (1 << 1)) { + if (dev->id[ATA_ID_FIELD_VALID] & (1 << 1)) {
+ pio_mask = dev->id[ATA_ID_PIO_MODES] & 0x03; + pio_mask = dev->id[ATA_ID_PIO_MODES] & 0x03;
+ if (pio_mask & (1 << 1)) { + if (pio_mask & (1 << 1)) {
@ -30,46 +27,43 @@
+ } else { + } else {
+ pio_mask = (dev->id[ATA_ID_OLD_PIO_MODES] >> 8); + pio_mask = (dev->id[ATA_ID_OLD_PIO_MODES] >> 8);
+ } + }
+ switch (pio_mask) { +
+ case 0: + switch (pio_mask){
+ ata_dev_printk(dev, KERN_INFO, "configured for PIO0\n"); + case 0:
+ dev->pio_mode = XFER_PIO_0; + ata_dev_printk(dev, KERN_INFO, "configured for PIO0\n");
+ dev->xfer_mode = XFER_PIO_0; + dev->pio_mode = XFER_PIO_0;
+ *data->cs0_cfg = 0x8a473c03; + dev->xfer_mode = XFER_PIO_0;
+ break; + *data->cs0_cfg = 0x8a473c03;
+ case 1: + break;
+ ata_dev_printk(dev, KERN_INFO, "configured for PIO1\n"); + case 1:
+ dev->pio_mode = XFER_PIO_1; + ata_dev_printk(dev, KERN_INFO, "configured for PIO1\n");
+ dev->xfer_mode = XFER_PIO_1; + dev->pio_mode = XFER_PIO_1;
+ *data->cs0_cfg = 0x86433c03; + dev->xfer_mode = XFER_PIO_1;
+ break; + *data->cs0_cfg = 0x86433c03;
+ case 2: + break;
+ ata_dev_printk(dev, KERN_INFO, "configured for PIO2\n"); + case 2:
+ dev->pio_mode = XFER_PIO_2; + ata_dev_printk(dev, KERN_INFO, "configured for PIO2\n");
+ dev->xfer_mode = XFER_PIO_2; + dev->pio_mode = XFER_PIO_2;
+ *data->cs0_cfg = 0x82413c03; + dev->xfer_mode = XFER_PIO_2;
+ break; + *data->cs0_cfg = 0x82413c03;
+ case 3: + break;
+ ata_dev_printk(dev, KERN_INFO, "configured for PIO3\n"); + case 3:
+ dev->pio_mode = XFER_PIO_3; + ata_dev_printk(dev, KERN_INFO, "configured for PIO3\n");
+ dev->xfer_mode = XFER_PIO_3; + dev->pio_mode = XFER_PIO_3;
+ *data->cs0_cfg = 0x80823c03; + dev->xfer_mode = XFER_PIO_3;
+ break; + *data->cs0_cfg = 0x80823c03;
+ case 4: + break;
+ ata_dev_printk(dev, KERN_INFO, "configured for PIO4\n"); + case 4:
+ dev->pio_mode = XFER_PIO_4; + ata_dev_printk(dev, KERN_INFO, "configured for PIO4\n");
+ dev->xfer_mode = XFER_PIO_4; + dev->pio_mode = XFER_PIO_4;
+ *data->cs0_cfg = 0x80403c03; + dev->xfer_mode = XFER_PIO_4;
+ break; + *data->cs0_cfg = 0x80403c03;
+ } + break;
+ if (ata_dev_enabled(dev)) {
+ dev->xfer_shift = ATA_SHIFT_PIO;
+ dev->flags |= ATA_DFLAG_PIO;
+ } + }
dev->xfer_shift = ATA_SHIFT_PIO;
dev->flags |= ATA_DFLAG_PIO;
} }
return 0; @@ -46,6 +88,7 @@ static unsigned int ixp4xx_mmio_data_xfe
}
@@ -46,6 +89,7 @@ static unsigned int ixp4xx_mmio_data_xfe
unsigned int i; unsigned int i;
unsigned int words = buflen >> 1; unsigned int words = buflen >> 1;
u16 *buf16 = (u16 *) buf; u16 *buf16 = (u16 *) buf;
@ -77,7 +71,7 @@
struct ata_port *ap = dev->link->ap; struct ata_port *ap = dev->link->ap;
void __iomem *mmio = ap->ioaddr.data_addr; void __iomem *mmio = ap->ioaddr.data_addr;
struct ixp4xx_pata_data *data = ap->host->dev->platform_data; struct ixp4xx_pata_data *data = ap->host->dev->platform_data;
@@ -53,8 +97,34 @@ static unsigned int ixp4xx_mmio_data_xfe @@ -53,8 +96,34 @@ static unsigned int ixp4xx_mmio_data_xfe
/* set the expansion bus in 16bit mode and restore /* set the expansion bus in 16bit mode and restore
* 8 bit mode after the transaction. * 8 bit mode after the transaction.
*/ */
@ -114,7 +108,7 @@
/* Transfer multiple of 2 bytes */ /* Transfer multiple of 2 bytes */
if (rw == READ) if (rw == READ)
@@ -79,8 +149,24 @@ static unsigned int ixp4xx_mmio_data_xfe @@ -79,8 +148,24 @@ static unsigned int ixp4xx_mmio_data_xfe
words++; words++;
} }