The patch titled Jmicron driver plumbing and quirk has been added to the -mm tree. Its filename is 2-of-2-jmicron-driver-plumbing-and-quirk.patch See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this ------------------------------------------------------ Subject: Jmicron driver plumbing and quirk From: Alan Cox <alan@xxxxxxxxxxxxxxxxxxx> At set up time we need to switch the chip to multifunction mode so that our PCI layer handles the transition correctly. In multi-function mode it provides an AHCI controller for SATA and an SFF type controller for PATA ports. In "as booted" mode it provides the ports folded onto a single SFF type function. The jmicron driver supports both modes while the quirk is set up to always force it into multi-function mode as per recommendations of chip vendor. The exception is the 368 which is PATA only and has no AHCI port. That is not handled by the quirk but is picked up directly by the Jmicron driver. Signed-off-by: Alan Cox <alan@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- drivers/pci/quirks.c | 49 ++++++++++++++++++++++++++++++++++++++++ drivers/scsi/Kconfig | 8 ++++++ drivers/scsi/Makefile | 1 3 files changed, 58 insertions(+) diff -puN drivers/pci/quirks.c~2-of-2-jmicron-driver-plumbing-and-quirk drivers/pci/quirks.c --- a/drivers/pci/quirks.c~2-of-2-jmicron-driver-plumbing-and-quirk +++ a/drivers/pci/quirks.c @@ -1174,6 +1174,55 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_S DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_963, quirk_sis_96x_smbus ); DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_LPC, quirk_sis_96x_smbus ); +#if defined(CONFIG_SCSI_SATA) || defined(CONFIG_SCSI_SATA_MODULE) + +/* + * If we are using libata we can drive this chip proeprly but must + * do this early on to make the additional device appear during + * the PCI scanning. + */ + +static void __devinit quirk_jmicron_dualfn(struct pci_dev *pdev) +{ + u32 conf; + u8 hdr; + + /* Only poke fn 0 */ + if (PCI_FUNC(pdev->devfn)) + return; + + switch(pdev->device) { + case PCI_DEVICE_ID_JMICRON_JMB365: + case PCI_DEVICE_ID_JMICRON_JMB366: + /* Redirect IDE second PATA port to the right spot */ + pci_read_config_dword(pdev, 0x80, &conf); + conf |= (1 << 24); + /* Fall through */ + pci_write_config_dword(pdev, 0x80, conf); + case PCI_DEVICE_ID_JMICRON_JMB361: + case PCI_DEVICE_ID_JMICRON_JMB363: + pci_read_config_dword(pdev, 0x40, &conf); + /* Enable dual function mode, AHCI on fn 0, IDE fn1 */ + /* Set the class codes correctly and then direct IDE 0 */ + conf &= ~0x000F0200; /* Clear bit 9 and 16-19 */ + conf |= 0x00C20002; /* Set bit 1, 17, 22, 23 */ + pci_write_config_dword(pdev, 0x40, conf); + + /* Reconfigure so that the PCI scanner discovers the + device is now multifunction */ + + pci_read_config_byte(pdev, PCI_HEADER_TYPE, &hdr); + pdev->hdr_type = hdr & 0x7f; + pdev->multifunction = !!(hdr & 0x80); + + break; + } +} + +DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, quirk_jmicron_dualfn); + +#endif + #ifdef CONFIG_X86_IO_APIC static void __init quirk_alder_ioapic(struct pci_dev *pdev) { diff -puN drivers/scsi/Kconfig~2-of-2-jmicron-driver-plumbing-and-quirk drivers/scsi/Kconfig --- a/drivers/scsi/Kconfig~2-of-2-jmicron-driver-plumbing-and-quirk +++ a/drivers/scsi/Kconfig @@ -650,6 +650,14 @@ config SCSI_PATA_IT821X If unsure, say N. +config SCSI_ATA_JMICRON + tristate "JMicron non-AHCI support (Experimental)" + depends on SCSI_SATA && PCI && EXPERIMENTAL + help + This option enables support for Jmicron ATA controllers + ports running in non-AHCI mode. Where possible you should + set the configuration for AHCI to get better performance + config SCSI_PATA_LEGACY tristate "Legacy ISA PATA support (Experimental)" depends on SCSI_SATA && PCI && EXPERIMENTAL diff -puN drivers/scsi/Makefile~2-of-2-jmicron-driver-plumbing-and-quirk drivers/scsi/Makefile --- a/drivers/scsi/Makefile~2-of-2-jmicron-driver-plumbing-and-quirk +++ a/drivers/scsi/Makefile @@ -140,6 +140,7 @@ obj-$(CONFIG_SCSI_PATA_HPT3X3) += libata obj-$(CONFIG_SCSI_PATA_ISAPNP) += libata.o pata_isapnp.o obj-$(CONFIG_SCSI_PATA_IT8172) += libata.o pata_it8172.o obj-$(CONFIG_SCSI_PATA_IT821X) += libata.o pata_it821x.o +obj-$(CONFIG_SCSI_ATA_JMICRON) += libata.o ata_jmicron.o obj-$(CONFIG_SCSI_PATA_NETCELL) += libata.o pata_netcell.o obj-$(CONFIG_SCSI_PATA_NS87410) += libata.o pata_ns87410.o obj-$(CONFIG_SCSI_PATA_OPTI) += libata.o pata_opti.o _ Patches currently in -mm which might be from alan@xxxxxxxxxxxxxxxxxxx are fix-and-enable-edac-sysfs-operation.patch fixes-for-piix-driver.patch 1-of-2-jmicron-driver.patch 2-of-2-jmicron-driver-plumbing-and-quirk.patch non-libata-driver-for-jmicron-devices.patch my-name-is-ingo-molnar-you-killed-my-make-allyesconfig-prepare-to-die.patch via-pata-controller-xfer-fixes.patch megaraid-gcc-41-warning-fix.patch edac-new-opteron-athlon64-memory-controller-driver.patch edac-new-opteron-athlon64-memory-controller-driver-tidy.patch sanitize-3c589_cs.patch ide-claim-extra-dma-ports-regardless-of-channel.patch ide-always-release-dma-engine.patch ide-error-handling-fixes.patch ide-hpt3xxn-clocking-fixes.patch ide-fix-hpt37x-timing-tables.patch ide-optimize-hpt37x-timing-tables.patch ide-fix-hpt3xx-hotswap-support.patch ide-fix-the-case-of-multiple-hpt3xx-chips-present.patch ide-hpt3xx-fix-pci-clock-detection.patch ide-hpt3xx-fix-pci-clock-detection-fix-2.patch piix-fix-82371mx-enablebits.patch piix-remove-check-for-broken-mw-dma-mode-0.patch piix-slc90e66-pio-mode-fallback-fix.patch make-number-of-ide-interfaces-configurable.patch ide_dma_speed-fixes.patch hpt3xx-rework-rate-filtering.patch hpt3xx-rework-rate-filtering-tidy.patch hpt3xx-print-the-real-chip-name-at-startup.patch hpt3xx-switch-to-using-pci_get_slot.patch hpt3xx-cache-channels-mcr-address.patch hpt3x7-merge-speedproc-handlers.patch hpt370-clean-up-dma-timeout-handling.patch enable-cdrom-dma-access-with-pdc20265_old.patch ide-fix-revision-comparison-in-ide_in_drive_list.patch ide-backport-piix-fixes-from-libata-into-the-legacy-driver.patch hpt3xx-init-code-rewrite.patch move-ide-to-unmaintained-drop-reference-to-old-git-tree.patch revert-tty-buffering-comment-out-debug-code.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html