public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v2 0/5] Exynos: Support for display drivers
@ 2012-09-19 13:01 Piotr Wilczek
  2012-09-19 13:01 ` [U-Boot] [PATCH v2 1/5] misc:max8998 Add LDO macros Piotr Wilczek
                   ` (5 more replies)
  0 siblings, 6 replies; 32+ messages in thread
From: Piotr Wilczek @ 2012-09-19 13:01 UTC (permalink / raw)
  To: u-boot

This patchset add support for display on Universal C210 board.
Max8998 is modified to power on display, new driver ld9040
and support for LCD display on universal C210 board is added.

Changes in v2:
- removed unnecessary function for fimd clock set;
- code cleanup
- removed patch for fix exynos4_fb structure

Piotr Wilczek (5):
  misc:max8998 Add LDO macros
  drivers: video: Add ld9040 video driver
  arm: exynos4: cpu: Add definition for display
  drivers: video: fix image position
  arm: exynos4: universal_C210: add display support

 arch/arm/include/asm/arch-exynos/cpu.h   |    1 +
 board/samsung/universal_c210/universal.c |  201 +++++++++++++++++++++++++++---
 drivers/video/Makefile                   |    1 +
 drivers/video/exynos_fb.c                |   15 ++-
 drivers/video/ld9040.c                   |  147 ++++++++++++++++++++++
 include/configs/s5pc210_universal.h      |   13 ++
 include/ld9040.h                         |   32 +++++
 include/max8998_pmic.h                   |    2 +
 8 files changed, 392 insertions(+), 20 deletions(-)
 create mode 100644 drivers/video/ld9040.c
 create mode 100644 include/ld9040.h

-- 
1.7.5.4

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v2 1/5] misc:max8998 Add LDO macros
  2012-09-19 13:01 [U-Boot] [PATCH v2 0/5] Exynos: Support for display drivers Piotr Wilczek
@ 2012-09-19 13:01 ` Piotr Wilczek
  2012-09-24 13:04   ` [U-Boot] [PATCH v3 0/5] Exynos: Support for display drivers Piotr Wilczek
  2012-09-19 13:01 ` [U-Boot] [PATCH v2 2/5] drivers: video: Add ld9040 video driver Piotr Wilczek
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 32+ messages in thread
From: Piotr Wilczek @ 2012-09-19 13:01 UTC (permalink / raw)
  To: u-boot

Add LDO7 and LDO17 macros to max8998_pmic.h necessary to power on the LCD.

Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
CC: Minkyu Kang <mk7.kang@samsung.com>

Changes in v2:
- none.
---
 include/max8998_pmic.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/include/max8998_pmic.h b/include/max8998_pmic.h
index ca21f88..0e559f9 100644
--- a/include/max8998_pmic.h
+++ b/include/max8998_pmic.h
@@ -76,7 +76,9 @@ enum {
 
 #define MAX8998_LDO3		(1 << 2)
 #define MAX8998_LDO4		(1 << 1)
+#define MAX8998_LDO7		(1 << 6)
 #define MAX8998_LDO8		(1 << 5)
+#define MAX8998_LDO17		(1 << 4)
 #define MAX8998_SAFEOUT1	(1 << 4)
 
 #define MAX8998_I2C_ADDR        (0xCC >> 1)
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v2 2/5] drivers: video: Add ld9040 video driver
  2012-09-19 13:01 [U-Boot] [PATCH v2 0/5] Exynos: Support for display drivers Piotr Wilczek
  2012-09-19 13:01 ` [U-Boot] [PATCH v2 1/5] misc:max8998 Add LDO macros Piotr Wilczek
@ 2012-09-19 13:01 ` Piotr Wilczek
  2012-09-20  9:57   ` Jaehoon Chung
  2012-09-19 13:01 ` [U-Boot] [PATCH v2 3/5] arm: exynos4: cpu: Add definition for display Piotr Wilczek
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 32+ messages in thread
From: Piotr Wilczek @ 2012-09-19 13:01 UTC (permalink / raw)
  To: u-boot

This patch add ld9040 video driver:
new file:   drivers/video/ld9040.c
new file:   include/ld9040.h
modified:   drivers/video/Makefile

This patch depends on software SPI:
<1346228122-13444-2-git-send-email-p.wilczek@samsung.com>

Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
CC: Minkyu Kang <mk7.kang@samsung.com>

Changes in v2:
- none.
---
 drivers/video/Makefile |    1 +
 drivers/video/ld9040.c |  147 ++++++++++++++++++++++++++++++++++++++++++++++++
 include/ld9040.h       |   32 ++++++++++
 3 files changed, 180 insertions(+), 0 deletions(-)
 create mode 100644 drivers/video/ld9040.c
 create mode 100644 include/ld9040.h

diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index ebb6da8..247b867 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -37,6 +37,7 @@ COBJS-$(CONFIG_EXYNOS_PWM_BL) += exynos_pwm_bl.o
 COBJS-$(CONFIG_FSL_DIU_FB) += fsl_diu_fb.o videomodes.o
 COBJS-$(CONFIG_S6E8AX0) += s6e8ax0.o
 COBJS-$(CONFIG_S6E63D6) += s6e63d6.o
+COBJS-$(CONFIG_LD9040) += ld9040.o
 COBJS-$(CONFIG_SED156X) += sed156x.o
 COBJS-$(CONFIG_VIDEO_AMBA) += amba.o
 COBJS-$(CONFIG_VIDEO_CT69000) += ct69000.o videomodes.o
diff --git a/drivers/video/ld9040.c b/drivers/video/ld9040.c
new file mode 100644
index 0000000..6e94086
--- /dev/null
+++ b/drivers/video/ld9040.c
@@ -0,0 +1,147 @@
+/*
+ * ld9040 AMOLED LCD panel driver.
+ *
+ * Copyright (C) 2012 Samsung Electronics
+ * Donghwa Lee <dh09.lee@samsung.com>
+ *
+ * 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 <spi.h>
+
+/* these machine specific platform data would be setting at universal.c */
+struct spi_platform_data *ld9040;
+
+static const unsigned char SEQ_SWRESET[] = {
+	0x01,
+};
+
+static const unsigned char SEQ_USER_SETTING[] = {
+	0xF0, 0x5A, 0x5A
+};
+
+static const unsigned char SEQ_ELVSS_ON[] = {
+	0xB1, 0x0D, 0x00, 0x16,
+};
+
+static const unsigned char SEQ_TEMP_SWIRE[] = {
+	0xB2, 0x06, 0x06, 0x06, 0x06,
+};
+
+static const unsigned char SEQ_GTCON[] = {
+	0xF7, 0x09, 0x00, 0x00,
+};
+
+static const unsigned char SEQ_PANEL_CONDITION[] = {
+	0xF8, 0x05, 0x65, 0x96, 0x71, 0x7D, 0x19, 0x3B,
+	0x0D, 0x19, 0x7E, 0x0D, 0xE2, 0x00, 0x00, 0x7E,
+	0x7D, 0x07, 0x07, 0x20, 0x20, 0x20, 0x02, 0x02,
+};
+
+static const unsigned char SEQ_GAMMA_SET1[] = {
+	0xF9, 0x00, 0xA7, 0xB4, 0xAE, 0xBF, 0x00, 0x91,
+	0x00, 0xB2, 0xB4, 0xAA, 0xBB, 0x00, 0xAC, 0x00,
+	0xB3, 0xB1, 0xAA, 0xBC, 0x00, 0xB3,
+};
+
+static const unsigned char SEQ_GAMMA_CTRL[] = {
+	0xFB, 0x02, 0x5A,
+};
+
+static const unsigned char SEQ_APON[] = {
+	0xF3, 0x00, 0x00, 0x00, 0x0A, 0x02,
+};
+
+static const unsigned char SEQ_DISPCTL[] = {
+	0xF2, 0x02, 0x08, 0x08, 0x10, 0x10,
+};
+
+static const unsigned char SEQ_MANPWR[] = {
+	0xB0, 0x04,
+};
+
+static const unsigned char SEQ_PWR_CTRL[] = {
+	0xF4, 0x0A, 0x87, 0x25, 0x6A, 0x44, 0x02, 0x88,
+};
+
+static const unsigned char SEQ_SLPOUT[] = {
+	0x11,
+};
+
+static const unsigned char SEQ_SLPIN[] = {
+	0x10,
+};
+
+static const unsigned char SEQ_DISPON[] = {
+	0x29,
+};
+
+static const unsigned char SEQ_DISPOFF[] = {
+	0x28,
+};
+
+static void ld9040_spi_write(const unsigned char *wbuf, unsigned int size_cmd)
+{
+	int i = 0;
+
+	/*
+	 * Data are transmitted in 9-bit words:
+	 * the first bit is command/parameter, the other are the value.
+	 * The value's LSB is shifted to MSB position, to be sent as 9th bit
+	 */
+
+	unsigned int data_out = 0, data_in = 0;
+	for (i = 0; i < size_cmd; i++) {
+		data_out = wbuf[i] >> 1;
+		if (i != 0)
+			data_out += 0x0080;
+		if (wbuf[i] & 0x01)
+			data_out += 0x8000;
+		spi_xfer(NULL, 9, &data_out, &data_in, SPI_XFER_BEGIN);
+	}
+}
+
+void ld9040_cfg_ldo(void)
+{
+	udelay(10);
+
+	ld9040_spi_write(SEQ_USER_SETTING,
+					ARRAY_SIZE(SEQ_USER_SETTING));
+	ld9040_spi_write(SEQ_PANEL_CONDITION,
+					ARRAY_SIZE(SEQ_PANEL_CONDITION));
+	ld9040_spi_write(SEQ_DISPCTL, ARRAY_SIZE(SEQ_DISPCTL));
+	ld9040_spi_write(SEQ_MANPWR, ARRAY_SIZE(SEQ_MANPWR));
+	ld9040_spi_write(SEQ_PWR_CTRL, ARRAY_SIZE(SEQ_PWR_CTRL));
+	ld9040_spi_write(SEQ_ELVSS_ON, ARRAY_SIZE(SEQ_ELVSS_ON));
+	ld9040_spi_write(SEQ_GTCON, ARRAY_SIZE(SEQ_GTCON));
+	ld9040_spi_write(SEQ_GAMMA_SET1, ARRAY_SIZE(SEQ_GAMMA_SET1));
+	ld9040_spi_write(SEQ_GAMMA_CTRL, ARRAY_SIZE(SEQ_GAMMA_CTRL));
+	ld9040_spi_write(SEQ_SLPOUT, ARRAY_SIZE(SEQ_SLPOUT));
+
+	udelay(120);
+}
+
+void ld9040_enable_ldo(unsigned int onoff)
+{
+	if (onoff)
+		ld9040_spi_write(SEQ_DISPON, ARRAY_SIZE(SEQ_DISPON));
+	else
+		ld9040_spi_write(SEQ_DISPOFF, ARRAY_SIZE(SEQ_DISPOFF));
+}
diff --git a/include/ld9040.h b/include/ld9040.h
new file mode 100644
index 0000000..fe99390
--- /dev/null
+++ b/include/ld9040.h
@@ -0,0 +1,32 @@
+/*
+ * ld9040 AMOLED LCD panel driver.
+ *
+ * Copyright (C) 2012 Samsung Electronics
+ * Donghwa Lee <dh09.lee@samsung.com>
+ *
+ * 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
+ */
+
+#ifndef __LD9040_H_
+#define __LD9040_H_
+
+void ld9040_cfg_ldo(void);
+void ld9040_enable_ldo(unsigned int onoff);
+
+#endif /* __LD9040_H_ */
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v2 3/5] arm: exynos4: cpu: Add definition for display
  2012-09-19 13:01 [U-Boot] [PATCH v2 0/5] Exynos: Support for display drivers Piotr Wilczek
  2012-09-19 13:01 ` [U-Boot] [PATCH v2 1/5] misc:max8998 Add LDO macros Piotr Wilczek
  2012-09-19 13:01 ` [U-Boot] [PATCH v2 2/5] drivers: video: Add ld9040 video driver Piotr Wilczek
@ 2012-09-19 13:01 ` Piotr Wilczek
  2012-09-19 13:01 ` [U-Boot] [PATCH v2 4/5] drivers: video: fix image position Piotr Wilczek
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 32+ messages in thread
From: Piotr Wilczek @ 2012-09-19 13:01 UTC (permalink / raw)
  To: u-boot

Add EXYNOS4_DISPLAY_CONTROL definition

Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
CC: Minkyu Kang <mk7.kang@samsung.com>

Changes in v2:
- removed definions for fimd.
---
 arch/arm/include/asm/arch-exynos/cpu.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/arm/include/asm/arch-exynos/cpu.h b/arch/arm/include/asm/arch-exynos/cpu.h
index 2cd4ae1..5056b37 100644
--- a/arch/arm/include/asm/arch-exynos/cpu.h
+++ b/arch/arm/include/asm/arch-exynos/cpu.h
@@ -54,6 +54,7 @@
 #define EXYNOS4_PWMTIMER_BASE		0x139D0000
 #define EXYNOS4_MODEM_BASE		0x13A00000
 #define EXYNOS4_USBPHY_CONTROL		0x10020704
+#define EXYNOS4_DISPLAY_CONTROL		0x10010210
 
 #define EXYNOS4_GPIO_PART4_BASE		DEVICE_NOT_AVAILABLE
 #define EXYNOS4_DP_BASE			DEVICE_NOT_AVAILABLE
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v2 4/5] drivers: video: fix image position
  2012-09-19 13:01 [U-Boot] [PATCH v2 0/5] Exynos: Support for display drivers Piotr Wilczek
                   ` (2 preceding siblings ...)
  2012-09-19 13:01 ` [U-Boot] [PATCH v2 3/5] arm: exynos4: cpu: Add definition for display Piotr Wilczek
@ 2012-09-19 13:01 ` Piotr Wilczek
  2012-09-19 13:01 ` [U-Boot] [PATCH v2 5/5] arm: exynos4: universal_C210: add display support Piotr Wilczek
  2012-09-20  9:56 ` [U-Boot] [PATCH v2 0/5] Exynos: Support for display drivers Jaehoon Chung
  5 siblings, 0 replies; 32+ messages in thread
From: Piotr Wilczek @ 2012-09-19 13:01 UTC (permalink / raw)
  To: u-boot

This patch fixes image position on screen when images's height or width is biger then the lcd's.

Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
CC: Minkyu Kang <mk7.kang@samsung.com>

Changes in v2:
- none.
---
 drivers/video/exynos_fb.c |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/video/exynos_fb.c b/drivers/video/exynos_fb.c
index e31a0fd..d9a3f9a 100644
--- a/drivers/video/exynos_fb.c
+++ b/drivers/video/exynos_fb.c
@@ -70,8 +70,19 @@ static void draw_logo(void)
 	int x, y;
 	ulong addr;
 
-	x = ((panel_width - panel_info.logo_width) >> 1);
-	y = ((panel_height - panel_info.logo_height) >> 1) - 4;
+	if (panel_width >= panel_info.logo_width) {
+		x = ((panel_width - panel_info.logo_width) >> 1);
+	} else {
+		x = 0;
+		printf("Warning: image width is bigger than display width\n");
+	}
+
+	if (panel_height >= panel_info.logo_height) {
+		y = ((panel_height - panel_info.logo_height) >> 1) - 4;
+	} else {
+		y = 0;
+		printf("Warning: image height is bigger than display height\n");
+	}
 
 	addr = panel_info.logo_addr;
 	bmp_display(addr, x, y);
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v2 5/5] arm: exynos4: universal_C210: add display support
  2012-09-19 13:01 [U-Boot] [PATCH v2 0/5] Exynos: Support for display drivers Piotr Wilczek
                   ` (3 preceding siblings ...)
  2012-09-19 13:01 ` [U-Boot] [PATCH v2 4/5] drivers: video: fix image position Piotr Wilczek
@ 2012-09-19 13:01 ` Piotr Wilczek
  2012-09-20  9:56 ` [U-Boot] [PATCH v2 0/5] Exynos: Support for display drivers Jaehoon Chung
  5 siblings, 0 replies; 32+ messages in thread
From: Piotr Wilczek @ 2012-09-19 13:01 UTC (permalink / raw)
  To: u-boot

This patch add support for display on Universal C210 board.
Width of displayed logo must be not bigger than 480 pixel and
is limited by width of the screen.
Tizen logo size is 520x120 pixels should be reseized.

Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
CC: Minkyu Kang <mk7.kang@samsung.com>

Changes in v2:
- removed unnecessary function for fimd clock set;
- removed unnecessary return;
- moved init_pmic_lcd to CONFIG_PMIC
---
 board/samsung/universal_c210/universal.c |  201 +++++++++++++++++++++++++++---
 include/configs/s5pc210_universal.h      |   13 ++
 2 files changed, 196 insertions(+), 18 deletions(-)

diff --git a/board/samsung/universal_c210/universal.c b/board/samsung/universal_c210/universal.c
index 4a23b1c..5128bef 100644
--- a/board/samsung/universal_c210/universal.c
+++ b/board/samsung/universal_c210/universal.c
@@ -23,6 +23,7 @@
  */
 
 #include <common.h>
+#include <lcd.h>
 #include <asm/io.h>
 #include <spi.h>
 #include <asm/arch/adc.h>
@@ -34,6 +35,8 @@
 #include <asm/arch/cpu.h>
 #include <max8998_pmic.h>
 #include <asm/arch/watchdog.h>
+#include <libtizen.h>
+#include <ld9040.h>
 #if defined(CONFIG_SOFT_SPI)
 # include <asm/gpio.h>
 #endif
@@ -56,24 +59,6 @@ static int get_hwrev(void)
 
 static void check_hw_revision(void);
 
-int board_init(void)
-{
-	gpio1 = (struct exynos4_gpio_part1 *) EXYNOS4_GPIO_PART1_BASE;
-	gpio2 = (struct exynos4_gpio_part2 *) EXYNOS4_GPIO_PART2_BASE;
-
-	gd->bd->bi_arch_number = MACH_TYPE_UNIVERSAL_C210;
-	gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
-
-#if defined(CONFIG_PMIC)
-	pmic_init();
-#endif
-
-	check_hw_revision();
-	printf("HW Revision:\t0x%x\n", board_rev);
-
-	return 0;
-}
-
 int dram_init(void)
 {
 	gd->ram_size = get_ram_size((long *)PHYS_SDRAM_1, PHYS_SDRAM_1_SIZE) +
@@ -323,3 +308,183 @@ int  spi_cs_is_valid(unsigned int bus, unsigned int cs)
 	return bus == 0 && cs == 0;
 }
 
