All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] IDE cable detection on Apple PowerBook
@ 2009-03-22  1:17 TOMARI Hisanobu
  2009-03-23 10:57 ` Sergei Shtylyov
  0 siblings, 1 reply; 5+ messages in thread
From: TOMARI Hisanobu @ 2009-03-22  1:17 UTC (permalink / raw)
  To: linux-ide; +Cc: bzolnier, benh

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.

Signed-off-by: TOMARI Hisanobu <posco.grubb@gmail.com>

--- linux-2.6.28.8/drivers/ide/pmac.c.orig	2009-03-21 23:07:19.177956922 +0900
+++ linux-2.6.28.8/drivers/ide/pmac.c	2009-03-22 09:57:58.774048828 +0900
@@ -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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] IDE cable detection on Apple PowerBook
  2009-03-22  1:17 [PATCH] IDE cable detection on Apple PowerBook TOMARI Hisanobu
@ 2009-03-23 10:57 ` Sergei Shtylyov
  2009-03-23 11:11   ` TOMARI Hisanobu
  0 siblings, 1 reply; 5+ messages in thread
From: Sergei Shtylyov @ 2009-03-23 10:57 UTC (permalink / raw)
  To: TOMARI Hisanobu; +Cc: linux-ide, bzolnier, benh

TOMARI Hisanobu wrote:

> 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.

> Signed-off-by: TOMARI Hisanobu <posco.grubb@gmail.com>

> --- linux-2.6.28.8/drivers/ide/pmac.c.orig	2009-03-21 23:07:19.177956922 +0900
> +++ linux-2.6.28.8/drivers/ide/pmac.c	2009-03-22 09:57:58.774048828 +0900
> @@ -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...

> +	    /* Some drives fail to detect 80c cable in PowerBook */
> +	    /* These machine use proprietary short IDE cable anyway */

    s/machine/machines/

> +	    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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] IDE cable detection on Apple PowerBook
  2009-03-23 10:57 ` Sergei Shtylyov
@ 2009-03-23 11:11   ` TOMARI Hisanobu
  2009-03-23 20:09     ` Bartlomiej Zolnierkiewicz
  0 siblings, 1 reply; 5+ messages in thread
From: TOMARI Hisanobu @ 2009-03-23 11:11 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: linux-ide, bzolnier, benh

On Mon, 23 Mar 2009 13:57:03 +0300
Sergei Shtylyov <sshtylyov@ru.mvista.com> wrote:

>     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.

---

Signed-off-by: TOMARI Hisanobu <posco.grubb@gmail.com>
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.

--- linux-2.6.28.8/drivers/ide/pmac.c.orig	2009-03-21 23:07:19.177956922 +0900
+++ linux-2.6.28.8/drivers/ide/pmac.c	2009-03-23 20:03:51.010964084 +0900
@@ -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.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] IDE cable detection on Apple PowerBook
  2009-03-23 11:11   ` TOMARI Hisanobu
@ 2009-03-23 20:09     ` Bartlomiej Zolnierkiewicz
  2009-03-23 23:44       ` TOMARI Hisanobu
  0 siblings, 1 reply; 5+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-03-23 20:09 UTC (permalink / raw)
  To: TOMARI Hisanobu; +Cc: Sergei Shtylyov, linux-ide, benh

On Monday 23 March 2009, TOMARI Hisanobu wrote:
> On Mon, 23 Mar 2009 13:57:03 +0300
> Sergei Shtylyov <sshtylyov@ru.mvista.com> wrote:
> 
> >     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.
> 
> ---
> 
> Signed-off-by: TOMARI Hisanobu <posco.grubb@gmail.com>
> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] IDE cable detection on Apple PowerBook
  2009-03-23 20:09     ` Bartlomiej Zolnierkiewicz
@ 2009-03-23 23:44       ` TOMARI Hisanobu
  0 siblings, 0 replies; 5+ messages in thread
From: TOMARI Hisanobu @ 2009-03-23 23:44 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz; +Cc: Sergei Shtylyov, linux-ide, benh

On Mon, 23 Mar 2009 21:09:24 +0100
Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> wrote:

> On Monday 23 March 2009, TOMARI Hisanobu wrote:
> > On Mon, 23 Mar 2009 13:57:03 +0300
> > Sergei Shtylyov <sshtylyov@ru.mvista.com> wrote:
> > 
> > >     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.
> > 
> > ---
> > 
> > Signed-off-by: TOMARI Hisanobu <posco.grubb@gmail.com>
> > 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
Roger that. Thanks!

-- 
TOMARI, Hisanobu

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-03-23 23:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-22  1:17 [PATCH] IDE cable detection on Apple PowerBook TOMARI Hisanobu
2009-03-23 10:57 ` Sergei Shtylyov
2009-03-23 11:11   ` TOMARI Hisanobu
2009-03-23 20:09     ` Bartlomiej Zolnierkiewicz
2009-03-23 23:44       ` TOMARI Hisanobu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.