All of lore.kernel.org
 help / color / mirror / Atom feed
* IDE cable detection on Apple PowerBook
@ 2009-03-18  5:06 TOMARI Hisanobu
  2009-03-18  7:58 ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 9+ messages in thread
From: TOMARI Hisanobu @ 2009-03-18  5:06 UTC (permalink / raw)
  To: linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 1287 bytes --]

Hello,

I'm using an OCZ PATA SSD on Apple PowerBook5,4 computer.
The IDE drive fails to recognize 80-conductor cable that
connects the drive to motherboard to fall back to UDMA33.

This patch fixes this behavior by assuming that the cable is
short-40pin when the model string matches "PowerBook5" and 
the motherboard detects 80c cable.

This patch is against drivers/ide/pmac.c in linux 2.6.28.8.

(before applying the patch) hdparm -i /dev/hda
/dev/hda:
 Timing buffered disk reads:   90 MB in  3.03 seconds =  29.73 MB/sec
(dmesg 2.6.26)
ide0: Found Apple UniNorth ATA-6 controller, bus ID 3, irq 39
Probing IDE interface ide0...
hda: CORE_PATA, ATA DISK drive
hda: host max PIO4 wanted PIO255(auto-tune) selected PIO4
hda: drive side 80-wire cable detection failed, limiting max speed to UDMA33
hda: UDMA/33 mode selected

(after applying the patch) hdparm -i /dev/hda
/dev/hda:
 Timing buffered disk reads:  240 MB in  3.02 seconds =  79.42 MB/sec
(dmesg 2.6.28.8)
ide-pmac: Found Apple UniNorth ATA-6 controller (PCI), bus ID 3, irq 39
Probing IDE interface ide0...
hda: CORE_PATA, ATA DISK drive
hda: host max PIO4 wanted PIO255(auto-tune) selected PIO4
hda: UDMA/100 mode selected
ide0 at 0xf102a000-0xf102a070,0xf102a160 on irq 39


-- 
TOMARI Hisanobu <posco.grubb@gmail.com>

