]> asedeno.scripts.mit.edu Git - linux.git/blob - arch/arm/mach-netx/nxeb500hmi.c
docs/perf: Add documentation for the i.MX8 DDR PMU
[linux.git] / arch / arm / mach-netx / nxeb500hmi.c
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * arch/arm/mach-netx/nxeb500hmi.c
4  *
5  * Copyright (c) 2005 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
6  */
7
8 #include <linux/dma-mapping.h>
9 #include <linux/init.h>
10 #include <linux/interrupt.h>
11 #include <linux/mtd/plat-ram.h>
12 #include <linux/platform_device.h>
13 #include <linux/amba/bus.h>
14 #include <linux/amba/clcd.h>
15
16 #include <mach/hardware.h>
17 #include <asm/mach-types.h>
18 #include <asm/mach/arch.h>
19 #include <mach/netx-regs.h>
20 #include <linux/platform_data/eth-netx.h>
21
22 #include "generic.h"
23 #include "fb.h"
24
25 static struct clcd_panel qvga = {
26         .mode           = {
27                 .name           = "QVGA",
28                 .refresh        = 60,
29                 .xres           = 240,
30                 .yres           = 320,
31                 .pixclock       = 187617,
32                 .left_margin    = 6,
33                 .right_margin   = 26,
34                 .upper_margin   = 0,
35                 .lower_margin   = 6,
36                 .hsync_len      = 6,
37                 .vsync_len      = 1,
38                 .sync           = 0,
39                 .vmode          = FB_VMODE_NONINTERLACED,
40         },
41         .width          = -1,
42         .height         = -1,
43         .tim2           =  16,
44         .cntl           = CNTL_LCDTFT | CNTL_BGR,
45         .bpp            = 16,
46         .grayscale      = 0,
47 };
48
49 static inline int nxeb500hmi_check(struct clcd_fb *fb, struct fb_var_screeninfo *var)
50 {
51         var->green.length = 5;
52         var->green.msb_right = 0;
53
54         return clcdfb_check(fb, var);
55 }
56
57 static int nxeb500hmi_clcd_setup(struct clcd_fb *fb)
58 {
59         unsigned int val;
60
61         fb->fb.var.green.length = 5;
62         fb->fb.var.green.msb_right = 0;
63
64         /* enable asic control */
65         val = readl(NETX_SYSTEM_IOC_ACCESS_KEY);
66         writel(val, NETX_SYSTEM_IOC_ACCESS_KEY);
67
68         writel(3, NETX_SYSTEM_IOC_CR);
69
70         /* GPIO 14 is used for display enable on newer boards */
71         writel(9, NETX_GPIO_CFG(14));
72
73         val = readl(NETX_PIO_OUTPIO);
74         writel(val | 1, NETX_PIO_OUTPIO);
75
76         val = readl(NETX_PIO_OEPIO);
77         writel(val | 1, NETX_PIO_OEPIO);
78         return netx_clcd_setup(fb);
79 }
80
81 static struct clcd_board clcd_data = {
82         .name           = "netX",
83         .check          = nxeb500hmi_check,
84         .decode         = clcdfb_decode,
85         .enable         = netx_clcd_enable,
86         .setup          = nxeb500hmi_clcd_setup,
87         .mmap           = netx_clcd_mmap,
88         .remove         = netx_clcd_remove,
89 };
90
91 static struct netxeth_platform_data eth0_platform_data = {
92         .xcno = 0,
93 };
94
95 static struct platform_device netx_eth0_device = {
96         .name           = "netx-eth",
97         .id             = 0,
98         .num_resources  = 0,
99         .resource       = NULL,
100         .dev = {
101                 .platform_data = &eth0_platform_data,
102         }
103 };
104
105 static struct netxeth_platform_data eth1_platform_data = {
106         .xcno = 1,
107 };
108
109 static struct platform_device netx_eth1_device = {
110         .name           = "netx-eth",
111         .id             = 1,
112         .num_resources  = 0,
113         .resource       = NULL,
114         .dev = {
115                 .platform_data = &eth1_platform_data,
116         }
117 };
118
119 static struct resource netx_cf_resources[] = {
120         [0] = {
121                 .start  = 0x20000000,
122                 .end    = 0x25ffffff,
123                 .flags  = IORESOURCE_MEM | IORESOURCE_MEM_8AND16BIT,
124         },
125 };
126
127 static struct platform_device netx_cf_device = {
128         .name           = "netx-cf",
129         .id             = 0,
130         .resource       = netx_cf_resources,
131         .num_resources  = ARRAY_SIZE(netx_cf_resources),
132 };
133
134 static struct resource netx_uart0_resources[] = {
135         [0] = {
136                 .start  = 0x00100A00,
137                 .end    = 0x00100A3F,
138                 .flags  = IORESOURCE_MEM,
139         },
140         [1] = {
141                 .start  = (NETX_IRQ_UART0),
142                 .end    = (NETX_IRQ_UART0),
143                 .flags  = IORESOURCE_IRQ,
144         },
145 };
146
147 static struct platform_device netx_uart0_device = {
148         .name           = "netx-uart",
149         .id             = 0,
150         .num_resources  = ARRAY_SIZE(netx_uart0_resources),
151         .resource       = netx_uart0_resources,
152 };
153
154 static struct platform_device *devices[] __initdata = {
155         &netx_eth0_device,
156         &netx_eth1_device,
157         &netx_cf_device,
158         &netx_uart0_device,
159 };
160
161 static void __init nxeb500hmi_init(void)
162 {
163         netx_fb_init(&clcd_data, &qvga);
164         platform_add_devices(devices, ARRAY_SIZE(devices));
165 }
166
167 MACHINE_START(NXEB500HMI, "Hilscher nxeb500hmi")
168         .atag_offset    = 0x100,
169         .map_io         = netx_map_io,
170         .init_irq       = netx_init_irq,
171         .init_time      = netx_timer_init,
172         .init_machine   = nxeb500hmi_init,
173         .restart        = netx_restart,
174 MACHINE_END