diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index cf707029352e29ac034a118518b1632cc303c0c5..667acd283364503c328fd4dcd7c1dbadc2ac5d85 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -1250,6 +1250,7 @@ unsigned ata_exec_internal_sg(struct ata_device *dev, ata_sg_init(qc, sg, n_elem); qc->nsect = buflen / ATA_SECT_SIZE; + qc->nbytes = buflen; } qc->private_data = &wait; diff --git a/drivers/ata/pata_atiixp.c b/drivers/ata/pata_atiixp.c index 6f6672c551319a09ef998ca88889e5ba4998fe45..504e1dbfffd7d9d6581fe4432c8e266bcd70730e 100644 --- a/drivers/ata/pata_atiixp.c +++ b/drivers/ata/pata_atiixp.c @@ -36,15 +36,22 @@ enum { static int atiixp_pre_reset(struct ata_port *ap) { struct pci_dev *pdev = to_pci_dev(ap->host->dev); - static struct pci_bits atiixp_enable_bits[] = { + static const struct pci_bits atiixp_enable_bits[] = { { 0x48, 1, 0x01, 0x00 }, { 0x48, 1, 0x08, 0x00 } }; + u8 udma; if (!pci_test_config_bits(pdev, &atiixp_enable_bits[ap->port_no])) return -ENOENT; - ap->cbl = ATA_CBL_PATA80; + /* Hack from drivers/ide/pci. Really we want to know how to do the + raw detection not play follow the bios mode guess */ + pci_read_config_byte(pdev, ATIIXP_IDE_UDMA_MODE + ap->port_no, &udma); + if ((udma & 0x07) >= 0x04 || (udma & 0x70) >= 0x40) + ap->cbl = ATA_CBL_PATA80; + else + ap->cbl = ATA_CBL_PATA40; return ata_std_prereset(ap); } diff --git a/drivers/ata/pata_jmicron.c b/drivers/ata/pata_jmicron.c index 2d661cb4df3cd75470af0e98f58e2bbb42886191..d50264af284811d164b231f4a4d01e352b8751d0 100644 --- a/drivers/ata/pata_jmicron.c +++ b/drivers/ata/pata_jmicron.c @@ -204,20 +204,12 @@ static int jmicron_init_one (struct pci_dev *pdev, const struct pci_device_id *i u32 reg; - if (id->driver_data != 368) { - /* Put the controller into AHCI mode in case the AHCI driver - has not yet been loaded. This can be done with either - function present */ + /* PATA controller is fn 1, AHCI is fn 0 */ + if (id->driver_data != 368 && PCI_FUNC(pdev->devfn) != 1) + return -ENODEV; - /* FIXME: We may want a way to override this in future */ - pci_write_config_byte(pdev, 0x41, 0xa1); - - /* PATA controller is fn 1, AHCI is fn 0 */ - if (PCI_FUNC(pdev->devfn) != 1) - return -ENODEV; - } - if ( id->driver_data == 365 || id->driver_data == 366) { - /* The 365/66 have two PATA channels, redirect the second */ + /* The 365/66 have two PATA channels, redirect the second */ + if (id->driver_data == 365 || id->driver_data == 366) { pci_read_config_dword(pdev, 0x80, ®); reg |= (1 << 24); /* IDE1 to PATA IDE secondary */ pci_write_config_dword(pdev, 0x80, reg); diff --git a/drivers/ata/pata_via.c b/drivers/ata/pata_via.c index 0219419cae97878dfcbb56edfefcb10bd2519a00..f0b6c3b7142931a30cb3524a033fb021393a2c47 100644 --- a/drivers/ata/pata_via.c +++ b/drivers/ata/pata_via.c @@ -23,6 +23,7 @@ * VIA VT8233c - UDMA100 * VIA VT8235 - UDMA133 * VIA VT8237 - UDMA133 + * VIA VT8237S - UDMA133 * VIA VT8251 - UDMA133 * * Most registers remain compatible across chips. Others start reserved @@ -61,7 +62,7 @@ #include #define DRV_NAME "pata_via" -#define DRV_VERSION "0.2.0" +#define DRV_VERSION "0.2.1" /* * The following comes directly from Vojtech Pavlik's ide/pci/via82cxxx diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index dcc0c1ab95ed8de5723b1fbab68f4224c33aa719..c913ea4e545c3fd444a1ce0c776d3a1628a5d266 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -1262,8 +1262,8 @@ static void quirk_jmicron_dualfn(struct pci_dev *pdev) 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 */ + conf &= ~0x000FF200; /* Clear bit 9 and 12-19 */ + conf |= 0x00C2A102; /* Set 1, 8, 13, 15, 17, 22, 23 */ pci_write_config_dword(pdev, 0x40, conf); /* Reconfigure so that the PCI scanner discovers the diff --git a/include/linux/libata.h b/include/linux/libata.h index 22aa69e209057a56e67d17379c0c484214f6f5a6..91bb8ceef0b5ab04ce1a462e68505cc53942d1bf 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -1054,6 +1054,8 @@ static inline void ata_pause(struct ata_port *ap) /** * ata_busy_wait - Wait for a port status register * @ap: Port to wait for. + * @bits: bits that must be clear + * @max: number of 10uS waits to perform * * Waits up to max*10 microseconds for the selected bits in the port's * status register to be cleared.