From d38a0f34af309c854c90975e1c1fc44efb142086 Mon Sep 17 00:00:00 2001 From: Albert Lee Date: Tue, 26 Jun 2007 13:43:15 +0800 Subject: [PATCH] --- yaml --- r: 58131 b: refs/heads/master c: 8c781bf77a339748839bfd5eedfe2ad3e0e05c4a h: refs/heads/master i: 58129: a29ac063c37c8728fb362457b062c8151a12ab8f 58127: 8eeedab9b9d5c36ce0e547be99b8e3aa7b7c0607 v: v3 --- [refs] | 2 +- trunk/drivers/ata/pata_pdc2027x.c | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index 3fcf9f334f17..c7e4e289a49d 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: abcdceb9d0bf39da7c7ff8bcdff6eb4d9dfec56f +refs/heads/master: 8c781bf77a339748839bfd5eedfe2ad3e0e05c4a diff --git a/trunk/drivers/ata/pata_pdc2027x.c b/trunk/drivers/ata/pata_pdc2027x.c index 0d2cc49fde4b..69a5aa4949f5 100644 --- a/trunk/drivers/ata/pata_pdc2027x.c +++ b/trunk/drivers/ata/pata_pdc2027x.c @@ -689,10 +689,12 @@ static long pdc_detect_pll_input_clock(struct ata_host *host) void __iomem *mmio_base = host->iomap[PDC_MMIO_BAR]; u32 scr; long start_count, end_count; - long pll_clock; + struct timeval start_time, end_time; + long pll_clock, usec_elapsed; /* Read current counter value */ start_count = pdc_read_counter(host); + do_gettimeofday(&start_time); /* Start the test mode */ scr = readl(mmio_base + PDC_SYS_CTL); @@ -705,6 +707,7 @@ static long pdc_detect_pll_input_clock(struct ata_host *host) /* Read the counter values again */ end_count = pdc_read_counter(host); + do_gettimeofday(&end_time); /* Stop the test mode */ scr = readl(mmio_base + PDC_SYS_CTL); @@ -713,7 +716,11 @@ static long pdc_detect_pll_input_clock(struct ata_host *host) readl(mmio_base + PDC_SYS_CTL); /* flush */ /* calculate the input clock in Hz */ - pll_clock = (start_count - end_count) * 10; + usec_elapsed = (end_time.tv_sec - start_time.tv_sec) * 1000000 + + (end_time.tv_usec - start_time.tv_usec); + + 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);