diff -urN linux-2.6.17-clean/arch/arm/mach-pxa/trizeps2.c linux-2.6.17-stab2/arch/arm/mach-pxa/trizeps2.c --- linux-2.6.17-clean/arch/arm/mach-pxa/trizeps2.c 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.6.17-stab2/arch/arm/mach-pxa/trizeps2.c 2006-07-03 18:24:59.000000000 +0200 @@ -0,0 +1,278 @@ +/* + * linux/arch/arm/mach-pxa/trizeps2.c + * + * Support for the Keith & Koep Trizeps2 PXA25x CPU module. + * + * Author: Hinko Kocevar + * Created: Jun 29, 2006 + * Copyright: Hinko Kocevar + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + + +#include +#include +#include +#include + +#include "generic.h" + +#define DEBUG_TRIZEPS2 +#ifdef DEBUG_TRIZEPS2 +#define DPRINTK(fmt, args...) printk("%s: " fmt, __FUNCTION__ , ## args) +#else +#define DPRINTK( x... ) +#endif + + +/* + * Backlight power control is connected to pin 37 + * on NetTerm 40-pin LCD connector (unused IRQ_PIC + */ +static void trizeps2_backlight_power(int on) +{ + if (on) + { +#ifdef CONFIG_ARCH_TRIZEPS2_KK_NETTERM + /* enable backlight, set GPIO0 low */ + GPCR(0) |= GPIO_bit(0); + /* GPIO0 output */ + GPDR(0) |= GPIO_bit(0); +#elif CONFIG_ARCH_TRIZEPS2_IM_GREENFLASH1 + /* enable LCD, set GPIO1 high */ + GPSR(1) |= GPIO_bit(1); + /* GPIO1 output */ + GPDR(1) |= GPIO_bit(1); +#endif + } + else + { +#ifdef CONFIG_ARCH_TRIZEPS2_KK_NETTERM + /* disable backlight, set GPIO0 high */ + GPSR(0) |= GPIO_bit(0); + /* GPIO0 input */ + /* GPDR(0) &= ~GPIO_bit(0); */ +#elif CONFIG_ARCH_TRIZEPS2_IM_GREENFLASH1 + /* disable LCD, set GPIO1 low */ + GPCR(1) |= GPIO_bit(1); +#endif + } +} + +/* + * LCD power control is connected to pin 25 on + * NetTerm 40-pin LCD connector (L_DISP) + * + * LCD power control is connected to GPIO0 on + * GreenFLASH1 board (LCD_ON). + */ +static void trizeps2_lcd_power(int on) +{ + if (on) + { +#ifdef CONFIG_ARCH_TRIZEPS2_KK_NETTERM + /* enable LCD, set GPIO1 high */ + GPSR(1) |= GPIO_bit(1); + /* GPIO1 output */ + GPDR(1) |= GPIO_bit(1); +#elif CONFIG_ARCH_TRIZEPS2_IM_GREENFLASH1 + /* enable LCD, set GPIO0 high */ + GPSR(0) |= GPIO_bit(0); + /* GPIO0 output */ + GPDR(0) |= GPIO_bit(0); +#endif + } + else + { +#ifdef CONFIG_ARCH_TRIZEPS2_KK_NETTERM + /* disable LCD, set GPIO1 low */ + GPCR(1) |= GPIO_bit(1); +#elif CONFIG_ARCH_TRIZEPS2_IM_GREENFLASH1 + /* disable LCD, set GPIO0 low */ + GPCR(0) |= GPIO_bit(0); + /* GPIO0 input */ + /* GPDR(0) &= ~GPIO_bit(0); */ +#endif + } +} + + +static void __init trizeps2_init_irq(void) +{ + pxa_init_irq(); + + pxa_gpio_mode(GPIO19_DREQ1 | GPIO_ALT_FN_1_IN); + pxa_gpio_mode(GPIO46_STRXD_MD); + pxa_gpio_mode(GPIO47_STTXD_MD); + + /* + * NOTE: + * disable IRQ PROBE of GPIO0 and GPIO1 to make sure + * LCD and BL is not powered off in probe_irq_on(). + */ + set_irq_flags(1, IRQF_VALID); + set_irq_flags(2, IRQF_VALID); + + set_irq_flags(61, IRQF_VALID); // disable PROBE +} + +static struct platform_device trizeps2_audio_device = { + .name = "pxa2xx-ac97", + .id = -1, +}; + +static struct resource smc91x_resources[] = { + [0] = { + .name = "smc91x-regs", + .start = TRIZEPS2_ETH_PHYS, /*0x0c000300*/ + .end = 0x0c0fffff, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = TRIZEPS2_ETH_IRQ, + .end = TRIZEPS2_ETH_IRQ, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct platform_device smc91x_device = { + .name = "smc91x", + .id = -1, + .num_resources = ARRAY_SIZE(smc91x_resources), + .resource = smc91x_resources, +}; + +static struct resource flash_resources[] = { + [0] = { + .start = 0x00000000, + .end = SZ_16M - 1, + .flags = IORESOURCE_MEM, + }, +}; + +static struct mtd_partition trizeps2_partitions[] = { + { + .name = "Bootloader", + .size = 0x00060000, + .offset = 0, + .mask_flags = MTD_WRITEABLE /* force read-only */ + },{ + .name = "Kernel", + .size = 0x00200000, + .offset = 0x00060000, + },{ + .name = "Filesystem", + .size = MTDPART_SIZ_FULL, + .offset = 0x00260000 + } +}; + +static struct flash_platform_data trizeps2_flash_data[1] = { + { + .map_name = "cfi_probe", + .parts = trizeps2_partitions, + .nr_parts = ARRAY_SIZE(trizeps2_partitions), + .width = 2, + .name = "application-flash", + }, +}; + +static struct platform_device trizeps2_flash_device[1] = { + { + .name = "pxa2xx-flash", + .id = 0, + .dev = { + .platform_data = &trizeps2_flash_data[0], + }, + .resource = &flash_resources[0], + .num_resources = 1, + }, +}; + +static struct platform_device *devices[] __initdata = { + &trizeps2_audio_device, + &smc91x_device, + &trizeps2_flash_device[0], +}; + +/* + * Hitachi SX14Q LCD properties struct + */ +static struct pxafb_mach_info hitachi_sx14q __initdata = { + .pixclock = 173521, + .xres = 320, + .yres = 240, + .bpp = 8, + .hsync_len = 1, + .left_margin = 1, + .right_margin = 1, + .vsync_len = 10, + .upper_margin = 0, + .lower_margin = 0, + .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, + .cmap_greyscale = 0, + .cmap_inverse = 0, + .cmap_static = 0, + .lccr0 = LCCR0_Pas | LCCR0_Sngl | LCCR0_Color, + .lccr3 = LCCR3_PCP | LCCR3_Acb(255), + .pxafb_backlight_power = trizeps2_backlight_power, + .pxafb_lcd_power = trizeps2_lcd_power, +}; + +static void __init trizeps2_init(void) +{ + set_pxa_fb_info(&hitachi_sx14q); + (void) platform_add_devices(devices, ARRAY_SIZE(devices)); +} + +static void __init trizeps2_map_io(void) +{ + pxa_map_io(); + + /* This is for the SMC chip select */ + pxa_gpio_mode(GPIO79_nCS_3_MD); + + /* setup sleep mode values */ + PWER = 0x00000002; + PFER = 0x00000000; + PRER = 0x00000002; + PGSR0 = 0x00008000; + PGSR1 = 0x003F0202; + PGSR2 = 0x0001C000; + PCFR |= PCFR_OPDE; +} + +MACHINE_START(TRIZEPS2, "Keith & Koep Trizeps2 PXA25x CPU module") + /* Maintainer: Hinko Kocevar */ + .phys_io = 0x40000000, + .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, + .map_io = trizeps2_map_io, + .init_irq = trizeps2_init_irq, + .timer = &pxa_timer, + .init_machine = trizeps2_init, +MACHINE_END