Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 58131
b: refs/heads/master
c: 8c781bf
h: refs/heads/master
i:
  58129: a29ac06
  58127: 8eeedab
v: v3
  • Loading branch information
Albert Lee authored and Jeff Garzik committed Jul 2, 2007
1 parent a84c713 commit d38a0f3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: abcdceb9d0bf39da7c7ff8bcdff6eb4d9dfec56f
refs/heads/master: 8c781bf77a339748839bfd5eedfe2ad3e0e05c4a
11 changes: 9 additions & 2 deletions trunk/drivers/ata/pata_pdc2027x.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit d38a0f3

Please sign in to comment.