aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/boards
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2009-07-23 05:43:48 -0400
committerPaul Mundt <lethal@linux-sh.org>2009-07-23 05:43:48 -0400
commita3beddd0aa267986de7b13b6d9cd0e1869fcf1fc (patch)
treebfdc42183f5aac21f605a30a4a511298ab91e3c5 /arch/sh/boards
parent955c9863bb5855a994751843e7066017edc00410 (diff)
parent5bdef865eb358b6f3760e25e591ae115e9eeddef (diff)
Merge branch 'sh/kfr2r09'
Diffstat (limited to 'arch/sh/boards')
-rw-r--r--arch/sh/boards/Kconfig7
-rw-r--r--arch/sh/boards/mach-kfr2r09/Makefile1
-rw-r--r--arch/sh/boards/mach-kfr2r09/setup.c153
3 files changed, 161 insertions, 0 deletions
diff --git a/arch/sh/boards/Kconfig b/arch/sh/boards/Kconfig
index 2b1af0eefa6a..db04c85971ad 100644
--- a/arch/sh/boards/Kconfig
+++ b/arch/sh/boards/Kconfig
@@ -193,6 +193,13 @@ config SH_AP325RXA
193 Renesas "AP-325RXA" support. 193 Renesas "AP-325RXA" support.
194 Compatible with ALGO SYSTEM CO.,LTD. "AP-320A" 194 Compatible with ALGO SYSTEM CO.,LTD. "AP-320A"
195 195
196config SH_KFR2R09
197 bool "KFR2R09"
198 depends on CPU_SUBTYPE_SH7724
199 select ARCH_REQUIRE_GPIOLIB
200 help
201 "Kit For R2R for 2009" support.
202
196config SH_SH7763RDP 203config SH_SH7763RDP
197 bool "SH7763RDP" 204 bool "SH7763RDP"
198 depends on CPU_SUBTYPE_SH7763 205 depends on CPU_SUBTYPE_SH7763
diff --git a/arch/sh/boards/mach-kfr2r09/Makefile b/arch/sh/boards/mach-kfr2r09/Makefile
new file mode 100644
index 000000000000..77037567633b
--- /dev/null
+++ b/arch/sh/boards/mach-kfr2r09/Makefile
@@ -0,0 +1 @@
obj-y := setup.o
diff --git a/arch/sh/boards/mach-kfr2r09/setup.c b/arch/sh/boards/mach-kfr2r09/setup.c
new file mode 100644
index 000000000000..bf5f8f8d3b5f
--- /dev/null
+++ b/arch/sh/boards/mach-kfr2r09/setup.c
@@ -0,0 +1,153 @@
1/*
2 * KFR2R09 board support code
3 *
4 * Copyright (C) 2009 Magnus Damm
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#include <linux/init.h>
11#include <linux/platform_device.h>
12#include <linux/interrupt.h>
13#include <linux/mtd/physmap.h>
14#include <linux/delay.h>
15#include <linux/clk.h>
16#include <linux/gpio.h>
17#include <linux/input.h>
18#include <asm/clock.h>
19#include <asm/machvec.h>
20#include <asm/io.h>
21#include <asm/sh_keysc.h>
22#include <cpu/sh7724.h>
23
24static struct mtd_partition kfr2r09_nor_flash_partitions[] =
25{
26 {
27 .name = "boot",
28 .offset = 0,
29 .size = (4 * 1024 * 1024),
30 .mask_flags = MTD_WRITEABLE, /* Read-only */
31 },
32 {
33 .name = "other",
34 .offset = MTDPART_OFS_APPEND,
35 .size = MTDPART_SIZ_FULL,
36 },
37};
38
39static struct physmap_flash_data kfr2r09_nor_flash_data = {
40 .width = 2,
41 .parts = kfr2r09_nor_flash_partitions,
42 .nr_parts = ARRAY_SIZE(kfr2r09_nor_flash_partitions),
43};
44
45static struct resource kfr2r09_nor_flash_resources[] = {
46 [0] = {
47 .name = "NOR Flash",
48 .start = 0x00000000,
49 .end = 0x03ffffff,
50 .flags = IORESOURCE_MEM,
51 }
52};
53
54static struct platform_device kfr2r09_nor_flash_device = {
55 .name = "physmap-flash",
56 .resource = kfr2r09_nor_flash_resources,
57 .num_resources = ARRAY_SIZE(kfr2r09_nor_flash_resources),
58 .dev = {
59 .platform_data = &kfr2r09_nor_flash_data,
60 },
61};
62
63static struct sh_keysc_info kfr2r09_sh_keysc_info = {
64 .mode = SH_KEYSC_MODE_1, /* KEYOUT0->4, KEYIN0->4 */
65 .scan_timing = 3,
66 .delay = 10,
67 .keycodes = {
68 KEY_PHONE, KEY_CLEAR, KEY_MAIL, KEY_WWW, KEY_ENTER,
69 KEY_1, KEY_2, KEY_3, 0, KEY_UP,
70 KEY_4, KEY_5, KEY_6, 0, KEY_LEFT,
71 KEY_7, KEY_8, KEY_9, KEY_PROG1, KEY_RIGHT,
72 KEY_S, KEY_0, KEY_P, KEY_PROG2, KEY_DOWN,
73 0, 0, 0, 0, 0
74 },
75};
76
77static struct resource kfr2r09_sh_keysc_resources[] = {
78 [0] = {
79 .name = "KEYSC",
80 .start = 0x044b0000,
81 .end = 0x044b000f,
82 .flags = IORESOURCE_MEM,
83 },
84 [1] = {
85 .start = 79,
86 .flags = IORESOURCE_IRQ,
87 },
88};
89
90static struct platform_device kfr2r09_sh_keysc_device = {
91 .name = "sh_keysc",
92 .id = 0, /* "keysc0" clock */
93 .num_resources = ARRAY_SIZE(kfr2r09_sh_keysc_resources),
94 .resource = kfr2r09_sh_keysc_resources,
95 .dev = {
96 .platform_data = &kfr2r09_sh_keysc_info,
97 },
98};
99
100static struct platform_device *kfr2r09_devices[] __initdata = {
101 &kfr2r09_nor_flash_device,
102 &kfr2r09_sh_keysc_device,
103};
104
105#define BSC_CS0BCR 0xfec10004
106#define BSC_CS0WCR 0xfec10024
107
108static int __init kfr2r09_devices_setup(void)
109{
110 /* enable SCIF1 serial port for YC401 console support */
111 gpio_request(GPIO_FN_SCIF1_RXD, NULL);
112 gpio_request(GPIO_FN_SCIF1_TXD, NULL);
113
114 /* setup NOR flash at CS0 */
115 ctrl_outl(0x36db0400, BSC_CS0BCR);
116 ctrl_outl(0x00000500, BSC_CS0WCR);
117
118 /* setup KEYSC pins */
119 gpio_request(GPIO_FN_KEYOUT0, NULL);
120 gpio_request(GPIO_FN_KEYOUT1, NULL);
121 gpio_request(GPIO_FN_KEYOUT2, NULL);
122 gpio_request(GPIO_FN_KEYOUT3, NULL);
123 gpio_request(GPIO_FN_KEYOUT4_IN6, NULL);
124 gpio_request(GPIO_FN_KEYIN0, NULL);
125 gpio_request(GPIO_FN_KEYIN1, NULL);
126 gpio_request(GPIO_FN_KEYIN2, NULL);
127 gpio_request(GPIO_FN_KEYIN3, NULL);
128 gpio_request(GPIO_FN_KEYIN4, NULL);
129 gpio_request(GPIO_FN_KEYOUT5_IN5, NULL);
130
131 return platform_add_devices(kfr2r09_devices,
132 ARRAY_SIZE(kfr2r09_devices));
133}
134device_initcall(kfr2r09_devices_setup);
135
136/* Return the board specific boot mode pin configuration */
137static int kfr2r09_mode_pins(void)
138{
139 /* MD0=1, MD1=1, MD2=0: Clock Mode 3
140 * MD3=0: 16-bit Area0 Bus Width
141 * MD5=1: Little Endian
142 * MD8=1: Test Mode Disabled
143 */
144 return MODE_PIN0 | MODE_PIN1 | MODE_PIN5 | MODE_PIN8;
145}
146
147/*
148 * The Machine Vector
149 */
150static struct sh_machine_vector mv_kfr2r09 __initmv = {
151 .mv_name = "kfr2r09",
152 .mv_mode_pins = kfr2r09_mode_pins,
153};