Commit | Line | Data |
---|---|---|
cfc2f947 EK |
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 | ||
12 | #include <linux/kernel.h> | |
13 | #include <linux/module.h> | |
14 | #include <linux/pci.h> | |
cfc2f947 EK |
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 | ||
22 | #define PHISON_DEBUG | |
23 | ||
33210206 | 24 | #define DRV_NAME "phison_e-box" /* #0003 */ |
33f84a8f | 25 | #define DRV_VERSION "0.91" /* #0003 */ |
cfc2f947 | 26 | |
33210206 GKH |
27 | #define PCI_VENDOR_ID_PHISON 0x1987 |
28 | #define PCI_DEVICE_ID_PS5000 0x5000 | |
cfc2f947 | 29 | |
33210206 | 30 | static int phison_pre_reset(struct ata_link *link, unsigned long deadline) |
cfc2f947 EK |
31 | { |
32 | int ret; | |
33 | struct ata_port *ap = link->ap; | |
33210206 | 34 | |
cfc2f947 EK |
35 | ap->cbl = ATA_CBL_NONE; |
36 | ret = ata_std_prereset(link, deadline); | |
33210206 | 37 | dev_dbg(ap->dev, "phison_pre_reset(), ret = %x\n", ret); |
cfc2f947 EK |
38 | return ret; |
39 | } | |
40 | ||
33210206 | 41 | static struct scsi_host_template phison_sht = { |
76d86df9 | 42 | ATA_BMDMA_SHT(DRV_NAME), |
cfc2f947 EK |
43 | }; |
44 | ||
76d86df9 GKH |
45 | static struct ata_port_operations phison_ops = { |
46 | .inherits = &ata_bmdma_port_ops, | |
47 | .prereset = phison_pre_reset, | |
cfc2f947 EK |
48 | }; |
49 | ||
33210206 | 50 | static int phison_init_one(struct pci_dev *pdev, const struct pci_device_id *id) |
cfc2f947 | 51 | { |
76d86df9 | 52 | int ret; |
cfc2f947 | 53 | struct ata_port_info info = { |
76d86df9 | 54 | .flags = ATA_FLAG_NO_ATAPI, |
cfc2f947 EK |
55 | |
56 | .pio_mask = 0x1f, | |
57 | .mwdma_mask = 0x07, | |
33f84a8f | 58 | .udma_mask = ATA_UDMA5, |
cfc2f947 EK |
59 | |
60 | .port_ops = &phison_ops, | |
61 | }; | |
cfc2f947 EK |
62 | const struct ata_port_info *ppi[] = { &info, NULL }; |
63 | ||
cf10700b | 64 | ret = ata_pci_bmdma_init_one(pdev, ppi, &phison_sht, NULL, 0); |
cfc2f947 | 65 | |
33210206 | 66 | dev_dbg(&pdev->dev, "phison_init_one(), ret = %x\n", ret); |
cfc2f947 EK |
67 | |
68 | return ret; | |
cfc2f947 EK |
69 | } |
70 | ||
41e043fc | 71 | static const struct pci_device_id phison_pci_tbl[] = { |
dcbc2fc6 | 72 | { PCI_DEVICE(PCI_VENDOR_ID_PHISON, PCI_DEVICE_ID_PS5000), |
cfc2f947 EK |
73 | PCI_CLASS_STORAGE_IDE << 8, 0xffff00, 0 }, |
74 | { 0, }, | |
75 | }; | |
cfc2f947 EK |
76 | MODULE_DEVICE_TABLE(pci, phison_pci_tbl); |
77 | ||
33210206 | 78 | static struct pci_driver phison_pci_driver = { |
cfc2f947 EK |
79 | .name = DRV_NAME, |
80 | .id_table = phison_pci_tbl, | |
81 | .probe = phison_init_one, | |
82 | .remove = ata_pci_remove_one, | |
33210206 | 83 | #ifdef CONFIG_PM /* haven't tested it. */ |
cfc2f947 EK |
84 | .suspend = ata_pci_device_suspend, |
85 | .resume = ata_pci_device_resume, | |
86 | #endif | |
87 | }; | |
88 | ||
d44858a9 | 89 | module_pci_driver(phison_pci_driver); |
cfc2f947 EK |
90 | |
91 | MODULE_AUTHOR("Evan Ko"); | |
33210206 | 92 | MODULE_DESCRIPTION("PCIE driver module for PHISON PS5000 E-BOX"); |
cfc2f947 EK |
93 | MODULE_LICENSE("GPL"); |
94 | MODULE_VERSION(DRV_VERSION); |