2009-02-09 22:02:35 +01:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2006 Red Hat <evan_ko@phison.com>
|
|
|
|
*
|
|
|
|
* May be copied or modified under the terms of the GNU General Public License
|
|
|
|
*
|
|
|
|
* [Modify History]
|
|
|
|
* #0001, Evan, 2008.10.22, V0.00, New release.
|
|
|
|
* #0002, Evan, 2008.11.01, V0.90, Test Work In Ubuntu Linux 8.04.
|
|
|
|
* #0003, Evan, 2008.01.08, V0.91, Change Name "PCIE-SSD" to "E-BOX".
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/pci.h>
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/blkdev.h>
|
|
|
|
#include <linux/delay.h>
|
|
|
|
#include <linux/device.h>
|
|
|
|
#include <scsi/scsi_host.h>
|
|
|
|
#include <linux/libata.h>
|
|
|
|
#include <linux/ata.h>
|
|
|
|
|
|
|
|
#define PHISON_DEBUG
|
|
|
|
|
2009-02-12 22:36:54 +01:00
|
|
|
#define DRV_NAME "phison_e-box" /* #0003 */
|
2010-03-16 15:41:09 +01:00
|
|
|
#define DRV_VERSION "0.91" /* #0003 */
|
2009-02-09 22:02:35 +01:00
|
|
|
|
2009-02-12 22:36:54 +01:00
|
|
|
#define PCI_VENDOR_ID_PHISON 0x1987
|
|
|
|
#define PCI_DEVICE_ID_PS5000 0x5000
|
2009-02-09 22:02:35 +01:00
|
|
|
|
2009-02-12 22:36:54 +01:00
|
|
|
static int phison_pre_reset(struct ata_link *link, unsigned long deadline)
|
2009-02-09 22:02:35 +01:00
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
struct ata_port *ap = link->ap;
|
2009-02-12 22:36:54 +01:00
|
|
|
|
2009-02-09 22:02:35 +01:00
|
|
|
ap->cbl = ATA_CBL_NONE;
|
|
|
|
ret = ata_std_prereset(link, deadline);
|
2009-02-12 22:36:54 +01:00
|
|
|
dev_dbg(ap->dev, "phison_pre_reset(), ret = %x\n", ret);
|
2009-02-09 22:02:35 +01:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2009-02-12 22:36:54 +01:00
|
|
|
static struct scsi_host_template phison_sht = {
|
2009-02-12 22:37:51 +01:00
|
|
|
ATA_BMDMA_SHT(DRV_NAME),
|
2009-02-09 22:02:35 +01:00
|
|
|
};
|
|
|
|
|
2009-02-12 22:37:51 +01:00
|
|
|
static struct ata_port_operations phison_ops = {
|
|
|
|
.inherits = &ata_bmdma_port_ops,
|
|
|
|
.prereset = phison_pre_reset,
|
2009-02-09 22:02:35 +01:00
|
|
|
};
|
|
|
|
|
2009-02-12 22:36:54 +01:00
|
|
|
static int phison_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
|
2009-02-09 22:02:35 +01:00
|
|
|
{
|
2009-02-12 22:37:51 +01:00
|
|
|
int ret;
|
2009-02-09 22:02:35 +01:00
|
|
|
struct ata_port_info info = {
|
2009-02-12 22:37:51 +01:00
|
|
|
.flags = ATA_FLAG_NO_ATAPI,
|
2009-02-09 22:02:35 +01:00
|
|
|
|
|
|
|
.pio_mask = 0x1f,
|
|
|
|
.mwdma_mask = 0x07,
|
2010-03-16 15:41:09 +01:00
|
|
|
.udma_mask = ATA_UDMA5,
|
2009-02-09 22:02:35 +01:00
|
|
|
|
|
|
|
.port_ops = &phison_ops,
|
|
|
|
};
|
|
|
|
const struct ata_port_info *ppi[] = { &info, NULL };
|
|
|
|
|
2010-10-09 22:26:12 +02:00
|
|
|
ret = ata_pci_bmdma_init_one(pdev, ppi, &phison_sht, NULL, 0);
|
2009-02-09 22:02:35 +01:00
|
|
|
|
2009-02-12 22:36:54 +01:00
|
|
|
dev_dbg(&pdev->dev, "phison_init_one(), ret = %x\n", ret);
|
2009-02-09 22:02:35 +01:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2010-12-09 17:40:28 +01:00
|
|
|
static DEFINE_PCI_DEVICE_TABLE(phison_pci_tbl) = {
|
2011-11-27 15:11:40 +01:00
|
|
|
{ PCI_DEVICE(PCI_VENDOR_ID_PHISON, PCI_DEVICE_ID_PS5000),
|
2009-02-09 22:02:35 +01:00
|
|
|
PCI_CLASS_STORAGE_IDE << 8, 0xffff00, 0 },
|
|
|
|
{ 0, },
|
|
|
|
};
|
|
|
|
MODULE_DEVICE_TABLE(pci, phison_pci_tbl);
|
|
|
|
|
2009-02-12 22:36:54 +01:00
|
|
|
static struct pci_driver phison_pci_driver = {
|
2009-02-09 22:02:35 +01:00
|
|
|
.name = DRV_NAME,
|
|
|
|
.id_table = phison_pci_tbl,
|
|
|
|
.probe = phison_init_one,
|
|
|
|
.remove = ata_pci_remove_one,
|
2009-02-12 22:36:54 +01:00
|
|
|
#ifdef CONFIG_PM /* haven't tested it. */
|
2009-02-09 22:02:35 +01:00
|
|
|
.suspend = ata_pci_device_suspend,
|
|
|
|
.resume = ata_pci_device_resume,
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
2012-07-10 08:46:30 +02:00
|
|
|
module_pci_driver(phison_pci_driver);
|
2009-02-09 22:02:35 +01:00
|
|
|
|
|
|
|
MODULE_AUTHOR("Evan Ko");
|
2009-02-12 22:36:54 +01:00
|
|
|
MODULE_DESCRIPTION("PCIE driver module for PHISON PS5000 E-BOX");
|
2009-02-09 22:02:35 +01:00
|
|
|
MODULE_LICENSE("GPL");
|
|
|
|
MODULE_VERSION(DRV_VERSION);
|