diff options
Diffstat (limited to 'arch/arm/mach-shmobile/board-ag5evm.c')
-rw-r--r-- | arch/arm/mach-shmobile/board-ag5evm.c | 181 |
1 files changed, 179 insertions, 2 deletions
diff --git a/arch/arm/mach-shmobile/board-ag5evm.c b/arch/arm/mach-shmobile/board-ag5evm.c index 343362d0207..3e6f0aab460 100644 --- a/arch/arm/mach-shmobile/board-ag5evm.c +++ b/arch/arm/mach-shmobile/board-ag5evm.c | |||
@@ -34,9 +34,10 @@ | |||
34 | #include <linux/input/sh_keysc.h> | 34 | #include <linux/input/sh_keysc.h> |
35 | #include <linux/mmc/host.h> | 35 | #include <linux/mmc/host.h> |
36 | #include <linux/mmc/sh_mmcif.h> | 36 | #include <linux/mmc/sh_mmcif.h> |
37 | 37 | #include <linux/sh_clk.h> | |
38 | #include <video/sh_mobile_lcdc.h> | ||
39 | #include <video/sh_mipi_dsi.h> | ||
38 | #include <sound/sh_fsi.h> | 40 | #include <sound/sh_fsi.h> |
39 | |||
40 | #include <mach/hardware.h> | 41 | #include <mach/hardware.h> |
41 | #include <mach/sh73a0.h> | 42 | #include <mach/sh73a0.h> |
42 | #include <mach/common.h> | 43 | #include <mach/common.h> |
@@ -173,11 +174,165 @@ static struct platform_device mmc_device = { | |||
173 | .resource = sh_mmcif_resources, | 174 | .resource = sh_mmcif_resources, |
174 | }; | 175 | }; |
175 | 176 | ||
177 | /* IrDA */ | ||
178 | static struct resource irda_resources[] = { | ||
179 | [0] = { | ||
180 | .start = 0xE6D00000, | ||
181 | .end = 0xE6D01FD4 - 1, | ||
182 | .flags = IORESOURCE_MEM, | ||
183 | }, | ||
184 | [1] = { | ||
185 | .start = gic_spi(95), | ||
186 | .flags = IORESOURCE_IRQ, | ||
187 | }, | ||
188 | }; | ||
189 | |||
190 | static struct platform_device irda_device = { | ||
191 | .name = "sh_irda", | ||
192 | .id = 0, | ||
193 | .resource = irda_resources, | ||
194 | .num_resources = ARRAY_SIZE(irda_resources), | ||
195 | }; | ||
196 | |||
197 | static unsigned char lcd_backlight_seq[3][2] = { | ||
198 | { 0x04, 0x07 }, | ||
199 | { 0x23, 0x80 }, | ||
200 | { 0x03, 0x01 }, | ||
201 | }; | ||
202 | |||
203 | static void lcd_backlight_on(void) | ||
204 | { | ||
205 | struct i2c_adapter *a; | ||
206 | struct i2c_msg msg; | ||
207 | int k; | ||
208 | |||
209 | a = i2c_get_adapter(1); | ||
210 | for (k = 0; a && k < 3; k++) { | ||
211 | msg.addr = 0x6d; | ||
212 | msg.buf = &lcd_backlight_seq[k][0]; | ||
213 | msg.len = 2; | ||
214 | msg.flags = 0; | ||
215 | if (i2c_transfer(a, &msg, 1) != 1) | ||
216 | break; | ||
217 | } | ||
218 | } | ||
219 | |||
220 | static void lcd_backlight_reset(void) | ||
221 | { | ||
222 | gpio_set_value(GPIO_PORT235, 0); | ||
223 | mdelay(24); | ||
224 | gpio_set_value(GPIO_PORT235, 1); | ||
225 | } | ||
226 | |||
227 | static void lcd_on(void *board_data, struct fb_info *info) | ||
228 | { | ||
229 | lcd_backlight_on(); | ||
230 | } | ||
231 | |||
232 | static void lcd_off(void *board_data) | ||
233 | { | ||
234 | lcd_backlight_reset(); | ||
235 | } | ||
236 | |||
237 | /* LCDC0 */ | ||
238 | static const struct fb_videomode lcdc0_modes[] = { | ||
239 | { | ||
240 | .name = "R63302(QHD)", | ||
241 | .xres = 544, | ||
242 | .yres = 961, | ||
243 | .left_margin = 72, | ||
244 | .right_margin = 600, | ||
245 | .hsync_len = 16, | ||
246 | .upper_margin = 8, | ||
247 | .lower_margin = 8, | ||
248 | .vsync_len = 2, | ||
249 | .sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT, | ||
250 | }, | ||
251 | }; | ||
252 | |||
253 | static struct sh_mobile_lcdc_info lcdc0_info = { | ||
254 | .clock_source = LCDC_CLK_PERIPHERAL, | ||
255 | .ch[0] = { | ||
256 | .chan = LCDC_CHAN_MAINLCD, | ||
257 | .interface_type = RGB24, | ||
258 | .clock_divider = 1, | ||
259 | .flags = LCDC_FLAGS_DWPOL, | ||
260 | .lcd_size_cfg.width = 44, | ||
261 | .lcd_size_cfg.height = 79, | ||
262 | .bpp = 16, | ||
263 | .lcd_cfg = lcdc0_modes, | ||
264 | .num_cfg = ARRAY_SIZE(lcdc0_modes), | ||
265 | .board_cfg = { | ||
266 | .display_on = lcd_on, | ||
267 | .display_off = lcd_off, | ||
268 | }, | ||
269 | } | ||
270 | }; | ||
271 | |||
272 | static struct resource lcdc0_resources[] = { | ||
273 | [0] = { | ||
274 | .name = "LCDC0", | ||
275 | .start = 0xfe940000, /* P4-only space */ | ||
276 | .end = 0xfe943fff, | ||
277 | .flags = IORESOURCE_MEM, | ||
278 | }, | ||
279 | [1] = { | ||
280 | .start = intcs_evt2irq(0x580), | ||
281 | .flags = IORESOURCE_IRQ, | ||
282 | }, | ||
283 | }; | ||
284 | |||
285 | static struct platform_device lcdc0_device = { | ||
286 | .name = "sh_mobile_lcdc_fb", | ||
287 | .num_resources = ARRAY_SIZE(lcdc0_resources), | ||
288 | .resource = lcdc0_resources, | ||
289 | .id = 0, | ||
290 | .dev = { | ||
291 | .platform_data = &lcdc0_info, | ||
292 | .coherent_dma_mask = ~0, | ||
293 | }, | ||
294 | }; | ||
295 | |||
296 | /* MIPI-DSI */ | ||
297 | static struct resource mipidsi0_resources[] = { | ||
298 | [0] = { | ||
299 | .start = 0xfeab0000, | ||
300 | .end = 0xfeab3fff, | ||
301 | .flags = IORESOURCE_MEM, | ||
302 | }, | ||
303 | [1] = { | ||
304 | .start = 0xfeab4000, | ||
305 | .end = 0xfeab7fff, | ||
306 | .flags = IORESOURCE_MEM, | ||
307 | }, | ||
308 | }; | ||
309 | |||
310 | static struct sh_mipi_dsi_info mipidsi0_info = { | ||
311 | .data_format = MIPI_RGB888, | ||
312 | .lcd_chan = &lcdc0_info.ch[0], | ||
313 | .vsynw_offset = 20, | ||
314 | .clksrc = 1, | ||
315 | .flags = SH_MIPI_DSI_HSABM, | ||
316 | }; | ||
317 | |||
318 | static struct platform_device mipidsi0_device = { | ||
319 | .name = "sh-mipi-dsi", | ||
320 | .num_resources = ARRAY_SIZE(mipidsi0_resources), | ||
321 | .resource = mipidsi0_resources, | ||
322 | .id = 0, | ||
323 | .dev = { | ||
324 | .platform_data = &mipidsi0_info, | ||
325 | }, | ||
326 | }; | ||
327 | |||
176 | static struct platform_device *ag5evm_devices[] __initdata = { | 328 | static struct platform_device *ag5evm_devices[] __initdata = { |
177 | ð_device, | 329 | ð_device, |
178 | &keysc_device, | 330 | &keysc_device, |
179 | &fsi_device, | 331 | &fsi_device, |
180 | &mmc_device, | 332 | &mmc_device, |
333 | &irda_device, | ||
334 | &lcdc0_device, | ||
335 | &mipidsi0_device, | ||
181 | }; | 336 | }; |
182 | 337 | ||
183 | static struct map_desc ag5evm_io_desc[] __initdata = { | 338 | static struct map_desc ag5evm_io_desc[] __initdata = { |
@@ -214,6 +369,8 @@ void __init ag5evm_init_irq(void) | |||
214 | __raw_writew(__raw_readw(PINTCR0A) | (2<<10), PINTCR0A); | 369 | __raw_writew(__raw_readw(PINTCR0A) | (2<<10), PINTCR0A); |
215 | } | 370 | } |
216 | 371 | ||
372 | #define DSI0PHYCR 0xe615006c | ||
373 | |||
217 | static void __init ag5evm_init(void) | 374 | static void __init ag5evm_init(void) |
218 | { | 375 | { |
219 | sh73a0_pinmux_init(); | 376 | sh73a0_pinmux_init(); |
@@ -277,6 +434,26 @@ static void __init ag5evm_init(void) | |||
277 | gpio_request(GPIO_FN_FSIAISLD, NULL); | 434 | gpio_request(GPIO_FN_FSIAISLD, NULL); |
278 | gpio_request(GPIO_FN_FSIAOSLD, NULL); | 435 | gpio_request(GPIO_FN_FSIAOSLD, NULL); |
279 | 436 | ||
437 | /* IrDA */ | ||
438 | gpio_request(GPIO_FN_PORT241_IRDA_OUT, NULL); | ||
439 | gpio_request(GPIO_FN_PORT242_IRDA_IN, NULL); | ||
440 | gpio_request(GPIO_FN_PORT243_IRDA_FIRSEL, NULL); | ||
441 | |||
442 | /* LCD panel */ | ||
443 | gpio_request(GPIO_PORT217, NULL); /* RESET */ | ||
444 | gpio_direction_output(GPIO_PORT217, 0); | ||
445 | mdelay(1); | ||
446 | gpio_set_value(GPIO_PORT217, 1); | ||
447 | mdelay(100); | ||
448 | |||
449 | /* LCD backlight controller */ | ||
450 | gpio_request(GPIO_PORT235, NULL); /* RESET */ | ||
451 | gpio_direction_output(GPIO_PORT235, 0); | ||
452 | lcd_backlight_reset(); | ||
453 | |||
454 | /* MIPI-DSI clock setup */ | ||
455 | __raw_writel(0x2a809010, DSI0PHYCR); | ||
456 | |||
280 | #ifdef CONFIG_CACHE_L2X0 | 457 | #ifdef CONFIG_CACHE_L2X0 |
281 | /* Shared attribute override enable, 64K*8way */ | 458 | /* Shared attribute override enable, 64K*8way */ |
282 | l2x0_init(__io(0xf0100000), 0x00460000, 0xc2000fff); | 459 | l2x0_init(__io(0xf0100000), 0x00460000, 0xc2000fff); |