+static void init_pmic_lcd(void)
+{
+	unsigned char val;
+	int ret = 0;
+
+	struct pmic *p = get_pmic();
+
+	if (pmic_probe(p))
+		return;
+
+	/* LDO7 1.8V */
+	val = 0x02; /* (1800 - 1600) / 100; */
+	ret |= pmic_reg_write(p,  MAX8998_REG_LDO7, val);
+
+	/* LDO17 3.0V */
+	val = 0xe; /* (3000 - 1600) / 100; */
+	ret |= pmic_reg_write(p,  MAX8998_REG_LDO17, val);
+
+	/* Disable unneeded regulators */
+	/*
+	 * ONOFF1
+	 * Buck1 ON, Buck2 OFF, Buck3 ON, Buck4 ON
+	 * LDO2 ON, LDO3 OFF, LDO4 OFF, LDO5 ON
+	 */
+	val = 0xB9;
+	ret |= pmic_reg_write(p,  MAX8998_REG_ONOFF1, val);
+
+	/* ONOFF2
+	 * LDO6 OFF, LDO7 ON, LDO8 OFF, LDO9 ON,
+	 * LDO10 OFF, LDO11 OFF, LDO12 OFF, LDO13 OFF
+	 */
+	val = 0x50;
+	ret |= pmic_reg_write(p,  MAX8998_REG_ONOFF2, val);
+
+	/* ONOFF3
+	 * LDO14 OFF, LDO15 OFF, LGO16 OFF, LDO17 OFF
+	 * EPWRHOLD OFF, EBATTMON OFF, ELBCNFG2 OFF, ELBCNFG1 OFF
+	 */
+	val = 0x00;
+	ret |= pmic_reg_write(p,  MAX8998_REG_ONOFF3, val);
+
+	if (ret)
+		puts("LCD pmic initialisation error!\n");
+}
+
+static void lcd_cfg_gpio(void)
+{
+	unsigned int i, f3_end = 4;
+
+	for (i = 0; i < 8; i++) {
+		/* set GPF0,1,2[0:7] for RGB Interface and Data lines (32bit) */
+		s5p_gpio_cfg_pin(&gpio1->f0, i, GPIO_FUNC(2));
+		s5p_gpio_cfg_pin(&gpio1->f1, i, GPIO_FUNC(2));
+		s5p_gpio_cfg_pin(&gpio1->f2, i, GPIO_FUNC(2));
+		/* pull-up/down disable */
+		s5p_gpio_set_pull(&gpio1->f0, i, GPIO_PULL_NONE);
+		s5p_gpio_set_pull(&gpio1->f1, i, GPIO_PULL_NONE);
+		s5p_gpio_set_pull(&gpio1->f2, i, GPIO_PULL_NONE);
+
+		/* drive strength to max (24bit) */
+		s5p_gpio_set_drv(&gpio1->f0, i, GPIO_DRV_4X);
+		s5p_gpio_set_rate(&gpio1->f0, i, GPIO_DRV_SLOW);
+		s5p_gpio_set_drv(&gpio1->f1, i, GPIO_DRV_4X);
+		s5p_gpio_set_rate(&gpio1->f1, i, GPIO_DRV_SLOW);
+		s5p_gpio_set_drv(&gpio1->f2, i, GPIO_DRV_4X);
+		s5p_gpio_set_rate(&gpio1->f0, i, GPIO_DRV_SLOW);
+	}
+
+	for (i = 0; i < f3_end; i++) {
+		/* set GPF3[0:3] for RGB Interface and Data lines (32bit) */
+		s5p_gpio_cfg_pin(&gpio1->f3, i, GPIO_FUNC(2));
+		/* pull-up/down disable */
+		s5p_gpio_set_pull(&gpio1->f3, i, GPIO_PULL_NONE);
+		/* drive strength to max (24bit) */
+		s5p_gpio_set_drv(&gpio1->f3, i, GPIO_DRV_4X);
+		s5p_gpio_set_rate(&gpio1->f3, i, GPIO_DRV_SLOW);
+	}
+
+	/* gpio pad configuration for LCD reset. */
+	s5p_gpio_cfg_pin(&gpio2->y4, 5, GPIO_OUTPUT);
+
+	spi_init();
+}
+
+static void reset_lcd(void)
+{
+	s5p_gpio_set_value(&gpio2->y4, 5, 1);
+	udelay(10000);
+	s5p_gpio_set_value(&gpio2->y4, 5, 0);
+	udelay(10000);
+	s5p_gpio_set_value(&gpio2->y4, 5, 1);
+	udelay(100);
+}
+
+static void lcd_power_on(void)
+{
+	struct pmic *p = get_pmic();
+
+	if (pmic_probe(p))
+		return;
+
+	pmic_set_output(p, MAX8998_REG_ONOFF3, MAX8998_LDO17, LDO_ON);
+	pmic_set_output(p, MAX8998_REG_ONOFF2, MAX8998_LDO7, LDO_ON);
+}
+
+vidinfo_t panel_info = {
+	.vl_freq	= 60,
+	.vl_col		= 480,
+	.vl_row		= 800,
+	.vl_width	= 480,
+	.vl_height	= 800,
+	.vl_clkp	= CONFIG_SYS_HIGH,
+	.vl_hsp		= CONFIG_SYS_HIGH,
+	.vl_vsp		= CONFIG_SYS_HIGH,
+	.vl_dp		= CONFIG_SYS_HIGH,
+
+	.vl_bpix	= 5,	/* Bits per pixel */
+
+	/* LD9040 LCD Panel */
+	.vl_hspw	= 2,
+	.vl_hbpd	= 16,
+	.vl_hfpd	= 16,
+
+	.vl_vspw	= 2,
+	.vl_vbpd	= 8,
+	.vl_vfpd	= 8,
+	.vl_cmd_allow_len = 0xf,
+
+	.win_id		= 0,
+	.cfg_gpio	= lcd_cfg_gpio,
+	.backlight_on	= NULL,
+	.lcd_power_on	= lcd_power_on,
+	.reset_lcd	= reset_lcd,
+	.dual_lcd_enabled = 0,
+
+	.init_delay	= 0,
+	.power_on_delay = 10000,
+	.reset_delay	= 10000,
+	.interface_mode = FIMD_RGB_INTERFACE,
+	.mipi_enabled	= 0,
+};
+
+void init_panel_info(vidinfo_t *vid)
+{
+	vid->logo_on	= 1;
+	vid->resolution	= HD_RESOLUTION;
+	vid->rgb_mode	= MODE_RGB_P;
+
+#ifdef CONFIG_TIZEN
+	get_tizen_logo_info(vid);
+#endif
+
+	/* for LD9040. */
+	vid->pclk_name = 1;	/* MPLL */
+	vid->sclk_div = 1;
+
+	vid->cfg_ldo = ld9040_cfg_ldo;
+	vid->enable_ldo = ld9040_enable_ldo;
+
+	setenv("lcdinfo", "lcd=ld9040");
+}
+
+int board_init(void)
+{
+	gpio1 = (struct exynos4_gpio_part1 *) EXYNOS4_GPIO_PART1_BASE;
+	gpio2 = (struct exynos4_gpio_part2 *) EXYNOS4_GPIO_PART2_BASE;
+
+	gd->bd->bi_arch_number = MACH_TYPE_UNIVERSAL_C210;
+	gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
+
+#if defined(CONFIG_PMIC)
+	pmic_init();
+	init_pmic_lcd();
+#endif
+
+	check_hw_revision();
+	printf("HW Revision:\t0x%x\n", board_rev);
+
+	return 0;
+}
diff --git a/include/configs/s5pc210_universal.h b/include/configs/s5pc210_universal.h
index f7a7443..ca0989c 100644
--- a/include/configs/s5pc210_universal.h
+++ b/include/configs/s5pc210_universal.h
@@ -34,6 +34,7 @@
 #define CONFIG_S5P		1	/* which is in a S5P Family */
 #define CONFIG_EXYNOS4210	1	/* which is in a EXYNOS4210 */
 #define CONFIG_UNIVERSAL	1	/* working with Universal */
+#define CONFIG_TIZEN		1	/* TIZEN lib */
 
 #include <asm/arch/cpu.h>		/* get chip and board defs */
 
@@ -283,4 +284,16 @@
 void soft_spi_init(void);
 #endif
 
+/*
+ * LCD Settings
+ */
+#define CONFIG_EXYNOS_FB
+#define CONFIG_LCD
+#define CONFIG_CMD_BMP
+#define CONFIG_BMP_32BPP
+#define CONFIG_LD9040
+#define CONFIG_EXYNOS_MIPI_DSIM
+#define CONFIG_VIDEO_BMP_GZIP
+#define CONFIG_SYS_VIDEO_LOGO_MAX_SIZE ((520 * 120 * 4) + (1 << 12))
+
 #endif	/* __CONFIG_H */
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v2 0/5] Exynos: Support for display drivers
  2012-09-19 13:01 [U-Boot] [PATCH v2 0/5] Exynos: Support for display drivers Piotr Wilczek
                   ` (4 preceding siblings ...)
  2012-09-19 13:01 ` [U-Boot] [PATCH v2 5/5] arm: exynos4: universal_C210: add display support Piotr Wilczek
@ 2012-09-20  9:56 ` Jaehoon Chung
  2012-09-20 11:11   ` Piotr Wilczek
  5 siblings, 1 reply; 32+ messages in thread
From: Jaehoon Chung @ 2012-09-20  9:56 UTC (permalink / raw)
  To: u-boot

Hi Piotr,

Could you add Mr.Kang to CC, plz?

Best Regards,
Jaehoon Chung

On 09/19/2012 10:01 PM, Piotr Wilczek wrote:
> This patchset add support for display on Universal C210 board.
> Max8998 is modified to power on display, new driver ld9040
> and support for LCD display on universal C210 board is added.
> 
> Changes in v2:
> - removed unnecessary function for fimd clock set;
> - code cleanup
> - removed patch for fix exynos4_fb structure
> 
> Piotr Wilczek (5):
>   misc:max8998 Add LDO macros
>   drivers: video: Add ld9040 video driver
>   arm: exynos4: cpu: Add definition for display
>   drivers: video: fix image position
>   arm: exynos4: universal_C210: add display support
> 
>  arch/arm/include/asm/arch-exynos/cpu.h   |    1 +
>  board/samsung/universal_c210/universal.c |  201 +++++++++++++++++++++++++++---
>  drivers/video/Makefile                   |    1 +
>  drivers/video/exynos_fb.c                |   15 ++-
>  drivers/video/ld9040.c                   |  147 ++++++++++++++++++++++
>  include/configs/s5pc210_universal.h      |   13 ++
>  include/ld9040.h                         |   32 +++++
>  include/max8998_pmic.h                   |    2 +
>  8 files changed, 392 insertions(+), 20 deletions(-)
>  create mode 100644 drivers/video/ld9040.c
>  create mode 100644 include/ld9040.h
> 

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v2 2/5] drivers: video: Add ld9040 video driver
  2012-09-19 13:01 ` [U-Boot] [PATCH v2 2/5] drivers: video: Add ld9040 video driver Piotr Wilczek
@ 2012-09-20  9:57   ` Jaehoon Chung
  0 siblings, 0 replies; 32+ messages in thread
From: Jaehoon Chung @ 2012-09-20  9:57 UTC (permalink / raw)
  To: u-boot

Add Mr.Lee to CC.

On 09/19/2012 10:01 PM, Piotr Wilczek wrote:
> This patch add ld9040 video driver:
> new file:   drivers/video/ld9040.c
> new file:   include/ld9040.h
> modified:   drivers/video/Makefile
> 
> This patch depends on software SPI:
> <1346228122-13444-2-git-send-email-p.wilczek@samsung.com>
> 
> Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> CC: Minkyu Kang <mk7.kang@samsung.com>
> 
> Changes in v2:
> - none.
> ---
>  drivers/video/Makefile |    1 +
>  drivers/video/ld9040.c |  147 ++++++++++++++++++++++++++++++++++++++++++++++++
>  include/ld9040.h       |   32 ++++++++++
>  3 files changed, 180 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/video/ld9040.c
>  create mode 100644 include/ld9040.h
> 
> diff --git a/drivers/video/Makefile b/drivers/video/Makefile
> index ebb6da8..247b867 100644
> --- a/drivers/video/Makefile
> +++ b/drivers/video/Makefile
> @@ -37,6 +37,7 @@ COBJS-$(CONFIG_EXYNOS_PWM_BL) += exynos_pwm_bl.o
>  COBJS-$(CONFIG_FSL_DIU_FB) += fsl_diu_fb.o videomodes.o
>  COBJS-$(CONFIG_S6E8AX0) += s6e8ax0.o
>  COBJS-$(CONFIG_S6E63D6) += s6e63d6.o
> +COBJS-$(CONFIG_LD9040) += ld9040.o
>  COBJS-$(CONFIG_SED156X) += sed156x.o
>  COBJS-$(CONFIG_VIDEO_AMBA) += amba.o
>  COBJS-$(CONFIG_VIDEO_CT69000) += ct69000.o videomodes.o
> diff --git a/drivers/video/ld9040.c b/drivers/video/ld9040.c
> new file mode 100644
> index 0000000..6e94086
> --- /dev/null
> +++ b/drivers/video/ld9040.c
> @@ -0,0 +1,147 @@
> +/*
> + * ld9040 AMOLED LCD panel driver.
> + *
> + * Copyright (C) 2012 Samsung Electronics
> + * Donghwa Lee <dh09.lee@samsung.com>
> + *
> + * 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 <spi.h>
> +
> +/* these machine specific platform data would be setting at universal.c */
> +struct spi_platform_data *ld9040;
> +
> +static const unsigned char SEQ_SWRESET[] = {
> +	0x01,
> +};
> +
> +static const unsigned char SEQ_USER_SETTING[] = {
> +	0xF0, 0x5A, 0x5A
> +};
> +
> +static const unsigned char SEQ_ELVSS_ON[] = {
> +	0xB1, 0x0D, 0x00, 0x16,
> +};
> +
> +static const unsigned char SEQ_TEMP_SWIRE[] = {
> +	0xB2, 0x06, 0x06, 0x06, 0x06,
> +};
> +
> +static const unsigned char SEQ_GTCON[] = {
> +	0xF7, 0x09, 0x00, 0x00,
> +};
> +
> +static const unsigned char SEQ_PANEL_CONDITION[] = {
> +	0xF8, 0x05, 0x65, 0x96, 0x71, 0x7D, 0x19, 0x3B,
> +	0x0D, 0x19, 0x7E, 0x0D, 0xE2, 0x00, 0x00, 0x7E,
> +	0x7D, 0x07, 0x07, 0x20, 0x20, 0x20, 0x02, 0x02,
> +};
> +
> +static const unsigned char SEQ_GAMMA_SET1[] = {
> +	0xF9, 0x00, 0xA7, 0xB4, 0xAE, 0xBF, 0x00, 0x91,
> +	0x00, 0xB2, 0xB4, 0xAA, 0xBB, 0x00, 0xAC, 0x00,
> +	0xB3, 0xB1, 0xAA, 0xBC, 0x00, 0xB3,
> +};
> +
> +static const unsigned char SEQ_GAMMA_CTRL[] = {
> +	0xFB, 0x02, 0x5A,
> +};
> +
> +static const unsigned char SEQ_APON[] = {
> +	0xF3, 0x00, 0x00, 0x00, 0x0A, 0x02,
> +};
> +
> +static const unsigned char SEQ_DISPCTL[] = {
> +	0xF2, 0x02, 0x08, 0x08, 0x10, 0x10,
> +};
> +
> +static const unsigned char SEQ_MANPWR[] = {
> +	0xB0, 0x04,
> +};
> +
> +static const unsigned char SEQ_PWR_CTRL[] = {
> +	0xF4, 0x0A, 0x87, 0x25, 0x6A, 0x44, 0x02, 0x88,
> +};
> +
> +static const unsigned char SEQ_SLPOUT[] = {
> +	0x11,
> +};
> +
> +static const unsigned char SEQ_SLPIN[] = {
> +	0x10,
> +};
> +
> +static const unsigned char SEQ_DISPON[] = {
> +	0x29,
> +};
> +
> +static const unsigned char SEQ_DISPOFF[] = {
> +	0x28,
> +};
> +
> +static void ld9040_spi_write(const unsigned char *wbuf, unsigned int size_cmd)
> +{
> +	int i = 0;
> +
> +	/*
> +	 * Data are transmitted in 9-bit words:
> +	 * the first bit is command/parameter, the other are the value.
> +	 * The value's LSB is shifted to MSB position, to be sent as 9th bit
> +	 */
> +
> +	unsigned int data_out = 0, data_in = 0;
> +	for (i = 0; i < size_cmd; i++) {
> +		data_out = wbuf[i] >> 1;
> +		if (i != 0)
> +			data_out += 0x0080;
> +		if (wbuf[i] & 0x01)
> +			data_out += 0x8000;
> +		spi_xfer(NULL, 9, &data_out, &data_in, SPI_XFER_BEGIN);
> +	}
> +}
> +
> +void ld9040_cfg_ldo(void)
> +{
> +	udelay(10);
> +
> +	ld9040_spi_write(SEQ_USER_SETTING,
> +					ARRAY_SIZE(SEQ_USER_SETTING));
> +	ld9040_spi_write(SEQ_PANEL_CONDITION,
> +					ARRAY_SIZE(SEQ_PANEL_CONDITION));
> +	ld9040_spi_write(SEQ_DISPCTL, ARRAY_SIZE(SEQ_DISPCTL));
> +	ld9040_spi_write(SEQ_MANPWR, ARRAY_SIZE(SEQ_MANPWR));
> +	ld9040_spi_write(SEQ_PWR_CTRL, ARRAY_SIZE(SEQ_PWR_CTRL));
> +	ld9040_spi_write(SEQ_ELVSS_ON, ARRAY_SIZE(SEQ_ELVSS_ON));
> +	ld9040_spi_write(SEQ_GTCON, ARRAY_SIZE(SEQ_GTCON));
> +	ld9040_spi_write(SEQ_GAMMA_SET1, ARRAY_SIZE(SEQ_GAMMA_SET1));
> +	ld9040_spi_write(SEQ_GAMMA_CTRL, ARRAY_SIZE(SEQ_GAMMA_CTRL));
> +	ld9040_spi_write(SEQ_SLPOUT, ARRAY_SIZE(SEQ_SLPOUT));
> +
> +	udelay(120);
> +}
> +
> +void ld9040_enable_ldo(unsigned int onoff)
> +{
> +	if (onoff)
> +		ld9040_spi_write(SEQ_DISPON, ARRAY_SIZE(SEQ_DISPON));
> +	else
> +		ld9040_spi_write(SEQ_DISPOFF, ARRAY_SIZE(SEQ_DISPOFF));
> +}
> diff --git a/include/ld9040.h b/include/ld9040.h
> new file mode 100644
> index 0000000..fe99390
> --- /dev/null
> +++ b/include/ld9040.h
> @@ -0,0 +1,32 @@
> +/*
> + * ld9040 AMOLED LCD panel driver.
> + *
> + * Copyright (C) 2012 Samsung Electronics
> + * Donghwa Lee <dh09.lee@samsung.com>
> + *
> + * 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
> + */
> +
> +#ifndef __LD9040_H_
> +#define __LD9040_H_
> +
> +void ld9040_cfg_ldo(void);
> +void ld9040_enable_ldo(unsigned int onoff);
> +
> +#endif /* __LD9040_H_ */
> 

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v2 0/5] Exynos: Support for display drivers
  2012-09-20  9:56 ` [U-Boot] [PATCH v2 0/5] Exynos: Support for display drivers Jaehoon Chung
@ 2012-09-20 11:11   ` Piotr Wilczek
  0 siblings, 0 replies; 32+ messages in thread
From: Piotr Wilczek @ 2012-09-20 11:11 UTC (permalink / raw)
  To: u-boot

Hi,

I will, of course.

Best regards,
Piotr Wilczek

