Skip to contentSkip to conversation

pata_cs5536: ATA driver for Geode companion chip

PATCH Applied Martin K. Petersen 5 participants 7 messages Oct 11, 2007 – Oct 15, 2007 libata

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pata_cs5536: ATA driver for Geode companion chip

This is a driver for the ATA controller on the Geode CS5536 companion chip. The PCI device ID for this device was previously claimed by pata_amd.c but the PIO timings were not correct. This driver also works around a bug in some BIOSes that handle unaligned access to the PCI config registers poorly. Finally, the driver allows fallback to using MSR registers for configuration on BIOSes that are truly broken.

---

drivers/ata/Kconfig +9 -0
diff -r 79f0ea1e0e70 drivers/ata/Kconfig
@@ -254,6 +254,15 @@ config PATA_CS5535
 
 	  If unsure, say N.
 
+config PATA_CS5536
+	tristate "CS5536 PATA support (Experimental)"
+	depends on PCI && X86 && !X86_64 && EXPERIMENTAL
+	help
+	  This option enables support for the AMD CS5536
+	  companion chip used with the Geode LX processor family.
+
+	  If unsure, say N.
+
 config PATA_CYPRESS
 	tristate "Cypress CY82C693 PATA support (Very Experimental)"
 	depends on PCI && EXPERIMENTAL
drivers/ata/Makefile +1 -0
diff -r 79f0ea1e0e70 drivers/ata/Makefile
@@ -27,6 +27,7 @@ obj-$(CONFIG_PATA_CS5520)	+= pata_cs5520
 obj-$(CONFIG_PATA_CS5520)	+= pata_cs5520.o
 obj-$(CONFIG_PATA_CS5530)	+= pata_cs5530.o
 obj-$(CONFIG_PATA_CS5535)	+= pata_cs5535.o
+obj-$(CONFIG_PATA_CS5536)	+= pata_cs5536.o
 obj-$(CONFIG_PATA_CYPRESS)	+= pata_cypress.o
 obj-$(CONFIG_PATA_EFAR)		+= pata_efar.o
 obj-$(CONFIG_PATA_HPT366)	+= pata_hpt366.o
drivers/ata/pata_amd.c +3 -0
diff -r 79f0ea1e0e70 drivers/ata/pata_amd.c
@@ -693,7 +693,10 @@ static const struct pci_device_id amd[] 
 	{ PCI_VDEVICE(NVIDIA,	PCI_DEVICE_ID_NVIDIA_NFORCE_MCP67_IDE),	8 },
 	{ PCI_VDEVICE(NVIDIA,	PCI_DEVICE_ID_NVIDIA_NFORCE_MCP73_IDE),	8 },
 	{ PCI_VDEVICE(NVIDIA,	PCI_DEVICE_ID_NVIDIA_NFORCE_MCP77_IDE),	8 },
+/* Temporary */
+#if !defined(CONFIG_PATA_CS5536) && !defined(CONFIG_PATA_CS5536_MODULE)
 	{ PCI_VDEVICE(AMD,	PCI_DEVICE_ID_AMD_CS5536_IDE),		9 },
+#endif
 
 	{ },
 };
drivers/ata/pata_cs5536.c new file +346 -0

346 lines not on this page · raw message

Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · On Thu, 11 Oct 2007 03:38:19 -0400 "Martin K. Petersen"…

This is a driver for the ATA controller on the Geode CS5536 companion chip. The PCI device ID for this device was previously claimed by pata_amd.c but the PIO timings were not correct. This driver also works around a bug in some BIOSes that handle unaligned access to the PCI config registers poorly. Finally, the driver allows fallback to using MSR registers for configuration on BIOSes that are truly broken.

Tested-by
#2 lore raw
Quoted 12 lines · Alan Cox
Quoted 9 lines · On Thu, 11 Oct 2007 03:38:19 -0400 "Martin K. Petersen"…

This is a driver for the ATA controller on the Geode CS5536 companion chip. The PCI device ID for this device was previously claimed by pata_amd.c but the PIO timings were not correct. This driver also works around a bug in some BIOSes that handle unaligned access to the PCI config registers poorly. Finally, the driver allows fallback to using MSR registers for configuration on BIOSes that are truly broken.

