aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-aaec2000
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-aaec2000')
-rw-r--r--arch/arm/mach-aaec2000/Makefile2
-rw-r--r--arch/arm/mach-aaec2000/aaed2000.c50
-rw-r--r--arch/arm/mach-aaec2000/clock.c110
-rw-r--r--arch/arm/mach-aaec2000/clock.h23
-rw-r--r--arch/arm/mach-aaec2000/core.c135
-rw-r--r--arch/arm/mach-aaec2000/core.h11
6 files changed, 327 insertions, 4 deletions
diff --git a/arch/arm/mach-aaec2000/Makefile b/arch/arm/mach-aaec2000/Makefile
index 20ec83896c37..a8e462f58bc9 100644
--- a/arch/arm/mach-aaec2000/Makefile
+++ b/arch/arm/mach-aaec2000/Makefile
@@ -3,7 +3,7 @@
3# 3#
4 4
5# Common support (must be linked before board specific support) 5# Common support (must be linked before board specific support)
6obj-y += core.o 6obj-y += core.o clock.o
7 7
8# Specific board support 8# Specific board support
9obj-$(CONFIG_MACH_AAED2000) += aaed2000.o 9obj-$(CONFIG_MACH_AAED2000) += aaed2000.o
diff --git a/arch/arm/mach-aaec2000/aaed2000.c b/arch/arm/mach-aaec2000/aaed2000.c
index c9d899886648..f5ef69702296 100644
--- a/arch/arm/mach-aaec2000/aaed2000.c
+++ b/arch/arm/mach-aaec2000/aaed2000.c
@@ -27,16 +27,65 @@
27#include <asm/mach/map.h> 27#include <asm/mach/map.h>
28#include <asm/mach/irq.h> 28#include <asm/mach/irq.h>
29 29
30#include <asm/arch/aaed2000.h>
31
30#include "core.h" 32#include "core.h"
31 33
34static void aaed2000_clcd_disable(struct clcd_fb *fb)
35{
36 AAED_EXT_GPIO &= ~AAED_EGPIO_LCD_PWR_EN;
37}
38
39static void aaed2000_clcd_enable(struct clcd_fb *fb)
40{
41 AAED_EXT_GPIO |= AAED_EGPIO_LCD_PWR_EN;
42}
43
44struct aaec2000_clcd_info clcd_info = {
45 .enable = aaed2000_clcd_enable,
46 .disable = aaed2000_clcd_disable,
47 .panel = {
48 .mode = {
49 .name = "Sharp",
50 .refresh = 60,
51 .xres = 640,
52 .yres = 480,
53 .pixclock = 39721,
54 .left_margin = 20,
55 .right_margin = 44,
56 .upper_margin = 21,
57 .lower_margin = 34,
58 .hsync_len = 96,
59 .vsync_len = 2,
60 .sync = 0,
61 .vmode = FB_VMODE_NONINTERLACED,
62 },
63 .width = -1,
64 .height = -1,
65 .tim2 = TIM2_IVS | TIM2_IHS,
66 .cntl = CNTL_LCDTFT,
67 .bpp = 16,
68 },
69};
70
32static void __init aaed2000_init_irq(void) 71static void __init aaed2000_init_irq(void)
33{ 72{
34 aaec2000_init_irq(); 73 aaec2000_init_irq();
35} 74}
36 75
76static void __init aaed2000_init(void)
77{
78 aaec2000_set_clcd_plat_data(&clcd_info);
79}
80
81static struct map_desc aaed2000_io_desc[] __initdata = {
82 { EXT_GPIO_VBASE, EXT_GPIO_PBASE, EXT_GPIO_LENGTH, MT_DEVICE }, /* Ext GPIO */
83};
84
37static void __init aaed2000_map_io(void) 85static void __init aaed2000_map_io(void)
38{ 86{
39 aaec2000_map_io(); 87 aaec2000_map_io();
88 iotable_init(aaed2000_io_desc, ARRAY_SIZE(aaed2000_io_desc));
40} 89}
41 90
42MACHINE_START(AAED2000, "Agilent AAED-2000 Development Platform") 91MACHINE_START(AAED2000, "Agilent AAED-2000 Development Platform")
@@ -47,4 +96,5 @@ MACHINE_START(AAED2000, "Agilent AAED-2000 Development Platform")
47 .map_io = aaed2000_map_io, 96 .map_io = aaed2000_map_io,
48 .init_irq = aaed2000_init_irq, 97 .init_irq = aaed2000_init_irq,
49 .timer = &aaec2000_timer, 98 .timer = &aaec2000_timer,
99 .init_machine = aaed2000_init,
50MACHINE_END 100MACHINE_END
diff --git a/arch/arm/mach-aaec2000/clock.c b/arch/arm/mach-aaec2000/clock.c
new file mode 100644
index 000000000000..99e019169dda
--- /dev/null
+++ b/arch/arm/mach-aaec2000/clock.c
@@ -0,0 +1,110 @@
1/*
2 * linux/arch/arm/mach-aaec2000/clock.c
3 *
4 * Copyright (C) 2005 Nicolas Bellido Y Ortega
5 *
6 * Based on linux/arch/arm/mach-integrator/clock.c
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12#include <linux/module.h>
13#include <linux/kernel.h>
14#include <linux/list.h>
15#include <linux/errno.h>
16#include <linux/err.h>
17
18#include <asm/semaphore.h>
19#include <asm/hardware/clock.h>
20
21#include "clock.h"
22
23static LIST_HEAD(clocks);
24static DECLARE_MUTEX(clocks_sem);
25
26struct clk *clk_get(struct device *dev, const char *id)
27{
28 struct clk *p, *clk = ERR_PTR(-ENOENT);
29
30 down(&clocks_sem);
31 list_for_each_entry(p, &clocks, node) {
32 if (strcmp(id, p->name) == 0 && try_module_get(p->owner)) {
33 clk = p;
34 break;
35 }
36 }
37 up(&clocks_sem);
38
39 return clk;
40}
41EXPORT_SYMBOL(clk_get);
42
43void clk_put(struct clk *clk)
44{
45 module_put(clk->owner);
46}
47EXPORT_SYMBOL(clk_put);
48
49int clk_enable(struct clk *clk)
50{
51 return 0;
52}
53EXPORT_SYMBOL(clk_enable);
54
55void clk_disable(struct clk *clk)
56{
57}
58EXPORT_SYMBOL(clk_disable);
59
60int clk_use(struct clk *clk)
61{
62 return 0;
63}
64EXPORT_SYMBOL(clk_use);
65
66void clk_unuse(struct clk *clk)
67{
68}
69EXPORT_SYMBOL(clk_unuse);
70
71unsigned long clk_get_rate(struct clk *clk)
72{
73 return clk->rate;
74}
75EXPORT_SYMBOL(clk_get_rate);
76
77long clk_round_rate(struct clk *clk, unsigned long rate)
78{
79 return rate;
80}
81EXPORT_SYMBOL(clk_round_rate);
82
83int clk_set_rate(struct clk *clk, unsigned long rate)
84{
85 return 0;
86}
87EXPORT_SYMBOL(clk_set_rate);
88
89int clk_register(struct clk *clk)
90{
91 down(&clocks_sem);
92 list_add(&clk->node, &clocks);
93 up(&clocks_sem);
94 return 0;
95}
96EXPORT_SYMBOL(clk_register);
97
98void clk_unregister(struct clk *clk)
99{
100 down(&clocks_sem);
101 list_del(&clk->node);
102 up(&clocks_sem);
103}
104EXPORT_SYMBOL(clk_unregister);
105
106static int __init clk_init(void)
107{
108 return 0;
109}
110arch_initcall(clk_init);
diff --git a/arch/arm/mach-aaec2000/clock.h b/arch/arm/mach-aaec2000/clock.h
new file mode 100644
index 000000000000..d4bb74ff613f
--- /dev/null
+++ b/arch/arm/mach-aaec2000/clock.h
@@ -0,0 +1,23 @@
1/*
2 * linux/arch/arm/mach-aaec2000/clock.h
3 *
4 * Copyright (C) 2005 Nicolas Bellido Y Ortega
5 *
6 * Based on linux/arch/arm/mach-integrator/clock.h
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12struct module;
13
14struct clk {
15 struct list_head node;
16 unsigned long rate;
17 struct module *owner;
18 const char *name;
19 void *data;
20};
21
22int clk_register(struct clk *clk);
23void clk_unregister(struct clk *clk);
diff --git a/arch/arm/mach-aaec2000/core.c b/arch/arm/mach-aaec2000/core.c
index aece0cd4f0a3..0c53dab80905 100644
--- a/arch/arm/mach-aaec2000/core.c
+++ b/arch/arm/mach-aaec2000/core.c
@@ -13,19 +13,27 @@
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/device.h>
16#include <linux/list.h> 17#include <linux/list.h>
17#include <linux/errno.h> 18#include <linux/errno.h>
19#include <linux/dma-mapping.h>
18#include <linux/interrupt.h> 20#include <linux/interrupt.h>
19#include <linux/timex.h> 21#include <linux/timex.h>
20#include <linux/signal.h> 22#include <linux/signal.h>
21 23
22#include <asm/hardware.h> 24#include <asm/hardware.h>
23#include <asm/irq.h> 25#include <asm/irq.h>
26#include <asm/sizes.h>
27#include <asm/hardware/amba.h>
24 28
29#include <asm/mach/flash.h>
25#include <asm/mach/irq.h> 30#include <asm/mach/irq.h>
26#include <asm/mach/time.h> 31#include <asm/mach/time.h>
27#include <asm/mach/map.h> 32#include <asm/mach/map.h>
28 33
34#include "core.h"
35#include "clock.h"
36
29/* 37/*
30 * Common I/O mapping: 38 * Common I/O mapping:
31 * 39 *
@@ -40,9 +48,17 @@
40 * default mapping provided here. 48 * default mapping provided here.
41 */ 49 */
42static struct map_desc standard_io_desc[] __initdata = { 50static struct map_desc standard_io_desc[] __initdata = {
43 /* virtual physical length type */ 51 {
44 { VIO_APB_BASE, PIO_APB_BASE, IO_APB_LENGTH, MT_DEVICE }, 52 .virtual = VIO_APB_BASE,
45 { VIO_AHB_BASE, PIO_AHB_BASE, IO_AHB_LENGTH, MT_DEVICE } 53 .physical = __phys_to_pfn(PIO_APB_BASE),
54 .length = IO_APB_LENGTH,
55 .type = MT_DEVICE
56 }, {
57 .virtual = VIO_AHB_BASE,
58 .physical = __phys_to_pfn(PIO_AHB_BASE),
59 .length = IO_AHB_LENGTH,
60 .type = MT_DEVICE
61 }
46}; 62};
47 63
48void __init aaec2000_map_io(void) 64void __init aaec2000_map_io(void)
@@ -155,3 +171,116 @@ struct sys_timer aaec2000_timer = {
155 .offset = aaec2000_gettimeoffset, 171 .offset = aaec2000_gettimeoffset,
156}; 172};
157 173
174static struct clcd_panel mach_clcd_panel;
175
176static int aaec2000_clcd_setup(struct clcd_fb *fb)
177{
178 dma_addr_t dma;
179
180 fb->panel = &mach_clcd_panel;
181
182 fb->fb.screen_base = dma_alloc_writecombine(&fb->dev->dev, SZ_1M,
183 &dma, GFP_KERNEL);
184
185 if (!fb->fb.screen_base) {
186 printk(KERN_ERR "CLCD: unable to map framebuffer\n");
187 return -ENOMEM;
188 }
189
190 fb->fb.fix.smem_start = dma;
191 fb->fb.fix.smem_len = SZ_1M;
192
193 return 0;
194}
195
196static int aaec2000_clcd_mmap(struct clcd_fb *fb, struct vm_area_struct *vma)
197{
198 return dma_mmap_writecombine(&fb->dev->dev, vma,
199 fb->fb.screen_base,
200 fb->fb.fix.smem_start,
201 fb->fb.fix.smem_len);
202}
203
204static void aaec2000_clcd_remove(struct clcd_fb *fb)
205{
206 dma_free_writecombine(&fb->dev->dev, fb->fb.fix.smem_len,
207 fb->fb.screen_base, fb->fb.fix.smem_start);
208}
209
210static struct clcd_board clcd_plat_data = {
211 .name = "AAEC-2000",
212 .check = clcdfb_check,
213 .decode = clcdfb_decode,
214 .setup = aaec2000_clcd_setup,
215 .mmap = aaec2000_clcd_mmap,
216 .remove = aaec2000_clcd_remove,
217};
218
219static struct amba_device clcd_device = {
220 .dev = {
221 .bus_id = "mb:16",
222 .coherent_dma_mask = ~0,
223 .platform_data = &clcd_plat_data,
224 },
225 .res = {
226 .start = AAEC_CLCD_PHYS,
227 .end = AAEC_CLCD_PHYS + SZ_4K - 1,
228 .flags = IORESOURCE_MEM,
229 },
230 .irq = { INT_LCD, NO_IRQ },
231 .periphid = 0x41110,
232};
233
234static struct amba_device *amba_devs[] __initdata = {
235 &clcd_device,
236};
237
238static struct clk aaec2000_clcd_clk = {
239 .name = "CLCDCLK",
240};
241
242void __init aaec2000_set_clcd_plat_data(struct aaec2000_clcd_info *clcd)
243{
244 clcd_plat_data.enable = clcd->enable;
245 clcd_plat_data.disable = clcd->disable;
246 memcpy(&mach_clcd_panel, &clcd->panel, sizeof(struct clcd_panel));
247}
248
249static struct flash_platform_data aaec2000_flash_data = {
250 .map_name = "cfi_probe",
251 .width = 4,
252};
253
254static struct resource aaec2000_flash_resource = {
255 .start = AAEC_FLASH_BASE,
256 .end = AAEC_FLASH_BASE + AAEC_FLASH_SIZE,
257 .flags = IORESOURCE_MEM,
258};
259
260static struct platform_device aaec2000_flash_device = {
261 .name = "armflash",
262 .id = 0,
263 .dev = {
264 .platform_data = &aaec2000_flash_data,
265 },
266 .num_resources = 1,
267 .resource = &aaec2000_flash_resource,
268};
269
270static int __init aaec2000_init(void)
271{
272 int i;
273
274 clk_register(&aaec2000_clcd_clk);
275
276 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
277 struct amba_device *d = amba_devs[i];
278 amba_device_register(d, &iomem_resource);
279 }
280
281 platform_device_register(&aaec2000_flash_device);
282
283 return 0;
284};
285arch_initcall(aaec2000_init);
286
diff --git a/arch/arm/mach-aaec2000/core.h b/arch/arm/mach-aaec2000/core.h
index 91893d848c16..daefc0ea14a1 100644
--- a/arch/arm/mach-aaec2000/core.h
+++ b/arch/arm/mach-aaec2000/core.h
@@ -9,8 +9,19 @@
9 * 9 *
10 */ 10 */
11 11
12#include <asm/hardware/amba_clcd.h>
13
12struct sys_timer; 14struct sys_timer;
13 15
14extern struct sys_timer aaec2000_timer; 16extern struct sys_timer aaec2000_timer;
15extern void __init aaec2000_map_io(void); 17extern void __init aaec2000_map_io(void);
16extern void __init aaec2000_init_irq(void); 18extern void __init aaec2000_init_irq(void);
19
20struct aaec2000_clcd_info {
21 struct clcd_panel panel;
22 void (*disable)(struct clcd_fb *);
23 void (*enable)(struct clcd_fb *);
24};
25
26extern void __init aaec2000_set_clcd_plat_data(struct aaec2000_clcd_info *);
27