Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
csb726.c
Go to the documentation of this file.
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>
19 #include <linux/smsc911x.h>
20 #include <linux/i2c/pxa-i2c.h>
21 
22 #include <asm/mach-types.h>
23 #include <asm/mach/arch.h>
24 #include <mach/csb726.h>
25 #include <mach/pxa27x.h>
28 #include <mach/audio.h>
29 #include <mach/smemc.h>
30 
31 #include "generic.h"
32 #include "devices.h"
33 
34 /*
35  * n/a: 2, 5, 6, 7, 8, 23, 24, 25, 26, 27, 87, 88, 89,
36  * nu: 58 -- 77, 90, 91, 93, 102, 105-108, 114-116,
37  * XXX: 21,
38  * XXX: 79 CS_3 for LAN9215 or PSKTSEL on R2, R3
39  * XXX: 33 CS_5 for LAN9215 on R1
40  */
41 
42 static unsigned long csb726_pin_config[] = {
43  GPIO78_nCS_2, /* EXP_CS */
44  GPIO79_nCS_3, /* SMSC9215 */
45  GPIO80_nCS_4, /* SM501 */
46 
47  GPIO52_GPIO, /* #SMSC9251 int */
48  GPIO53_GPIO, /* SM501 int */
49 
50  GPIO1_GPIO, /* GPIO0 */
51  GPIO11_GPIO, /* GPIO1 */
52  GPIO9_GPIO, /* GPIO2 */
53  GPIO10_GPIO, /* GPIO3 */
54  GPIO16_PWM0_OUT, /* or GPIO4 */
55  GPIO17_PWM1_OUT, /* or GPIO5 */
56  GPIO94_GPIO, /* GPIO6 */
57  GPIO95_GPIO, /* GPIO7 */
58  GPIO96_GPIO, /* GPIO8 */
59  GPIO97_GPIO, /* GPIO9 */
60  GPIO15_GPIO, /* EXP_IRQ */
61  GPIO18_RDY, /* EXP_WAIT */
62 
63  GPIO0_GPIO, /* PWR_INT */
64  GPIO104_GPIO, /* PWR_OFF */
65 
66  GPIO12_GPIO, /* touch irq */
67 
70  MFP_CFG_OUT(GPIO19, AF1, DRIVE_LOW),/* SSP2_SYSCLK */
72 
77 
78  GPIO20_GPIO, /* SDIO int */
85  GPIO100_GPIO, /* SD CD */
86  GPIO101_GPIO, /* SD WP */
87 
93 
102 
107 
110 
111  GPIO48_nPOE,
112  GPIO49_nPWE,
113  GPIO50_nPIOR,
114  GPIO51_nPIOW,
116  GPIO55_nPREG,
118  GPIO57_nIOIS16, /* maybe unused */
120  GPIO98_GPIO, /* CF IRQ */
121  GPIO99_GPIO, /* CF CD */
122  GPIO103_GPIO, /* Reset */
123 
126 };
127 
128 static struct pxamci_platform_data csb726_mci = {
129  .detect_delay_ms = 500,
130  .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
131  /* FIXME setpower */
132  .gpio_card_detect = CSB726_GPIO_MMC_DETECT,
133  .gpio_card_ro = CSB726_GPIO_MMC_RO,
134  .gpio_power = -1,
135 };
136 
137 static struct pxaohci_platform_data csb726_ohci_platform_data = {
138  .port_mode = PMM_NPS_MODE,
139  .flags = ENABLE_PORT1 | NO_OC_PROTECTION,
140 };
141 
142 static struct mtd_partition csb726_flash_partitions[] = {
143  {
144  .name = "Bootloader",
145  .offset = 0,
146  .size = CSB726_FLASH_uMON,
147  .mask_flags = MTD_WRITEABLE /* force read-only */
148  },
149  {
150  .name = "root",
151  .offset = MTDPART_OFS_APPEND,
152  .size = MTDPART_SIZ_FULL,
153  }
154 };
155 
156 static struct physmap_flash_data csb726_flash_data = {
157  .width = 2,
158  .parts = csb726_flash_partitions,
159  .nr_parts = ARRAY_SIZE(csb726_flash_partitions),
160 };
161 
162 static struct resource csb726_flash_resources[] = {
163  {
164  .start = PXA_CS0_PHYS,
165  .end = PXA_CS0_PHYS + CSB726_FLASH_SIZE - 1 ,
166  .flags = IORESOURCE_MEM,
167  }
168 };
169 
170 static struct platform_device csb726_flash = {
171  .name = "physmap-flash",
172  .dev = {
173  .platform_data = &csb726_flash_data,
174  },
175  .resource = csb726_flash_resources,
176  .num_resources = ARRAY_SIZE(csb726_flash_resources),
177 };
178 
179 static struct resource csb726_sm501_resources[] = {
180  {
181  .start = PXA_CS4_PHYS,
182  .end = PXA_CS4_PHYS + SZ_8M - 1,
183  .flags = IORESOURCE_MEM,
184  .name = "sm501-localmem",
185  },
186  {
187  .start = PXA_CS4_PHYS + SZ_64M - SZ_2M,
188  .end = PXA_CS4_PHYS + SZ_64M - 1,
189  .flags = IORESOURCE_MEM,
190  .name = "sm501-regs",
191  },
192  {
193  .start = CSB726_IRQ_SM501,
194  .end = CSB726_IRQ_SM501,
195  .flags = IORESOURCE_IRQ,
196  },
197 };
198 
199 static struct sm501_initdata csb726_sm501_initdata = {
200 /* .devices = SM501_USE_USB_HOST, */
202 };
203 
204 static struct sm501_platdata csb726_sm501_platdata = {
205  .init = &csb726_sm501_initdata,
206 };
207 
208 static struct platform_device csb726_sm501 = {
209  .name = "sm501",
210  .id = 0,
211  .num_resources = ARRAY_SIZE(csb726_sm501_resources),
212  .resource = csb726_sm501_resources,
213  .dev = {
214  .platform_data = &csb726_sm501_platdata,
215  },
216 };
217 
218 static struct resource csb726_lan_resources[] = {
219  {
220  .start = PXA_CS3_PHYS,
221  .end = PXA_CS3_PHYS + SZ_64K - 1,
222  .flags = IORESOURCE_MEM,
223  },
224  {
225  .start = CSB726_IRQ_LAN,
226  .end = CSB726_IRQ_LAN,
228  },
229 };
230 
232  .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
233  .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
234  .flags = SMSC911X_USE_32BIT,
235  .phy_interface = PHY_INTERFACE_MODE_MII,
236 };
237 
238 
239 static struct platform_device csb726_lan = {
240  .name = "smsc911x",
241  .id = -1,
242  .num_resources = ARRAY_SIZE(csb726_lan_resources),
243  .resource = csb726_lan_resources,
244  .dev = {
245  .platform_data = &csb726_lan_config,
246  },
247 };
248 
249 static struct platform_device *devices[] __initdata = {
250  &csb726_flash,
251  &csb726_sm501,
252  &csb726_lan,
253 };
254 
255 static void __init csb726_init(void)
256 {
257  pxa2xx_mfp_config(ARRAY_AND_SIZE(csb726_pin_config));
258 /* __raw_writel(0x7ffc3ffc, MSC1); *//* LAN9215/EXP_CS */
259 /* __raw_writel(0x06697ff4, MSC2); *//* none/SM501 */
260  __raw_writel((__raw_readl(MSC2) & ~0xffff) | 0x7ff4, MSC2); /* SM501 */
261 
267  pxa_set_mci_info(&csb726_mci);
268  pxa_set_ohci_info(&csb726_ohci_platform_data);
270 
271  platform_add_devices(devices, ARRAY_SIZE(devices));
272 }
273 
274 MACHINE_START(CSB726, "Cogent CSB726")
275  .atag_offset = 0x100,
276  .map_io = pxa27x_map_io,
277  .nr_irqs = PXA_NR_IRQS,
278  .init_irq = pxa27x_init_irq,
279  .handle_irq = pxa27x_handle_irq,
280  .init_machine = csb726_init,
281  .timer = &pxa_timer,
282  .restart = pxa_restart,