diff options
author | Paul Mundt <lethal@linux-sh.org> | 2009-08-15 00:00:02 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2009-08-15 00:00:02 -0400 |
commit | 4b6b987969b076298485697bfb0d0e35502642a3 (patch) | |
tree | a8f5ebd6a0b9efbe30272012d759669b0c5ddc13 /arch/sh/boards/mach-kfr2r09/setup.c | |
parent | df47cd096c8f54a5242e3a2ffb4525c804567eda (diff) | |
parent | 60e0a4c7adc700f2d2929cdb2d0055e519a3eb3d (diff) |
Merge branch 'master' into sh/hwblk
Diffstat (limited to 'arch/sh/boards/mach-kfr2r09/setup.c')
-rw-r--r-- | arch/sh/boards/mach-kfr2r09/setup.c | 117 |
1 files changed, 117 insertions, 0 deletions
diff --git a/arch/sh/boards/mach-kfr2r09/setup.c b/arch/sh/boards/mach-kfr2r09/setup.c index 0e9b39034df3..c96533794c26 100644 --- a/arch/sh/boards/mach-kfr2r09/setup.c +++ b/arch/sh/boards/mach-kfr2r09/setup.c | |||
@@ -11,15 +11,18 @@ | |||
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/mtd/physmap.h> |
14 | #include <linux/mtd/onenand.h> | ||
14 | #include <linux/delay.h> | 15 | #include <linux/delay.h> |
15 | #include <linux/clk.h> | 16 | #include <linux/clk.h> |
16 | #include <linux/gpio.h> | 17 | #include <linux/gpio.h> |
17 | #include <linux/input.h> | 18 | #include <linux/input.h> |
19 | #include <video/sh_mobile_lcdc.h> | ||
18 | #include <asm/clock.h> | 20 | #include <asm/clock.h> |
19 | #include <asm/machvec.h> | 21 | #include <asm/machvec.h> |
20 | #include <asm/io.h> | 22 | #include <asm/io.h> |
21 | #include <asm/sh_keysc.h> | 23 | #include <asm/sh_keysc.h> |
22 | #include <cpu/sh7724.h> | 24 | #include <cpu/sh7724.h> |
25 | #include <mach/kfr2r09.h> | ||
23 | 26 | ||
24 | static struct mtd_partition kfr2r09_nor_flash_partitions[] = | 27 | static struct mtd_partition kfr2r09_nor_flash_partitions[] = |
25 | { | 28 | { |
@@ -60,6 +63,21 @@ static struct platform_device kfr2r09_nor_flash_device = { | |||
60 | }, | 63 | }, |
61 | }; | 64 | }; |
62 | 65 | ||
66 | static struct resource kfr2r09_nand_flash_resources[] = { | ||
67 | [0] = { | ||
68 | .name = "NAND Flash", | ||
69 | .start = 0x10000000, | ||
70 | .end = 0x1001ffff, | ||
71 | .flags = IORESOURCE_MEM, | ||
72 | } | ||
73 | }; | ||
74 | |||
75 | static struct platform_device kfr2r09_nand_flash_device = { | ||
76 | .name = "onenand-flash", | ||
77 | .resource = kfr2r09_nand_flash_resources, | ||
78 | .num_resources = ARRAY_SIZE(kfr2r09_nand_flash_resources), | ||
79 | }; | ||
80 | |||
63 | static struct sh_keysc_info kfr2r09_sh_keysc_info = { | 81 | static struct sh_keysc_info kfr2r09_sh_keysc_info = { |
64 | .mode = SH_KEYSC_MODE_1, /* KEYOUT0->4, KEYIN0->4 */ | 82 | .mode = SH_KEYSC_MODE_1, /* KEYOUT0->4, KEYIN0->4 */ |
65 | .scan_timing = 3, | 83 | .scan_timing = 3, |
@@ -100,13 +118,77 @@ static struct platform_device kfr2r09_sh_keysc_device = { | |||
100 | }, | 118 | }, |
101 | }; | 119 | }; |
102 | 120 | ||
121 | static struct sh_mobile_lcdc_info kfr2r09_sh_lcdc_info = { | ||
122 | .clock_source = LCDC_CLK_BUS, | ||
123 | .ch[0] = { | ||
124 | .chan = LCDC_CHAN_MAINLCD, | ||
125 | .bpp = 16, | ||
126 | .interface_type = SYS18, | ||
127 | .clock_divider = 6, | ||
128 | .flags = LCDC_FLAGS_DWPOL, | ||
129 | .lcd_cfg = { | ||
130 | .name = "TX07D34VM0AAA", | ||
131 | .xres = 240, | ||
132 | .yres = 400, | ||
133 | .left_margin = 0, | ||
134 | .right_margin = 16, | ||
135 | .hsync_len = 8, | ||
136 | .upper_margin = 0, | ||
137 | .lower_margin = 1, | ||
138 | .vsync_len = 1, | ||
139 | .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, | ||
140 | }, | ||
141 | .lcd_size_cfg = { | ||
142 | .width = 35, | ||
143 | .height = 58, | ||
144 | }, | ||
145 | .board_cfg = { | ||
146 | .setup_sys = kfr2r09_lcd_setup, | ||
147 | .display_on = kfr2r09_lcd_on, | ||
148 | .display_off = kfr2r09_lcd_off, | ||
149 | }, | ||
150 | .sys_bus_cfg = { | ||
151 | .ldmt2r = 0x07010904, | ||
152 | .ldmt3r = 0x14012914, | ||
153 | /* set 1s delay to encourage fsync() */ | ||
154 | .deferred_io_msec = 1000, | ||
155 | }, | ||
156 | } | ||
157 | }; | ||
158 | |||
159 | static struct resource kfr2r09_sh_lcdc_resources[] = { | ||
160 | [0] = { | ||
161 | .name = "LCDC", | ||
162 | .start = 0xfe940000, /* P4-only space */ | ||
163 | .end = 0xfe941fff, | ||
164 | .flags = IORESOURCE_MEM, | ||
165 | }, | ||
166 | [1] = { | ||
167 | .start = 106, | ||
168 | .flags = IORESOURCE_IRQ, | ||
169 | }, | ||
170 | }; | ||
171 | |||
172 | static struct platform_device kfr2r09_sh_lcdc_device = { | ||
173 | .name = "sh_mobile_lcdc_fb", | ||
174 | .num_resources = ARRAY_SIZE(kfr2r09_sh_lcdc_resources), | ||
175 | .resource = kfr2r09_sh_lcdc_resources, | ||
176 | .dev = { | ||
177 | .platform_data = &kfr2r09_sh_lcdc_info, | ||
178 | }, | ||
179 | }; | ||
180 | |||
103 | static struct platform_device *kfr2r09_devices[] __initdata = { | 181 | static struct platform_device *kfr2r09_devices[] __initdata = { |
104 | &kfr2r09_nor_flash_device, | 182 | &kfr2r09_nor_flash_device, |
183 | &kfr2r09_nand_flash_device, | ||
105 | &kfr2r09_sh_keysc_device, | 184 | &kfr2r09_sh_keysc_device, |
185 | &kfr2r09_sh_lcdc_device, | ||
106 | }; | 186 | }; |
107 | 187 | ||
108 | #define BSC_CS0BCR 0xfec10004 | 188 | #define BSC_CS0BCR 0xfec10004 |
109 | #define BSC_CS0WCR 0xfec10024 | 189 | #define BSC_CS0WCR 0xfec10024 |
190 | #define BSC_CS4BCR 0xfec10010 | ||
191 | #define BSC_CS4WCR 0xfec10030 | ||
110 | 192 | ||
111 | static int __init kfr2r09_devices_setup(void) | 193 | static int __init kfr2r09_devices_setup(void) |
112 | { | 194 | { |
@@ -118,6 +200,10 @@ static int __init kfr2r09_devices_setup(void) | |||
118 | ctrl_outl(0x36db0400, BSC_CS0BCR); | 200 | ctrl_outl(0x36db0400, BSC_CS0BCR); |
119 | ctrl_outl(0x00000500, BSC_CS0WCR); | 201 | ctrl_outl(0x00000500, BSC_CS0WCR); |
120 | 202 | ||
203 | /* setup NAND flash at CS4 */ | ||
204 | ctrl_outl(0x36db0400, BSC_CS4BCR); | ||
205 | ctrl_outl(0x00000500, BSC_CS4WCR); | ||
206 | |||
121 | /* setup KEYSC pins */ | 207 | /* setup KEYSC pins */ |
122 | gpio_request(GPIO_FN_KEYOUT0, NULL); | 208 | gpio_request(GPIO_FN_KEYOUT0, NULL); |
123 | gpio_request(GPIO_FN_KEYOUT1, NULL); | 209 | gpio_request(GPIO_FN_KEYOUT1, NULL); |
@@ -131,6 +217,37 @@ static int __init kfr2r09_devices_setup(void) | |||
131 | gpio_request(GPIO_FN_KEYIN4, NULL); | 217 | gpio_request(GPIO_FN_KEYIN4, NULL); |
132 | gpio_request(GPIO_FN_KEYOUT5_IN5, NULL); | 218 | gpio_request(GPIO_FN_KEYOUT5_IN5, NULL); |
133 | 219 | ||
220 | /* setup LCDC pins for SYS panel */ | ||
221 | gpio_request(GPIO_FN_LCDD17, NULL); | ||
222 | gpio_request(GPIO_FN_LCDD16, NULL); | ||
223 | gpio_request(GPIO_FN_LCDD15, NULL); | ||
224 | gpio_request(GPIO_FN_LCDD14, NULL); | ||
225 | gpio_request(GPIO_FN_LCDD13, NULL); | ||
226 | gpio_request(GPIO_FN_LCDD12, NULL); | ||
227 | gpio_request(GPIO_FN_LCDD11, NULL); | ||
228 | gpio_request(GPIO_FN_LCDD10, NULL); | ||
229 | gpio_request(GPIO_FN_LCDD9, NULL); | ||
230 | gpio_request(GPIO_FN_LCDD8, NULL); | ||
231 | gpio_request(GPIO_FN_LCDD7, NULL); | ||
232 | gpio_request(GPIO_FN_LCDD6, NULL); | ||
233 | gpio_request(GPIO_FN_LCDD5, NULL); | ||
234 | gpio_request(GPIO_FN_LCDD4, NULL); | ||
235 | gpio_request(GPIO_FN_LCDD3, NULL); | ||
236 | gpio_request(GPIO_FN_LCDD2, NULL); | ||
237 | gpio_request(GPIO_FN_LCDD1, NULL); | ||
238 | gpio_request(GPIO_FN_LCDD0, NULL); | ||
239 | gpio_request(GPIO_FN_LCDRS, NULL); /* LCD_RS */ | ||
240 | gpio_request(GPIO_FN_LCDCS, NULL); /* LCD_CS/ */ | ||
241 | gpio_request(GPIO_FN_LCDRD, NULL); /* LCD_RD/ */ | ||
242 | gpio_request(GPIO_FN_LCDWR, NULL); /* LCD_WR/ */ | ||
243 | gpio_request(GPIO_FN_LCDVSYN, NULL); /* LCD_VSYNC */ | ||
244 | gpio_request(GPIO_PTE4, NULL); /* LCD_RST/ */ | ||
245 | gpio_direction_output(GPIO_PTE4, 1); | ||
246 | gpio_request(GPIO_PTF4, NULL); /* PROTECT/ */ | ||
247 | gpio_direction_output(GPIO_PTF4, 1); | ||
248 | gpio_request(GPIO_PTU0, NULL); /* LEDSTDBY/ */ | ||
249 | gpio_direction_output(GPIO_PTU0, 1); | ||
250 | |||
134 | return platform_add_devices(kfr2r09_devices, | 251 | return platform_add_devices(kfr2r09_devices, |
135 | ARRAY_SIZE(kfr2r09_devices)); | 252 | ARRAY_SIZE(kfr2r09_devices)); |
136 | } | 253 | } |