GNU Linux-libre 4.19.264-gnu1
[releases.git] / drivers / staging / board / armadillo800eva.c
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         [0] = {
54                 .name   = "LCD0",
55                 .start  = 0xfe940000,
56                 .end    = 0xfe943fff,
57                 .flags  = IORESOURCE_MEM,
58         },
59         [1] = {
60                 .start  = 177 + 32,
61                 .flags  = IORESOURCE_IRQ,
62         },
63 };
64
65 static struct platform_device lcdc0_device = {
66         .name           = "sh_mobile_lcdc_fb",
67         .num_resources  = ARRAY_SIZE(lcdc0_resources),
68         .resource       = lcdc0_resources,
69         .id             = 0,
70         .dev    = {
71                 .platform_data  = &lcdc0_info,
72                 .coherent_dma_mask = DMA_BIT_MASK(32),
73         },
74 };
75
76 static const struct board_staging_clk lcdc0_clocks[] __initconst = {
77         { "lcdc0", NULL, "sh_mobile_lcdc_fb.0" },
78 };
79
80 static const struct board_staging_dev armadillo800eva_devices[] __initconst = {
81         {
82                 .pdev    = &lcdc0_device,
83                 .clocks  = lcdc0_clocks,
84                 .nclocks = ARRAY_SIZE(lcdc0_clocks),
85                 .domain  = "/system-controller@e6180000/pm-domains/c5/a4lc@1"
86         },
87 };
88
89 static void __init armadillo800eva_init(void)
90 {
91         board_staging_gic_setup_xlate("arm,pl390", 32);
92         board_staging_register_devices(armadillo800eva_devices,
93                                        ARRAY_SIZE(armadillo800eva_devices));
94 }
95
96 board_staging("renesas,armadillo800eva", armadillo800eva_init);