/* * linux/arch/arm/mach-pxa/z2.c * * Support for the Zipit Z2 Handheld device. * * Copyright (C) 2009-2010 Marek Vasut * * Based on research and code by: Ken McGuire * Based on mainstone.c as modified for the Zipit Z2. * * 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 #include #include "generic.h" #include "devices.h" /****************************************************************************** * Pin configuration ******************************************************************************/ static unsigned long z2_pin_config[] = { /* LCD - 16bpp Active TFT */ GPIO58_LCD_LDD_0, GPIO59_LCD_LDD_1, GPIO60_LCD_LDD_2, GPIO61_LCD_LDD_3, GPIO62_LCD_LDD_4, GPIO63_LCD_LDD_5, GPIO64_LCD_LDD_6, GPIO65_LCD_LDD_7, GPIO66_LCD_LDD_8, GPIO67_LCD_LDD_9, GPIO68_LCD_LDD_10, GPIO69_LCD_LDD_11, GPIO70_LCD_LDD_12, GPIO71_LCD_LDD_13, GPIO72_LCD_LDD_14, GPIO73_LCD_LDD_15, GPIO74_LCD_FCLK, GPIO75_LCD_LCLK, GPIO76_LCD_PCLK, GPIO77_LCD_BIAS, GPIO19_GPIO, /* LCD reset */ GPIO88_GPIO, /* LCD chipselect */ /* PWM */ GPIO115_PWM1_OUT, /* Keypad Backlight */ GPIO11_PWM2_OUT, /* LCD Backlight */ /* MMC */ GPIO32_MMC_CLK, GPIO112_MMC_CMD, GPIO92_MMC_DAT_0, GPIO109_MMC_DAT_1, GPIO110_MMC_DAT_2, GPIO111_MMC_DAT_3, GPIO96_GPIO, /* SD detect */ /* STUART */ GPIO46_STUART_RXD, GPIO47_STUART_TXD, /* Keypad */ GPIO100_KP_MKIN_0, GPIO101_KP_MKIN_1, GPIO102_KP_MKIN_2, GPIO34_KP_MKIN_3, GPIO38_KP_MKIN_4, GPIO16_KP_MKIN_5, GPIO17_KP_MKIN_6, GPIO103_KP_MKOUT_0, GPIO104_KP_MKOUT_1, GPIO105_KP_MKOUT_2, GPIO106_KP_MKOUT_3, GPIO107_KP_MKOUT_4, GPIO108_KP_MKOUT_5, GPIO35_KP_MKOUT_6, GPIO41_KP_MKOUT_7, /* I2C */ GPIO117_I2C_SCL, GPIO118_I2C_SDA, /* SSP1 */ GPIO23_SSP1_SCLK, /* SSP1_SCK */ GPIO25_SSP1_TXD, /* SSP1_TXD */ GPIO26_SSP1_RXD, /* SSP1_RXD */ /* SSP2 */ GPIO22_SSP2_SCLK, /* SSP2_SCK */ GPIO13_SSP2_TXD, /* SSP2_TXD */ GPIO40_SSP2_RXD, /* SSP2_RXD */ /* LEDs */ GPIO10_GPIO, /* WiFi LED */ GPIO83_GPIO, /* Charging LED */ GPIO85_GPIO, /* Charged LED */ /* I2S */ GPIO28_I2S_BITCLK_OUT, GPIO29_I2S_SDATA_IN, GPIO30_I2S_SDATA_OUT, GPIO31_I2S_SYNC, GPIO113_I2S_SYSCLK, /* MISC */ GPIO0_GPIO, /* AC power detect */ GPIO1_GPIO, /* Power button */ GPIO37_GPIO, /* Headphone detect */ GPIO98_GPIO, /* Lid switch */ GPIO14_GPIO, /* WiFi Power */ GPIO24_GPIO, /* WiFi CS */ GPIO36_GPIO, /* WiFi IRQ */ GPIO88_GPIO, /* LCD CS */ }; /****************************************************************************** * NOR Flash ******************************************************************************/ #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) static struct resource z2_flash_resource = { .start = PXA_CS0_PHYS, .end = PXA_CS0_PHYS + SZ_8M - 1, .flags = IORESOURCE_MEM, }; static struct mtd_partition z2_flash_parts[] = { { .name = "U-Boot Bootloader", .offset = 0x0, .size = 0x40000, }, { .name = "U-Boot Environment", .offset = 0x40000, .size = 0x20000, }, { .name = "Flash", .offset = 0x60000, .size = MTDPART_SIZ_FULL, }, }; static struct physmap_flash_data z2_flash_data = { .width = 2, .parts = z2_flash_parts, .nr_parts = ARRAY_SIZE(z2_flash_parts), }; static struct platform_device z2_flash = { .name = "physmap-flash", .id = -1, .resource = &z2_flash_resource, .num_resources = 1, .dev = { .platform_data = &z2_flash_data, }, }; static void __init z2_nor_init(void) { platform_device_register(&z2_flash); } #else static inline void z2_nor_init(void) {} #endif /****************************************************************************** * Backlight ******************************************************************************/ #if defined(CONFIG_BACKLIGHT_PWM) || defined(CONFIG_BACKLIGHT_PWM_MODULE) static struct platform_pwm_backlight_data z2_backlight_data[] = { [0] = { /* Keypad Backlight */ .pwm_id = 1, .max_brightness = 1023, .dft_brightness = 0, .pwm_period_ns = 1260320, }, [1] = { /* LCD Backlight */ .pwm_id = 2, .max_brightness = 1023, .dft_brightness = 512, .pwm_period_ns = 1260320, }, }; static struct platform_device z2_backlight_devices[2] = { { .name = "pwm-backlight", .id = 0, .dev = { .platform_data = &z2_backlight_data[1], }, }, { .name = "pwm-backlight", .id = 1, .dev = { .platform_data = &z2_backlight_data[0], }, }, }; static void __init z2_pwm_init(void) { platform_device_register(&z2_backlight_devices[0]); platform_device_register(&z2_backlight_devices[1]); } #else static inline void z2_pwm_init(void) {} #endif /****************************************************************************** * Framebuffer ******************************************************************************/ #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE) static struct pxafb_mode_info z2_lcd_modes[] = { { .pixclock = 192000, .xres = 240, .yres = 320, .bpp = 16, .left_margin = 4, .right_margin = 8, .upper_margin = 4, .lower_margin = 8, .hsync_len = 4, .vsync_len = 4, }, }; static struct pxafb_mach_info z2_lcd_screen = { .modes = z2_lcd_modes, .num_modes = ARRAY_SIZE(z2_lcd_modes), .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_BIAS_ACTIVE_LOW | LCD_ALTERNATE_MAPPING, }; static void __init z2_lcd_init(void) { pxa_set_fb_info(NULL, &z2_lcd_screen); } #else static inline void z2_lcd_init(void) {} #endif /****************************************************************************** * SD/MMC card controller ******************************************************************************/ #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE) static struct pxamci_platform_data z2_mci_platform_data = { .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, .gpio_card_detect = GPIO96_ZIPITZ2_SD_DETECT, .gpio_power = -1, .gpio_card_ro = -1, .detect_delay_ms = 200, }; static void __init z2_mmc_init(void) { pxa_set_mci_info(&z2_mci_platform_data); } #else static inline void z2_mmc_init(void) {} #endif /****************************************************************************** * LEDs ******************************************************************************/ #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE) struct gpio_led z2_gpio_leds[] = { { .name = "z2:green:wifi", .default_trigger = "none", .gpio = GPIO10_ZIPITZ2_LED_WIFI, .active_low = 1, }, {