]> git.karo-electronics.de Git - karo-tx-uboot.git/commitdiff
board/BuR/common: support timer5 for pwm-backlight
authorHannes Petermaier <oe5hpm@oevsv.at>
Thu, 11 Jun 2015 10:25:43 +0000 (12:25 +0200)
committerTom Rini <trini@konsulko.com>
Thu, 18 Jun 2015 20:11:40 +0000 (16:11 -0400)
in future we support yet another b&r am335x based board, where Timer 5 is
wired to backlight-driver.

So we introduce a new driver-type '2' to setup timer5 instead timer6.

Signed-off-by: Hannes Schmelzer <oe5hpm@oevsv.at>
Reviewed-by: Simon Glass <sjg@chromium.org>
board/BuR/common/common.c

index 7830d1a200e1b0334e9f292c24693a09f016e3a0..441465c005ec4cba07cb0e2783fcfd928df3c28a 100644 (file)
@@ -64,14 +64,21 @@ void lcdbacklight(int on)
        unsigned int pwmfrq = getenv_ulong("ds1_pwmfreq", 10, ~0UL);
 #endif
        unsigned int tmp;
-
-       struct gptimer *const timerhw = (struct gptimer *)DM_TIMER6_BASE;
+       struct gptimer *timerhw;
 
        if (on)
                bright = bright != ~0UL ? bright : 50;
        else
                bright = 0;
 
+       switch (driver) {
+       case 2:
+               timerhw = (struct gptimer *)DM_TIMER5_BASE;
+               break;
+       default:
+               timerhw = (struct gptimer *)DM_TIMER6_BASE;
+       }
+
        switch (driver) {
        case 0: /* PMIC LED-Driver */
                /* brightness level */
@@ -83,7 +90,8 @@ void lcdbacklight(int on)
                                   bright != 0 ? 0x0A : 0x02,
                                   0xFF);
                break;
-       case 1: /* PWM using timer6 */
+       case 1:
+       case 2: /* PWM using timer */
                if (pwmfrq != ~0UL) {
                        timerhw->tiocp_cfg = TCFG_RESET;
                        udelay(10);