> -----Original Message-----
> From: Jaehoon Chung [mailto:jh80.chung at samsung.com]
> Sent: Thursday, September 20, 2012 11:56 AM
> To: Piotr Wilczek
> Cc: u-boot at lists.denx.de; Kyungmin Park; mk7.kang at samsung.com
> Subject: Re: [U-Boot] [PATCH v2 0/5] Exynos: Support for display
> drivers
> 
> Hi Piotr,
> 
> Could you add Mr.Kang to CC, plz?
> 
> Best Regards,
> Jaehoon Chung
> 
> On 09/19/2012 10:01 PM, Piotr Wilczek wrote:
> > This patchset add support for display on Universal C210 board.
> > Max8998 is modified to power on display, new driver ld9040 and
> support
> > for LCD display on universal C210 board is added.
> >
> > Changes in v2:
> > - removed unnecessary function for fimd clock set;
> > - code cleanup
> > - removed patch for fix exynos4_fb structure
> >
> > Piotr Wilczek (5):
> >   misc:max8998 Add LDO macros
> >   drivers: video: Add ld9040 video driver
> >   arm: exynos4: cpu: Add definition for display
> >   drivers: video: fix image position
> >   arm: exynos4: universal_C210: add display support
> >
> >  arch/arm/include/asm/arch-exynos/cpu.h   |    1 +
> >  board/samsung/universal_c210/universal.c |  201
> +++++++++++++++++++++++++++---
> >  drivers/video/Makefile                   |    1 +
> >  drivers/video/exynos_fb.c                |   15 ++-
> >  drivers/video/ld9040.c                   |  147
> ++++++++++++++++++++++
> >  include/configs/s5pc210_universal.h      |   13 ++
> >  include/ld9040.h                         |   32 +++++
> >  include/max8998_pmic.h                   |    2 +
> >  8 files changed, 392 insertions(+), 20 deletions(-)  create mode
> > 100644 drivers/video/ld9040.c  create mode 100644 include/ld9040.h
> >

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v3 0/5]  Exynos: Support for display drivers
  2012-09-19 13:01 ` [U-Boot] [PATCH v2 1/5] misc:max8998 Add LDO macros Piotr Wilczek
@ 2012-09-24 13:04   ` Piotr Wilczek
  2012-09-24 13:04     ` [U-Boot] [PATCH v3 1/5] misc: max8998: Add LDO macros Piotr Wilczek
                       ` (4 more replies)
  0 siblings, 5 replies; 32+ messages in thread
From: Piotr Wilczek @ 2012-09-24 13:04 UTC (permalink / raw)
  To: u-boot

This patchset add support for display on Universal C210 board.
Max8998 is modified to power on display, new driver ld9040
and support for LCD display on universal C210 board is added.

Changes in v2:
- removed unnecessary function for fimd clock set;
- code cleanup
- removed patch for fix exynos4_fb structure
Changes in v3:
- small changes in Patch 5/5 after some changes in another
 patch ID=<1348487791-18435-2-git-send-email-p.wilczek@samsung.com>
 on which this patch depends on.

Piotr Wilczek (5):
  misc: max8998: Add LDO macros
  drivers: video: Add ld9040 video driver
  arm: exynos4: cpu: Add definition for display
  drivers: video: fix image position
  arm: exynos4: universal_C210: add display support

 arch/arm/include/asm/arch-exynos/cpu.h   |    1 +
 board/samsung/universal_c210/universal.c |  202 +++++++++++++++++++++++++++---
 drivers/video/Makefile                   |    1 +
 drivers/video/exynos_fb.c                |   15 ++-
 drivers/video/ld9040.c                   |  147 ++++++++++++++++++++++
 include/configs/s5pc210_universal.h      |   13 ++
 include/ld9040.h                         |   32 +++++
 include/max8998_pmic.h                   |    2 +
 8 files changed, 393 insertions(+), 20 deletions(-)
 create mode 100644 drivers/video/ld9040.c
 create mode 100644 include/ld9040.h

-- 
1.7.5.4

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v3 1/5] misc: max8998: Add LDO macros
  2012-09-24 13:04   ` [U-Boot] [PATCH v3 0/5] Exynos: Support for display drivers Piotr Wilczek
@ 2012-09-24 13:04     ` Piotr Wilczek
  2012-09-24 13:04     ` [U-Boot] [PATCH v3 2/5] drivers: video: Add ld9040 video driver Piotr Wilczek
                       ` (3 subsequent siblings)
  4 siblings, 0 replies; 32+ messages in thread
From: Piotr Wilczek @ 2012-09-24 13:04 UTC (permalink / raw)
  To: u-boot

Add LDO7 and LDO17 macros to max8998_pmic.h necessary to power on the LCD.

Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
CC: Minkyu Kang <mk7.kang@samsung.com>
---
Changes in v2:
- none.
Changes in v3:
- none.

 include/max8998_pmic.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/include/max8998_pmic.h b/include/max8998_pmic.h
index ca21f88..0e559f9 100644
--- a/include/max8998_pmic.h
+++ b/include/max8998_pmic.h
@@ -76,7 +76,9 @@ enum {
 
 #define MAX8998_LDO3		(1 << 2)
 #define MAX8998_LDO4		(1 << 1)
+#define MAX8998_LDO7		(1 << 6)
 #define MAX8998_LDO8		(1 << 5)
+#define MAX8998_LDO17		(1 << 4)
 #define MAX8998_SAFEOUT1	(1 << 4)
 
 #define MAX8998_I2C_ADDR        (0xCC >> 1)
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v3 2/5] drivers: video: Add ld9040 video driver
  2012-09-24 13:04   ` [U-Boot] [PATCH v3 0/5] Exynos: Support for display drivers Piotr Wilczek
  2012-09-24 13:04     ` [U-Boot] [PATCH v3 1/5] misc: max8998: Add LDO macros Piotr Wilczek
@ 2012-09-24 13:04     ` Piotr Wilczek
  2012-09-27  6:58       ` Minkyu Kang
  2012-09-28 10:34       ` [U-Boot] [PATCH v4 0/4] Exynos: Support for display drivers Piotr Wilczek
  2012-09-24 13:04     ` [U-Boot] [PATCH v3 3/5] arm: exynos4: cpu: Add definition for display Piotr Wilczek
                       ` (2 subsequent siblings)
  4 siblings, 2 replies; 32+ messages in thread
From: Piotr Wilczek @ 2012-09-24 13:04 UTC (permalink / raw)
  To: u-boot

This patch add ld9040 video driver:
new file:   drivers/video/ld9040.c
new file:   include/ld9040.h
modified:   drivers/video/Makefile

Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
CC: Minkyu Kang <mk7.kang@samsung.com>
CC: Donghwa Lee <dh09.lee@samsung.com>
---
This patch depends on software SPI:
<1348487791-18435-2-git-send-email-p.wilczek@samsung.com>

Changes in v2:
- none.
Changes in v3:
- none

 drivers/video/Makefile |    1 +
 drivers/video/ld9040.c |  147 ++++++++++++++++++++++++++++++++++++++++++++++++
 include/ld9040.h       |   32 ++++++++++
 3 files changed, 180 insertions(+), 0 deletions(-)
 create mode 100644 drivers/video/ld9040.c
 create mode 100644 include/ld9040.h

diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index ebb6da8..247b867 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -37,6 +37,7 @@ COBJS-$(CONFIG_EXYNOS_PWM_BL) += exynos_pwm_bl.o
 COBJS-$(CONFIG_FSL_DIU_FB) += fsl_diu_fb.o videomodes.o
 COBJS-$(CONFIG_S6E8AX0) += s6e8ax0.o
 COBJS-$(CONFIG_S6E63D6) += s6e63d6.o
+COBJS-$(CONFIG_LD9040) += ld9040.o
 COBJS-$(CONFIG_SED156X) += sed156x.o
 COBJS-$(CONFIG_VIDEO_AMBA) += amba.o
 COBJS-$(CONFIG_VIDEO_CT69000) += ct69000.o videomodes.o
diff --git a/drivers/video/ld9040.c b/drivers/video/ld9040.c
new file mode 100644
index 0000000..6e94086
--- /dev/null
+++ b/drivers/video/ld9040.c
@@ -0,0 +1,147 @@
+/*
+ * ld9040 AMOLED LCD panel driver.
+ *
+ * Copyright (C) 2012 Samsung Electronics
+ * Donghwa Lee <dh09.lee@samsung.com>
+ *
+ * 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 <spi.h>
+
+/* these machine specific platform data would be setting at universal.c */
+struct spi_platform_data *ld9040;
+
+static const unsigned char SEQ_SWRESET[] = {
+	0x01,
+};
+
+static const unsigned char SEQ_USER_SETTING[] = {
+	0xF0, 0x5A, 0x5A
+};
+
+static const unsigned char SEQ_ELVSS_ON[] = {
+	0xB1, 0x0D, 0x00, 0x16,
+};
+
+static const unsigned char SEQ_TEMP_SWIRE[] = {
+	0xB2, 0x06, 0x06, 0x06, 0x06,
+};
+
+static const unsigned char SEQ_GTCON[] = {
+	0xF7, 0x09, 0x00, 0x00,
+};
+
+static const unsigned char SEQ_PANEL_CONDITION[] = {
+	0xF8, 0x05, 0x65, 0x96, 0x71, 0x7D, 0x19, 0x3B,
+	0x0D, 0x19, 0x7E, 0x0D, 0xE2, 0x00, 0x00, 0x7E,
+	0x7D, 0x07, 0x07, 0x20, 0x20, 0x20, 0x02, 0x02,
+};
+
+static const unsigned char SEQ_GAMMA_SET1[] = {
+	0xF9, 0x00, 0xA7, 0xB4, 0xAE, 0xBF, 0x00, 0x91,
+	0x00, 0xB2, 0xB4, 0xAA, 0xBB, 0x00, 0xAC, 0x00,
+	0xB3, 0xB1, 0xAA, 0xBC, 0x00, 0xB3,
+};
+
+static const unsigned char SEQ_GAMMA_CTRL[] = {
+	0xFB, 0x02, 0x5A,
+};
+
+static const unsigned char SEQ_APON[] = {
+	0xF3, 0x00, 0x00, 0x00, 0x0A, 0x02,
+};
+
+static const unsigned char SEQ_DISPCTL[] = {
+	0xF2, 0x02, 0x08, 0x08, 0x10, 0x10,
+};
+
+static const unsigned char SEQ_MANPWR[] = {
+	0xB0, 0x04,
+};
+
+static const unsigned char SEQ_PWR_CTRL[] = {
+	0xF4, 0x0A, 0x87, 0x25, 0x6A, 0x44, 0x02, 0x88,
+};
+
+static const unsigned char SEQ_SLPOUT[] = {
+	0x11,
+};
+
+static const unsigned char SEQ_SLPIN[] = {
+	0x10,
+};
+
+static const unsigned char SEQ_DISPON[] = {
+	0x29,
+};
+
+static const unsigned char SEQ_DISPOFF[] = {
+	0x28,
+};
+
+static void ld9040_spi_write(const unsigned char *wbuf, unsigned int size_cmd)
+{
+	int i = 0;
+
+	/*
+	 * Data are transmitted in 9-bit words:
+	 * the first bit is command/parameter, the other are the value.
+	 * The value's LSB is shifted to MSB position, to be sent as 9th bit
+	 */
+
+	unsigned int data_out = 0, data_in = 0;
+	for (i = 0; i < size_cmd; i++) {
+		data_out = wbuf[i] >> 1;
+		if (i != 0)
+			data_out += 0x0080;
+		if (wbuf[i] & 0x01)
+			data_out += 0x8000;
+		spi_xfer(NULL, 9, &data_out, &data_in, SPI_XFER_BEGIN);
+	}
+}
+
+void ld9040_cfg_ldo(void)
+{
+	udelay(10);
+
+	ld9040_spi_write(SEQ_USER_SETTING,
+					ARRAY_SIZE(SEQ_USER_SETTING));
+	ld9040_spi_write(SEQ_PANEL_CONDITION,
+					ARRAY_SIZE(SEQ_PANEL_CONDITION));
+	ld9040_spi_write(SEQ_DISPCTL, ARRAY_SIZE(SEQ_DISPCTL));
+	ld9040_spi_write(SEQ_MANPWR, ARRAY_SIZE(SEQ_MANPWR));
+	ld9040_spi_write(SEQ_PWR_CTRL, ARRAY_SIZE(SEQ_PWR_CTRL));
+	ld9040_spi_write(SEQ_ELVSS_ON, ARRAY_SIZE(SEQ_ELVSS_ON));
+	ld9040_spi_write(SEQ_GTCON, ARRAY_SIZE(SEQ_GTCON));
+	ld9040_spi_write(SEQ_GAMMA_SET1, ARRAY_SIZE(SEQ_GAMMA_SET1));
+	ld9040_spi_write(SEQ_GAMMA_CTRL, ARRAY_SIZE(SEQ_GAMMA_CTRL));
+	ld9040_spi_write(SEQ_SLPOUT, ARRAY_SIZE(SEQ_SLPOUT));
+
+	udelay(120);
+}
+
+void ld9040_enable_ldo(unsigned int onoff)
+{
+	if (onoff)
+		ld9040_spi_write(SEQ_DISPON, ARRAY_SIZE(SEQ_DISPON));
+	else
+		ld9040_spi_write(SEQ_DISPOFF, ARRAY_SIZE(SEQ_DISPOFF));
+}
diff --git a/include/ld9040.h b/include/ld9040.h
new file mode 100644
index 0000000..fe99390
--- /dev/null
+++ b/include/ld9040.h
@@ -0,0 +1,32 @@
+/*
+ * ld9040 AMOLED LCD panel driver.
+ *
+ * Copyright (C) 2012 Samsung Electronics
+ * Donghwa Lee <dh09.lee@samsung.com>
+ *
+ * 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
+ */
+
+#ifndef __LD9040_H_
+#define __LD9040_H_
+
+void ld9040_cfg_ldo(void);
+void ld9040_enable_ldo(unsigned int onoff);
+
+#endif /* __LD9040_H_ */
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v3 3/5] arm: exynos4: cpu: Add definition for display
  2012-09-24 13:04   ` [U-Boot] [PATCH v3 0/5] Exynos: Support for display drivers Piotr Wilczek
  2012-09-24 13:04     ` [U-Boot] [PATCH v3 1/5] misc: max8998: Add LDO macros Piotr Wilczek
  2012-09-24 13:04     ` [U-Boot] [PATCH v3 2/5] drivers: video: Add ld9040 video driver Piotr Wilczek
@ 2012-09-24 13:04     ` Piotr Wilczek
  2012-09-27  0:21       ` Minkyu Kang
  2012-09-24 13:04     ` [U-Boot] [PATCH v3 4/5] drivers: video: fix image position Piotr Wilczek
  2012-09-24 13:04     ` [U-Boot] [PATCH v3 5/5] arm: exynos4: universal_C210: add display support Piotr Wilczek
  4 siblings, 1 reply; 32+ messages in thread
From: Piotr Wilczek @ 2012-09-24 13:04 UTC (permalink / raw)
  To: u-boot

Add EXYNOS4_DISPLAY_CONTROL definition

Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
CC: Minkyu Kang <mk7.kang@samsung.com>
---
Changes in v2:
- removed definions for fimd.
Changes in v3:
- none.

 arch/arm/include/asm/arch-exynos/cpu.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/arm/include/asm/arch-exynos/cpu.h b/arch/arm/include/asm/arch-exynos/cpu.h
index 2cd4ae1..5056b37 100644
--- a/arch/arm/include/asm/arch-exynos/cpu.h
+++ b/arch/arm/include/asm/arch-exynos/cpu.h
@@ -54,6 +54,7 @@
 #define EXYNOS4_PWMTIMER_BASE		0x139D0000
 #define EXYNOS4_MODEM_BASE		0x13A00000
 #define EXYNOS4_USBPHY_CONTROL		0x10020704
+#define EXYNOS4_DISPLAY_CONTROL		0x10010210
 
 #define EXYNOS4_GPIO_PART4_BASE		DEVICE_NOT_AVAILABLE
 #define EXYNOS4_DP_BASE			DEVICE_NOT_AVAILABLE
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v3 4/5] drivers: video: fix image position
  2012-09-24 13:04   ` [U-Boot] [PATCH v3 0/5] Exynos: Support for display drivers Piotr Wilczek
                       ` (2 preceding siblings ...)
  2012-09-24 13:04     ` [U-Boot] [PATCH v3 3/5] arm: exynos4: cpu: Add definition for display Piotr Wilczek
@ 2012-09-24 13:04     ` Piotr Wilczek
  2012-09-24 13:04     ` [U-Boot] [PATCH v3 5/5] arm: exynos4: universal_C210: add display support Piotr Wilczek
  4 siblings, 0 replies; 32+ messages in thread
From: Piotr Wilczek @ 2012-09-24 13:04 UTC (permalink / raw)
  To: u-boot

This patch fixes image position on screen when images's height or width is biger then the lcd's.

Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
CC: Minkyu Kang <mk7.kang@samsung.com>
---
Changes in v2:
- none.
Changes in v3:
- none.

 drivers/video/exynos_fb.c |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/video/exynos_fb.c b/drivers/video/exynos_fb.c
index e31a0fd..d9a3f9a 100644
--- a/drivers/video/exynos_fb.c
+++ b/drivers/video/exynos_fb.c
@@ -70,8 +70,19 @@ static void draw_logo(void)
 	int x, y;
 	ulong addr;
 
-	x = ((panel_width - panel_info.logo_width) >> 1);
-	y = ((panel_height - panel_info.logo_height) >> 1) - 4;
+	if (panel_width >= panel_info.logo_width) {
+		x = ((panel_width - panel_info.logo_width) >> 1);
+	} else {
+		x = 0;
+		printf("Warning: image width is bigger than display width\n");
+	}
+
+	if (panel_height >= panel_info.logo_height) {
+		y = ((panel_height - panel_info.logo_height) >> 1) - 4;
+	} else {
+		y = 0;
+		printf("Warning: image height is bigger than display height\n");
+	}
 
 	addr = panel_info.logo_addr;
 	bmp_display(addr, x, y);
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v3 5/5] arm: exynos4: universal_C210: add display support
  2012-09-24 13:04   ` [U-Boot] [PATCH v3 0/5] Exynos: Support for display drivers Piotr Wilczek
                       ` (3 preceding siblings ...)
  2012-09-24 13:04     ` [U-Boot] [PATCH v3 4/5] drivers: video: fix image position Piotr Wilczek
