Commit a0bdf49e399e9e25e71081c5b3e73fc56c63a236
1 parent
e9684a536a
Exists in
master
and in
55 other branches
INKA4x0: Allow initialization of LCD backlight dimming from
"brightness" environment variable.
Showing 4 changed files with 20 additions and 0 deletions Side-by-side Diff
CHANGELOG
... | ... | @@ -5,6 +5,9 @@ |
5 | 5 | * Patch by Stefan Roese, 14 March 2005: |
6 | 6 | Update for esd voh405 fpga image |
7 | 7 | |
8 | +* INKA4x0: Allow initialization of LCD backlight dimming from | |
9 | + "brightness" environment variable. | |
10 | + | |
8 | 11 | * Add port initialization for digital I/O on INKA4x0 |
9 | 12 | |
10 | 13 | * Patch by Stefan Roese, 01 March 2005: |
board/inka4x0/inka4x0.c
... | ... | @@ -177,6 +177,16 @@ |
177 | 177 | |
178 | 178 | int misc_init_f (void) |
179 | 179 | { |
180 | + uchar tmp[10]; | |
181 | + int i, br; | |
182 | + | |
183 | + i = getenv_r("brightness", tmp, sizeof(tmp)); | |
184 | + br = (i > 0) | |
185 | + ? (int) simple_strtoul (tmp, NULL, 10) | |
186 | + : CFG_BRIGHTNESS; | |
187 | + if (br > 255) | |
188 | + br = 255; | |
189 | + | |
180 | 190 | /* Initialize GPIO output pins. |
181 | 191 | */ |
182 | 192 | /* Configure GPT as GPIO output */ |
... | ... | @@ -187,6 +197,11 @@ |
187 | 197 | *(vu_long *)MPC5XXX_GPT4_ENABLE = |
188 | 198 | *(vu_long *)MPC5XXX_GPT5_ENABLE = 0x24; |
189 | 199 | |
200 | + /* Configure GPT7 as PWM timer, 1kHz, no ints. */ | |
201 | + *(vu_long *)MPC5XXX_GPT7_ENABLE = 0;/* Disable */ | |
202 | + *(vu_long *)MPC5XXX_GPT7_COUNTER = 0x020000fe; | |
203 | + *(vu_long *)MPC5XXX_GPT7_PWMCFG = (br << 16); | |
204 | + *(vu_long *)MPC5XXX_GPT7_ENABLE = 0x3;/* Enable PWM mode and start */ | |
190 | 205 | |
191 | 206 | /* Configure PSC3_6,7 as GPIO output */ |
192 | 207 | *(vu_long *)MPC5XXX_GPIO_ENABLE |= 0x00003000; |
include/configs/inka4x0.h
include/mpc5xxx.h
... | ... | @@ -248,6 +248,7 @@ |
248 | 248 | #define MPC5XXX_GPT7_ENABLE (MPC5XXX_GPT + 0x70) |
249 | 249 | #define MPC5XXX_GPT7_COUNTER (MPC5XXX_GPT + 0x74) |
250 | 250 | |
251 | +#define MPC5XXX_GPT7_PWMCFG (MPC5XXX_GPT + 0x78) | |
251 | 252 | |
252 | 253 | /* ATA registers */ |
253 | 254 | #define MPC5XXX_ATA_HOST_CONFIG (MPC5XXX_ATA + 0x0000) |