1669a5db4SJeff Garzik /* 2669a5db4SJeff Garzik * pata_netcell.c - Netcell PATA driver 3669a5db4SJeff Garzik * 4669a5db4SJeff Garzik * (c) 2006 Red Hat <alan@redhat.com> 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 = { 51669a5db4SJeff Garzik .sht = &netcell_sht, 521d2808fdSJeff Garzik .flags = ATA_FLAG_SLAVE_POSS, 53669a5db4SJeff Garzik /* Actually we don't really care about these as the 54669a5db4SJeff Garzik firmware deals with it */ 55669a5db4SJeff Garzik .pio_mask = 0x1f, /* pio0-4 */ 56669a5db4SJeff Garzik .mwdma_mask = 0x07, /* mwdma0-2 */ 57bf6263a8SJeff Garzik .udma_mask = ATA_UDMA5, /* UDMA 133 */ 58669a5db4SJeff Garzik .port_ops = &netcell_ops, 59669a5db4SJeff Garzik }; 601626aeb8STejun Heo const struct ata_port_info *port_info[] = { &info, NULL }; 61f08048e9STejun Heo int rc; 62669a5db4SJeff Garzik 63669a5db4SJeff Garzik if (!printed_version++) 64669a5db4SJeff Garzik dev_printk(KERN_DEBUG, &pdev->dev, 65669a5db4SJeff Garzik "version " DRV_VERSION "\n"); 66669a5db4SJeff Garzik 67f08048e9STejun Heo rc = pcim_enable_device(pdev); 68f08048e9STejun Heo if (rc) 69f08048e9STejun Heo return rc; 70f08048e9STejun Heo 71669a5db4SJeff Garzik /* Any chip specific setup/optimisation/messages here */ 72669a5db4SJeff Garzik ata_pci_clear_simplex(pdev); 73669a5db4SJeff Garzik 74669a5db4SJeff Garzik /* And let the library code do the work */ 751626aeb8STejun Heo return ata_pci_init_one(pdev, port_info); 76669a5db4SJeff Garzik } 77669a5db4SJeff Garzik 78669a5db4SJeff Garzik static const struct pci_device_id netcell_pci_tbl[] = { 792d2744fcSJeff Garzik { PCI_VDEVICE(NETCELL, PCI_DEVICE_ID_REVOLUTION), }, 802d2744fcSJeff Garzik 81669a5db4SJeff Garzik { } /* terminate list */ 82669a5db4SJeff Garzik }; 83669a5db4SJeff Garzik 84669a5db4SJeff Garzik static struct pci_driver netcell_pci_driver = { 85669a5db4SJeff Garzik .name = DRV_NAME, 86669a5db4SJeff Garzik .id_table = netcell_pci_tbl, 87669a5db4SJeff Garzik .probe = netcell_init_one, 88669a5db4SJeff Garzik .remove = ata_pci_remove_one, 89438ac6d5STejun Heo #ifdef CONFIG_PM 9030ced0f0SAlan .suspend = ata_pci_device_suspend, 9130ced0f0SAlan .resume = ata_pci_device_resume, 92438ac6d5STejun Heo #endif 93669a5db4SJeff Garzik }; 94669a5db4SJeff Garzik 95669a5db4SJeff Garzik static int __init netcell_init(void) 96669a5db4SJeff Garzik { 97669a5db4SJeff Garzik return pci_register_driver(&netcell_pci_driver); 98669a5db4SJeff Garzik } 99669a5db4SJeff Garzik 100669a5db4SJeff Garzik static void __exit netcell_exit(void) 101669a5db4SJeff Garzik { 102669a5db4SJeff Garzik pci_unregister_driver(&netcell_pci_driver); 103669a5db4SJeff Garzik } 104669a5db4SJeff Garzik 105669a5db4SJeff Garzik module_init(netcell_init); 106669a5db4SJeff Garzik module_exit(netcell_exit); 107669a5db4SJeff Garzik 108669a5db4SJeff Garzik MODULE_AUTHOR("Alan Cox"); 109669a5db4SJeff Garzik MODULE_DESCRIPTION("SCSI low-level driver for Netcell PATA RAID"); 110669a5db4SJeff Garzik MODULE_LICENSE("GPL"); 111669a5db4SJeff Garzik MODULE_DEVICE_TABLE(pci, netcell_pci_tbl); 112669a5db4SJeff Garzik MODULE_VERSION(DRV_VERSION); 113669a5db4SJeff Garzik 114