@ 2012-09-24 13:04     ` Piotr Wilczek
  4 siblings, 0 replies; 32+ messages in thread
From: Piotr Wilczek @ 2012-09-24 13:04 UTC (permalink / raw)
  To: u-boot

This patch add support for display on Universal C210 board.
Width of displayed logo must be not bigger than 480 pixel and
is limited by width of the screen.
Tizen logo size is 520x120 pixels should be reseized.

Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
CC: Minkyu Kang <mk7.kang@samsung.com>
---
Changes in v2:
- removed unnecessary function for fimd clock set;
- removed unnecessary return;
- moved init_pmic_lcd to CONFIG_PMIC
Changes in v3:
- code cleanup.

 board/samsung/universal_c210/universal.c |  202 +++++++++++++++++++++++++++---
 include/configs/s5pc210_universal.h      |   13 ++
 2 files changed, 197 insertions(+), 18 deletions(-)

diff --git a/board/samsung/universal_c210/universal.c b/board/samsung/universal_c210/universal.c
index 72999d9..f1ff299 100644
--- a/board/samsung/universal_c210/universal.c
+++ b/board/samsung/universal_c210/universal.c
@@ -24,6 +24,7 @@
 
 #include <common.h>
 #include <spi.h>
+#include <lcd.h>
 #include <asm/io.h>
 #include <asm/gpio.h>
 #include <asm/arch/adc.h>
@@ -35,6 +36,8 @@
 #include <asm/arch/cpu.h>
 #include <max8998_pmic.h>
 #include <asm/arch/watchdog.h>
+#include <libtizen.h>
+#include <ld9040.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -54,24 +57,6 @@ static int get_hwrev(void)
 
 static void check_hw_revision(void);
 
-int board_init(void)
-{
-	gpio1 = (struct exynos4_gpio_part1 *) EXYNOS4_GPIO_PART1_BASE;
-	gpio2 = (struct exynos4_gpio_part2 *) EXYNOS4_GPIO_PART2_BASE;
-
-	gd->bd->bi_arch_number = MACH_TYPE_UNIVERSAL_C210;
-	gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
-
-#if defined(CONFIG_PMIC)
-	pmic_init();
-#endif
-
-	check_hw_revision();
-	printf("HW Revision:\t0x%x\n", board_rev);
-
-	return 0;
-}
-
 int dram_init(void)
 {
 	gd->ram_size = get_ram_size((long *)PHYS_SDRAM_1, PHYS_SDRAM_1_SIZE) +
@@ -318,3 +303,184 @@ int  spi_cs_is_valid(unsigned int bus, unsigned int cs)
 	return bus == 0 && cs == 0;
 }
 #endif
+
+static void init_pmic_lcd(void)
+{
+	unsigned char val;
+	int ret = 0;
+
+	struct pmic *p = get_pmic();
+
+	if (pmic_probe(p))
+		return;
+
+	/* LDO7 1.8V */
+	val = 0x02; /* (1800 - 1600) / 100; */
+	ret |= pmic_reg_write(p,  MAX8998_REG_LDO7, val);
+
+	/* LDO17 3.0V */
+	val = 0xe; /* (3000 - 1600) / 100; */
+	ret |= pmic_reg_write(p,  MAX8998_REG_LDO17, val);
+
+	/* Disable unneeded regulators */
+	/*
+	 * ONOFF1
+	 * Buck1 ON, Buck2 OFF, Buck3 ON, Buck4 ON
+	 * LDO2 ON, LDO3 OFF, LDO4 OFF, LDO5 ON
+	 */
+	val = 0xB9;
+	ret |= pmic_reg_write(p,  MAX8998_REG_ONOFF1, val);
+
+	/* ONOFF2
+	 * LDO6 OFF, LDO7 ON, LDO8 OFF, LDO9 ON,
+	 * LDO10 OFF, LDO11 OFF, LDO12 OFF, LDO13 OFF
+	 */
+	val = 0x50;
+	ret |= pmic_reg_write(p,  MAX8998_REG_ONOFF2, val);
+
+	/* ONOFF3
+	 * LDO14 OFF, LDO15 OFF, LGO16 OFF, LDO17 OFF
+	 * EPWRHOLD OFF, EBATTMON OFF, ELBCNFG2 OFF, ELBCNFG1 OFF
+	 */
+	val = 0x00;
+	ret |= pmic_reg_write(p,  MAX8998_REG_ONOFF3, val);
+
+	if (ret)
+		puts("LCD pmic initialisation error!\n");
+}
+
+static void lcd_cfg_gpio(void)
+{
+	unsigned int i, f3_end = 4;
+
+	for (i = 0; i < 8; i++) {
+		/* set GPF0,1,2[0:7] for RGB Interface and Data lines (32bit) */
+		s5p_gpio_cfg_pin(&gpio1->f0, i, GPIO_FUNC(2));
+		s5p_gpio_cfg_pin(&gpio1->f1, i, GPIO_FUNC(2));
+		s5p_gpio_cfg_pin(&gpio1->f2, i, GPIO_FUNC(2));
+		/* pull-up/down disable */
+		s5p_gpio_set_pull(&gpio1->f0, i, GPIO_PULL_NONE);
+		s5p_gpio_set_pull(&gpio1->f1, i, GPIO_PULL_NONE);
+		s5p_gpio_set_pull(&gpio1->f2, i, GPIO_PULL_NONE);
+
+		/* drive strength to max (24bit) */
+		s5p_gpio_set_drv(&gpio1->f0, i, GPIO_DRV_4X);
+		s5p_gpio_set_rate(&gpio1->f0, i, GPIO_DRV_SLOW);
+		s5p_gpio_set_drv(&gpio1->f1, i, GPIO_DRV_4X);
+		s5p_gpio_set_rate(&gpio1->f1, i, GPIO_DRV_SLOW);
+		s5p_gpio_set_drv(&gpio1->f2, i, GPIO_DRV_4X);
+		s5p_gpio_set_rate(&gpio1->f0, i, GPIO_DRV_SLOW);
+	}
+
+	for (i = 0; i < f3_end; i++) {
+		/* set GPF3[0:3] for RGB Interface and Data lines (32bit) */
+		s5p_gpio_cfg_pin(&gpio1->f3, i, GPIO_FUNC(2));
+		/* pull-up/down disable */
+		s5p_gpio_set_pull(&gpio1->f3, i, GPIO_PULL_NONE);
+		/* drive strength to max (24bit) */
+		s5p_gpio_set_drv(&gpio1->f3, i, GPIO_DRV_4X);
+		s5p_gpio_set_rate(&gpio1->f3, i, GPIO_DRV_SLOW);
+	}
+
+	/* gpio pad configuration for LCD reset. */
+	s5p_gpio_cfg_pin(&gpio2->y4, 5, GPIO_OUTPUT);
+
+	spi_init();
+}
+
+static void reset_lcd(void)
+{
+	s5p_gpio_set_value(&gpio2->y4, 5, 1);
+	udelay(10000);
+	s5p_gpio_set_value(&gpio2->y4, 5, 0);
+	udelay(10000);
+	s5p_gpio_set_value(&gpio2->y4, 5, 1);
+	udelay(100);
+}
+
+static void lcd_power_on(void)
+{
+	struct pmic *p = get_pmic();
+
+	if (pmic_probe(p))
+		return;
+
+	pmic_set_output(p, MAX8998_REG_ONOFF3, MAX8998_LDO17, LDO_ON);
+	pmic_set_output(p, MAX8998_REG_ONOFF2, MAX8998_LDO7, LDO_ON);
+}
+
+vidinfo_t panel_info = {
+	.vl_freq	= 60,
+	.vl_col		= 480,
+	.vl_row		= 800,
+	.vl_width	= 480,
+	.vl_height	= 800,
+	.vl_clkp	= CONFIG_SYS_HIGH,
+	.vl_hsp		= CONFIG_SYS_HIGH,
+	.vl_vsp		= CONFIG_SYS_HIGH,
+	.vl_dp		= CONFIG_SYS_HIGH,
+
+	.vl_bpix	= 5,	/* Bits per pixel */
+
+	/* LD9040 LCD Panel */
+	.vl_hspw	= 2,
+	.vl_hbpd	= 16,
+	.vl_hfpd	= 16,
+
+	.vl_vspw	= 2,
+	.vl_vbpd	= 8,
+	.vl_vfpd	= 8,
+	.vl_cmd_allow_len = 0xf,
+
+	.win_id		= 0,
+	.cfg_gpio	= lcd_cfg_gpio,
+	.backlight_on	= NULL,
+	.lcd_power_on	= lcd_power_on,
+	.reset_lcd	= reset_lcd,
+	.dual_lcd_enabled = 0,
+
+	.init_delay	= 0,
+	.power_on_delay = 10000,
+	.reset_delay	= 10000,
+	.interface_mode = FIMD_RGB_INTERFACE,
+	.mipi_enabled	= 0,
+};
+
+void init_panel_info(vidinfo_t *vid)
+{
+	vid->logo_on	= 1;
+	vid->resolution	= HD_RESOLUTION;
+	vid->rgb_mode	= MODE_RGB_P;
+
+#ifdef CONFIG_TIZEN
+	get_tizen_logo_info(vid);
+#endif
+
+	/* for LD9040. */
+	vid->pclk_name = 1;	/* MPLL */
+	vid->sclk_div = 1;
+
+	vid->cfg_ldo = ld9040_cfg_ldo;
+	vid->enable_ldo = ld9040_enable_ldo;
+
+	setenv("lcdinfo", "lcd=ld9040");
+}
+
+int board_init(void)
+{
+	gpio1 = (struct exynos4_gpio_part1 *) EXYNOS4_GPIO_PART1_BASE;
+	gpio2 = (struct exynos4_gpio_part2 *) EXYNOS4_GPIO_PART2_BASE;
+
+	gd->bd->bi_arch_number = MACH_TYPE_UNIVERSAL_C210;
+	gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
+
+#if defined(CONFIG_PMIC)
+	pmic_init();
+	init_pmic_lcd();
+#endif
+
+	check_hw_revision();
+	printf("HW Revision:\t0x%x\n", board_rev);
+
+	return 0;
+}
diff --git a/include/configs/s5pc210_universal.h b/include/configs/s5pc210_universal.h
index f7a7443..ca0989c 100644
--- a/include/configs/s5pc210_universal.h
+++ b/include/configs/s5pc210_universal.h
@@ -34,6 +34,7 @@
 #define CONFIG_S5P		1	/* which is in a S5P Family */
 #define CONFIG_EXYNOS4210	1	/* which is in a EXYNOS4210 */
 #define CONFIG_UNIVERSAL	1	/* working with Universal */
+#define CONFIG_TIZEN		1	/* TIZEN lib */
 
 #include <asm/arch/cpu.h>		/* get chip and board defs */
 
@@ -283,4 +284,16 @@
 void soft_spi_init(void);
 #endif
 
+/*
+ * LCD Settings
+ */
+#define CONFIG_EXYNOS_FB
+#define CONFIG_LCD
+#define CONFIG_CMD_BMP
+#define CONFIG_BMP_32BPP
+#define CONFIG_LD9040
+#define CONFIG_EXYNOS_MIPI_DSIM
+#define CONFIG_VIDEO_BMP_GZIP
+#define CONFIG_SYS_VIDEO_LOGO_MAX_SIZE ((520 * 120 * 4) + (1 << 12))
+
 #endif	/* __CONFIG_H */
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v3 3/5] arm: exynos4: cpu: Add definition for display
  2012-09-24 13:04     ` [U-Boot] [PATCH v3 3/5] arm: exynos4: cpu: Add definition for display Piotr Wilczek
@ 2012-09-27  0:21       ` Minkyu Kang
  2012-09-27  6:11         ` Piotr Wilczek
  0 siblings, 1 reply; 32+ messages in thread
From: Minkyu Kang @ 2012-09-27  0:21 UTC (permalink / raw)
  To: u-boot

Dear Piotr,

On 24 September 2012 22:04, Piotr Wilczek <p.wilczek@samsung.com> wrote:
> Add EXYNOS4_DISPLAY_CONTROL definition
>
> Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> CC: Minkyu Kang <mk7.kang@samsung.com>
> ---
> Changes in v2:
> - removed definions for fimd.
> Changes in v3:
> - none.
>
>  arch/arm/include/asm/arch-exynos/cpu.h |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/include/asm/arch-exynos/cpu.h b/arch/arm/include/asm/arch-exynos/cpu.h
> index 2cd4ae1..5056b37 100644
> --- a/arch/arm/include/asm/arch-exynos/cpu.h
> +++ b/arch/arm/include/asm/arch-exynos/cpu.h
> @@ -54,6 +54,7 @@
>  #define EXYNOS4_PWMTIMER_BASE          0x139D0000
>  #define EXYNOS4_MODEM_BASE             0x13A00000
>  #define EXYNOS4_USBPHY_CONTROL         0x10020704
> +#define EXYNOS4_DISPLAY_CONTROL                0x10010210

This define is not used.

Thanks.
Minkyu Kang.
-- 
from. prom.
www.promsoft.net

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v3 3/5] arm: exynos4: cpu: Add definition for display
  2012-09-27  0:21       ` Minkyu Kang
@ 2012-09-27  6:11         ` Piotr Wilczek
  0 siblings, 0 replies; 32+ messages in thread
From: Piotr Wilczek @ 2012-09-27  6:11 UTC (permalink / raw)
  To: u-boot

Dear Minkyu,

> -----Original Message-----
> From: Minkyu Kang [mailto:promsoft at gmail.com]
> Sent: Thursday, September 27, 2012 2:21 AM
> To: Piotr Wilczek
> Cc: u-boot at lists.denx.de; Kyungmin Park; Donghwa Lee
> Subject: Re: [U-Boot] [PATCH v3 3/5] arm: exynos4: cpu: Add definition
> for display
> 
> Dear Piotr,
> 
> On 24 September 2012 22:04, Piotr Wilczek <p.wilczek@samsung.com>
> wrote:
> > Add EXYNOS4_DISPLAY_CONTROL definition
> >
> > Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
> > Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> > CC: Minkyu Kang <mk7.kang@samsung.com>
> > ---
> > Changes in v2:
> > - removed definions for fimd.
> > Changes in v3:
> > - none.
> >
> >  arch/arm/include/asm/arch-exynos/cpu.h |    1 +
> >  1 files changed, 1 insertions(+), 0 deletions(-)
> >
> > diff --git a/arch/arm/include/asm/arch-exynos/cpu.h
> b/arch/arm/include/asm/arch-exynos/cpu.h
> > index 2cd4ae1..5056b37 100644
> > --- a/arch/arm/include/asm/arch-exynos/cpu.h
> > +++ b/arch/arm/include/asm/arch-exynos/cpu.h
> > @@ -54,6 +54,7 @@
> >  #define EXYNOS4_PWMTIMER_BASE          0x139D0000
> >  #define EXYNOS4_MODEM_BASE             0x13A00000
> >  #define EXYNOS4_USBPHY_CONTROL         0x10020704
> > +#define EXYNOS4_DISPLAY_CONTROL                0x10010210
> 
> This define is not used.
That is correct, thank you.
> 
> Thanks.
> Minkyu Kang.
> --
> from. prom.
> www.promsoft.net

Best regards,
Piotr Wilczek

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v3 2/5] drivers: video: Add ld9040 video driver
  2012-09-24 13:04     ` [U-Boot] [PATCH v3 2/5] drivers: video: Add ld9040 video driver Piotr Wilczek
@ 2012-09-27  6:58       ` Minkyu Kang
  2012-09-27  7:39         ` Piotr Wilczek
  2012-09-28 10:34       ` [U-Boot] [PATCH v4 0/4] Exynos: Support for display drivers Piotr Wilczek
  1 sibling, 1 reply; 32+ messages in thread
From: Minkyu Kang @ 2012-09-27  6:58 UTC (permalink / raw)
  To: u-boot

Dear Piotr,

On 24 September 2012 22:04, Piotr Wilczek <p.wilczek@samsung.com> wrote:
> This patch add ld9040 video driver:
> new file:   drivers/video/ld9040.c
> new file:   include/ld9040.h
> modified:   drivers/video/Makefile

It's a unnecessary information.
Please remove it.

>
> Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> CC: Minkyu Kang <mk7.kang@samsung.com>
> CC: Donghwa Lee <dh09.lee@samsung.com>
> ---
> This patch depends on software SPI:
> <1348487791-18435-2-git-send-email-p.wilczek@samsung.com>
>
> Changes in v2:
> - none.
> Changes in v3:
> - none
>
>  drivers/video/Makefile |    1 +
>  drivers/video/ld9040.c |  147 ++++++++++++++++++++++++++++++++++++++++++++++++
>  include/ld9040.h       |   32 ++++++++++
>  3 files changed, 180 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/video/ld9040.c
>  create mode 100644 include/ld9040.h
>
> diff --git a/drivers/video/Makefile b/drivers/video/Makefile
> index ebb6da8..247b867 100644
> --- a/drivers/video/Makefile
> +++ b/drivers/video/Makefile
> @@ -37,6 +37,7 @@ COBJS-$(CONFIG_EXYNOS_PWM_BL) += exynos_pwm_bl.o
>  COBJS-$(CONFIG_FSL_DIU_FB) += fsl_diu_fb.o videomodes.o
>  COBJS-$(CONFIG_S6E8AX0) += s6e8ax0.o
>  COBJS-$(CONFIG_S6E63D6) += s6e63d6.o
> +COBJS-$(CONFIG_LD9040) += ld9040.o
>  COBJS-$(CONFIG_SED156X) += sed156x.o
>  COBJS-$(CONFIG_VIDEO_AMBA) += amba.o
>  COBJS-$(CONFIG_VIDEO_CT69000) += ct69000.o videomodes.o
> diff --git a/drivers/video/ld9040.c b/drivers/video/ld9040.c
> new file mode 100644
> index 0000000..6e94086
> --- /dev/null
> +++ b/drivers/video/ld9040.c
> @@ -0,0 +1,147 @@
> +/*
> + * ld9040 AMOLED LCD panel driver.
> + *
> + * Copyright (C) 2012 Samsung Electronics
> + * Donghwa Lee <dh09.lee@samsung.com>

is author Donghwa?

> + *
> + * 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 <spi.h>
> +
> +/* these machine specific platform data would be setting at universal.c */

is this panel driver for universal board only?

