aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/ata/pata_jmicron.c34
1 files changed, 28 insertions, 6 deletions
diff --git a/drivers/ata/pata_jmicron.c b/drivers/ata/pata_jmicron.c
index 0210b10d49cd..c9f0a543b27b 100644
--- a/drivers/ata/pata_jmicron.c
+++ b/drivers/ata/pata_jmicron.c
@@ -19,7 +19,7 @@
19#include <linux/ata.h> 19#include <linux/ata.h>
20 20
21#define DRV_NAME "pata_jmicron" 21#define DRV_NAME "pata_jmicron"
22#define DRV_VERSION "0.1.2" 22#define DRV_VERSION "0.1.4"
23 23
24typedef enum { 24typedef enum {
25 PORT_PATA0 = 0, 25 PORT_PATA0 = 0,
@@ -213,12 +213,11 @@ static int jmicron_init_one (struct pci_dev *pdev, const struct pci_device_id *i
213 213
214 /* FIXME: We may want a way to override this in future */ 214 /* FIXME: We may want a way to override this in future */
215 pci_write_config_byte(pdev, 0x41, 0xa1); 215 pci_write_config_byte(pdev, 0x41, 0xa1);
216 }
217
218 /* PATA controller is fn 1, AHCI is fn 0 */
219 if (PCI_FUNC(pdev->devfn) != 1)
220 return -ENODEV;
221 216
217 /* PATA controller is fn 1, AHCI is fn 0 */
218 if (PCI_FUNC(pdev->devfn) != 1)
219 return -ENODEV;
220 }
222 if ( id->driver_data == 365 || id->driver_data == 366) { 221 if ( id->driver_data == 365 || id->driver_data == 366) {
223 /* The 365/66 have two PATA channels, redirect the second */ 222 /* The 365/66 have two PATA channels, redirect the second */
224 pci_read_config_dword(pdev, 0x80, &reg); 223 pci_read_config_dword(pdev, 0x80, &reg);
@@ -229,6 +228,27 @@ static int jmicron_init_one (struct pci_dev *pdev, const struct pci_device_id *i
229 return ata_pci_init_one(pdev, port_info, 2); 228 return ata_pci_init_one(pdev, port_info, 2);
230} 229}
231 230
231static int jmicron_reinit_one(struct pci_dev *pdev)
232{
233 u32 reg;
234
235 switch(pdev->device) {
236 case PCI_DEVICE_ID_JMICRON_JMB368:
237 break;
238 case PCI_DEVICE_ID_JMICRON_JMB365:
239 case PCI_DEVICE_ID_JMICRON_JMB366:
240 /* Restore mapping or disks swap and boy does it get ugly */
241 pci_read_config_dword(pdev, 0x80, &reg);
242 reg |= (1 << 24); /* IDE1 to PATA IDE secondary */
243 pci_write_config_dword(pdev, 0x80, reg);
244 /* Fall through */
245 default:
246 /* Make sure AHCI is turned back on */
247 pci_write_config_byte(pdev, 0x41, 0xa1);
248 }
249 return ata_pci_device_resume(pdev);
250}
251
232static const struct pci_device_id jmicron_pci_tbl[] = { 252static const struct pci_device_id jmicron_pci_tbl[] = {
233 { PCI_VDEVICE(JMICRON, PCI_DEVICE_ID_JMICRON_JMB361), 361}, 253 { PCI_VDEVICE(JMICRON, PCI_DEVICE_ID_JMICRON_JMB361), 361},
234 { PCI_VDEVICE(JMICRON, PCI_DEVICE_ID_JMICRON_JMB363), 363}, 254 { PCI_VDEVICE(JMICRON, PCI_DEVICE_ID_JMICRON_JMB363), 363},
@@ -244,6 +264,8 @@ static struct pci_driver jmicron_pci_driver = {
244 .id_table = jmicron_pci_tbl, 264 .id_table = jmicron_pci_tbl,
245 .probe = jmicron_init_one, 265 .probe = jmicron_init_one,
246 .remove = ata_pci_remove_one, 266 .remove = ata_pci_remove_one,
267 .suspend = ata_pci_device_suspend,
268 .resume = jmicron_reinit_one,
247}; 269};
248 270
249static int __init jmicron_init(void) 271static int __init jmicron_init(void)