Quoted 3 lines
Quoted 1 line

I've been using the driver (boot drive on the port) since Martin's post and haven't experienced any problems.

#3 lore raw

Just noticed something.. I'm not sure if this is due to a libata-dev change or me switching to pata_cs5536, but my 128MB DOM on the PATA port is hitting the ata_dma_blacklisted() case and it was not previously. This did not happen under 2.6.22.6 using pata_amd. The system is noticeably slower when forced to use PIO4 (as you would expect).

Is this expected in the newer code, or is it a bug?

Previous 2.6.22.6 kernel using pata_amd:

pata_amd 0000:00:0f.2: version 0.3.8
scsi4 : pata_amd
scsi5 : pata_amd
ata5: PATA max UDMA/100 cmd 0x000101f0 ctl 0x000103f6 bmdma 0x0001ff00 irq 14
ata6: PATA max UDMA/100 cmd 0x00010170 ctl 0x00010376 bmdma 0x0001ff08 irq 15 ata5.00: ATA-0: , 060729DA, max MWDMA2
ata5.00: 256000 sectors, multi 1: LBA
ata5.00: configured for MWDMA2
ata6: port disabled. ignoring.

Up-to-date libata-dev using pata_cs5536:

scsi4 : pata_cs5536
scsi5 : pata_cs5536
ata5: PATA max UDMA/100 cmd 0x1f0 ctl 0x3f6 bmdma 0xff00 irq 14
ata6: DUMMY
ata5: PATA max UDMA/100 cmd 0x1f0 ctl 0x3f6 bmdma 0xff00 irq 14 ata5.00: ATA-0: , 060729DA, max MWDMA2
ata5.00: 256000 sectors, multi 1: LBA
ata5.00: device is on DMA blacklist, disabling DMA ata5.00: configured for PIO4
ata5.00: device is on DMA blacklist, disabling DMA ata5.00: configured for PIO4
ata5: EH complete

Thanks,
-Andrew

Quoted 21 lines · Andrew Paprocki
Quoted 12 lines · Alan Cox
Quoted 9 lines · On Thu, 11 Oct 2007 03:38:19 -0400 "Martin K. Petersen"…

This is a driver for the ATA controller on the Geode CS5536 companion chip. The PCI device ID for this device was previously claimed by pata_amd.c but the PIO timings were not correct. This driver also works around a bug in some BIOSes that handle unaligned access to the PCI config registers poorly. Finally, the driver allows fallback to using MSR registers for configuration on BIOSes that are truly broken.

Quoted 3 lines
Quoted 1 line

I've been using the driver (boot drive on the port) since Martin's post and haven't experienced any problems.

#4 lore raw
Quoted 8 lines · On Sun, 14 Oct 2007 15:42:19 -0400 "Andrew Paprocki"…

Just noticed something.. I'm not sure if this is due to a libata-dev change or me switching to pata_cs5536, but my 128MB DOM on the PATA port is hitting the ata_dma_blacklisted() case and it was not previously. This did not happen under 2.6.22.6 using pata_amd. The system is noticeably slower when forced to use PIO4 (as you would expect).

Is this expected in the newer code, or is it a bug?

Sounds like someone added it wrongly to the blacklist. Remove the blacklist entry, test again and if DMA is working we need to get that fixed ASAP in .2 and 2.6.24.

Alan

#5 lore raw

Long story short -- this has nothing to do with pata_cs5536.

It isn't in that list! I just patched my kernel to print the reason why it is being blacklisted and this turned up:

ata5.00: ATA-0: , 060729DA, max MWDMA2
ata5.00: 256000 sectors, multi 1: LBA
ata5.00: device is on DMA blacklist, disabling DMA ata5.00: device matched DMA blacklist, model: WDC AC11000H ata5.00: configured for PIO4

The strn_pattern_cmp function does not handle blank model names. I would like to give this Taiwanese manufacturer a bug for not bothering to put a model name on their device, but I don't think they'll care too much.. :)

I just submitted a patch to fix strn_pattern_cmp to handle the strlen(name)==0 case appropriately (ie only match it against "*" or "").

With that change, it is properly detected as MWDMA2 again:

