- struct s5pc1xx_timer *const timer = s5pc1xx_get_base_timer();
- u32 val;
-
- /*
- * @ PWM Timer 4
- * Timer Freq(HZ) =
- * PCLK / { (prescaler_value + 1) * (divider_value) }
- */
-
- /* set prescaler : 16 */
- /* set divider : 2 */
- writel((PRESCALER_1 & 0xff) << 8, &timer->tcfg0);
- writel((MUX_DIV_2 & 0xf) << MUX4_DIV_SHIFT, &timer->tcfg1);
-
- if (count_value == 0) {
- /* reset initial value */
- /* count_value = 2085937.5(HZ) (per 1 sec)*/
- count_value = get_pclk() / ((PRESCALER_1 + 1) *
- (MUX_DIV_2 + 1));
-
- /* count_value / 100 = 20859.375(HZ) (per 10 msec) */
- count_value = count_value / 100;
- }
-
- /* set count value */
- writel(count_value, &timer->tcntb4);
- lastdec = count_value;
-
- val = (readl(&timer->tcon) & ~(0x07 << TCON_TIMER4_SHIFT)) |
- S5PC1XX_TCON4_AUTO_RELOAD;
-
- /* auto reload & manual update */
- writel(val | S5PC1XX_TCON4_UPDATE, &timer->tcon);
-
- /* start PWM timer 4 */
- writel(val | S5PC1XX_TCON4_START, &timer->tcon);
-
- timestamp = 0;