Commit | Line | Data |
---|---|---|
aac42970 DES |
1 | /* |
2 | * Support for Cogent CSB726 | |
3 | * | |
4 | * Copyright (c) 2008 Dmitry Eremin-Solenikov | |
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 | * published by the Free Software Foundation. | |
9 | * | |
10 | */ | |
11 | #include <linux/kernel.h> | |
12 | #include <linux/init.h> | |
13 | #include <linux/io.h> | |
14 | #include <linux/gpio.h> | |
15 | #include <linux/platform_device.h> | |
16 | #include <linux/mtd/physmap.h> | |
17 | #include <linux/mtd/partitions.h> | |
18 | #include <linux/sm501.h> | |
b8601715 | 19 | #include <linux/smsc911x.h> |
aac42970 DES |
20 | |
21 | #include <asm/mach-types.h> | |
22 | #include <asm/mach/arch.h> | |
23 | #include <mach/csb726.h> | |
24 | #include <mach/mfp-pxa27x.h> | |
f0a83701 | 25 | #include <plat/i2c.h> |
aac42970 DES |
26 | #include <mach/mmc.h> |
27 | #include <mach/ohci.h> | |
28 | #include <mach/pxa2xx-regs.h> | |
96a9fcaf | 29 | #include <mach/audio.h> |
ad68bb9f | 30 | #include <mach/smemc.h> |
aac42970 DES |
31 | |
32 | #include "generic.h" | |
33 | #include "devices.h" | |
34 | ||
35 | /* | |
36 | * n/a: 2, 5, 6, 7, 8, 23, 24, 25, 26, 27, 87, 88, 89, | |
37 | * nu: 58 -- 77, 90, 91, 93, 102, 105-108, 114-116, | |
38 | * XXX: 21, | |
39 | * XXX: 79 CS_3 for LAN9215 or PSKTSEL on R2, R3 | |
40 | * XXX: 33 CS_5 for LAN9215 on R1 | |
41 | */ | |
42 | ||
43 | static unsigned long csb726_pin_config[] = { | |
44 | GPIO78_nCS_2, /* EXP_CS */ | |
45 | GPIO79_nCS_3, /* SMSC9215 */ | |
46 | GPIO80_nCS_4, /* SM501 */ | |
47 | ||
48 | GPIO52_GPIO, /* #SMSC9251 int */ | |
49 | GPIO53_GPIO, /* SM501 int */ | |
50 | ||
51 | GPIO1_GPIO, /* GPIO0 */ | |
52 | GPIO11_GPIO, /* GPIO1 */ | |
53 | GPIO9_GPIO, /* GPIO2 */ | |
54 | GPIO10_GPIO, /* GPIO3 */ | |
55 | GPIO16_PWM0_OUT, /* or GPIO4 */ | |
56 | GPIO17_PWM1_OUT, /* or GPIO5 */ | |
57 | GPIO94_GPIO, /* GPIO6 */ | |
58 | GPIO95_GPIO, /* GPIO7 */ | |
59 | GPIO96_GPIO, /* GPIO8 */ | |
60 | GPIO97_GPIO, /* GPIO9 */ | |
61 | GPIO15_GPIO, /* EXP_IRQ */ | |
62 | GPIO18_RDY, /* EXP_WAIT */ | |
63 | ||
64 | GPIO0_GPIO, /* PWR_INT */ | |
65 | GPIO104_GPIO, /* PWR_OFF */ | |
66 | ||
67 | GPIO12_GPIO, /* touch irq */ | |
68 | ||
69 | GPIO13_SSP2_TXD, | |
70 | GPIO14_SSP2_SFRM, | |
71 | MFP_CFG_OUT(GPIO19, AF1, DRIVE_LOW),/* SSP2_SYSCLK */ | |
72 | GPIO22_SSP2_SCLK, | |
73 | ||
74 | GPIO81_SSP3_TXD, | |
75 | GPIO82_SSP3_RXD, | |
76 | GPIO83_SSP3_SFRM, | |
77 | GPIO84_SSP3_SCLK, | |
78 | ||
79 | GPIO20_GPIO, /* SDIO int */ | |
80 | GPIO32_MMC_CLK, | |
81 | GPIO92_MMC_DAT_0, | |
82 | GPIO109_MMC_DAT_1, | |
83 | GPIO110_MMC_DAT_2, | |
84 | GPIO111_MMC_DAT_3, | |
85 | GPIO112_MMC_CMD, | |
86 | GPIO100_GPIO, /* SD CD */ | |
87 | GPIO101_GPIO, /* SD WP */ | |
88 | ||
89 | GPIO28_AC97_BITCLK, | |
90 | GPIO29_AC97_SDATA_IN_0, | |
91 | GPIO30_AC97_SDATA_OUT, | |
92 | GPIO31_AC97_SYNC, | |
93 | GPIO113_AC97_nRESET, | |
94 | ||
95 | GPIO34_FFUART_RXD, | |
96 | GPIO35_FFUART_CTS, | |
97 | GPIO36_FFUART_DCD, | |
98 | GPIO37_FFUART_DSR, | |
99 | GPIO38_FFUART_RI, | |
100 | GPIO39_FFUART_TXD, | |
101 | GPIO40_FFUART_DTR, | |
102 | GPIO41_FFUART_RTS, | |
103 | ||
104 | GPIO42_BTUART_RXD, | |
105 | GPIO43_BTUART_TXD, | |
106 | GPIO44_BTUART_CTS, | |
107 | GPIO45_BTUART_RTS, | |
108 | ||
109 | GPIO46_STUART_RXD, | |
110 | GPIO47_STUART_TXD, | |
111 | ||
112 | GPIO48_nPOE, | |
113 | GPIO49_nPWE, | |
114 | GPIO50_nPIOR, | |
115 | GPIO51_nPIOW, | |
116 | GPIO54_nPCE_2, | |
117 | GPIO55_nPREG, | |
118 | GPIO56_nPWAIT, | |
119 | GPIO57_nIOIS16, /* maybe unused */ | |
120 | GPIO85_nPCE_1, | |
121 | GPIO98_GPIO, /* CF IRQ */ | |
122 | GPIO99_GPIO, /* CF CD */ | |
123 | GPIO103_GPIO, /* Reset */ | |
124 | ||
125 | GPIO117_I2C_SCL, | |
126 | GPIO118_I2C_SDA, | |
127 | }; | |
128 | ||
aac42970 | 129 | static struct pxamci_platform_data csb726_mci = { |
f97cab28 | 130 | .detect_delay_ms = 500, |
7a648256 | 131 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, |
aac42970 | 132 | /* FIXME setpower */ |
7a648256 RJ |
133 | .gpio_card_detect = CSB726_GPIO_MMC_DETECT, |
134 | .gpio_card_ro = CSB726_GPIO_MMC_RO, | |
135 | .gpio_power = -1, | |
aac42970 DES |
136 | }; |
137 | ||
138 | static struct pxaohci_platform_data csb726_ohci_platform_data = { | |
139 | .port_mode = PMM_NPS_MODE, | |
140 | .flags = ENABLE_PORT1 | NO_OC_PROTECTION, | |
141 | }; | |
142 | ||
143 | static struct mtd_partition csb726_flash_partitions[] = { | |
144 | { | |
145 | .name = "Bootloader", | |
146 | .offset = 0, | |
147 | .size = CSB726_FLASH_uMON, | |
148 | .mask_flags = MTD_WRITEABLE /* force read-only */ | |
149 | }, | |
150 | { | |
151 | .name = "root", | |
152 | .offset = MTDPART_OFS_APPEND, | |
153 | .size = MTDPART_SIZ_FULL, | |
154 | } | |
155 | }; | |
156 | ||
157 | static struct physmap_flash_data csb726_flash_data = { | |
158 | .width = 2, | |
159 | .parts = csb726_flash_partitions, | |
160 | .nr_parts = ARRAY_SIZE(csb726_flash_partitions), | |
161 | }; | |
162 | ||
163 | static struct resource csb726_flash_resources[] = { | |
164 | { | |
165 | .start = PXA_CS0_PHYS, | |
166 | .end = PXA_CS0_PHYS + CSB726_FLASH_SIZE - 1 , | |
167 | .flags = IORESOURCE_MEM, | |
168 | } | |
169 | }; | |
170 | ||
171 | static struct platform_device csb726_flash = { | |
172 | .name = "physmap-flash", | |
173 | .dev = { | |
174 | .platform_data = &csb726_flash_data, | |
175 | }, | |
176 | .resource = csb726_flash_resources, | |
177 | .num_resources = ARRAY_SIZE(csb726_flash_resources), | |
178 | }; | |
179 | ||
180 | static struct resource csb726_sm501_resources[] = { | |
181 | { | |
182 | .start = PXA_CS4_PHYS, | |
183 | .end = PXA_CS4_PHYS + SZ_8M - 1, | |
184 | .flags = IORESOURCE_MEM, | |
185 | .name = "sm501-localmem", | |
186 | }, | |
187 | { | |
188 | .start = PXA_CS4_PHYS + SZ_64M - SZ_2M, | |
189 | .end = PXA_CS4_PHYS + SZ_64M - 1, | |
190 | .flags = IORESOURCE_MEM, | |
191 | .name = "sm501-regs", | |
192 | }, | |
193 | { | |
194 | .start = CSB726_IRQ_SM501, | |
195 | .end = CSB726_IRQ_SM501, | |
196 | .flags = IORESOURCE_IRQ, | |
197 | }, | |
198 | }; | |
199 | ||
200 | static struct sm501_initdata csb726_sm501_initdata = { | |
201 | /* .devices = SM501_USE_USB_HOST, */ | |
202 | .devices = SM501_USE_USB_HOST | SM501_USE_UART0 | SM501_USE_UART1, | |
203 | }; | |
204 | ||
205 | static struct sm501_platdata csb726_sm501_platdata = { | |
206 | .init = &csb726_sm501_initdata, | |
207 | }; | |
208 | ||
209 | static struct platform_device csb726_sm501 = { | |
210 | .name = "sm501", | |
211 | .id = 0, | |
212 | .num_resources = ARRAY_SIZE(csb726_sm501_resources), | |
213 | .resource = csb726_sm501_resources, | |
214 | .dev = { | |
215 | .platform_data = &csb726_sm501_platdata, | |
216 | }, | |
217 | }; | |
218 | ||
219 | static struct resource csb726_lan_resources[] = { | |
220 | { | |
221 | .start = PXA_CS3_PHYS, | |
222 | .end = PXA_CS3_PHYS + SZ_64K - 1, | |
223 | .flags = IORESOURCE_MEM, | |
224 | }, | |
225 | { | |
226 | .start = CSB726_IRQ_LAN, | |
227 | .end = CSB726_IRQ_LAN, | |
b8601715 | 228 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE, |
aac42970 DES |
229 | }, |
230 | }; | |
231 | ||
b8601715 | 232 | struct smsc911x_platform_config csb726_lan_config = { |
c639ef43 | 233 | .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, |
b8601715 DES |
234 | .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL, |
235 | .flags = SMSC911X_USE_32BIT, | |
236 | .phy_interface = PHY_INTERFACE_MODE_MII, | |
237 | }; | |
238 | ||
239 | ||
aac42970 | 240 | static struct platform_device csb726_lan = { |
b8601715 | 241 | .name = "smsc911x", |
aac42970 DES |
242 | .id = -1, |
243 | .num_resources = ARRAY_SIZE(csb726_lan_resources), | |
244 | .resource = csb726_lan_resources, | |
b8601715 DES |
245 | .dev = { |
246 | .platform_data = &csb726_lan_config, | |
247 | }, | |
aac42970 DES |
248 | }; |
249 | ||
250 | static struct platform_device *devices[] __initdata = { | |
251 | &csb726_flash, | |
252 | &csb726_sm501, | |
253 | &csb726_lan, | |
254 | }; | |
255 | ||
256 | static void __init csb726_init(void) | |
257 | { | |
258 | pxa2xx_mfp_config(ARRAY_AND_SIZE(csb726_pin_config)); | |
ad68bb9f MV |
259 | /* __raw_writel(0x7ffc3ffc, MSC1); *//* LAN9215/EXP_CS */ |
260 | /* __raw_writel(0x06697ff4, MSC2); *//* none/SM501 */ | |
261 | __raw_writel((__raw_readl(MSC2) & ~0xffff) | 0x7ff4, MSC2); /* SM501 */ | |
aac42970 | 262 | |
cc155c6f RK |
263 | pxa_set_ffuart_info(NULL); |
264 | pxa_set_btuart_info(NULL); | |
265 | pxa_set_stuart_info(NULL); | |
aac42970 DES |
266 | pxa_set_i2c_info(NULL); |
267 | pxa27x_set_i2c_power_info(NULL); | |
268 | pxa_set_mci_info(&csb726_mci); | |
269 | pxa_set_ohci_info(&csb726_ohci_platform_data); | |
96a9fcaf | 270 | pxa_set_ac97_info(NULL); |
aac42970 DES |
271 | |
272 | platform_add_devices(devices, ARRAY_SIZE(devices)); | |
273 | } | |
274 | ||
275 | MACHINE_START(CSB726, "Cogent CSB726") | |
aac42970 | 276 | .boot_params = 0xa0000100, |
851982c1 | 277 | .map_io = pxa27x_map_io, |
aac42970 DES |
278 | .init_irq = pxa27x_init_irq, |
279 | .init_machine = csb726_init, | |
280 | .timer = &pxa_timer, | |
281 | MACHINE_END |