> +struct spi_platform_data *ld9040;
> +
> +static const unsigned char SEQ_SWRESET[] = {
> +       0x01,
> +};
> +
> +static const unsigned char SEQ_USER_SETTING[] = {
> +       0xF0, 0x5A, 0x5A
> +};
> +
> +static const unsigned char SEQ_ELVSS_ON[] = {
> +       0xB1, 0x0D, 0x00, 0x16,
> +};
> +
> +static const unsigned char SEQ_TEMP_SWIRE[] = {
> +       0xB2, 0x06, 0x06, 0x06, 0x06,
> +};
> +
> +static const unsigned char SEQ_GTCON[] = {
> +       0xF7, 0x09, 0x00, 0x00,
> +};
> +
> +static const unsigned char SEQ_PANEL_CONDITION[] = {
> +       0xF8, 0x05, 0x65, 0x96, 0x71, 0x7D, 0x19, 0x3B,
> +       0x0D, 0x19, 0x7E, 0x0D, 0xE2, 0x00, 0x00, 0x7E,
> +       0x7D, 0x07, 0x07, 0x20, 0x20, 0x20, 0x02, 0x02,
> +};
> +
> +static const unsigned char SEQ_GAMMA_SET1[] = {
> +       0xF9, 0x00, 0xA7, 0xB4, 0xAE, 0xBF, 0x00, 0x91,
> +       0x00, 0xB2, 0xB4, 0xAA, 0xBB, 0x00, 0xAC, 0x00,
> +       0xB3, 0xB1, 0xAA, 0xBC, 0x00, 0xB3,
> +};
> +
> +static const unsigned char SEQ_GAMMA_CTRL[] = {
> +       0xFB, 0x02, 0x5A,
> +};
> +
> +static const unsigned char SEQ_APON[] = {
> +       0xF3, 0x00, 0x00, 0x00, 0x0A, 0x02,
> +};
> +
> +static const unsigned char SEQ_DISPCTL[] = {
> +       0xF2, 0x02, 0x08, 0x08, 0x10, 0x10,
> +};
> +
> +static const unsigned char SEQ_MANPWR[] = {
> +       0xB0, 0x04,
> +};
> +
> +static const unsigned char SEQ_PWR_CTRL[] = {
> +       0xF4, 0x0A, 0x87, 0x25, 0x6A, 0x44, 0x02, 0x88,
> +};
> +
> +static const unsigned char SEQ_SLPOUT[] = {
> +       0x11,
> +};
> +
> +static const unsigned char SEQ_SLPIN[] = {
> +       0x10,
> +};
> +
> +static const unsigned char SEQ_DISPON[] = {
> +       0x29,
> +};
> +
> +static const unsigned char SEQ_DISPOFF[] = {
> +       0x28,
> +};
> +
> +static void ld9040_spi_write(const unsigned char *wbuf, unsigned int size_cmd)
> +{
> +       int i = 0;
> +
> +       /*
> +        * Data are transmitted in 9-bit words:
> +        * the first bit is command/parameter, the other are the value.
> +        * The value's LSB is shifted to MSB position, to be sent as 9th bit
> +        */
> +
> +       unsigned int data_out = 0, data_in = 0;
> +       for (i = 0; i < size_cmd; i++) {
> +               data_out = wbuf[i] >> 1;
> +               if (i != 0)
> +                       data_out += 0x0080;
> +               if (wbuf[i] & 0x01)
> +                       data_out += 0x8000;
> +               spi_xfer(NULL, 9, &data_out, &data_in, SPI_XFER_BEGIN);
> +       }
> +}
> +
> +void ld9040_cfg_ldo(void)
> +{
> +       udelay(10);
> +
> +       ld9040_spi_write(SEQ_USER_SETTING,
> +                                       ARRAY_SIZE(SEQ_USER_SETTING));
> +       ld9040_spi_write(SEQ_PANEL_CONDITION,
> +                                       ARRAY_SIZE(SEQ_PANEL_CONDITION));
> +       ld9040_spi_write(SEQ_DISPCTL, ARRAY_SIZE(SEQ_DISPCTL));
> +       ld9040_spi_write(SEQ_MANPWR, ARRAY_SIZE(SEQ_MANPWR));
> +       ld9040_spi_write(SEQ_PWR_CTRL, ARRAY_SIZE(SEQ_PWR_CTRL));
> +       ld9040_spi_write(SEQ_ELVSS_ON, ARRAY_SIZE(SEQ_ELVSS_ON));
> +       ld9040_spi_write(SEQ_GTCON, ARRAY_SIZE(SEQ_GTCON));
> +       ld9040_spi_write(SEQ_GAMMA_SET1, ARRAY_SIZE(SEQ_GAMMA_SET1));
> +       ld9040_spi_write(SEQ_GAMMA_CTRL, ARRAY_SIZE(SEQ_GAMMA_CTRL));
> +       ld9040_spi_write(SEQ_SLPOUT, ARRAY_SIZE(SEQ_SLPOUT));
> +
> +       udelay(120);
> +}
> +
> +void ld9040_enable_ldo(unsigned int onoff)
> +{
> +       if (onoff)
> +               ld9040_spi_write(SEQ_DISPON, ARRAY_SIZE(SEQ_DISPON));
> +       else
> +               ld9040_spi_write(SEQ_DISPOFF, ARRAY_SIZE(SEQ_DISPOFF));
> +}

Thanks.
Minkyu Kang.
-- 
from. prom.
www.promsoft.net

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v3 2/5] drivers: video: Add ld9040 video driver
  2012-09-27  6:58       ` Minkyu Kang
@ 2012-09-27  7:39         ` Piotr Wilczek
  0 siblings, 0 replies; 32+ messages in thread
From: Piotr Wilczek @ 2012-09-27  7:39 UTC (permalink / raw)
  To: u-boot

Dear Minkyu,

> -----Original Message-----
> From: Minkyu Kang [mailto:promsoft at gmail.com]
> Sent: Thursday, September 27, 2012 8:59 AM
> To: Piotr Wilczek
> Cc: u-boot at lists.denx.de; Kyungmin Park; Donghwa Lee
> Subject: Re: [U-Boot] [PATCH v3 2/5] drivers: video: Add ld9040 video
> driver
> 
> Dear Piotr,
> 
> On 24 September 2012 22:04, Piotr Wilczek <p.wilczek@samsung.com>
> wrote:
> > This patch add ld9040 video driver:
> > new file:   drivers/video/ld9040.c
> > new file:   include/ld9040.h
> > modified:   drivers/video/Makefile
> 
> It's a unnecessary information.
> Please remove it.
Ok.
> 
> >
> > Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
> > Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> > CC: Minkyu Kang <mk7.kang@samsung.com>
> > CC: Donghwa Lee <dh09.lee@samsung.com>
> > ---
> > This patch depends on software SPI:
> > <1348487791-18435-2-git-send-email-p.wilczek@samsung.com>
> >
> > Changes in v2:
> > - none.
> > Changes in v3:
> > - none
> >
> >  drivers/video/Makefile |    1 +
> >  drivers/video/ld9040.c |  147
> ++++++++++++++++++++++++++++++++++++++++++++++++
> >  include/ld9040.h       |   32 ++++++++++
> >  3 files changed, 180 insertions(+), 0 deletions(-)  create mode
> > 100644 drivers/video/ld9040.c  create mode 100644 include/ld9040.h
> >
> > diff --git a/drivers/video/Makefile b/drivers/video/Makefile index
> > ebb6da8..247b867 100644
> > --- a/drivers/video/Makefile
> > +++ b/drivers/video/Makefile
> > @@ -37,6 +37,7 @@ COBJS-$(CONFIG_EXYNOS_PWM_BL) += exynos_pwm_bl.o
> >  COBJS-$(CONFIG_FSL_DIU_FB) += fsl_diu_fb.o videomodes.o
> >  COBJS-$(CONFIG_S6E8AX0) += s6e8ax0.o
> >  COBJS-$(CONFIG_S6E63D6) += s6e63d6.o
> > +COBJS-$(CONFIG_LD9040) += ld9040.o
> >  COBJS-$(CONFIG_SED156X) += sed156x.o
> >  COBJS-$(CONFIG_VIDEO_AMBA) += amba.o
> >  COBJS-$(CONFIG_VIDEO_CT69000) += ct69000.o videomodes.o diff --git
> > a/drivers/video/ld9040.c b/drivers/video/ld9040.c new file mode
> 100644
> > index 0000000..6e94086
> > --- /dev/null
> > +++ b/drivers/video/ld9040.c
> > @@ -0,0 +1,147 @@
> > +/*
> > + * ld9040 AMOLED LCD panel driver.
> > + *
> > + * Copyright (C) 2012 Samsung Electronics
> > + * Donghwa Lee <dh09.lee@samsung.com>
> 
> is author Donghwa?
I believe so. This driver is a modification of the driver that can be found
in Kernel and the author is Mr. Donghwa Lee.
> 
> > + *
> > + * 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 <spi.h>
> > +
> > +/* these machine specific platform data would be setting at
> > +universal.c */
> 
> is this panel driver for universal board only?
No it's not. This comment is unnecessary. Also, the following 'struct
spi_platform_data *ld9040' is not used. I should remove both.
> 
> > +struct spi_platform_data *ld9040;
> > +
> > +static const unsigned char SEQ_SWRESET[] = {
> > +       0x01,
> > +};
> > +
> > +static const unsigned char SEQ_USER_SETTING[] = {
> > +       0xF0, 0x5A, 0x5A
> > +};
> > +
> > +static const unsigned char SEQ_ELVSS_ON[] = {
> > +       0xB1, 0x0D, 0x00, 0x16,
> > +};
> > +
> > +static const unsigned char SEQ_TEMP_SWIRE[] = {
> > +       0xB2, 0x06, 0x06, 0x06, 0x06,
> > +};
> > +
> > +static const unsigned char SEQ_GTCON[] = {
> > +       0xF7, 0x09, 0x00, 0x00,
> > +};
> > +
> > +static const unsigned char SEQ_PANEL_CONDITION[] = {
> > +       0xF8, 0x05, 0x65, 0x96, 0x71, 0x7D, 0x19, 0x3B,
> > +       0x0D, 0x19, 0x7E, 0x0D, 0xE2, 0x00, 0x00, 0x7E,
> > +       0x7D, 0x07, 0x07, 0x20, 0x20, 0x20, 0x02, 0x02, };
> > +
> > +static const unsigned char SEQ_GAMMA_SET1[] = {
> > +       0xF9, 0x00, 0xA7, 0xB4, 0xAE, 0xBF, 0x00, 0x91,
> > +       0x00, 0xB2, 0xB4, 0xAA, 0xBB, 0x00, 0xAC, 0x00,
> > +       0xB3, 0xB1, 0xAA, 0xBC, 0x00, 0xB3, };
> > +
> > +static const unsigned char SEQ_GAMMA_CTRL[] = {
> > +       0xFB, 0x02, 0x5A,
> > +};
> > +
> > +static const unsigned char SEQ_APON[] = {
> > +       0xF3, 0x00, 0x00, 0x00, 0x0A, 0x02, };
> > +
> > +static const unsigned char SEQ_DISPCTL[] = {
> > +       0xF2, 0x02, 0x08, 0x08, 0x10, 0x10, };
> > +
> > +static const unsigned char SEQ_MANPWR[] = {
> > +       0xB0, 0x04,
> > +};
> > +
> > +static const unsigned char SEQ_PWR_CTRL[] = {
> > +       0xF4, 0x0A, 0x87, 0x25, 0x6A, 0x44, 0x02, 0x88, };
> > +
> > +static const unsigned char SEQ_SLPOUT[] = {
> > +       0x11,
> > +};
> > +
> > +static const unsigned char SEQ_SLPIN[] = {
> > +       0x10,
> > +};
> > +
> > +static const unsigned char SEQ_DISPON[] = {
> > +       0x29,
> > +};
> > +
> > +static const unsigned char SEQ_DISPOFF[] = {
> > +       0x28,
> > +};
> > +
> > +static void ld9040_spi_write(const unsigned char *wbuf, unsigned int
> > +size_cmd) {
> > +       int i = 0;
> > +
> > +       /*
> > +        * Data are transmitted in 9-bit words:
> > +        * the first bit is command/parameter, the other are the
> value.
> > +        * The value's LSB is shifted to MSB position, to be sent as
> 9th bit
> > +        */
> > +
> > +       unsigned int data_out = 0, data_in = 0;
> > +       for (i = 0; i < size_cmd; i++) {
> > +               data_out = wbuf[i] >> 1;
> > +               if (i != 0)
> > +                       data_out += 0x0080;
> > +               if (wbuf[i] & 0x01)
> > +                       data_out += 0x8000;
> > +               spi_xfer(NULL, 9, &data_out, &data_in,
> SPI_XFER_BEGIN);
> > +       }
> > +}
> > +
> > +void ld9040_cfg_ldo(void)
> > +{
> > +       udelay(10);
> > +
> > +       ld9040_spi_write(SEQ_USER_SETTING,
> > +
> ARRAY_SIZE(SEQ_USER_SETTING));
> > +       ld9040_spi_write(SEQ_PANEL_CONDITION,
> > +
> ARRAY_SIZE(SEQ_PANEL_CONDITION));
> > +       ld9040_spi_write(SEQ_DISPCTL, ARRAY_SIZE(SEQ_DISPCTL));
> > +       ld9040_spi_write(SEQ_MANPWR, ARRAY_SIZE(SEQ_MANPWR));
> > +       ld9040_spi_write(SEQ_PWR_CTRL, ARRAY_SIZE(SEQ_PWR_CTRL));
> > +       ld9040_spi_write(SEQ_ELVSS_ON, ARRAY_SIZE(SEQ_ELVSS_ON));
> > +       ld9040_spi_write(SEQ_GTCON, ARRAY_SIZE(SEQ_GTCON));
> > +       ld9040_spi_write(SEQ_GAMMA_SET1, ARRAY_SIZE(SEQ_GAMMA_SET1));
> > +       ld9040_spi_write(SEQ_GAMMA_CTRL, ARRAY_SIZE(SEQ_GAMMA_CTRL));
> > +       ld9040_spi_write(SEQ_SLPOUT, ARRAY_SIZE(SEQ_SLPOUT));
> > +
> > +       udelay(120);
> > +}
> > +
> > +void ld9040_enable_ldo(unsigned int onoff) {
> > +       if (onoff)
> > +               ld9040_spi_write(SEQ_DISPON, ARRAY_SIZE(SEQ_DISPON));
> > +       else
> > +               ld9040_spi_write(SEQ_DISPOFF,
> > +ARRAY_SIZE(SEQ_DISPOFF)); }
> 
> Thanks.
> Minkyu Kang.
> --
> from. prom.
> www.promsoft.net

Thank you,
Piotr Wilczek

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v4 0/4] Exynos: Support for display drivers
  2012-09-24 13:04     ` [U-Boot] [PATCH v3 2/5] drivers: video: Add ld9040 video driver Piotr Wilczek
  2012-09-27  6:58       ` Minkyu Kang
@ 2012-09-28 10:34       ` Piotr Wilczek
  2012-09-28 10:34         ` [U-Boot] [PATCH v4 1/4] misc:max8998 Add LDO macros Piotr Wilczek
                           ` (3 more replies)
  1 sibling, 4 replies; 32+ messages in thread
From: Piotr Wilczek @ 2012-09-28 10:34 UTC (permalink / raw)
  To: u-boot

This patchset add support for display on Universal C210 board.
Max8998 is modified to power on display, new driver ld9040 is added
and support for LCD display on universal C210 board is added.

Changes in v2:
- removed unnecessary function for fimd clock set;
- code cleanup
- removed patch for fix exynos4_fb structure
Changes in v3:
- small changes in Patch 5/5 after some changes in another
 patch ID=<1348487791-18435-2-git-send-email-p.wilczek@samsung.com>
 on which this patch depends on.
Changes in v4:
- removed comment and unused struct
- removed patch with unused display control define

Piotr Wilczek (4):
  misc:max8998 Add LDO macros
  drivers: video: Add ld9040 video driver
  drivers: video: fix image position
  exynos4: universal_C210: add display support

 board/samsung/universal_c210/universal.c |  202 +++++++++++++++++++++++++++---
 drivers/video/Makefile                   |    1 +
 drivers/video/exynos_fb.c                |   15 ++-
 drivers/video/ld9040.c                   |  144 +++++++++++++++++++++
 include/configs/s5pc210_universal.h      |   13 ++
 include/ld9040.h                         |   32 +++++
 include/max8998_pmic.h                   |    2 +
 7 files changed, 389 insertions(+), 20 deletions(-)
 create mode 100644 drivers/video/ld9040.c
 create mode 100644 include/ld9040.h

-- 
1.7.5.4

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v4 1/4] misc:max8998 Add LDO macros
  2012-09-28 10:34       ` [U-Boot] [PATCH v4 0/4] Exynos: Support for display drivers Piotr Wilczek
@ 2012-09-28 10:34         ` Piotr Wilczek
  2012-10-19 15:34           ` [U-Boot] [PATCH v5 0/5] arm:exynos: Support for display drivers Piotr Wilczek
  2012-09-28 10:34         ` [U-Boot] [PATCH v4 2/4] drivers: video: Add ld9040 video driver Piotr Wilczek
                           ` (2 subsequent siblings)
  3 siblings, 1 reply; 32+ messages in thread
From: Piotr Wilczek @ 2012-09-28 10:34 UTC (permalink / raw)
  To: u-boot

Add LDO7 and LDO17 macros to max8998_pmic.h necessary to power on the LCD.

Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
CC: Minkyu Kang <mk7.kang@samsung.com>
---
Changes in v2:
- none.
Changes in v3:
- none.
Changes in v4:
- none.

 include/max8998_pmic.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/include/max8998_pmic.h b/include/max8998_pmic.h
index ca21f88..0e559f9 100644
--- a/include/max8998_pmic.h
+++ b/include/max8998_pmic.h
@@ -76,7 +76,9 @@ enum {
 
 #define MAX8998_LDO3		(1 << 2)
 #define MAX8998_LDO4		(1 << 1)
+#define MAX8998_LDO7		(1 << 6)
 #define MAX8998_LDO8		(1 << 5)
+#define MAX8998_LDO17		(1 << 4)
 #define MAX8998_SAFEOUT1	(1 << 4)
 
 #define MAX8998_I2C_ADDR        (0xCC >> 1)
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v4 2/4] drivers: video: Add ld9040 video driver
  2012-09-28 10:34       ` [U-Boot] [PATCH v4 0/4] Exynos: Support for display drivers Piotr Wilczek
  2012-09-28 10:34         ` [U-Boot] [PATCH v4 1/4] misc:max8998 Add LDO macros Piotr Wilczek
