diff options
Diffstat (limited to 'drivers/ata/pata_marvell.c')
-rw-r--r-- | drivers/ata/pata_marvell.c | 51 |
1 files changed, 38 insertions, 13 deletions
diff --git a/drivers/ata/pata_marvell.c b/drivers/ata/pata_marvell.c index 24a011b25024..0d87eec84966 100644 --- a/drivers/ata/pata_marvell.c +++ b/drivers/ata/pata_marvell.c | |||
@@ -20,29 +20,30 @@ | |||
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.1.4" | 23 | #define DRV_VERSION "0.1.6" |
24 | 24 | ||
25 | /** | 25 | /** |
26 | * marvell_pre_reset - check for 40/80 pin | 26 | * marvell_pata_active - check if PATA is active |
27 | * @link: link | 27 | * @pdev: PCI device |
28 | * @deadline: deadline jiffies for the operation | ||
29 | * | 28 | * |
30 | * Perform the PATA port setup we need. | 29 | * Returns 1 if the PATA port may be active. We know how to check this |
30 | * for the 6145 but not the other devices | ||
31 | */ | 31 | */ |
32 | 32 | ||
33 | static int marvell_pre_reset(struct ata_link *link, unsigned long deadline) | 33 | static int marvell_pata_active(struct pci_dev *pdev) |
34 | { | 34 | { |
35 | struct ata_port *ap = link->ap; | 35 | int i; |
36 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | ||
37 | u32 devices; | 36 | u32 devices; |
38 | void __iomem *barp; | 37 | void __iomem *barp; |
39 | int i; | ||
40 | 38 | ||
41 | /* Check if our port is enabled */ | 39 | /* We don't yet know how to do this for other devices */ |
40 | if (pdev->device != 0x6145) | ||
41 | return 1; | ||
42 | 42 | ||
43 | barp = pci_iomap(pdev, 5, 0x10); | 43 | barp = pci_iomap(pdev, 5, 0x10); |
44 | if (barp == NULL) | 44 | if (barp == NULL) |
45 | return -ENOMEM; | 45 | return -ENOMEM; |
46 | |||
46 | printk("BAR5:"); | 47 | printk("BAR5:"); |
47 | for(i = 0; i <= 0x0F; i++) | 48 | for(i = 0; i <= 0x0F; i++) |
48 | printk("%02X:%02X ", i, ioread8(barp + i)); | 49 | printk("%02X:%02X ", i, ioread8(barp + i)); |
@@ -51,9 +52,27 @@ static int marvell_pre_reset(struct ata_link *link, unsigned long deadline) | |||
51 | devices = ioread32(barp + 0x0C); | 52 | devices = ioread32(barp + 0x0C); |
52 | pci_iounmap(pdev, barp); | 53 | pci_iounmap(pdev, barp); |
53 | 54 | ||
54 | if ((pdev->device == 0x6145) && (ap->port_no == 0) && | 55 | if (devices & 0x10) |
55 | (!(devices & 0x10))) /* PATA enable ? */ | 56 | return 1; |
56 | return -ENOENT; | 57 | return 0; |
58 | } | ||
59 | |||
60 | /** | ||
61 | * marvell_pre_reset - check for 40/80 pin | ||
62 | * @link: link | ||
63 | * @deadline: deadline jiffies for the operation | ||
64 | * | ||
65 | * Perform the PATA port setup we need. | ||
66 | */ | ||
67 | |||
68 | static int marvell_pre_reset(struct ata_link *link, unsigned long deadline) | ||
69 | { | ||
70 | struct ata_port *ap = link->ap; | ||
71 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | ||
72 | |||
73 | if (pdev->device == 0x6145 && ap->port_no == 0 && | ||
74 | !marvell_pata_active(pdev)) /* PATA enable ? */ | ||
75 | return -ENOENT; | ||
57 | 76 | ||
58 | return ata_sff_prereset(link, deadline); | 77 | return ata_sff_prereset(link, deadline); |
59 | } | 78 | } |
@@ -128,6 +147,12 @@ static int marvell_init_one (struct pci_dev *pdev, const struct pci_device_id *i | |||
128 | if (pdev->device == 0x6101) | 147 | if (pdev->device == 0x6101) |
129 | ppi[1] = &ata_dummy_port_info; | 148 | ppi[1] = &ata_dummy_port_info; |
130 | 149 | ||
150 | #if defined(CONFIG_AHCI) || defined(CONFIG_AHCI_MODULE) | ||
151 | if (!marvell_pata_active(pdev)) { | ||
152 | printk(KERN_INFO DRV_NAME ": PATA port not active, deferring to AHCI driver.\n"); | ||
153 | return -ENODEV; | ||
154 | } | ||
155 | #endif | ||
131 | return ata_pci_sff_init_one(pdev, ppi, &marvell_sht, NULL); | 156 | return ata_pci_sff_init_one(pdev, ppi, &marvell_sht, NULL); |
132 | } | 157 | } |
133 | 158 | ||