Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 58188
b: refs/heads/master
c: 8006bf5
h: refs/heads/master
v: v3
  • Loading branch information
Albert Lee authored and Bartlomiej Zolnierkiewicz committed Jul 3, 2007
1 parent df0dcae commit 15cf223
Show file tree
Hide file tree
Showing 2 changed files with 9 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: 52374f890c1d0d64148d55a20d995a0b3e0ae987
refs/heads/master: 8006bf56e360a4db71d304df778870a371a9e930
10 changes: 8 additions & 2 deletions trunk/drivers/ide/pci/pdc202xx_new.c
Original file line number Diff line number Diff line change
Expand Up @@ -306,11 +306,13 @@ static long __devinit read_counter(u32 dma_base)
*/
static long __devinit detect_pll_input_clock(unsigned long dma_base)
{
struct timeval start_time, end_time;
long start_count, end_count;
long pll_input;
long pll_input, usec_elapsed;
u8 scr1;

start_count = read_counter(dma_base);
do_gettimeofday(&start_time);

/* Start the test mode */
outb(0x01, dma_base + 0x01);
Expand All @@ -322,6 +324,7 @@ static long __devinit detect_pll_input_clock(unsigned long dma_base)
mdelay(10);

end_count = read_counter(dma_base);
do_gettimeofday(&end_time);

/* Stop the test mode */
outb(0x01, dma_base + 0x01);
Expand All @@ -333,7 +336,10 @@ static long __devinit detect_pll_input_clock(unsigned long dma_base)
* Calculate the input clock in Hz
* (the clock counter is 30 bit wide and counts down)
*/
pll_input = ((start_count - end_count) & 0x3ffffff) * 100;
usec_elapsed = (end_time.tv_sec - start_time.tv_sec) * 1000000 +
(end_time.tv_usec - start_time.tv_usec);
pll_input = ((start_count - end_count) & 0x3ffffff) / 10 *
(10000000 / usec_elapsed);

DBG("start[%ld] end[%ld]\n", start_count, end_count);

Expand Down

0 comments on commit 15cf223

Please sign in to comment.