1 // SPDX-License-Identifier: GPL-2.0-only
3 * pata_netcell.c - Netcell PATA driver
8 #include <linux/kernel.h>
9 #include <linux/module.h>
10 #include <linux/pci.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>
18 #define DRV_NAME "pata_netcell"
19 #define DRV_VERSION "0.1.7"
21 /* No PIO or DMA methods needed for this device */
23 static unsigned int netcell_read_id(struct ata_device
*adev
,
24 struct ata_taskfile
*tf
, __le16
*id
)
26 unsigned int err_mask
= ata_do_dev_read_id(adev
, tf
, id
);
28 /* Firmware forgets to mark words 85-87 valid */
30 id
[ATA_ID_CSF_DEFAULT
] |= cpu_to_le16(0x4000);
34 static const struct scsi_host_template netcell_sht
= {
35 ATA_BMDMA_SHT(DRV_NAME
),
38 static struct ata_port_operations netcell_ops
= {
39 .inherits
= &ata_bmdma_port_ops
,
40 .cable_detect
= ata_cable_80wire
,
41 .read_id
= netcell_read_id
,
46 * netcell_init_one - Register Netcell ATA PCI device with kernel services
47 * @pdev: PCI device to register
48 * @ent: Entry in netcell_pci_tbl matching with @pdev
50 * Called from kernel PCI layer.
53 * Inherited from PCI layer (may sleep).
56 * Zero on success, or -ERRNO value.
59 static int netcell_init_one (struct pci_dev
*pdev
, const struct pci_device_id
*ent
)
61 static const struct ata_port_info info
= {
62 .flags
= ATA_FLAG_SLAVE_POSS
,
63 /* Actually we don't really care about these as the
64 firmware deals with it */
66 .mwdma_mask
= ATA_MWDMA2
,
67 .udma_mask
= ATA_UDMA5
, /* UDMA 133 */
68 .port_ops
= &netcell_ops
,
70 const struct ata_port_info
*port_info
[] = { &info
, NULL
};
73 ata_print_version_once(&pdev
->dev
, DRV_VERSION
);
75 rc
= pcim_enable_device(pdev
);
79 /* Any chip specific setup/optimisation/messages here */
80 ata_pci_bmdma_clear_simplex(pdev
);
82 /* And let the library code do the work */
83 return ata_pci_bmdma_init_one(pdev
, port_info
, &netcell_sht
, NULL
, 0);
86 static const struct pci_device_id netcell_pci_tbl
[] = {
87 { PCI_VDEVICE(NETCELL
, PCI_DEVICE_ID_REVOLUTION
), },
89 { } /* terminate list */
92 static struct pci_driver netcell_pci_driver
= {
94 .id_table
= netcell_pci_tbl
,
95 .probe
= netcell_init_one
,
96 .remove
= ata_pci_remove_one
,
97 #ifdef CONFIG_PM_SLEEP
98 .suspend
= ata_pci_device_suspend
,
99 .resume
= ata_pci_device_resume
,
103 module_pci_driver(netcell_pci_driver
);
105 MODULE_AUTHOR("Alan Cox");
106 MODULE_DESCRIPTION("SCSI low-level driver for Netcell PATA RAID");
107 MODULE_LICENSE("GPL");
108 MODULE_DEVICE_TABLE(pci
, netcell_pci_tbl
);
109 MODULE_VERSION(DRV_VERSION
);