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/mtd/partitions.h>
15 #include <linux/mtd/physmap.h>
16 #include <linux/mtd/nand-gpio.h>
17 #include <linux/gpio/machine.h>
18 #include <linux/spi/spi.h>
19 #include <linux/spi/pxa2xx_spi.h>
21 #include <asm/mach/arch.h>
22 #include <asm/mach-types.h>
23 #include <asm/mach/map.h>
29 #define GPIO_NAND_CS (5)
30 #define GPIO_NAND_ALE (4)
31 #define GPIO_NAND_CLE (3)
32 #define GPIO_NAND_RB (10)
34 static unsigned long cmx255_pin_config
[] = {
37 GPIO29_AC97_SDATA_IN_0
,
38 GPIO30_AC97_SDATA_OUT
,
78 /* SDRAM and local bus */
87 GPIO0_GPIO
| WAKEUP_ON_EDGE_BOTH
,
88 GPIO9_GPIO
, /* PC card reset */
91 GPIO5_GPIO
| MFP_LPM_DRIVE_HIGH
, /* NAND CE# */
92 GPIO4_GPIO
| MFP_LPM_DRIVE_LOW
, /* NAND ALE */
93 GPIO3_GPIO
| MFP_LPM_DRIVE_LOW
, /* NAND CLE */
94 GPIO10_GPIO
, /* NAND Ready/Busy */
97 GPIO22_GPIO
, /* DM9000 interrupt */
100 #if defined(CONFIG_SPI_PXA2XX)
101 static struct pxa2xx_spi_master pxa_ssp_master_info
= {
105 static struct spi_board_info spi_board_info
[] __initdata
= {
107 .modalias
= "rtc-max6902",
108 .max_speed_hz
= 1000000,
114 static void __init
cmx255_init_rtc(void)
116 pxa2xx_set_spi_info(1, &pxa_ssp_master_info
);
117 spi_register_board_info(ARRAY_AND_SIZE(spi_board_info
));
120 static inline void cmx255_init_rtc(void) {}
123 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
124 static struct mtd_partition cmx255_nor_partitions
[] = {
129 .mask_flags
= MTD_WRITEABLE
/* force read-only */
131 .name
= "ARMmon setup block",
133 .offset
= MTDPART_OFS_APPEND
,
134 .mask_flags
= MTD_WRITEABLE
/* force read-only */
138 .offset
= MTDPART_OFS_APPEND
,
141 .size
= MTDPART_SIZ_FULL
,
142 .offset
= MTDPART_OFS_APPEND
146 static struct physmap_flash_data cmx255_nor_flash_data
[] = {
148 .width
= 2, /* bankwidth in bytes */
149 .parts
= cmx255_nor_partitions
,
150 .nr_parts
= ARRAY_SIZE(cmx255_nor_partitions
)
154 static struct resource cmx255_nor_resource
= {
155 .start
= PXA_CS0_PHYS
,
156 .end
= PXA_CS0_PHYS
+ SZ_8M
- 1,
157 .flags
= IORESOURCE_MEM
,
160 static struct platform_device cmx255_nor
= {
161 .name
= "physmap-flash",
164 .platform_data
= cmx255_nor_flash_data
,
166 .resource
= &cmx255_nor_resource
,
170 static void __init
cmx255_init_nor(void)
172 platform_device_register(&cmx255_nor
);
175 static inline void cmx255_init_nor(void) {}
178 #if defined(CONFIG_MTD_NAND_GPIO) || defined(CONFIG_MTD_NAND_GPIO_MODULE)
180 static struct gpiod_lookup_table cmx255_nand_gpiod_table
= {
181 .dev_id
= "gpio-nand",
183 GPIO_LOOKUP("gpio-pxa", GPIO_NAND_CS
, "nce", GPIO_ACTIVE_HIGH
),
184 GPIO_LOOKUP("gpio-pxa", GPIO_NAND_CLE
, "cle", GPIO_ACTIVE_HIGH
),
185 GPIO_LOOKUP("gpio-pxa", GPIO_NAND_ALE
, "ale", GPIO_ACTIVE_HIGH
),
186 GPIO_LOOKUP("gpio-pxa", GPIO_NAND_RB
, "rdy", GPIO_ACTIVE_HIGH
),
190 static struct resource cmx255_nand_resource
[] = {
192 .start
= PXA_CS1_PHYS
,
193 .end
= PXA_CS1_PHYS
+ 11,
194 .flags
= IORESOURCE_MEM
,
197 .start
= PXA_CS5_PHYS
,
198 .end
= PXA_CS5_PHYS
+ 3,
199 .flags
= IORESOURCE_MEM
,
203 static struct mtd_partition cmx255_nand_parts
[] = {
205 .name
= "cmx255-nand",
206 .size
= MTDPART_SIZ_FULL
,
211 static struct gpio_nand_platdata cmx255_nand_platdata
= {
212 .parts
= cmx255_nand_parts
,
213 .num_parts
= ARRAY_SIZE(cmx255_nand_parts
),
217 static struct platform_device cmx255_nand
= {
219 .num_resources
= ARRAY_SIZE(cmx255_nand_resource
),
220 .resource
= cmx255_nand_resource
,
223 .platform_data
= &cmx255_nand_platdata
,
227 static void __init
cmx255_init_nand(void)
229 gpiod_add_lookup_table(&cmx255_nand_gpiod_table
);
230 platform_device_register(&cmx255_nand
);
233 static inline void cmx255_init_nand(void) {}
236 void __init
cmx255_init(void)
238 pxa2xx_mfp_config(ARRAY_AND_SIZE(cmx255_pin_config
));