]> git.ipfire.org Git - thirdparty/linux.git/blame - arch/arm/mach-netx/nxeb500hmi.c
ARM: delete struct sys_timer
[thirdparty/linux.git] / arch / arm / mach-netx / nxeb500hmi.c
CommitLineData
2697c5e1
SH
1/*
2 * arch/arm/mach-netx/nxeb500hmi.c
3 *
4 * Copyright (c) 2005 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2
8 * as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#include <linux/dma-mapping.h>
21#include <linux/init.h>
22#include <linux/interrupt.h>
23#include <linux/mtd/plat-ram.h>
24#include <linux/platform_device.h>
25#include <linux/amba/bus.h>
26#include <linux/amba/clcd.h>
27
a09e64fb 28#include <mach/hardware.h>
2697c5e1
SH
29#include <asm/mach-types.h>
30#include <asm/mach/arch.h>
14f127ba 31#include <asm/hardware/vic.h>
a09e64fb 32#include <mach/netx-regs.h>
2960ed34 33#include <linux/platform_data/eth-netx.h>
2697c5e1
SH
34
35#include "generic.h"
36#include "fb.h"
37
38static struct clcd_panel qvga = {
39 .mode = {
40 .name = "QVGA",
41 .refresh = 60,
42 .xres = 240,
43 .yres = 320,
44 .pixclock = 187617,
45 .left_margin = 6,
46 .right_margin = 26,
47 .upper_margin = 0,
48 .lower_margin = 6,
49 .hsync_len = 6,
50 .vsync_len = 1,
51 .sync = 0,
52 .vmode = FB_VMODE_NONINTERLACED,
53 },
54 .width = -1,
55 .height = -1,
56 .tim2 = 16,
57 .cntl = CNTL_LCDTFT | CNTL_BGR,
58 .bpp = 16,
59 .grayscale = 0,
60};
61
62static inline int nxeb500hmi_check(struct clcd_fb *fb, struct fb_var_screeninfo *var)
63{
64 var->green.length = 5;
65 var->green.msb_right = 0;
66
67 return clcdfb_check(fb, var);
68}
69
70static int nxeb500hmi_clcd_setup(struct clcd_fb *fb)
71{
72 unsigned int val;
73
74 fb->fb.var.green.length = 5;
75 fb->fb.var.green.msb_right = 0;
76
77 /* enable asic control */
78 val = readl(NETX_SYSTEM_IOC_ACCESS_KEY);
79 writel(val, NETX_SYSTEM_IOC_ACCESS_KEY);
80
81 writel(3, NETX_SYSTEM_IOC_CR);
82
83 /* GPIO 14 is used for display enable on newer boards */
84 writel(9, NETX_GPIO_CFG(14));
85
86 val = readl(NETX_PIO_OUTPIO);
87 writel(val | 1, NETX_PIO_OUTPIO);
88
89 val = readl(NETX_PIO_OEPIO);
90 writel(val | 1, NETX_PIO_OEPIO);
91 return netx_clcd_setup(fb);
92}
93
94static struct clcd_board clcd_data = {
95 .name = "netX",
96 .check = nxeb500hmi_check,
97 .decode = clcdfb_decode,
98 .enable = netx_clcd_enable,
99 .setup = nxeb500hmi_clcd_setup,
100 .mmap = netx_clcd_mmap,
101 .remove = netx_clcd_remove,
102};
103
104static struct netxeth_platform_data eth0_platform_data = {
105 .xcno = 0,
106};
107
108static struct platform_device netx_eth0_device = {
109 .name = "netx-eth",
110 .id = 0,
111 .num_resources = 0,
112 .resource = NULL,
113 .dev = {
114 .platform_data = &eth0_platform_data,
115 }
116};
117
118static struct netxeth_platform_data eth1_platform_data = {
119 .xcno = 1,
120};
121
122static struct platform_device netx_eth1_device = {
123 .name = "netx-eth",
124 .id = 1,
125 .num_resources = 0,
126 .resource = NULL,
127 .dev = {
128 .platform_data = &eth1_platform_data,
129 }
130};
131
132static struct resource netx_cf_resources[] = {
133 [0] = {
134 .start = 0x20000000,
135 .end = 0x25ffffff,
136 .flags = IORESOURCE_MEM | IORESOURCE_MEM_8AND16BIT,
137 },
138};
139
140static struct platform_device netx_cf_device = {
141 .name = "netx-cf",
142 .id = 0,
143 .resource = netx_cf_resources,
144 .num_resources = ARRAY_SIZE(netx_cf_resources),
145};
146
147static struct resource netx_uart0_resources[] = {
148 [0] = {
149 .start = 0x00100A00,
150 .end = 0x00100A3F,
151 .flags = IORESOURCE_MEM,
152 },
153 [1] = {
154 .start = (NETX_IRQ_UART0),
155 .end = (NETX_IRQ_UART0),
156 .flags = IORESOURCE_IRQ,
157 },
158};
159
160static struct platform_device netx_uart0_device = {
161 .name = "netx-uart",
162 .id = 0,
163 .num_resources = ARRAY_SIZE(netx_uart0_resources),
164 .resource = netx_uart0_resources,
165};
166
167static struct platform_device *devices[] __initdata = {
168 &netx_eth0_device,
169 &netx_eth1_device,
170 &netx_cf_device,
171 &netx_uart0_device,
172};
173
174static void __init nxeb500hmi_init(void)
175{
176 netx_fb_init(&clcd_data, &qvga);
177 platform_add_devices(devices, ARRAY_SIZE(devices));
178}
179
180MACHINE_START(NXEB500HMI, "Hilscher nxeb500hmi")
b11fd42c 181 .atag_offset = 0x100,
2697c5e1
SH
182 .map_io = netx_map_io,
183 .init_irq = netx_init_irq,
14f127ba 184 .handle_irq = vic_handle_irq,
6bb27d73 185 .init_time = netx_timer_init,
2697c5e1 186 .init_machine = nxeb500hmi_init,
8fb06b12 187 .restart = netx_restart,
2697c5e1 188MACHINE_END