blob: ce55fd8821c40f3bdff6bd757ef9bc47af5b32c5 [file] [log] [blame]
Eric Miao01215e32009-03-20 13:33:49 +08001/*
2 * linux/arch/arm/mach-mmp/ttc_dkb.c
3 *
4 * Support for the Marvell PXA910-based TTC_DKB Development Platform.
5 *
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 */
10
11#include <linux/init.h>
12#include <linux/kernel.h>
13#include <linux/platform_device.h>
Haojian Zhuangd6587c32009-09-23 01:57:35 +080014#include <linux/mtd/mtd.h>
15#include <linux/mtd/partitions.h>
16#include <linux/mtd/onenand.h>
Haojian Zhuang0bd86962010-09-08 09:42:42 -040017#include <linux/interrupt.h>
Haojian Zhuange04eb142011-04-01 10:39:28 +080018#include <linux/i2c/pca953x.h>
19#include <linux/gpio.h>
Chao Xief4466942012-05-07 11:24:00 +080020#include <linux/mfd/88pm860x.h>
Neil Zhang673eef92012-05-03 14:19:14 +080021#include <linux/platform_data/mv_usb.h>
Eric Miao01215e32009-03-20 13:33:49 +080022
23#include <asm/mach-types.h>
24#include <asm/mach/arch.h>
Haojian Zhuangd6587c32009-09-23 01:57:35 +080025#include <asm/mach/flash.h>
Eric Miao01215e32009-03-20 13:33:49 +080026#include <mach/addr-map.h>
27#include <mach/mfp-pxa910.h>
28#include <mach/pxa910.h>
Haojian Zhuang1a8d5fa2011-11-08 14:15:59 +080029#include <mach/irqs.h>
Neil Zhang673eef92012-05-03 14:19:14 +080030#include <mach/regs-usb.h>
Eric Miao01215e32009-03-20 13:33:49 +080031
32#include "common.h"
33
Haojian Zhuang1a8d5fa2011-11-08 14:15:59 +080034#define TTCDKB_GPIO_EXT0(x) (MMP_NR_BUILTIN_GPIO + ((x < 0) ? 0 : \
Haojian Zhuange04eb142011-04-01 10:39:28 +080035 ((x < 16) ? x : 15)))
Haojian Zhuang1a8d5fa2011-11-08 14:15:59 +080036#define TTCDKB_GPIO_EXT1(x) (MMP_NR_BUILTIN_GPIO + 16 + ((x < 0) ? 0 : \
Haojian Zhuange04eb142011-04-01 10:39:28 +080037 ((x < 16) ? x : 15)))
38
39/*
40 * 16 board interrupts -- MAX7312 GPIO expander
41 * 16 board interrupts -- PCA9575 GPIO expander
42 * 24 board interrupts -- 88PM860x PMIC
43 */
Rob Herring8661fb92012-01-03 16:50:40 -060044#define TTCDKB_NR_IRQS (MMP_NR_IRQS + 16 + 16 + 24)
Haojian Zhuang0bd86962010-09-08 09:42:42 -040045
Eric Miao01215e32009-03-20 13:33:49 +080046static unsigned long ttc_dkb_pin_config[] __initdata = {
47 /* UART2 */
48 GPIO47_UART2_RXD,
49 GPIO48_UART2_TXD,
Haojian Zhuangd6587c32009-09-23 01:57:35 +080050
51 /* DFI */
52 DF_IO0_ND_IO0,
53 DF_IO1_ND_IO1,
54 DF_IO2_ND_IO2,
55 DF_IO3_ND_IO3,
56 DF_IO4_ND_IO4,
57 DF_IO5_ND_IO5,
58 DF_IO6_ND_IO6,
59 DF_IO7_ND_IO7,
60 DF_IO8_ND_IO8,
61 DF_IO9_ND_IO9,
62 DF_IO10_ND_IO10,
63 DF_IO11_ND_IO11,
64 DF_IO12_ND_IO12,
65 DF_IO13_ND_IO13,
66 DF_IO14_ND_IO14,
67 DF_IO15_ND_IO15,
68 DF_nCS0_SM_nCS2_nCS0,
69 DF_ALE_SM_WEn_ND_ALE,
70 DF_CLE_SM_OEn_ND_CLE,
71 DF_WEn_DF_WEn,
72 DF_REn_DF_REn,
73 DF_RDY0_DF_RDY0,
74};
75
76static struct mtd_partition ttc_dkb_onenand_partitions[] = {
77 {
78 .name = "bootloader",
79 .offset = 0,
80 .size = SZ_1M,
81 .mask_flags = MTD_WRITEABLE,
82 }, {
83 .name = "reserved",
84 .offset = MTDPART_OFS_APPEND,
85 .size = SZ_128K,
86 .mask_flags = MTD_WRITEABLE,
87 }, {
88 .name = "reserved",
89 .offset = MTDPART_OFS_APPEND,
90 .size = SZ_8M,
91 .mask_flags = MTD_WRITEABLE,
92 }, {
93 .name = "kernel",
94 .offset = MTDPART_OFS_APPEND,
95 .size = (SZ_2M + SZ_1M),
96 .mask_flags = 0,
97 }, {
98 .name = "filesystem",
99 .offset = MTDPART_OFS_APPEND,
Stephen Boyd3f8e2882011-07-26 18:45:54 +0100100 .size = SZ_32M + SZ_16M,
Haojian Zhuangd6587c32009-09-23 01:57:35 +0800101 .mask_flags = 0,
102 }
103};
104
Haojian Zhuangd6223872009-11-20 10:57:16 -0500105static struct onenand_platform_data ttc_dkb_onenand_info = {
Haojian Zhuangd6587c32009-09-23 01:57:35 +0800106 .parts = ttc_dkb_onenand_partitions,
107 .nr_parts = ARRAY_SIZE(ttc_dkb_onenand_partitions),
108};
109
110static struct resource ttc_dkb_resource_onenand[] = {
111 [0] = {
112 .start = SMC_CS0_PHYS_BASE,
113 .end = SMC_CS0_PHYS_BASE + SZ_1M,
114 .flags = IORESOURCE_MEM,
115 },
116};
117
118static struct platform_device ttc_dkb_device_onenand = {
119 .name = "onenand-flash",
120 .id = -1,
121 .resource = ttc_dkb_resource_onenand,
122 .num_resources = ARRAY_SIZE(ttc_dkb_resource_onenand),
123 .dev = {
124 .platform_data = &ttc_dkb_onenand_info,
125 },
126};
127
128static struct platform_device *ttc_dkb_devices[] = {
Haojian Zhuang157d2642011-10-17 20:37:52 +0800129 &pxa910_device_gpio,
Haojian Zhuang4128e272012-02-23 23:37:33 +0800130 &pxa910_device_rtc,
Haojian Zhuangd6587c32009-09-23 01:57:35 +0800131 &ttc_dkb_device_onenand,
Eric Miao01215e32009-03-20 13:33:49 +0800132};
133
Haojian Zhuange04eb142011-04-01 10:39:28 +0800134static struct pca953x_platform_data max7312_data[] = {
135 {
136 .gpio_base = TTCDKB_GPIO_EXT0(0),
Rob Herring8661fb92012-01-03 16:50:40 -0600137 .irq_base = MMP_NR_IRQS,
Haojian Zhuange04eb142011-04-01 10:39:28 +0800138 },
139};
140
Chao Xief4466942012-05-07 11:24:00 +0800141static struct pm860x_platform_data ttc_dkb_pm8607_info = {
142 .irq_base = IRQ_BOARD_START,
143};
144
Haojian Zhuange04eb142011-04-01 10:39:28 +0800145static struct i2c_board_info ttc_dkb_i2c_info[] = {
146 {
Chao Xief4466942012-05-07 11:24:00 +0800147 .type = "88PM860x",
148 .addr = 0x34,
149 .platform_data = &ttc_dkb_pm8607_info,
150 .irq = IRQ_PXA910_PMIC_INT,
151 },
152 {
Haojian Zhuange04eb142011-04-01 10:39:28 +0800153 .type = "max7312",
154 .addr = 0x23,
Haojian Zhuang1a8d5fa2011-11-08 14:15:59 +0800155 .irq = MMP_GPIO_TO_IRQ(80),
Haojian Zhuange04eb142011-04-01 10:39:28 +0800156 .platform_data = &max7312_data,
157 },
158};
159
Neil Zhang673eef92012-05-03 14:19:14 +0800160#ifdef CONFIG_USB_SUPPORT
161#if defined(CONFIG_USB_MV_UDC) || defined(CONFIG_USB_EHCI_MV_U2O)
162
163static char *pxa910_usb_clock_name[] = {
164 [0] = "U2OCLK",
165};
166
167static struct mv_usb_platform_data ttc_usb_pdata = {
168 .clknum = 1,
169 .clkname = pxa910_usb_clock_name,
170 .vbus = NULL,
171 .mode = MV_USB_MODE_OTG,
172 .otg_force_a_bus_req = 1,
173 .phy_init = pxa_usb_phy_init,
174 .phy_deinit = pxa_usb_phy_deinit,
175 .set_vbus = NULL,
176};
177#endif
178#endif
179
Lei Wen0f74da32012-07-30 21:59:41 +0800180#ifdef CONFIG_MTD_NAND_PXA3xx
181static struct pxa3xx_nand_platform_data dkb_nand_info = {
182 .enable_arbiter = 1,
183 .num_cs = 1,
184};
185#endif
186
Eric Miao01215e32009-03-20 13:33:49 +0800187static void __init ttc_dkb_init(void)
188{
189 mfp_config(ARRAY_AND_SIZE(ttc_dkb_pin_config));
190
191 /* on-chip devices */
192 pxa910_add_uart(1);
Lei Wen0f74da32012-07-30 21:59:41 +0800193#ifdef CONFIG_MTD_NAND_PXA3xx
194 pxa910_add_nand(&dkb_nand_info);
195#endif
Haojian Zhuangd6587c32009-09-23 01:57:35 +0800196
197 /* off-chip devices */
Haojian Zhuange04eb142011-04-01 10:39:28 +0800198 pxa910_add_twsi(0, NULL, ARRAY_AND_SIZE(ttc_dkb_i2c_info));
Haojian Zhuangd6587c32009-09-23 01:57:35 +0800199 platform_add_devices(ARRAY_AND_SIZE(ttc_dkb_devices));
Neil Zhang673eef92012-05-03 14:19:14 +0800200
201#ifdef CONFIG_USB_MV_UDC
202 pxa168_device_u2o.dev.platform_data = &ttc_usb_pdata;
203 platform_device_register(&pxa168_device_u2o);
204#endif
205
206#ifdef CONFIG_USB_EHCI_MV_U2O
207 pxa168_device_u2oehci.dev.platform_data = &ttc_usb_pdata;
208 platform_device_register(&pxa168_device_u2oehci);
209#endif
210
211#ifdef CONFIG_USB_MV_OTG
212 pxa168_device_u2ootg.dev.platform_data = &ttc_usb_pdata;
213 platform_device_register(&pxa168_device_u2ootg);
214#endif
Eric Miao01215e32009-03-20 13:33:49 +0800215}
216
217MACHINE_START(TTC_DKB, "PXA910-based TTC_DKB Development Platform")
Eric Miao80228872010-07-15 17:50:13 +0800218 .map_io = mmp_map_io,
Haojian Zhuang0bd86962010-09-08 09:42:42 -0400219 .nr_irqs = TTCDKB_NR_IRQS,
Eric Miao01215e32009-03-20 13:33:49 +0800220 .init_irq = pxa910_init_irq,
221 .timer = &pxa910_timer,
222 .init_machine = ttc_dkb_init,
Russell King9854a382011-11-05 15:40:09 +0000223 .restart = mmp_restart,
Eric Miao01215e32009-03-20 13:33:49 +0800224MACHINE_END