Toshiba TC86C001 IDE driver
PATCH 1/1 Toshiba TC86C001 IDE driver
Behold! This is the driver for the Toshiba TC86C001 GOKU-S IDE controller, completely reworked from the original brain-damaged Toshiba's 2.4 version.
This single channel UltraDMA/66 controller is very simple in programming, yet Toshiba managed to plant many interesting bugs in it. The particularly nasty "limitation 5" (as they call the errata) caused me to abuse the IDE core in a possibly most interesting way so far. However, this is still better than the #ifdef mess in drivers/ide/ide-io.c that the original version included (well, it had much more mess)...
drivers/ide/Kconfig | 5 drivers/ide/pci/Makefile | 1 drivers/ide/pci/tc86c001.c | 304 +++++++++++++++++++++++++++++++++++++++++++++ drivers/pci/quirks.c | 18 ++ include/linux/pci_ids.h | 1 5 files changed, 329 insertions(+)
drivers/ide/Kconfig +5 -0
@@ -742,6 +742,11 @@ config BLK_DEV_VIA82CXXX This allows the kernel to change PIO, DMA and UDMA speeds and to configure the chip to optimum performance. +config BLK_DEV_TC86C001 + tristate "Toshiba TC86C001 support" + help + This driver adds support for Toshiba TC86C001 GOKU-S chip. + endif config BLK_DEV_IDE_PMAC
drivers/ide/pci/Makefile +1 -0
@@ -26,6 +26,7 @@ obj-$(CONFIG_BLK_DEV_SIIMAGE) += siimag obj-$(CONFIG_BLK_DEV_SIS5513) += sis5513.o obj-$(CONFIG_BLK_DEV_SL82C105) += sl82c105.o obj-$(CONFIG_BLK_DEV_SLC90E66) += slc90e66.o +obj-$(CONFIG_BLK_DEV_TC86C001) += tc86c001.o obj-$(CONFIG_BLK_DEV_TRIFLEX) += triflex.o obj-$(CONFIG_BLK_DEV_TRM290) += trm290.o obj-$(CONFIG_BLK_DEV_VIA82CXXX) += via82cxxx.o
drivers/ide/pci/tc86c001.c new file +304 -0
304 lines not on this page · raw message
drivers/pci/quirks.c +18 -0
@@ -1407,6 +1407,24 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INDECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_INTEL ,0x260a , quirk_intel_pcie_pm);DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_INTEL ,0x260b , quirk_intel_pcie_pm); +/* +* Toshiba TC86C001 IDE controller reports the standard 8-byte BAR0 size +* but PIO transfer won't work if BAR0 falls at the odd 8 bytes. +* Re-allocate the region if needed. +*/ +static void __init quirk_tc86c001_ide (struct pci_dev *dev) +{ +struct resource *r = &dev->resource[0 ]; + +if (r->start &0x8 ) { + r->start =0 ; + r->end =0xf ; + } +} +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_TOSHIBA_2 , +PCI_DEVICE_ID_TOSHIBA_TC86C001_IDE , + quirk_tc86c001_ide ); +static void __devinit quirk_netmos (struct pci_dev *dev) {unsigned int num_parallel = (dev->subsystem_device &0xf0 ) >>4 ;
include/linux/pci_ids.h +1 -0
@@ -1444,6 +1444,7 @@#define PCI_VENDOR_ID_TOSHIBA_2 0x102f#define PCI_DEVICE_ID_TOSHIBA_TC35815CF 0x0030 +#define PCI_DEVICE_ID_TOSHIBA_TC86C001_IDE 0x0105#define PCI_DEVICE_ID_TOSHIBA_TC86C001_MISC 0x0108#define PCI_DEVICE_ID_TOSHIBA_SPIDER_NET 0x01b3
Hello.
Quoted 2 lines · Sergei Shtylyov
Behold! This is the driver for the Toshiba TC86C001 GOKU-S IDE controller, completely reworked from the original brain-damaged Toshiba's 2.4 version.
Shoot, the patch is actually against the most recent Linus' tree, so
it's 2.6.20-rc1...
Andrew, 2.6.19-rc6-mm2 series keeps failing to completely apply to
2.6.19-rc6 head in my git repo -- don't know why, maybe that's my git... Hence the patch was againt Linus' tree.
WBR, Sergei
Quoted 24 lines · On Wed, 13 Dec 2006 01:48:34 +0300 Sergei Shtylyov wrote:
Behold! This is the driver for the Toshiba TC86C001 GOKU-S IDE controller, completely reworked from the original brain-damaged Toshiba's 2.4 version.
This single channel UltraDMA/66 controller is very simple in programming, yet Toshiba managed to plant many interesting bugs in it. The particularly nasty "limitation 5" (as they call the errata) caused me to abuse the IDE core in a possibly most interesting way so far. However, this is still better than the #ifdef mess in
drivers/ide/ide-io.cthat the original version included (well, it had much more mess)...Signed-off-by Sergei Shtylyov <[email protected]>drivers/ide/Kconfig | 5 drivers/ide/pci/Makefile | 1 drivers/ide/pci/tc86c001.c | 304 +++++++++++++++++++++++++++++++++++++++++++++ drivers/pci/quirks.c | 18 ++ include/linux/pci_ids.h | 1 5 files changed, 329 insertions(+)Index: linux-2.6/drivers/ide/Kconfig
===================================================================
drivers/ide/Kconfig config BLK_DEV_VIA82CXXX · line 746
Quoted 5 lines
drivers/ide/Kconfig +2
-0@@ -742,6 +742,11 @@ config BLK_DEV_VIA82CXXX This allows the kernel to change PIO, DMA and UDMA speeds and to configure the chip to optimum performance. +config BLK_DEV_TC86C001 + tristate "Toshiba TC86C001 support"
Needs something here like lots of other IDE PCI drivers have:
depends on PCI && BLK_DEV_IDEPCI
or at least: depends on PCI
drivers/ide/Kconfig config BLK_DEV_VIA82CXXX · line 750
Quoted 4 lines
drivers/ide/Kconfig +3
-0+ help + This driver adds support for Toshiba TC86C001 GOKU-S chip. + endif
---
~Randy
Hello.
Quoted 24 lines · Randy Dunlap
Quoted 24 lines
Behold! This is the driver for the Toshiba TC86C001 GOKU-S IDE controller, completely reworked from the original brain-damaged Toshiba's 2.4 version.
This single channel UltraDMA/66 controller is very simple in programming, yet Toshiba managed to plant many interesting bugs in it. The particularly nasty "limitation 5" (as they call the errata) caused me to abuse the IDE core in a possibly most interesting way so far. However, this is still better than the #ifdef mess in
drivers/ide/ide-io.cthat the original version included (well, it had much more mess)...Signed-off-by Sergei Shtylyov <[email protected]>drivers/ide/Kconfig | 5 drivers/ide/pci/Makefile | 1 drivers/ide/pci/tc86c001.c | 304 +++++++++++++++++++++++++++++++++++++++++++++ drivers/pci/quirks.c | 18 ++ include/linux/pci_ids.h | 1 5 files changed, 329 insertions(+)Index: linux-2.6/drivers/ide/Kconfig
===================================================================drivers/ide/Kconfig +0
-0@@ -742,6 +742,11 @@ config BLK_DEV_VIA82CXXX This allows the kernel to change PIO, DMA and UDMA speeds and to configure the chip to optimum performance.
Quoted 7 lines
drivers/ide/Kconfig config BLK_DEV_VIA82CXXX · line 746
Quoted 2 lines
drivers/ide/Kconfig +2
-0+config BLK_DEV_TC86C001 + tristate "Toshiba TC86C001 support"Needs something here like lots of other IDE PCI drivers have:
depends on PCI && BLK_DEV_IDEPCIor at least: depends on PCI
No, it's already under if BLK_DEV_IDEPCI. And if you really look intoKconfig you'll see hwo it's done there...
Quoted 4 lines
Quoted 4 lines
drivers/ide/Kconfig +3
-0+ help + This driver adds support for Toshiba TC86C001 GOKU-S chip. +endif
Here's that endif.
WBR, Sergei
Quoted 40 lines · Sergei Shtylyov
Hello.
Quoted 25 lines · Randy Dunlap
Quoted 25 lines
Behold! This is the driver for the Toshiba TC86C001 GOKU-S IDE controller, completely reworked from the original brain-damaged Toshiba's 2.4 version.
This single channel UltraDMA/66 controller is very simple in programming, yet Toshiba managed to plant many interesting bugs in it. The particularly nasty "limitation 5" (as they call the errata) caused me to abuse the IDE core in a possibly most interesting way so far. However, this is still better than the #ifdef mess in
drivers/ide/ide-io.cthat the original version included (well, it had much more mess)...Signed-off-by Sergei Shtylyov <[email protected]>
drivers/ide/Kconfig| 5drivers/ide/pci/Makefile| 1drivers/ide/pci/tc86c001.c| 304
+++++++++++++++++++++++++++++++++++++++++++++drivers/pci/quirks.c| 18 ++include/linux/pci_ids.h| 1 5 files changed, 329 insertions(+)Index: linux-2.6/drivers/ide/Kconfig
===================================================================drivers/ide/Kconfig +0
-0@@ -742,6 +742,11 @@ config BLK_DEV_VIA82CXXX This allows the kernel to change PIO, DMA and UDMA speeds and to configure the chip to optimum performance.Quoted 7 lines
drivers/ide/Kconfig config BLK_DEV_VIA82CXXX · line 746
Quoted 2 lines
drivers/ide/Kconfig +2
-0+config BLK_DEV_TC86C001 + tristate "Toshiba TC86C001 support"Needs something here like lots of other IDE PCI drivers have:
depends on PCI && BLK_DEV_IDEPCIor at least: depends on PCI
No, it's already under if
BLK_DEV_IDEPCI. And if you really look intoKconfigyou'll see hwo it's done there...
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
drivers/ide/Kconfig +3
-0+ help + This driver adds support for Toshiba TC86C001 GOKU-S chip. +endif
Here's that endif.
Ack. Thanks.
Signature · 1 line
~Randy
Quoted 2 lines
+ * We work around this by initiating dummy, zero-length DMA transfer on
+ * a DMA timeout expiration. I found no better way to do this with the current
Novel workaround and probably better than resetting the chip as the winbong does.
Review
Quoted 2 lines
(quoted diff) +2
-0+static int tc86c001_busproc(ide_drive_t *drive, int state) +{
Waste of space having a busproc routine. The maintainer removed all the usable hotplug support from old IDE so this might as well be dropped.
drivers/pci/quirks.c DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_IN · line 1414
Quoted 9 lines
drivers/pci/quirks.c +5
-0@@ -1407,6 +1407,24 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INDECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_INTEL ,0x260a , quirk_intel_pcie_pm);DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_INTEL ,0x260b , quirk_intel_pcie_pm); +/* +* Toshiba TC86C001 IDE controller reports the standard 8-byte BAR0 size +* but PIO transfer won't work if BAR0 falls at the odd 8 bytes. +* Re-allocate the region if needed. +*/
NAK. I think this fixup should be testing if the device port 0 is in native mode before doing the fixup. In comaptibility mode bar 0 is ignored and the correct compatibility values set up in the resource tree by the PCI layer as of 2.6.18-mm-mumble. They are also of course on a xx0 boundary.
"Close but no cookie": please fix the PCI quirk to match the current -mm behaviour with the ATA resource tree. Otherwise - nice driver.
Alan
Quoted 5 lines · Alan
Review
Quoted 2 lines
(quoted diff) +2
-0+static int tc86c001_busproc(ide_drive_t *drive, int state) +{Waste of space having a busproc routine. The maintainer removed all the usable hotplug support from old IDE so this might as well be dropped.
I took over IDE when hotplug was already broken (late 2.5), moreover IDE hotplug support has been always a quick hack according to its original author... I remember your great efforts to fix it but unfortunately they depended on executing
ioctls on non-existing devices which made them depend on layering violation in 2.6,
also IDE device model fixes has some conflicts with them. I take the blame for not
applying them (for the reasons given above) and for taking much too long in reviewing/testing them (due to lack of time not bad intention) but accusing me of
intentional feature removal is going a bit too far... You can hate me all you want
for the way I did my entirely volunteer and unpaid job (but hey there were and still is shortage of ATA hackers and there weren't anybody to step up and takeover IDE)
but I actually have always taken responsibility/blame for all my patches and patches
I accepted so if you really think I intentionally removed some usable hotplug support
please point me to specific patch and describe the regression after applying this
specific patch and I will do my best to have this regression fixed...
Bart
Quoted 9 lines
Quoted 2 lines
Waste of space having a busproc routine. The maintainer removed all the usable hotplug support from old IDE so this might as well be dropped.
I took over IDE when hotplug was already broken (late 2.5), moreover IDE hotplug support has been always a quick hack according to its original author... I remember your great efforts to fix it but unfortunately they depended on executing
ioctls on non-existing devices which made them depend on layering violation in 2.6,
Bart, I'm really not interested in a 500 email rehash of the fact you chose to refuse the hotplug support (that was working) for 2.6.x. You did, the world has moved on, and there is no point putting a busproc function in that driver.
Do something useful. Send a patch to make Sergei the IDE maintainer as he's doing all the IDE stuff these days.
Quoted 10 lines · Alan
Quoted 9 lines
Quoted 2 lines
Waste of space having a busproc routine. The maintainer removed all the usable hotplug support from old IDE so this might as well be dropped.
I took over IDE when hotplug was already broken (late 2.5), moreover IDE hotplug support has been always a quick hack according to its original author... I remember your great efforts to fix it but unfortunately they depended on executing
ioctls on non-existing devices which made them depend on layering violation in 2.6,
Quoted 4 lines
Bart, I'm really not interested in a 500 email rehash of the fact you chose to refuse the hotplug support (that was working) for 2.6.x. You did, the world has moved on, and there is no point putting a busproc function in that driver.
Unfortunately it seems that not everybody has moved on. It is not about your not accepted patches but about "the maintainer removed all the usable hotplug support from old IDE" false accusations which are unproven and untrue.
Bart
Quoted 4 lines
Unfortunately it seems that not everybody has moved on. It is not about your not accepted patches but about "the maintainer removed all the usable hotplug support from old IDE" false accusations which are unproven and untrue.
I invite anyone who cares to study the archive.
Welcome back to my killfile.
Quoted 4 lines · Alan
Quoted 4 lines
Unfortunately it seems that not everybody has moved on. It is not about your not accepted patches but about "the maintainer removed all the usable hotplug support from old IDE" false accusations which are unproven and untrue.
Moreover I could be just bypassed (which happened quite a few times in the past) and you could get your patches accepted anyway. And this indeed did happened for some of your IDE patches but not for "working" hotplug support. Strange, isn't? So accept the damn fact that your hotplug support was far from being acceptable and move on finally...
Quoted 1 line
I invite anyone who cares to study the archive.
I also invite anyone to study the archive.
Quoted 1 line
Welcome back to my killfile.
A novel way to prove your statements...
Bart
Hello.
Quoted 5 lines · Alan
Quoted 2 lines
+ * We work around this by initiating dummy, zero-length DMA transfer on
+ * a DMA timeout expiration. I found no better way to do this with the currentNovel workaround and probably better than resetting the chip as the winbong does.
I didn't try resetting however the datasheet suggests it just won't do.
Quoted 5 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+static int tc86c001_busproc(ide_drive_t *drive, int state) +{Waste of space having a busproc routine. The maintainer removed all the usable hotplug support from old IDE so this might as well be dropped.
Don't know what you mean, ioctl is still there...
Quoted 4 lines
Quoted 3 lines
drivers/pci/quirks.c +0
-0@@ -1407,6 +1407,24 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INDECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_INTEL ,0x260a , quirk_intel_pcie_pm);DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_INTEL ,0x260b , quirk_intel_pcie_pm);
Quoted 8 lines
drivers/pci/quirks.c DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_IN · line 1414
Quoted 5 lines
drivers/pci/quirks.c +5
-0+/* +* Toshiba TC86C001 IDE controller reports the standard 8-byte BAR0 size +* but PIO transfer won't work if BAR0 falls at the odd 8 bytes. +* Re-allocate the region if needed. +*/ NAK. I think this fixup should be testing if the device port 0 is in native mode before doing the fixup. In comaptibility mode bar 0 is
The chip is native mode only.
Quoted 2 lines
"Close but no cookie": please fix the PCI quirk to match the current -mm behaviour with the ATA resource tree. Otherwise - nice driver.
Ugh, I should've expected some backstab from -mm tree...
Quoted 1 line
Alan
WBR, Sergei
Alan
Acked-by Alan CoxQuoted 7 lines
Quoted 5 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+static int tc86c001_busproc(ide_drive_t *drive, int state) +{Waste of space having a busproc routine. The maintainer removed all the usable hotplug support from old IDE so this might as well be dropped.
Don't know what you mean, ioctl is still there...
You can turn the bus on and off but there is no ability to actually swap drives except in RHEL4 and 2.4.x-ac kernels. Hence "waste of space"
Quoted 4 lines
Quoted 2 lines
"Close but no cookie": please fix the PCI quirk to match the current -mm behaviour with the ATA resource tree. Otherwise - nice driver.
Ugh, I should've expected some backstab from -mm tree...
If it is native only then there are no problems with the quirk
Quoted 2 lines · On Wed, 13 Dec 2006 01:48:34 +0300 Sergei Shtylyov <[email protected]>…
Behold! This is the driver for the Toshiba TC86C001 GOKU-S IDE controller, completely reworked from the original brain-damaged Toshiba's 2.4 version.
Actually un-nack the PCI quirk. While it is true the native mode is relevant because of the way the BAR values work we know legacy bar values are never "& 8" so the test is sufficient [but should be commented about the assumption]
Alan