[ARM] 3041/1: AAEC-2000 - CLCD controller platform glue
authorBellido Nicolas <ml@acolin.be>
Fri, 28 Oct 2005 15:51:44 +0000 (16:51 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Fri, 28 Oct 2005 15:51:44 +0000 (16:51 +0100)
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>
arch/arm/Kconfig
arch/arm/mach-aaec2000/core.c
arch/arm/mach-aaec2000/core.h
include/asm-arm/arch-aaec2000/aaec2000.h

index d885cc48bae1d1820b96b711ab3cab60c8558cdb..682367bd0f653d63a19b7120959e18cc3d1da383 100644 (file)
@@ -204,6 +204,7 @@ config ARCH_H720X
 
 config ARCH_AAEC2000
        bool "Agilent AAEC-2000 based"
+       select ARM_AMBA
        help
          This enables support for systems based on the Agilent AAEC-2000
 
index 86c5149b1721250e4ea7add3e89dcf750c5c98dc..0c53dab8090593028381a6c23cdf265779745eb6 100644 (file)
 #include <linux/device.h>
 #include <linux/list.h>
 #include <linux/errno.h>
+#include <linux/dma-mapping.h>
 #include <linux/interrupt.h>
 #include <linux/timex.h>
 #include <linux/signal.h>
 
 #include <asm/hardware.h>
 #include <asm/irq.h>
+#include <asm/sizes.h>
+#include <asm/hardware/amba.h>
 
 #include <asm/mach/flash.h>
 #include <asm/mach/irq.h>
 #include <asm/mach/time.h>
 #include <asm/mach/map.h>
 
+#include "core.h"
+#include "clock.h"
+
 /*
  * Common I/O mapping:
  *
@@ -165,6 +171,81 @@ struct sys_timer aaec2000_timer = {
        .offset         = aaec2000_gettimeoffset,
 };
 
+static struct clcd_panel mach_clcd_panel;
+
+static int aaec2000_clcd_setup(struct clcd_fb *fb)
+{
+       dma_addr_t dma;
+
+       fb->panel = &mach_clcd_panel;
+
+       fb->fb.screen_base = dma_alloc_writecombine(&fb->dev->dev, SZ_1M,
+                       &dma, GFP_KERNEL);
+
+       if (!fb->fb.screen_base) {
+               printk(KERN_ERR "CLCD: unable to map framebuffer\n");
+               return -ENOMEM;
+       }
+
+       fb->fb.fix.smem_start = dma;
+       fb->fb.fix.smem_len = SZ_1M;
+
+       return 0;
+}
+
+static int aaec2000_clcd_mmap(struct clcd_fb *fb, struct vm_area_struct *vma)
+{
+       return dma_mmap_writecombine(&fb->dev->dev, vma,
+                       fb->fb.screen_base,
+                       fb->fb.fix.smem_start,
+                       fb->fb.fix.smem_len);
+}
+
+static void aaec2000_clcd_remove(struct clcd_fb *fb)
+{
+       dma_free_writecombine(&fb->dev->dev, fb->fb.fix.smem_len,
+                       fb->fb.screen_base, fb->fb.fix.smem_start);
+}
+
+static struct clcd_board clcd_plat_data = {
+       .name   = "AAEC-2000",
+       .check  = clcdfb_check,
+       .decode = clcdfb_decode,
+       .setup  = aaec2000_clcd_setup,
+       .mmap   = aaec2000_clcd_mmap,
+       .remove = aaec2000_clcd_remove,
+};
+
+static struct amba_device clcd_device = {
+       .dev            = {
+               .bus_id                 = "mb:16",
+               .coherent_dma_mask      = ~0,
+               .platform_data          = &clcd_plat_data,
+       },
+       .res            = {
+               .start                  = AAEC_CLCD_PHYS,
+               .end                    = AAEC_CLCD_PHYS + SZ_4K - 1,
+               .flags                  = IORESOURCE_MEM,
+       },
+       .irq            = { INT_LCD, NO_IRQ },
+       .periphid       = 0x41110,
+};
+
+static struct amba_device *amba_devs[] __initdata = {
+       &clcd_device,
+};
+
+static struct clk aaec2000_clcd_clk = {
+       .name = "CLCDCLK",
+};
+
+void __init aaec2000_set_clcd_plat_data(struct aaec2000_clcd_info *clcd)
+{
+       clcd_plat_data.enable = clcd->enable;
+       clcd_plat_data.disable = clcd->disable;
+       memcpy(&mach_clcd_panel, &clcd->panel, sizeof(struct clcd_panel));
+}
+
 static struct flash_platform_data aaec2000_flash_data = {
        .map_name       = "cfi_probe",
        .width          = 4,
@@ -188,6 +269,15 @@ static struct platform_device aaec2000_flash_device = {
 
 static int __init aaec2000_init(void)
 {
+       int i;
+
+       clk_register(&aaec2000_clcd_clk);
+
+       for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
+               struct amba_device *d = amba_devs[i];
+               amba_device_register(d, &iomem_resource);
+       }
+
        platform_device_register(&aaec2000_flash_device);
 
        return 0;
index 91893d848c165e67ff16079e9dbac8d4c626f4bf..daefc0ea14a10236c8aca9e068dda22f6cd24540 100644 (file)
@@ -9,8 +9,19 @@
  *
  */
 
+#include <asm/hardware/amba_clcd.h>
+
 struct sys_timer;
 
 extern struct sys_timer aaec2000_timer;
 extern void __init aaec2000_map_io(void);
 extern void __init aaec2000_init_irq(void);
+
+struct aaec2000_clcd_info {
+       struct clcd_panel panel;
+       void (*disable)(struct clcd_fb *);
+       void (*enable)(struct clcd_fb *);
+};
+
+extern void __init aaec2000_set_clcd_plat_data(struct aaec2000_clcd_info *);
+
index dfb09389ebc121e47e8d39e649a231d440cc028b..002227924b9fa09c48a80b909ecb7329d219cce2 100644 (file)
 #define AAEC_GPIO_PINMUX_CODECON       (1 << 2)
 #define AAEC_GPIO_PINMUX_UART3CON      (1 << 3)
 
+/* LCD Controller */
+#define AAEC_CLCD_PHYS 0x80003000
+
 #endif /* __ARM_ARCH_AAEC2000_H */