2 * linux/arch/arm/mach-mmp/ttc_dkb.c
4 * Support for the Marvell PXA910-based TTC_DKB Development Platform.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * publishhed by the Free Software Foundation.
11 #include <linux/init.h>
12 #include <linux/kernel.h>
13 #include <linux/platform_device.h>
14 #include <linux/mtd/mtd.h>
15 #include <linux/mtd/partitions.h>
16 #include <linux/mtd/onenand.h>
17 #include <linux/interrupt.h>
18 #include <linux/i2c/pca953x.h>
19 #include <linux/gpio.h>
20 #include <linux/mfd/88pm860x.h>
21 #include <linux/platform_data/mv_usb.h>
22 #include <linux/spi/spi.h>
23 #include <linux/delay.h>
25 #include <asm/mach-types.h>
26 #include <asm/mach/arch.h>
27 #include <asm/mach/flash.h>
28 #include <mach/addr-map.h>
29 #include <mach/mfp-pxa910.h>
30 #include <mach/pxa910.h>
31 #include <mach/irqs.h>
32 #include <mach/regs-usb.h>
36 #define TTCDKB_GPIO_EXT0(x) (MMP_NR_BUILTIN_GPIO + ((x < 0) ? 0 : \
38 #define TTCDKB_GPIO_EXT1(x) (MMP_NR_BUILTIN_GPIO + 16 + ((x < 0) ? 0 : \
42 * 16 board interrupts -- MAX7312 GPIO expander
43 * 16 board interrupts -- PCA9575 GPIO expander
44 * 24 board interrupts -- 88PM860x PMIC
46 #define TTCDKB_NR_IRQS (MMP_NR_IRQS + 16 + 16 + 24)
48 static unsigned long ttc_dkb_pin_config[] __initdata = {
78 static struct mtd_partition ttc_dkb_onenand_partitions[] = {
83 .mask_flags = MTD_WRITEABLE,
86 .offset = MTDPART_OFS_APPEND,
88 .mask_flags = MTD_WRITEABLE,
91 .offset = MTDPART_OFS_APPEND,
93 .mask_flags = MTD_WRITEABLE,
96 .offset = MTDPART_OFS_APPEND,
97 .size = (SZ_2M + SZ_1M),
100 .name = "filesystem",
101 .offset = MTDPART_OFS_APPEND,
102 .size = SZ_32M + SZ_16M,
107 static struct onenand_platform_data ttc_dkb_onenand_info = {
108 .parts = ttc_dkb_onenand_partitions,
109 .nr_parts = ARRAY_SIZE(ttc_dkb_onenand_partitions),
112 static struct resource ttc_dkb_resource_onenand[] = {
114 .start = SMC_CS0_PHYS_BASE,
115 .end = SMC_CS0_PHYS_BASE + SZ_1M,
116 .flags = IORESOURCE_MEM,
120 static struct platform_device ttc_dkb_device_onenand = {
121 .name = "onenand-flash",
123 .resource = ttc_dkb_resource_onenand,
124 .num_resources = ARRAY_SIZE(ttc_dkb_resource_onenand),
126 .platform_data = &ttc_dkb_onenand_info,
130 static struct platform_device *ttc_dkb_devices[] = {
133 &ttc_dkb_device_onenand,
136 static struct pca953x_platform_data max7312_data[] = {
138 .gpio_base = TTCDKB_GPIO_EXT0(0),
139 .irq_base = MMP_NR_IRQS,
143 static struct pm860x_platform_data ttc_dkb_pm8607_info = {
144 .irq_base = IRQ_BOARD_START,
147 static struct i2c_board_info ttc_dkb_i2c_info[] = {
151 .platform_data = &ttc_dkb_pm8607_info,
152 .irq = IRQ_PXA910_PMIC_INT,
157 .irq = MMP_GPIO_TO_IRQ(80),
158 .platform_data = &max7312_data,
162 #ifdef CONFIG_USB_SUPPORT
163 #if defined(CONFIG_USB_MV_UDC) || defined(CONFIG_USB_EHCI_MV_U2O)
165 static struct mv_usb_platform_data ttc_usb_pdata = {
167 .mode = MV_USB_MODE_OTG,
168 .otg_force_a_bus_req = 1,
169 .phy_init = pxa_usb_phy_init,
170 .phy_deinit = pxa_usb_phy_deinit,
176 #ifdef CONFIG_MTD_NAND_PXA3xx
177 static struct pxa3xx_nand_platform_data dkb_nand_info = {
183 #ifdef CONFIG_MMP_DISP
185 #define CFG_IOPADMODE(iopad) (iopad) /* 0x0 ~ 0xd */
186 #define SCLK_SOURCE_SELECT(x) (x << 30) /* 0x0 ~ 0x3 */
188 #define CFG_DUMBMODE(mode) (mode << 28) /* 0x0 ~ 0x6*/
189 #define CFG_GRA_SWAPRB(x) (x << 0) /* 1: rbswap enabled */
190 static struct mmp_mach_path_config dkb_disp_config[] = {
192 .name = "mmp-parallel",
194 .output_type = PATH_OUT_PARALLEL,
195 .path_config = CFG_IOPADMODE(0x1)
196 | SCLK_SOURCE_SELECT(0x1),
197 .link_config = CFG_DUMBMODE(0x2)
198 | CFG_GRA_SWAPRB(0x1),
202 static struct mmp_mach_plat_info dkb_disp_info = {
206 .paths = dkb_disp_config,
209 static struct mmp_buffer_driver_mach_info dkb_fb_info = {
211 .path_name = "mmp-parallel",
214 .default_pixfmt = PIXFMT_RGB565,
217 static void dkb_tpo_panel_power(int on)
220 u32 spi_reset = mfp_to_gpio(MFP_PIN_GPIO106);
223 err = gpio_request(spi_reset, "TPO_LCD_SPI_RESET");
225 pr_err("failed to request GPIO for TPO LCD RESET\n");
228 gpio_direction_output(spi_reset, 0);
230 gpio_set_value(spi_reset, 1);
231 gpio_free(spi_reset);
233 err = gpio_request(spi_reset, "TPO_LCD_SPI_RESET");
235 pr_err("failed to request LCD RESET gpio\n");
238 gpio_set_value(spi_reset, 0);
239 gpio_free(spi_reset);
243 static struct mmp_mach_panel_info dkb_tpo_panel_info = {
245 .plat_path_name = "mmp-parallel",
246 .plat_set_onoff = dkb_tpo_panel_power,
249 static struct spi_board_info spi_board_info[] __initdata = {
251 .modalias = "tpo-hvga",
252 .platform_data = &dkb_tpo_panel_info,
257 static void __init add_disp(void)
259 pxa_register_device(&pxa910_device_disp,
260 &dkb_disp_info, sizeof(dkb_disp_info));
261 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
262 pxa_register_device(&pxa910_device_fb,
263 &dkb_fb_info, sizeof(dkb_fb_info));
264 pxa_register_device(&pxa910_device_panel,
265 &dkb_tpo_panel_info, sizeof(dkb_tpo_panel_info));
269 static void __init ttc_dkb_init(void)
271 mfp_config(ARRAY_AND_SIZE(ttc_dkb_pin_config));
273 /* on-chip devices */
275 #ifdef CONFIG_MTD_NAND_PXA3xx
276 pxa910_add_nand(&dkb_nand_info);
279 /* off-chip devices */
280 pxa910_add_twsi(0, NULL, ARRAY_AND_SIZE(ttc_dkb_i2c_info));
281 platform_add_devices(ARRAY_AND_SIZE(ttc_dkb_devices));
283 #ifdef CONFIG_USB_MV_UDC
284 pxa168_device_u2o.dev.platform_data = &ttc_usb_pdata;
285 platform_device_register(&pxa168_device_u2o);
288 #ifdef CONFIG_USB_EHCI_MV_U2O
289 pxa168_device_u2oehci.dev.platform_data = &ttc_usb_pdata;
290 platform_device_register(&pxa168_device_u2oehci);
293 #ifdef CONFIG_USB_MV_OTG
294 pxa168_device_u2ootg.dev.platform_data = &ttc_usb_pdata;
295 platform_device_register(&pxa168_device_u2ootg);
298 #ifdef CONFIG_MMP_DISP
303 MACHINE_START(TTC_DKB, "PXA910-based TTC_DKB Development Platform")
304 .map_io = mmp_map_io,
305 .nr_irqs = TTCDKB_NR_IRQS,
306 .init_irq = pxa910_init_irq,
307 .init_time = pxa910_timer_init,
308 .init_machine = ttc_dkb_init,
309 .restart = mmp_restart,