[U-Boot] [PATCH 0/6] Exynos: Support for display drivers

This patch add support for display on Universal C210 board
[Patch 1/6] misc:max8998 Add LDO macros [Patch 2/6] drivers: video: Add ld9040 video driver [Patch 3/6] arm: exynos4: Fix exynos4_fb structure [Patch 4/6] arm: exynos4: cpu: Add definition for display [Patch 5/6] drivers: video: fix image position [Patch 6/6] arm: exynos4: universal_C210: add display support
Thank you, Piotr Wilczek
Piotr Wilczek (6): misc:max8998 Add LDO macros drivers: video: Add ld9040 video driver arm: exynos4: Fix exynos4_fb structure 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 + arch/arm/include/asm/arch-exynos/fb.h | 13 ++- board/samsung/universal_c210/universal.c | 225 +++++++++++++++++++++++++++--- 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 + 9 files changed, 425 insertions(+), 24 deletions(-) create mode 100644 drivers/video/ld9040.c create mode 100644 include/ld9040.h

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 --- 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)

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 --- 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 2f8e2b5..364a5bb 100644 --- a/drivers/video/Makefile +++ b/drivers/video/Makefile @@ -35,6 +35,7 @@ COBJS-$(CONFIG_EXYNOS_MIPI_DSIM) += exynos_mipi_dsi.o exynos_mipi_dsi_common.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_ */

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 --- arch/arm/include/asm/arch-exynos/fb.h | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/arm/include/asm/arch-exynos/fb.h b/arch/arm/include/asm/arch-exynos/fb.h index b10b0da..f7c6d76 100644 --- a/arch/arm/include/asm/arch-exynos/fb.h +++ b/arch/arm/include/asm/arch-exynos/fb.h @@ -103,7 +103,7 @@ struct exynos4_fb {
unsigned int vidintcon0; unsigned int vidintcon1; - unsigned int res9[1]; + unsigned int res9[2];
unsigned int w1keycon0; unsigned int w1keycon1; @@ -120,14 +120,14 @@ struct exynos4_fb { unsigned int w4keyalpha;
unsigned int dithmode; - unsigned int res10[2]; + unsigned int res10[3];
unsigned int win0map; unsigned int win1map; unsigned int win2map; unsigned int win3map; unsigned int win4map; - unsigned int res11[1]; + unsigned int res11[2];
unsigned int wpalcon_h; unsigned int wpalcon_l; @@ -141,7 +141,7 @@ struct exynos4_fb { unsigned int i80ifconb1;
unsigned int colorgaincon; - unsigned int res13[2]; + unsigned int res13[3];
unsigned int ldi_cmdcon0; unsigned int ldi_cmdcon1;

Dear Donghwa,
On 13 September 2012 16:45, Piotr Wilczek p.wilczek@samsung.com wrote:
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
arch/arm/include/asm/arch-exynos/fb.h | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/arm/include/asm/arch-exynos/fb.h b/arch/arm/include/asm/arch-exynos/fb.h index b10b0da..f7c6d76 100644 --- a/arch/arm/include/asm/arch-exynos/fb.h +++ b/arch/arm/include/asm/arch-exynos/fb.h @@ -103,7 +103,7 @@ struct exynos4_fb {
unsigned int vidintcon0; unsigned int vidintcon1;
unsigned int res9[1];
unsigned int res9[2]; unsigned int w1keycon0; unsigned int w1keycon1;
@@ -120,14 +120,14 @@ struct exynos4_fb { unsigned int w4keyalpha;
unsigned int dithmode;
unsigned int res10[2];
unsigned int res10[3]; unsigned int win0map; unsigned int win1map; unsigned int win2map; unsigned int win3map; unsigned int win4map;
unsigned int res11[1];
unsigned int res11[2]; unsigned int wpalcon_h; unsigned int wpalcon_l;
@@ -141,7 +141,7 @@ struct exynos4_fb { unsigned int i80ifconb1;
unsigned int colorgaincon;
unsigned int res13[2];
unsigned int res13[3]; unsigned int ldi_cmdcon0; unsigned int ldi_cmdcon1;
--
Please check it.
Thanks. Minkyu Kang.

Dear Piotr,
-----Original Message----- From: Minkyu Kang [mailto:promsoft@gmail.com] Sent: Saturday, September 15, 2012 5:04 PM To: Piotr Wilczek; Donghwa Lee Cc: u-boot@lists.denx.de; Kyungmin Park Subject: Re: [U-Boot] [PATCH 3/6] arm: exynos4: Fix exynos4_fb structure
Dear Donghwa,
On 13 September 2012 16:45, Piotr Wilczek p.wilczek@samsung.com wrote:
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
arch/arm/include/asm/arch-exynos/fb.h | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/arm/include/asm/arch-exynos/fb.h
b/arch/arm/include/asm/arch-exynos/fb.h
index b10b0da..f7c6d76 100644 --- a/arch/arm/include/asm/arch-exynos/fb.h +++ b/arch/arm/include/asm/arch-exynos/fb.h @@ -103,7 +103,7 @@ struct exynos4_fb {
unsigned int vidintcon0; unsigned int vidintcon1;
unsigned int res9[1];
unsigned int res9[2]; unsigned int w1keycon0; unsigned int w1keycon1;
@@ -120,14 +120,14 @@ struct exynos4_fb { unsigned int w4keyalpha;
unsigned int dithmode;
unsigned int res10[2];
unsigned int res10[3]; unsigned int win0map; unsigned int win1map; unsigned int win2map; unsigned int win3map; unsigned int win4map;
unsigned int res11[1];
unsigned int res11[2]; unsigned int wpalcon_h; unsigned int wpalcon_l;
@@ -141,7 +141,7 @@ struct exynos4_fb { unsigned int i80ifconb1;
unsigned int colorgaincon;
unsigned int res13[2];
unsigned int res13[3]; unsigned int ldi_cmdcon0; unsigned int ldi_cmdcon1;
--
This patch is out of sync with the latest version of fb.h Please sync with the latest version.
Thank you. Donghwa Lee,

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 --- arch/arm/include/asm/arch-exynos/cpu.h | 1 + arch/arm/include/asm/arch-exynos/fb.h | 5 +++++ 2 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/arch/arm/include/asm/arch-exynos/cpu.h b/arch/arm/include/asm/arch-exynos/cpu.h index 0c341d4..90556a1 100644 --- a/arch/arm/include/asm/arch-exynos/cpu.h +++ b/arch/arm/include/asm/arch-exynos/cpu.h @@ -53,6 +53,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
diff --git a/arch/arm/include/asm/arch-exynos/fb.h b/arch/arm/include/asm/arch-exynos/fb.h index f7c6d76..1a5f556 100644 --- a/arch/arm/include/asm/arch-exynos/fb.h +++ b/arch/arm/include/asm/arch-exynos/fb.h @@ -443,4 +443,9 @@ struct exynos4_fb { #define EXYNOS_I80START_TRIG (1 << 1) #define EXYNOS_I80STATUS_TRIG_DONE (1 << 2)
+/* DISPLAY CONTROL */ +#define EXYNOS_DISPLAYCONTROL_FIFORST_LBLK0 (1 << 9) +#define EXYNOS_DISPLAYCONTROL_FIMDBYPASS_LBLK0 (1 << 1) + + #endif /* _REGS_FB_H */

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 --- 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 49fdfec..1aeca6b 100644 --- a/drivers/video/exynos_fb.c +++ b/drivers/video/exynos_fb.c @@ -69,8 +69,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);

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 to be displayed corectly on Universal C210.
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 --- board/samsung/universal_c210/universal.c | 225 +++++++++++++++++++++++++++--- include/configs/s5pc210_universal.h | 13 ++ 2 files changed, 220 insertions(+), 18 deletions(-)
diff --git a/board/samsung/universal_c210/universal.c b/board/samsung/universal_c210/universal.c index 772ade5..da28f7a 100644 --- a/board/samsung/universal_c210/universal.c +++ b/board/samsung/universal_c210/universal.c @@ -23,17 +23,21 @@ */
#include <common.h> +#include <lcd.h> #include <asm/io.h> #include <spi.h> #include <asm/arch/adc.h> #include <asm/arch/gpio.h> #include <asm/arch/mmc.h> #include <asm/arch/pinmux.h> +#include <asm/arch/fb.h> #include <pmic.h> #include <usb/s3c_udc.h> #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> @@ -57,24 +61,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) + @@ -324,3 +310,206 @@ int spi_cs_is_valid(unsigned int bus, unsigned int cs) return 1; }
+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 fimd_clk_set(void) +{ + unsigned int cfg = 0; + + /* LCD0_BLK FIFO S/W reset */ + cfg = readl(EXYNOS4_DISPLAY_CONTROL); + cfg |= EXYNOS_DISPLAYCONTROL_FIFORST_LBLK0; + writel(cfg, EXYNOS4_DISPLAY_CONTROL); + + cfg = 0; + + /* FIMD of LBLK0 Bypass Selection */ + cfg = readl(EXYNOS4_DISPLAY_CONTROL); + cfg &= ~EXYNOS_DISPLAYCONTROL_FIFORST_LBLK0; + cfg |= EXYNOS_DISPLAYCONTROL_FIMDBYPASS_LBLK0; + writel(cfg, EXYNOS4_DISPLAY_CONTROL); +} + +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(); + + return; +} + +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) +{ + fimd_clk_set(); + + 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(); +#endif + + init_pmic_lcd(); + + 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 a338840..14e42cc 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 */
@@ -285,4 +286,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 */

Dear Piotr,
On 13 September 2012 16:45, Piotr Wilczek p.wilczek@samsung.com wrote:
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 to be displayed corectly on Universal C210.
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
board/samsung/universal_c210/universal.c | 225 +++++++++++++++++++++++++++--- include/configs/s5pc210_universal.h | 13 ++ 2 files changed, 220 insertions(+), 18 deletions(-)
diff --git a/board/samsung/universal_c210/universal.c b/board/samsung/universal_c210/universal.c index 772ade5..da28f7a 100644 --- a/board/samsung/universal_c210/universal.c +++ b/board/samsung/universal_c210/universal.c
+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 fimd_clk_set(void) +{
unsigned int cfg = 0;
/* LCD0_BLK FIFO S/W reset */
cfg = readl(EXYNOS4_DISPLAY_CONTROL);
cfg |= EXYNOS_DISPLAYCONTROL_FIFORST_LBLK0;
writel(cfg, EXYNOS4_DISPLAY_CONTROL);
cfg = 0;
/* FIMD of LBLK0 Bypass Selection */
cfg = readl(EXYNOS4_DISPLAY_CONTROL);
cfg &= ~EXYNOS_DISPLAYCONTROL_FIFORST_LBLK0;
cfg |= EXYNOS_DISPLAYCONTROL_FIMDBYPASS_LBLK0;
writel(cfg, EXYNOS4_DISPLAY_CONTROL);
No.. We don't allow direct access. And this function looks same with exynos4_set_system_display.
+}
+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();
return;
Please remove this return.
+}
+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) +{
fimd_clk_set();
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();
+#endif
init_pmic_lcd();
move this function into CONFIG_PMIC?
check_hw_revision();
printf("HW Revision:\t0x%x\n", board_rev);
return 0;
+}
Thanks. Minkyu Kang.

Dear Minkyu,
-----Original Message----- From: Minkyu Kang [mailto:promsoft@gmail.com] Sent: Saturday, September 15, 2012 10:46 AM To: Piotr Wilczek; Donghwa Lee Cc: u-boot@lists.denx.de; Kyungmin Park Subject: Re: [U-Boot] [PATCH 6/6] arm: exynos4: universal_C210: add display support
Dear Piotr,
On 13 September 2012 16:45, Piotr Wilczek p.wilczek@samsung.com wrote:
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 to be displayed corectly on Universal C210.
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
board/samsung/universal_c210/universal.c | 225
+++++++++++++++++++++++++++---
include/configs/s5pc210_universal.h | 13 ++ 2 files changed, 220 insertions(+), 18 deletions(-)
diff --git a/board/samsung/universal_c210/universal.c b/board/samsung/universal_c210/universal.c index 772ade5..da28f7a 100644 --- a/board/samsung/universal_c210/universal.c +++ b/board/samsung/universal_c210/universal.c
+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 fimd_clk_set(void) +{
unsigned int cfg = 0;
/* LCD0_BLK FIFO S/W reset */
cfg = readl(EXYNOS4_DISPLAY_CONTROL);
cfg |= EXYNOS_DISPLAYCONTROL_FIFORST_LBLK0;
writel(cfg, EXYNOS4_DISPLAY_CONTROL);
cfg = 0;
/* FIMD of LBLK0 Bypass Selection */
cfg = readl(EXYNOS4_DISPLAY_CONTROL);
cfg &= ~EXYNOS_DISPLAYCONTROL_FIFORST_LBLK0;
cfg |= EXYNOS_DISPLAYCONTROL_FIMDBYPASS_LBLK0;
writel(cfg, EXYNOS4_DISPLAY_CONTROL);
No.. We don't allow direct access. And this function looks same with exynos4_set_system_display.
Ok, I will fix it.
+}
+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();
return;
Please remove this return.
Ok.
+}
+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) +{
fimd_clk_set();
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();
+#endif
init_pmic_lcd();
move this function into CONFIG_PMIC?
Yes, it should be in CONFIG_PMIC.
check_hw_revision();
printf("HW Revision:\t0x%x\n", board_rev);
return 0;
+}
Thanks. Minkyu Kang.
Thank you, Piotr Wilczek
-- from. prom. www.promsoft.net
participants (3)
-
leedonghwa
-
Minkyu Kang
-
Piotr Wilczek