ata5.00: ATA-0: , 060729DA, max MWDMA2
ata5.00: 256000 sectors, multi 1: LBA
ata5.00: configured for MWDMA2
ata5.00: configured for MWDMA2

Thanks,
-Andrew

Quoted 17 lines · Alan Cox
Quoted 8 lines · On Sun, 14 Oct 2007 15:42:19 -0400 "Andrew Paprocki"…

Just noticed something.. I'm not sure if this is due to a libata-dev change or me switching to pata_cs5536, but my 128MB DOM on the PATA port is hitting the ata_dma_blacklisted() case and it was not previously. This did not happen under 2.6.22.6 using pata_amd. The system is noticeably slower when forced to use PIO4 (as you would expect).

Is this expected in the newer code, or is it a bug?

Sounds like someone added it wrongly to the blacklist. Remove the blacklist entry, test again and if DMA is working we need to get that fixed ASAP in .2 and 2.6.24.

Alan

Applied
#6 lore raw
In reply to Martin K. Petersen
Quoted 46 lines · Martin K. Petersen

This is a driver for the ATA controller on the Geode CS5536 companion chip. The PCI device ID for this device was previously claimed by pata_amd.c but the PIO timings were not correct. This driver also works around a bug in some BIOSes that handle unaligned access to the PCI config registers poorly. Finally, the driver allows fallback to using MSR registers for configuration on BIOSes that are truly broken.

---

diff -r 79f0ea1e0e70 drivers/ata/Kconfig

drivers/ata/Kconfig +9 -0
@@ -254,6 +254,15 @@ config PATA_CS5535
 
 	  If unsure, say N.
 
+config PATA_CS5536
+	tristate "CS5536 PATA support (Experimental)"
+	depends on PCI && X86 && !X86_64 && EXPERIMENTAL
+	help
+	  This option enables support for the AMD CS5536
+	  companion chip used with the Geode LX processor family.
+
+	  If unsure, say N.
+
 config PATA_CYPRESS
 	tristate "Cypress CY82C693 PATA support (Very Experimental)"
 	depends on PCI && EXPERIMENTAL

diff -r 79f0ea1e0e70 drivers/ata/Makefile

drivers/ata/Makefile +1 -0
@@ -27,6 +27,7 @@ obj-$(CONFIG_PATA_CS5520)	+= pata_cs5520
 obj-$(CONFIG_PATA_CS5520)	+= pata_cs5520.o
 obj-$(CONFIG_PATA_CS5530)	+= pata_cs5530.o
 obj-$(CONFIG_PATA_CS5535)	+= pata_cs5535.o
+obj-$(CONFIG_PATA_CS5536)	+= pata_cs5536.o
 obj-$(CONFIG_PATA_CYPRESS)	+= pata_cypress.o
 obj-$(CONFIG_PATA_EFAR)		+= pata_efar.o
 obj-$(CONFIG_PATA_HPT366)	+= pata_hpt366.o

diff -r 79f0ea1e0e70 drivers/ata/pata_amd.c

drivers/ata/pata_amd.c static const struct pci_device_id amd[] · line 702

Quoted 10 lines
drivers/ata/pata_amd.c +3 -0
@@ -693,7 +693,10 @@ static const struct pci_device_id amd[] 
 	{ PCI_VDEVICE(NVIDIA,	PCI_DEVICE_ID_NVIDIA_NFORCE_MCP67_IDE),	8 },
 	{ PCI_VDEVICE(NVIDIA,	PCI_DEVICE_ID_NVIDIA_NFORCE_MCP73_IDE),	8 },
 	{ PCI_VDEVICE(NVIDIA,	PCI_DEVICE_ID_NVIDIA_NFORCE_MCP77_IDE),	8 },
+/* Temporary */
+#if !defined(CONFIG_PATA_CS5536) && !defined(CONFIG_PATA_CS5536_MODULE)
 	{ PCI_VDEVICE(AMD,	PCI_DEVICE_ID_AMD_CS5536_IDE),		9 },
+#endif
 
 	{ },
 };

applied, after removing the pata_amd patch

I don't typically apply things marked temporary :) but moreover, this is a bit unusual to do in a driver. Any opinions on simply removing the PCI ID? what's the installed base like today? do we need to keep the PCI ID in both drivers?