Commit a419df8a authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev

* 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev:
  libata: clean up the SFF code for coding style
  libata: Add 32bit PIO support
  [libata] ahci: Withdraw IGN_SERR_INTERNAL for SB800 SATA
  pata_hpt366: reimplement mode programming
  [libata] pata_hpt3x3: correct _freeze() function declaration
  libata: Add special ata_pio_need_iordy() handling for Compact Flash.
  pata_platform: __pata_platform_remove() shouldn't be in discard section
  sata_sil24: remove unused sil24_port_multiplier
  [libata] ahci: Add SATA GEN3 related messages
  ata_piix: save, use saved and restore IOCFG
  pata_ali: Fix and workaround for FIFO DMA bug
  pata_ali: force initialise a few bits
  pata_hpt3x3: Workarounds for chipset
parents 33b04b93 0fe40ff8
...@@ -105,7 +105,7 @@ enum { ...@@ -105,7 +105,7 @@ enum {
board_ahci_ign_iferr = 2, board_ahci_ign_iferr = 2,
board_ahci_sb600 = 3, board_ahci_sb600 = 3,
board_ahci_mv = 4, board_ahci_mv = 4,
board_ahci_sb700 = 5, board_ahci_sb700 = 5, /* for SB700 and SB800 */
board_ahci_mcp65 = 6, board_ahci_mcp65 = 6,
board_ahci_nopmp = 7, board_ahci_nopmp = 7,
...@@ -439,7 +439,7 @@ static const struct ata_port_info ahci_port_info[] = { ...@@ -439,7 +439,7 @@ static const struct ata_port_info ahci_port_info[] = {
.udma_mask = ATA_UDMA6, .udma_mask = ATA_UDMA6,
.port_ops = &ahci_ops, .port_ops = &ahci_ops,
}, },
/* board_ahci_sb700 */ /* board_ahci_sb700, for SB700 and SB800 */
{ {
AHCI_HFLAGS (AHCI_HFLAG_IGN_SERR_INTERNAL), AHCI_HFLAGS (AHCI_HFLAG_IGN_SERR_INTERNAL),
.flags = AHCI_FLAG_COMMON, .flags = AHCI_FLAG_COMMON,
...@@ -2446,6 +2446,8 @@ static void ahci_print_info(struct ata_host *host) ...@@ -2446,6 +2446,8 @@ static void ahci_print_info(struct ata_host *host)
speed_s = "1.5"; speed_s = "1.5";
else if (speed == 2) else if (speed == 2)
speed_s = "3"; speed_s = "3";
else if (speed == 3)
speed_s = "6";
else else
speed_s = "?"; speed_s = "?";
...@@ -2610,6 +2612,10 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -2610,6 +2612,10 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
(pdev->revision == 0xa1 || pdev->revision == 0xa2)) (pdev->revision == 0xa1 || pdev->revision == 0xa2))
hpriv->flags |= AHCI_HFLAG_NO_MSI; hpriv->flags |= AHCI_HFLAG_NO_MSI;
/* SB800 does NOT need the workaround to ignore SERR_INTERNAL */
if (board_id == board_ahci_sb700 && pdev->revision >= 0x40)
hpriv->flags &= ~AHCI_HFLAG_IGN_SERR_INTERNAL;
if ((hpriv->flags & AHCI_HFLAG_NO_MSI) || pci_enable_msi(pdev)) if ((hpriv->flags & AHCI_HFLAG_NO_MSI) || pci_enable_msi(pdev))
pci_intx(pdev, 1); pci_intx(pdev, 1);
......
...@@ -154,11 +154,13 @@ struct piix_map_db { ...@@ -154,11 +154,13 @@ struct piix_map_db {
struct piix_host_priv { struct piix_host_priv {
const int *map; const int *map;
u32 saved_iocfg;
void __iomem *sidpr; void __iomem *sidpr;
}; };
static int piix_init_one(struct pci_dev *pdev, static int piix_init_one(struct pci_dev *pdev,
const struct pci_device_id *ent); const struct pci_device_id *ent);
static void piix_remove_one(struct pci_dev *pdev);
static int piix_pata_prereset(struct ata_link *link, unsigned long deadline); static int piix_pata_prereset(struct ata_link *link, unsigned long deadline);
static void piix_set_piomode(struct ata_port *ap, struct ata_device *adev); static void piix_set_piomode(struct ata_port *ap, struct ata_device *adev);
static void piix_set_dmamode(struct ata_port *ap, struct ata_device *adev); static void piix_set_dmamode(struct ata_port *ap, struct ata_device *adev);
...@@ -296,7 +298,7 @@ static struct pci_driver piix_pci_driver = { ...@@ -296,7 +298,7 @@ static struct pci_driver piix_pci_driver = {
.name = DRV_NAME, .name = DRV_NAME,
.id_table = piix_pci_tbl, .id_table = piix_pci_tbl,
.probe = piix_init_one, .probe = piix_init_one,
.remove = ata_pci_remove_one, .remove = piix_remove_one,
#ifdef CONFIG_PM #ifdef CONFIG_PM
.suspend = piix_pci_device_suspend, .suspend = piix_pci_device_suspend,
.resume = piix_pci_device_resume, .resume = piix_pci_device_resume,
...@@ -308,7 +310,7 @@ static struct scsi_host_template piix_sht = { ...@@ -308,7 +310,7 @@ static struct scsi_host_template piix_sht = {
}; };
static struct ata_port_operations piix_pata_ops = { static struct ata_port_operations piix_pata_ops = {
.inherits = &ata_bmdma_port_ops, .inherits = &ata_bmdma32_port_ops,
.cable_detect = ata_cable_40wire, .cable_detect = ata_cable_40wire,
.set_piomode = piix_set_piomode, .set_piomode = piix_set_piomode,
.set_dmamode = piix_set_dmamode, .set_dmamode = piix_set_dmamode,
...@@ -610,8 +612,9 @@ static const struct ich_laptop ich_laptop[] = { ...@@ -610,8 +612,9 @@ static const struct ich_laptop ich_laptop[] = {
static int ich_pata_cable_detect(struct ata_port *ap) static int ich_pata_cable_detect(struct ata_port *ap)
{ {
struct pci_dev *pdev = to_pci_dev(ap->host->dev); struct pci_dev *pdev = to_pci_dev(ap->host->dev);
struct piix_host_priv *hpriv = ap->host->private_data;
const struct ich_laptop *lap = &ich_laptop[0]; const struct ich_laptop *lap = &ich_laptop[0];
u8 tmp, mask; u8 mask;
/* Check for specials - Acer Aspire 5602WLMi */ /* Check for specials - Acer Aspire 5602WLMi */
while (lap->device) { while (lap->device) {
...@@ -625,8 +628,7 @@ static int ich_pata_cable_detect(struct ata_port *ap) ...@@ -625,8 +628,7 @@ static int ich_pata_cable_detect(struct ata_port *ap)
/* check BIOS cable detect results */ /* check BIOS cable detect results */
mask = ap->port_no == 0 ? PIIX_80C_PRI : PIIX_80C_SEC; mask = ap->port_no == 0 ? PIIX_80C_PRI : PIIX_80C_SEC;
pci_read_config_byte(pdev, PIIX_IOCFG, &tmp); if ((hpriv->saved_iocfg & mask) == 0)
if ((tmp & mask) == 0)
return ATA_CBL_PATA40; return ATA_CBL_PATA40;
return ATA_CBL_PATA80; return ATA_CBL_PATA80;
} }
...@@ -1350,7 +1352,7 @@ static int __devinit piix_init_sidpr(struct ata_host *host) ...@@ -1350,7 +1352,7 @@ static int __devinit piix_init_sidpr(struct ata_host *host)
return 0; return 0;
} }
static void piix_iocfg_bit18_quirk(struct pci_dev *pdev) static void piix_iocfg_bit18_quirk(struct ata_host *host)
{ {
static const struct dmi_system_id sysids[] = { static const struct dmi_system_id sysids[] = {
{ {
...@@ -1367,7 +1369,8 @@ static void piix_iocfg_bit18_quirk(struct pci_dev *pdev) ...@@ -1367,7 +1369,8 @@ static void piix_iocfg_bit18_quirk(struct pci_dev *pdev)
{ } /* terminate list */ { } /* terminate list */
}; };
u32 iocfg; struct pci_dev *pdev = to_pci_dev(host->dev);
struct piix_host_priv *hpriv = host->private_data;
if (!dmi_check_system(sysids)) if (!dmi_check_system(sysids))
return; return;
...@@ -1376,12 +1379,11 @@ static void piix_iocfg_bit18_quirk(struct pci_dev *pdev) ...@@ -1376,12 +1379,11 @@ static void piix_iocfg_bit18_quirk(struct pci_dev *pdev)
* seem to use it to disable a channel. Clear the bit on the * seem to use it to disable a channel. Clear the bit on the
* affected systems. * affected systems.
*/ */
pci_read_config_dword(pdev, PIIX_IOCFG, &iocfg); if (hpriv->saved_iocfg & (1 << 18)) {
if (iocfg & (1 << 18)) {
dev_printk(KERN_INFO, &pdev->dev, dev_printk(KERN_INFO, &pdev->dev,
"applying IOCFG bit18 quirk\n"); "applying IOCFG bit18 quirk\n");
iocfg &= ~(1 << 18); pci_write_config_dword(pdev, PIIX_IOCFG,
pci_write_config_dword(pdev, PIIX_IOCFG, iocfg); hpriv->saved_iocfg & ~(1 << 18));
} }
} }
...@@ -1430,6 +1432,17 @@ static int __devinit piix_init_one(struct pci_dev *pdev, ...@@ -1430,6 +1432,17 @@ static int __devinit piix_init_one(struct pci_dev *pdev,
if (rc) if (rc)
return rc; return rc;
hpriv = devm_kzalloc(dev, sizeof(*hpriv), GFP_KERNEL);
if (!hpriv)
return -ENOMEM;
/* Save IOCFG, this will be used for cable detection, quirk
* detection and restoration on detach. This is necessary
* because some ACPI implementations mess up cable related
* bits on _STM. Reported on kernel bz#11879.
*/
pci_read_config_dword(pdev, PIIX_IOCFG, &hpriv->saved_iocfg);
/* ICH6R may be driven by either ata_piix or ahci driver /* ICH6R may be driven by either ata_piix or ahci driver
* regardless of BIOS configuration. Make sure AHCI mode is * regardless of BIOS configuration. Make sure AHCI mode is
* off. * off.
...@@ -1441,10 +1454,6 @@ static int __devinit piix_init_one(struct pci_dev *pdev, ...@@ -1441,10 +1454,6 @@ static int __devinit piix_init_one(struct pci_dev *pdev,
} }
/* SATA map init can change port_info, do it before prepping host */ /* SATA map init can change port_info, do it before prepping host */
hpriv = devm_kzalloc(dev, sizeof(*hpriv), GFP_KERNEL);
if (!hpriv)
return -ENOMEM;
if (port_flags & ATA_FLAG_SATA) if (port_flags & ATA_FLAG_SATA)
hpriv->map = piix_init_sata_map(pdev, port_info, hpriv->map = piix_init_sata_map(pdev, port_info,
piix_map_db_table[ent->driver_data]); piix_map_db_table[ent->driver_data]);
...@@ -1463,7 +1472,7 @@ static int __devinit piix_init_one(struct pci_dev *pdev, ...@@ -1463,7 +1472,7 @@ static int __devinit piix_init_one(struct pci_dev *pdev,
} }
/* apply IOCFG bit18 quirk */ /* apply IOCFG bit18 quirk */
piix_iocfg_bit18_quirk(pdev); piix_iocfg_bit18_quirk(host);
/* On ICH5, some BIOSen disable the interrupt using the /* On ICH5, some BIOSen disable the interrupt using the
* PCI_COMMAND_INTX_DISABLE bit added in PCI 2.3. * PCI_COMMAND_INTX_DISABLE bit added in PCI 2.3.
...@@ -1488,6 +1497,16 @@ static int __devinit piix_init_one(struct pci_dev *pdev, ...@@ -1488,6 +1497,16 @@ static int __devinit piix_init_one(struct pci_dev *pdev,
return ata_pci_sff_activate_host(host, ata_sff_interrupt, &piix_sht); return ata_pci_sff_activate_host(host, ata_sff_interrupt, &piix_sht);
} }
static void piix_remove_one(struct pci_dev *pdev)
{
struct ata_host *host = dev_get_drvdata(&pdev->dev);
struct piix_host_priv *hpriv = host->private_data;
pci_write_config_dword(pdev, PIIX_IOCFG, hpriv->saved_iocfg);
ata_pci_remove_one(pdev);
}
static int __init piix_init(void) static int __init piix_init(void)
{ {
int rc; int rc;
......
...@@ -1007,6 +1007,7 @@ static const char *sata_spd_string(unsigned int spd) ...@@ -1007,6 +1007,7 @@ static const char *sata_spd_string(unsigned int spd)
static const char * const spd_str[] = { static const char * const spd_str[] = {
"1.5 Gbps", "1.5 Gbps",
"3.0 Gbps", "3.0 Gbps",
"6.0 Gbps",
}; };
if (spd == 0 || (spd - 1) >= ARRAY_SIZE(spd_str)) if (spd == 0 || (spd - 1) >= ARRAY_SIZE(spd_str))
...@@ -2000,6 +2001,10 @@ unsigned int ata_pio_need_iordy(const struct ata_device *adev) ...@@ -2000,6 +2001,10 @@ unsigned int ata_pio_need_iordy(const struct ata_device *adev)
as the caller should know this */ as the caller should know this */
if (adev->link->ap->flags & ATA_FLAG_NO_IORDY) if (adev->link->ap->flags & ATA_FLAG_NO_IORDY)
return 0; return 0;
/* CF spec. r4.1 Table 22 says no iordy on PIO5 and PIO6. */
if (ata_id_is_cfa(adev->id)
&& (adev->pio_mode == XFER_PIO_5 || adev->pio_mode == XFER_PIO_6))
return 0;
/* PIO3 and higher it is mandatory */ /* PIO3 and higher it is mandatory */
if (adev->pio_mode > XFER_PIO_2) if (adev->pio_mode > XFER_PIO_2)
return 1; return 1;
......
This diff is collapsed.
...@@ -19,7 +19,9 @@ ...@@ -19,7 +19,9 @@
* *
* TODO/CHECK * TODO/CHECK
* Cannot have ATAPI on both master & slave for rev < c2 (???) but * Cannot have ATAPI on both master & slave for rev < c2 (???) but
* otherwise should do atapi DMA. * otherwise should do atapi DMA (For now for old we do PIO only for
* ATAPI)
* Review Sunblade workaround.
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -33,12 +35,14 @@ ...@@ -33,12 +35,14 @@
#include <linux/dmi.h> #include <linux/dmi.h>
#define DRV_NAME "pata_ali" #define DRV_NAME "pata_ali"
#define DRV_VERSION "0.7.5" #define DRV_VERSION "0.7.8"
static int ali_atapi_dma = 0; static int ali_atapi_dma = 0;
module_param_named(atapi_dma, ali_atapi_dma, int, 0644); module_param_named(atapi_dma, ali_atapi_dma, int, 0644);
MODULE_PARM_DESC(atapi_dma, "Enable ATAPI DMA (0=disable, 1=enable)"); MODULE_PARM_DESC(atapi_dma, "Enable ATAPI DMA (0=disable, 1=enable)");
static struct pci_dev *isa_bridge;
/* /*
* Cable special cases * Cable special cases
*/ */
...@@ -147,8 +151,7 @@ static void ali_fifo_control(struct ata_port *ap, struct ata_device *adev, int o ...@@ -147,8 +151,7 @@ static void ali_fifo_control(struct ata_port *ap, struct ata_device *adev, int o
pci_read_config_byte(pdev, pio_fifo, &fifo); pci_read_config_byte(pdev, pio_fifo, &fifo);
fifo &= ~(0x0F << shift); fifo &= ~(0x0F << shift);
if (on) fifo |= (on << shift);
fifo |= (on << shift);
pci_write_config_byte(pdev, pio_fifo, fifo); pci_write_config_byte(pdev, pio_fifo, fifo);
} }
...@@ -337,6 +340,23 @@ static int ali_check_atapi_dma(struct ata_queued_cmd *qc) ...@@ -337,6 +340,23 @@ static int ali_check_atapi_dma(struct ata_queued_cmd *qc)
return 0; return 0;
} }
static void ali_c2_c3_postreset(struct ata_link *link, unsigned int *classes)
{
u8 r;
int port_bit = 4 << link->ap->port_no;
/* If our bridge is an ALI 1533 then do the extra work */
if (isa_bridge) {
/* Tristate and re-enable the bus signals */
pci_read_config_byte(isa_bridge, 0x58, &r);
r &= ~port_bit;
pci_write_config_byte(isa_bridge, 0x58, r);
r |= port_bit;
pci_write_config_byte(isa_bridge, 0x58, r);
}
ata_sff_postreset(link, classes);
}
static struct scsi_host_template ali_sht = { static struct scsi_host_template ali_sht = {
ATA_BMDMA_SHT(DRV_NAME), ATA_BMDMA_SHT(DRV_NAME),
}; };
...@@ -349,10 +369,11 @@ static struct ata_port_operations ali_early_port_ops = { ...@@ -349,10 +369,11 @@ static struct ata_port_operations ali_early_port_ops = {
.inherits = &ata_sff_port_ops, .inherits = &ata_sff_port_ops,
.cable_detect = ata_cable_40wire, .cable_detect = ata_cable_40wire,
.set_piomode = ali_set_piomode, .set_piomode = ali_set_piomode,
.sff_data_xfer = ata_sff_data_xfer32,
}; };
static const struct ata_port_operations ali_dma_base_ops = { static const struct ata_port_operations ali_dma_base_ops = {
.inherits = &ata_bmdma_port_ops, .inherits = &ata_bmdma32_port_ops,
.set_piomode = ali_set_piomode, .set_piomode = ali_set_piomode,
.set_dmamode = ali_set_dmamode, .set_dmamode = ali_set_dmamode,
}; };
...@@ -377,6 +398,17 @@ static struct ata_port_operations ali_c2_port_ops = { ...@@ -377,6 +398,17 @@ static struct ata_port_operations ali_c2_port_ops = {
.check_atapi_dma = ali_check_atapi_dma, .check_atapi_dma = ali_check_atapi_dma,
.cable_detect = ali_c2_cable_detect, .cable_detect = ali_c2_cable_detect,
.dev_config = ali_lock_sectors, .dev_config = ali_lock_sectors,
.postreset = ali_c2_c3_postreset,
};
/*
* Port operations for DMA capable ALi with cable detect
*/
static struct ata_port_operations ali_c4_port_ops = {
.inherits = &ali_dma_base_ops,
.check_atapi_dma = ali_check_atapi_dma,
.cable_detect = ali_c2_cable_detect,
.dev_config = ali_lock_sectors,
}; };
/* /*
...@@ -401,52 +433,49 @@ static struct ata_port_operations ali_c5_port_ops = { ...@@ -401,52 +433,49 @@ static struct ata_port_operations ali_c5_port_ops = {
static void ali_init_chipset(struct pci_dev *pdev) static void ali_init_chipset(struct pci_dev *pdev)
{ {
u8 tmp; u8 tmp;
struct pci_dev *north, *isa_bridge; struct pci_dev *north;
/* /*
* The chipset revision selects the driver operations and * The chipset revision selects the driver operations and
* mode data. * mode data.
*/ */
if (pdev->revision >= 0x20 && pdev->revision < 0xC2) { if (pdev->revision <= 0x20) {
/* 1543-E/F, 1543C-C, 1543C-D, 1543C-E */ pci_read_config_byte(pdev, 0x53, &tmp);
pci_read_config_byte(pdev, 0x4B, &tmp); tmp |= 0x03;
/* Clear CD-ROM DMA write bit */ pci_write_config_byte(pdev, 0x53, tmp);
tmp &= 0x7F; } else {
pci_write_config_byte(pdev, 0x4B, tmp); pci_read_config_byte(pdev, 0x4a, &tmp);
} else if (pdev->revision >= 0xC2) { pci_write_config_byte(pdev, 0x4a, tmp | 0x20);
/* Enable cable detection logic */
pci_read_config_byte(pdev, 0x4B, &tmp); pci_read_config_byte(pdev, 0x4B, &tmp);
pci_write_config_byte(pdev, 0x4B, tmp | 0x08); if (pdev->revision < 0xC2)
} /* 1543-E/F, 1543C-C, 1543C-D, 1543C-E */
north = pci_get_bus_and_slot(0, PCI_DEVFN(0,0)); /* Clear CD-ROM DMA write bit */
isa_bridge = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, NULL); tmp &= 0x7F;
/* Cable and UDMA */
if (north && north->vendor == PCI_VENDOR_ID_AL && isa_bridge) { pci_write_config_byte(pdev, 0x4B, tmp | 0x09);
/* Configure the ALi bridge logic. For non ALi rely on BIOS.
Set the south bridge enable bit */
pci_read_config_byte(isa_bridge, 0x79, &tmp);
if (pdev->revision == 0xC2)
pci_write_config_byte(isa_bridge, 0x79, tmp | 0x04);
else if (pdev->revision > 0xC2 && pdev->revision < 0xC5)
pci_write_config_byte(isa_bridge, 0x79, tmp | 0x02);
}
if (pdev->revision >= 0x20) {
/* /*
* CD_ROM DMA on (0x53 bit 0). Enable this even if we want * CD_ROM DMA on (0x53 bit 0). Enable this even if we want
* to use PIO. 0x53 bit 1 (rev 20 only) - enable FIFO control * to use PIO. 0x53 bit 1 (rev 20 only) - enable FIFO control
* via 0x54/55. * via 0x54/55.
*/ */
pci_read_config_byte(pdev, 0x53, &tmp); pci_read_config_byte(pdev, 0x53, &tmp);
if (pdev->revision <= 0x20)
tmp &= ~0x02;
if (pdev->revision >= 0xc7) if (pdev->revision >= 0xc7)
tmp |= 0x03; tmp |= 0x03;
else else
tmp |= 0x01; /* CD_ROM enable for DMA */ tmp |= 0x01; /* CD_ROM enable for DMA */
pci_write_config_byte(pdev, 0x53, tmp); pci_write_config_byte(pdev, 0x53, tmp);
} }
pci_dev_put(isa_bridge); north = pci_get_bus_and_slot(0, PCI_DEVFN(0,0));
if (north && north->vendor == PCI_VENDOR_ID_AL && isa_bridge) {
/* Configure the ALi bridge logic. For non ALi rely on BIOS.
Set the south bridge enable bit */
pci_read_config_byte(isa_bridge, 0x79, &tmp);
if (pdev->revision == 0xC2)
pci_write_config_byte(isa_bridge, 0x79, tmp | 0x04);
else if (pdev->revision > 0xC2 && pdev->revision < 0xC5)
pci_write_config_byte(isa_bridge, 0x79, tmp | 0x02);
}
pci_dev_put(north); pci_dev_put(north);
ata_pci_bmdma_clear_simplex(pdev); ata_pci_bmdma_clear_simplex(pdev);
} }
...@@ -503,7 +532,7 @@ static int ali_init_one(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -503,7 +532,7 @@ static int ali_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
.pio_mask = 0x1f, .pio_mask = 0x1f,
.mwdma_mask = 0x07, .mwdma_mask = 0x07,
.udma_mask = ATA_UDMA5, .udma_mask = ATA_UDMA5,
.port_ops = &ali_c2_port_ops .port_ops = &ali_c4_port_ops
}; };
/* Revision 0xC5 is UDMA133 with LBA48 DMA */ /* Revision 0xC5 is UDMA133 with LBA48 DMA */
static const struct ata_port_info info_c5 = { static const struct ata_port_info info_c5 = {
...@@ -516,7 +545,6 @@ static int ali_init_one(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -516,7 +545,6 @@ static int ali_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
const struct ata_port_info *ppi[] = { NULL, NULL }; const struct ata_port_info *ppi[] = { NULL, NULL };
u8 tmp; u8 tmp;
struct pci_dev *isa_bridge;
int rc; int rc;
rc = pcim_enable_device(pdev); rc = pcim_enable_device(pdev);
...@@ -543,14 +571,12 @@ static int ali_init_one(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -543,14 +571,12 @@ static int ali_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
ali_init_chipset(pdev); ali_init_chipset(pdev);
isa_bridge = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, NULL);
if (isa_bridge && pdev->revision >= 0x20 && pdev->revision < 0xC2) { if (isa_bridge && pdev->revision >= 0x20 && pdev->revision < 0xC2) {
/* Are we paired with a UDMA capable chip */ /* Are we paired with a UDMA capable chip */
pci_read_config_byte(isa_bridge, 0x5E, &tmp); pci_read_config_byte(isa_bridge, 0x5E, &tmp);
if ((tmp & 0x1E) == 0x12) if ((tmp & 0x1E) == 0x12)
ppi[0] = &info_20_udma; ppi[0] = &info_20_udma;
} }
pci_dev_put(isa_bridge);
return ata_pci_sff_init_one(pdev, ppi, &ali_sht, NULL); return ata_pci_sff_init_one(pdev, ppi, &ali_sht, NULL);
} }
...@@ -590,13 +616,20 @@ static struct pci_driver ali_pci_driver = { ...@@ -590,13 +616,20 @@ static struct pci_driver ali_pci_driver = {
static int __init ali_init(void) static int __init ali_init(void)
{ {
return pci_register_driver(&ali_pci_driver); int ret;
isa_bridge = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, NULL);
ret = pci_register_driver(&ali_pci_driver);
if (ret < 0)
pci_dev_put(isa_bridge);
return ret;
} }
static void __exit ali_exit(void) static void __exit ali_exit(void)
{ {
pci_unregister_driver(&ali_pci_driver); pci_unregister_driver(&ali_pci_driver);
pci_dev_put(isa_bridge);
} }
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include <linux/libata.h> #include <linux/libata.h>
#define DRV_NAME "pata_amd" #define DRV_NAME "pata_amd"
#define DRV_VERSION "0.3.10" #define DRV_VERSION "0.3.11"
/** /**
* timing_setup - shared timing computation and load * timing_setup - shared timing computation and load
...@@ -345,7 +345,7 @@ static struct scsi_host_template amd_sht = { ...@@ -345,7 +345,7 @@ static struct scsi_host_template amd_sht = {
}; };
static const struct ata_port_operations amd_base_port_ops = { static const struct ata_port_operations amd_base_port_ops = {
.inherits = &ata_bmdma_port_ops, .inherits = &ata_bmdma32_port_ops,
.prereset = amd_pre_reset, .prereset = amd_pre_reset,
}; };
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#define DRV_VERSION "0.6.2" #define DRV_VERSION "0.6.2"
struct hpt_clock { struct hpt_clock {
u8 xfer_speed; u8 xfer_mode;
u32 timing; u32 timing;
}; };
...@@ -189,28 +189,6 @@ static unsigned long hpt366_filter(struct ata_device *adev, unsigned long mask) ...@@ -189,28 +189,6 @@ static unsigned long hpt366_filter(struct ata_device *adev, unsigned long mask)
return ata_bmdma_mode_filter(adev, mask); return ata_bmdma_mode_filter(adev, mask);
} }
/**
* hpt36x_find_mode - reset the hpt36x bus
* @ap: ATA port
* @speed: transfer mode
*
* Return the 32bit register programming information for this channel
* that matches the speed provided.
*/
static u32 hpt36x_find_mode(struct ata_port *ap, int speed)
{
struct hpt_clock *clocks = ap->host->private_data;
while(clocks->xfer_speed) {
if (clocks->xfer_speed == speed)
return clocks->timing;
clocks++;
}
BUG();
return 0xffffffffU; /* silence compiler warning */
}
static int hpt36x_cable_detect(struct ata_port *ap) static int hpt36x_cable_detect(struct ata_port *ap)
{ {
struct pci_dev *pdev = to_pci_dev(ap->host->dev); struct pci_dev *pdev = to_pci_dev(ap->host->dev);
...@@ -226,25 +204,16 @@ static int hpt36x_cable_detect(struct ata_port *ap) ...@@ -226,25 +204,16 @@ static int hpt36x_cable_detect(struct ata_port *ap)
return ATA_CBL_PATA80; return ATA_CBL_PATA80;
} }
/** static void hpt366_set_mode(struct ata_port *ap, struct ata_device *adev,
* hpt366_set_piomode - PIO setup u8 mode)
* @ap: ATA interface
* @adev: device on the interface
*
* Perform PIO mode setup.
*/
static void hpt366_set_piomode(struct ata_port *ap, struct ata_device *adev)
{ {
struct hpt_clock *clocks = ap->host->private_data;
struct pci_dev *pdev = to_pci_dev(ap->host->dev); struct pci_dev *pdev = to_pci_dev(ap->host->dev);
u32 addr1, addr2; u32 addr1 = 0x40 + 4 * (adev->devno + 2 * ap->port_no);
u32 reg; u32 addr2 = 0x51 + 4 * ap->port_no;
u32 mode; u32 mask, reg;
u8 fast; u8 fast;
addr1 = 0x40 + 4 * (adev->devno + 2 * ap->port_no);
addr2 = 0x51 + 4 * ap->port_no;
/* Fast interrupt prediction disable, hold off interrupt disable */ /* Fast interrupt prediction disable, hold off interrupt disable */
pci_read_config_byte(pdev, addr2, &fast); pci_read_config_byte(pdev, addr2, &fast);
if (fast & 0x80) { if (fast & 0x80) {
...@@ -252,12 +221,43 @@ static void hpt366_set_piomode(struct ata_port *ap, struct ata_device *adev) ...@@ -252,12 +221,43 @@ static void hpt366_set_piomode(struct ata_port *ap, struct ata_device *adev)
pci_write_config_byte(pdev, addr2, fast); pci_write_config_byte(pdev, addr2, fast);
} }
/* determine timing mask and find matching clock entry */
if (mode < XFER_MW_DMA_0)
mask = 0xc1f8ffff;
else if (mode < XFER_UDMA_0)
mask = 0x303800ff;
else
mask = 0x30070000;
while (clocks->xfer_mode) {
if (clocks->xfer_mode == mode)
break;
clocks++;
}
if (!clocks->xfer_mode)
BUG();
/*
* Combine new mode bits with old config bits and disable
* on-chip PIO FIFO/buffer (and PIO MST mode as well) to avoid
* problems handling I/O errors later.
*/
pci_read_config_dword(pdev, addr1, &reg); pci_read_config_dword(pdev, addr1, &reg);
mode = hpt36x_find_mode(ap, adev->pio_mode); reg = ((reg & ~mask) | (clocks->timing & mask)) & ~0xc0000000;
mode &= ~0x8000000; /* No FIFO in PIO */ pci_write_config_dword(pdev, addr1, reg);
mode &= ~0x30070000; /* Leave config bits alone */ }
reg &= 0x30070000; /* Strip timing bits */
pci_write_config_dword(pdev, addr1, reg | mode); /**
* hpt366_set_piomode - PIO setup
* @ap: ATA interface
* @adev: device on the interface
*
* Perform PIO mode setup.
*/
static void hpt366_set_piomode(struct ata_port *ap, struct ata_device *adev)
{
hpt366_set_mode(ap, adev, adev->pio_mode);
} }
/** /**
...@@ -271,28 +271,7 @@ static void hpt366_set_piomode(struct ata_port *ap, struct ata_device *adev) ...@@ -271,28 +271,7 @@ static void hpt366_set_piomode(struct ata_port *ap, struct ata_device *adev)
static void hpt366_set_dmamode(struct ata_port *ap, struct ata_device *adev) static void hpt366_set_dmamode(struct ata_port *ap, struct ata_device *adev)
{ {
struct pci_dev *pdev = to_pci_dev(ap->host->dev); hpt366_set_mode(ap, adev, adev->dma_mode);
u32 addr1, addr2;
u32 reg;
u32 mode;
u8 fast;
addr1 = 0x40 + 4 * (adev->devno + 2 * ap->port_no);
addr2 = 0x51 + 4 * ap->port_no;
/* Fast interrupt prediction disable, hold off interrupt disable */
pci_read_config_byte(pdev, addr2, &fast);
if (fast & 0x80) {
fast &= ~0x80;
pci_write_config_byte(pdev, addr2, fast);
}
pci_read_config_dword(pdev, addr1, &reg);
mode = hpt36x_find_mode(ap, adev->dma_mode);
mode |= 0x8000000; /* FIFO in MWDMA or UDMA */
mode &= ~0xC0000000; /* Leave config bits alone */
reg &= 0xC0000000; /* Strip timing bits */
pci_write_config_dword(pdev, addr1, reg | mode);
} }
static struct scsi_host_template hpt36x_sht = { static struct scsi_host_template hpt36x_sht = {
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#include <linux/libata.h> #include <linux/libata.h>
#define DRV_NAME "pata_hpt3x3" #define DRV_NAME "pata_hpt3x3"
#define DRV_VERSION "0.5.3" #define DRV_VERSION "0.6.1"
/** /**
* hpt3x3_set_piomode - PIO setup * hpt3x3_set_piomode - PIO setup
...@@ -80,14 +80,48 @@ static void hpt3x3_set_dmamode(struct ata_port *ap, struct ata_device *adev) ...@@ -80,14 +80,48 @@ static void hpt3x3_set_dmamode(struct ata_port *ap, struct ata_device *adev)
r2 &= ~(0x11 << dn); /* Clear MWDMA and UDMA bits */ r2 &= ~(0x11 << dn); /* Clear MWDMA and UDMA bits */
if (adev->dma_mode >= XFER_UDMA_0) if (adev->dma_mode >= XFER_UDMA_0)
r2 |= (0x10 << dn); /* Ultra mode */ r2 |= (0x01 << dn); /* Ultra mode */
else else
r2 |= (0x01 << dn); /* MWDMA */ r2 |= (0x10 << dn); /* MWDMA */
pci_write_config_dword(pdev, 0x44, r1); pci_write_config_dword(pdev, 0x44, r1);
pci_write_config_dword(pdev, 0x48, r2); pci_write_config_dword(pdev, 0x48, r2);
} }
#endif /* CONFIG_PATA_HPT3X3_DMA */
/**
* hpt3x3_freeze - DMA workaround
* @ap: port to freeze
*
* When freezing an HPT3x3 we must stop any pending DMA before
* writing to the control register or the chip will hang
*/
static void hpt3x3_freeze(struct ata_port *ap)
{
void __iomem *mmio = ap->ioaddr.bmdma_addr;
iowrite8(ioread8(mmio + ATA_DMA_CMD) & ~ ATA_DMA_START,
mmio + ATA_DMA_CMD);
ata_sff_dma_pause(ap);
ata_sff_freeze(ap);
}
/**
* hpt3x3_bmdma_setup - DMA workaround
* @qc: Queued command
*
* When issuing BMDMA we must clean up the error/active bits in
* software on this device
*/
static void hpt3x3_bmdma_setup(struct ata_queued_cmd *qc)
{
struct ata_port *ap = qc->ap;
u8 r = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS);
r |= ATA_DMA_INTR | ATA_DMA_ERR;
iowrite8(r, ap->ioaddr.bmdma_addr + ATA_DMA_STATUS);
return ata_bmdma_setup(qc);
}
/** /**
* hpt3x3_atapi_dma - ATAPI DMA check * hpt3x3_atapi_dma - ATAPI DMA check
...@@ -101,18 +135,23 @@ static int hpt3x3_atapi_dma(struct ata_queued_cmd *qc) ...@@ -101,18 +135,23 @@ static int hpt3x3_atapi_dma(struct ata_queued_cmd *qc)
return 1; return 1;
} }
#endif /* CONFIG_PATA_HPT3X3_DMA */
static struct scsi_host_template hpt3x3_sht = { static struct scsi_host_template hpt3x3_sht = {
ATA_BMDMA_SHT(DRV_NAME), ATA_BMDMA_SHT(DRV_NAME),
}; };
static struct ata_port_operations hpt3x3_port_ops = { static struct ata_port_operations hpt3x3_port_ops = {
.inherits = &ata_bmdma_port_ops, .inherits = &ata_bmdma_port_ops,
.check_atapi_dma= hpt3x3_atapi_dma,
.cable_detect = ata_cable_40wire, .cable_detect = ata_cable_40wire,
.set_piomode = hpt3x3_set_piomode, .set_piomode = hpt3x3_set_piomode,
#if defined(CONFIG_PATA_HPT3X3_DMA) #if defined(CONFIG_PATA_HPT3X3_DMA)
.set_dmamode = hpt3x3_set_dmamode, .set_dmamode = hpt3x3_set_dmamode,
.bmdma_setup = hpt3x3_bmdma_setup,
.check_atapi_dma= hpt3x3_atapi_dma,
.freeze = hpt3x3_freeze,
#endif #endif
}; };
/** /**
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
#include <linux/libata.h> #include <linux/libata.h>
#define DRV_NAME "pata_mpiix" #define DRV_NAME "pata_mpiix"
#define DRV_VERSION "0.7.6" #define DRV_VERSION "0.7.7"
enum { enum {
IDETIM = 0x6C, /* IDE control register */ IDETIM = 0x6C, /* IDE control register */
...@@ -146,6 +146,7 @@ static struct ata_port_operations mpiix_port_ops = { ...@@ -146,6 +146,7 @@ static struct ata_port_operations mpiix_port_ops = {
.cable_detect = ata_cable_40wire, .cable_detect = ata_cable_40wire,
.set_piomode = mpiix_set_piomode, .set_piomode = mpiix_set_piomode,
.prereset = mpiix_pre_reset, .prereset = mpiix_pre_reset,
.sff_data_xfer = ata_sff_data_xfer32,
}; };
static int mpiix_init_one(struct pci_dev *dev, const struct pci_device_id *id) static int mpiix_init_one(struct pci_dev *dev, const struct pci_device_id *id)
......
...@@ -186,7 +186,7 @@ EXPORT_SYMBOL_GPL(__pata_platform_probe); ...@@ -186,7 +186,7 @@ EXPORT_SYMBOL_GPL(__pata_platform_probe);
* A platform bus ATA device has been unplugged. Perform the needed * A platform bus ATA device has been unplugged. Perform the needed
* cleanup. Also called on module unload for any active devices. * cleanup. Also called on module unload for any active devices.
*/ */
int __devexit __pata_platform_remove(struct device *dev) int __pata_platform_remove(struct device *dev)
{ {
struct ata_host *host = dev_get_drvdata(dev); struct ata_host *host = dev_get_drvdata(dev);
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#include <linux/libata.h> #include <linux/libata.h>
#define DRV_NAME "pata_sil680" #define DRV_NAME "pata_sil680"
#define DRV_VERSION "0.4.8" #define DRV_VERSION "0.4.9"
#define SIL680_MMIO_BAR 5 #define SIL680_MMIO_BAR 5
...@@ -195,7 +195,7 @@ static struct scsi_host_template sil680_sht = { ...@@ -195,7 +195,7 @@ static struct scsi_host_template sil680_sht = {
}; };
static struct ata_port_operations sil680_port_ops = { static struct ata_port_operations sil680_port_ops = {
.inherits = &ata_bmdma_port_ops, .inherits = &ata_bmdma32_port_ops,
.cable_detect = sil680_cable_detect, .cable_detect = sil680_cable_detect,
.set_piomode = sil680_set_piomode, .set_piomode = sil680_set_piomode,
.set_dmamode = sil680_set_dmamode, .set_dmamode = sil680_set_dmamode,
......
...@@ -51,13 +51,6 @@ struct sil24_sge { ...@@ -51,13 +51,6 @@ struct sil24_sge {
__le32 flags; __le32 flags;
}; };
/*
* Port multiplier
*/
struct sil24_port_multiplier {
__le32 diag;
__le32 sactive;
};
enum { enum {
SIL24_HOST_BAR = 0, SIL24_HOST_BAR = 0,
......
...@@ -1518,6 +1518,7 @@ extern void sata_pmp_error_handler(struct ata_port *ap); ...@@ -1518,6 +1518,7 @@ extern void sata_pmp_error_handler(struct ata_port *ap);
extern const struct ata_port_operations ata_sff_port_ops; extern const struct ata_port_operations ata_sff_port_ops;
extern const struct ata_port_operations ata_bmdma_port_ops; extern const struct ata_port_operations ata_bmdma_port_ops;
extern const struct ata_port_operations ata_bmdma32_port_ops;
/* PIO only, sg_tablesize and dma_boundary limits can be removed */ /* PIO only, sg_tablesize and dma_boundary limits can be removed */
#define ATA_PIO_SHT(drv_name) \ #define ATA_PIO_SHT(drv_name) \
...@@ -1545,6 +1546,8 @@ extern void ata_sff_exec_command(struct ata_port *ap, ...@@ -1545,6 +1546,8 @@ extern void ata_sff_exec_command(struct ata_port *ap,
const struct ata_taskfile *tf); const struct ata_taskfile *tf);
extern unsigned int ata_sff_data_xfer(struct ata_device *dev, extern unsigned int ata_sff_data_xfer(struct ata_device *dev,
unsigned char *buf, unsigned int buflen, int rw); unsigned char *buf, unsigned int buflen, int rw);
extern unsigned int ata_sff_data_xfer32(struct ata_device *dev,
unsigned char *buf, unsigned int buflen, int rw);
extern unsigned int ata_sff_data_xfer_noirq(struct ata_device *dev, extern unsigned int ata_sff_data_xfer_noirq(struct ata_device *dev,
unsigned char *buf, unsigned int buflen, int rw); unsigned char *buf, unsigned int buflen, int rw);
extern u8 ata_sff_irq_on(struct ata_port *ap); extern u8 ata_sff_irq_on(struct ata_port *ap);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment