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