@ 2012-09-28 10:34         ` Piotr Wilczek
  2012-09-28 10:34         ` [U-Boot] [PATCH v4 3/4] drivers: video: fix image position Piotr Wilczek
  2012-09-28 10:34         ` [U-Boot] [PATCH v4 4/4] exynos4: universal_C210: add display support Piotr Wilczek
  3 siblings, 0 replies; 32+ messages in thread
From: Piotr Wilczek @ 2012-09-28 10:34 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
CC: Minkyu Kang <mk7.kang@samsung.com>
CC: Donghwa Lee <dh09.lee@samsung.com>
---
This patch depends on software SPI:
<1346228122-13444-2-git-send-email-p.wilczek@samsung.com>

Changes in v2:
- none
Changes in v3:
- none
Changes in v4:
- removed comment and unused struct

 drivers/video/Makefile |    1 +
 drivers/video/ld9040.c |  144 ++++++++++++++++++++++++++++++++++++++++++++++++
 include/ld9040.h       |   32 +++++++++++
 3 files changed, 177 insertions(+), 0 deletions(-)
 create mode 100644 drivers/video/ld9040.c
 create mode 100644 include/ld9040.h

diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index ebb6da8..247b867 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -37,6 +37,7 @@ COBJS-$(CONFIG_EXYNOS_PWM_BL) += exynos_pwm_bl.o
 COBJS-$(CONFIG_FSL_DIU_FB) += fsl_diu_fb.o videomodes.o
 COBJS-$(CONFIG_S6E8AX0) += s6e8ax0.o
 COBJS-$(CONFIG_S6E63D6) += s6e63d6.o
+COBJS-$(CONFIG_LD9040) += ld9040.o
 COBJS-$(CONFIG_SED156X) += sed156x.o
 COBJS-$(CONFIG_VIDEO_AMBA) += amba.o
 COBJS-$(CONFIG_VIDEO_CT69000) += ct69000.o videomodes.o
diff --git a/drivers/video/ld9040.c b/drivers/video/ld9040.c
new file mode 100644
index 0000000..c01ae12
--- /dev/null
+++ b/drivers/video/ld9040.c
@@ -0,0 +1,144 @@
+/*
+ * ld9040 AMOLED LCD panel driver.
+ *
+ * Copyright (C) 2012 Samsung Electronics
+ * Donghwa Lee <dh09.lee@samsung.com>
+ *
+ * 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 <spi.h>
+
+static const unsigned char SEQ_SWRESET[] = {
+	0x01,
+};
+
+static const unsigned char SEQ_USER_SETTING[] = {
+	0xF0, 0x5A, 0x5A
+};
+
+static const unsigned char SEQ_ELVSS_ON[] = {
+	0xB1, 0x0D, 0x00, 0x16,
+};
+
+static const unsigned char SEQ_TEMP_SWIRE[] = {
+	0xB2, 0x06, 0x06, 0x06, 0x06,
+};
+
+static const unsigned char SEQ_GTCON[] = {
+	0xF7, 0x09, 0x00, 0x00,
+};
+
+static const unsigned char SEQ_PANEL_CONDITION[] = {
+	0xF8, 0x05, 0x65, 0x96, 0x71, 0x7D, 0x19, 0x3B,
+	0x0D, 0x19, 0x7E, 0x0D, 0xE2, 0x00, 0x00, 0x7E,
+	0x7D, 0x07, 0x07, 0x20, 0x20, 0x20, 0x02, 0x02,
+};
+
+static const unsigned char SEQ_GAMMA_SET1[] = {
+	0xF9, 0x00, 0xA7, 0xB4, 0xAE, 0xBF, 0x00, 0x91,
+	0x00, 0xB2, 0xB4, 0xAA, 0xBB, 0x00, 0xAC, 0x00,
+	0xB3, 0xB1, 0xAA, 0xBC, 0x00, 0xB3,
+};
+
+static const unsigned char SEQ_GAMMA_CTRL[] = {
+	0xFB, 0x02, 0x5A,
+};
+
+static const unsigned char SEQ_APON[] = {
+	0xF3, 0x00, 0x00, 0x00, 0x0A, 0x02,
+};
+
+static const unsigned char SEQ_DISPCTL[] = {
+	0xF2, 0x02, 0x08, 0x08, 0x10, 0x10,
+};
+
+static const unsigned char SEQ_MANPWR[] = {
+	0xB0, 0x04,
+};
+
+static const unsigned char SEQ_PWR_CTRL[] = {
+	0xF4, 0x0A, 0x87, 0x25, 0x6A, 0x44, 0x02, 0x88,
+};
+
+static const unsigned char SEQ_SLPOUT[] = {
+	0x11,
+};
+
+static const unsigned char SEQ_SLPIN[] = {
+	0x10,
+};
+
+static const unsigned char SEQ_DISPON[] = {
+	0x29,
+};
+
+static const unsigned char SEQ_DISPOFF[] = {
+	0x28,
+};
+
+static void ld9040_spi_write(const unsigned char *wbuf, unsigned int size_cmd)
+{
+	int i = 0;
+
+	/*
+	 * Data are transmitted in 9-bit words:
+	 * the first bit is command/parameter, the other are the value.
+	 * The value's LSB is shifted to MSB position, to be sent as 9th bit
+	 */
+
+	unsigned int data_out = 0, data_in = 0;
+	for (i = 0; i < size_cmd; i++) {
+		data_out = wbuf[i] >> 1;
+		if (i != 0)
+			data_out += 0x0080;
+		if (wbuf[i] & 0x01)
+			data_out += 0x8000;
+		spi_xfer(NULL, 9, &data_out, &data_in, SPI_XFER_BEGIN);
+	}
+}
+
+void ld9040_cfg_ldo(void)
+{
+	udelay(10);
+
+	ld9040_spi_write(SEQ_USER_SETTING,
+					ARRAY_SIZE(SEQ_USER_SETTING));
+	ld9040_spi_write(SEQ_PANEL_CONDITION,
+					ARRAY_SIZE(SEQ_PANEL_CONDITION));
+	ld9040_spi_write(SEQ_DISPCTL, ARRAY_SIZE(SEQ_DISPCTL));
+	ld9040_spi_write(SEQ_MANPWR, ARRAY_SIZE(SEQ_MANPWR));
+	ld9040_spi_write(SEQ_PWR_CTRL, ARRAY_SIZE(SEQ_PWR_CTRL));
+	ld9040_spi_write(SEQ_ELVSS_ON, ARRAY_SIZE(SEQ_ELVSS_ON));
+	ld9040_spi_write(SEQ_GTCON, ARRAY_SIZE(SEQ_GTCON));
+	ld9040_spi_write(SEQ_GAMMA_SET1, ARRAY_SIZE(SEQ_GAMMA_SET1));
+	ld9040_spi_write(SEQ_GAMMA_CTRL, ARRAY_SIZE(SEQ_GAMMA_CTRL));
+	ld9040_spi_write(SEQ_SLPOUT, ARRAY_SIZE(SEQ_SLPOUT));
+
+	udelay(120);
+}
+
+void ld9040_enable_ldo(unsigned int onoff)
+{
+	if (onoff)
+		ld9040_spi_write(SEQ_DISPON, ARRAY_SIZE(SEQ_DISPON));
+	else
+		ld9040_spi_write(SEQ_DISPOFF, ARRAY_SIZE(SEQ_DISPOFF));
+}
diff --git a/include/ld9040.h b/include/ld9040.h
new file mode 100644
index 0000000..fe99390
--- /dev/null
+++ b/include/ld9040.h
@@ -0,0 +1,32 @@
+/*
+ * ld9040 AMOLED LCD panel driver.
+ *
+ * Copyright (C) 2012 Samsung Electronics
+ * Donghwa Lee <dh09.lee@samsung.com>
+ *
+ * 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
+ */
+
+#ifndef __LD9040_H_
+#define __LD9040_H_
+
+void ld9040_cfg_ldo(void);
+void ld9040_enable_ldo(unsigned int onoff);
+
+#endif /* __LD9040_H_ */
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v4 3/4] drivers: video: fix image position
  2012-09-28 10:34       ` [U-Boot] [PATCH v4 0/4] Exynos: Support for display drivers Piotr Wilczek
  2012-09-28 10:34         ` [U-Boot] [PATCH v4 1/4] misc:max8998 Add LDO macros Piotr Wilczek
  2012-09-28 10:34         ` [U-Boot] [PATCH v4 2/4] drivers: video: Add ld9040 video driver Piotr Wilczek
@ 2012-09-28 10:34         ` Piotr Wilczek
  2012-09-28 10:34         ` [U-Boot] [PATCH v4 4/4] exynos4: universal_C210: add display support Piotr Wilczek
  3 siblings, 0 replies; 32+ messages in thread
From: Piotr Wilczek @ 2012-09-28 10:34 UTC (permalink / raw)
  To: u-boot

This patch fixes image position on screen when images's height or width is biger than the lcd's.

Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
CC: Minkyu Kang <mk7.kang@samsung.com>
---
Changes in v2:
- none.
Changes in v3:
- none
Changes in v4:
- none

 drivers/video/exynos_fb.c |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/video/exynos_fb.c b/drivers/video/exynos_fb.c
index e31a0fd..d9a3f9a 100644
--- a/drivers/video/exynos_fb.c
+++ b/drivers/video/exynos_fb.c
@@ -70,8 +70,19 @@ static void draw_logo(void)
 	int x, y;
 	ulong addr;
 
-	x = ((panel_width - panel_info.logo_width) >> 1);
-	y = ((panel_height - panel_info.logo_height) >> 1) - 4;
+	if (panel_width >= panel_info.logo_width) {
+		x = ((panel_width - panel_info.logo_width) >> 1);
+	} else {
+		x = 0;
+		printf("Warning: image width is bigger than display width\n");
+	}
+
+	if (panel_height >= panel_info.logo_height) {
+		y = ((panel_height - panel_info.logo_height) >> 1) - 4;
+	} else {
+		y = 0;
+		printf("Warning: image height is bigger than display height\n");
+	}
 
 	addr = panel_info.logo_addr;
 	bmp_display(addr, x, y);
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v4 4/4] exynos4: universal_C210: add display support
  2012-09-28 10:34       ` [U-Boot] [PATCH v4 0/4] Exynos: Support for display drivers Piotr Wilczek
                           ` (2 preceding siblings ...)
  2012-09-28 10:34         ` [U-Boot] [PATCH v4 3/4] drivers: video: fix image position Piotr Wilczek
@ 2012-09-28 10:34         ` Piotr Wilczek
  3 siblings, 0 replies; 32+ messages in thread
From: Piotr Wilczek @ 2012-09-28 10:34 UTC (permalink / raw)
  To: u-boot

This patch add support for display on Universal C210 board.
Width of displyed logo must be not bigger than 480 pixel and
is limited by width of the screen.
Tizen logo size is 520x120 pixels and should be resized.

Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
CC: Minkyu Kang <mk7.kang@samsung.com>
---
Changes in v2:
- removed unnecessary function for fimd clock set;
- removed unnecessary return;
- moved init_pmic_lcd to CONFIG_PMIC
Changes in v3:
- code cleanup
Changes in v4:
- none

 board/samsung/universal_c210/universal.c |  202 +++++++++++++++++++++++++++---
 include/configs/s5pc210_universal.h      |   13 ++
 2 files changed, 197 insertions(+), 18 deletions(-)

diff --git a/board/samsung/universal_c210/universal.c b/board/samsung/universal_c210/universal.c
index 72999d9..f1ff299 100644
--- a/board/samsung/universal_c210/universal.c
+++ b/board/samsung/universal_c210/universal.c
@@ -24,6 +24,7 @@
 
 #include <common.h>
 #include <spi.h>
+#include <lcd.h>
 #include <asm/io.h>
 #include <asm/gpio.h>
 #include <asm/arch/adc.h>
@@ -35,6 +36,8 @@
 #include <asm/arch/cpu.h>
 #include <max8998_pmic.h>
 #include <asm/arch/watchdog.h>
+#include <libtizen.h>
+#include <ld9040.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -54,24 +57,6 @@ static int get_hwrev(void)
 
 static void check_hw_revision(void);
 
-int board_init(void)
-{
-	gpio1 = (struct exynos4_gpio_part1 *) EXYNOS4_GPIO_PART1_BASE;
-	gpio2 = (struct exynos4_gpio_part2 *) EXYNOS4_GPIO_PART2_BASE;
-
-	gd->bd->bi_arch_number = MACH_TYPE_UNIVERSAL_C210;
-	gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
-
-#if defined(CONFIG_PMIC)
-	pmic_init();
-#endif
-
-	check_hw_revision();
-	printf("HW Revision:\t0x%x\n", board_rev);
-
-	return 0;
-}
-
 int dram_init(void)
 {
 	gd->ram_size = get_ram_size((long *)PHYS_SDRAM_1, PHYS_SDRAM_1_SIZE) +
@@ -318,3 +303,184 @@ int  spi_cs_is_valid(unsigned int bus, unsigned int cs)
 	return bus == 0 && cs == 0;
 }
 #endif
+
+static void init_pmic_lcd(void)
+{
+	unsigned char val;
+	int ret = 0;
+
+	struct pmic *p = get_pmic();
+
+	if (pmic_probe(p))
+		return;
+
+	/* LDO7 1.8V */
+	val = 0x02; /* (1800 - 1600) / 100; */
+	ret |= pmic_reg_write(p,  MAX8998_REG_LDO7, val);
+
+	/* LDO17 3.0V */
+	val = 0xe; /* (3000 - 1600) / 100; */
+	ret |= pmic_reg_write(p,  MAX8998_REG_LDO17, val);
+
+	/* Disable unneeded regulators */
+	/*
+	 * ONOFF1
+	 * Buck1 ON, Buck2 OFF, Buck3 ON, Buck4 ON
+	 * LDO2 ON, LDO3 OFF, LDO4 OFF, LDO5 ON
+	 */
+	val = 0xB9;
+	ret |= pmic_reg_write(p,  MAX8998_REG_ONOFF1, val);
+
+	/* ONOFF2
+	 * LDO6 OFF, LDO7 ON, LDO8 OFF, LDO9 ON,
+	 * LDO10 OFF, LDO11 OFF, LDO12 OFF, LDO13 OFF
+	 */
+	val = 0x50;
+	ret |= pmic_reg_write(p,  MAX8998_REG_ONOFF2, val);
+
+	/* ONOFF3
+	 * LDO14 OFF, LDO15 OFF, LGO16 OFF, LDO17 OFF
+	 * EPWRHOLD OFF, EBATTMON OFF, ELBCNFG2 OFF, ELBCNFG1 OFF
+	 */
+	val = 0x00;
+	ret |= pmic_reg_write(p,  MAX8998_REG_ONOFF3, val);
+
+	if (ret)
+		puts("LCD pmic initialisation error!\n");
+}
+
+static void lcd_cfg_gpio(void)
+{
+	unsigned int i, f3_end = 4;
+
+	for (i = 0; i < 8; i++) {
+		/* set GPF0,1,2[0:7] for RGB Interface and Data lines (32bit) */
+		s5p_gpio_cfg_pin(&gpio1->f0, i, GPIO_FUNC(2));
+		s5p_gpio_cfg_pin(&gpio1->f1, i, GPIO_FUNC(2));
+		s5p_gpio_cfg_pin(&gpio1->f2, i, GPIO_FUNC(2));
+		/* pull-up/down disable */
+		s5p_gpio_set_pull(&gpio1->f0, i, GPIO_PULL_NONE);
+		s5p_gpio_set_pull(&gpio1->f1, i, GPIO_PULL_NONE);
+		s5p_gpio_set_pull(&gpio1->f2, i, GPIO_PULL_NONE);
+
+		/* drive strength to max (24bit) */
+		s5p_gpio_set_drv(&gpio1->f0, i, GPIO_DRV_4X);
+		s5p_gpio_set_rate(&gpio1->f0, i, GPIO_DRV_SLOW);
+		s5p_gpio_set_drv(&gpio1->f1, i, GPIO_DRV_4X);
+		s5p_gpio_set_rate(&gpio1->f1, i, GPIO_DRV_SLOW);
+		s5p_gpio_set_drv(&gpio1->f2, i, GPIO_DRV_4X);
+		s5p_gpio_set_rate(&gpio1->f0, i, GPIO_DRV_SLOW);
+	}
+
+	for (i = 0; i < f3_end; i++) {
+		/* set GPF3[0:3] for RGB Interface and Data lines (32bit) */
+		s5p_gpio_cfg_pin(&gpio1->f3, i, GPIO_FUNC(2));
+		/* pull-up/down disable */
+		s5p_gpio_set_pull(&gpio1->f3, i, GPIO_PULL_NONE);
+		/* drive strength to max (24bit) */
+		s5p_gpio_set_drv(&gpio1->f3, i, GPIO_DRV_4X);
+		s5p_gpio_set_rate(&gpio1->f3, i, GPIO_DRV_SLOW);
+	}
+
+	/* gpio pad configuration for LCD reset. */
+	s5p_gpio_cfg_pin(&gpio2->y4, 5, GPIO_OUTPUT);
+
+	spi_init();
+}
+
+static void reset_lcd(void)
+{
+	s5p_gpio_set_value(&gpio2->y4, 5, 1);
+	udelay(10000);
+	s5p_gpio_set_value(&gpio2->y4, 5, 0);
+	udelay(10000);
+	s5p_gpio_set_value(&gpio2->y4, 5, 1);
+	udelay(100);
+}
+
+static void lcd_power_on(void)
+{
+	struct pmic *p = get_pmic();
+
+	if (pmic_probe(p))
+		return;
+
+	pmic_set_output(p, MAX8998_REG_ONOFF3, MAX8998_LDO17, LDO_ON);
+	pmic_set_output(p, MAX8998_REG_ONOFF2, MAX8998_LDO7, LDO_ON);
+}
+
+vidinfo_t panel_info = {
+	.vl_freq	= 60,
+	.vl_col		= 480,
+	.vl_row		= 800,
+	.vl_width	= 480,
+	.vl_height	= 800,
+	.vl_clkp	= CONFIG_SYS_HIGH,
+	.vl_hsp		= CONFIG_SYS_HIGH,
+	.vl_vsp		= CONFIG_SYS_HIGH,
+	.vl_dp		= CONFIG_SYS_HIGH,
+
+	.vl_bpix	= 5,	/* Bits per pixel */
+
+	/* LD9040 LCD Panel */
+	.vl_hspw	= 2,
+	.vl_hbpd	= 16,
+	.vl_hfpd	= 16,
+
+	.vl_vspw	= 2,
+	.vl_vbpd	= 8,
+	.vl_vfpd	= 8,
+	.vl_cmd_allow_len = 0xf,
+
+	.win_id		= 0,
+	.cfg_gpio	= lcd_cfg_gpio,
+	.backlight_on	= NULL,
+	.lcd_power_on	= lcd_power_on,
+	.reset_lcd	= reset_lcd,
+	.dual_lcd_enabled = 0,
+
+	.init_delay	= 0,
+	.power_on_delay = 10000,
+	.reset_delay	= 10000,
+	.interface_mode = FIMD_RGB_INTERFACE,
+	.mipi_enabled	= 0,
+};
+
+void init_panel_info(vidinfo_t *vid)
+{
+	vid->logo_on	= 1;
+	vid->resolution	= HD_RESOLUTION;
+	vid->rgb_mode	= MODE_RGB_P;
+
+#ifdef CONFIG_TIZEN
+	get_tizen_logo_info(vid);
+#endif
+
+	/* for LD9040. */
+	vid->pclk_name = 1;	/* MPLL */
+	vid->sclk_div = 1;
+
+	vid->cfg_ldo = ld9040_cfg_ldo;
+	vid->enable_ldo = ld9040_enable_ldo;
+
+	setenv("lcdinfo", "lcd=ld9040");
+}
+
+int board_init(void)
+{
+	gpio1 = (struct exynos4_gpio_part1 *) EXYNOS4_GPIO_PART1_BASE;
+	gpio2 = (struct exynos4_gpio_part2 *) EXYNOS4_GPIO_PART2_BASE;
+
+	gd->bd->bi_arch_number = MACH_TYPE_UNIVERSAL_C210;
+	gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
+
+#if defined(CONFIG_PMIC)
+	pmic_init();
+	init_pmic_lcd();
+#endif
+
+	check_hw_revision();
+	printf("HW Revision:\t0x%x\n", board_rev);
+
+	return 0;
+}
diff --git a/include/configs/s5pc210_universal.h b/include/configs/s5pc210_universal.h
index f7a7443..ca0989c 100644
--- a/include/configs/s5pc210_universal.h
+++ b/include/configs/s5pc210_universal.h
@@ -34,6 +34,7 @@
 #define CONFIG_S5P		1	/* which is in a S5P Family */
 #define CONFIG_EXYNOS4210	1	/* which is in a EXYNOS4210 */
 #define CONFIG_UNIVERSAL	1	/* working with Universal */
+#define CONFIG_TIZEN		1	/* TIZEN lib */
 
 #include <asm/arch/cpu.h>		/* get chip and board defs */
 
@@ -283,4 +284,16 @@
 void soft_spi_init(void);
 #endif
 
+/*
+ * LCD Settings
+ */
+#define CONFIG_EXYNOS_FB
+#define CONFIG_LCD
+#define CONFIG_CMD_BMP
+#define CONFIG_BMP_32BPP
+#define CONFIG_LD9040
+#define CONFIG_EXYNOS_MIPI_DSIM
+#define CONFIG_VIDEO_BMP_GZIP
+#define CONFIG_SYS_VIDEO_LOGO_MAX_SIZE ((520 * 120 * 4) + (1 << 12))
+
 #endif	/* __CONFIG_H */
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v5 0/5] arm:exynos: Support for display drivers
  2012-09-28 10:34         ` [U-Boot] [PATCH v4 1/4] misc:max8998 Add LDO macros Piotr Wilczek
@ 2012-10-19 15:34           ` Piotr Wilczek
  2012-10-19 15:34             ` [U-Boot] [PATCH v5 1/5] exynos4: universal_C210: use software SPI Piotr Wilczek
                               ` (5 more replies)
  0 siblings, 6 replies; 32+ messages in thread
