From dbf0c89c80e47a2a132048dcded0dcc2a59c74ad Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Thu, 26 Jul 2007 18:43:01 +0100 Subject: [PATCH 1/7] pata_cmd64x: Correct the speed ranges I must have been half asleep when doing the original code Signed-off-by: Alan Cox Signed-off-by: Jeff Garzik --- drivers/ata/pata_cmd64x.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/ata/pata_cmd64x.c b/drivers/ata/pata_cmd64x.c index dc443e7dc37c..e34b632487d7 100644 --- a/drivers/ata/pata_cmd64x.c +++ b/drivers/ata/pata_cmd64x.c @@ -31,7 +31,7 @@ #include #define DRV_NAME "pata_cmd64x" -#define DRV_VERSION "0.2.3" +#define DRV_VERSION "0.2.4" /* * CMD64x specific registers definition. @@ -397,7 +397,7 @@ static int cmd64x_init_one(struct pci_dev *pdev, const struct pci_device_id *id) .flags = ATA_FLAG_SLAVE_POSS, .pio_mask = 0x1f, .mwdma_mask = 0x07, - .udma_mask = ATA_UDMA1, + .udma_mask = ATA_UDMA2, .port_ops = &cmd64x_port_ops }, { /* CMD 646 rev 1 */ @@ -412,7 +412,7 @@ static int cmd64x_init_one(struct pci_dev *pdev, const struct pci_device_id *id) .flags = ATA_FLAG_SLAVE_POSS, .pio_mask = 0x1f, .mwdma_mask = 0x07, - .udma_mask = ATA_UDMA2, + .udma_mask = ATA_UDMA4, .port_ops = &cmd648_port_ops }, { /* CMD 649 */ @@ -420,7 +420,7 @@ static int cmd64x_init_one(struct pci_dev *pdev, const struct pci_device_id *id) .flags = ATA_FLAG_SLAVE_POSS, .pio_mask = 0x1f, .mwdma_mask = 0x07, - .udma_mask = ATA_UDMA3, + .udma_mask = ATA_UDMA5, .port_ops = &cmd648_port_ops } }; From 6fdc99a224bd52020c602c3d4d57e5f8a75f6bb8 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Thu, 26 Jul 2007 18:41:30 +0100 Subject: [PATCH 2/7] libata-sff; Unbreak non DMA capable controllers again Seems nobody else is checking/testing this case as it keeps getting horked. If we have no BAR4 mapping on an SFF controller this is *NOT* an error, it just means it isn't doing BMDMA. Signed-off-by: Alan Cox Signed-off-by: Jeff Garzik --- drivers/ata/libata-sff.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c index 6c289c7b1322..1cce2198baaf 100644 --- a/drivers/ata/libata-sff.c +++ b/drivers/ata/libata-sff.c @@ -573,6 +573,10 @@ int ata_pci_init_bmdma(struct ata_host *host) struct pci_dev *pdev = to_pci_dev(gdev); int i, rc; + /* No BAR4 allocation: No DMA */ + if (pci_resource_start(pdev, 4) == 0) + return 0; + /* TODO: If we get no DMA mask we should fall back to PIO */ rc = pci_set_dma_mask(pdev, ATA_DMA_MASK); if (rc) From 0b62e13b5c9b4871641973e024cc9dd440b5bb58 Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Fri, 27 Jul 2007 14:43:35 +0900 Subject: [PATCH 3/7] pci: rename __pci_reenable_device() to pci_reenable_device() Rename __pci_reenable_device() to pci_reenable_device(). Signed-off-by: Tejun Heo Signed-off-by: Jeff Garzik --- drivers/ata/ata_piix.c | 6 +++--- drivers/pci/pci-driver.c | 2 +- drivers/pci/pci.c | 7 +++---- include/linux/pci.h | 2 +- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c index ad070861bb53..6089fbc5b89f 100644 --- a/drivers/ata/ata_piix.c +++ b/drivers/ata/ata_piix.c @@ -973,10 +973,10 @@ static int piix_pci_device_resume(struct pci_dev *pdev) pci_restore_state(pdev); /* PCI device wasn't disabled during suspend. Use - * __pci_reenable_device() to avoid affecting the - * enable count. + * pci_reenable_device() to avoid affecting the enable + * count. */ - rc = __pci_reenable_device(pdev); + rc = pci_reenable_device(pdev); if (rc) dev_printk(KERN_ERR, &pdev->dev, "failed to enable " "device after resume (%d)\n", rc); diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index 8e58ea3d95c0..004bc2487270 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c @@ -310,7 +310,7 @@ static int pci_default_resume(struct pci_dev *pci_dev) /* restore the PCI config space */ pci_restore_state(pci_dev); /* if the device was enabled before suspend, reenable */ - retval = __pci_reenable_device(pci_dev); + retval = pci_reenable_device(pci_dev); /* if the device was busmaster before the suspend, make it busmaster again */ if (pci_dev->is_busmaster) pci_set_master(pci_dev); diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 1ee9cd9c86e2..37c00f6fd801 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -695,14 +695,13 @@ static int do_pci_enable_device(struct pci_dev *dev, int bars) } /** - * __pci_reenable_device - Resume abandoned device + * pci_reenable_device - Resume abandoned device * @dev: PCI device to be resumed * * Note this function is a backend of pci_default_resume and is not supposed * to be called by normal code, write proper resume handler and use it instead. */ -int -__pci_reenable_device(struct pci_dev *dev) +int pci_reenable_device(struct pci_dev *dev) { if (atomic_read(&dev->enable_cnt)) return do_pci_enable_device(dev, (1 << PCI_NUM_RESOURCES) - 1); @@ -1604,7 +1603,7 @@ early_param("pci", pci_setup); device_initcall(pci_init); EXPORT_SYMBOL_GPL(pci_restore_bars); -EXPORT_SYMBOL(__pci_reenable_device); +EXPORT_SYMBOL(pci_reenable_device); EXPORT_SYMBOL(pci_enable_device_bars); EXPORT_SYMBOL(pci_enable_device); EXPORT_SYMBOL(pcim_enable_device); diff --git a/include/linux/pci.h b/include/linux/pci.h index d8f8a3a96644..e7d8d4e19a53 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -534,7 +534,7 @@ static inline int pci_write_config_dword(struct pci_dev *dev, int where, u32 val int __must_check pci_enable_device(struct pci_dev *dev); int __must_check pci_enable_device_bars(struct pci_dev *dev, int mask); -int __must_check __pci_reenable_device(struct pci_dev *); +int __must_check pci_reenable_device(struct pci_dev *); int __must_check pcim_enable_device(struct pci_dev *pdev); void pcim_pin_device(struct pci_dev *pdev); From 8c3832ebeb049c5744ece888daae253c683257c3 Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Fri, 27 Jul 2007 14:53:28 +0900 Subject: [PATCH 4/7] ata_piix: implement piix_borken_suspend() Separate out broken suspend blacklist matching into piix_broken_suspend(). Signed-off-by: Tejun Heo Signed-off-by: Jeff Garzik --- drivers/ata/ata_piix.c | 60 +++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c index 6089fbc5b89f..fb3b9594651d 100644 --- a/drivers/ata/ata_piix.c +++ b/drivers/ata/ata_piix.c @@ -890,37 +890,38 @@ static void ich_set_dmamode (struct ata_port *ap, struct ata_device *adev) } #ifdef CONFIG_PM -static struct dmi_system_id piix_broken_suspend_dmi_table[] = { - { - .ident = "TECRA M5", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), - DMI_MATCH(DMI_PRODUCT_NAME, "TECRA M5"), +static int piix_broken_suspend(void) +{ + static struct dmi_system_id sysids[] = { + { + .ident = "TECRA M5", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), + DMI_MATCH(DMI_PRODUCT_NAME, "TECRA M5"), + }, }, - }, - { - .ident = "Satellite U200", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), - DMI_MATCH(DMI_PRODUCT_NAME, "Satellite U200"), + { + .ident = "Satellite U205", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), + DMI_MATCH(DMI_PRODUCT_NAME, "Satellite U205"), + }, }, - }, - { - .ident = "Satellite U205", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), - DMI_MATCH(DMI_PRODUCT_NAME, "Satellite U205"), + { + .ident = "Portege M500", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), + DMI_MATCH(DMI_PRODUCT_NAME, "PORTEGE M500"), + }, }, - }, - { - .ident = "Portege M500", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), - DMI_MATCH(DMI_PRODUCT_NAME, "PORTEGE M500"), - }, - }, - { } -}; + { } + }; + + if (dmi_check_system(sysids)) + return 1; + + return 0; +} static int piix_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg) { @@ -937,8 +938,7 @@ static int piix_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg) * cycles and power trying to do something to the sleeping * beauty. */ - if (dmi_check_system(piix_broken_suspend_dmi_table) && - mesg.event == PM_EVENT_SUSPEND) { + if (piix_broken_suspend() && mesg.event == PM_EVENT_SUSPEND) { pci_save_state(pdev); /* mark its power state as "unknown", since we don't From 7abe79c353caf868053c2ddcada7f4c20c8251e6 Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Fri, 27 Jul 2007 14:55:07 +0900 Subject: [PATCH 5/7] ata_piix: add Tecra M3 to broken suspend blacklist Add Tecra M3 to the broken suspend blacklist. Tecra M3 doesn't have proper DMI_PRODUCT_NAME but has an OEM_STRING instead. Match it. Signed-off-by: Tejun Heo Signed-off-by: Jeff Garzik --- drivers/ata/ata_piix.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c index fb3b9594651d..a78832ea81fa 100644 --- a/drivers/ata/ata_piix.c +++ b/drivers/ata/ata_piix.c @@ -916,10 +916,18 @@ static int piix_broken_suspend(void) }, { } }; + static const char *oemstrs[] = { + "Tecra M3,", + }; + int i; if (dmi_check_system(sysids)) return 1; + for (i = 0; i < ARRAY_SIZE(oemstrs); i++) + if (dmi_find_device(DMI_DEV_TYPE_OEM_STRING, oemstrs[i], NULL)) + return 1; + return 0; } From 5d6aca8defe77dfd0f0169cc015b900129078648 Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Sat, 28 Jul 2007 16:25:25 +0900 Subject: [PATCH 6/7] libata: blacklist SAMSUNG HD401LJ / ZZ100-15 for NCQ SAMSUNG HD401LJ / ZZ100-15 does spurious completion of NCQ commands. Disable NCQ. Reported by Ulrich in bugzilla #8805. Signed-off-by: Tejun Heo Cc: Ulrich Signed-off-by: Jeff Garzik --- drivers/ata/libata-core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 6001aae0b884..60e78bef469f 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -3788,6 +3788,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { { "WDC WD740ADFD-00NLR1", NULL, ATA_HORKAGE_NONCQ, }, { "FUJITSU MHV2080BH", "00840028", ATA_HORKAGE_NONCQ, }, { "ST9160821AS", "3.CLF", ATA_HORKAGE_NONCQ, }, + { "SAMSUNG HD401LJ", "ZZ100-15", ATA_HORKAGE_NONCQ, }, /* Devices with NCQ limits */ From 4761c06cb39011c9cc3fef9e6bbfb4c50ceb307d Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Tue, 31 Jul 2007 22:02:41 +0200 Subject: [PATCH 7/7] pata_sis: fix MWDMA for <= UDMA66 chipsets and UDMA for UDMA33 chipsets * Fix MWDMA timings setup in sis_old_set_dmamode() and sis_66_set_dmamode(). The old timings were overclocked (even worse behavior than sis5513 IDE driver which depends on BIOS to program correct timings), the new timings are taken from the datasheet (they match timings from ATA spec). * Fix UDMA timings setup in sis_old_set_dmamode(). Misplaced pci_write_config_word() call resulted in UDMA timings never being set. * Fix comments for sis_133_early_set_dmamode() and sis_133_set_dmamode(): - only the former function handles early SiS 961 bridges - both functions lack MWDMA timings setup * Fix typos in sis_100_set_piomode() and sis_133_set_piomode() comments. * Bump driver version. Cc: Alan Cox Signed-off-by: Bartlomiej Zolnierkiewicz Signed-off-by: Jeff Garzik --- drivers/ata/pata_sis.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/drivers/ata/pata_sis.c b/drivers/ata/pata_sis.c index 9a829a7cbc60..66bd0e83ac07 100644 --- a/drivers/ata/pata_sis.c +++ b/drivers/ata/pata_sis.c @@ -2,6 +2,7 @@ * pata_sis.c - SiS ATA driver * * (C) 2005 Red Hat + * (C) 2007 Bartlomiej Zolnierkiewicz * * Based upon linux/drivers/ide/pci/sis5513.c * Copyright (C) 1999-2000 Andre Hedrick @@ -35,7 +36,7 @@ #include "sis.h" #define DRV_NAME "pata_sis" -#define DRV_VERSION "0.5.1" +#define DRV_VERSION "0.5.2" struct sis_chipset { u16 device; /* PCI host ID */ @@ -237,7 +238,7 @@ static void sis_old_set_piomode (struct ata_port *ap, struct ata_device *adev) } /** - * sis_100_set_pioode - Initialize host controller PATA PIO timings + * sis_100_set_piomode - Initialize host controller PATA PIO timings * @ap: Port whose timings we are configuring * @adev: Device we are configuring for. * @@ -262,7 +263,7 @@ static void sis_100_set_piomode (struct ata_port *ap, struct ata_device *adev) } /** - * sis_133_set_pioode - Initialize host controller PATA PIO timings + * sis_133_set_piomode - Initialize host controller PATA PIO timings * @ap: Port whose timings we are configuring * @adev: Device we are configuring for. * @@ -334,7 +335,7 @@ static void sis_old_set_dmamode (struct ata_port *ap, struct ata_device *adev) int drive_pci = sis_old_port_base(adev); u16 timing; - const u16 mwdma_bits[] = { 0x707, 0x202, 0x202 }; + const u16 mwdma_bits[] = { 0x008, 0x302, 0x301 }; const u16 udma_bits[] = { 0xE000, 0xC000, 0xA000 }; pci_read_config_word(pdev, drive_pci, &timing); @@ -342,15 +343,15 @@ static void sis_old_set_dmamode (struct ata_port *ap, struct ata_device *adev) if (adev->dma_mode < XFER_UDMA_0) { /* bits 3-0 hold recovery timing bits 8-10 active timing and the higer bits are dependant on the device */ - timing &= ~ 0x870F; + timing &= ~0x870F; timing |= mwdma_bits[speed]; - pci_write_config_word(pdev, drive_pci, timing); } else { /* Bit 15 is UDMA on/off, bit 13-14 are cycle time */ speed = adev->dma_mode - XFER_UDMA_0; timing &= ~0x6000; timing |= udma_bits[speed]; } + pci_write_config_word(pdev, drive_pci, timing); } /** @@ -373,7 +374,7 @@ static void sis_66_set_dmamode (struct ata_port *ap, struct ata_device *adev) int drive_pci = sis_old_port_base(adev); u16 timing; - const u16 mwdma_bits[] = { 0x707, 0x202, 0x202 }; + const u16 mwdma_bits[] = { 0x008, 0x302, 0x301 }; const u16 udma_bits[] = { 0xF000, 0xD000, 0xB000, 0xA000, 0x9000}; pci_read_config_word(pdev, drive_pci, &timing); @@ -432,8 +433,7 @@ static void sis_100_set_dmamode (struct ata_port *ap, struct ata_device *adev) * @adev: Device to program * * Set UDMA/MWDMA mode for device, in host controller PCI config space. - * Handles early SiS 961 bridges. Supports MWDMA as well unlike - * the old ide/pci driver. + * Handles early SiS 961 bridges. * * LOCKING: * None (inherited from caller). @@ -467,8 +467,6 @@ static void sis_133_early_set_dmamode (struct ata_port *ap, struct ata_device *a * @adev: Device to program * * Set UDMA/MWDMA mode for device, in host controller PCI config space. - * Handles early SiS 961 bridges. Supports MWDMA as well unlike - * the old ide/pci driver. * * LOCKING: * None (inherited from caller).