From: Albert Lee <albertcc@tw.ibm.com>
To: Mikael Pettersson <mikpe@it.uu.se>
Cc: alan@lxorguk.ukuu.org.uk, bahadir.balban@gmail.com,
dwm@enoyolf.org, jeff@garzik.org, linux-ide@vger.kernel.org,
linuxppc-dev@ozlabs.org, sshtylyov@ru.mvista.com
Subject: Re: [PATCH 1/1] libata: pata_pdc2027x PLL input clock fix
Date: Wed, 11 Jul 2007 10:45:35 +0800 [thread overview]
Message-ID: <4694444F.3050909@tw.ibm.com> (raw)
In-Reply-To: <200707102314.l6ANEWq2029195@harpo.it.uu.se>
Mikael Pettersson wrote:
>
>
> 2.6.22 + this prints the following on my G3:
>
> pata_pdc2027x 0000:00:0e.0: version 0.9
> usec_elapsed for mdelay(37) [35431]
> start time: [1184112028]s [775333]us
> end time: [1184112028]s [810764]us
> pata_pdc2027x 0000:00:0e.0: PLL input clock 1691741 kHz
> pata_pdc2027x: Invalid PLL input clock 1691741kHz, give up!
>
My x86 box got this:
Jul 11 10:02:17 p4ht-s kernel: [ 260.746980] ACPI: PCI Interrupt 0000:02:05.0[A] -> Link [LNK1] -> GSI 10 (level, low) -> IRQ 10
Jul 11 10:02:17 p4ht-s kernel: [ 260.882905] usec_elapsed for mdelay(37) [36734]
Jul 11 10:02:17 p4ht-s kernel: [ 260.882911] start time: [1184119336]s [999802]us
Jul 11 10:02:17 p4ht-s kernel: [ 260.882914] end time: [1184119337]s [36536]us
Jul 11 10:02:17 p4ht-s kernel: [ 260.882917] pata_pdc2027x 0000:02:05.0: PLL input clock 16829 kHz
So, it seems both mdelay(37) and do_gettimeofday() are working properly on PowerMac G3.
Maybe the calculated wrong PLL input is due to wrong reading of the counter register?
Could you please try the attached debug patch for more clue, thanks.
--
albert
diff -Nrup 00_libata-dev/drivers/ata/pata_pdc2027x.c 01_debug/drivers/ata/pata_pdc2027x.c
--- 00_libata-dev/drivers/ata/pata_pdc2027x.c 2007-07-07 09:58:55.000000000 +0800
+++ 01_debug/drivers/ata/pata_pdc2027x.c 2007-07-11 10:41:41.000000000 +0800
@@ -574,8 +574,8 @@ retry:
counter = (bccrh << 15) | bccrl;
- PDPRINTK("bccrh [%X] bccrl [%X]\n", bccrh, bccrl);
- PDPRINTK("bccrhv[%X] bccrlv[%X]\n", bccrhv, bccrlv);
+ printk(KERN_ERR "bccrh [%X] bccrl [%X]\n", bccrh, bccrl);
+ printk(KERN_ERR "bccrhv[%X] bccrlv[%X]\n", bccrhv, bccrlv);
/*
* The 30-bit decreasing counter are read by 2 pieces.
@@ -584,7 +584,7 @@ retry:
*/
if (retry && !(bccrh == bccrhv && bccrl >= bccrlv)) {
retry--;
- PDPRINTK("rereading counter\n");
+ printk(KERN_ERR "rereading counter\n");
goto retry;
}
@@ -722,8 +722,21 @@ static long pdc_detect_pll_input_clock(s
pll_clock = (start_count - end_count) / 100 *
(100000000 / usec_elapsed);
- PDPRINTK("start[%ld] end[%ld] \n", start_count, end_count);
- PDPRINTK("PLL input clock[%ld]Hz\n", pll_clock);
+ printk(KERN_ERR "start[%ld] end[%ld] \n", start_count, end_count);
+ printk(KERN_ERR "usec_elapsed for mdelay(100) [%ld]\n", usec_elapsed);
+ printk(KERN_ERR "start time: [%ld]s [%ld]us \n", start_time.tv_sec, start_time.tv_usec);
+ printk(KERN_ERR "end time: [%ld]s [%ld]us \n", end_time.tv_sec, end_time.tv_usec);
+ printk(KERN_ERR "PLL input clock[%ld]Hz\n", pll_clock);
+
+ /* mdelay(37) for comparison */
+ do_gettimeofday(&start_time);
+ mdelay(37);
+ do_gettimeofday(&end_time);
+ usec_elapsed = (end_time.tv_sec - start_time.tv_sec) * 1000000 +
+ (end_time.tv_usec - start_time.tv_usec);
+ printk(KERN_ERR "usec_elapsed for mdelay(37) [%ld]\n", usec_elapsed);
+ printk(KERN_ERR "start time: [%ld]s [%ld]us \n", start_time.tv_sec, start_time.tv_usec);
+ printk(KERN_ERR "end time: [%ld]s [%ld]us \n", end_time.tv_sec, end_time.tv_usec);
return pll_clock;
}
next prev parent reply other threads:[~2007-07-11 2:45 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-10 23:14 [PATCH 1/1] libata: pata_pdc2027x PLL input clock fix Mikael Pettersson
2007-07-11 2:45 ` Albert Lee [this message]
-- strict thread matches above, loose matches on Subject: below --
2007-10-14 18:33 Mikael Pettersson
2007-08-17 20:51 Mikael Pettersson
2007-10-14 17:31 ` Jeff Garzik
2007-07-11 10:26 Mikael Pettersson
2007-07-16 9:12 ` Albert Lee
2007-07-09 23:04 Mikael Pettersson
2007-07-10 3:52 ` Albert Lee
2007-08-16 19:11 ` Jeff Garzik
2007-08-16 20:19 ` Alan Cox
2007-06-21 11:47 ide/dma not working from 2.6.19 to 2.6.21 Bahadir Balban
2007-06-21 15:28 ` Sergei Shtylyov
2007-06-25 5:22 ` Albert Lee
2007-06-25 9:10 ` Alan Cox
2007-06-26 5:05 ` Albert Lee
2007-06-26 5:43 ` [PATCH 1/1] libata: pata_pdc2027x PLL input clock fix Albert Lee
2007-07-02 14:14 ` Jeff Garzik
2007-07-02 18:13 ` Bartlomiej Zolnierkiewicz
2007-07-02 18:00 ` Sergei Shtylyov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4694444F.3050909@tw.ibm.com \
--to=albertcc@tw.ibm.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=albertl@mail.com \
--cc=bahadir.balban@gmail.com \
--cc=dwm@enoyolf.org \
--cc=jeff@garzik.org \
--cc=linux-ide@vger.kernel.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=mikpe@it.uu.se \
--cc=sshtylyov@ru.mvista.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).