From: Piotr Wilczek @ 2012-10-19 15:34 UTC (permalink / raw)
  To: u-boot

This patchset add support for display on Universal C210 board.
Software SPI support is added to universal C210.
Max8998 is modified to power on display, new driver ld9040 is added
and support for LCD display on universal C210 board is added.

Changes in v2:
	- removed unnecessary function for fimd clock set;
	- code cleanup
	- removed patch for fix exynos4_fb structure
Changes in v3:
	- code cleanup
Changes in v4:
	- removed comment and unused struct
	- removed patch with unused display control define
Changes in v5:
	- add patch to support soft SPI on Universal_C210
	
Piotr Wilczek (5):
  exynos4: universal_C210: use software SPI
  misc:max8998 Add LDO macros
  drivers: video: Add ld9040 video driver
  drivers: video: fix image position
  exynos4: universal_C210: add display support

 board/samsung/universal_c210/universal.c |  253 +++++++++++++++++++++++++++--
 drivers/video/Makefile                   |    1 +
 drivers/video/exynos_fb.c                |   15 ++-
 drivers/video/ld9040.c                   |  144 +++++++++++++++++
 include/configs/s5pc210_universal.h      |   34 ++++
 include/ld9040.h                         |   32 ++++
 include/max8998_pmic.h                   |    2 +
 7 files changed, 461 insertions(+), 20 deletions(-)
 create mode 100644 drivers/video/ld9040.c
 create mode 100644 include/ld9040.h

-- 
1.7.5.4

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v5 1/5] exynos4: universal_C210: use software SPI
  2012-10-19 15:34           ` [U-Boot] [PATCH v5 0/5] arm:exynos: Support for display drivers Piotr Wilczek
@ 2012-10-19 15:34             ` Piotr Wilczek
  2012-12-09  5:46               ` Albert ARIBAUD
  2012-10-19 15:34             ` [U-Boot] [PATCH v5 2/5] misc:max8998 Add LDO macros Piotr Wilczek
                               ` (4 subsequent siblings)
  5 siblings, 1 reply; 32+ messages in thread
From: Piotr Wilczek @ 2012-10-19 15:34 UTC (permalink / raw)
  To: u-boot

This patch use software spi on Samsung Universal C210 board.

Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
CC: Minkyu Kang <mk7.kang@samsung.com>
---
New path added in v5.

 board/samsung/universal_c210/universal.c |   87 +++++++++++++++++++++++------
 include/configs/s5pc210_universal.h      |   21 +++++++
 2 files changed, 90 insertions(+), 18 deletions(-)

diff --git a/board/samsung/universal_c210/universal.c b/board/samsung/universal_c210/universal.c
index ded97ca..4c1163e 100644
--- a/board/samsung/universal_c210/universal.c
+++ b/board/samsung/universal_c210/universal.c
@@ -23,7 +23,9 @@
  */
 
 #include <common.h>
+#include <spi.h>
 #include <asm/io.h>
+#include <asm/gpio.h>
 #include <asm/arch/adc.h>
 #include <asm/arch/gpio.h>
 #include <asm/arch/mmc.h>
@@ -52,24 +54,6 @@ static int get_hwrev(void)
 
 static void check_hw_revision(void);
 
-int board_init(void)
-{
-	gpio1 = (struct exynos4_gpio_part1 *) EXYNOS4_GPIO_PART1_BASE;
-	gpio2 = (struct exynos4_gpio_part2 *) EXYNOS4_GPIO_PART2_BASE;
-
-	gd->bd->bi_arch_number = MACH_TYPE_UNIVERSAL_C210;
-	gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
-
-#if defined(CONFIG_PMIC)
-	pmic_init();
-#endif
-
-	check_hw_revision();
-	printf("HW Revision:\t0x%x\n", board_rev);
-
-	return 0;
-}
-
 int dram_init(void)
 {
 	gd->ram_size = get_ram_size((long *)PHYS_SDRAM_1, PHYS_SDRAM_1_SIZE) +
@@ -284,3 +268,70 @@ int board_early_init_f(void)
 
 	return 0;
 }
+
+#ifdef CONFIG_SOFT_SPI
+static void soft_spi_init(void)
+{
+	gpio_direction_output(CONFIG_SOFT_SPI_GPIO_SCLK,
+		CONFIG_SOFT_SPI_MODE & SPI_CPOL);
+	gpio_direction_output(CONFIG_SOFT_SPI_GPIO_MOSI, 1);
+	gpio_direction_input(CONFIG_SOFT_SPI_GPIO_MISO);
+	gpio_direction_output(CONFIG_SOFT_SPI_GPIO_CS,
+		!(CONFIG_SOFT_SPI_MODE & SPI_CS_HIGH));
+}
+
+void spi_cs_activate(struct spi_slave *slave)
+{
+	gpio_set_value(CONFIG_SOFT_SPI_GPIO_CS,
+		!(CONFIG_SOFT_SPI_MODE & SPI_CS_HIGH));
+	SPI_SCL(1);
+	gpio_set_value(CONFIG_SOFT_SPI_GPIO_CS,
+		CONFIG_SOFT_SPI_MODE & SPI_CS_HIGH);
+}
+
+void spi_cs_deactivate(struct spi_slave *slave)
+{
+	gpio_set_value(CONFIG_SOFT_SPI_GPIO_CS,
+		!(CONFIG_SOFT_SPI_MODE & SPI_CS_HIGH));
+}
+
+int  spi_cs_is_valid(unsigned int bus, unsigned int cs)
+{
+	return bus == 0 && cs == 0;
+}
+
+void universal_spi_scl(int bit)
+{
+	gpio_set_value(CONFIG_SOFT_SPI_GPIO_SCLK, bit);
+}
+
+void universal_spi_sda(int bit)
+{
+	gpio_set_value(CONFIG_SOFT_SPI_GPIO_MOSI, bit);
+}
+
+int universal_spi_read(void)
+{
+	return gpio_get_value(CONFIG_SOFT_SPI_GPIO_MISO);
+}
+#endif
+
+int board_init(void)
+{
+	gpio1 = (struct exynos4_gpio_part1 *) EXYNOS4_GPIO_PART1_BASE;
+	gpio2 = (struct exynos4_gpio_part2 *) EXYNOS4_GPIO_PART2_BASE;
+
+	gd->bd->bi_arch_number = MACH_TYPE_UNIVERSAL_C210;
+	gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
+
+#if defined(CONFIG_PMIC)
+	pmic_init();
+#endif
+#ifdef CONFIG_SOFT_SPI
+	soft_spi_init();
+#endif
+	check_hw_revision();
+	printf("HW Revision:\t0x%x\n", board_rev);
+
+	return 0;
+}
diff --git a/include/configs/s5pc210_universal.h b/include/configs/s5pc210_universal.h
index 07849fb..54ee8c4 100644
--- a/include/configs/s5pc210_universal.h
+++ b/include/configs/s5pc210_universal.h
@@ -263,4 +263,25 @@
 #define CONFIG_USB_GADGET_S3C_UDC_OTG
 #define CONFIG_USB_GADGET_DUALSPEED
 
+/*
+ * SPI Settings
+ */
+#define CONFIG_SOFT_SPI
+#define CONFIG_SOFT_SPI_MODE SPI_MODE_3
+#define CONFIG_SOFT_SPI_GPIO_SCLK exynos4_gpio_part2_get_nr(y3, 1)
+#define CONFIG_SOFT_SPI_GPIO_MOSI exynos4_gpio_part2_get_nr(y3, 3)
+#define CONFIG_SOFT_SPI_GPIO_MISO exynos4_gpio_part2_get_nr(y3, 0)
+#define CONFIG_SOFT_SPI_GPIO_CS exynos4_gpio_part2_get_nr(y4, 3)
+
+#define SPI_DELAY udelay(1)
+#undef SPI_INIT
+#define SPI_SCL(bit) universal_spi_scl(bit)
+#define SPI_SDA(bit) universal_spi_sda(bit)
+#define SPI_READ universal_spi_read()
+#ifndef	__ASSEMBLY__
+void universal_spi_scl(int bit);
+void universal_spi_sda(int bit);
+int universal_spi_read(void);
+#endif
+
 #endif	/* __CONFIG_H */
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v5 2/5] misc:max8998 Add LDO macros
  2012-10-19 15:34           ` [U-Boot] [PATCH v5 0/5] arm:exynos: Support for display drivers Piotr Wilczek
  2012-10-19 15:34             ` [U-Boot] [PATCH v5 1/5] exynos4: universal_C210: use software SPI Piotr Wilczek
@ 2012-10-19 15:34             ` Piotr Wilczek
  2012-10-19 15:34             ` [U-Boot] [PATCH v5 3/5] drivers: video: Add ld9040 video driver Piotr Wilczek
                               ` (3 subsequent siblings)
  5 siblings, 0 replies; 32+ messages in thread
From: Piotr Wilczek @ 2012-10-19 15:34 UTC (permalink / raw)
  To: u-boot

Add LDO7 and LDO17 macros to max8998_pmic.h necessary to power on the LCD.

Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
CC: Minkyu Kang <mk7.kang@samsung.com>
---
Changes in v2:
	- none
Changes in v3:
	- none
Changes in v4:
	- none
Changes in v5:
	- none

 include/max8998_pmic.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/include/max8998_pmic.h b/include/max8998_pmic.h
index ca21f88..0e559f9 100644
--- a/include/max8998_pmic.h
+++ b/include/max8998_pmic.h
@@ -76,7 +76,9 @@ enum {
 
 #define MAX8998_LDO3		(1 << 2)
 #define MAX8998_LDO4		(1 << 1)
+#define MAX8998_LDO7		(1 << 6)
 #define MAX8998_LDO8		(1 << 5)
+#define MAX8998_LDO17		(1 << 4)
 #define MAX8998_SAFEOUT1	(1 << 4)
 
 #define MAX8998_I2C_ADDR        (0xCC >> 1)
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v5 3/5] drivers: video: Add ld9040 video driver
  2012-10-19 15:34           ` [U-Boot] [PATCH v5 0/5] arm:exynos: Support for display drivers Piotr Wilczek
  2012-10-19 15:34             ` [U-Boot] [PATCH v5 1/5] exynos4: universal_C210: use software SPI Piotr Wilczek
  2012-10-19 15:34             ` [U-Boot] [PATCH v5 2/5] misc:max8998 Add LDO macros Piotr Wilczek
@ 2012-10-19 15:34             ` Piotr Wilczek
  2012-10-19 15:34             ` [U-Boot] [PATCH v5 4/5] drivers: video: fix image position Piotr Wilczek
                               ` (2 subsequent siblings)
  5 siblings, 0 replies; 32+ messages in thread
From: Piotr Wilczek @ 2012-10-19 15:34 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
CC: Minkyu Kang <mk7.kang@samsung.com>
CC: Donghwa Lee <dh09.lee@samsung.com>
---
Changes in v2:
	- none
Changes in v3:
	- none
Changes in v4:
	- removed comment and unused struct
Changes in v5:
	- none

 drivers/video/Makefile |    1 +
 drivers/video/ld9040.c |  144 ++++++++++++++++++++++++++++++++++++++++++++++++
 include/ld9040.h       |   32 +++++++++++
 3 files changed, 177 insertions(+), 0 deletions(-)
 create mode 100644 drivers/video/ld9040.c
 create mode 100644 include/ld9040.h

diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index ebb6da8..247b867 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -37,6 +37,7 @@ COBJS-$(CONFIG_EXYNOS_PWM_BL) += exynos_pwm_bl.o
 COBJS-$(CONFIG_FSL_DIU_FB) += fsl_diu_fb.o videomodes.o
 COBJS-$(CONFIG_S6E8AX0) += s6e8ax0.o
 COBJS-$(CONFIG_S6E63D6) += s6e63d6.o
+COBJS-$(CONFIG_LD9040) += ld9040.o
 COBJS-$(CONFIG_SED156X) += sed156x.o
 COBJS-$(CONFIG_VIDEO_AMBA) += amba.o
 COBJS-$(CONFIG_VIDEO_CT69000) += ct69000.o videomodes.o
diff --git a/drivers/video/ld9040.c b/drivers/video/ld9040.c
new file mode 100644
index 0000000..c01ae12
--- /dev/null
+++ b/drivers/video/ld9040.c
@@ -0,0 +1,144 @@
+/*
+ * ld9040 AMOLED LCD panel driver.
+ *
+ * Copyright (C) 2012 Samsung Electronics
+ * Donghwa Lee <dh09.lee@samsung.com>
+ *
+ * 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 <spi.h>
+
+static const unsigned char SEQ_SWRESET[] = {
+	0x01,
+};
+
+static const unsigned char SEQ_USER_SETTING[] = {
+	0xF0, 0x5A, 0x5A
+};
+
+static const unsigned char SEQ_ELVSS_ON[] = {
+	0xB1, 0x0D, 0x00, 0x16,
+};
+
+static const unsigned char SEQ_TEMP_SWIRE[] = {
+	0xB2, 0x06, 0x06, 0x06, 0x06,
+};
+
+static const unsigned char SEQ_GTCON[] = {
+	0xF7, 0x09, 0x00, 0x00,
+};
+
+static const unsigned char SEQ_PANEL_CONDITION[] = {
+	0xF8, 0x05, 0x65, 0x96, 0x71, 0x7D, 0x19, 0x3B,
+	0x0D, 0x19, 0x7E, 0x0D, 0xE2, 0x00, 0x00, 0x7E,
+	0x7D, 0x07, 0x07, 0x20, 0x20, 0x20, 0x02, 0x02,
+};
+
+static const unsigned char SEQ_GAMMA_SET1[] = {
+	0xF9, 0x00, 0xA7, 0xB4, 0xAE, 0xBF, 0x00, 0x91,
+	0x00, 0xB2, 0xB4, 0xAA, 0xBB, 0x00, 0xAC, 0x00,
+	0xB3, 0xB1, 0xAA, 0xBC, 0x00, 0xB3,
+};
+
+static const unsigned char SEQ_GAMMA_CTRL[] = {
+	0xFB, 0x02, 0x5A,
+};
+
+static const unsigned char SEQ_APON[] = {
+	0xF3, 0x00, 0x00, 0x00, 0x0A, 0x02,
+};
+
+static const unsigned char SEQ_DISPCTL[] = {
+	0xF2, 0x02, 0x08, 0x08, 0x10, 0x10,
+};
+
+static const unsigned char SEQ_MANPWR[] = {
+	0xB0, 0x04,
+};
+
+static const unsigned char SEQ_PWR_CTRL[] = {
+	0xF4, 0x0A, 0x87, 0x25, 0x6A, 0x44, 0x02, 0x88,
+};
+
+static const unsigned char SEQ_SLPOUT[] = {
+	0x11,
+};
+
+static const unsigned char SEQ_SLPIN[] = {
+	0x10,
+};
+
+static const unsigned char SEQ_DISPON[] = {
+	0x29,
+};
+
+static const unsigned char SEQ_DISPOFF[] = {
+	0x28,
+};
+
+static void ld9040_spi_write(const unsigned char *wbuf, unsigned int size_cmd)
+{
+	int i = 0;
+
+	/*
+	 * Data are transmitted in 9-bit words:
+	 * the first bit is command/parameter, the other are the value.
+	 * The value's LSB is shifted to MSB position, to be sent as 9th bit
+	 */
+
+	unsigned int data_out = 0, data_in = 0;
+	for (i = 0; i < size_cmd; i++) {
+		data_out = wbuf[i] >> 1;
+		if (i != 0)
+			data_out += 0x0080;
+		if (wbuf[i] & 0x01)
+			data_out += 0x8000;
+		spi_xfer(NULL, 9, &data_out, &data_in, SPI_XFER_BEGIN);
+	}
+}
+
+void ld9040_cfg_ldo(void)
+{
+	udelay(10);
+
+	ld9040_spi_write(SEQ_USER_SETTING,
+					ARRAY_SIZE(SEQ_USER_SETTING));
+	ld9040_spi_write(SEQ_PANEL_CONDITION,
+					ARRAY_SIZE(SEQ_PANEL_CONDITION));
+	ld9040_spi_write(SEQ_DISPCTL, ARRAY_SIZE(SEQ_DISPCTL));
+	ld9040_spi_write(SEQ_MANPWR, ARRAY_SIZE(SEQ_MANPWR));
+	ld9040_spi_write(SEQ_PWR_CTRL, ARRAY_SIZE(SEQ_PWR_CTRL));
+	ld9040_spi_write(SEQ_ELVSS_ON, ARRAY_SIZE(SEQ_ELVSS_ON));
+	ld9040_spi_write(SEQ_GTCON, ARRAY_SIZE(SEQ_GTCON));
+	ld9040_spi_write(SEQ_GAMMA_SET1, ARRAY_SIZE(SEQ_GAMMA_SET1));
+	ld9040_spi_write(SEQ_GAMMA_CTRL, ARRAY_SIZE(SEQ_GAMMA_CTRL));
+	ld9040_spi_write(SEQ_SLPOUT, ARRAY_SIZE(SEQ_SLPOUT));
+
+	udelay(120);
+}
+
+void ld9040_enable_ldo(unsigned int onoff)
+{
+	if (onoff)
+		ld9040_spi_write(SEQ_DISPON, ARRAY_SIZE(SEQ_DISPON));
+	else
+		ld9040_spi_write(SEQ_DISPOFF, ARRAY_SIZE(SEQ_DISPOFF));
+}
diff --git a/include/ld9040.h b/include/ld9040.h
new file mode 100644
index 0000000..fe99390
--- /dev/null
+++ b/include/ld9040.h
@@ -0,0 +1,32 @@
+/*
+ * ld9040 AMOLED LCD panel driver.
+ *
+ * Copyright (C) 2012 Samsung Electronics
+ * Donghwa Lee <dh09.lee@samsung.com>
+ *
+ * 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
+ */
+
+#ifndef __LD9040_H_
+#define __LD9040_H_
+
+void ld9040_cfg_ldo(void);
+void ld9040_enable_ldo(unsigned int onoff);
+
+#endif /* __LD9040_H_ */
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v5 4/5] drivers: video: fix image position
  2012-10-19 15:34           ` [U-Boot] [PATCH v5 0/5] arm:exynos: Support for display drivers Piotr Wilczek
                               ` (2 preceding siblings ...)
  2012-10-19 15:34             ` [U-Boot] [PATCH v5 3/5] drivers: video: Add ld9040 video driver Piotr Wilczek
@ 2012-10-19 15:34             ` Piotr Wilczek
  2012-10-19 15:34             ` [U-Boot] [PATCH v5 5/5] exynos4: universal_C210: add display support Piotr Wilczek
  2012-11-02  9:01             ` [U-Boot] [PATCH v5 0/5] arm:exynos: Support for display drivers Minkyu Kang
  5 siblings, 0 replies; 32+ messages in thread
From: Piotr Wilczek @ 2012-10-19 15:34 UTC (permalink / raw)
  To: u-boot

