1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * Staging board support for Armadillo 800 eva.
4  * Enable not-yet-DT-capable devices here.
5  *
6  * Based on board-armadillo800eva.c
7  *
8  * Copyright (C) 2012 Renesas Solutions Corp.
9  * Copyright (C) 2012 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
10  */
11 
12 #include <linux/dma-mapping.h>
13 #include <linux/fb.h>
14 #include <linux/kernel.h>
15 #include <linux/platform_device.h>
16 #include <linux/videodev2.h>
17 
18 #include <video/sh_mobile_lcdc.h>
19 
20 #include "board.h"
21 
22 static struct fb_videomode lcdc0_mode = {
23 	.name		= "AMPIER/AM-800480",
24 	.xres		= 800,
25 	.yres		= 480,
26 	.left_margin	= 88,
27 	.right_margin	= 40,
28 	.hsync_len	= 128,
29 	.upper_margin	= 20,
30 	.lower_margin	= 5,
31 	.vsync_len	= 5,
32 	.sync		= 0,
33 };
34 
35 static struct sh_mobile_lcdc_info lcdc0_info = {
36 	.clock_source	= LCDC_CLK_BUS,
37 	.ch[0] = {
38 		.chan		= LCDC_CHAN_MAINLCD,
39 		.fourcc		= V4L2_PIX_FMT_RGB565,
40 		.interface_type	= RGB24,
41 		.clock_divider	= 5,
42 		.flags		= 0,
43 		.lcd_modes	= &lcdc0_mode,
44 		.num_modes	= 1,
45 		.panel_cfg = {
46 			.width	= 111,
47 			.height = 68,
48 		},
49 	},
50 };
51 
52 static struct resource lcdc0_resources[] = {
53 	DEFINE_RES_MEM_NAMED(0xfe940000, 0x4000, "LCD0"),
54 	DEFINE_RES_IRQ(177 + 32),
55 };
56 
57 static struct platform_device lcdc0_device = {
58 	.name		= "sh_mobile_lcdc_fb",
59 	.num_resources	= ARRAY_SIZE(lcdc0_resources),
60 	.resource	= lcdc0_resources,
61 	.id		= 0,
62 	.dev	= {
63 		.platform_data	= &lcdc0_info,
64 		.coherent_dma_mask = DMA_BIT_MASK(32),
65 	},
66 };
67 
68 static const struct board_staging_clk lcdc0_clocks[] __initconst = {
69 	{ "lcdc0", NULL, "sh_mobile_lcdc_fb.0" },
70 };
71 
72 static const struct board_staging_dev armadillo800eva_devices[] __initconst = {
73 	{
74 		.pdev	 = &lcdc0_device,
75 		.clocks	 = lcdc0_clocks,
76 		.nclocks = ARRAY_SIZE(lcdc0_clocks),
77 		.domain	 = "/system-controller@e6180000/pm-domains/c5/a4lc@1"
78 	},
79 };
80 
armadillo800eva_init(void)81 static void __init armadillo800eva_init(void)
82 {
83 	board_staging_gic_setup_xlate("arm,pl390", 32);
84 	board_staging_register_devices(armadillo800eva_devices,
85 				       ARRAY_SIZE(armadillo800eva_devices));
86 }
87 
88 board_staging("renesas,armadillo800eva", armadillo800eva_init);
89