phison.c 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /*
  2. * Copyright (C) 2006 Red Hat <evan_ko@phison.com>
  3. *
  4. * May be copied or modified under the terms of the GNU General Public License
  5. *
  6. * [Modify History]
  7. * #0001, Evan, 2008.10.22, V0.00, New release.
  8. * #0002, Evan, 2008.11.01, V0.90, Test Work In Ubuntu Linux 8.04.
  9. * #0003, Evan, 2008.01.08, V0.91, Change Name "PCIE-SSD" to "E-BOX".
  10. */
  11. #include <linux/kernel.h>
  12. #include <linux/module.h>
  13. #include <linux/pci.h>
  14. #include <linux/init.h>
  15. #include <linux/blkdev.h>
  16. #include <linux/delay.h>
  17. #include <linux/device.h>
  18. #include <scsi/scsi_host.h>
  19. #include <linux/libata.h>
  20. #include <linux/ata.h>
  21. #define PHISON_DEBUG
  22. #define DRV_NAME "phison_e-box" /* #0003 */
  23. #define DRV_VERSION "0.91" /* #0003 */
  24. #define PCI_VENDOR_ID_PHISON 0x1987
  25. #define PCI_DEVICE_ID_PS5000 0x5000
  26. static int phison_pre_reset(struct ata_link *link, unsigned long deadline)
  27. {
  28. int ret;
  29. struct ata_port *ap = link->ap;
  30. ap->cbl = ATA_CBL_NONE;
  31. ret = ata_std_prereset(link, deadline);
  32. dev_dbg(ap->dev, "phison_pre_reset(), ret = %x\n", ret);
  33. return ret;
  34. }
  35. static struct scsi_host_template phison_sht = {
  36. ATA_BMDMA_SHT(DRV_NAME),
  37. };
  38. static struct ata_port_operations phison_ops = {
  39. .inherits = &ata_bmdma_port_ops,
  40. .prereset = phison_pre_reset,
  41. };
  42. static int phison_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
  43. {
  44. int ret;
  45. struct ata_port_info info = {
  46. .flags = ATA_FLAG_NO_ATAPI,
  47. .pio_mask = 0x1f,
  48. .mwdma_mask = 0x07,
  49. .udma_mask = ATA_UDMA5,
  50. .port_ops = &phison_ops,
  51. };
  52. const struct ata_port_info *ppi[] = { &info, NULL };
  53. ret = ata_pci_bmdma_init_one(pdev, ppi, &phison_sht, NULL, 0);
  54. dev_dbg(&pdev->dev, "phison_init_one(), ret = %x\n", ret);
  55. return ret;
  56. }
  57. static DEFINE_PCI_DEVICE_TABLE(phison_pci_tbl) = {
  58. { PCI_VENDOR_ID_PHISON, PCI_DEVICE_ID_PS5000, PCI_ANY_ID, PCI_ANY_ID,
  59. PCI_CLASS_STORAGE_IDE << 8, 0xffff00, 0 },
  60. { 0, },
  61. };
  62. MODULE_DEVICE_TABLE(pci, phison_pci_tbl);
  63. static struct pci_driver phison_pci_driver = {
  64. .name = DRV_NAME,
  65. .id_table = phison_pci_tbl,
  66. .probe = phison_init_one,
  67. .remove = ata_pci_remove_one,
  68. #ifdef CONFIG_PM /* haven't tested it. */
  69. .suspend = ata_pci_device_suspend,
  70. .resume = ata_pci_device_resume,
  71. #endif
  72. };
  73. static int __init phison_ide_init(void)
  74. {
  75. return pci_register_driver(&phison_pci_driver);
  76. }
  77. static void __exit phison_ide_exit(void)
  78. {
  79. pci_unregister_driver(&phison_pci_driver);
  80. }
  81. module_init(phison_ide_init);
  82. module_exit(phison_ide_exit);
  83. MODULE_AUTHOR("Evan Ko");
  84. MODULE_DESCRIPTION("PCIE driver module for PHISON PS5000 E-BOX");
  85. MODULE_LICENSE("GPL");
  86. MODULE_VERSION(DRV_VERSION);