* [PATCH] pata_sis: implement laptop list and add ASUS A6K/A6U
@ 2007-01-08 17:36 Tejun Heo
2007-01-09 0:01 ` Tejun Heo
0 siblings, 1 reply; 3+ messages in thread
From: Tejun Heo @ 2007-01-08 17:36 UTC (permalink / raw)
To: Jeff Garzik, linux-ide; +Cc: J J
From: J J <jakub007@go2.pl>
In ASUS A6K/A6U hdd is connected to SiS 96x via 40c cable, however it
is short cable and is UDMA66 capable.
tj: fixed if () conditionals.
Signed-off-by: J J <jakub007@go2.pl>
Signed-off-by: Tejun Heo <htejun@gmail.com>
diff --git a/drivers/ata/pata_sis.c b/drivers/ata/pata_sis.c
index c434c4e..e9415a7 100644
--- a/drivers/ata/pata_sis.c
+++ b/drivers/ata/pata_sis.c
@@ -43,6 +43,33 @@ struct sis_chipset {
up code later */
};
+struct sis_laptop {
+ u16 device;
+ u16 subvendor;
+ u16 subdevice;
+};
+
+static const struct sis_laptop sis_laptop[] = {
+ /* devid, subvendor, subdev */
+ { 0x5513, 0x1043, 0x1107 }, /* ASUS A6K */
+ /* end marker */
+ { 0, }
+};
+
+static int sis_short_ata40(struct pci_dev *dev)
+{
+ const struct sis_laptop *lap = &sis_laptop[0];
+
+ while (lap->device) {
+ if (lap->device == dev->device &&
+ lap->subvendor == dev->subsystem_vendor &&
+ lap->subdevice == dev->subsystem_device)
+ return 1;
+ }
+
+ return 0;
+}
+
/**
* sis_port_base - return PCI configuration base for dev
* @adev: device
@@ -79,7 +106,7 @@ static int sis_133_pre_reset(struct ata_port *ap)
/* The top bit of this register is the cable detect bit */
pci_read_config_word(pdev, 0x50 + 2 * ap->port_no, &tmp);
- if (tmp & 0x8000)
+ if ((tmp & 0x8000) && !sis_short_ata40(pdev))
ap->cbl = ATA_CBL_PATA40;
else
ap->cbl = ATA_CBL_PATA80;
@@ -127,7 +154,7 @@ static int sis_66_pre_reset(struct ata_port *ap)
/* Older chips keep cable detect in bits 4/5 of reg 0x48 */
pci_read_config_byte(pdev, 0x48, &tmp);
tmp >>= ap->port_no;
- if (tmp & 0x10)
+ if ((tmp & 0x10) && !sis_short_ata40(pdev))
ap->cbl = ATA_CBL_PATA40;
else
ap->cbl = ATA_CBL_PATA80;
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH] pata_sis: implement laptop list and add ASUS A6K/A6U
2007-01-08 17:36 [PATCH] pata_sis: implement laptop list and add ASUS A6K/A6U Tejun Heo
@ 2007-01-09 0:01 ` Tejun Heo
2007-01-09 10:34 ` Jeff Garzik
0 siblings, 1 reply; 3+ messages in thread
From: Tejun Heo @ 2007-01-09 0:01 UTC (permalink / raw)
To: Jeff Garzik, linux-ide; +Cc: Jakub W. Jozwicki, Andreas Henriksson
From: Jakub W. Jozwicki J <jakub007@go2.pl>
In ASUS A6K/A6U hdd is connected to SiS 96x via 40c cable, however it
is short cable and is UDMA66 capable.
tj: fixed if () conditionals
ah: fixed infinite loop
Signed-off-by: Jakub W. Jozwicki <jakub007@go2.pl>
Cc: Andreas Henriksson <andreas@fatal.se>
Signed-off-by: Tejun Heo <htejun@gmail.com>
---
lap++ was missing. This will result in infinite loop. Please apply
this one. Thanks to Andreas Henriksson for spotting this.
diff --git a/drivers/ata/pata_sis.c b/drivers/ata/pata_sis.c
index c434c4e..d9486fc 100644
--- a/drivers/ata/pata_sis.c
+++ b/drivers/ata/pata_sis.c
@@ -43,6 +43,34 @@ struct sis_chipset {
up code later */
};
+struct sis_laptop {
+ u16 device;
+ u16 subvendor;
+ u16 subdevice;
+};
+
+static const struct sis_laptop sis_laptop[] = {
+ /* devid, subvendor, subdev */
+ { 0x5513, 0x1043, 0x1107 }, /* ASUS A6K */
+ /* end marker */
+ { 0, }
+};
+
+static int sis_short_ata40(struct pci_dev *dev)
+{
+ const struct sis_laptop *lap = &sis_laptop[0];
+
+ while (lap->device) {
+ if (lap->device == dev->device &&
+ lap->subvendor == dev->subsystem_vendor &&
+ lap->subdevice == dev->subsystem_device)
+ return 1;
+ lap++;
+ }
+
+ return 0;
+}
+
/**
* sis_port_base - return PCI configuration base for dev
* @adev: device
@@ -79,7 +107,7 @@ static int sis_133_pre_reset(struct ata_port *ap)
/* The top bit of this register is the cable detect bit */
pci_read_config_word(pdev, 0x50 + 2 * ap->port_no, &tmp);
- if (tmp & 0x8000)
+ if ((tmp & 0x8000) && !sis_short_ata40(pdev))
ap->cbl = ATA_CBL_PATA40;
else
ap->cbl = ATA_CBL_PATA80;
@@ -127,7 +155,7 @@ static int sis_66_pre_reset(struct ata_port *ap)
/* Older chips keep cable detect in bits 4/5 of reg 0x48 */
pci_read_config_byte(pdev, 0x48, &tmp);
tmp >>= ap->port_no;
- if (tmp & 0x10)
+ if ((tmp & 0x10) && !sis_short_ata40(pdev))
ap->cbl = ATA_CBL_PATA40;
else
ap->cbl = ATA_CBL_PATA80;
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] pata_sis: implement laptop list and add ASUS A6K/A6U
2007-01-09 0:01 ` Tejun Heo
@ 2007-01-09 10:34 ` Jeff Garzik
0 siblings, 0 replies; 3+ messages in thread
From: Jeff Garzik @ 2007-01-09 10:34 UTC (permalink / raw)
To: Tejun Heo; +Cc: linux-ide, Jakub W. Jozwicki, Andreas Henriksson
Tejun Heo wrote:
> From: Jakub W. Jozwicki J <jakub007@go2.pl>
>
> In ASUS A6K/A6U hdd is connected to SiS 96x via 40c cable, however it
> is short cable and is UDMA66 capable.
>
> tj: fixed if () conditionals
> ah: fixed infinite loop
>
> Signed-off-by: Jakub W. Jozwicki <jakub007@go2.pl>
> Cc: Andreas Henriksson <andreas@fatal.se>
> Signed-off-by: Tejun Heo <htejun@gmail.com>
>
> ---
> lap++ was missing. This will result in infinite loop. Please apply
> this one. Thanks to Andreas Henriksson for spotting this.
applied
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-01-09 10:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-08 17:36 [PATCH] pata_sis: implement laptop list and add ASUS A6K/A6U Tejun Heo
2007-01-09 0:01 ` Tejun Heo
2007-01-09 10:34 ` Jeff Garzik
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).