ARM: mach-shmobile: mackerel: Add LCDC support
[deliverable/linux.git] / arch / arm / mach-shmobile / board-mackerel.c
CommitLineData
920adc75
KM
1/*
2 * mackerel board support
3 *
4 * Copyright (C) 2010 Renesas Solutions Corp.
5 * Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
6 *
7 * based on ap4evb
8 * Copyright (C) 2010 Magnus Damm
9 * Copyright (C) 2008 Yoshihiro Shimoda
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; version 2 of the License.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 */
24#include <linux/kernel.h>
25#include <linux/init.h>
26#include <linux/interrupt.h>
27#include <linux/irq.h>
28#include <linux/platform_device.h>
29#include <linux/gpio.h>
30#include <linux/input.h>
31#include <linux/io.h>
32#include <linux/mtd/mtd.h>
33#include <linux/mtd/partitions.h>
34#include <linux/mtd/physmap.h>
2264c151 35#include <linux/smsc911x.h>
920adc75 36
11fee467
KM
37#include <video/sh_mobile_lcdc.h>
38
920adc75
KM
39#include <mach/common.h>
40#include <mach/sh7372.h>
41
42#include <asm/mach/arch.h>
43#include <asm/mach/time.h>
44#include <asm/mach/map.h>
45#include <asm/mach-types.h>
46
47/*
48 * Address Interface BusWidth note
49 * ------------------------------------------------------------------
50 * 0x0000_0000 NOR Flash ROM (MCP) 16bit SW7 : bit1 = ON
51 * 0x0800_0000 user area -
52 * 0x1000_0000 NOR Flash ROM (MCP) 16bit SW7 : bit1 = OFF
53 * 0x1400_0000 Ether (LAN9220) 16bit
54 * 0x1600_0000 user area - cannot use with NAND
55 * 0x1800_0000 user area -
56 * 0x1A00_0000 -
57 * 0x4000_0000 LPDDR2-SDRAM (POP) 32bit
58 */
59
60/* MTD */
61static struct mtd_partition nor_flash_partitions[] = {
62 {
63 .name = "loader",
64 .offset = 0x00000000,
65 .size = 512 * 1024,
66 .mask_flags = MTD_WRITEABLE,
67 },
68 {
69 .name = "bootenv",
70 .offset = MTDPART_OFS_APPEND,
71 .size = 512 * 1024,
72 .mask_flags = MTD_WRITEABLE,
73 },
74 {
75 .name = "kernel_ro",
76 .offset = MTDPART_OFS_APPEND,
77 .size = 8 * 1024 * 1024,
78 .mask_flags = MTD_WRITEABLE,
79 },
80 {
81 .name = "kernel",
82 .offset = MTDPART_OFS_APPEND,
83 .size = 8 * 1024 * 1024,
84 },
85 {
86 .name = "data",
87 .offset = MTDPART_OFS_APPEND,
88 .size = MTDPART_SIZ_FULL,
89 },
90};
91
92static struct physmap_flash_data nor_flash_data = {
93 .width = 2,
94 .parts = nor_flash_partitions,
95 .nr_parts = ARRAY_SIZE(nor_flash_partitions),
96};
97
98static struct resource nor_flash_resources[] = {
99 [0] = {
100 .start = 0x00000000,
101 .end = 0x08000000 - 1,
102 .flags = IORESOURCE_MEM,
103 }
104};
105
106static struct platform_device nor_flash_device = {
107 .name = "physmap-flash",
108 .dev = {
109 .platform_data = &nor_flash_data,
110 },
111 .num_resources = ARRAY_SIZE(nor_flash_resources),
112 .resource = nor_flash_resources,
113};
114
2264c151
KM
115/* SMSC */
116static struct resource smc911x_resources[] = {
117 {
118 .start = 0x14000000,
119 .end = 0x16000000 - 1,
120 .flags = IORESOURCE_MEM,
121 }, {
122 .start = evt2irq(0x02c0) /* IRQ6A */,
123 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
124 },
125};
126
127static struct smsc911x_platform_config smsc911x_info = {
128 .flags = SMSC911X_USE_16BIT | SMSC911X_SAVE_MAC_ADDRESS,
129 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
130 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
131};
132
133static struct platform_device smc911x_device = {
134 .name = "smsc911x",
135 .id = -1,
136 .num_resources = ARRAY_SIZE(smc911x_resources),
137 .resource = smc911x_resources,
138 .dev = {
139 .platform_data = &smsc911x_info,
140 },
141};
142
11fee467
KM
143/* LCDC */
144static struct fb_videomode mackerel_lcdc_modes[] = {
145 {
146 .name = "WVGA Panel",
147 .xres = 800,
148 .yres = 480,
149 .left_margin = 220,
150 .right_margin = 110,
151 .hsync_len = 70,
152 .upper_margin = 20,
153 .lower_margin = 5,
154 .vsync_len = 5,
155 .sync = 0,
156 },
157};
158
159static struct sh_mobile_lcdc_info lcdc_info = {
160 .clock_source = LCDC_CLK_BUS,
161 .ch[0] = {
162 .chan = LCDC_CHAN_MAINLCD,
163 .bpp = 16,
164 .lcd_cfg = mackerel_lcdc_modes,
165 .num_cfg = ARRAY_SIZE(mackerel_lcdc_modes),
166 .interface_type = RGB24,
167 .clock_divider = 2,
168 .flags = 0,
169 .lcd_size_cfg.width = 152,
170 .lcd_size_cfg.height = 91,
171 }
172};
173
174static struct resource lcdc_resources[] = {
175 [0] = {
176 .name = "LCDC",
177 .start = 0xfe940000,
178 .end = 0xfe943fff,
179 .flags = IORESOURCE_MEM,
180 },
181 [1] = {
182 .start = intcs_evt2irq(0x580),
183 .flags = IORESOURCE_IRQ,
184 },
185};
186
187static struct platform_device lcdc_device = {
188 .name = "sh_mobile_lcdc_fb",
189 .num_resources = ARRAY_SIZE(lcdc_resources),
190 .resource = lcdc_resources,
191 .dev = {
192 .platform_data = &lcdc_info,
193 .coherent_dma_mask = ~0,
194 },
195};
196
920adc75
KM
197static struct platform_device *mackerel_devices[] __initdata = {
198 &nor_flash_device,
2264c151 199 &smc911x_device,
11fee467 200 &lcdc_device,
920adc75
KM
201};
202
203static struct map_desc mackerel_io_desc[] __initdata = {
204 /* create a 1:1 entity map for 0xe6xxxxxx
205 * used by CPGA, INTC and PFC.
206 */
207 {
208 .virtual = 0xe6000000,
209 .pfn = __phys_to_pfn(0xe6000000),
210 .length = 256 << 20,
211 .type = MT_DEVICE_NONSHARED
212 },
213};
214
215static void __init mackerel_map_io(void)
216{
217 iotable_init(mackerel_io_desc, ARRAY_SIZE(mackerel_io_desc));
218
219 /* setup early devices and console here as well */
220 sh7372_add_early_devices();
221 shmobile_setup_console();
222}
223
224static void __init mackerel_init(void)
225{
226 sh7372_pinmux_init();
227
228 /* enable SCIFA0 */
229 gpio_request(GPIO_FN_SCIFA0_TXD, NULL);
230 gpio_request(GPIO_FN_SCIFA0_RXD, NULL);
231
2264c151
KM
232 /* enable SMSC911X */
233 gpio_request(GPIO_FN_CS5A, NULL);
234 gpio_request(GPIO_FN_IRQ6_39, NULL);
235
11fee467
KM
236 /* LCDC */
237 gpio_request(GPIO_FN_LCDD17, NULL);
238 gpio_request(GPIO_FN_LCDD16, NULL);
239 gpio_request(GPIO_FN_LCDD15, NULL);
240 gpio_request(GPIO_FN_LCDD14, NULL);
241 gpio_request(GPIO_FN_LCDD13, NULL);
242 gpio_request(GPIO_FN_LCDD12, NULL);
243 gpio_request(GPIO_FN_LCDD11, NULL);
244 gpio_request(GPIO_FN_LCDD10, NULL);
245 gpio_request(GPIO_FN_LCDD9, NULL);
246 gpio_request(GPIO_FN_LCDD8, NULL);
247 gpio_request(GPIO_FN_LCDD7, NULL);
248 gpio_request(GPIO_FN_LCDD6, NULL);
249 gpio_request(GPIO_FN_LCDD5, NULL);
250 gpio_request(GPIO_FN_LCDD4, NULL);
251 gpio_request(GPIO_FN_LCDD3, NULL);
252 gpio_request(GPIO_FN_LCDD2, NULL);
253 gpio_request(GPIO_FN_LCDD1, NULL);
254 gpio_request(GPIO_FN_LCDD0, NULL);
255 gpio_request(GPIO_FN_LCDDISP, NULL);
256 gpio_request(GPIO_FN_LCDDCK, NULL);
257
258 gpio_request(GPIO_PORT31, NULL); /* backlight */
259 gpio_direction_output(GPIO_PORT31, 1);
260
261 gpio_request(GPIO_PORT151, NULL); /* LCDDON */
262 gpio_direction_output(GPIO_PORT151, 1);
263
264
920adc75
KM
265 sh7372_add_standard_devices();
266
267 platform_add_devices(mackerel_devices, ARRAY_SIZE(mackerel_devices));
268}
269
270static void __init mackerel_timer_init(void)
271{
272 sh7372_clock_init();
273 shmobile_timer.init();
274}
275
276static struct sys_timer mackerel_timer = {
277 .init = mackerel_timer_init,
278};
279
280MACHINE_START(MACKEREL, "mackerel")
281 .map_io = mackerel_map_io,
282 .init_irq = sh7372_init_irq,
283 .init_machine = mackerel_init,
284 .timer = &mackerel_timer,
285MACHINE_END
This page took 0.035001 seconds and 5 git commands to generate.