Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 049eb329 authored by Bellido Nicolas's avatar Bellido Nicolas Committed by Russell King
Browse files

[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: default avatarNicolas Bellido <ml@acolin.be>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 4224b67c
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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

+90 −0
Original line number Diff line number Diff line
@@ -16,18 +16,24 @@
#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;
+11 −0
Original line number Diff line number Diff line
@@ -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 *);
+3 −0
Original line number Diff line number Diff line
@@ -201,4 +201,7 @@
#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 */