summaryrefslogtreecommitdiff
path: root/board/inka4x0/inka4x0.c
diff options
context:
space:
mode:
authorwdenk <wdenk>2005-03-14 13:14:58 +0000
committerwdenk <wdenk>2005-03-14 13:14:58 +0000
commita0bdf49e399e9e25e71081c5b3e73fc56c63a236 (patch)
tree9267533169022c0629e259db22382d4471cf2edb /board/inka4x0/inka4x0.c
parente9684a536a6769475b0b8cbac8b443e9acba9d60 (diff)
INKA4x0: Allow initialization of LCD backlight dimming from
"brightness" environment variable.
Diffstat (limited to 'board/inka4x0/inka4x0.c')
-rw-r--r--board/inka4x0/inka4x0.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/board/inka4x0/inka4x0.c b/board/inka4x0/inka4x0.c
index f5e32cc589..c17b8feb41 100644
--- a/board/inka4x0/inka4x0.c
+++ b/board/inka4x0/inka4x0.c
@@ -177,6 +177,16 @@ void flash_preinit(void)
int misc_init_f (void)
{
+ uchar tmp[10];
+ int i, br;
+
+ i = getenv_r("brightness", tmp, sizeof(tmp));
+ br = (i > 0)
+ ? (int) simple_strtoul (tmp, NULL, 10)
+ : CFG_BRIGHTNESS;
+ if (br > 255)
+ br = 255;
+
/* Initialize GPIO output pins.
*/
/* Configure GPT as GPIO output */
@@ -187,6 +197,11 @@ int misc_init_f (void)
*(vu_long *)MPC5XXX_GPT4_ENABLE =
*(vu_long *)MPC5XXX_GPT5_ENABLE = 0x24;
+ /* Configure GPT7 as PWM timer, 1kHz, no ints. */
+ *(vu_long *)MPC5XXX_GPT7_ENABLE = 0;/* Disable */
+ *(vu_long *)MPC5XXX_GPT7_COUNTER = 0x020000fe;
+ *(vu_long *)MPC5XXX_GPT7_PWMCFG = (br << 16);
+ *(vu_long *)MPC5XXX_GPT7_ENABLE = 0x3;/* Enable PWM mode and start */
/* Configure PSC3_6,7 as GPIO output */
*(vu_long *)MPC5XXX_GPIO_ENABLE |= 0x00003000;