aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2010-05-23 10:04:03 -0400
committerPaul Mundt <lethal@linux-sh.org>2010-05-23 19:49:10 -0400
commit8eda2f21ed9c936a54fd7bc16cbfa5ee656635c2 (patch)
tree10fbb6b2750a5214a95190a231f5c54db3b0410e /arch
parent9fd04fe34af36344f61ebb24cc653726c231356e (diff)
ARM: mach-shmobile: add framebuffer support for ap4evb
ap4evb uses an LCD, connected to the SoC over the MIPI bus. This patch adds platform data to configure this display and a static clock activation. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Tested-by: Damian Hobson-Garcia <dhobsong@igel.co.jp> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-shmobile/Kconfig1
-rw-r--r--arch/arm/mach-shmobile/board-ap4evb.c121
2 files changed, 122 insertions, 0 deletions
diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
index a69e033ca045..1de8d171c6e9 100644
--- a/arch/arm/mach-shmobile/Kconfig
+++ b/arch/arm/mach-shmobile/Kconfig
@@ -42,6 +42,7 @@ config MACH_AP4EVB
42 bool "AP4EVB board" 42 bool "AP4EVB board"
43 depends on ARCH_SH7372 43 depends on ARCH_SH7372
44 select ARCH_REQUIRE_GPIOLIB 44 select ARCH_REQUIRE_GPIOLIB
45 select SH_LCD_MIPI_DSI
45 46
46comment "SH-Mobile System Configuration" 47comment "SH-Mobile System Configuration"
47 48
diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c
index 5342306cd391..353ff8d120b1 100644
--- a/arch/arm/mach-shmobile/board-ap4evb.c
+++ b/arch/arm/mach-shmobile/board-ap4evb.c
@@ -17,6 +17,7 @@
17 * along with this program; if not, write to the Free Software 17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */ 19 */
20#include <linux/clk.h>
20#include <linux/kernel.h> 21#include <linux/kernel.h>
21#include <linux/init.h> 22#include <linux/init.h>
22#include <linux/interrupt.h> 23#include <linux/interrupt.h>
@@ -34,8 +35,14 @@
34#include <linux/input.h> 35#include <linux/input.h>
35#include <linux/input/sh_keysc.h> 36#include <linux/input/sh_keysc.h>
36#include <linux/usb/r8a66597.h> 37#include <linux/usb/r8a66597.h>
38
39#include <video/sh_mobile_lcdc.h>
40#include <video/sh_mipi_dsi.h>
41
37#include <mach/common.h> 42#include <mach/common.h>
43#include <mach/irqs.h>
38#include <mach/sh7372.h> 44#include <mach/sh7372.h>
45
39#include <asm/mach-types.h> 46#include <asm/mach-types.h>
40#include <asm/mach/arch.h> 47#include <asm/mach/arch.h>
41#include <asm/mach/map.h> 48#include <asm/mach/map.h>
@@ -284,12 +291,87 @@ static struct platform_device usb1_host_device = {
284 .resource = usb1_host_resources, 291 .resource = usb1_host_resources,
285}; 292};
286 293
294static struct sh_mobile_lcdc_info sh_mobile_lcdc_info = {
295 .clock_source = LCDC_CLK_PERIPHERAL, /* One of interface clocks */
296 .ch[0] = {
297 .chan = LCDC_CHAN_MAINLCD,
298 .bpp = 16,
299 .interface_type = RGB24,
300 .clock_divider = 1,
301 .flags = LCDC_FLAGS_DWPOL,
302 .lcd_cfg = {
303 .name = "R63302(QHD)",
304 .xres = 544,
305 .yres = 961,
306 .left_margin = 72,
307 .right_margin = 600,
308 .hsync_len = 16,
309 .upper_margin = 8,
310 .lower_margin = 8,
311 .vsync_len = 2,
312 .sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT,
313 },
314 .lcd_size_cfg = {
315 .width = 44,
316 .height = 79,
317 },
318 }
319};
320
321static struct resource lcdc_resources[] = {
322 [0] = {
323 .name = "LCDC",
324 .start = 0xfe940000, /* P4-only space */
325 .end = 0xfe943fff,
326 .flags = IORESOURCE_MEM,
327 },
328 [1] = {
329 .start = intcs_evt2irq(0x580),
330 .flags = IORESOURCE_IRQ,
331 },
332};
333
334static struct platform_device lcdc_device = {
335 .name = "sh_mobile_lcdc_fb",
336 .num_resources = ARRAY_SIZE(lcdc_resources),
337 .resource = lcdc_resources,
338 .dev = {
339 .platform_data = &sh_mobile_lcdc_info,
340 .coherent_dma_mask = ~0,
341 },
342};
343
344static struct resource mipidsi0_resources[] = {
345 [0] = {
346 .start = 0xffc60000,
347 .end = 0xffc68fff,
348 .flags = IORESOURCE_MEM,
349 },
350};
351
352static struct sh_mipi_dsi_info mipidsi0_info = {
353 .data_format = MIPI_RGB888,
354 .lcd_chan = &sh_mobile_lcdc_info.ch[0],
355};
356
357static struct platform_device mipidsi0_device = {
358 .name = "sh-mipi-dsi",
359 .num_resources = ARRAY_SIZE(mipidsi0_resources),
360 .resource = mipidsi0_resources,
361 .id = 0,
362 .dev = {
363 .platform_data = &mipidsi0_info,
364 },
365};
366
287static struct platform_device *ap4evb_devices[] __initdata = { 367static struct platform_device *ap4evb_devices[] __initdata = {
288 &nor_flash_device, 368 &nor_flash_device,
289 &smc911x_device, 369 &smc911x_device,
290 &keysc_device, 370 &keysc_device,
291 &sdhi0_device, 371 &sdhi0_device,
292 &usb1_host_device, 372 &usb1_host_device,
373 &lcdc_device,
374 &mipidsi0_device,
293}; 375};
294 376
295/* TouchScreen (Needs SW3 set to OFF) */ 377/* TouchScreen (Needs SW3 set to OFF) */
@@ -333,6 +415,45 @@ static void __init ap4evb_map_io(void)
333 shmobile_setup_console(); 415 shmobile_setup_console();
334} 416}
335 417
418/* This function will disappear when we switch to (runtime) PM */
419static int __init ap4evb_init_display_clk(void)
420{
421 struct clk *lcdc_clk;
422 struct clk *dsitx_clk;
423 int ret;
424
425 lcdc_clk = clk_get(&lcdc_device.dev, "sh_mobile_lcdc_fb.0");
426 if (IS_ERR(lcdc_clk))
427 return PTR_ERR(lcdc_clk);
428
429 dsitx_clk = clk_get(&mipidsi0_device.dev, "sh-mipi-dsi.0");
430 if (IS_ERR(dsitx_clk)) {
431 ret = PTR_ERR(dsitx_clk);
432 goto eclkdsitxget;
433 }
434
435 ret = clk_enable(lcdc_clk);
436 if (ret < 0)
437 goto eclklcdcon;
438
439 ret = clk_enable(dsitx_clk);
440 if (ret < 0)
441 goto eclkdsitxon;
442
443 return 0;
444
445eclkdsitxon:
446 clk_disable(lcdc_clk);
447eclklcdcon:
448 clk_put(dsitx_clk);
449eclkdsitxget:
450 clk_put(lcdc_clk);
451
452 return ret;
453}
454
455device_initcall(ap4evb_init_display_clk);
456
336static void __init ap4evb_init(void) 457static void __init ap4evb_init(void)
337{ 458{
338 sh7372_pinmux_init(); 459 sh7372_pinmux_init();