Linux Audio

Check our new training course

Loading...
v6.8
  1// SPDX-License-Identifier: GPL-2.0-only
  2/*
  3 *    pata_netcell.c - Netcell PATA driver
  4 *
  5 *	(c) 2006 Red Hat
  6 */
  7
  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>
 17
 18#define DRV_NAME	"pata_netcell"
 19#define DRV_VERSION	"0.1.7"
 20
 21/* No PIO or DMA methods needed for this device */
 22
 23static unsigned int netcell_read_id(struct ata_device *adev,
 24				    struct ata_taskfile *tf, __le16 *id)
 25{
 26	unsigned int err_mask = ata_do_dev_read_id(adev, tf, id);
 27
 28	/* Firmware forgets to mark words 85-87 valid */
 29	if (err_mask == 0)
 30		id[ATA_ID_CSF_DEFAULT] |= cpu_to_le16(0x4000);
 31	return err_mask;
 32}
 33
 34static const struct scsi_host_template netcell_sht = {
 35	ATA_BMDMA_SHT(DRV_NAME),
 36};
 37
 38static struct ata_port_operations netcell_ops = {
 39	.inherits	= &ata_bmdma_port_ops,
 40	.cable_detect	= ata_cable_80wire,
 41	.read_id	= netcell_read_id,
 42};
 43
 44
 45/**
 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
 49 *
 50 *	Called from kernel PCI layer.
 51 *
 52 *	LOCKING:
 53 *	Inherited from PCI layer (may sleep).
 54 *
 55 *	RETURNS:
 56 *	Zero on success, or -ERRNO value.
 57 */
 58
 59static int netcell_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
 60{
 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 */
 65		.pio_mask	= ATA_PIO4,
 66		.mwdma_mask	= ATA_MWDMA2,
 67		.udma_mask 	= ATA_UDMA5, /* UDMA 133 */
 68		.port_ops	= &netcell_ops,
 69	};
 70	const struct ata_port_info *port_info[] = { &info, NULL };
 71	int rc;
 72
 73	ata_print_version_once(&pdev->dev, DRV_VERSION);
 74
 75	rc = pcim_enable_device(pdev);
 76	if (rc)
 77		return rc;
 78
 79	/* Any chip specific setup/optimisation/messages here */
 80	ata_pci_bmdma_clear_simplex(pdev);
 81
 82	/* And let the library code do the work */
 83	return ata_pci_bmdma_init_one(pdev, port_info, &netcell_sht, NULL, 0);
 84}
 85
 86static const struct pci_device_id netcell_pci_tbl[] = {
 87	{ PCI_VDEVICE(NETCELL, PCI_DEVICE_ID_REVOLUTION), },
 88
 89	{ }	/* terminate list */
 90};
 91
 92static struct pci_driver netcell_pci_driver = {
 93	.name			= DRV_NAME,
 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,
100#endif
101};
102
103module_pci_driver(netcell_pci_driver);
 
 
 
 
 
 
 
 
 
 
 
104
105MODULE_AUTHOR("Alan Cox");
106MODULE_DESCRIPTION("SCSI low-level driver for Netcell PATA RAID");
107MODULE_LICENSE("GPL");
108MODULE_DEVICE_TABLE(pci, netcell_pci_tbl);
109MODULE_VERSION(DRV_VERSION);
v3.1
 
  1/*
  2 *    pata_netcell.c - Netcell PATA driver
  3 *
  4 *	(c) 2006 Red Hat
  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"
 19#define DRV_VERSION	"0.1.7"
 20
 21/* No PIO or DMA methods needed for this device */
 22
 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)
 29		id[ATA_ID_CSF_DEFAULT] |= 0x4000;
 30	return err_mask;
 31}
 32
 33static struct scsi_host_template netcell_sht = {
 34	ATA_BMDMA_SHT(DRV_NAME),
 35};
 36
 37static struct ata_port_operations netcell_ops = {
 38	.inherits	= &ata_bmdma_port_ops,
 39	.cable_detect	= ata_cable_80wire,
 40	.read_id	= netcell_read_id,
 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 const struct ata_port_info info = {
 61		.flags		= ATA_FLAG_SLAVE_POSS,
 62		/* Actually we don't really care about these as the
 63		   firmware deals with it */
 64		.pio_mask	= ATA_PIO4,
 65		.mwdma_mask	= ATA_MWDMA2,
 66		.udma_mask 	= ATA_UDMA5, /* UDMA 133 */
 67		.port_ops	= &netcell_ops,
 68	};
 69	const struct ata_port_info *port_info[] = { &info, NULL };
 70	int rc;
 71
 72	ata_print_version_once(&pdev->dev, DRV_VERSION);
 73
 74	rc = pcim_enable_device(pdev);
 75	if (rc)
 76		return rc;
 77
 78	/* Any chip specific setup/optimisation/messages here */
 79	ata_pci_bmdma_clear_simplex(pdev);
 80
 81	/* And let the library code do the work */
 82	return ata_pci_bmdma_init_one(pdev, port_info, &netcell_sht, NULL, 0);
 83}
 84
 85static const struct pci_device_id netcell_pci_tbl[] = {
 86	{ PCI_VDEVICE(NETCELL, PCI_DEVICE_ID_REVOLUTION), },
 87
 88	{ }	/* terminate list */
 89};
 90
 91static struct pci_driver netcell_pci_driver = {
 92	.name			= DRV_NAME,
 93	.id_table		= netcell_pci_tbl,
 94	.probe			= netcell_init_one,
 95	.remove			= ata_pci_remove_one,
 96#ifdef CONFIG_PM
 97	.suspend		= ata_pci_device_suspend,
 98	.resume			= ata_pci_device_resume,
 99#endif
100};
101
102static int __init netcell_init(void)
103{
104	return pci_register_driver(&netcell_pci_driver);
105}
106
107static void __exit netcell_exit(void)
108{
109	pci_unregister_driver(&netcell_pci_driver);
110}
111
112module_init(netcell_init);
113module_exit(netcell_exit);
114
115MODULE_AUTHOR("Alan Cox");
116MODULE_DESCRIPTION("SCSI low-level driver for Netcell PATA RAID");
117MODULE_LICENSE("GPL");
118MODULE_DEVICE_TABLE(pci, netcell_pci_tbl);
119MODULE_VERSION(DRV_VERSION);
120