summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafaël Carré <rafael.carre@gmail.com>2010-03-28 04:10:36 +0000
committerRafaël Carré <rafael.carre@gmail.com>2010-03-28 04:10:36 +0000
commita8adcf36f116227e74831993e72cce0af924873a (patch)
tree52aec42ceca1750ea3a98f5345eb369a70cfdec7
parent839c73a8c5c940f472a9c323cb5167452e9ba181 (diff)
downloadrockbox-a8adcf36f116227e74831993e72cce0af924873a.tar.gz
rockbox-a8adcf36f116227e74831993e72cce0af924873a.zip
Fuzev2: fix LCD
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25368 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/target/arm/as3525/sansa-fuzev2/lcd-fuzev2.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/firmware/target/arm/as3525/sansa-fuzev2/lcd-fuzev2.c b/firmware/target/arm/as3525/sansa-fuzev2/lcd-fuzev2.c
index fb33104882..7e5b30d122 100644
--- a/firmware/target/arm/as3525/sansa-fuzev2/lcd-fuzev2.c
+++ b/firmware/target/arm/as3525/sansa-fuzev2/lcd-fuzev2.c
@@ -116,10 +116,12 @@ static void as3525_dbop_init(void)
116static inline void dbop_set_mode(int mode) 116static inline void dbop_set_mode(int mode)
117{ 117{
118 int delay = 10; 118 int delay = 10;
119 if (mode == 32 && (!(DBOP_CTRL & (1<<13|1<<14)))) 119 unsigned long ctrl = DBOP_CTRL;
120 DBOP_CTRL |= (1<<13|1<<14); 120 int words = (ctrl >> 13) & 3; // bits 14:13
121 else if (mode == 16 && (DBOP_CTRL & (1<<13|1<<14))) 121 if (mode == 32 && words != 2)
122 DBOP_CTRL &= ~(1<<14|1<<13); 122 DBOP_CTRL = (ctrl & ~(1<<13)) | (1<<14); // 4 serial words
123 else if (mode == 16 && words != 1)
124 DBOP_CTRL = (ctrl & ~(1<<14)) | (1<<13); // 2 serial words
123 else 125 else
124 return; 126 return;
125 while(delay--) asm volatile("nop"); 127 while(delay--) asm volatile("nop");
@@ -127,13 +129,12 @@ static inline void dbop_set_mode(int mode)
127 129
128static void dbop_write_data(const int16_t* p_bytes, int count) 130static void dbop_write_data(const int16_t* p_bytes, int count)
129{ 131{
130
131 const int32_t *data; 132 const int32_t *data;
132 if ((intptr_t)p_bytes & 0x3 || count == 1) 133 if ((intptr_t)p_bytes & 0x3 || count == 1)
133 { /* need to do a single 16bit write beforehand if the address is 134 { /* need to do a single 16bit write beforehand if the address is
134 * not word aligned or count is 1, switch to 16bit mode if needed */ 135 * not word aligned or count is 1, switch to 16bit mode if needed */
135 dbop_set_mode(16); 136 dbop_set_mode(16);
136 DBOP_DOUT16 = *p_bytes++; 137 DBOP_DOUT16 = swap16(*p_bytes++);
137 if (!(--count)) 138 if (!(--count))
138 return; 139 return;
139 } 140 }
@@ -145,7 +146,9 @@ static void dbop_write_data(const int16_t* p_bytes, int count)
145 data = (int32_t*)p_bytes; 146 data = (int32_t*)p_bytes;
146 while (count > 1) 147 while (count > 1)
147 { 148 {
148 DBOP_DOUT32 = *data++; 149 int pixels = *data++;
150 pixels = (swap16(pixels >> 16) << 16) | (swap16(pixels & 0xffff));
151 DBOP_DOUT32 = pixels;
149 count -= 2; 152 count -= 2;
150 153
151 /* Wait if push fifo is full */ 154 /* Wait if push fifo is full */
@@ -160,23 +163,19 @@ static void dbop_write_data(const int16_t* p_bytes, int count)
160 dbop_write_data((int16_t*)data, 1); 163 dbop_write_data((int16_t*)data, 1);
161} 164}
162 165
163static void lcd_write_cmd(short cmd) 166static void lcd_write_cmd(unsigned short cmd)
164{ 167{
165 volatile int i; 168 volatile int i;
166 for(i=0;i<20;i++) nop; 169 for(i=0;i<0x20;i++) asm volatile ("nop\n");
167 170
168 int r3 = 0x2000; 171 DBOP_CTRL |= 1<<13;
169 DBOP_CTRL |= r3; 172 DBOP_CTRL &= ~(1<<14); // 2 serial words
170 r3 >>= 1; 173 DBOP_CTRL &= ~(1<<12); // 8 bit data width
171 DBOP_CTRL &= ~r3;
172 r3 <<= 2;
173 DBOP_CTRL &= ~r3;
174 DBOP_TIMPOL_23 = 0xA12F0036; 174 DBOP_TIMPOL_23 = 0xA12F0036;
175 cmd = swap16(cmd); 175 DBOP_DOUT = swap16(cmd);
176 DBOP_DOUT16 = cmd;
177 176
178 while ((DBOP_STAT & (1<<10)) == 0); 177 while ((DBOP_STAT & (1<<10)) == 0);
179 for(i=0;i<20;i++) nop; 178 for(i=0;i<0x20;i++) asm volatile ("nop\n");
180 DBOP_TIMPOL_23 = 0xA12FE037; 179 DBOP_TIMPOL_23 = 0xA12FE037;
181} 180}
182 181
@@ -277,11 +276,12 @@ void lcd_init_device(void)
277 GPIOA_PIN(0) = 1; 276 GPIOA_PIN(0) = 1;
278 GPIOA_PIN(4) = 0; 277 GPIOA_PIN(4) = 0;
279 278
280 GPIOB_DIR |= 0x2f; 279 GPIOB_DIR |= 0xf;
281 GPIOB_PIN(0) = 1<<0; 280 GPIOB_PIN(0) = 1<<0;
282 GPIOB_PIN(1) = 1<<1; 281 GPIOB_PIN(1) = 1<<1;
283 GPIOB_PIN(2) = 1<<2; 282 GPIOB_PIN(2) = 1<<2;
284 GPIOB_PIN(3) = 1<<3; 283 GPIOB_PIN(3) = 1<<3;
284
285 GPIOA_PIN(4) = 1<<4; 285 GPIOA_PIN(4) = 1<<4;
286 GPIOA_PIN(5) = 1<<5; 286 GPIOA_PIN(5) = 1<<5;
287 287