aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/ata/pata_marvell.c43
1 files changed, 21 insertions, 22 deletions
diff --git a/drivers/ata/pata_marvell.c b/drivers/ata/pata_marvell.c
index 2b8e00cb7b9b..1ea64075c783 100644
--- a/drivers/ata/pata_marvell.c
+++ b/drivers/ata/pata_marvell.c
@@ -20,7 +20,7 @@
20#include <linux/ata.h> 20#include <linux/ata.h>
21 21
22#define DRV_NAME "pata_marvell" 22#define DRV_NAME "pata_marvell"
23#define DRV_VERSION "0.0.4t" 23#define DRV_VERSION "0.0.5u"
24 24
25/** 25/**
26 * marvell_pre_reset - check for 40/80 pin 26 * marvell_pre_reset - check for 40/80 pin
@@ -33,14 +33,12 @@ static int marvell_pre_reset(struct ata_port *ap)
33{ 33{
34 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 34 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
35 u32 devices; 35 u32 devices;
36 unsigned long bar5;
37 void __iomem *barp; 36 void __iomem *barp;
38 int i; 37 int i;
39 38
40 /* Check if our port is enabled */ 39 /* Check if our port is enabled */
41 40
42 bar5 = pci_resource_start(pdev, 5); 41 barp = pci_iomap(pdev, 5, 0x10);
43 barp = ioremap(bar5, 0x10);
44 if (barp == NULL) 42 if (barp == NULL)
45 return -ENOMEM; 43 return -ENOMEM;
46 printk("BAR5:"); 44 printk("BAR5:");
@@ -49,24 +47,25 @@ static int marvell_pre_reset(struct ata_port *ap)
49 printk("\n"); 47 printk("\n");
50 48
51 devices = readl(barp + 0x0C); 49 devices = readl(barp + 0x0C);
52 iounmap(barp); 50 pci_iounmap(pdev, barp);
53 51
54 if (pdev->device == 0x6145 && ap->port_no == 0 && !(devices & 0x10)) /* PATA enable ? */ 52 if ((pdev->device == 0x6145) && (ap->port_no == 0) &&
53 (!(devices & 0x10))) /* PATA enable ? */
55 return -ENOENT; 54 return -ENOENT;
56 55
57 /* Cable type */ 56 /* Cable type */
58 switch(ap->port_no) 57 switch(ap->port_no)
59 { 58 {
60 case 0: 59 case 0:
61 /* Might be backward, docs unclear */ 60 /* Might be backward, docs unclear */
62 if(inb(ap->ioaddr.bmdma_addr + 1) & 1) 61 if (inb(ap->ioaddr.bmdma_addr + 1) & 1)
63 ap->cbl = ATA_CBL_PATA80; 62 ap->cbl = ATA_CBL_PATA80;
64 else 63 else
65 ap->cbl = ATA_CBL_PATA40; 64 ap->cbl = ATA_CBL_PATA40;
66 65
67 case 1: /* Legacy SATA port */ 66 case 1: /* Legacy SATA port */
68 ap->cbl = ATA_CBL_SATA; 67 ap->cbl = ATA_CBL_SATA;
69 break; 68 break;
70 } 69 }
71 return ata_std_prereset(ap); 70 return ata_std_prereset(ap);
72} 71}
@@ -81,7 +80,8 @@ static int marvell_pre_reset(struct ata_port *ap)
81 80
82static void marvell_error_handler(struct ata_port *ap) 81static void marvell_error_handler(struct ata_port *ap)
83{ 82{
84 return ata_bmdma_drive_eh(ap, marvell_pre_reset, ata_std_softreset, NULL, ata_std_postreset); 83 return ata_bmdma_drive_eh(ap, marvell_pre_reset, ata_std_softreset,
84 NULL, ata_std_postreset);
85} 85}
86 86
87/* No PIO or DMA methods needed for this device */ 87/* No PIO or DMA methods needed for this device */
@@ -130,7 +130,6 @@ static const struct ata_port_operations marvell_ops = {
130 .data_xfer = ata_pio_data_xfer, 130 .data_xfer = ata_pio_data_xfer,
131 131
132 /* Timeout handling */ 132 /* Timeout handling */
133 .eng_timeout = ata_eng_timeout,
134 .irq_handler = ata_interrupt, 133 .irq_handler = ata_interrupt,
135 .irq_clear = ata_bmdma_irq_clear, 134 .irq_clear = ata_bmdma_irq_clear,
136 135
@@ -159,7 +158,7 @@ static int marvell_init_one (struct pci_dev *pdev, const struct pci_device_id *i
159{ 158{
160 static struct ata_port_info info = { 159 static struct ata_port_info info = {
161 .sht = &marvell_sht, 160 .sht = &marvell_sht,
162 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 161 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
163 162
164 .pio_mask = 0x1f, 163 .pio_mask = 0x1f,
165 .mwdma_mask = 0x07, 164 .mwdma_mask = 0x07,
@@ -170,7 +169,7 @@ static int marvell_init_one (struct pci_dev *pdev, const struct pci_device_id *i
170 static struct ata_port_info info_sata = { 169 static struct ata_port_info info_sata = {
171 .sht = &marvell_sht, 170 .sht = &marvell_sht,
172 /* Slave possible as its magically mapped not real */ 171 /* Slave possible as its magically mapped not real */
173 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 172 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
174 173
175 .pio_mask = 0x1f, 174 .pio_mask = 0x1f,
176 .mwdma_mask = 0x07, 175 .mwdma_mask = 0x07,
@@ -180,10 +179,10 @@ static int marvell_init_one (struct pci_dev *pdev, const struct pci_device_id *i
180 }; 179 };
181 struct ata_port_info *port_info[2] = { &info, &info_sata }; 180 struct ata_port_info *port_info[2] = { &info, &info_sata };
182 int n_port = 2; 181 int n_port = 2;
183 182
184 if (pdev->device == 0x6101) 183 if (pdev->device == 0x6101)
185 n_port = 1; 184 n_port = 1;
186 185
187 return ata_pci_init_one(pdev, port_info, n_port); 186 return ata_pci_init_one(pdev, port_info, n_port);
188} 187}
189 188