diff options
author | Magnus Damm <damm@igel.co.jp> | 2009-07-22 12:22:28 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2009-07-23 00:15:20 -0400 |
commit | a366aa64f3a51ca3deebe74447f929a5614d9b90 (patch) | |
tree | fa4763f2151152a3a497213d6b5a7521ec51b082 | |
parent | e7d165146a7de5ceb4f68e188b2679f003744f54 (diff) |
sh: kfr2r09 board support - NOR flash
This patch adds NOR flash support to the kfr2r09 board.
NOR flash support is added by describing the NOR flash
chip hooked up to CS0 as platform device data for the
physmap-flash MTD driver.
Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
-rw-r--r-- | arch/sh/boards/mach-kfr2r09/setup.c | 54 |
1 files changed, 53 insertions, 1 deletions
diff --git a/arch/sh/boards/mach-kfr2r09/setup.c b/arch/sh/boards/mach-kfr2r09/setup.c index 224318abc9e6..382bf1884300 100644 --- a/arch/sh/boards/mach-kfr2r09/setup.c +++ b/arch/sh/boards/mach-kfr2r09/setup.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/init.h> | 10 | #include <linux/init.h> |
11 | #include <linux/platform_device.h> | 11 | #include <linux/platform_device.h> |
12 | #include <linux/interrupt.h> | 12 | #include <linux/interrupt.h> |
13 | #include <linux/mtd/physmap.h> | ||
13 | #include <linux/delay.h> | 14 | #include <linux/delay.h> |
14 | #include <linux/clk.h> | 15 | #include <linux/clk.h> |
15 | #include <linux/gpio.h> | 16 | #include <linux/gpio.h> |
@@ -18,13 +19,64 @@ | |||
18 | #include <asm/io.h> | 19 | #include <asm/io.h> |
19 | #include <cpu/sh7724.h> | 20 | #include <cpu/sh7724.h> |
20 | 21 | ||
22 | static struct mtd_partition kfr2r09_nor_flash_partitions[] = | ||
23 | { | ||
24 | { | ||
25 | .name = "boot", | ||
26 | .offset = 0, | ||
27 | .size = (4 * 1024 * 1024), | ||
28 | .mask_flags = MTD_WRITEABLE, /* Read-only */ | ||
29 | }, | ||
30 | { | ||
31 | .name = "other", | ||
32 | .offset = MTDPART_OFS_APPEND, | ||
33 | .size = MTDPART_SIZ_FULL, | ||
34 | }, | ||
35 | }; | ||
36 | |||
37 | static struct physmap_flash_data kfr2r09_nor_flash_data = { | ||
38 | .width = 2, | ||
39 | .parts = kfr2r09_nor_flash_partitions, | ||
40 | .nr_parts = ARRAY_SIZE(kfr2r09_nor_flash_partitions), | ||
41 | }; | ||
42 | |||
43 | static struct resource kfr2r09_nor_flash_resources[] = { | ||
44 | [0] = { | ||
45 | .name = "NOR Flash", | ||
46 | .start = 0x00000000, | ||
47 | .end = 0x03ffffff, | ||
48 | .flags = IORESOURCE_MEM, | ||
49 | } | ||
50 | }; | ||
51 | |||
52 | static struct platform_device kfr2r09_nor_flash_device = { | ||
53 | .name = "physmap-flash", | ||
54 | .resource = kfr2r09_nor_flash_resources, | ||
55 | .num_resources = ARRAY_SIZE(kfr2r09_nor_flash_resources), | ||
56 | .dev = { | ||
57 | .platform_data = &kfr2r09_nor_flash_data, | ||
58 | }, | ||
59 | }; | ||
60 | |||
61 | static struct platform_device *kfr2r09_devices[] __initdata = { | ||
62 | &kfr2r09_nor_flash_device, | ||
63 | }; | ||
64 | |||
65 | #define BSC_CS0BCR 0xfec10004 | ||
66 | #define BSC_CS0WCR 0xfec10024 | ||
67 | |||
21 | static int __init kfr2r09_devices_setup(void) | 68 | static int __init kfr2r09_devices_setup(void) |
22 | { | 69 | { |
23 | /* enable SCIF1 serial port for YC401 console support */ | 70 | /* enable SCIF1 serial port for YC401 console support */ |
24 | gpio_request(GPIO_FN_SCIF1_RXD, NULL); | 71 | gpio_request(GPIO_FN_SCIF1_RXD, NULL); |
25 | gpio_request(GPIO_FN_SCIF1_TXD, NULL); | 72 | gpio_request(GPIO_FN_SCIF1_TXD, NULL); |
26 | 73 | ||
27 | return 0; | 74 | /* setup NOR flash at CS0 */ |
75 | ctrl_outl(0x36db0400, BSC_CS0BCR); | ||
76 | ctrl_outl(0x00000500, BSC_CS0WCR); | ||
77 | |||
78 | return platform_add_devices(kfr2r09_devices, | ||
79 | ARRAY_SIZE(kfr2r09_devices)); | ||
28 | } | 80 | } |
29 | device_initcall(kfr2r09_devices_setup); | 81 | device_initcall(kfr2r09_devices_setup); |
30 | 82 | ||