aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAlan Cox <alan@linux.intel.com>2009-11-30 08:23:11 -0500
committerJeff Garzik <jgarzik@redhat.com>2009-12-03 14:35:31 -0500
commit8e182a90f91456335756d2ce304ad470795d98e1 (patch)
tree680787fcf19cf0962a43edf71e35185046e79ade /drivers
parentd6250a03fa736c1bff4df4601f5af2dc21f2bf9e (diff)
pata_piccolo: Driver for old Toshiba chipsets
We were never able to get docs for this out of Toshiba for years. Dave Barnes produced a NetBSD driver however and from that we can fill in the needed tables. As we correct the PCI identifiers a bit also update the old ide generic driver at the same time so it stays compiling. Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ata/Kconfig9
-rw-r--r--drivers/ata/Makefile1
-rw-r--r--drivers/ata/ata_generic.c5
-rw-r--r--drivers/ata/pata_piccolo.c140
-rw-r--r--drivers/ide/ide-pci-generic.c3
5 files changed, 156 insertions, 2 deletions
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index a47ca75aa078..676f08b004b3 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -667,6 +667,15 @@ config PATA_SIS
667 667
668 If unsure, say N. 668 If unsure, say N.
669 669
670config PATA_TOSHIBA
671 tristate "Toshiba Piccolo support (Experimental)"
672 depends on PCI && EXPERIMENTAL
673 help
674 Support for the Toshiba Piccolo controllers. Currently only the
675 primary channel is supported by this driver.
676
677 If unsure, say N.
678
670config PATA_VIA 679config PATA_VIA
671 tristate "VIA PATA support" 680 tristate "VIA PATA support"
672 depends on PCI 681 depends on PCI
diff --git a/drivers/ata/Makefile b/drivers/ata/Makefile
index 01e126f343b3..d909435e9d81 100644
--- a/drivers/ata/Makefile
+++ b/drivers/ata/Makefile
@@ -63,6 +63,7 @@ obj-$(CONFIG_PATA_RZ1000) += pata_rz1000.o
63obj-$(CONFIG_PATA_SC1200) += pata_sc1200.o 63obj-$(CONFIG_PATA_SC1200) += pata_sc1200.o
64obj-$(CONFIG_PATA_SERVERWORKS) += pata_serverworks.o 64obj-$(CONFIG_PATA_SERVERWORKS) += pata_serverworks.o
65obj-$(CONFIG_PATA_SIL680) += pata_sil680.o 65obj-$(CONFIG_PATA_SIL680) += pata_sil680.o
66obj-$(CONFIG_PATA_TOSHIBA) += pata_piccolo.o
66obj-$(CONFIG_PATA_VIA) += pata_via.o 67obj-$(CONFIG_PATA_VIA) += pata_via.o
67obj-$(CONFIG_PATA_WINBOND) += pata_sl82c105.o 68obj-$(CONFIG_PATA_WINBOND) += pata_sl82c105.o
68obj-$(CONFIG_PATA_WINBOND_VLB) += pata_winbond.o 69obj-$(CONFIG_PATA_WINBOND_VLB) += pata_winbond.o
diff --git a/drivers/ata/ata_generic.c b/drivers/ata/ata_generic.c
index ecfd22b4f1ce..12e26c3c68e3 100644
--- a/drivers/ata/ata_generic.c
+++ b/drivers/ata/ata_generic.c
@@ -168,9 +168,12 @@ static struct pci_device_id ata_generic[] = {
168 { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C561), }, 168 { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C561), },
169 { PCI_DEVICE(PCI_VENDOR_ID_OPTI, PCI_DEVICE_ID_OPTI_82C558), }, 169 { PCI_DEVICE(PCI_VENDOR_ID_OPTI, PCI_DEVICE_ID_OPTI_82C558), },
170 { PCI_DEVICE(PCI_VENDOR_ID_CENATEK,PCI_DEVICE_ID_CENATEK_IDE), }, 170 { PCI_DEVICE(PCI_VENDOR_ID_CENATEK,PCI_DEVICE_ID_CENATEK_IDE), },
171 { PCI_DEVICE(PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO), }, 171#if !defined(CONFIG_PATA_TOSHIBA) && !defined(CONFIG_PATA_TOSHIBA_MODULE)
172 { PCI_DEVICE(PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_1), }, 172 { PCI_DEVICE(PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_1), },
173 { PCI_DEVICE(PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_2), }, 173 { PCI_DEVICE(PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_2), },
174 { PCI_DEVICE(PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_3), },
175 { PCI_DEVICE(PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_5), },
176#endif
174 /* Must come last. If you add entries adjust this table appropriately */ 177 /* Must come last. If you add entries adjust this table appropriately */
175 { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_STORAGE_IDE << 8, 0xFFFFFF00UL, 1}, 178 { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_STORAGE_IDE << 8, 0xFFFFFF00UL, 1},
176 { 0, }, 179 { 0, },
diff --git a/drivers/ata/pata_piccolo.c b/drivers/ata/pata_piccolo.c
new file mode 100644
index 000000000000..bfe0180f3efa
--- /dev/null
+++ b/drivers/ata/pata_piccolo.c
@@ -0,0 +1,140 @@
1/*
2 * pata_piccolo.c - Toshiba Piccolo PATA/SATA controller driver.
3 *
4 * This is basically an update to ata_generic.c to add Toshiba Piccolo support
5 * then split out to keep ata_generic "clean".
6 *
7 * Copyright 2005 Red Hat Inc, all rights reserved.
8 *
9 * Elements from ide/pci/generic.c
10 * Copyright (C) 2001-2002 Andre Hedrick <andre@linux-ide.org>
11 * Portions (C) Copyright 2002 Red Hat Inc <alan@redhat.com>
12 *
13 * May be copied or modified under the terms of the GNU General Public License
14 *
15 * The timing data tables/programming info are courtesy of the NetBSD driver
16 */
17
18#include <linux/kernel.h>
19#include <linux/module.h>
20#include <linux/pci.h>
21#include <linux/init.h>
22#include <linux/blkdev.h>
23#include <linux/delay.h>
24#include <scsi/scsi_host.h>
25#include <linux/libata.h>
26
27#define DRV_NAME "pata_piccolo"
28#define DRV_VERSION "0.0.1"
29
30
31
32static void tosh_set_piomode(struct ata_port *ap, struct ata_device *adev)
33{
34 static const u16 pio[6] = { /* For reg 0x50 low word & E088 */
35 0x0566, 0x0433, 0x0311, 0x0201, 0x0200, 0x0100
36 };
37 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
38 u16 conf;
39 pci_read_config_word(pdev, 0x50, &conf);
40 conf &= 0xE088;
41 conf |= pio[adev->pio_mode - XFER_PIO_0];
42 pci_write_config_word(pdev, 0x50, conf);
43}
44
45static void tosh_set_dmamode(struct ata_port *ap, struct ata_device *adev)
46{
47 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
48 u32 conf;
49 pci_read_config_dword(pdev, 0x5C, &conf);
50 conf &= 0x78FFE088; /* Keep the other bits */
51 if (adev->dma_mode >= XFER_UDMA_0) {
52 int udma = adev->dma_mode - XFER_UDMA_0;
53 conf |= 0x80000000;
54 conf |= (udma + 2) << 28;
55 conf |= (2 - udma) * 0x111; /* spread into three nibbles */
56 } else {
57 static const u32 mwdma[4] = {
58 0x0655, 0x0200, 0x0200, 0x0100
59 };
60 conf |= mwdma[adev->dma_mode - XFER_MW_DMA_0];
61 }
62 pci_write_config_dword(pdev, 0x5C, conf);
63}
64
65
66static struct scsi_host_template tosh_sht = {
67 ATA_BMDMA_SHT(DRV_NAME),
68};
69
70static struct ata_port_operations tosh_port_ops = {
71 .inherits = &ata_bmdma_port_ops,
72 .cable_detect = ata_cable_unknown,
73 .set_piomode = tosh_set_piomode,
74 .set_dmamode = tosh_set_dmamode
75};
76
77/**
78 * ata_tosh_init - attach generic IDE
79 * @dev: PCI device found
80 * @id: match entry
81 *
82 * Called each time a matching IDE interface is found. We check if the
83 * interface is one we wish to claim and if so we perform any chip
84 * specific hacks then let the ATA layer do the heavy lifting.
85 */
86
87static int ata_tosh_init_one(struct pci_dev *dev, const struct pci_device_id *id)
88{
89 static const struct ata_port_info info = {
90 .flags = ATA_FLAG_SLAVE_POSS,
91 .pio_mask = ATA_PIO5,
92 .mwdma_mask = ATA_MWDMA2,
93 .udma_mask = ATA_UDMA2,
94 .port_ops = &tosh_port_ops
95 };
96 const struct ata_port_info *ppi[] = { &info, &ata_dummy_port_info };
97 /* Just one port for the moment */
98 return ata_pci_sff_init_one(dev, ppi, &tosh_sht, NULL);
99}
100
101static struct pci_device_id ata_tosh[] = {
102 { PCI_DEVICE(PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_1), },
103 { PCI_DEVICE(PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_2), },
104 { PCI_DEVICE(PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_3), },
105 { PCI_DEVICE(PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_5), },
106 { 0, },
107};
108
109static struct pci_driver ata_tosh_pci_driver = {
110 .name = DRV_NAME,
111 .id_table = ata_tosh,
112 .probe = ata_tosh_init_one,
113 .remove = ata_pci_remove_one,
114#ifdef CONFIG_PM
115 .suspend = ata_pci_device_suspend,
116 .resume = ata_pci_device_resume,
117#endif
118};
119
120static int __init ata_tosh_init(void)
121{
122 return pci_register_driver(&ata_tosh_pci_driver);
123}
124
125
126static void __exit ata_tosh_exit(void)
127{
128 pci_unregister_driver(&ata_tosh_pci_driver);
129}
130
131
132MODULE_AUTHOR("Alan Cox");
133MODULE_DESCRIPTION("Low level driver for Toshiba Piccolo ATA");
134MODULE_LICENSE("GPL");
135MODULE_DEVICE_TABLE(pci, ata_tosh);
136MODULE_VERSION(DRV_VERSION);
137
138module_init(ata_tosh_init);
139module_exit(ata_tosh_exit);
140
diff --git a/drivers/ide/ide-pci-generic.c b/drivers/ide/ide-pci-generic.c
index 39d4e01f5c9c..a743e68a8903 100644
--- a/drivers/ide/ide-pci-generic.c
+++ b/drivers/ide/ide-pci-generic.c
@@ -162,9 +162,10 @@ static const struct pci_device_id generic_pci_tbl[] = {
162#ifdef CONFIG_BLK_DEV_IDE_SATA 162#ifdef CONFIG_BLK_DEV_IDE_SATA
163 { PCI_VDEVICE(VIA, PCI_DEVICE_ID_VIA_8237_SATA), 5 }, 163 { PCI_VDEVICE(VIA, PCI_DEVICE_ID_VIA_8237_SATA), 5 },
164#endif 164#endif
165 { PCI_VDEVICE(TOSHIBA, PCI_DEVICE_ID_TOSHIBA_PICCOLO), 4 },
166 { PCI_VDEVICE(TOSHIBA, PCI_DEVICE_ID_TOSHIBA_PICCOLO_1), 4 }, 165 { PCI_VDEVICE(TOSHIBA, PCI_DEVICE_ID_TOSHIBA_PICCOLO_1), 4 },
167 { PCI_VDEVICE(TOSHIBA, PCI_DEVICE_ID_TOSHIBA_PICCOLO_2), 4 }, 166 { PCI_VDEVICE(TOSHIBA, PCI_DEVICE_ID_TOSHIBA_PICCOLO_2), 4 },
167 { PCI_VDEVICE(TOSHIBA, PCI_DEVICE_ID_TOSHIBA_PICCOLO_3), 4 },
168 { PCI_VDEVICE(TOSHIBA, PCI_DEVICE_ID_TOSHIBA_PICCOLO_5), 4 },
168 { PCI_VDEVICE(NETCELL, PCI_DEVICE_ID_REVOLUTION), 6 }, 169 { PCI_VDEVICE(NETCELL, PCI_DEVICE_ID_REVOLUTION), 6 },
169 /* 170 /*
170 * Must come last. If you add entries adjust 171 * Must come last. If you add entries adjust