diff options
Diffstat (limited to 'firmware/system.c')
-rw-r--r-- | firmware/system.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/firmware/system.c b/firmware/system.c index 8bdd821e60..b41337b8fe 100644 --- a/firmware/system.c +++ b/firmware/system.c | |||
@@ -594,6 +594,13 @@ int system_memory_guard(int newmode) | |||
594 | #define DEFAULT_REFRESH_TIMER 1 | 594 | #define DEFAULT_REFRESH_TIMER 1 |
595 | #endif | 595 | #endif |
596 | 596 | ||
597 | #ifdef IRIVER_H300_SERIES | ||
598 | #define RECALC_DELAYS(f) \ | ||
599 | pcf50606_i2c_recalc_delay(f) | ||
600 | #else | ||
601 | #define RECALC_DELAYS(f) | ||
602 | #endif | ||
603 | |||
597 | void set_cpu_frequency (long) __attribute__ ((section (".icode"))); | 604 | void set_cpu_frequency (long) __attribute__ ((section (".icode"))); |
598 | void set_cpu_frequency(long frequency) | 605 | void set_cpu_frequency(long frequency) |
599 | { | 606 | { |
@@ -604,6 +611,7 @@ void set_cpu_frequency(long frequency) | |||
604 | /* Refresh timer for bypass frequency */ | 611 | /* Refresh timer for bypass frequency */ |
605 | PLLCR &= ~1; /* Bypass mode */ | 612 | PLLCR &= ~1; /* Bypass mode */ |
606 | timers_adjust_prescale(CPUFREQ_DEFAULT_MULT, false); | 613 | timers_adjust_prescale(CPUFREQ_DEFAULT_MULT, false); |
614 | RECALC_DELAYS(CPUFREQ_MAX); | ||
607 | PLLCR = 0x11c56005; | 615 | PLLCR = 0x11c56005; |
608 | CSCR0 = 0x00001180; /* Flash: 4 wait states */ | 616 | CSCR0 = 0x00001180; /* Flash: 4 wait states */ |
609 | CSCR1 = 0x00000980; /* LCD: 2 wait states */ | 617 | CSCR1 = 0x00000980; /* LCD: 2 wait states */ |
@@ -615,12 +623,13 @@ void set_cpu_frequency(long frequency) | |||
615 | IDECONFIG1 = 0x106000 | (5 << 10); /* BUFEN2 enable + CS2Pre/CS2Post */ | 623 | IDECONFIG1 = 0x106000 | (5 << 10); /* BUFEN2 enable + CS2Pre/CS2Post */ |
616 | IDECONFIG2 = 0x40000 | (1 << 8); /* TA enable + CS2wait */ | 624 | IDECONFIG2 = 0x40000 | (1 << 8); /* TA enable + CS2wait */ |
617 | break; | 625 | break; |
618 | 626 | ||
619 | case CPUFREQ_NORMAL: | 627 | case CPUFREQ_NORMAL: |
620 | DCR = (DCR & ~0x01ff) | DEFAULT_REFRESH_TIMER; | 628 | DCR = (DCR & ~0x01ff) | DEFAULT_REFRESH_TIMER; |
621 | /* Refresh timer for bypass frequency */ | 629 | /* Refresh timer for bypass frequency */ |
622 | PLLCR &= ~1; /* Bypass mode */ | 630 | PLLCR &= ~1; /* Bypass mode */ |
623 | timers_adjust_prescale(CPUFREQ_DEFAULT_MULT, false); | 631 | timers_adjust_prescale(CPUFREQ_DEFAULT_MULT, false); |
632 | RECALC_DELAYS(CPUFREQ_NORMAL); | ||
624 | PLLCR = 0x13c5e005; | 633 | PLLCR = 0x13c5e005; |
625 | CSCR0 = 0x00000580; /* Flash: 1 wait state */ | 634 | CSCR0 = 0x00000580; /* Flash: 1 wait state */ |
626 | CSCR1 = 0x00000180; /* LCD: 0 wait states */ | 635 | CSCR1 = 0x00000180; /* LCD: 0 wait states */ |
@@ -637,6 +646,7 @@ void set_cpu_frequency(long frequency) | |||
637 | /* Refresh timer for bypass frequency */ | 646 | /* Refresh timer for bypass frequency */ |
638 | PLLCR &= ~1; /* Bypass mode */ | 647 | PLLCR &= ~1; /* Bypass mode */ |
639 | timers_adjust_prescale(CPUFREQ_DEFAULT_MULT, true); | 648 | timers_adjust_prescale(CPUFREQ_DEFAULT_MULT, true); |
649 | RECALC_DELAYS(CPUFREQ_DEFAULT); | ||
640 | PLLCR = 0x10c00200; /* Power down PLL, but keep CLSEL and CRSEL */ | 650 | PLLCR = 0x10c00200; /* Power down PLL, but keep CLSEL and CRSEL */ |
641 | CSCR0 = 0x00000180; /* Flash: 0 wait states */ | 651 | CSCR0 = 0x00000180; /* Flash: 0 wait states */ |
642 | CSCR1 = 0x00000180; /* LCD: 0 wait states */ | 652 | CSCR1 = 0x00000180; /* LCD: 0 wait states */ |