board/BuR/common: support timer5 for pwm-backlight

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>
This commit is contained in:
Hannes Petermaier 2015-06-11 12:25:43 +02:00 committed by Tom Rini
parent 60480f8121
commit 9b63ba3727
1 changed files with 11 additions and 3 deletions

View File

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