Commit | Line | Data |
---|---|---|
669a5db4 JG |
1 | /* |
2 | * pata_netcell.c - Netcell PATA driver | |
3 | * | |
ab771630 | 4 | * (c) 2006 Red Hat |
669a5db4 JG |
5 | */ |
6 | ||
7 | #include <linux/kernel.h> | |
8 | #include <linux/module.h> | |
9 | #include <linux/pci.h> | |
669a5db4 JG |
10 | #include <linux/blkdev.h> |
11 | #include <linux/delay.h> | |
12 | #include <linux/device.h> | |
13 | #include <scsi/scsi_host.h> | |
14 | #include <linux/libata.h> | |
15 | #include <linux/ata.h> | |
16 | ||
17 | #define DRV_NAME "pata_netcell" | |
3b4ba591 | 18 | #define DRV_VERSION "0.1.7" |
669a5db4 JG |
19 | |
20 | /* No PIO or DMA methods needed for this device */ | |
21 | ||
d3ae33ef AC |
22 | static unsigned int netcell_read_id(struct ata_device *adev, |
23 | struct ata_taskfile *tf, u16 *id) | |
24 | { | |
25 | unsigned int err_mask = ata_do_dev_read_id(adev, tf, id); | |
26 | /* Firmware forgets to mark words 85-87 valid */ | |
27 | if (err_mask == 0) | |
5284c6b9 | 28 | id[ATA_ID_CSF_DEFAULT] |= 0x4000; |
d3ae33ef AC |
29 | return err_mask; |
30 | } | |
31 | ||
669a5db4 | 32 | static struct scsi_host_template netcell_sht = { |
68d1d07b | 33 | ATA_BMDMA_SHT(DRV_NAME), |
669a5db4 JG |
34 | }; |
35 | ||
029cfd6b TH |
36 | static struct ata_port_operations netcell_ops = { |
37 | .inherits = &ata_bmdma_port_ops, | |
d3ae33ef AC |
38 | .cable_detect = ata_cable_80wire, |
39 | .read_id = netcell_read_id, | |
669a5db4 JG |
40 | }; |
41 | ||
42 | ||
43 | /** | |
44 | * netcell_init_one - Register Netcell ATA PCI device with kernel services | |
45 | * @pdev: PCI device to register | |
46 | * @ent: Entry in netcell_pci_tbl matching with @pdev | |
47 | * | |
48 | * Called from kernel PCI layer. | |
49 | * | |
50 | * LOCKING: | |
51 | * Inherited from PCI layer (may sleep). | |
52 | * | |
53 | * RETURNS: | |
54 | * Zero on success, or -ERRNO value. | |
55 | */ | |
56 | ||
57 | static int netcell_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |
58 | { | |
1626aeb8 | 59 | static const struct ata_port_info info = { |
1d2808fd | 60 | .flags = ATA_FLAG_SLAVE_POSS, |
669a5db4 JG |
61 | /* Actually we don't really care about these as the |
62 | firmware deals with it */ | |
14bdef98 EIB |
63 | .pio_mask = ATA_PIO4, |
64 | .mwdma_mask = ATA_MWDMA2, | |
bf6263a8 | 65 | .udma_mask = ATA_UDMA5, /* UDMA 133 */ |
669a5db4 JG |
66 | .port_ops = &netcell_ops, |
67 | }; | |
1626aeb8 | 68 | const struct ata_port_info *port_info[] = { &info, NULL }; |
f08048e9 | 69 | int rc; |
669a5db4 | 70 | |
06296a1e | 71 | ata_print_version_once(&pdev->dev, DRV_VERSION); |
669a5db4 | 72 | |
f08048e9 TH |
73 | rc = pcim_enable_device(pdev); |
74 | if (rc) | |
75 | return rc; | |
76 | ||
669a5db4 | 77 | /* Any chip specific setup/optimisation/messages here */ |
9363c382 | 78 | ata_pci_bmdma_clear_simplex(pdev); |
85cd7251 | 79 | |
669a5db4 | 80 | /* And let the library code do the work */ |
1c5afdf7 | 81 | return ata_pci_bmdma_init_one(pdev, port_info, &netcell_sht, NULL, 0); |
669a5db4 JG |
82 | } |
83 | ||
84 | static const struct pci_device_id netcell_pci_tbl[] = { | |
2d2744fc JG |
85 | { PCI_VDEVICE(NETCELL, PCI_DEVICE_ID_REVOLUTION), }, |
86 | ||
669a5db4 JG |
87 | { } /* terminate list */ |
88 | }; | |
89 | ||
90 | static struct pci_driver netcell_pci_driver = { | |
91 | .name = DRV_NAME, | |
92 | .id_table = netcell_pci_tbl, | |
93 | .probe = netcell_init_one, | |
94 | .remove = ata_pci_remove_one, | |
58eb8cd5 | 95 | #ifdef CONFIG_PM_SLEEP |
30ced0f0 A |
96 | .suspend = ata_pci_device_suspend, |
97 | .resume = ata_pci_device_resume, | |
438ac6d5 | 98 | #endif |
669a5db4 JG |
99 | }; |
100 | ||
2fc75da0 | 101 | module_pci_driver(netcell_pci_driver); |
669a5db4 JG |
102 | |
103 | MODULE_AUTHOR("Alan Cox"); | |
104 | MODULE_DESCRIPTION("SCSI low-level driver for Netcell PATA RAID"); | |
105 | MODULE_LICENSE("GPL"); | |
106 | MODULE_DEVICE_TABLE(pci, netcell_pci_tbl); | |
107 | MODULE_VERSION(DRV_VERSION); |