1 // SPDX-License-Identifier: GPL-2.0-only
3 * arch/arm/mach-netx/nxeb500hmi.c
5 * Copyright (c) 2005 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
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>
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>
25 static struct clcd_panel qvga = {
39 .vmode = FB_VMODE_NONINTERLACED,
44 .cntl = CNTL_LCDTFT | CNTL_BGR,
49 static inline int nxeb500hmi_check(struct clcd_fb *fb, struct fb_var_screeninfo *var)
51 var->green.length = 5;
52 var->green.msb_right = 0;
54 return clcdfb_check(fb, var);
57 static int nxeb500hmi_clcd_setup(struct clcd_fb *fb)
61 fb->fb.var.green.length = 5;
62 fb->fb.var.green.msb_right = 0;
64 /* enable asic control */
65 val = readl(NETX_SYSTEM_IOC_ACCESS_KEY);
66 writel(val, NETX_SYSTEM_IOC_ACCESS_KEY);
68 writel(3, NETX_SYSTEM_IOC_CR);
70 /* GPIO 14 is used for display enable on newer boards */
71 writel(9, NETX_GPIO_CFG(14));
73 val = readl(NETX_PIO_OUTPIO);
74 writel(val | 1, NETX_PIO_OUTPIO);
76 val = readl(NETX_PIO_OEPIO);
77 writel(val | 1, NETX_PIO_OEPIO);
78 return netx_clcd_setup(fb);
81 static struct clcd_board clcd_data = {
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,
91 static struct netxeth_platform_data eth0_platform_data = {
95 static struct platform_device netx_eth0_device = {
101 .platform_data = ð0_platform_data,
105 static struct netxeth_platform_data eth1_platform_data = {
109 static struct platform_device netx_eth1_device = {
115 .platform_data = ð1_platform_data,
119 static struct resource netx_cf_resources[] = {
123 .flags = IORESOURCE_MEM | IORESOURCE_MEM_8AND16BIT,
127 static struct platform_device netx_cf_device = {
130 .resource = netx_cf_resources,
131 .num_resources = ARRAY_SIZE(netx_cf_resources),
134 static struct resource netx_uart0_resources[] = {
138 .flags = IORESOURCE_MEM,
141 .start = (NETX_IRQ_UART0),
142 .end = (NETX_IRQ_UART0),
143 .flags = IORESOURCE_IRQ,
147 static struct platform_device netx_uart0_device = {
150 .num_resources = ARRAY_SIZE(netx_uart0_resources),
151 .resource = netx_uart0_resources,
154 static struct platform_device *devices[] __initdata = {
161 static void __init nxeb500hmi_init(void)
163 netx_fb_init(&clcd_data, &qvga);
164 platform_add_devices(devices, ARRAY_SIZE(devices));
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,