Commit a9d5a97f authored by TOMARI Hisanobu's avatar TOMARI Hisanobu Committed by Bartlomiej Zolnierkiewicz

ide-pmac: IDE cable detection on Apple PowerBook

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.
Signed-off-by: default avatarTOMARI Hisanobu <posco.grubb@gmail.com>
Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: benh@kernel.crashing.org
[bart: beautify patch description]
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
parent fdd88f0a
......@@ -919,10 +919,18 @@ static u8 pmac_ide_cable_detect(ide_hwif_t *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.
......
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