2 * Support for Cogent CSB726
4 * Copyright (c) 2008 Dmitry Eremin-Solenikov
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.
11 #include <linux/kernel.h>
12 #include <linux/init.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>
21 #include <asm/mach-types.h>
22 #include <asm/mach/arch.h>
23 #include <mach/csb726.h>
24 #include <mach/mfp-pxa27x.h>
27 #include <mach/ohci.h>
28 #include <mach/pxa2xx-regs.h>
29 #include <mach/audio.h>
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,
38 * XXX: 79 CS_3 for LAN9215 or PSKTSEL on R2, R3
39 * XXX: 33 CS_5 for LAN9215 on R1
42 static unsigned long csb726_pin_config[] = {
43 GPIO78_nCS_2, /* EXP_CS */
44 GPIO79_nCS_3, /* SMSC9215 */
45 GPIO80_nCS_4, /* SM501 */
47 GPIO52_GPIO, /* #SMSC9251 int */
48 GPIO53_GPIO, /* SM501 int */
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 */
63 GPIO0_GPIO, /* PWR_INT */
64 GPIO104_GPIO, /* PWR_OFF */
66 GPIO12_GPIO, /* touch irq */
70 MFP_CFG_OUT(GPIO19, AF1, DRIVE_LOW),/* SSP2_SYSCLK */
78 GPIO20_GPIO, /* SDIO int */
85 GPIO100_GPIO, /* SD CD */
86 GPIO101_GPIO, /* SD WP */
89 GPIO29_AC97_SDATA_IN_0,
90 GPIO30_AC97_SDATA_OUT,
118 GPIO57_nIOIS16, /* maybe unused */
120 GPIO98_GPIO, /* CF IRQ */
121 GPIO99_GPIO, /* CF CD */
122 GPIO103_GPIO, /* Reset */
128 static struct pxamci_platform_data csb726_mci_data;
130 static int csb726_mci_init(struct device *dev,
131 irq_handler_t detect, void *data)
133 csb726_mci_data.detect_delay = msecs_to_jiffies(500);
137 static struct pxamci_platform_data csb726_mci = {
138 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
139 .init = csb726_mci_init,
141 .gpio_card_detect = CSB726_GPIO_MMC_DETECT,
142 .gpio_card_ro = CSB726_GPIO_MMC_RO,
146 static struct pxaohci_platform_data csb726_ohci_platform_data = {
147 .port_mode = PMM_NPS_MODE,
148 .flags = ENABLE_PORT1 | NO_OC_PROTECTION,
151 static struct mtd_partition csb726_flash_partitions[] = {
153 .name = "Bootloader",
155 .size = CSB726_FLASH_uMON,
156 .mask_flags = MTD_WRITEABLE /* force read-only */
160 .offset = MTDPART_OFS_APPEND,
161 .size = MTDPART_SIZ_FULL,
165 static struct physmap_flash_data csb726_flash_data = {
167 .parts = csb726_flash_partitions,
168 .nr_parts = ARRAY_SIZE(csb726_flash_partitions),
171 static struct resource csb726_flash_resources[] = {
173 .start = PXA_CS0_PHYS,
174 .end = PXA_CS0_PHYS + CSB726_FLASH_SIZE - 1 ,
175 .flags = IORESOURCE_MEM,
179 static struct platform_device csb726_flash = {
180 .name = "physmap-flash",
182 .platform_data = &csb726_flash_data,
184 .resource = csb726_flash_resources,
185 .num_resources = ARRAY_SIZE(csb726_flash_resources),
188 static struct resource csb726_sm501_resources[] = {
190 .start = PXA_CS4_PHYS,
191 .end = PXA_CS4_PHYS + SZ_8M - 1,
192 .flags = IORESOURCE_MEM,
193 .name = "sm501-localmem",
196 .start = PXA_CS4_PHYS + SZ_64M - SZ_2M,
197 .end = PXA_CS4_PHYS + SZ_64M - 1,
198 .flags = IORESOURCE_MEM,
199 .name = "sm501-regs",
202 .start = CSB726_IRQ_SM501,
203 .end = CSB726_IRQ_SM501,
204 .flags = IORESOURCE_IRQ,
208 static struct sm501_initdata csb726_sm501_initdata = {
209 /* .devices = SM501_USE_USB_HOST, */
210 .devices = SM501_USE_USB_HOST | SM501_USE_UART0 | SM501_USE_UART1,
213 static struct sm501_platdata csb726_sm501_platdata = {
214 .init = &csb726_sm501_initdata,
217 static struct platform_device csb726_sm501 = {
220 .num_resources = ARRAY_SIZE(csb726_sm501_resources),
221 .resource = csb726_sm501_resources,
223 .platform_data = &csb726_sm501_platdata,
227 static struct resource csb726_lan_resources[] = {
229 .start = PXA_CS3_PHYS,
230 .end = PXA_CS3_PHYS + SZ_64K - 1,
231 .flags = IORESOURCE_MEM,
234 .start = CSB726_IRQ_LAN,
235 .end = CSB726_IRQ_LAN,
236 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
240 struct smsc911x_platform_config csb726_lan_config = {
241 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
242 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
243 .flags = SMSC911X_USE_32BIT,
244 .phy_interface = PHY_INTERFACE_MODE_MII,
248 static struct platform_device csb726_lan = {
251 .num_resources = ARRAY_SIZE(csb726_lan_resources),
252 .resource = csb726_lan_resources,
254 .platform_data = &csb726_lan_config,
258 static struct platform_device *devices[] __initdata = {
264 static void __init csb726_init(void)
266 pxa2xx_mfp_config(ARRAY_AND_SIZE(csb726_pin_config));
267 /* MSC1 = 0x7ffc3ffc; *//* LAN9215/EXP_CS */
268 /* MSC2 = 0x06697ff4; *//* none/SM501 */
269 MSC2 = (MSC2 & ~0xffff) | 0x7ff4; /* SM501 */
271 pxa_set_ffuart_info(NULL);
272 pxa_set_btuart_info(NULL);
273 pxa_set_stuart_info(NULL);
274 pxa_set_i2c_info(NULL);
275 pxa27x_set_i2c_power_info(NULL);
276 pxa_set_mci_info(&csb726_mci);
277 pxa_set_ohci_info(&csb726_ohci_platform_data);
278 pxa_set_ac97_info(NULL);
280 platform_add_devices(devices, ARRAY_SIZE(devices));
283 MACHINE_START(CSB726, "Cogent CSB726")
284 .phys_io = 0x40000000,
285 .boot_params = 0xa0000100,
286 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
287 .map_io = pxa_map_io,
288 .init_irq = pxa27x_init_irq,
289 .init_machine = csb726_init,