Skip to contentSkip to conversation

IDE cable detection on Apple PowerBook

PATCH Applied TOMARI Hisanobu 3 participants 5 messages Mar 22, 2009 – Mar 23, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 IDE cable detection on Apple PowerBook

This patch against 2.6.28.8 modifies the behavior of 80c cable detection of drivers/ide/pmac.c.
As IDE cable used on Apple PowerBook/iBook laptops are always of "Short 40" type when the firmware says it's 80 conductor one, the cable detection should return ATA_CBL_PATA40_SHORT on those machines.
This enables to automatically use UDMA5 even with drives that doesn't correctly detect those cables on Apple laptops.

drivers/ide/pmac.c renamed from drivers/ide/pmac.c.orig +9 -0
@@ -917,10 +917,19 @@ static u8 pmac_ide_cable_detect(ide_hwif
 		(pmac_ide_hwif_t *)dev_get_drvdata(hwif->gendev.parent);
 	struct device_node *np = pmif->node;
 	const char *cable = of_get_property(np, "cable-type", NULL);
+	struct device_node *root = of_find_node_by_path("/");
+	const char *model = of_get_property(root, "model", NULL);
 
 	/* Get cable type from device-tree. */
 	if (cable && !strncmp(cable, "80-", 3))
+	  {
+	    /* Some drives fail to detect 80c cable in PowerBook */
+	    /* These machine use proprietary short IDE cable anyway */
+	    if (!strncmp(model,"PowerBook", 9))
+		return ATA_CBL_PATA40_SHORT;
+	    else
 		return ATA_CBL_PATA80;
+	  }
 
 	/*
 	 * G5's seem to have incorrect cable type in device-tree.
#1 lore raw
Quoted 9 lines · TOMARI Hisanobu

This patch against 2.6.28.8 modifies the behavior of 80c cable detection of drivers/ide/pmac.c.
As IDE cable used on Apple PowerBook/iBook laptops are always of "Short 40" type when the firmware says it's 80 conductor one, the cable detection should return ATA_CBL_PATA40_SHORT on those machines. This enables to automatically use UDMA5 even with drives that doesn't correctly detect those cables on Apple laptops.

drivers/ide/pmac.c static u8 pmac_ide_cable_detect(ide_hwif · line 925

Quoted 9 lines
drivers/ide/pmac.c renamed from drivers/ide/pmac.c.orig +3 -0
@@ -917,10 +917,19 @@ static u8 pmac_ide_cable_detect(ide_hwif
 		(pmac_ide_hwif_t *)dev_get_drvdata(hwif->gendev.parent);
 	struct device_node *np = pmif->node;
 	const char *cable = of_get_property(np, "cable-type", NULL);
+	struct device_node *root = of_find_node_by_path("/");
+	const char *model = of_get_property(root, "model", NULL);
 
 	/* Get cable type from device-tree. */
 	if (cable && !strncmp(cable, "80-", 3))
+	  {

Unacceptable style, brace should be on the same line with *if*; run your
patch thru scripts/checkpatch.pl please...

drivers/ide/pmac.c static u8 pmac_ide_cable_detect(ide_hwif · line 927

Quoted 2 lines
drivers/ide/pmac.c renamed from drivers/ide/pmac.c.orig +2 -0
+	    /* Some drives fail to detect 80c cable in PowerBook */
+	    /* These machine use proprietary short IDE cable anyway */

s/machine/machines/

drivers/ide/pmac.c static u8 pmac_ide_cable_detect(ide_hwif · line 935

Quoted 8 lines
drivers/ide/pmac.c renamed from drivers/ide/pmac.c.orig +4 -0
+	    if (!strncmp(model,"PowerBook", 9))
+		return ATA_CBL_PATA40_SHORT;
+	    else
 		return ATA_CBL_PATA80;
+	  }
 
 	/*
 	 * G5's seem to have incorrect cable type in device-tree.

WBR, Sergei

#2 lore raw
Quoted 2 lines · On Mon, 23 Mar 2009 13:57:03 +0300 Sergei Shtylyov <[email protected]>…

Unacceptable style, brace should be on the same line with *if*; run your
patch thru scripts/checkpatch.pl please...

Thank you for telling me the error. Now, this one should be all right.

---

This patch against 2.6.28.8 modifies the behavior of 80c cable detection of drivers/ide/pmac.c.
As IDE cable used on Apple PowerBook/iBook laptops are always of "Short 40" type when the firmware says it's 80 conductor one, the cable detection should return ATA_CBL_PATA40_SHORT on those machines.
This enables to automatically use UDMA5 even with drives that doesn't correctly detect those cables on Apple laptops.

drivers/ide/pmac.c renamed from drivers/ide/pmac.c.orig +10 -2
@@ -917,10 +917,18 @@ static u8 pmac_ide_cable_detect(ide_hwif
 		(pmac_ide_hwif_t *)dev_get_drvdata(hwif->gendev.parent);
 	struct device_node *np = pmif->node;
 	const char *cable = of_get_property(np, "cable-type", NULL);
+	struct device_node *root = of_find_node_by_path("/");
+	const char *model = of_get_property(root, "model", NULL);
 
 	/* Get cable type from device-tree. */
-	if (cable && !strncmp(cable, "80-", 3))
-		return ATA_CBL_PATA80;
+	if (cable && !strncmp(cable, "80-", 3)) {
+		/* Some drives fail to detect 80c cable in PowerBook */
+		/* These machine use proprietary short IDE cable anyway */
+		if (!strncmp(model, "PowerBook", 9))
+			return ATA_CBL_PATA40_SHORT;
+		else
+			return ATA_CBL_PATA80;
+	}
 
 	/*
 	 * G5's seem to have incorrect cable type in device-tree.
#3 lore raw
Quoted 9 lines · TOMARI Hisanobu
Quoted 2 lines · On Mon, 23 Mar 2009 13:57:03 +0300 Sergei Shtylyov <[email protected]>…

Unacceptable style, brace should be on the same line with *if*; run your
patch thru scripts/checkpatch.pl please...

Thank you for telling me the error. Now, this one should be all right.

---

Quoted 8 lines

This patch against 2.6.28.8 modifies the behavior of 80c cable detection of drivers/ide/pmac.c.
As IDE cable used on Apple PowerBook/iBook laptops are always of "Short 40" type when the firmware says it's 80 conductor one, the cable detection should return ATA_CBL_PATA40_SHORT on those machines.
This enables to automatically use UDMA5 even with drives that doesn't correctly detect those cables on Apple laptops.

applied

PS please keep the following ordering in future:

- patch description
- S-o-B line
- "---" line

to allow easier/automatic merging of patches

#4 lore raw
Quoted 21 lines · On Mon, 23 Mar 2009 21:09:24 +0100 Bartlomiej Zolnierkiewicz…
Quoted 9 lines · TOMARI Hisanobu
Quoted 2 lines · On Mon, 23 Mar 2009 13:57:03 +0300 Sergei Shtylyov <[email protected]>…

Unacceptable style, brace should be on the same line with *if*; run your
patch thru scripts/checkpatch.pl please...

Thank you for telling me the error. Now, this one should be all right.

---

Quoted 8 lines

This patch against 2.6.28.8 modifies the behavior of 80c cable detection of drivers/ide/pmac.c.
As IDE cable used on Apple PowerBook/iBook laptops are always of "Short 40" type when the firmware says it's 80 conductor one, the cable detection should return ATA_CBL_PATA40_SHORT on those machines.
This enables to automatically use UDMA5 even with drives that doesn't correctly detect those cables on Apple laptops.

applied

Quoted 7 lines

PS please keep the following ordering in future:

- patch description
- S-o-B line
- "---" line

to allow easier/automatic merging of patches

Roger that. Thanks!

Signature · 1 line
TOMARI, Hisanobu