summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWolfgang Denk <wd@denx.de>2010-02-03 20:03:46 +0100
committerWolfgang Denk <wd@denx.de>2010-02-03 20:03:46 +0100
commit0ae016f1ff6b06e94db52373efd08d106bfcecdf (patch)
treeb0ad230adfa839a5829fb7e4083c8706e594b2f6
parentd0750bc9e5932baf4c90eda2456106f21a26bdc1 (diff)
parenta6e42ed097220a82870a32f4e60ac8863a8b05ab (diff)
downloadu-boot-imx-0ae016f1ff6b06e94db52373efd08d106bfcecdf.zip
u-boot-imx-0ae016f1ff6b06e94db52373efd08d106bfcecdf.tar.gz
u-boot-imx-0ae016f1ff6b06e94db52373efd08d106bfcecdf.tar.bz2
Merge branch 'master' of git://git.denx.de/u-boot-video
-rw-r--r--common/lcd.c8
-rw-r--r--drivers/video/Makefile1
-rw-r--r--drivers/video/amba.c79
-rw-r--r--include/amba_clcd.h77
-rw-r--r--include/nomadik.h1
5 files changed, 158 insertions, 8 deletions
diff --git a/common/lcd.c b/common/lcd.c
index 4e31618..db799db 100644
--- a/common/lcd.c
+++ b/common/lcd.c
@@ -456,22 +456,14 @@ ulong lcd_setmem (ulong addr)
static void lcd_setfgcolor (int color)
{
-#ifdef CONFIG_ATMEL_LCD
lcd_color_fg = color;
-#else
- lcd_color_fg = color & 0x0F;
-#endif
}
/*----------------------------------------------------------------------*/
static void lcd_setbgcolor (int color)
{
-#ifdef CONFIG_ATMEL_LCD
lcd_color_bg = color;
-#else
- lcd_color_bg = color & 0x0F;
-#endif
}
/*----------------------------------------------------------------------*/
diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index bb6b5a0..a5e339a 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -29,6 +29,7 @@ COBJS-$(CONFIG_ATI_RADEON_FB) += ati_radeon_fb.o
COBJS-$(CONFIG_ATMEL_LCD) += atmel_lcdfb.o
COBJS-$(CONFIG_CFB_CONSOLE) += cfb_console.o
COBJS-$(CONFIG_S6E63D6) += s6e63d6.o
+COBJS-$(CONFIG_VIDEO_AMBA) += amba.o
COBJS-$(CONFIG_VIDEO_CT69000) += ct69000.o
COBJS-$(CONFIG_VIDEO_MB862xx) += mb862xx.o
COBJS-$(CONFIG_VIDEO_MX3) += mx3fb.o
diff --git a/drivers/video/amba.c b/drivers/video/amba.c
new file mode 100644
index 0000000..ffa1c39
--- /dev/null
+++ b/drivers/video/amba.c
@@ -0,0 +1,79 @@
+/*
+ * Driver for AMBA PrimeCell CLCD
+ *
+ * Copyright (C) 2009 Alessandro Rubini
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <asm/io.h>
+#include <lcd.h>
+#include <amba_clcd.h>
+
+/* These variables are required by lcd.c -- although it sets them by itself */
+int lcd_line_length;
+int lcd_color_fg;
+int lcd_color_bg;
+void *lcd_base;
+void *lcd_console_address;
+short console_col;
+short console_row;
+
+/*
+ * To use this driver you need to provide the following in board files:
+ * a panel_info definition
+ * an lcd_enable function (can't define a weak default with current code)
+ */
+
+/* There is nothing to do with color registers, we use true color */
+void lcd_setcolreg(ushort regno, ushort red, ushort green, ushort blue)
+{
+ return;
+}
+
+/* Low level initialization of the logic cell: depends on panel_info */
+void lcd_ctrl_init(void *lcdbase)
+{
+ struct clcd_config *config;
+ struct clcd_registers *regs;
+ u32 cntl;
+
+ config = panel_info.priv;
+ regs = config->address;
+ cntl = config->cntl & ~CNTL_LCDEN;
+
+ /* Lazily, just copy the registers over: first control with disable */
+ writel(cntl, &regs->cntl);
+
+ writel(config->tim0, &regs->tim0);
+ writel(config->tim1, &regs->tim1);
+ writel(config->tim2, &regs->tim2);
+ writel(config->tim3, &regs->tim3);
+ writel((u32)lcdbase, &regs->ubas);
+ /* finally, enable */
+ writel(cntl | CNTL_LCDEN, &regs->cntl);
+}
+
+/* This is trivial, and copied from atmel_lcdfb.c */
+ulong calc_fbsize(void)
+{
+ return ((panel_info.vl_col * panel_info.vl_row *
+ NBITS(panel_info.vl_bpix)) / 8) + PAGE_SIZE;
+}
diff --git a/include/amba_clcd.h b/include/amba_clcd.h
new file mode 100644
index 0000000..db80517
--- /dev/null
+++ b/include/amba_clcd.h
@@ -0,0 +1,77 @@
+/*
+ * Register definitions for the AMBA CLCD logic cell.
+ *
+ * derived from David A Rusling, although rearranged as a C structure
+ * linux/include/asm-arm/hardware/amba_clcd.h -- Integrator LCD panel.
+ *
+ * Copyright (C) 2001 ARM Limited
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file COPYING in the main directory of this archive
+ * for more details.
+ */
+
+/*
+ * CLCD Controller Internal Register addresses
+ */
+struct clcd_registers {
+ u32 tim0; /* 0x00 */
+ u32 tim1;
+ u32 tim2;
+ u32 tim3;
+ u32 ubas; /* 0x10 */
+ u32 lbas;
+#if !defined(CONFIG_ARCH_VERSATILE) && !defined(CONFIG_ARCH_REALVIEW)
+ u32 ienb;
+ u32 cntl;
+#else /* Someone rearranged these two registers on the Versatile */
+ u32 cntl;
+ u32 ienb;
+#endif
+ u32 stat; /* 0x20 */
+ u32 intr;
+ u32 ucur;
+ u32 lcur;
+ u32 unused[0x74]; /* 0x030..0x1ff */
+ u32 palette[0x80]; /* 0x200..0x3ff */
+};
+
+/* Bit definition for TIM2 */
+#define TIM2_CLKSEL (1 << 5)
+#define TIM2_IVS (1 << 11)
+#define TIM2_IHS (1 << 12)
+#define TIM2_IPC (1 << 13)
+#define TIM2_IOE (1 << 14)
+#define TIM2_BCD (1 << 26)
+
+/* Bit definitions for control register */
+#define CNTL_LCDEN (1 << 0)
+#define CNTL_LCDBPP1 (0 << 1)
+#define CNTL_LCDBPP2 (1 << 1)
+#define CNTL_LCDBPP4 (2 << 1)
+#define CNTL_LCDBPP8 (3 << 1)
+#define CNTL_LCDBPP16 (4 << 1)
+#define CNTL_LCDBPP16_565 (6 << 1)
+#define CNTL_LCDBPP24 (5 << 1)
+#define CNTL_LCDBW (1 << 4)
+#define CNTL_LCDTFT (1 << 5)
+#define CNTL_LCDMONO8 (1 << 6)
+#define CNTL_LCDDUAL (1 << 7)
+#define CNTL_BGR (1 << 8)
+#define CNTL_BEBO (1 << 9)
+#define CNTL_BEPO (1 << 10)
+#define CNTL_LCDPWR (1 << 11)
+#define CNTL_LCDVCOMP(x) ((x) << 12)
+#define CNTL_LDMAFIFOTIME (1 << 15)
+#define CNTL_WATERMARK (1 << 16)
+
+/* u-boot specific: information passed by the board file */
+struct clcd_config {
+ struct clcd_registers *address;
+ u32 tim0;
+ u32 tim1;
+ u32 tim2;
+ u32 tim3;
+ u32 cntl;
+ unsigned long pixclock;
+};
diff --git a/include/nomadik.h b/include/nomadik.h
index d9405fd..ea65b2d 100644
--- a/include/nomadik.h
+++ b/include/nomadik.h
@@ -4,6 +4,7 @@
#define __NOMADIK_H__
/* Base addresses of our peripherals */
+#define NOMADIK_CLCDC_BASE 0x10120000 /* CLCD Controller */
#define NOMADIK_SRC_BASE 0x101E0000 /* System and Reset Cnt */
#define NOMADIK_PMU_BASE 0x101E9000 /* Power Management Unit */
#define NOMADIK_MPMC_BASE 0x10110000 /* SDRAM Controller */