1669a5db4SJeff Garzik /* 2669a5db4SJeff Garzik * pata_netcell.c - Netcell PATA driver 3669a5db4SJeff Garzik * 4ab771630SAlan Cox * (c) 2006 Red Hat 5669a5db4SJeff Garzik */ 6669a5db4SJeff Garzik 7669a5db4SJeff Garzik #include <linux/kernel.h> 8669a5db4SJeff Garzik #include <linux/module.h> 9669a5db4SJeff Garzik #include <linux/pci.h> 10669a5db4SJeff Garzik #include <linux/init.h> 11669a5db4SJeff Garzik #include <linux/blkdev.h> 12669a5db4SJeff Garzik #include <linux/delay.h> 13669a5db4SJeff Garzik #include <linux/device.h> 14669a5db4SJeff Garzik #include <scsi/scsi_host.h> 15669a5db4SJeff Garzik #include <linux/libata.h> 16669a5db4SJeff Garzik #include <linux/ata.h> 17669a5db4SJeff Garzik 18669a5db4SJeff Garzik #define DRV_NAME "pata_netcell" 193b4ba591SAlan Cox #define DRV_VERSION "0.1.7" 20669a5db4SJeff Garzik 21669a5db4SJeff Garzik /* No PIO or DMA methods needed for this device */ 22669a5db4SJeff Garzik 23669a5db4SJeff Garzik static struct scsi_host_template netcell_sht = { 2468d1d07bSTejun Heo ATA_BMDMA_SHT(DRV_NAME), 25669a5db4SJeff Garzik }; 26669a5db4SJeff Garzik 27029cfd6bSTejun Heo static struct ata_port_operations netcell_ops = { 28029cfd6bSTejun Heo .inherits = &ata_bmdma_port_ops, 293b4ba591SAlan Cox .cable_detect = ata_cable_80wire, 30669a5db4SJeff Garzik }; 31669a5db4SJeff Garzik 32669a5db4SJeff Garzik 33669a5db4SJeff Garzik /** 34669a5db4SJeff Garzik * netcell_init_one - Register Netcell ATA PCI device with kernel services 35669a5db4SJeff Garzik * @pdev: PCI device to register 36669a5db4SJeff Garzik * @ent: Entry in netcell_pci_tbl matching with @pdev 37669a5db4SJeff Garzik * 38669a5db4SJeff Garzik * Called from kernel PCI layer. 39669a5db4SJeff Garzik * 40669a5db4SJeff Garzik * LOCKING: 41669a5db4SJeff Garzik * Inherited from PCI layer (may sleep). 42669a5db4SJeff Garzik * 43669a5db4SJeff Garzik * RETURNS: 44669a5db4SJeff Garzik * Zero on success, or -ERRNO value. 45669a5db4SJeff Garzik */ 46669a5db4SJeff Garzik 47669a5db4SJeff Garzik static int netcell_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) 48669a5db4SJeff Garzik { 49669a5db4SJeff Garzik static int printed_version; 501626aeb8STejun Heo static const struct ata_port_info info = { 511d2808fdSJeff Garzik .flags = ATA_FLAG_SLAVE_POSS, 52669a5db4SJeff Garzik /* Actually we don't really care about these as the 53669a5db4SJeff Garzik firmware deals with it */ 54669a5db4SJeff Garzik .pio_mask = 0x1f, /* pio0-4 */ 55669a5db4SJeff Garzik .mwdma_mask = 0x07, /* mwdma0-2 */ 56bf6263a8SJeff Garzik .udma_mask = ATA_UDMA5, /* UDMA 133 */ 57669a5db4SJeff Garzik .port_ops = &netcell_ops, 58669a5db4SJeff Garzik }; 591626aeb8STejun Heo const struct ata_port_info *port_info[] = { &info, NULL }; 60f08048e9STejun Heo int rc; 61669a5db4SJeff Garzik 62669a5db4SJeff Garzik if (!printed_version++) 63669a5db4SJeff Garzik dev_printk(KERN_DEBUG, &pdev->dev, 64669a5db4SJeff Garzik "version " DRV_VERSION "\n"); 65669a5db4SJeff Garzik 66f08048e9STejun Heo rc = pcim_enable_device(pdev); 67f08048e9STejun Heo if (rc) 68f08048e9STejun Heo return rc; 69f08048e9STejun Heo 70669a5db4SJeff Garzik /* Any chip specific setup/optimisation/messages here */ 719363c382STejun Heo ata_pci_bmdma_clear_simplex(pdev); 72669a5db4SJeff Garzik 73669a5db4SJeff Garzik /* And let the library code do the work */ 749363c382STejun Heo return ata_pci_sff_init_one(pdev, port_info, &netcell_sht, NULL); 75669a5db4SJeff Garzik } 76669a5db4SJeff Garzik 77669a5db4SJeff Garzik static const struct pci_device_id netcell_pci_tbl[] = { 782d2744fcSJeff Garzik { PCI_VDEVICE(NETCELL, PCI_DEVICE_ID_REVOLUTION), }, 792d2744fcSJeff Garzik 80669a5db4SJeff Garzik { } /* terminate list */ 81669a5db4SJeff Garzik }; 82669a5db4SJeff Garzik 83669a5db4SJeff Garzik static struct pci_driver netcell_pci_driver = { 84669a5db4SJeff Garzik .name = DRV_NAME, 85669a5db4SJeff Garzik .id_table = netcell_pci_tbl, 86669a5db4SJeff Garzik .probe = netcell_init_one, 87669a5db4SJeff Garzik .remove = ata_pci_remove_one, 88438ac6d5STejun Heo #ifdef CONFIG_PM 8930ced0f0SAlan .suspend = ata_pci_device_suspend, 9030ced0f0SAlan .resume = ata_pci_device_resume, 91438ac6d5STejun Heo #endif 92669a5db4SJeff Garzik }; 93669a5db4SJeff Garzik 94669a5db4SJeff Garzik static int __init netcell_init(void) 95669a5db4SJeff Garzik { 96669a5db4SJeff Garzik return pci_register_driver(&netcell_pci_driver); 97669a5db4SJeff Garzik } 98669a5db4SJeff Garzik 99669a5db4SJeff Garzik static void __exit netcell_exit(void) 100669a5db4SJeff Garzik { 101669a5db4SJeff Garzik pci_unregister_driver(&netcell_pci_driver); 102669a5db4SJeff Garzik } 103669a5db4SJeff Garzik 104669a5db4SJeff Garzik module_init(netcell_init); 105669a5db4SJeff Garzik module_exit(netcell_exit); 106669a5db4SJeff Garzik 107669a5db4SJeff Garzik MODULE_AUTHOR("Alan Cox"); 108669a5db4SJeff Garzik MODULE_DESCRIPTION("SCSI low-level driver for Netcell PATA RAID"); 109669a5db4SJeff Garzik MODULE_LICENSE("GPL"); 110669a5db4SJeff Garzik MODULE_DEVICE_TABLE(pci, netcell_pci_tbl); 111669a5db4SJeff Garzik MODULE_VERSION(DRV_VERSION); 112669a5db4SJeff Garzik 113