diff options
author | Bellido Nicolas <ml@acolin.be> | 2005-10-28 11:51:44 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2005-10-28 11:51:44 -0400 |
commit | 049eb3298a832a63c55bc8d8ea4cc881ab99f84b (patch) | |
tree | 93de3e93882c8e44ec9bd469c58bd999c12914d0 /arch/arm/mach-aaec2000 | |
parent | 4224b67c9a1d6cbf47b073970bd2db5a89557f92 (diff) |
[ARM] 3041/1: AAEC-2000 - CLCD controller platform glue
Patch from Bellido Nicolas
The AAEC-2000 has an ARM PrimeCell PL110 Color LCD Controller.
This patch contains the platform glue that will be used by specific boards.
Signed-off-by: Nicolas Bellido <ml@acolin.be>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-aaec2000')
-rw-r--r-- | arch/arm/mach-aaec2000/core.c | 90 | ||||
-rw-r--r-- | arch/arm/mach-aaec2000/core.h | 11 |
2 files changed, 101 insertions, 0 deletions
diff --git a/arch/arm/mach-aaec2000/core.c b/arch/arm/mach-aaec2000/core.c index 86c5149b1721..0c53dab80905 100644 --- a/arch/arm/mach-aaec2000/core.c +++ b/arch/arm/mach-aaec2000/core.c | |||
@@ -16,18 +16,24 @@ | |||
16 | #include <linux/device.h> | 16 | #include <linux/device.h> |
17 | #include <linux/list.h> | 17 | #include <linux/list.h> |
18 | #include <linux/errno.h> | 18 | #include <linux/errno.h> |
19 | #include <linux/dma-mapping.h> | ||
19 | #include <linux/interrupt.h> | 20 | #include <linux/interrupt.h> |
20 | #include <linux/timex.h> | 21 | #include <linux/timex.h> |
21 | #include <linux/signal.h> | 22 | #include <linux/signal.h> |
22 | 23 | ||
23 | #include <asm/hardware.h> | 24 | #include <asm/hardware.h> |
24 | #include <asm/irq.h> | 25 | #include <asm/irq.h> |
26 | #include <asm/sizes.h> | ||
27 | #include <asm/hardware/amba.h> | ||
25 | 28 | ||
26 | #include <asm/mach/flash.h> | 29 | #include <asm/mach/flash.h> |
27 | #include <asm/mach/irq.h> | 30 | #include <asm/mach/irq.h> |
28 | #include <asm/mach/time.h> | 31 | #include <asm/mach/time.h> |
29 | #include <asm/mach/map.h> | 32 | #include <asm/mach/map.h> |
30 | 33 | ||
34 | #include "core.h" | ||
35 | #include "clock.h" | ||
36 | |||
31 | /* | 37 | /* |
32 | * Common I/O mapping: | 38 | * Common I/O mapping: |
33 | * | 39 | * |
@@ -165,6 +171,81 @@ struct sys_timer aaec2000_timer = { | |||
165 | .offset = aaec2000_gettimeoffset, | 171 | .offset = aaec2000_gettimeoffset, |
166 | }; | 172 | }; |
167 | 173 | ||
174 | static struct clcd_panel mach_clcd_panel; | ||
175 | |||
176 | static 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 | |||
196 | static 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 | |||
204 | static 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 | |||
210 | static 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 | |||
219 | static 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 | |||
234 | static struct amba_device *amba_devs[] __initdata = { | ||
235 | &clcd_device, | ||
236 | }; | ||
237 | |||
238 | static struct clk aaec2000_clcd_clk = { | ||
239 | .name = "CLCDCLK", | ||
240 | }; | ||
241 | |||
242 | void __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 | |||
168 | static struct flash_platform_data aaec2000_flash_data = { | 249 | static struct flash_platform_data aaec2000_flash_data = { |
169 | .map_name = "cfi_probe", | 250 | .map_name = "cfi_probe", |
170 | .width = 4, | 251 | .width = 4, |
@@ -188,6 +269,15 @@ static struct platform_device aaec2000_flash_device = { | |||
188 | 269 | ||
189 | static int __init aaec2000_init(void) | 270 | static int __init aaec2000_init(void) |
190 | { | 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 | |||
191 | platform_device_register(&aaec2000_flash_device); | 281 | platform_device_register(&aaec2000_flash_device); |
192 | 282 | ||
193 | return 0; | 283 | return 0; |
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 | |||
12 | struct sys_timer; | 14 | struct sys_timer; |
13 | 15 | ||
14 | extern struct sys_timer aaec2000_timer; | 16 | extern struct sys_timer aaec2000_timer; |
15 | extern void __init aaec2000_map_io(void); | 17 | extern void __init aaec2000_map_io(void); |
16 | extern void __init aaec2000_init_irq(void); | 18 | extern void __init aaec2000_init_irq(void); |
19 | |||
20 | struct aaec2000_clcd_info { | ||
21 | struct clcd_panel panel; | ||
22 | void (*disable)(struct clcd_fb *); | ||
23 | void (*enable)(struct clcd_fb *); | ||
24 | }; | ||
25 | |||
26 | extern void __init aaec2000_set_clcd_plat_data(struct aaec2000_clcd_info *); | ||
27 | |||