pata_netcell.c 2.6 KB

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