diff options
author | Robert Keevil <rkeevil+rockbox@gmail.com> | 2009-07-17 20:40:40 +0000 |
---|---|---|
committer | Robert Keevil <rkeevil+rockbox@gmail.com> | 2009-07-17 20:40:40 +0000 |
commit | a0d630f3deeac93656e4f38b3bab6069b8817238 (patch) | |
tree | 66b5aa817976ce097ced823065731382216e1946 | |
parent | f2f9031f4f825ccd6c7429b45e63e7ece3b195af (diff) | |
download | rockbox-a0d630f3deeac93656e4f38b3bab6069b8817238.tar.gz rockbox-a0d630f3deeac93656e4f38b3bab6069b8817238.zip |
Add information gleaned from disassembling the main firmware image. Detect lcd type in use. Still no actual output
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21929 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | firmware/export/pp6100.h | 11 | ||||
-rw-r--r-- | firmware/target/arm/sandisk/sansa-view/lcd-view.c | 166 |
2 files changed, 101 insertions, 76 deletions
diff --git a/firmware/export/pp6100.h b/firmware/export/pp6100.h index 0894affdd2..33f00b305c 100644 --- a/firmware/export/pp6100.h +++ b/firmware/export/pp6100.h | |||
@@ -28,4 +28,15 @@ | |||
28 | #undef DRAM_START | 28 | #undef DRAM_START |
29 | #define DRAM_START 0x10f00000 | 29 | #define DRAM_START 0x10f00000 |
30 | 30 | ||
31 | #define GPIOM_ENABLE (*(volatile unsigned long *)(0x6000d180)) | ||
32 | #define GPIOM_OUTPUT_EN (*(volatile unsigned long *)(0x6000d190)) | ||
33 | #define GPIOM_OUTPUT_VAL (*(volatile unsigned long *)(0x6000d1a0)) | ||
34 | #define GPIOM_INPUT_VAL (*(volatile unsigned long *)(0x6000d1b0)) | ||
35 | #define GPIOM_INT_STAT (*(volatile unsigned long *)(0x6000d1c0)) | ||
36 | #define GPIOM_INT_EN (*(volatile unsigned long *)(0x6000d1d0)) | ||
37 | #define GPIOM_INT_LEV (*(volatile unsigned long *)(0x6000d1e0)) | ||
38 | #define GPIOM_INT_CLR (*(volatile unsigned long *)(0x6000d1f0)) | ||
39 | |||
40 | #define GPIOM 12 | ||
41 | |||
31 | #endif | 42 | #endif |
diff --git a/firmware/target/arm/sandisk/sansa-view/lcd-view.c b/firmware/target/arm/sandisk/sansa-view/lcd-view.c index 39b0d574eb..99c972704d 100644 --- a/firmware/target/arm/sandisk/sansa-view/lcd-view.c +++ b/firmware/target/arm/sandisk/sansa-view/lcd-view.c | |||
@@ -32,6 +32,7 @@ | |||
32 | static bool power_on = false; /* Is the power turned on? */ | 32 | static bool power_on = false; /* Is the power turned on? */ |
33 | static bool display_on SHAREDBSS_ATTR = false; /* Is the display turned on? */ | 33 | static bool display_on SHAREDBSS_ATTR = false; /* Is the display turned on? */ |
34 | static unsigned lcd_yuv_options SHAREDBSS_ATTR = 0; | 34 | static unsigned lcd_yuv_options SHAREDBSS_ATTR = 0; |
35 | static int lcd_type; | ||
35 | 36 | ||
36 | #define LCD_DATA_OUT_GPIO GPIOH_OUTPUT_VAL | 37 | #define LCD_DATA_OUT_GPIO GPIOH_OUTPUT_VAL |
37 | #define LCD_DATA_OUT_PIN 4 | 38 | #define LCD_DATA_OUT_PIN 4 |
@@ -45,43 +46,49 @@ static unsigned lcd_yuv_options SHAREDBSS_ATTR = 0; | |||
45 | #ifdef BOOTLOADER | 46 | #ifdef BOOTLOADER |
46 | static void lcd_init_gpio(void) | 47 | static void lcd_init_gpio(void) |
47 | { | 48 | { |
48 | // OF: 0x5CC8 | 49 | /* BOOT: 0x5CC8 |
50 | OF: 0x88284 */ | ||
49 | 51 | ||
50 | outl(inl(0x70000010) | 0xFC000000, 0x70000010); | 52 | outl(inl(0x70000010) | 0xFC000000, 0x70000010); |
51 | outl(inl(0x70000014) | 0xC300000, 0x70000014); | 53 | outl(inl(0x70000014) | 0xC300000, 0x70000014); |
52 | 54 | ||
53 | GPIOE_ENABLE = 0; | 55 | GPIOE_ENABLE = 0; |
54 | /* TODO: check GPIOM exists and isn't just atomic access */ | 56 | GPIOM_ENABLE &= ~0x3; |
55 | /* GPIOM_ENABLE &= ~0x3; */ | 57 | GPIOF_ENABLE = 0; |
56 | GPIOJ_ENABLE &= ~0x1a; | 58 | GPIOJ_ENABLE &= ~0x1a; |
57 | GPIOB_ENABLE &= ~0x8; | 59 | GPIOB_ENABLE &= ~0x8; |
58 | GPIOH_OUTPUT_VAL |= 0x80; | 60 | GPIOH_OUTPUT_VAL |= 0x80; |
59 | GPIOH_OUTPUT_EN |= 0x80; | 61 | GPIOH_OUTPUT_EN |= 0x80; |
60 | GPIOH_ENABLE |= 0x80; | 62 | GPIOH_ENABLE |= 0x80; |
61 | GPIOH_OUTPUT_VAL |= 0x40; | 63 | GPIOH_OUTPUT_VAL |= 0x40; |
62 | GPIOH_OUTPUT_EN |= 0x40; | 64 | GPIOH_OUTPUT_EN |= 0x40; |
63 | GPIOH_ENABLE |= 0x40; | 65 | GPIOH_ENABLE |= 0x40; |
64 | GPIOH_OUTPUT_VAL |= 0x20; | 66 | GPIOH_OUTPUT_VAL |= 0x20; |
65 | GPIOH_OUTPUT_EN |= 0x20; | 67 | GPIOH_OUTPUT_EN |= 0x20; |
66 | GPIOH_ENABLE |= 0x20; | 68 | GPIOH_ENABLE |= 0x20; |
67 | GPIOH_OUTPUT_VAL |= 0x10; | 69 | GPIOH_OUTPUT_VAL |= 0x10; |
68 | GPIOH_OUTPUT_EN |= 0x10; | 70 | GPIOH_OUTPUT_EN |= 0x10; |
69 | GPIOH_ENABLE |= 0x10; | 71 | GPIOH_ENABLE |= 0x10; |
70 | // GPIOD_OUTOUT_VAL &= ~0x1; //backlight on | 72 | GPIOD_OUTPUT_VAL |= 0x1; /* backlight on */ |
71 | // GPIOD_ENABLE |= 0x1; | 73 | GPIOD_ENABLE |= 0x1; |
72 | GPIOB_OUTPUT_VAL |= 0x4; | 74 | GPIOB_OUTPUT_VAL |= 0x4; |
73 | GPIOB_ENABLE |= 0x4; | 75 | GPIOB_ENABLE |= 0x4; |
74 | GPIOB_OUTPUT_EN |= 0x4; | 76 | GPIOB_OUTPUT_EN |= 0x4; |
75 | GPIOG_ENABLE |= 0x8; | 77 | DEV_INIT2 = 0x40000000; |
76 | GPIOG_OUTPUT_EN &= ~0x8; | 78 | GPIOG_ENABLE |= 0x8; |
77 | 79 | GPIOG_OUTPUT_EN &= ~0x8; | |
78 | // more to add here... | 80 | |
81 | if (GPIOG_INPUT_VAL & 0x8) | ||
82 | lcd_type = 1; | ||
83 | else | ||
84 | lcd_type = 0; | ||
79 | } | 85 | } |
80 | #endif | 86 | #endif |
81 | 87 | ||
82 | static void lcd_send_msg(unsigned char count, unsigned int data) | 88 | static void lcd_send_msg(unsigned char count, unsigned int data) |
83 | { | 89 | { |
84 | // OF: 0x645C | 90 | /* BOOT: 0x645C |
91 | OF: 0x88E90 */ | ||
85 | int i; | 92 | int i; |
86 | 93 | ||
87 | LCD_CLOCK_GPIO |= (1 << LCD_CLOCK_PIN); | 94 | LCD_CLOCK_GPIO |= (1 << LCD_CLOCK_PIN); |
@@ -89,13 +96,11 @@ static void lcd_send_msg(unsigned char count, unsigned int data) | |||
89 | 96 | ||
90 | for (i = count - 1; i >= 0; i--) | 97 | for (i = count - 1; i >= 0; i--) |
91 | { | 98 | { |
92 | if (data & (1 << count)) | 99 | if (data & (1 << i)) |
93 | { | 100 | { |
94 | // LCD_DATA_OUT_GPIO &= ~(1 << LCD_DATA_OUT_PIN); | ||
95 | LCD_DATA_OUT_GPIO |= (1 << LCD_DATA_OUT_PIN); | ||
96 | } else { | ||
97 | // LCD_DATA_OUT_GPIO |= (1 << LCD_DATA_OUT_PIN); | ||
98 | LCD_DATA_OUT_GPIO &= ~(1 << LCD_DATA_OUT_PIN); | 101 | LCD_DATA_OUT_GPIO &= ~(1 << LCD_DATA_OUT_PIN); |
102 | } else { | ||
103 | LCD_DATA_OUT_GPIO |= (1 << LCD_DATA_OUT_PIN); | ||
99 | } | 104 | } |
100 | LCD_CLOCK_GPIO &= ~(1 << LCD_CLOCK_PIN); | 105 | LCD_CLOCK_GPIO &= ~(1 << LCD_CLOCK_PIN); |
101 | udelay(1); | 106 | udelay(1); |
@@ -152,9 +157,23 @@ static void lcd_write_reg(unsigned int cmd, unsigned int data) | |||
152 | lcd_write_info(data); | 157 | lcd_write_info(data); |
153 | } | 158 | } |
154 | 159 | ||
160 | void lcd_reset(void) | ||
161 | { | ||
162 | /* BOOT: 0x623C | ||
163 | OF: 0x88BDC */ | ||
164 | |||
165 | GPIOB_OUTPUT_VAL |= 0x4; | ||
166 | udelay(1000); | ||
167 | GPIOB_OUTPUT_VAL &= ~0x4; | ||
168 | udelay(10000); | ||
169 | GPIOB_OUTPUT_VAL |= 0x4; | ||
170 | udelay(50000); | ||
171 | } | ||
172 | |||
155 | /* Run the powerup sequence for the driver IC */ | 173 | /* Run the powerup sequence for the driver IC */ |
156 | static void lcd_power_on(void) | 174 | static void lcd_power_on(void) |
157 | { | 175 | { |
176 | lcd_reset(); | ||
158 | /* OF: 0x5DC0 * | 177 | /* OF: 0x5DC0 * |
159 | * r2: cmd * | 178 | * r2: cmd * |
160 | * r3: data */ | 179 | * r3: data */ |
@@ -180,28 +199,10 @@ static void lcd_power_on(void) | |||
180 | lcd_write_reg(0x12, 0x13c); | 199 | lcd_write_reg(0x12, 0x13c); |
181 | sleep(HZ/20); | 200 | sleep(HZ/20); |
182 | 201 | ||
183 | // OF: BNE 0x5fb2 | 202 | /* BOOT: BNE 0x5fb2 */ |
184 | 203 | ||
185 | // two different models in use?!? | 204 | if (lcd_type == 0) |
186 | if (1) | ||
187 | { | ||
188 | lcd_write_reg(0x13, 0x1800); | ||
189 | lcd_write_reg(0x29, 0x13); | ||
190 | sleep(HZ/10); | ||
191 | lcd_write_reg(0x20, 0x0); | ||
192 | lcd_write_reg(0x21, 0x0); | ||
193 | |||
194 | lcd_write_reg(0x30, 0x2); | ||
195 | lcd_write_reg(0x31, 0xF07); // 0x37 option in other controller | ||
196 | lcd_write_reg(0x32, 0x403); // 0x31 option in other controller | ||
197 | lcd_write_reg(0x35, 0x206); | ||
198 | lcd_write_reg(0x36, 0x504); | ||
199 | lcd_write_reg(0x37, 0x707); | ||
200 | lcd_write_reg(0x38, 0x403); | ||
201 | } | ||
202 | else | ||
203 | { | 205 | { |
204 | // OF: last func continues, 0x5EFC | ||
205 | lcd_write_reg(0x13, 0x1700); | 206 | lcd_write_reg(0x13, 0x1700); |
206 | lcd_write_reg(0x29, 0x10); | 207 | lcd_write_reg(0x29, 0x10); |
207 | sleep(HZ/10); | 208 | sleep(HZ/10); |
@@ -213,21 +214,38 @@ static void lcd_power_on(void) | |||
213 | lcd_write_reg(0x32, 0x400); | 214 | lcd_write_reg(0x32, 0x400); |
214 | lcd_write_reg(0x35, 0x3); | 215 | lcd_write_reg(0x35, 0x3); |
215 | lcd_write_reg(0x36, 0xF07); | 216 | lcd_write_reg(0x36, 0xF07); |
216 | lcd_write_reg(0x37, 0x403); | 217 | lcd_write_reg(0x37, 0x606); |
217 | lcd_write_reg(0x37, 0x106); | 218 | lcd_write_reg(0x38, 0x106); |
219 | lcd_write_reg(0x39, 0x7); | ||
220 | } | ||
221 | else | ||
222 | { | ||
223 | lcd_write_reg(0x13, 0x1800); | ||
224 | lcd_write_reg(0x29, 0x13); | ||
225 | sleep(HZ/10); | ||
226 | lcd_write_reg(0x20, 0x0); | ||
227 | lcd_write_reg(0x21, 0x0); | ||
228 | |||
229 | lcd_write_reg(0x30, 0x2); | ||
230 | lcd_write_reg(0x31, 0x606); | ||
231 | lcd_write_reg(0x32, 0x501); | ||
232 | lcd_write_reg(0x35, 0x206); | ||
233 | lcd_write_reg(0x36, 0x504); | ||
234 | lcd_write_reg(0x37, 0x707); | ||
235 | lcd_write_reg(0x38, 0x306); | ||
236 | lcd_write_reg(0x39, 0x9); | ||
218 | } | 237 | } |
219 | 238 | ||
220 | // OF: b 0x6066 | 239 | /* BOOT: 0x6066 */ |
221 | lcd_write_reg(0x39, 0x7); | ||
222 | lcd_write_reg(0x3c, 0x700); | 240 | lcd_write_reg(0x3c, 0x700); |
223 | lcd_write_reg(0x3d, 0x700); | 241 | lcd_write_reg(0x3d, 0x700); |
224 | 242 | ||
225 | lcd_write_reg(0x50, 0x0); | 243 | lcd_write_reg(0x50, 0x0); |
226 | lcd_write_reg(0x51, 0xef); // 239 - LCD_WIDTH | 244 | lcd_write_reg(0x51, 0xef); /* 239 - LCD_WIDTH */ |
227 | lcd_write_reg(0x52, 0x0); | 245 | lcd_write_reg(0x52, 0x0); |
228 | lcd_write_reg(0x53, 0x13f); // 319 - LCD_HEIGHT | 246 | lcd_write_reg(0x53, 0x13f); /* 319 - LCD_HEIGHT */ |
229 | 247 | ||
230 | // OF: b 0x6114 | 248 | /* BOOT: b 0x6114 */ |
231 | lcd_write_reg(0x60, 0x2700); | 249 | lcd_write_reg(0x60, 0x2700); |
232 | lcd_write_reg(0x61, 0x1); | 250 | lcd_write_reg(0x61, 0x1); |
233 | lcd_write_reg(0x6a, 0x0); | 251 | lcd_write_reg(0x6a, 0x0); |
@@ -239,7 +257,7 @@ static void lcd_power_on(void) | |||
239 | lcd_write_reg(0x84, 0x0); | 257 | lcd_write_reg(0x84, 0x0); |
240 | lcd_write_reg(0x85, 0x0); | 258 | lcd_write_reg(0x85, 0x0); |
241 | 259 | ||
242 | // OF: 0x61A8 | 260 | /* BOOT: 0x61A8 */ |
243 | lcd_write_reg(0x90, 0x10); | 261 | lcd_write_reg(0x90, 0x10); |
244 | lcd_write_reg(0x92, 0x0); | 262 | lcd_write_reg(0x92, 0x0); |
245 | lcd_write_reg(0x93, 0x3); | 263 | lcd_write_reg(0x93, 0x3); |
@@ -250,14 +268,15 @@ static void lcd_power_on(void) | |||
250 | lcd_write_reg(0xc, 0x110); | 268 | lcd_write_reg(0xc, 0x110); |
251 | lcd_write_reg(0x7, 0x173); | 269 | lcd_write_reg(0x7, 0x173); |
252 | sleep(HZ/10); | 270 | sleep(HZ/10); |
253 | lcd_write_cmd(0x22); | ||
254 | 271 | ||
255 | power_on = true; | 272 | power_on = true; |
256 | } | 273 | } |
257 | 274 | ||
275 | /* unknown 01 and 02 - sleep or enable on and off funcs? */ | ||
258 | void unknown01(void) | 276 | void unknown01(void) |
259 | { | 277 | { |
260 | // OF: 0x62C4 | 278 | /* BOOT: 0x62C4 |
279 | OF: 0x88CA0 */ | ||
261 | 280 | ||
262 | lcd_write_reg(0x10, 0x17B0); | 281 | lcd_write_reg(0x10, 0x17B0); |
263 | udelay(100); | 282 | udelay(100); |
@@ -266,30 +285,26 @@ void unknown01(void) | |||
266 | 285 | ||
267 | void unknown02(void) | 286 | void unknown02(void) |
268 | { | 287 | { |
269 | // OF: 0x6308 | 288 | /* BOOT: 0x6308 |
289 | OF: 0x88D0C */ | ||
270 | 290 | ||
271 | lcd_write_reg(0x7, 0x160); | 291 | lcd_write_reg(0x7, 0x160); |
272 | lcd_write_reg(0x10, 0x17B1); | 292 | lcd_write_reg(0x10, 0x17B1); |
273 | } | 293 | } |
274 | 294 | ||
275 | void unknown03(void) | 295 | void unknown03(bool r0) |
276 | { | ||
277 | // OF: 0x6410 | ||
278 | GPIOJ_ENABLE |= 0x2; | ||
279 | GPIOJ_OUTPUT_EN |= 0x2; | ||
280 | GPIOJ_OUTPUT_VAL &= ~0x02; | ||
281 | } | ||
282 | |||
283 | void unknown04(void) | ||
284 | { | 296 | { |
285 | // OF: 0x623C | 297 | /* BOOT: 0x6410 |
298 | OF: 0x88E30 */ | ||
286 | 299 | ||
287 | GPIOB_OUTPUT_VAL |= 0x4; | 300 | if (r0) |
288 | udelay(1000); | 301 | GPIOJ_ENABLE &= ~0x2; |
289 | GPIOB_OUTPUT_VAL &= ~0x4; | 302 | else |
290 | sleep(HZ/10); | 303 | { |
291 | GPIOB_OUTPUT_VAL |= 0x4; | 304 | GPIOJ_ENABLE |= 0x2; |
292 | udelay(1000); | 305 | GPIOJ_OUTPUT_EN |= 0x2; |
306 | GPIOJ_OUTPUT_VAL &= ~0x02; | ||
307 | } | ||
293 | } | 308 | } |
294 | 309 | ||
295 | /* Run the display on sequence for the driver IC */ | 310 | /* Run the display on sequence for the driver IC */ |
@@ -316,7 +331,6 @@ void lcd_init_device(void) | |||
316 | { | 331 | { |
317 | 332 | ||
318 | #ifdef BOOTLOADER /* Bother at all to do this again? */ | 333 | #ifdef BOOTLOADER /* Bother at all to do this again? */ |
319 | //#if 0 | ||
320 | /* Init GPIO ports */ | 334 | /* Init GPIO ports */ |
321 | lcd_init_gpio(); | 335 | lcd_init_gpio(); |
322 | lcd_power_on(); | 336 | lcd_power_on(); |