Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 58333
b: refs/heads/master
c: 95ba8c1
h: refs/heads/master
i:
  58331: 8b367b5
v: v3
  • Loading branch information
Bartlomiej Zolnierkiewicz committed Jul 9, 2007
1 parent dcac2eb commit 40a27f8
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 24 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7207626f47a3d66ce361bad197eefca4b8a6fa17
refs/heads/master: 95ba8c17bc57bf4666e9de2be715b69d9a1ba211
71 changes: 48 additions & 23 deletions trunk/drivers/ide/pci/alim15x3.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* linux/drivers/ide/pci/alim15x3.c Version 0.21 2007/02/03
* linux/drivers/ide/pci/alim15x3.c Version 0.25 Jun 9 2007
*
* Copyright (C) 1998-2000 Michel Aubry, Maintainer
* Copyright (C) 1998-2000 Andrzej Krzysztofowicz, Maintainer
Expand All @@ -10,6 +10,7 @@
* Copyright (C) 2002 Alan Cox <alan@redhat.com>
* ALi (now ULi M5228) support by Clear Zhang <Clear.Zhang@ali.com.tw>
* Copyright (C) 2007 MontaVista Software, Inc. <source@mvista.com>
* Copyright (C) 2007 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
*
* (U)DMA capable version of ali 1533/1543(C), 1535(D)
*
Expand All @@ -36,6 +37,7 @@
#include <linux/hdreg.h>
#include <linux/ide.h>
#include <linux/init.h>
#include <linux/dmi.h>

#include <asm/io.h>

Expand Down Expand Up @@ -583,6 +585,35 @@ static unsigned int __devinit init_chipset_ali15x3 (struct pci_dev *dev, const c
return 0;
}

/*
* Cable special cases
*/

static struct dmi_system_id cable_dmi_table[] = {
{
.ident = "HP Pavilion N5430",
.matches = {
DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"),
DMI_MATCH(DMI_BOARD_NAME, "OmniBook N32N-736"),
},
},
{ }
};

static int ali_cable_override(struct pci_dev *pdev)
{
/* Fujitsu P2000 */
if (pdev->subsystem_vendor == 0x10CF &&
pdev->subsystem_device == 0x10AF)
return 1;

/* Systems by DMI */
if (dmi_check_system(cable_dmi_table))
return 1;

return 0;
}

/**
* ata66_ali15x3 - check for UDMA 66 support
* @hwif: IDE interface
Expand All @@ -597,34 +628,28 @@ static unsigned int __devinit init_chipset_ali15x3 (struct pci_dev *dev, const c
static u8 __devinit ata66_ali15x3(ide_hwif_t *hwif)
{
struct pci_dev *dev = hwif->pci_dev;
unsigned int ata66 = 0;
u8 cable_80_pin[2] = { 0, 0 };

unsigned long flags;
u8 tmpbyte;
u8 cbl = ATA_CBL_PATA40, tmpbyte;

local_irq_save(flags);

if (m5229_revision >= 0xC2) {
/*
* Ultra66 cable detection (from Host View)
* m5229, 0x4a, bit0: primary, bit1: secondary 80 pin
*/
pci_read_config_byte(dev, 0x4a, &tmpbyte);
/*
* 0x4a, bit0 is 0 => primary channel
* has 80-pin (from host view)
* m5229 80-pin cable detection (from Host View)
*
* 0x4a bit0 is 0 => primary channel has 80-pin
* 0x4a bit1 is 0 => secondary channel has 80-pin
*
* Certain laptops use short but suitable cables
* and don't implement the detect logic.
*/
if (!(tmpbyte & 0x01)) cable_80_pin[0] = 1;
/*
* 0x4a, bit1 is 0 => secondary channel
* has 80-pin (from host view)
*/
if (!(tmpbyte & 0x02)) cable_80_pin[1] = 1;
/*
* Allow ata66 if cable of current channel has 80 pins
*/
ata66 = (hwif->channel)?cable_80_pin[1]:cable_80_pin[0];
if (ali_cable_override(dev))
cbl = ATA_CBL_PATA40_SHORT;
else {
pci_read_config_byte(dev, 0x4a, &tmpbyte);
if ((tmpbyte & (1 << hwif->channel)) == 0)
cbl = ATA_CBL_PATA80;
}
} else {
/*
* check m1533, 0x5e, bit 1~4 == 1001 => & 00011110 = 00010010
Expand Down Expand Up @@ -657,7 +682,7 @@ static u8 __devinit ata66_ali15x3(ide_hwif_t *hwif)

local_irq_restore(flags);

return ata66 ? ATA_CBL_PATA80 : ATA_CBL_PATA40;
return cbl;
}

/**
Expand Down

0 comments on commit 40a27f8

Please sign in to comment.