blob: 266215393f44c9d3a84335d34804074211c5f74a [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>
Neil Zhang673eef92012-05-03 14:19:14 +080020#include <linux/platform_data/mv_usb.h>
Eric Miao01215e32009-03-20 13:33:49 +080021
22#include <asm/mach-types.h>
23#include <asm/mach/arch.h>
Haojian Zhuangd6587c32009-09-23 01:57:35 +080024#include <asm/mach/flash.h>
Eric Miao01215e32009-03-20 13:33:49 +080025#include <mach/addr-map.h>
26#include <mach/mfp-pxa910.h>
27#include <mach/pxa910.h>
Haojian Zhuang1a8d5fa2011-11-08 14:15:59 +080028#include <mach/irqs.h>
Neil Zhang673eef92012-05-03 14:19:14 +080029#include <mach/regs-usb.h>
Eric Miao01215e32009-03-20 13:33:49 +080030
31#include "common.h"
32
Haojian Zhuang1a8d5fa2011-11-08 14:15:59 +080033#define TTCDKB_GPIO_EXT0(x) (MMP_NR_BUILTIN_GPIO + ((x < 0) ? 0 : \
Haojian Zhuange04eb142011-04-01 10:39:28 +080034 ((x < 16) ? x : 15)))
Haojian Zhuang1a8d5fa2011-11-08 14:15:59 +080035#define TTCDKB_GPIO_EXT1(x) (MMP_NR_BUILTIN_GPIO + 16 + ((x < 0) ? 0 : \
Haojian Zhuange04eb142011-04-01 10:39:28 +080036 ((x < 16) ? x : 15)))
37
38/*
39 * 16 board interrupts -- MAX7312 GPIO expander
40 * 16 board interrupts -- PCA9575 GPIO expander
41 * 24 board interrupts -- 88PM860x PMIC
42 */
Rob Herring8661fb92012-01-03 16:50:40 -060043#define TTCDKB_NR_IRQS (MMP_NR_IRQS + 16 + 16 + 24)
Haojian Zhuang0bd86962010-09-08 09:42:42 -040044
Eric Miao01215e32009-03-20 13:33:49 +080045static unsigned long ttc_dkb_pin_config[] __initdata = {
46 /* UART2 */
47 GPIO47_UART2_RXD,
48 GPIO48_UART2_TXD,
Haojian Zhuangd6587c32009-09-23 01:57:35 +080049
50 /* DFI */
51 DF_IO0_ND_IO0,
52 DF_IO1_ND_IO1,
53 DF_IO2_ND_IO2,
54 DF_IO3_ND_IO3,
55 DF_IO4_ND_IO4,
56 DF_IO5_ND_IO5,
57 DF_IO6_ND_IO6,
58 DF_IO7_ND_IO7,
59 DF_IO8_ND_IO8,
60 DF_IO9_ND_IO9,
61 DF_IO10_ND_IO10,
62 DF_IO11_ND_IO11,
63 DF_IO12_ND_IO12,
64 DF_IO13_ND_IO13,
65 DF_IO14_ND_IO14,
66 DF_IO15_ND_IO15,
67 DF_nCS0_SM_nCS2_nCS0,
68 DF_ALE_SM_WEn_ND_ALE,
69 DF_CLE_SM_OEn_ND_CLE,
70 DF_WEn_DF_WEn,
71 DF_REn_DF_REn,
72 DF_RDY0_DF_RDY0,
73};
74
75static struct mtd_partition ttc_dkb_onenand_partitions[] = {
76 {
77 .name = "bootloader",
78 .offset = 0,
79 .size = SZ_1M,
80 .mask_flags = MTD_WRITEABLE,
81 }, {
82 .name = "reserved",
83 .offset = MTDPART_OFS_APPEND,
84 .size = SZ_128K,
85 .mask_flags = MTD_WRITEABLE,
86 }, {
87 .name = "reserved",
88 .offset = MTDPART_OFS_APPEND,
89 .size = SZ_8M,
90 .mask_flags = MTD_WRITEABLE,
91 }, {
92 .name = "kernel",
93 .offset = MTDPART_OFS_APPEND,
94 .size = (SZ_2M + SZ_1M),
95 .mask_flags = 0,
96 }, {
97 .name = "filesystem",
98 .offset = MTDPART_OFS_APPEND,
Stephen Boyd3f8e2882011-07-26 18:45:54 +010099 .size = SZ_32M + SZ_16M,
Haojian Zhuangd6587c32009-09-23 01:57:35 +0800100 .mask_flags = 0,
101 }
102};
103
Haojian Zhuangd6223872009-11-20 10:57:16 -0500104static struct onenand_platform_data ttc_dkb_onenand_info = {
Haojian Zhuangd6587c32009-09-23 01:57:35 +0800105 .parts = ttc_dkb_onenand_partitions,
106 .nr_parts = ARRAY_SIZE(ttc_dkb_onenand_partitions),
107};
108
109static struct resource ttc_dkb_resource_onenand[] = {
110 [0] = {
111 .start = SMC_CS0_PHYS_BASE,
112 .end = SMC_CS0_PHYS_BASE + SZ_1M,
113 .flags = IORESOURCE_MEM,
114 },
115};
116
117static struct platform_device ttc_dkb_device_onenand = {
118 .name = "onenand-flash",
119 .id = -1,
120 .resource = ttc_dkb_resource_onenand,
121 .num_resources = ARRAY_SIZE(ttc_dkb_resource_onenand),
122 .dev = {
123 .platform_data = &ttc_dkb_onenand_info,
124 },
125};
126
127static struct platform_device *ttc_dkb_devices[] = {
Haojian Zhuang157d2642011-10-17 20:37:52 +0800128 &pxa910_device_gpio,
Haojian Zhuang4128e272012-02-23 23:37:33 +0800129 &pxa910_device_rtc,
Haojian Zhuangd6587c32009-09-23 01:57:35 +0800130 &ttc_dkb_device_onenand,
Eric Miao01215e32009-03-20 13:33:49 +0800131};
132
Haojian Zhuange04eb142011-04-01 10:39:28 +0800133static struct pca953x_platform_data max7312_data[] = {
134 {
135 .gpio_base = TTCDKB_GPIO_EXT0(0),
Rob Herring8661fb92012-01-03 16:50:40 -0600136 .irq_base = MMP_NR_IRQS,
Haojian Zhuange04eb142011-04-01 10:39:28 +0800137 },
138};
139
140static struct i2c_board_info ttc_dkb_i2c_info[] = {
141 {
142 .type = "max7312",
143 .addr = 0x23,
Haojian Zhuang1a8d5fa2011-11-08 14:15:59 +0800144 .irq = MMP_GPIO_TO_IRQ(80),
Haojian Zhuange04eb142011-04-01 10:39:28 +0800145 .platform_data = &max7312_data,
146 },
147};
148
Neil Zhang673eef92012-05-03 14:19:14 +0800149#ifdef CONFIG_USB_SUPPORT
150#if defined(CONFIG_USB_MV_UDC) || defined(CONFIG_USB_EHCI_MV_U2O)
151
152static char *pxa910_usb_clock_name[] = {
153 [0] = "U2OCLK",
154};
155
156static struct mv_usb_platform_data ttc_usb_pdata = {
157 .clknum = 1,
158 .clkname = pxa910_usb_clock_name,
159 .vbus = NULL,
160 .mode = MV_USB_MODE_OTG,
161 .otg_force_a_bus_req = 1,
162 .phy_init = pxa_usb_phy_init,
163 .phy_deinit = pxa_usb_phy_deinit,
164 .set_vbus = NULL,
165};
166#endif
167#endif
168
Eric Miao01215e32009-03-20 13:33:49 +0800169static void __init ttc_dkb_init(void)
170{
171 mfp_config(ARRAY_AND_SIZE(ttc_dkb_pin_config));
172
173 /* on-chip devices */
174 pxa910_add_uart(1);
Haojian Zhuangd6587c32009-09-23 01:57:35 +0800175
176 /* off-chip devices */
Haojian Zhuange04eb142011-04-01 10:39:28 +0800177 pxa910_add_twsi(0, NULL, ARRAY_AND_SIZE(ttc_dkb_i2c_info));
Haojian Zhuangd6587c32009-09-23 01:57:35 +0800178 platform_add_devices(ARRAY_AND_SIZE(ttc_dkb_devices));
Neil Zhang673eef92012-05-03 14:19:14 +0800179
180#ifdef CONFIG_USB_MV_UDC
181 pxa168_device_u2o.dev.platform_data = &ttc_usb_pdata;
182 platform_device_register(&pxa168_device_u2o);
183#endif
184
185#ifdef CONFIG_USB_EHCI_MV_U2O
186 pxa168_device_u2oehci.dev.platform_data = &ttc_usb_pdata;
187 platform_device_register(&pxa168_device_u2oehci);
188#endif
189
190#ifdef CONFIG_USB_MV_OTG
191 pxa168_device_u2ootg.dev.platform_data = &ttc_usb_pdata;
192 platform_device_register(&pxa168_device_u2ootg);
193#endif
Eric Miao01215e32009-03-20 13:33:49 +0800194}
195
196MACHINE_START(TTC_DKB, "PXA910-based TTC_DKB Development Platform")
Eric Miao80228872010-07-15 17:50:13 +0800197 .map_io = mmp_map_io,
Haojian Zhuang0bd86962010-09-08 09:42:42 -0400198 .nr_irqs = TTCDKB_NR_IRQS,
Eric Miao01215e32009-03-20 13:33:49 +0800199 .init_irq = pxa910_init_irq,
200 .timer = &pxa910_timer,
201 .init_machine = ttc_dkb_init,
Russell King9854a382011-11-05 15:40:09 +0000202 .restart = mmp_restart,
Eric Miao01215e32009-03-20 13:33:49 +0800203MACHINE_END