Add linux-next specific files for 20110831
[linux-2.6/next.git] / arch / arm / mach-mmp / ttc_dkb.c
blob176515a7698935ee136842563b1c025e39a22651
1 /*
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.
9 */
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>
21 #include <asm/mach-types.h>
22 #include <asm/mach/arch.h>
23 #include <asm/mach/flash.h>
24 #include <mach/addr-map.h>
25 #include <mach/mfp-pxa910.h>
26 #include <mach/pxa910.h>
28 #include "common.h"
30 #define TTCDKB_GPIO_EXT0(x) (NR_BUILTIN_GPIO + ((x < 0) ? 0 : \
31 ((x < 16) ? x : 15)))
32 #define TTCDKB_GPIO_EXT1(x) (NR_BUILTIN_GPIO + 16 + ((x < 0) ? 0 : \
33 ((x < 16) ? x : 15)))
36 * 16 board interrupts -- MAX7312 GPIO expander
37 * 16 board interrupts -- PCA9575 GPIO expander
38 * 24 board interrupts -- 88PM860x PMIC
40 #define TTCDKB_NR_IRQS (IRQ_BOARD_START + 16 + 16 + 24)
42 static unsigned long ttc_dkb_pin_config[] __initdata = {
43 /* UART2 */
44 GPIO47_UART2_RXD,
45 GPIO48_UART2_TXD,
47 /* DFI */
48 DF_IO0_ND_IO0,
49 DF_IO1_ND_IO1,
50 DF_IO2_ND_IO2,
51 DF_IO3_ND_IO3,
52 DF_IO4_ND_IO4,
53 DF_IO5_ND_IO5,
54 DF_IO6_ND_IO6,
55 DF_IO7_ND_IO7,
56 DF_IO8_ND_IO8,
57 DF_IO9_ND_IO9,
58 DF_IO10_ND_IO10,
59 DF_IO11_ND_IO11,
60 DF_IO12_ND_IO12,
61 DF_IO13_ND_IO13,
62 DF_IO14_ND_IO14,
63 DF_IO15_ND_IO15,
64 DF_nCS0_SM_nCS2_nCS0,
65 DF_ALE_SM_WEn_ND_ALE,
66 DF_CLE_SM_OEn_ND_CLE,
67 DF_WEn_DF_WEn,
68 DF_REn_DF_REn,
69 DF_RDY0_DF_RDY0,
72 static struct mtd_partition ttc_dkb_onenand_partitions[] = {
74 .name = "bootloader",
75 .offset = 0,
76 .size = SZ_1M,
77 .mask_flags = MTD_WRITEABLE,
78 }, {
79 .name = "reserved",
80 .offset = MTDPART_OFS_APPEND,
81 .size = SZ_128K,
82 .mask_flags = MTD_WRITEABLE,
83 }, {
84 .name = "reserved",
85 .offset = MTDPART_OFS_APPEND,
86 .size = SZ_8M,
87 .mask_flags = MTD_WRITEABLE,
88 }, {
89 .name = "kernel",
90 .offset = MTDPART_OFS_APPEND,
91 .size = (SZ_2M + SZ_1M),
92 .mask_flags = 0,
93 }, {
94 .name = "filesystem",
95 .offset = MTDPART_OFS_APPEND,
96 .size = SZ_32M + SZ_16M,
97 .mask_flags = 0,
101 static struct onenand_platform_data ttc_dkb_onenand_info = {
102 .parts = ttc_dkb_onenand_partitions,
103 .nr_parts = ARRAY_SIZE(ttc_dkb_onenand_partitions),
106 static struct resource ttc_dkb_resource_onenand[] = {
107 [0] = {
108 .start = SMC_CS0_PHYS_BASE,
109 .end = SMC_CS0_PHYS_BASE + SZ_1M,
110 .flags = IORESOURCE_MEM,
114 static struct platform_device ttc_dkb_device_onenand = {
115 .name = "onenand-flash",
116 .id = -1,
117 .resource = ttc_dkb_resource_onenand,
118 .num_resources = ARRAY_SIZE(ttc_dkb_resource_onenand),
119 .dev = {
120 .platform_data = &ttc_dkb_onenand_info,
124 static struct platform_device *ttc_dkb_devices[] = {
125 &ttc_dkb_device_onenand,
128 static struct pca953x_platform_data max7312_data[] = {
130 .gpio_base = TTCDKB_GPIO_EXT0(0),
131 .irq_base = IRQ_BOARD_START,
135 static struct i2c_board_info ttc_dkb_i2c_info[] = {
137 .type = "max7312",
138 .addr = 0x23,
139 .irq = IRQ_GPIO(80),
140 .platform_data = &max7312_data,
144 static void __init ttc_dkb_init(void)
146 mfp_config(ARRAY_AND_SIZE(ttc_dkb_pin_config));
148 /* on-chip devices */
149 pxa910_add_uart(1);
151 /* off-chip devices */
152 pxa910_add_twsi(0, NULL, ARRAY_AND_SIZE(ttc_dkb_i2c_info));
153 platform_add_devices(ARRAY_AND_SIZE(ttc_dkb_devices));
156 MACHINE_START(TTC_DKB, "PXA910-based TTC_DKB Development Platform")
157 .map_io = mmp_map_io,
158 .nr_irqs = TTCDKB_NR_IRQS,
159 .init_irq = pxa910_init_irq,
160 .timer = &pxa910_timer,
161 .init_machine = ttc_dkb_init,
162 MACHINE_END