2 * linux/arch/arm/mach-pxa/cm-x255.c
4 * Copyright (C) 2007, 2008 CompuLab, Ltd.
5 * Mike Rapoport <mike@compulab.co.il>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
12 #include <linux/platform_device.h>
13 #include <linux/irq.h>
14 #include <linux/gpio.h>
15 #include <linux/mtd/partitions.h>
16 #include <linux/mtd/physmap.h>
17 #include <linux/mtd/nand-gpio.h>
19 #include <linux/spi/spi.h>
21 #include <asm/mach/arch.h>
22 #include <asm/mach-types.h>
23 #include <asm/mach/map.h>
25 #include <mach/pxa2xx-regs.h>
26 #include <mach/mfp-pxa25x.h>
27 #include <mach/pxa2xx_spi.h>
28 #include <mach/bitfield.h>
32 #define GPIO_NAND_CS (5)
33 #define GPIO_NAND_ALE (4)
34 #define GPIO_NAND_CLE (3)
35 #define GPIO_NAND_RB (10)
37 static unsigned long cmx255_pin_config[] = {
40 GPIO29_AC97_SDATA_IN_0,
41 GPIO30_AC97_SDATA_OUT,
100 /* SDRAM and local bus */
109 GPIO0_GPIO | WAKEUP_ON_EDGE_BOTH,
110 GPIO9_GPIO, /* PC card reset */
113 GPIO5_GPIO | MFP_LPM_DRIVE_HIGH, /* NAND CE# */
114 GPIO4_GPIO | MFP_LPM_DRIVE_LOW, /* NAND ALE */
115 GPIO3_GPIO | MFP_LPM_DRIVE_LOW, /* NAND CLE */
116 GPIO10_GPIO, /* NAND Ready/Busy */
119 GPIO22_GPIO, /* DM9000 interrupt */
122 #if defined(CONFIG_SPI_PXA2XX)
123 static struct pxa2xx_spi_master pxa_ssp_master_info = {
127 static struct spi_board_info spi_board_info[] __initdata = {
129 .modalias = "rtc-max6902",
130 .max_speed_hz = 1000000,
136 static void __init cmx255_init_rtc(void)
138 pxa2xx_set_spi_info(1, &pxa_ssp_master_info);
139 spi_register_board_info(ARRAY_AND_SIZE(spi_board_info));
142 static inline void cmx255_init_rtc(void) {}
145 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
146 static struct mtd_partition cmx255_nor_partitions[] = {
151 .mask_flags = MTD_WRITEABLE /* force read-only */
153 .name = "ARMmon setup block",
155 .offset = MTDPART_OFS_APPEND,
156 .mask_flags = MTD_WRITEABLE /* force read-only */
160 .offset = MTDPART_OFS_APPEND,
163 .size = MTDPART_SIZ_FULL,
164 .offset = MTDPART_OFS_APPEND
168 static struct physmap_flash_data cmx255_nor_flash_data[] = {
170 .width = 2, /* bankwidth in bytes */
171 .parts = cmx255_nor_partitions,
172 .nr_parts = ARRAY_SIZE(cmx255_nor_partitions)
176 static struct resource cmx255_nor_resource = {
177 .start = PXA_CS0_PHYS,
178 .end = PXA_CS0_PHYS + SZ_8M - 1,
179 .flags = IORESOURCE_MEM,
182 static struct platform_device cmx255_nor = {
183 .name = "physmap-flash",
186 .platform_data = cmx255_nor_flash_data,
188 .resource = &cmx255_nor_resource,
192 static void __init cmx255_init_nor(void)
194 platform_device_register(&cmx255_nor);
197 static inline void cmx255_init_nor(void) {}
200 #if defined(CONFIG_MTD_NAND_GPIO) || defined(CONFIG_MTD_NAND_GPIO_MODULE)
201 static struct resource cmx255_nand_resource[] = {
203 .start = PXA_CS1_PHYS,
204 .end = PXA_CS1_PHYS + 11,
205 .flags = IORESOURCE_MEM,
208 .start = PXA_CS5_PHYS,
209 .end = PXA_CS5_PHYS + 3,
210 .flags = IORESOURCE_MEM,
214 static struct mtd_partition cmx255_nand_parts[] = {
216 .name = "cmx255-nand",
217 .size = MTDPART_SIZ_FULL,
222 static struct gpio_nand_platdata cmx255_nand_platdata = {
223 .gpio_nce = GPIO_NAND_CS,
224 .gpio_cle = GPIO_NAND_CLE,
225 .gpio_ale = GPIO_NAND_ALE,
226 .gpio_rdy = GPIO_NAND_RB,
228 .parts = cmx255_nand_parts,
229 .num_parts = ARRAY_SIZE(cmx255_nand_parts),
233 static struct platform_device cmx255_nand = {
235 .num_resources = ARRAY_SIZE(cmx255_nand_resource),
236 .resource = cmx255_nand_resource,
239 .platform_data = &cmx255_nand_platdata,
243 static void __init cmx255_init_nand(void)
245 platform_device_register(&cmx255_nand);
248 static inline void cmx255_init_nand(void) {}
251 void __init cmx255_init(void)
253 pxa2xx_mfp_config(ARRAY_AND_SIZE(cmx255_pin_config));