[-- Attachment #2: ide-pmac-pbookcable.patch --]
[-- Type: text/x-diff, Size: 1254 bytes --]

*** linux-2.6.28.8/drivers/ide/pmac.c.orig	2009-03-18 13:59:39.645805773 +0900
--- linux-2.6.28.8/drivers/ide/pmac.c	2009-03-18 13:57:38.935818468 +0900
***************
*** 916,926 ****
  	pmac_ide_hwif_t *pmif =
  		(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);
  
  	/* Get cable type from device-tree. */
  	if (cable && !strncmp(cable, "80-", 3))
! 		return ATA_CBL_PATA80;
  
  	/*
  	 * G5's seem to have incorrect cable type in device-tree.
--- 916,934 ----
  	pmac_ide_hwif_t *pmif =
  		(pmac_ide_hwif_t *)dev_get_drvdata(hwif->gendev.parent);
  	struct device_node *np = pmif->node;
+ 	struct device_node *root = of_find_node_by_path("/");
  	const char *cable = of_get_property(np, "cable-type", NULL);
+ 	const char *model = of_get_property(root, "model", NULL);
  
  	/* Get cable type from device-tree. */
  	if (cable && !strncmp(cable, "80-", 3))
! 	  {
! 	    if(strncmp(model,"PowerBook5",10)==0)
! 	      /* Some drives fail to detect 80c cable in PowerBook */
! 	      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] 9+ messages in thread

* Re: IDE cable detection on Apple PowerBook
  2009-03-18  5:06 IDE cable detection on Apple PowerBook TOMARI Hisanobu
@ 2009-03-18  7:58 ` Benjamin Herrenschmidt
  2009-03-18 13:47   ` TOMARI Hisanobu
  0 siblings, 1 reply; 9+ messages in thread
From: Benjamin Herrenschmidt @ 2009-03-18  7:58 UTC (permalink / raw)
  To: TOMARI Hisanobu; +Cc: linuxppc-dev

On Wed, 2009-03-18 at 14:06 +0900, TOMARI Hisanobu wrote:
> Hello,
> 
> I'm using an OCZ PATA SSD on Apple PowerBook5,4 computer.
> The IDE drive fails to recognize 80-conductor cable that
> connects the drive to motherboard to fall back to UDMA33.
> 
> This patch fixes this behavior by assuming that the cable is
> short-40pin when the model string matches "PowerBook5" and 
> the motherboard detects 80c cable.
> 
> This patch is against drivers/ide/pmac.c in linux 2.6.28.8.

The patch is too much of an ad-hoc hack... _maybe_ an option is to make
the core fallback to 40 "short" when 80 pin detection fails on
powerbooks instead ?

Ben.

> (before applying the patch) hdparm -i /dev/hda
> /dev/hda:
>  Timing buffered disk reads:   90 MB in  3.03 seconds =  29.73 MB/sec
> (dmesg 2.6.26)
> ide0: Found Apple UniNorth ATA-6 controller, bus ID 3, irq 39
> Probing IDE interface ide0...
> hda: CORE_PATA, ATA DISK drive
> hda: host max PIO4 wanted PIO255(auto-tune) selected PIO4
> hda: drive side 80-wire cable detection failed, limiting max speed to UDMA33
> hda: UDMA/33 mode selected
> 
> (after applying the patch) hdparm -i /dev/hda
> /dev/hda:
>  Timing buffered disk reads:  240 MB in  3.02 seconds =  79.42 MB/sec
> (dmesg 2.6.28.8)
> ide-pmac: Found Apple UniNorth ATA-6 controller (PCI), bus ID 3, irq 39
> Probing IDE interface ide0...
> hda: CORE_PATA, ATA DISK drive
> hda: host max PIO4 wanted PIO255(auto-tune) selected PIO4
> hda: UDMA/100 mode selected
> ide0 at 0xf102a000-0xf102a070,0xf102a160 on irq 39
> 
> 
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev

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

* Re: IDE cable detection on Apple PowerBook
  2009-03-18  7:58 ` Benjamin Herrenschmidt
@ 2009-03-18 13:47   ` TOMARI Hisanobu
  2009-03-19  6:07     ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 9+ messages in thread
From: TOMARI Hisanobu @ 2009-03-18 13:47 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev

I thought the short-40pin assumption would cause no problem
considering all models beginning with "PowerBook5" are laptops.
Do you mean an option to toggle this hack on/off should be present 
in Kconfig?

Thanks,
TOMARI Hisanobu

On Wed, 18 Mar 2009 18:58:17 +1100
Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:

> On Wed, 2009-03-18 at 14:06 +0900, TOMARI Hisanobu wrote:
> > Hello,
> > 
> > I'm using an OCZ PATA SSD on Apple PowerBook5,4 computer.
> > The IDE drive fails to recognize 80-conductor cable that
> > connects the drive to motherboard to fall back to UDMA33.
> > 
> > This patch fixes this behavior by assuming that the cable is
> > short-40pin when the model string matches "PowerBook5" and 
> > the motherboard detects 80c cable.
> > 
> > This patch is against drivers/ide/pmac.c in linux 2.6.28.8.
> 
> The patch is too much of an ad-hoc hack... _maybe_ an option is to make
> the core fallback to 40 "short" when 80 pin detection fails on
> powerbooks instead ?
> 
> Ben.
> 
> > (before applying the patch) hdparm -i /dev/hda
> > /dev/hda:
> >  Timing buffered disk reads:   90 MB in  3.03 seconds =  29.73 MB/sec
> > (dmesg 2.6.26)
> > ide0: Found Apple UniNorth ATA-6 controller, bus ID 3, irq 39
> > Probing IDE interface ide0...
> > hda: CORE_PATA, ATA DISK drive
> > hda: host max PIO4 wanted PIO255(auto-tune) selected PIO4
> > hda: drive side 80-wire cable detection failed, limiting max speed to UDMA33
> > hda: UDMA/33 mode selected
> > 
> > (after applying the patch) hdparm -i /dev/hda
> > /dev/hda:
> >  Timing buffered disk reads:  240 MB in  3.02 seconds =  79.42 MB/sec
> > (dmesg 2.6.28.8)
> > ide-pmac: Found Apple UniNorth ATA-6 controller (PCI), bus ID 3, irq 39
> > Probing IDE interface ide0...
> > hda: CORE_PATA, ATA DISK drive
> > hda: host max PIO4 wanted PIO255(auto-tune) selected PIO4
> > hda: UDMA/100 mode selected
> > ide0 at 0xf102a000-0xf102a070,0xf102a160 on irq 39
> > 
> > 
> > _______________________________________________
> > Linuxppc-dev mailing list
> > Linuxppc-dev@ozlabs.org
> > https://ozlabs.org/mailman/listinfo/linuxppc-dev
> 

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

* Re: IDE cable detection on Apple PowerBook
  2009-03-18 13:47   ` TOMARI Hisanobu
@ 2009-03-19  6:07     ` Benjamin Herrenschmidt
  2009-03-19  6:08       ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 9+ messages in thread
From: Benjamin Herrenschmidt @ 2009-03-19  6:07 UTC (permalink / raw)
  To: TOMARI Hisanobu; +Cc: linuxppc-dev

On Wed, 2009-03-18 at 22:47 +0900, TOMARI Hisanobu wrote:
> I thought the short-40pin assumption would cause no problem
> considering all models beginning with "PowerBook5" are laptops.
> Do you mean an option to toggle this hack on/off should be present 
> in Kconfig?

Actually, it makes -some- amount of sense to do it by testing
specifically for the prefix "PowerBook" and "iBook" without a specific
number I suppose.

Ben.

> Thanks,
> TOMARI Hisanobu
> 
> On Wed, 18 Mar 2009 18:58:17 +1100
> Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
> 
> > On Wed, 2009-03-18 at 14:06 +0900, TOMARI Hisanobu wrote:
> > > Hello,
> > > 
> > > I'm using an OCZ PATA SSD on Apple PowerBook5,4 computer.
> > > The IDE drive fails to recognize 80-conductor cable that
> > > connects the drive to motherboard to fall back to UDMA33.
> > > 
> > > This patch fixes this behavior by assuming that the cable is
> > > short-40pin when the model string matches "PowerBook5" and 
> > > the motherboard detects 80c cable.
> > > 
> > > This patch is against drivers/ide/pmac.c in linux 2.6.28.8.
> > 
> > The patch is too much of an ad-hoc hack... _maybe_ an option is to make
> > the core fallback to 40 "short" when 80 pin detection fails on
> > powerbooks instead ?
> > 
> > Ben.
> > 
> > > (before applying the patch) hdparm -i /dev/hda
> > > /dev/hda:
> > >  Timing buffered disk reads:   90 MB in  3.03 seconds =  29.73 MB/sec
> > > (dmesg 2.6.26)
> > > ide0: Found Apple UniNorth ATA-6 controller, bus ID 3, irq 39
> > > Probing IDE interface ide0...
> > > hda: CORE_PATA, ATA DISK drive
> > > hda: host max PIO4 wanted PIO255(auto-tune) selected PIO4
> > > hda: drive side 80-wire cable detection failed, limiting max speed to UDMA33
> > > hda: UDMA/33 mode selected
> > > 
> > > (after applying the patch) hdparm -i /dev/hda
> > > /dev/hda:
> > >  Timing buffered disk reads:  240 MB in  3.02 seconds =  79.42 MB/sec
> > > (dmesg 2.6.28.8)
> > > ide-pmac: Found Apple UniNorth ATA-6 controller (PCI), bus ID 3, irq 39
> > > Probing IDE interface ide0...
> > > hda: CORE_PATA, ATA DISK drive
> > > hda: host max PIO4 wanted PIO255(auto-tune) selected PIO4
> > > hda: UDMA/100 mode selected
> > > ide0 at 0xf102a000-0xf102a070,0xf102a160 on irq 39
> > > 
> > > 
> > > _______________________________________________
> > > Linuxppc-dev mailing list
> > > Linuxppc-dev@ozlabs.org
> > > https://ozlabs.org/mailman/listinfo/linuxppc-dev
> > 

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

* Re: IDE cable detection on Apple PowerBook
  2009-03-19  6:07     ` Benjamin Herrenschmidt
@ 2009-03-19  6:08       ` Benjamin Herrenschmidt
  2009-03-19 13:30         ` TOMARI Hisanobu
  0 siblings, 1 reply; 9+ messages in thread
From: Benjamin Herrenschmidt @ 2009-03-19  6:08 UTC (permalink / raw)
  To: TOMARI Hisanobu; +Cc: linuxppc-dev

On Thu, 2009-03-19 at 17:07 +1100, Benjamin Herrenschmidt wrote:
> On Wed, 2009-03-18 at 22:47 +0900, TOMARI Hisanobu wrote:
> > I thought the short-40pin assumption would cause no problem
> > considering all models beginning with "PowerBook5" are laptops.
> > Do you mean an option to toggle this hack on/off should be present 
> > in Kconfig?
> 
> Actually, it makes -some- amount of sense to do it by testing
> specifically for the prefix "PowerBook" and "iBook" without a specific
> number I suppose.

Actually "PowerBook" is enough, there's no iBook prefix in the
device-tree, I was confusing with old busted iMac firmwares that used
iMac instead of PowerMac in there.

Cheers,
Ben.

> Ben.
> 
> > Thanks,
> > TOMARI Hisanobu
> > 
> > On Wed, 18 Mar 2009 18:58:17 +1100
> > Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
> > 
> > > On Wed, 2009-03-18 at 14:06 +0900, TOMARI Hisanobu wrote:
> > > > Hello,
> > > > 
> > > > I'm using an OCZ PATA SSD on Apple PowerBook5,4 computer.
> > > > The IDE drive fails to recognize 80-conductor cable that
> > > > connects the drive to motherboard to fall back to UDMA33.
> > > > 
> > > > This patch fixes this behavior by assuming that the cable is
> > > > short-40pin when the model string matches "PowerBook5" and 
> > > > the motherboard detects 80c cable.
> > > > 
> > > > This patch is against drivers/ide/pmac.c in linux 2.6.28.8.
> > > 
> > > The patch is too much of an ad-hoc hack... _maybe_ an option is to make
> > > the core fallback to 40 "short" when 80 pin detection fails on
> > > powerbooks instead ?
> > > 
> > > Ben.
> > > 
> > > > (before applying the patch) hdparm -i /dev/hda
> > > > /dev/hda:
> > > >  Timing buffered disk reads:   90 MB in  3.03 seconds =  29.73 MB/sec
> > > > (dmesg 2.6.26)
> > > > ide0: Found Apple UniNorth ATA-6 controller, bus ID 3, irq 39
> > > > Probing IDE interface ide0...
> > > > hda: CORE_PATA, ATA DISK drive
> > > > hda: host max PIO4 wanted PIO255(auto-tune) selected PIO4
> > > > hda: drive side 80-wire cable detection failed, limiting max speed to UDMA33
> > > > hda: UDMA/33 mode selected
> > > > 
> > > > (after applying the patch) hdparm -i /dev/hda
> > > > /dev/hda:
> > > >  Timing buffered disk reads:  240 MB in  3.02 seconds =  79.42 MB/sec
> > > > (dmesg 2.6.28.8)
> > > > ide-pmac: Found Apple UniNorth ATA-6 controller (PCI), bus ID 3, irq 39
> > > > Probing IDE interface ide0...
> > > > hda: CORE_PATA, ATA DISK drive
> > > > hda: host max PIO4 wanted PIO255(auto-tune) selected PIO4
> > > > hda: UDMA/100 mode selected
> > > > ide0 at 0xf102a000-0xf102a070,0xf102a160 on irq 39
> > > > 
> > > > 
> > > > _______________________________________________
> > > > Linuxppc-dev mailing list
> > > > Linuxppc-dev@ozlabs.org
> > > > https://ozlabs.org/mailman/listinfo/linuxppc-dev
> > > 

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

* Re: IDE cable detection on Apple PowerBook
  2009-03-19  6:08       ` Benjamin Herrenschmidt
@ 2009-03-19 13:30         ` TOMARI Hisanobu
  2009-03-19 13:41           ` Anton Vorontsov
  2009-03-20  6:27           ` Benjamin Herrenschmidt
  0 siblings, 2 replies; 9+ messages in thread
From: TOMARI Hisanobu @ 2009-03-19 13:30 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 3442 bytes --]

Thanks for helpful advices.
This patch adds an option to drivers/ide/Kconfig and adds 
some lines to drivers/ide/pmac.c . Now the driver checks
if the model is prefixed with "PowerBook" and the entire hack
can be toggled in the Kconfig.

Again, the patch is against linux 2.6.28.8.

Best regards,
TOMARI Hisanobu

p.s. oddly, the drive works in ATA/100 mode under untouched
MacOS X 10.5.

On Thu, 19 Mar 2009 17:08:37 +1100
Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:

> On Thu, 2009-03-19 at 17:07 +1100, Benjamin Herrenschmidt wrote:
> > On Wed, 2009-03-18 at 22:47 +0900, TOMARI Hisanobu wrote:
> > > I thought the short-40pin assumption would cause no problem
> > > considering all models beginning with "PowerBook5" are laptops.
> > > Do you mean an option to toggle this hack on/off should be present 
> > > in Kconfig?
> > 
> > Actually, it makes -some- amount of sense to do it by testing
> > specifically for the prefix "PowerBook" and "iBook" without a specific
> > number I suppose.
> 
> Actually "PowerBook" is enough, there's no iBook prefix in the
> device-tree, I was confusing with old busted iMac firmwares that used
> iMac instead of PowerMac in there.
> 
> Cheers,
> Ben.
> 
> > Ben.
> > 
> > > Thanks,
> > > TOMARI Hisanobu
> > > 
> > > On Wed, 18 Mar 2009 18:58:17 +1100
> > > Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
> > > 
> > > > On Wed, 2009-03-18 at 14:06 +0900, TOMARI Hisanobu wrote:
> > > > > Hello,
> > > > > 
> > > > > I'm using an OCZ PATA SSD on Apple PowerBook5,4 computer.
> > > > > The IDE drive fails to recognize 80-conductor cable that
> > > > > connects the drive to motherboard to fall back to UDMA33.
> > > > > 
> > > > > This patch fixes this behavior by assuming that the cable is
> > > > > short-40pin when the model string matches "PowerBook5" and 
> > > > > the motherboard detects 80c cable.
> > > > > 
> > > > > This patch is against drivers/ide/pmac.c in linux 2.6.28.8.
> > > > 
> > > > The patch is too much of an ad-hoc hack... _maybe_ an option is to make
> > > > the core fallback to 40 "short" when 80 pin detection fails on
> > > > powerbooks instead ?
> > > > 
> > > > Ben.
> > > > 
> > > > > (before applying the patch) hdparm -i /dev/hda
> > > > > /dev/hda:
> > > > >  Timing buffered disk reads:   90 MB in  3.03 seconds =  29.73 MB/sec
> > > > > (dmesg 2.6.26)
> > > > > ide0: Found Apple UniNorth ATA-6 controller, bus ID 3, irq 39
> > > > > Probing IDE interface ide0...
> > > > > hda: CORE_PATA, ATA DISK drive
> > > > > hda: host max PIO4 wanted PIO255(auto-tune) selected PIO4
> > > > > hda: drive side 80-wire cable detection failed, limiting max speed to UDMA33
> > > > > hda: UDMA/33 mode selected
> > > > > 
> > > > > (after applying the patch) hdparm -i /dev/hda
> > > > > /dev/hda:
> > > > >  Timing buffered disk reads:  240 MB in  3.02 seconds =  79.42 MB/sec
> > > > > (dmesg 2.6.28.8)
> > > > > ide-pmac: Found Apple UniNorth ATA-6 controller (PCI), bus ID 3, irq 39
> > > > > Probing IDE interface ide0...
> > > > > hda: CORE_PATA, ATA DISK drive
> > > > > hda: host max PIO4 wanted PIO255(auto-tune) selected PIO4
> > > > > hda: UDMA/100 mode selected
> > > > > ide0 at 0xf102a000-0xf102a070,0xf102a160 on irq 39
> > > > > 
> > > > > 
> > > > > _______________________________________________
> > > > > Linuxppc-dev mailing list
> > > > > Linuxppc-dev@ozlabs.org
> > > > > https://ozlabs.org/mailman/listinfo/linuxppc-dev
> > > > 
> 

[-- Attachment #2: ide-pmac-shortcable.patch --]
[-- Type: text/x-diff, Size: 2206 bytes --]

*** linux-2.6.28.8/drivers/ide/Kconfig.old	2009-03-19 21:30:24.594129124 +0900
--- linux-2.6.28.8/drivers/ide/Kconfig	2009-03-19 21:49:41.776996312 +0900
***************
*** 691,696 ****
--- 691,706 ----
  	  CD-ROM on hda. This option changes this to more natural hda for
  	  hard disk and hdc for CD-ROM.
  
+ config BLK_DEV_IDE_PMAC_SHORTCABLE
+        bool "Assume short IDE cable on PowerBook/iBook"
+        depends on BLK_DEV_IDE_PMAC
+        help
+          Some IDE drives fail to recognize 80-conductor IDE cable used in
+ 	 PowerBooks and the driver limits the transfer speed to ATA/33.
+ 	 With this option, the driver reports the 80-conductor cable to be 
+ 	 of "40 conductor short" type on PowerBook/iBook, and enables to use
+ 	 ATA/100 on drives that support the transfer mode.
+ 
  config BLK_DEV_IDE_AU1XXX
         bool "IDE for AMD Alchemy Au1200"
         depends on SOC_AU1200
*** linux-2.6.28.8/drivers/ide/pmac.c.orig	2009-03-19 22:21:14.137849502 +0900
--- linux-2.6.28.8/drivers/ide/pmac.c	2009-03-19 22:16:44.612877441 +0900
***************
*** 917,926 ****
  		(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);
  
  	/* Get cable type from device-tree. */
  	if (cable && !strncmp(cable, "80-", 3))
! 		return ATA_CBL_PATA80;
  
  	/*
  	 * G5's seem to have incorrect cable type in device-tree.
--- 917,938 ----
  		(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);
+ #ifdef CONFIG_BLK_DEV_IDE_PMAC_SHORTCABLE
+ 	struct device_node *root = of_find_node_by_path("/");
+ 	const char *model = of_get_property(root, "model", NULL);
+ #endif
  
  	/* Get cable type from device-tree. */
  	if (cable && !strncmp(cable, "80-", 3))
! 	  {
! #ifdef CONFIG_BLK_DEV_IDE_PMAC_SHORTCABLE
! 	    if(strncmp(model,"PowerBook",9)==0)
! 	      /* Some drives fail to detect 80c cable in PowerBook */
! 	      return ATA_CBL_PATA40_SHORT;
! 	    else
! #endif
! 	      return ATA_CBL_PATA80;
! 	  }
  
  	/*
  	 * G5's seem to have incorrect cable type in device-tree.

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

* Re: IDE cable detection on Apple PowerBook
  2009-03-19 13:30         ` TOMARI Hisanobu
@ 2009-03-19 13:41           ` Anton Vorontsov
  2009-03-19 21:14             ` Benjamin Herrenschmidt
  2009-03-20  6:27           ` Benjamin Herrenschmidt
  1 sibling, 1 reply; 9+ messages in thread
From: Anton Vorontsov @ 2009-03-19 13:41 UTC (permalink / raw)
  To: TOMARI Hisanobu; +Cc: linuxppc-dev

On Thu, Mar 19, 2009 at 10:30:01PM +0900, TOMARI Hisanobu wrote:
> Thanks for helpful advices.
> This patch adds an option to drivers/ide/Kconfig and adds 
> some lines to drivers/ide/pmac.c .

I think it would be better to make it a kernel command line option
instead of Kconfig knob.

The reason is: with distro (pre-compiled) kernels you don't have to
re-compile anything to make the drive work.

The other option is to enable BLK_DEV_IDE_PMAC_SHORTCABLE by default,
but I'm not sure if it's safe thing to do (most probably not).

Thanks for you work on this,

-- 
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2

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

* Re: IDE cable detection on Apple PowerBook
  2009-03-19 13:41           ` Anton Vorontsov
@ 2009-03-19 21:14             ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 9+ messages in thread
From: Benjamin Herrenschmidt @ 2009-03-19 21:14 UTC (permalink / raw)
  To: avorontsov; +Cc: linuxppc-dev, TOMARI Hisanobu

On Thu, 2009-03-19 at 16:41 +0300, Anton Vorontsov wrote:
> 
> The other option is to enable BLK_DEV_IDE_PMAC_SHORTCABLE by default,
> but I'm not sure if it's safe thing to do (most probably not).

It should be allright for powerbooks. If the firmware says 80 pin cable,
then it probably is, and in fact, It used to work, I think the test in
the IDE code is new there, and MacOS X solely relies on the firmware
data.

Ben.

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

* Re: IDE cable detection on Apple PowerBook
  2009-03-19 13:30         ` TOMARI Hisanobu
  2009-03-19 13:41           ` Anton Vorontsov
@ 2009-03-20  6:27           ` Benjamin Herrenschmidt
  1 sibling, 0 replies; 9+ messages in thread
From: Benjamin Herrenschmidt @ 2009-03-20  6:27 UTC (permalink / raw)
  To: TOMARI Hisanobu; +Cc: linuxppc-dev

On Thu, 2009-03-19 at 22:30 +0900, TOMARI Hisanobu wrote:
> Thanks for helpful advices.
> This patch adds an option to drivers/ide/Kconfig and adds 
> some lines to drivers/ide/pmac.c . Now the driver checks
> if the model is prefixed with "PowerBook" and the entire hack
> can be toggled in the Kconfig.
> 
> Again, the patch is against linux 2.6.28.8.

Ack. I forwarded it to Bart for his queue.

Ben.

> Best regards,
> TOMARI Hisanobu
> 
> p.s. oddly, the drive works in ATA/100 mode under untouched
> MacOS X 10.5.
> 
> On Thu, 19 Mar 2009 17:08:37 +1100
> Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
> 
> > On Thu, 2009-03-19 at 17:07 +1100, Benjamin Herrenschmidt wrote:
> > > On Wed, 2009-03-18 at 22:47 +0900, TOMARI Hisanobu wrote:
> > > > I thought the short-40pin assumption would cause no problem
> > > > considering all models beginning with "PowerBook5" are laptops.
> > > > Do you mean an option to toggle this hack on/off should be present 
> > > > in Kconfig?
> > > 
> > > Actually, it makes -some- amount of sense to do it by testing
> > > specifically for the prefix "PowerBook" and "iBook" without a specific
> > > number I suppose.
> > 
> > Actually "PowerBook" is enough, there's no iBook prefix in the
> > device-tree, I was confusing with old busted iMac firmwares that used
> > iMac instead of PowerMac in there.
> > 
> > Cheers,
> > Ben.
> > 
> > > Ben.
> > > 
> > > > Thanks,
> > > > TOMARI Hisanobu
> > > > 
> > > > On Wed, 18 Mar 2009 18:58:17 +1100
> > > > Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
> > > > 
> > > > > On Wed, 2009-03-18 at 14:06 +0900, TOMARI Hisanobu wrote:
> > > > > > Hello,
> > > > > > 
> > > > > > I'm using an OCZ PATA SSD on Apple PowerBook5,4 computer.
> > > > > > The IDE drive fails to recognize 80-conductor cable that
> > > > > > connects the drive to motherboard to fall back to UDMA33.
> > > > > > 
> > > > > > This patch fixes this behavior by assuming that the cable is
> > > > > > short-40pin when the model string matches "PowerBook5" and 
> > > > > > the motherboard detects 80c cable.
> > > > > > 
> > > > > > This patch is against drivers/ide/pmac.c in linux 2.6.28.8.
> > > > > 
> > > > > The patch is too much of an ad-hoc hack... _maybe_ an option is to make
> > > > > the core fallback to 40 "short" when 80 pin detection fails on
> > > > > powerbooks instead ?
> > > > > 
> > > > > Ben.
> > > > > 
> > > > > > (before applying the patch) hdparm -i /dev/hda
> > > > > > /dev/hda:
> > > > > >  Timing buffered disk reads:   90 MB in  3.03 seconds =  29.73 MB/sec
> > > > > > (dmesg 2.6.26)
> > > > > > ide0: Found Apple UniNorth ATA-6 controller, bus ID 3, irq 39
> > > > > > Probing IDE interface ide0...
> > > > > > hda: CORE_PATA, ATA DISK drive
> > > > > > hda: host max PIO4 wanted PIO255(auto-tune) selected PIO4
> > > > > > hda: drive side 80-wire cable detection failed, limiting max speed to UDMA33
> > > > > > hda: UDMA/33 mode selected
> > > > > > 
> > > > > > (after applying the patch) hdparm -i /dev/hda
> > > > > > /dev/hda:
> > > > > >  Timing buffered disk reads:  240 MB in  3.02 seconds =  79.42 MB/sec
> > > > > > (dmesg 2.6.28.8)
> > > > > > ide-pmac: Found Apple UniNorth ATA-6 controller (PCI), bus ID 3, irq 39
> > > > > > Probing IDE interface ide0...
> > > > > > hda: CORE_PATA, ATA DISK drive
> > > > > > hda: host max PIO4 wanted PIO255(auto-tune) selected PIO4
> > > > > > hda: UDMA/100 mode selected
> > > > > > ide0 at 0xf102a000-0xf102a070,0xf102a160 on irq 39
> > > > > > 
> > > > > > 
> > > > > > _______________________________________________
> > > > > > Linuxppc-dev mailing list
> > > > > > Linuxppc-dev@ozlabs.org
> > > > > > https://ozlabs.org/mailman/listinfo/linuxppc-dev
> > > > > 
> > 

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

end of thread, other threads:[~2009-03-20  6:27 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-18  5:06 IDE cable detection on Apple PowerBook TOMARI Hisanobu
2009-03-18  7:58 ` Benjamin Herrenschmidt
2009-03-18 13:47   ` TOMARI Hisanobu
2009-03-19  6:07     ` Benjamin Herrenschmidt
2009-03-19  6:08       ` Benjamin Herrenschmidt
2009-03-19 13:30         ` TOMARI Hisanobu
2009-03-19 13:41           ` Anton Vorontsov
2009-03-19 21:14             ` Benjamin Herrenschmidt
2009-03-20  6:27           ` Benjamin Herrenschmidt

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.