ARM: mmp: add usb device support for ttc dkb
[deliverable/linux.git] / arch / arm / mach-mmp / ttc_dkb.c
CommitLineData
01215e35
EM
1/*
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>
d6587c34
HZ
14#include <linux/mtd/mtd.h>
15#include <linux/mtd/partitions.h>
16#include <linux/mtd/onenand.h>
0bd86961 17#include <linux/interrupt.h>
e04eb14f
HZ
18#include <linux/i2c/pca953x.h>
19#include <linux/gpio.h>
673eef98 20#include <linux/platform_data/mv_usb.h>
01215e35
EM
21
22#include <asm/mach-types.h>
23#include <asm/mach/arch.h>
d6587c34 24#include <asm/mach/flash.h>
01215e35
EM
25#include <mach/addr-map.h>
26#include <mach/mfp-pxa910.h>
27#include <mach/pxa910.h>
1a8d5fab 28#include <mach/irqs.h>
673eef98 29#include <mach/regs-usb.h>
01215e35
EM
30
31#include "common.h"
32
1a8d5fab 33#define TTCDKB_GPIO_EXT0(x) (MMP_NR_BUILTIN_GPIO + ((x < 0) ? 0 : \
e04eb14f 34 ((x < 16) ? x : 15)))
1a8d5fab 35#define TTCDKB_GPIO_EXT1(x) (MMP_NR_BUILTIN_GPIO + 16 + ((x < 0) ? 0 : \
e04eb14f
HZ
36 ((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 */
8661fb92 43#define TTCDKB_NR_IRQS (MMP_NR_IRQS + 16 + 16 + 24)
0bd86961 44
01215e35
EM
45static unsigned long ttc_dkb_pin_config[] __initdata = {
46 /* UART2 */
47 GPIO47_UART2_RXD,
48 GPIO48_UART2_TXD,
d6587c34
HZ
49
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,
3f8e2880 99 .size = SZ_32M + SZ_16M,
d6587c34
HZ
100 .mask_flags = 0,
101 }
102};
103
d6223871 104static struct onenand_platform_data ttc_dkb_onenand_info = {
d6587c34
HZ
105 .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[] = {
157d2644 128 &pxa910_device_gpio,
4128e275 129 &pxa910_device_rtc,
d6587c34 130 &ttc_dkb_device_onenand,
01215e35
EM
131};
132
e04eb14f
HZ
133static struct pca953x_platform_data max7312_data[] = {
134 {
135 .gpio_base = TTCDKB_GPIO_EXT0(0),
8661fb92 136 .irq_base = MMP_NR_IRQS,
e04eb14f
HZ
137 },
138};
139
140static struct i2c_board_info ttc_dkb_i2c_info[] = {
141 {
142 .type = "max7312",
143 .addr = 0x23,
1a8d5fab 144 .irq = MMP_GPIO_TO_IRQ(80),
e04eb14f
HZ
145 .platform_data = &max7312_data,
146 },
147};
148
673eef98
NZ
149#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
01215e35
EM
169static 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);
d6587c34
HZ
175
176 /* off-chip devices */
e04eb14f 177 pxa910_add_twsi(0, NULL, ARRAY_AND_SIZE(ttc_dkb_i2c_info));
d6587c34 178 platform_add_devices(ARRAY_AND_SIZE(ttc_dkb_devices));
673eef98
NZ
179
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
01215e35
EM
194}
195
196MACHINE_START(TTC_DKB, "PXA910-based TTC_DKB Development Platform")
8022887c 197 .map_io = mmp_map_io,
0bd86961 198 .nr_irqs = TTCDKB_NR_IRQS,
01215e35
EM
199 .init_irq = pxa910_init_irq,
200 .timer = &pxa910_timer,
201 .init_machine = ttc_dkb_init,
9854a38e 202 .restart = mmp_restart,
01215e35 203MACHINE_END
This page took 0.190954 seconds and 5 git commands to generate.