diff options
author | Vladimir Barinov <vbarinov@ru.mvista.com> | 2007-05-16 15:39:02 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2007-07-12 06:12:15 -0400 |
commit | 4ad48b4bfa121a67ec04162d584afcfa75ed151a (patch) | |
tree | fcd42e72641165e3665b70b470c8b1b62b8fcd13 /arch/arm | |
parent | 7dcca30a32aadb0520417521b0c44f42d09fe05c (diff) |
[ARM] 4385/2: ixdp425: NAND support
IXDP425 NAND support (arch specific part).
The generic platform driver that is used by ixdp425 platfrom is already
in upstream kernel in 2.6.22-rc1.
Signed-off-by: Vladimir Barinov <vbarinov@ru.mvista.com>
Signed-off-by: Ruslan Sushko <rsushko@ru.mvista.com>
Signed-off-by: Deepak Saxena <dsaxena@mvista.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-ixp4xx/ixdp425-setup.c | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/arch/arm/mach-ixp4xx/ixdp425-setup.c b/arch/arm/mach-ixp4xx/ixdp425-setup.c index ec4f07950ec6..d5008d8fc9a5 100644 --- a/arch/arm/mach-ixp4xx/ixdp425-setup.c +++ b/arch/arm/mach-ixp4xx/ixdp425-setup.c | |||
@@ -15,6 +15,10 @@ | |||
15 | #include <linux/tty.h> | 15 | #include <linux/tty.h> |
16 | #include <linux/serial_8250.h> | 16 | #include <linux/serial_8250.h> |
17 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
18 | #include <linux/io.h> | ||
19 | #include <linux/mtd/mtd.h> | ||
20 | #include <linux/mtd/nand.h> | ||
21 | #include <linux/mtd/partitions.h> | ||
18 | 22 | ||
19 | #include <asm/types.h> | 23 | #include <asm/types.h> |
20 | #include <asm/setup.h> | 24 | #include <asm/setup.h> |
@@ -24,6 +28,7 @@ | |||
24 | #include <asm/irq.h> | 28 | #include <asm/irq.h> |
25 | #include <asm/mach/arch.h> | 29 | #include <asm/mach/arch.h> |
26 | #include <asm/mach/flash.h> | 30 | #include <asm/mach/flash.h> |
31 | #include <asm/delay.h> | ||
27 | 32 | ||
28 | static struct flash_platform_data ixdp425_flash_data = { | 33 | static struct flash_platform_data ixdp425_flash_data = { |
29 | .map_name = "cfi_probe", | 34 | .map_name = "cfi_probe", |
@@ -44,6 +49,77 @@ static struct platform_device ixdp425_flash = { | |||
44 | .resource = &ixdp425_flash_resource, | 49 | .resource = &ixdp425_flash_resource, |
45 | }; | 50 | }; |
46 | 51 | ||
52 | #if defined(CONFIG_MTD_NAND_PLATFORM) || \ | ||
53 | defined(CONFIG_MTD_NAND_PLATFORM_MODULE) | ||
54 | |||
55 | #ifdef CONFIG_MTD_PARTITIONS | ||
56 | const char *part_probes[] = { "cmdlinepart", NULL }; | ||
57 | |||
58 | static struct mtd_partition ixdp425_partitions[] = { | ||
59 | { | ||
60 | .name = "ixp400 NAND FS 0", | ||
61 | .offset = 0, | ||
62 | .size = SZ_8M | ||
63 | }, { | ||
64 | .name = "ixp400 NAND FS 1", | ||
65 | .offset = MTDPART_OFS_APPEND, | ||
66 | .size = MTDPART_SIZ_FULL | ||
67 | }, | ||
68 | }; | ||
69 | #endif | ||
70 | |||
71 | static void | ||
72 | ixdp425_flash_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl) | ||
73 | { | ||
74 | struct nand_chip *this = mtd->priv; | ||
75 | int offset = (int)this->priv; | ||
76 | |||
77 | if (ctrl & NAND_CTRL_CHANGE) { | ||
78 | if (ctrl & NAND_NCE) { | ||
79 | gpio_line_set(IXDP425_NAND_NCE_PIN, IXP4XX_GPIO_LOW); | ||
80 | udelay(5); | ||
81 | } else | ||
82 | gpio_line_set(IXDP425_NAND_NCE_PIN, IXP4XX_GPIO_HIGH); | ||
83 | |||
84 | offset = (ctrl & NAND_CLE) ? IXDP425_NAND_CMD_BYTE : 0; | ||
85 | offset |= (ctrl & NAND_ALE) ? IXDP425_NAND_ADDR_BYTE : 0; | ||
86 | this->priv = (void *)offset; | ||
87 | } | ||
88 | |||
89 | if (cmd != NAND_CMD_NONE) | ||
90 | writeb(cmd, this->IO_ADDR_W + offset); | ||
91 | } | ||
92 | |||
93 | static struct platform_nand_data ixdp425_flash_nand_data = { | ||
94 | .chip = { | ||
95 | .chip_delay = 30, | ||
96 | .options = NAND_NO_AUTOINCR, | ||
97 | #ifdef CONFIG_MTD_PARTITIONS | ||
98 | .part_probe_types = part_probes, | ||
99 | .partitions = ixdp425_partitions, | ||
100 | .nr_partitions = ARRAY_SIZE(ixdp425_partitions), | ||
101 | #endif | ||
102 | }, | ||
103 | .ctrl = { | ||
104 | .cmd_ctrl = ixdp425_flash_nand_cmd_ctrl | ||
105 | } | ||
106 | }; | ||
107 | |||
108 | static struct resource ixdp425_flash_nand_resource = { | ||
109 | .flags = IORESOURCE_MEM, | ||
110 | }; | ||
111 | |||
112 | static struct platform_device ixdp425_flash_nand = { | ||
113 | .name = "gen_nand", | ||
114 | .id = -1, | ||
115 | .dev = { | ||
116 | .platform_data = &ixdp425_flash_nand_data, | ||
117 | }, | ||
118 | .num_resources = 1, | ||
119 | .resource = &ixdp425_flash_nand_resource, | ||
120 | }; | ||
121 | #endif /* CONFIG_MTD_NAND_PLATFORM */ | ||
122 | |||
47 | static struct ixp4xx_i2c_pins ixdp425_i2c_gpio_pins = { | 123 | static struct ixp4xx_i2c_pins ixdp425_i2c_gpio_pins = { |
48 | .sda_pin = IXDP425_SDA_PIN, | 124 | .sda_pin = IXDP425_SDA_PIN, |
49 | .scl_pin = IXDP425_SCL_PIN, | 125 | .scl_pin = IXDP425_SCL_PIN, |
@@ -104,6 +180,10 @@ static struct platform_device ixdp425_uart = { | |||
104 | static struct platform_device *ixdp425_devices[] __initdata = { | 180 | static struct platform_device *ixdp425_devices[] __initdata = { |
105 | &ixdp425_i2c_controller, | 181 | &ixdp425_i2c_controller, |
106 | &ixdp425_flash, | 182 | &ixdp425_flash, |
183 | #if defined(CONFIG_MTD_NAND_PLATFORM) || \ | ||
184 | defined(CONFIG_MTD_NAND_PLATFORM_MODULE) | ||
185 | &ixdp425_flash_nand, | ||
186 | #endif | ||
107 | &ixdp425_uart | 187 | &ixdp425_uart |
108 | }; | 188 | }; |
109 | 189 | ||
@@ -115,6 +195,22 @@ static void __init ixdp425_init(void) | |||
115 | ixdp425_flash_resource.end = | 195 | ixdp425_flash_resource.end = |
116 | IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1; | 196 | IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1; |
117 | 197 | ||
198 | #if defined(CONFIG_MTD_NAND_PLATFORM) || \ | ||
199 | defined(CONFIG_MTD_NAND_PLATFORM_MODULE) | ||
200 | ixdp425_flash_nand_resource.start = IXP4XX_EXP_BUS_BASE(3), | ||
201 | ixdp425_flash_nand_resource.end = IXP4XX_EXP_BUS_BASE(3) + 0x10 - 1; | ||
202 | |||
203 | gpio_line_config(IXDP425_NAND_NCE_PIN, IXP4XX_GPIO_OUT); | ||
204 | |||
205 | /* Configure expansion bus for NAND Flash */ | ||
206 | *IXP4XX_EXP_CS3 = IXP4XX_EXP_BUS_CS_EN | | ||
207 | IXP4XX_EXP_BUS_STROBE_T(1) | /* extend by 1 clock */ | ||
208 | IXP4XX_EXP_BUS_CYCLES(0) | /* Intel cycles */ | ||
209 | IXP4XX_EXP_BUS_SIZE(0) | /* 512bytes addr space*/ | ||
210 | IXP4XX_EXP_BUS_WR_EN | | ||
211 | IXP4XX_EXP_BUS_BYTE_EN; /* 8 bit data bus */ | ||
212 | #endif | ||
213 | |||
118 | if (cpu_is_ixp43x()) { | 214 | if (cpu_is_ixp43x()) { |
119 | ixdp425_uart.num_resources = 1; | 215 | ixdp425_uart.num_resources = 1; |
120 | ixdp425_uart_data[1].flags = 0; | 216 | ixdp425_uart_data[1].flags = 0; |