summaryrefslogtreecommitdiff
path: root/firmware/target/arm/imx31/gigabeat-s/timer-imx31.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/imx31/gigabeat-s/timer-imx31.c')
-rw-r--r--firmware/target/arm/imx31/gigabeat-s/timer-imx31.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/firmware/target/arm/imx31/gigabeat-s/timer-imx31.c b/firmware/target/arm/imx31/gigabeat-s/timer-imx31.c
index 531baf3cc5..c4734a543b 100644
--- a/firmware/target/arm/imx31/gigabeat-s/timer-imx31.c
+++ b/firmware/target/arm/imx31/gigabeat-s/timer-imx31.c
@@ -35,11 +35,11 @@ static void __attribute__((interrupt("IRQ"))) EPIT2_HANDLER(void)
35static void stop_timer(bool clock_off) 35static void stop_timer(bool clock_off)
36{ 36{
37 /* Ensure clock gating on (before touching any module registers) */ 37 /* Ensure clock gating on (before touching any module registers) */
38 imx31_clkctl_module_clock_gating(CG_EPIT2, CGM_ON_ALL); 38 ccm_module_clock_gating(CG_EPIT2, CGM_ON_RUN_WAIT);
39 /* Disable insterrupt */ 39 /* Disable insterrupt */
40 avic_disable_int(EPIT2); 40 avic_disable_int(INT_EPIT2);
41 /* Clear wakeup mask */ 41 /* Clear wakeup mask */
42 CLKCTL_WIMR0 &= ~WIM_IPI_INT_EPIT2; 42 CCM_WIMR0 &= ~CCM_WIMR0_IPI_INT_EPIT2;
43 /* Disable counter */ 43 /* Disable counter */
44 EPITCR2 &= ~(EPITCR_OCIEN | EPITCR_EN); 44 EPITCR2 &= ~(EPITCR_OCIEN | EPITCR_EN);
45 /* Clear pending */ 45 /* Clear pending */
@@ -48,7 +48,7 @@ static void stop_timer(bool clock_off)
48 if (clock_off) 48 if (clock_off)
49 { 49 {
50 /* Final stop, not reset; don't clock module any longer */ 50 /* Final stop, not reset; don't clock module any longer */
51 imx31_clkctl_module_clock_gating(CG_EPIT2, CGM_OFF); 51 ccm_module_clock_gating(CG_EPIT2, CGM_OFF);
52 } 52 }
53} 53}
54 54
@@ -77,7 +77,7 @@ bool _timer_set(long cycles, bool start)
77 * Reload from modulus register, 77 * Reload from modulus register,
78 * Count from load value */ 78 * Count from load value */
79 EPITCR2 = EPITCR_CLKSRC_IPG_CLK | EPITCR_WAITEN | EPITCR_IOVW | 79 EPITCR2 = EPITCR_CLKSRC_IPG_CLK | EPITCR_WAITEN | EPITCR_IOVW |
80 EPITCR_PRESCALER(1-1) | EPITCR_RLD | EPITCR_ENMOD; 80 (1-1) << EPITCR_PRESCALER_POS | EPITCR_RLD | EPITCR_ENMOD;
81 EPITLR2 = cycles; 81 EPITLR2 = cycles;
82 /* Event when counter reaches 0 */ 82 /* Event when counter reaches 0 */
83 EPITCMPR2 = 0; 83 EPITCMPR2 = 0;
@@ -95,7 +95,8 @@ bool _timer_register(void)
95 95
96 /* Enable interrupt */ 96 /* Enable interrupt */
97 EPITCR2 |= EPITCR_OCIEN; 97 EPITCR2 |= EPITCR_OCIEN;
98 avic_enable_int(EPIT2, IRQ, 8, EPIT2_HANDLER); 98 avic_enable_int(INT_EPIT2, INT_TYPE_IRQ, INT_PRIO_DEFAULT,
99 EPIT2_HANDLER);
99 /* Start timer */ 100 /* Start timer */
100 EPITCR2 |= EPITCR_EN; 101 EPITCR2 |= EPITCR_EN;
101 102