diff options
Diffstat (limited to 'arch/arm/mach-sa1100/assabet.c')
-rw-r--r-- | arch/arm/mach-sa1100/assabet.c | 194 |
1 files changed, 140 insertions, 54 deletions
diff --git a/arch/arm/mach-sa1100/assabet.c b/arch/arm/mach-sa1100/assabet.c index 0c4b76ab4d8..375d3f779a8 100644 --- a/arch/arm/mach-sa1100/assabet.c +++ b/arch/arm/mach-sa1100/assabet.c | |||
@@ -15,14 +15,16 @@ | |||
15 | #include <linux/errno.h> | 15 | #include <linux/errno.h> |
16 | #include <linux/ioport.h> | 16 | #include <linux/ioport.h> |
17 | #include <linux/serial_core.h> | 17 | #include <linux/serial_core.h> |
18 | #include <linux/mfd/ucb1x00.h> | ||
18 | #include <linux/mtd/mtd.h> | 19 | #include <linux/mtd/mtd.h> |
19 | #include <linux/mtd/partitions.h> | 20 | #include <linux/mtd/partitions.h> |
20 | #include <linux/delay.h> | 21 | #include <linux/delay.h> |
21 | #include <linux/mm.h> | 22 | #include <linux/mm.h> |
22 | 23 | ||
24 | #include <video/sa1100fb.h> | ||
25 | |||
23 | #include <mach/hardware.h> | 26 | #include <mach/hardware.h> |
24 | #include <asm/mach-types.h> | 27 | #include <asm/mach-types.h> |
25 | #include <asm/irq.h> | ||
26 | #include <asm/setup.h> | 28 | #include <asm/setup.h> |
27 | #include <asm/page.h> | 29 | #include <asm/page.h> |
28 | #include <asm/pgtable-hwdef.h> | 30 | #include <asm/pgtable-hwdef.h> |
@@ -36,17 +38,18 @@ | |||
36 | #include <asm/mach/serial_sa1100.h> | 38 | #include <asm/mach/serial_sa1100.h> |
37 | #include <mach/assabet.h> | 39 | #include <mach/assabet.h> |
38 | #include <mach/mcp.h> | 40 | #include <mach/mcp.h> |
41 | #include <mach/irqs.h> | ||
39 | 42 | ||
40 | #include "generic.h" | 43 | #include "generic.h" |
41 | 44 | ||
42 | #define ASSABET_BCR_DB1110 \ | 45 | #define ASSABET_BCR_DB1110 \ |
43 | (ASSABET_BCR_SPK_OFF | ASSABET_BCR_QMUTE | \ | 46 | (ASSABET_BCR_SPK_OFF | \ |
44 | ASSABET_BCR_LED_GREEN | ASSABET_BCR_LED_RED | \ | 47 | ASSABET_BCR_LED_GREEN | ASSABET_BCR_LED_RED | \ |
45 | ASSABET_BCR_RS232EN | ASSABET_BCR_LCD_12RGB | \ | 48 | ASSABET_BCR_RS232EN | ASSABET_BCR_LCD_12RGB | \ |
46 | ASSABET_BCR_IRDA_MD0) | 49 | ASSABET_BCR_IRDA_MD0) |
47 | 50 | ||
48 | #define ASSABET_BCR_DB1111 \ | 51 | #define ASSABET_BCR_DB1111 \ |
49 | (ASSABET_BCR_SPK_OFF | ASSABET_BCR_QMUTE | \ | 52 | (ASSABET_BCR_SPK_OFF | \ |
50 | ASSABET_BCR_LED_GREEN | ASSABET_BCR_LED_RED | \ | 53 | ASSABET_BCR_LED_GREEN | ASSABET_BCR_LED_RED | \ |
51 | ASSABET_BCR_RS232EN | ASSABET_BCR_LCD_12RGB | \ | 54 | ASSABET_BCR_RS232EN | ASSABET_BCR_LCD_12RGB | \ |
52 | ASSABET_BCR_CF_BUS_OFF | ASSABET_BCR_STEREO_LB | \ | 55 | ASSABET_BCR_CF_BUS_OFF | ASSABET_BCR_STEREO_LB | \ |
@@ -69,31 +72,10 @@ void ASSABET_BCR_frob(unsigned int mask, unsigned int val) | |||
69 | 72 | ||
70 | EXPORT_SYMBOL(ASSABET_BCR_frob); | 73 | EXPORT_SYMBOL(ASSABET_BCR_frob); |
71 | 74 | ||
72 | static void assabet_backlight_power(int on) | 75 | static void assabet_ucb1x00_reset(enum ucb1x00_reset state) |
73 | { | ||
74 | #ifndef ASSABET_PAL_VIDEO | ||
75 | if (on) | ||
76 | ASSABET_BCR_set(ASSABET_BCR_LIGHT_ON); | ||
77 | else | ||
78 | #endif | ||
79 | ASSABET_BCR_clear(ASSABET_BCR_LIGHT_ON); | ||
80 | } | ||
81 | |||
82 | /* | ||
83 | * Turn on/off the backlight. When turning the backlight on, | ||
84 | * we wait 500us after turning it on so we don't cause the | ||
85 | * supplies to droop when we enable the LCD controller (and | ||
86 | * cause a hard reset.) | ||
87 | */ | ||
88 | static void assabet_lcd_power(int on) | ||
89 | { | 76 | { |
90 | #ifndef ASSABET_PAL_VIDEO | 77 | if (state == UCB_RST_PROBE) |
91 | if (on) { | 78 | ASSABET_BCR_set(ASSABET_BCR_CODEC_RST); |
92 | ASSABET_BCR_set(ASSABET_BCR_LCD_ON); | ||
93 | udelay(500); | ||
94 | } else | ||
95 | #endif | ||
96 | ASSABET_BCR_clear(ASSABET_BCR_LCD_ON); | ||
97 | } | 79 | } |
98 | 80 | ||
99 | 81 | ||
@@ -152,15 +134,8 @@ static struct flash_platform_data assabet_flash_data = { | |||
152 | }; | 134 | }; |
153 | 135 | ||
154 | static struct resource assabet_flash_resources[] = { | 136 | static struct resource assabet_flash_resources[] = { |
155 | { | 137 | DEFINE_RES_MEM(SA1100_CS0_PHYS, SZ_32M), |
156 | .start = SA1100_CS0_PHYS, | 138 | DEFINE_RES_MEM(SA1100_CS1_PHYS, SZ_32M), |
157 | .end = SA1100_CS0_PHYS + SZ_32M - 1, | ||
158 | .flags = IORESOURCE_MEM, | ||
159 | }, { | ||
160 | .start = SA1100_CS1_PHYS, | ||
161 | .end = SA1100_CS1_PHYS + SZ_32M - 1, | ||
162 | .flags = IORESOURCE_MEM, | ||
163 | } | ||
164 | }; | 139 | }; |
165 | 140 | ||
166 | 141 | ||
@@ -199,18 +174,126 @@ static struct irda_platform_data assabet_irda_data = { | |||
199 | .set_speed = assabet_irda_set_speed, | 174 | .set_speed = assabet_irda_set_speed, |
200 | }; | 175 | }; |
201 | 176 | ||
177 | static struct ucb1x00_plat_data assabet_ucb1x00_data = { | ||
178 | .reset = assabet_ucb1x00_reset, | ||
179 | .gpio_base = -1, | ||
180 | }; | ||
181 | |||
202 | static struct mcp_plat_data assabet_mcp_data = { | 182 | static struct mcp_plat_data assabet_mcp_data = { |
203 | .mccr0 = MCCR0_ADM, | 183 | .mccr0 = MCCR0_ADM, |
204 | .sclk_rate = 11981000, | 184 | .sclk_rate = 11981000, |
185 | .codec_pdata = &assabet_ucb1x00_data, | ||
186 | }; | ||
187 | |||
188 | static void assabet_lcd_set_visual(u32 visual) | ||
189 | { | ||
190 | u_int is_true_color = visual == FB_VISUAL_TRUECOLOR; | ||
191 | |||
192 | if (machine_is_assabet()) { | ||
193 | #if 1 // phase 4 or newer Assabet's | ||
194 | if (is_true_color) | ||
195 | ASSABET_BCR_set(ASSABET_BCR_LCD_12RGB); | ||
196 | else | ||
197 | ASSABET_BCR_clear(ASSABET_BCR_LCD_12RGB); | ||
198 | #else | ||
199 | // older Assabet's | ||
200 | if (is_true_color) | ||
201 | ASSABET_BCR_clear(ASSABET_BCR_LCD_12RGB); | ||
202 | else | ||
203 | ASSABET_BCR_set(ASSABET_BCR_LCD_12RGB); | ||
204 | #endif | ||
205 | } | ||
206 | } | ||
207 | |||
208 | #ifndef ASSABET_PAL_VIDEO | ||
209 | static void assabet_lcd_backlight_power(int on) | ||
210 | { | ||
211 | if (on) | ||
212 | ASSABET_BCR_set(ASSABET_BCR_LIGHT_ON); | ||
213 | else | ||
214 | ASSABET_BCR_clear(ASSABET_BCR_LIGHT_ON); | ||
215 | } | ||
216 | |||
217 | /* | ||
218 | * Turn on/off the backlight. When turning the backlight on, we wait | ||
219 | * 500us after turning it on so we don't cause the supplies to droop | ||
220 | * when we enable the LCD controller (and cause a hard reset.) | ||
221 | */ | ||
222 | static void assabet_lcd_power(int on) | ||
223 | { | ||
224 | if (on) { | ||
225 | ASSABET_BCR_set(ASSABET_BCR_LCD_ON); | ||
226 | udelay(500); | ||
227 | } else | ||
228 | ASSABET_BCR_clear(ASSABET_BCR_LCD_ON); | ||
229 | } | ||
230 | |||
231 | /* | ||
232 | * The assabet uses a sharp LQ039Q2DS54 LCD module. It is actually | ||
233 | * takes an RGB666 signal, but we provide it with an RGB565 signal | ||
234 | * instead (def_rgb_16). | ||
235 | */ | ||
236 | static struct sa1100fb_mach_info lq039q2ds54_info = { | ||
237 | .pixclock = 171521, .bpp = 16, | ||
238 | .xres = 320, .yres = 240, | ||
239 | |||
240 | .hsync_len = 5, .vsync_len = 1, | ||
241 | .left_margin = 61, .upper_margin = 3, | ||
242 | .right_margin = 9, .lower_margin = 0, | ||
243 | |||
244 | .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, | ||
245 | |||
246 | .lccr0 = LCCR0_Color | LCCR0_Sngl | LCCR0_Act, | ||
247 | .lccr3 = LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(2), | ||
248 | |||
249 | .backlight_power = assabet_lcd_backlight_power, | ||
250 | .lcd_power = assabet_lcd_power, | ||
251 | .set_visual = assabet_lcd_set_visual, | ||
252 | }; | ||
253 | #else | ||
254 | static void assabet_pal_backlight_power(int on) | ||
255 | { | ||
256 | ASSABET_BCR_clear(ASSABET_BCR_LIGHT_ON); | ||
257 | } | ||
258 | |||
259 | static void assabet_pal_power(int on) | ||
260 | { | ||
261 | ASSABET_BCR_clear(ASSABET_BCR_LCD_ON); | ||
262 | } | ||
263 | |||
264 | static struct sa1100fb_mach_info pal_info = { | ||
265 | .pixclock = 67797, .bpp = 16, | ||
266 | .xres = 640, .yres = 512, | ||
267 | |||
268 | .hsync_len = 64, .vsync_len = 6, | ||
269 | .left_margin = 125, .upper_margin = 70, | ||
270 | .right_margin = 115, .lower_margin = 36, | ||
271 | |||
272 | .lccr0 = LCCR0_Color | LCCR0_Sngl | LCCR0_Act, | ||
273 | .lccr3 = LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(512), | ||
274 | |||
275 | .backlight_power = assabet_pal_backlight_power, | ||
276 | .lcd_power = assabet_pal_power, | ||
277 | .set_visual = assabet_lcd_set_visual, | ||
205 | }; | 278 | }; |
279 | #endif | ||
280 | |||
281 | #ifdef CONFIG_ASSABET_NEPONSET | ||
282 | static struct resource neponset_resources[] = { | ||
283 | DEFINE_RES_MEM(0x10000000, 0x08000000), | ||
284 | DEFINE_RES_MEM(0x18000000, 0x04000000), | ||
285 | DEFINE_RES_MEM(0x40000000, SZ_8K), | ||
286 | DEFINE_RES_IRQ(IRQ_GPIO25), | ||
287 | }; | ||
288 | #endif | ||
206 | 289 | ||
207 | static void __init assabet_init(void) | 290 | static void __init assabet_init(void) |
208 | { | 291 | { |
209 | /* | 292 | /* |
210 | * Ensure that the power supply is in "high power" mode. | 293 | * Ensure that the power supply is in "high power" mode. |
211 | */ | 294 | */ |
212 | GPDR |= GPIO_GPIO16; | ||
213 | GPSR = GPIO_GPIO16; | 295 | GPSR = GPIO_GPIO16; |
296 | GPDR |= GPIO_GPIO16; | ||
214 | 297 | ||
215 | /* | 298 | /* |
216 | * Ensure that these pins are set as outputs and are driving | 299 | * Ensure that these pins are set as outputs and are driving |
@@ -218,8 +301,16 @@ static void __init assabet_init(void) | |||
218 | * the WS latch in the CPLD, and we don't float causing | 301 | * the WS latch in the CPLD, and we don't float causing |
219 | * excessive power drain. --rmk | 302 | * excessive power drain. --rmk |
220 | */ | 303 | */ |
221 | GPDR |= GPIO_SSP_TXD | GPIO_SSP_SCLK | GPIO_SSP_SFRM; | ||
222 | GPCR = GPIO_SSP_TXD | GPIO_SSP_SCLK | GPIO_SSP_SFRM; | 304 | GPCR = GPIO_SSP_TXD | GPIO_SSP_SCLK | GPIO_SSP_SFRM; |
305 | GPDR |= GPIO_SSP_TXD | GPIO_SSP_SCLK | GPIO_SSP_SFRM; | ||
306 | |||
307 | /* | ||
308 | * Also set GPIO27 as an output; this is used to clock UART3 | ||
309 | * via the FPGA and as otherwise has no pullups or pulldowns, | ||
310 | * so stop it floating. | ||
311 | */ | ||
312 | GPCR = GPIO_GPIO27; | ||
313 | GPDR |= GPIO_GPIO27; | ||
223 | 314 | ||
224 | /* | 315 | /* |
225 | * Set up registers for sleep mode. | 316 | * Set up registers for sleep mode. |
@@ -231,8 +322,7 @@ static void __init assabet_init(void) | |||
231 | PPDR |= PPC_TXD3 | PPC_TXD1; | 322 | PPDR |= PPC_TXD3 | PPC_TXD1; |
232 | PPSR |= PPC_TXD3 | PPC_TXD1; | 323 | PPSR |= PPC_TXD3 | PPC_TXD1; |
233 | 324 | ||
234 | sa1100fb_lcd_power = assabet_lcd_power; | 325 | sa11x0_ppc_configure_mcp(); |
235 | sa1100fb_backlight_power = assabet_backlight_power; | ||
236 | 326 | ||
237 | if (machine_has_neponset()) { | 327 | if (machine_has_neponset()) { |
238 | /* | 328 | /* |
@@ -246,9 +336,17 @@ static void __init assabet_init(void) | |||
246 | #ifndef CONFIG_ASSABET_NEPONSET | 336 | #ifndef CONFIG_ASSABET_NEPONSET |
247 | printk( "Warning: Neponset detected but full support " | 337 | printk( "Warning: Neponset detected but full support " |
248 | "hasn't been configured in the kernel\n" ); | 338 | "hasn't been configured in the kernel\n" ); |
339 | #else | ||
340 | platform_device_register_simple("neponset", 0, | ||
341 | neponset_resources, ARRAY_SIZE(neponset_resources)); | ||
249 | #endif | 342 | #endif |
250 | } | 343 | } |
251 | 344 | ||
345 | #ifndef ASSABET_PAL_VIDEO | ||
346 | sa11x0_register_lcd(&lq039q2ds54_info); | ||
347 | #else | ||
348 | sa11x0_register_lcd(&pal_video); | ||
349 | #endif | ||
252 | sa11x0_register_mtd(&assabet_flash_data, assabet_flash_resources, | 350 | sa11x0_register_mtd(&assabet_flash_data, assabet_flash_resources, |
253 | ARRAY_SIZE(assabet_flash_resources)); | 351 | ARRAY_SIZE(assabet_flash_resources)); |
254 | sa11x0_register_irda(&assabet_irda_data); | 352 | sa11x0_register_irda(&assabet_irda_data); |
@@ -412,21 +510,8 @@ static void __init assabet_map_io(void) | |||
412 | */ | 510 | */ |
413 | Ser1SDCR0 |= SDCR0_SUS; | 511 | Ser1SDCR0 |= SDCR0_SUS; |
414 | 512 | ||
415 | if (machine_has_neponset()) { | 513 | if (!machine_has_neponset()) |
416 | #ifdef CONFIG_ASSABET_NEPONSET | ||
417 | extern void neponset_map_io(void); | ||
418 | |||
419 | /* | ||
420 | * We map Neponset registers even if it isn't present since | ||
421 | * many drivers will try to probe their stuff (and fail). | ||
422 | * This is still more friendly than a kernel paging request | ||
423 | * crash. | ||
424 | */ | ||
425 | neponset_map_io(); | ||
426 | #endif | ||
427 | } else { | ||
428 | sa1100_register_uart_fns(&assabet_port_fns); | 514 | sa1100_register_uart_fns(&assabet_port_fns); |
429 | } | ||
430 | 515 | ||
431 | /* | 516 | /* |
432 | * When Neponset is attached, the first UART should be | 517 | * When Neponset is attached, the first UART should be |
@@ -449,6 +534,7 @@ MACHINE_START(ASSABET, "Intel-Assabet") | |||
449 | .atag_offset = 0x100, | 534 | .atag_offset = 0x100, |
450 | .fixup = fixup_assabet, | 535 | .fixup = fixup_assabet, |
451 | .map_io = assabet_map_io, | 536 | .map_io = assabet_map_io, |
537 | .nr_irqs = SA1100_NR_IRQS, | ||
452 | .init_irq = sa1100_init_irq, | 538 | .init_irq = sa1100_init_irq, |
453 | .timer = &sa1100_timer, | 539 | .timer = &sa1100_timer, |
454 | .init_machine = assabet_init, | 540 | .init_machine = assabet_init, |