This patch fixes image position on screen when images's height or width is biger then the lcd's.

Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
CC: Minkyu Kang <mk7.kang@samsung.com>
---
Changes in v2:
	- none
Changes in v3:
	- none
Changes in v4:
	- none
Changes in v4:
	- none

 drivers/video/exynos_fb.c |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/video/exynos_fb.c b/drivers/video/exynos_fb.c
index e31a0fd..d9a3f9a 100644
--- a/drivers/video/exynos_fb.c
+++ b/drivers/video/exynos_fb.c
@@ -70,8 +70,19 @@ static void draw_logo(void)
 	int x, y;
 	ulong addr;
 
-	x = ((panel_width - panel_info.logo_width) >> 1);
-	y = ((panel_height - panel_info.logo_height) >> 1) - 4;
+	if (panel_width >= panel_info.logo_width) {
+		x = ((panel_width - panel_info.logo_width) >> 1);
+	} else {
+		x = 0;
+		printf("Warning: image width is bigger than display width\n");
+	}
+
+	if (panel_height >= panel_info.logo_height) {
+		y = ((panel_height - panel_info.logo_height) >> 1) - 4;
+	} else {
+		y = 0;
+		printf("Warning: image height is bigger than display height\n");
+	}
 
 	addr = panel_info.logo_addr;
 	bmp_display(addr, x, y);
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v5 5/5] exynos4: universal_C210: add display support
  2012-10-19 15:34           ` [U-Boot] [PATCH v5 0/5] arm:exynos: Support for display drivers Piotr Wilczek
                               ` (3 preceding siblings ...)
  2012-10-19 15:34             ` [U-Boot] [PATCH v5 4/5] drivers: video: fix image position Piotr Wilczek
@ 2012-10-19 15:34             ` Piotr Wilczek
  2012-11-02  9:01             ` [U-Boot] [PATCH v5 0/5] arm:exynos: Support for display drivers Minkyu Kang
  5 siblings, 0 replies; 32+ messages in thread
From: Piotr Wilczek @ 2012-10-19 15:34 UTC (permalink / raw)
  To: u-boot

This patch add support for display on Universal C210 board.
Width of displyed logo must be not bigger than 480 pixel and
is limited by width of the screen.
Tizen logo size is 520x120 pixels and should be resized.

Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
CC: Minkyu Kang <mk7.kang@samsung.com>
---
Changes in v2:
	- removed unnecessary function for fimd clock set;
	- removed unnecessary return;
	- moved init_pmic_lcd to CONFIG_PMIC
Changes in v3:
	- code cleanup
Changes in v4:
	- none
Changes in v5:
	- none

 board/samsung/universal_c210/universal.c |  166 ++++++++++++++++++++++++++++++
 include/configs/s5pc210_universal.h      |   13 +++
 2 files changed, 179 insertions(+), 0 deletions(-)

diff --git a/board/samsung/universal_c210/universal.c b/board/samsung/universal_c210/universal.c
index 4c1163e..afe3bb0 100644
--- a/board/samsung/universal_c210/universal.c
+++ b/board/samsung/universal_c210/universal.c
@@ -24,6 +24,7 @@
 
 #include <common.h>
 #include <spi.h>
+#include <lcd.h>
 #include <asm/io.h>
 #include <asm/gpio.h>
 #include <asm/arch/adc.h>
@@ -35,6 +36,8 @@
 #include <asm/arch/cpu.h>
 #include <max8998_pmic.h>
 #include <asm/arch/watchdog.h>
+#include <libtizen.h>
+#include <ld9040.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -316,6 +319,168 @@ int universal_spi_read(void)
 }
 #endif
 
+static void init_pmic_lcd(void)
+{
+	unsigned char val;
+	int ret = 0;
+
+	struct pmic *p = get_pmic();
+
+	if (pmic_probe(p))
+		return;
+
+	/* LDO7 1.8V */
+	val = 0x02; /* (1800 - 1600) / 100; */
+	ret |= pmic_reg_write(p,  MAX8998_REG_LDO7, val);
+
+	/* LDO17 3.0V */
+	val = 0xe; /* (3000 - 1600) / 100; */
+	ret |= pmic_reg_write(p,  MAX8998_REG_LDO17, val);
+
+	/* Disable unneeded regulators */
+	/*
+	 * ONOFF1
+	 * Buck1 ON, Buck2 OFF, Buck3 ON, Buck4 ON
+	 * LDO2 ON, LDO3 OFF, LDO4 OFF, LDO5 ON
+	 */
+	val = 0xB9;
+	ret |= pmic_reg_write(p,  MAX8998_REG_ONOFF1, val);
+
+	/* ONOFF2
+	 * LDO6 OFF, LDO7 ON, LDO8 OFF, LDO9 ON,
+	 * LDO10 OFF, LDO11 OFF, LDO12 OFF, LDO13 OFF
+	 */
+	val = 0x50;
+	ret |= pmic_reg_write(p,  MAX8998_REG_ONOFF2, val);
+
+	/* ONOFF3
+	 * LDO14 OFF, LDO15 OFF, LGO16 OFF, LDO17 OFF
+	 * EPWRHOLD OFF, EBATTMON OFF, ELBCNFG2 OFF, ELBCNFG1 OFF
+	 */
+	val = 0x00;
+	ret |= pmic_reg_write(p,  MAX8998_REG_ONOFF3, val);
+
+	if (ret)
+		puts("LCD pmic initialisation error!\n");
+}
+
+static void lcd_cfg_gpio(void)
+{
+	unsigned int i, f3_end = 4;
+
+	for (i = 0; i < 8; i++) {
+		/* set GPF0,1,2[0:7] for RGB Interface and Data lines (32bit) */
+		s5p_gpio_cfg_pin(&gpio1->f0, i, GPIO_FUNC(2));
+		s5p_gpio_cfg_pin(&gpio1->f1, i, GPIO_FUNC(2));
+		s5p_gpio_cfg_pin(&gpio1->f2, i, GPIO_FUNC(2));
+		/* pull-up/down disable */
+		s5p_gpio_set_pull(&gpio1->f0, i, GPIO_PULL_NONE);
+		s5p_gpio_set_pull(&gpio1->f1, i, GPIO_PULL_NONE);
+		s5p_gpio_set_pull(&gpio1->f2, i, GPIO_PULL_NONE);
+
+		/* drive strength to max (24bit) */
+		s5p_gpio_set_drv(&gpio1->f0, i, GPIO_DRV_4X);
+		s5p_gpio_set_rate(&gpio1->f0, i, GPIO_DRV_SLOW);
+		s5p_gpio_set_drv(&gpio1->f1, i, GPIO_DRV_4X);
+		s5p_gpio_set_rate(&gpio1->f1, i, GPIO_DRV_SLOW);
+		s5p_gpio_set_drv(&gpio1->f2, i, GPIO_DRV_4X);
+		s5p_gpio_set_rate(&gpio1->f0, i, GPIO_DRV_SLOW);
+	}
+
+	for (i = 0; i < f3_end; i++) {
+		/* set GPF3[0:3] for RGB Interface and Data lines (32bit) */
+		s5p_gpio_cfg_pin(&gpio1->f3, i, GPIO_FUNC(2));
+		/* pull-up/down disable */
+		s5p_gpio_set_pull(&gpio1->f3, i, GPIO_PULL_NONE);
+		/* drive strength to max (24bit) */
+		s5p_gpio_set_drv(&gpio1->f3, i, GPIO_DRV_4X);
+		s5p_gpio_set_rate(&gpio1->f3, i, GPIO_DRV_SLOW);
+	}
+
+	/* gpio pad configuration for LCD reset. */
+	s5p_gpio_cfg_pin(&gpio2->y4, 5, GPIO_OUTPUT);
+
+	spi_init();
+}
+
+static void reset_lcd(void)
+{
+	s5p_gpio_set_value(&gpio2->y4, 5, 1);
+	udelay(10000);
+	s5p_gpio_set_value(&gpio2->y4, 5, 0);
+	udelay(10000);
+	s5p_gpio_set_value(&gpio2->y4, 5, 1);
+	udelay(100);
+}
+
+static void lcd_power_on(void)
+{
+	struct pmic *p = get_pmic();
+
+	if (pmic_probe(p))
+		return;
+
+	pmic_set_output(p, MAX8998_REG_ONOFF3, MAX8998_LDO17, LDO_ON);
+	pmic_set_output(p, MAX8998_REG_ONOFF2, MAX8998_LDO7, LDO_ON);
+}
+
+vidinfo_t panel_info = {
+	.vl_freq	= 60,
+	.vl_col		= 480,
+	.vl_row		= 800,
+	.vl_width	= 480,
+	.vl_height	= 800,
+	.vl_clkp	= CONFIG_SYS_HIGH,
+	.vl_hsp		= CONFIG_SYS_HIGH,
+	.vl_vsp		= CONFIG_SYS_HIGH,
+	.vl_dp		= CONFIG_SYS_HIGH,
+
+	.vl_bpix	= 5,	/* Bits per pixel */
+
+	/* LD9040 LCD Panel */
+	.vl_hspw	= 2,
+	.vl_hbpd	= 16,
+	.vl_hfpd	= 16,
+
+	.vl_vspw	= 2,
+	.vl_vbpd	= 8,
+	.vl_vfpd	= 8,
+	.vl_cmd_allow_len = 0xf,
+
+	.win_id		= 0,
+	.cfg_gpio	= lcd_cfg_gpio,
+	.backlight_on	= NULL,
+	.lcd_power_on	= lcd_power_on,
+	.reset_lcd	= reset_lcd,
+	.dual_lcd_enabled = 0,
+
+	.init_delay	= 0,
+	.power_on_delay = 10000,
+	.reset_delay	= 10000,
+	.interface_mode = FIMD_RGB_INTERFACE,
+	.mipi_enabled	= 0,
+};
+
+void init_panel_info(vidinfo_t *vid)
+{
+	vid->logo_on	= 1;
+	vid->resolution	= HD_RESOLUTION;
+	vid->rgb_mode	= MODE_RGB_P;
+
+#ifdef CONFIG_TIZEN
+	get_tizen_logo_info(vid);
+#endif
+
+	/* for LD9040. */
+	vid->pclk_name = 1;	/* MPLL */
+	vid->sclk_div = 1;
+
+	vid->cfg_ldo = ld9040_cfg_ldo;
+	vid->enable_ldo = ld9040_enable_ldo;
+
+	setenv("lcdinfo", "lcd=ld9040");
+}
+
 int board_init(void)
 {
 	gpio1 = (struct exynos4_gpio_part1 *) EXYNOS4_GPIO_PART1_BASE;
@@ -326,6 +491,7 @@ int board_init(void)
 
 #if defined(CONFIG_PMIC)
 	pmic_init();
+	init_pmic_lcd();
 #endif
 #ifdef CONFIG_SOFT_SPI
 	soft_spi_init();
diff --git a/include/configs/s5pc210_universal.h b/include/configs/s5pc210_universal.h
index 54ee8c4..035c27f 100644
--- a/include/configs/s5pc210_universal.h
+++ b/include/configs/s5pc210_universal.h
@@ -34,6 +34,7 @@
 #define CONFIG_S5P		1	/* which is in a S5P Family */
 #define CONFIG_EXYNOS4210	1	/* which is in a EXYNOS4210 */
 #define CONFIG_UNIVERSAL	1	/* working with Universal */
+#define CONFIG_TIZEN		1	/* TIZEN lib */
 
 #include <asm/arch/cpu.h>		/* get chip and board defs */
 
@@ -284,4 +285,16 @@ void universal_spi_sda(int bit);
 int universal_spi_read(void);
 #endif
 
+/*
+ * LCD Settings
+ */
+#define CONFIG_EXYNOS_FB
+#define CONFIG_LCD
+#define CONFIG_CMD_BMP
+#define CONFIG_BMP_32BPP
+#define CONFIG_LD9040
+#define CONFIG_EXYNOS_MIPI_DSIM
+#define CONFIG_VIDEO_BMP_GZIP
+#define CONFIG_SYS_VIDEO_LOGO_MAX_SIZE ((520 * 120 * 4) + (1 << 12))
+
 #endif	/* __CONFIG_H */
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v5 0/5] arm:exynos: Support for display drivers
  2012-10-19 15:34           ` [U-Boot] [PATCH v5 0/5] arm:exynos: Support for display drivers Piotr Wilczek
                               ` (4 preceding siblings ...)
  2012-10-19 15:34             ` [U-Boot] [PATCH v5 5/5] exynos4: universal_C210: add display support Piotr Wilczek
@ 2012-11-02  9:01             ` Minkyu Kang
  5 siblings, 0 replies; 32+ messages in thread
From: Minkyu Kang @ 2012-11-02  9:01 UTC (permalink / raw)
  To: u-boot

On 20/10/12 00:34, Piotr Wilczek wrote:
> This patchset add support for display on Universal C210 board.
> Software SPI support is added to universal C210.
> Max8998 is modified to power on display, new driver ld9040 is added
> and support for LCD display on universal C210 board is added.
> 
> Changes in v2:
> 	- removed unnecessary function for fimd clock set;
> 	- code cleanup
> 	- removed patch for fix exynos4_fb structure
> Changes in v3:
> 	- code cleanup
> Changes in v4:
> 	- removed comment and unused struct
> 	- removed patch with unused display control define
> Changes in v5:
> 	- add patch to support soft SPI on Universal_C210
> 	
> Piotr Wilczek (5):
>   exynos4: universal_C210: use software SPI
>   misc:max8998 Add LDO macros
>   drivers: video: Add ld9040 video driver
>   drivers: video: fix image position
>   exynos4: universal_C210: add display support
> 
>  board/samsung/universal_c210/universal.c |  253 +++++++++++++++++++++++++++--
>  drivers/video/Makefile                   |    1 +
>  drivers/video/exynos_fb.c                |   15 ++-
>  drivers/video/ld9040.c                   |  144 +++++++++++++++++
>  include/configs/s5pc210_universal.h      |   34 ++++
>  include/ld9040.h                         |   32 ++++
>  include/max8998_pmic.h                   |    2 +
>  7 files changed, 461 insertions(+), 20 deletions(-)
>  create mode 100644 drivers/video/ld9040.c
>  create mode 100644 include/ld9040.h
> 

applied to u-boot-samsung.

Thanks.
Minkyu Kang.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [U-Boot] [PATCH v5 1/5] exynos4: universal_C210: use software SPI
  2012-10-19 15:34             ` [U-Boot] [PATCH v5 1/5] exynos4: universal_C210: use software SPI Piotr Wilczek
@ 2012-12-09  5:46               ` Albert ARIBAUD
  0 siblings, 0 replies; 32+ messages in thread
From: Albert ARIBAUD @ 2012-12-09  5:46 UTC (permalink / raw)
  To: u-boot

Hi Piotr,

On Fri, 19 Oct 2012 17:34:03 +0200, Piotr Wilczek
<p.wilczek@samsung.com> wrote:

> This patch use software spi on Samsung Universal C210 board.
> 
> Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> CC: Minkyu Kang <mk7.kang@samsung.com>
> ---
> New path added in v5.

This patch, committed in Minkuy's tree as ff0fedd5, as well as
"exynos4: universal_C210: add display support", committed too, as
d984b9f8, conflict with PMIC/POWER reworks now in u-boot/master.

Piotr, can you see what neds reworking?

Minkyu, can you provide a pull request the same way as Stefano did for
the woodburn issue? See

<http://www.mail-archive.com/u-boot@lists.denx.de/msg101115.html>

Thanks in advance!

Amicalement,
-- 
Albert.

^ permalink raw reply	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2012-12-09  5:46 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-19 13:01 [U-Boot] [PATCH v2 0/5] Exynos: Support for display drivers Piotr Wilczek
2012-09-19 13:01 ` [U-Boot] [PATCH v2 1/5] misc:max8998 Add LDO macros Piotr Wilczek
2012-09-24 13:04   ` [U-Boot] [PATCH v3 0/5] Exynos: Support for display drivers Piotr Wilczek
2012-09-24 13:04     ` [U-Boot] [PATCH v3 1/5] misc: max8998: Add LDO macros Piotr Wilczek
2012-09-24 13:04     ` [U-Boot] [PATCH v3 2/5] drivers: video: Add ld9040 video driver Piotr Wilczek
2012-09-27  6:58       ` Minkyu Kang
2012-09-27  7:39         ` Piotr Wilczek
2012-09-28 10:34       ` [U-Boot] [PATCH v4 0/4] Exynos: Support for display drivers Piotr Wilczek
2012-09-28 10:34         ` [U-Boot] [PATCH v4 1/4] misc:max8998 Add LDO macros Piotr Wilczek
2012-10-19 15:34           ` [U-Boot] [PATCH v5 0/5] arm:exynos: Support for display drivers Piotr Wilczek
2012-10-19 15:34             ` [U-Boot] [PATCH v5 1/5] exynos4: universal_C210: use software SPI Piotr Wilczek
2012-12-09  5:46               ` Albert ARIBAUD
2012-10-19 15:34             ` [U-Boot] [PATCH v5 2/5] misc:max8998 Add LDO macros Piotr Wilczek
2012-10-19 15:34             ` [U-Boot] [PATCH v5 3/5] drivers: video: Add ld9040 video driver Piotr Wilczek
2012-10-19 15:34             ` [U-Boot] [PATCH v5 4/5] drivers: video: fix image position Piotr Wilczek
2012-10-19 15:34             ` [U-Boot] [PATCH v5 5/5] exynos4: universal_C210: add display support Piotr Wilczek
2012-11-02  9:01             ` [U-Boot] [PATCH v5 0/5] arm:exynos: Support for display drivers Minkyu Kang
2012-09-28 10:34         ` [U-Boot] [PATCH v4 2/4] drivers: video: Add ld9040 video driver Piotr Wilczek
2012-09-28 10:34         ` [U-Boot] [PATCH v4 3/4] drivers: video: fix image position Piotr Wilczek
2012-09-28 10:34         ` [U-Boot] [PATCH v4 4/4] exynos4: universal_C210: add display support Piotr Wilczek
2012-09-24 13:04     ` [U-Boot] [PATCH v3 3/5] arm: exynos4: cpu: Add definition for display Piotr Wilczek
2012-09-27  0:21       ` Minkyu Kang
2012-09-27  6:11         ` Piotr Wilczek
2012-09-24 13:04     ` [U-Boot] [PATCH v3 4/5] drivers: video: fix image position Piotr Wilczek
2012-09-24 13:04     ` [U-Boot] [PATCH v3 5/5] arm: exynos4: universal_C210: add display support Piotr Wilczek
2012-09-19 13:01 ` [U-Boot] [PATCH v2 2/5] drivers: video: Add ld9040 video driver Piotr Wilczek
2012-09-20  9:57   ` Jaehoon Chung
2012-09-19 13:01 ` [U-Boot] [PATCH v2 3/5] arm: exynos4: cpu: Add definition for display Piotr Wilczek
2012-09-19 13:01 ` [U-Boot] [PATCH v2 4/5] drivers: video: fix image position Piotr Wilczek
2012-09-19 13:01 ` [U-Boot] [PATCH v2 5/5] arm: exynos4: universal_C210: add display support Piotr Wilczek
2012-09-20  9:56 ` [U-Boot] [PATCH v2 0/5] Exynos: Support for display drivers Jaehoon Chung
2012-09-20 11:11   ` Piotr Wilczek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox