pata_netcell.c 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /*
  2. * pata_netcell.c - Netcell PATA driver
  3. *
  4. * (c) 2006 Red Hat <alan@redhat.com>
  5. */
  6. #include <linux/kernel.h>
  7. #include <linux/module.h>
  8. #include <linux/pci.h>
  9. #include <linux/init.h>
  10. #include <linux/blkdev.h>
  11. #include <linux/delay.h>
  12. #include <linux/device.h>
  13. #include <scsi/scsi_host.h>
  14. #include <linux/libata.h>
  15. #include <linux/ata.h>
  16. #define DRV_NAME "pata_netcell"
  17. #define DRV_VERSION "0.1.7"
  18. /* No PIO or DMA methods needed for this device */
  19. static struct scsi_host_template netcell_sht = {
  20. ATA_BMDMA_SHT(DRV_NAME),
  21. };
  22. static struct ata_port_operations netcell_ops = {
  23. .inherits = &ata_bmdma_port_ops,
  24. .cable_detect = ata_cable_80wire,
  25. };
  26. /**
  27. * netcell_init_one - Register Netcell ATA PCI device with kernel services
  28. * @pdev: PCI device to register
  29. * @ent: Entry in netcell_pci_tbl matching with @pdev
  30. *
  31. * Called from kernel PCI layer.
  32. *
  33. * LOCKING:
  34. * Inherited from PCI layer (may sleep).
  35. *
  36. * RETURNS:
  37. * Zero on success, or -ERRNO value.
  38. */
  39. static int netcell_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
  40. {
  41. static int printed_version;
  42. static const struct ata_port_info info = {
  43. .flags = ATA_FLAG_SLAVE_POSS,
  44. /* Actually we don't really care about these as the
  45. firmware deals with it */
  46. .pio_mask = 0x1f, /* pio0-4 */
  47. .mwdma_mask = 0x07, /* mwdma0-2 */
  48. .udma_mask = ATA_UDMA5, /* UDMA 133 */
  49. .port_ops = &netcell_ops,
  50. };
  51. const struct ata_port_info *port_info[] = { &info, NULL };
  52. int rc;
  53. if (!printed_version++)
  54. dev_printk(KERN_DEBUG, &pdev->dev,
  55. "version " DRV_VERSION "\n");
  56. rc = pcim_enable_device(pdev);
  57. if (rc)
  58. return rc;
  59. /* Any chip specific setup/optimisation/messages here */
  60. ata_pci_bmdma_clear_simplex(pdev);
  61. /* And let the library code do the work */
  62. return ata_pci_sff_init_one(pdev, port_info, &netcell_sht, NULL);
  63. }
  64. static const struct pci_device_id netcell_pci_tbl[] = {
  65. { PCI_VDEVICE(NETCELL, PCI_DEVICE_ID_REVOLUTION), },
  66. { } /* terminate list */
  67. };
  68. static struct pci_driver netcell_pci_driver = {
  69. .name = DRV_NAME,
  70. .id_table = netcell_pci_tbl,
  71. .probe = netcell_init_one,
  72. .remove = ata_pci_remove_one,
  73. #ifdef CONFIG_PM
  74. .suspend = ata_pci_device_suspend,
  75. .resume = ata_pci_device_resume,
  76. #endif
  77. };
  78. static int __init netcell_init(void)
  79. {
  80. return pci_register_driver(&netcell_pci_driver);
  81. }
  82. static void __exit netcell_exit(void)
  83. {
  84. pci_unregister_driver(&netcell_pci_driver);
  85. }
  86. module_init(netcell_init);
  87. module_exit(netcell_exit);
  88. MODULE_AUTHOR("Alan Cox");
  89. MODULE_DESCRIPTION("SCSI low-level driver for Netcell PATA RAID");
  90. MODULE_LICENSE("GPL");
  91. MODULE_DEVICE_TABLE(pci, netcell_pci_tbl);
  92. MODULE_VERSION(DRV_VERSION);