From patchwork Wed Mar 18 05:06:38 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: TOMARI Hisanobu X-Patchwork-Id: 24616 X-Patchwork-Delegate: benh@kernel.crashing.org Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id CB01FDE236 for ; Wed, 18 Mar 2009 16:07:06 +1100 (EST) X-Original-To: linuxppc-dev@ozlabs.org Delivered-To: linuxppc-dev@ozlabs.org Received: from wa-out-1112.google.com (wa-out-1112.google.com [209.85.146.176]) by ozlabs.org (Postfix) with ESMTP id D6876DDEF3 for ; Wed, 18 Mar 2009 16:06:39 +1100 (EST) Received: by wa-out-1112.google.com with SMTP id j37so192455waf.9 for ; Tue, 17 Mar 2009 22:06:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:subject :message-id:x-mailer:mime-version:content-type; bh=Q84oOB/iBn4JgyyleqcXJiuoJ8a2M1TzmbxTShZXses=; b=b+qIYKFggKUur/q+Dzy0EsAnuRcm5YAvDibmDJC2F9hwR7Wa0YQKO5917+y+4+hx3w tfqzmezmFWc9vZ2NO5RTm/dVMpWntMlRdhQtQBt21EZKR0tssOjI7RtnlzASTPTD3z9B o2LIMLtDQ3qsU5Wvs0BOZi3/C7EzrOKvQ0srY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:subject:message-id:x-mailer:mime-version:content-type; b=K1YZvL/XH2zh75DeBSDXSXG6+47zwzU7QD/rqPEOeTEGSlCYZVCUqt79651Me9Eu7o 9hNIyK4uOfF4CT5Ge6uFrXYAIqXlmtj0tqot9Ycp0hCK/onVaZlB2Kbf7FHi3S0MJRbY hQOuM+p8o6nkA8+rmNLgG9fb/Rhaa7yZxiTkE= Received: by 10.114.125.15 with SMTP id x15mr89618wac.217.1237352798316; Tue, 17 Mar 2009 22:06:38 -0700 (PDT) Received: from mono.is.s.u-tokyo.ac.jp (csefs0f.is.s.u-tokyo.ac.jp [133.11.30.84]) by mx.google.com with ESMTPS id q20sm3805404pog.8.2009.03.17.22.06.35 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 17 Mar 2009 22:06:37 -0700 (PDT) Date: Wed, 18 Mar 2009 14:06:38 +0900 From: TOMARI Hisanobu To: linuxppc-dev@ozlabs.org Subject: IDE cable detection on Apple PowerBook Message-Id: <20090318140638.e6b61eaa.posco.grubb@gmail.com> X-Mailer: Sylpheed 2.4.8 (GTK+ 2.12.9; x86_64-pc-linux-gnu) Mime-Version: 1.0 X-BeenThere: linuxppc-dev@ozlabs.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org 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 *** 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.