All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 00/10] Introduce Samsung misc file and LCD menu.
@ 2013-12-03 18:03 Przemyslaw Marczak
  2013-12-03 18:03 ` [U-Boot] [PATCH 01/10] s5p: gpio: change gpio coding method for s5p gpio Przemyslaw Marczak
                   ` (15 more replies)
  0 siblings, 16 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2013-12-03 18:03 UTC (permalink / raw)
  To: u-boot

This patch set includes changes required to:
- properly use of all gpios
- introduce common file for Samsung misc code
- keys support (PWR, VOL:UP,DOWN)
- console support on LCD
- 16bpp logo support
- introduce LCD menu on Samsung devices

Przemyslaw Marczak (10):
  s5p: gpio: change gpio coding method for s5p gpio.
  trats2: Code cleanup.
  samsung: common: Add misc file and common function misc_init_r().
  samsung: misc: move display logo function to misc.c file.
  lib: tizen: add Tizen 16bpp logo support.
  video: exynos: fimd: always use 16bpp display mode.
  samsung: misc: Add LCD download menu.
  Trats: add LCD download menu support
  trats2: add LCD download menu support
  universal: add LCD download menu support

 arch/arm/include/asm/arch-exynos/gpio.h  |  169 +-
 arch/arm/include/asm/arch-s5pc1xx/gpio.h |   47 +-
 board/samsung/common/Makefile            |    1 +
 board/samsung/common/keys.h              |   78 +
 board/samsung/common/misc.c              |  409 ++
 board/samsung/trats/trats.c              |    5 +-
 board/samsung/trats2/trats2.c            |   25 +-
 board/samsung/universal_c210/universal.c |    6 +-
 drivers/gpio/s5p_gpio.c                  |   15 +-
 drivers/power/battery/bat_trats2.c       |    2 +-
 drivers/video/exynos_fb.c                |   28 -
 drivers/video/exynos_fimd.c              |   10 +-
 include/configs/s5p_goni.h               |    4 +-
 include/configs/s5pc210_universal.h      |   27 +-
 include/configs/trats.h                  |   23 +-
 include/configs/trats2.h                 |   29 +-
 lib/tizen/tizen.c                        |   16 +-
 lib/tizen/tizen_hd_logo_16bpp.h          | 7518 ++++++++++++++++++++++++++++++
 18 files changed, 8190 insertions(+), 222 deletions(-)
 create mode 100644 board/samsung/common/keys.h
 create mode 100644 board/samsung/common/misc.c
 create mode 100644 lib/tizen/tizen_hd_logo_16bpp.h

-- 
1.7.9.5

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

* [U-Boot] [PATCH 01/10] s5p: gpio: change gpio coding method for s5p gpio.
  2013-12-03 18:03 [U-Boot] [PATCH 00/10] Introduce Samsung misc file and LCD menu Przemyslaw Marczak
@ 2013-12-03 18:03 ` Przemyslaw Marczak
  2013-12-03 18:03 ` [U-Boot] [PATCH 02/10] trats2: Code cleanup Przemyslaw Marczak
                   ` (14 subsequent siblings)
  15 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2013-12-03 18:03 UTC (permalink / raw)
  To: u-boot

Old s5p gpio coding method was not clean and was not working properly
for all parts and banks. New method is clean and easy to extend.

Gpio coding mask:
0x000000ff - pin number
0x00ffff00 - bank offset
0xff000000 - part number

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
---
 arch/arm/include/asm/arch-exynos/gpio.h  |  169 +++++++++++-------------------
 arch/arm/include/asm/arch-s5pc1xx/gpio.h |   47 +++++++--
 drivers/gpio/s5p_gpio.c                  |   15 +--
 include/configs/s5p_goni.h               |    4 +-
 include/configs/s5pc210_universal.h      |   12 +--
 include/configs/trats.h                  |    8 +-
 include/configs/trats2.h                 |   12 +--
 7 files changed, 125 insertions(+), 142 deletions(-)

diff --git a/arch/arm/include/asm/arch-exynos/gpio.h b/arch/arm/include/asm/arch-exynos/gpio.h
index a1a7439..b7dc8f5 100644
--- a/arch/arm/include/asm/arch-exynos/gpio.h
+++ b/arch/arm/include/asm/arch-exynos/gpio.h
@@ -196,117 +196,72 @@ void s5p_gpio_set_rate(struct s5p_gpio_bank *bank, int gpio, int mode);
 /* GPIO pins per bank  */
 #define GPIO_PER_BANK 8
 
-#define exynos4_gpio_part1_get_nr(bank, pin) \
-	((((((unsigned int) &(((struct exynos4_gpio_part1 *) \
-			       EXYNOS4_GPIO_PART1_BASE)->bank)) \
-	    - EXYNOS4_GPIO_PART1_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin)
-
-#define EXYNOS4_GPIO_PART1_MAX ((sizeof(struct exynos4_gpio_part1) \
-			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
-
-#define exynos4_gpio_part2_get_nr(bank, pin) \
-	(((((((unsigned int) &(((struct exynos4_gpio_part2 *) \
-				EXYNOS4_GPIO_PART2_BASE)->bank)) \
-	    - EXYNOS4_GPIO_PART2_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin) + EXYNOS4_GPIO_PART1_MAX)
-
-#define exynos4x12_gpio_part1_get_nr(bank, pin) \
-	((((((unsigned int) &(((struct exynos4x12_gpio_part1 *) \
-			       EXYNOS4X12_GPIO_PART1_BASE)->bank)) \
-	    - EXYNOS4X12_GPIO_PART1_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin)
-
-#define EXYNOS4X12_GPIO_PART1_MAX ((sizeof(struct exynos4x12_gpio_part1) \
-			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
-
-#define exynos4x12_gpio_part2_get_nr(bank, pin) \
-	(((((((unsigned int) &(((struct exynos4x12_gpio_part2 *) \
-				EXYNOS4X12_GPIO_PART2_BASE)->bank)) \
-	    - EXYNOS4X12_GPIO_PART2_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin) + EXYNOS4X12_GPIO_PART1_MAX)
-
-#define EXYNOS4X12_GPIO_PART2_MAX ((sizeof(struct exynos4x12_gpio_part2) \
-			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
-
-#define exynos4x12_gpio_part3_get_nr(bank, pin) \
-	(((((((unsigned int) &(((struct exynos4x12_gpio_part3 *) \
-				EXYNOS4X12_GPIO_PART3_BASE)->bank)) \
-	    - EXYNOS4X12_GPIO_PART3_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin) + EXYNOS4X12_GPIO_PART2_MAX)
-
-#define exynos5_gpio_part1_get_nr(bank, pin) \
-	((((((unsigned int) &(((struct exynos5_gpio_part1 *) \
-			       EXYNOS5_GPIO_PART1_BASE)->bank)) \
-	    - EXYNOS5_GPIO_PART1_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin)
-
-#define EXYNOS5_GPIO_PART1_MAX ((sizeof(struct exynos5_gpio_part1) \
-			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
-
-#define exynos5_gpio_part2_get_nr(bank, pin) \
-	(((((((unsigned int) &(((struct exynos5_gpio_part2 *) \
-				EXYNOS5_GPIO_PART2_BASE)->bank)) \
-	    - EXYNOS5_GPIO_PART2_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin) + EXYNOS5_GPIO_PART1_MAX)
-
-#define EXYNOS5_GPIO_PART2_MAX ((sizeof(struct exynos5_gpio_part2) \
-			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
-
-#define exynos5_gpio_part3_get_nr(bank, pin) \
-	(((((((unsigned int) &(((struct exynos5_gpio_part3 *) \
-				EXYNOS5_GPIO_PART3_BASE)->bank)) \
-	    - EXYNOS5_GPIO_PART3_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin) + EXYNOS5_GPIO_PART2_MAX)
-
-static inline unsigned int s5p_gpio_base(int nr)
+#define S5P_GPIO_PART_SHIFT	(24)
+#define S5P_GPIO_PART_MASK	(0xff)
+#define S5P_GPIO_BANK_SHIFT	(8)
+#define S5P_GPIO_BANK_MASK	(0xffff)
+#define S5P_GPIO_PIN_MASK	(0xff)
+
+#define S5P_GPIO_SET_PART(x) \
+			((x & S5P_GPIO_PART_MASK) << S5P_GPIO_PART_SHIFT)
+
+#define S5P_GPIO_GET_PART(x) \
+			((x >> S5P_GPIO_PART_SHIFT) & S5P_GPIO_PART_MASK)
+
+#define S5P_GPIO_SET_PIN(x) \
+			(x & S5P_GPIO_PIN_MASK)
+
+#define EXYNOS4_GPIO_SET_BANK(part, bank) \
+			((((unsigned)&(((struct exynos4_gpio_part##part *) \
+			EXYNOS4_GPIO_PART##part##_BASE)->bank) \
+			- EXYNOS4_GPIO_PART##part##_BASE) \
+			& S5P_GPIO_BANK_MASK) << S5P_GPIO_BANK_SHIFT)
+
+#define EXYNOS4X12_GPIO_SET_BANK(part, bank) \
+			((((unsigned)&(((struct exynos4x12_gpio_part##part *) \
+			EXYNOS4X12_GPIO_PART##part##_BASE)->bank) \
+			- EXYNOS4X12_GPIO_PART##part##_BASE) \
+			& S5P_GPIO_BANK_MASK) << S5P_GPIO_BANK_SHIFT)
+
+#define EXYNOS5_GPIO_SET_BANK(part, bank) \
+			((((unsigned)&(((struct exynos5_gpio_part##part *) \
+			EXYNOS5_GPIO_PART##part##_BASE)->bank) \
+			- EXYNOS5_GPIO_PART##part##_BASE) \
+			& S5P_GPIO_BANK_MASK) << S5P_GPIO_BANK_SHIFT)
+
+#define exynos4_gpio_get(part, bank, pin) \
+			(S5P_GPIO_SET_PART(part) | \
+			EXYNOS4_GPIO_SET_BANK(part, bank) | \
+			S5P_GPIO_SET_PIN(pin))
+
+#define exynos4x12_gpio_get(part, bank, pin) \
+			(S5P_GPIO_SET_PART(part) | \
+			EXYNOS4X12_GPIO_SET_BANK(part, bank) | \
+			S5P_GPIO_SET_PIN(pin))
+
+#define exynos5_gpio_get(part, bank, pin) \
+			(S5P_GPIO_SET_PART(part) | \
+			EXYNOS5_GPIO_SET_BANK(part, bank) | \
+			S5P_GPIO_SET_PIN(pin))
+
+static inline unsigned int s5p_gpio_base(int gpio)
 {
-	if (cpu_is_exynos5()) {
-		if (nr < EXYNOS5_GPIO_PART1_MAX)
-			return EXYNOS5_GPIO_PART1_BASE;
-		else if (nr < EXYNOS5_GPIO_PART2_MAX)
-			return EXYNOS5_GPIO_PART2_BASE;
-		else
-			return EXYNOS5_GPIO_PART3_BASE;
-
-	} else if (cpu_is_exynos4()) {
-		if (nr < EXYNOS4_GPIO_PART1_MAX)
-			return EXYNOS4_GPIO_PART1_BASE;
-		else
-			return EXYNOS4_GPIO_PART2_BASE;
+	unsigned gpio_part = S5P_GPIO_GET_PART(gpio);
+
+	switch (gpio_part) {
+	case 1:
+		return samsung_get_base_gpio_part1();
+	case 2:
+		return samsung_get_base_gpio_part2();
+	case 3:
+		return samsung_get_base_gpio_part3();
+	case 4:
+		return samsung_get_base_gpio_part4();
+	default:
+		return 0;
 	}
-
-	return 0;
 }
 
-static inline unsigned int s5p_gpio_part_max(int nr)
-{
-	if (cpu_is_exynos5()) {
-		if (nr < EXYNOS5_GPIO_PART1_MAX)
-			return 0;
-		else if (nr < EXYNOS5_GPIO_PART2_MAX)
-			return EXYNOS5_GPIO_PART1_MAX;
-		else
-			return EXYNOS5_GPIO_PART2_MAX;
-
-	} else if (cpu_is_exynos4()) {
-		if (proid_is_exynos4412()) {
-			if (nr < EXYNOS4X12_GPIO_PART1_MAX)
-				return 0;
-			else if (nr < EXYNOS4X12_GPIO_PART2_MAX)
-				return EXYNOS4X12_GPIO_PART1_MAX;
-			else
-				return EXYNOS4X12_GPIO_PART2_MAX;
-		} else {
-			if (nr < EXYNOS4_GPIO_PART1_MAX)
-				return 0;
-			else
-				return EXYNOS4_GPIO_PART1_MAX;
-		}
-	}
-
-	return 0;
-}
 #endif
 
 /* Pin configurations */
diff --git a/arch/arm/include/asm/arch-s5pc1xx/gpio.h b/arch/arm/include/asm/arch-s5pc1xx/gpio.h
index ac60fe6..84a7091 100644
--- a/arch/arm/include/asm/arch-s5pc1xx/gpio.h
+++ b/arch/arm/include/asm/arch-s5pc1xx/gpio.h
@@ -125,20 +125,45 @@ void s5p_gpio_set_rate(struct s5p_gpio_bank *bank, int gpio, int mode);
 /* GPIO pins per bank  */
 #define GPIO_PER_BANK 8
 
-static inline unsigned int s5p_gpio_base(int nr)
-{
-	return S5PC110_GPIO_BASE;
-}
+#define S5P_GPIO_PART_SHIFT	(24)
+#define S5P_GPIO_PART_MASK	(0xff)
+#define S5P_GPIO_BANK_SHIFT	(8)
+#define S5P_GPIO_BANK_MASK	(0xffff)
+#define S5P_GPIO_PIN_MASK	(0xff)
+
+#define S5P_GPIO_SET_PART(x) \
+			((x & S5P_GPIO_PART_MASK) << S5P_GPIO_PART_SHIFT)
+
+#define S5P_GPIO_GET_PART(x) \
+			((x >> S5P_GPIO_PART_SHIFT) & S5P_GPIO_PART_MASK)
+
+#define S5P_GPIO_SET_PIN(x) \
+			(x & S5P_GPIO_PIN_MASK)
 
-static inline unsigned int s5p_gpio_part_max(int nr)
+#define S5PC100_SET_BANK(bank) \
+			(((unsigned)&(((struct s5pc100_gpio *) \
+			S5PC100_GPIO_BASE)->bank) - S5PC100_GPIO_BASE) \
+			& S5P_GPIO_BANK_MASK) << S5P_GPIO_BANK_SHIFT)
+
+#define S5PC110_SET_BANK(bank) \
+			((((unsigned) &(((struct s5pc110_gpio *) \
+			S5PC110_GPIO_BASE)->bank) - S5PC110_GPIO_BASE) \
+			& S5P_GPIO_BANK_MASK) << S5P_GPIO_BANK_SHIFT)
+
+#define s5pc100_gpio_get(bank, pin) \
+			(S5P_GPIO_SET_PART(0) | \
+			S5PC100_SET_BANK(bank) | \
+			S5P_GPIO_SET_PIN(pin))
+
+#define s5pc110_gpio_get(bank, pin) \
+			(S5P_GPIO_SET_PART(0) | \
+			S5PC110_SET_BANK(bank) | \
+			S5P_GPIO_SET_PIN(pin))
+
+static inline unsigned int s5p_gpio_base(int nr)
 {
-	return 0;
+	return samsung_get_base_gpio();
 }
-
-#define s5pc110_gpio_get_nr(bank, pin)	  \
-	((((((unsigned int)&(((struct s5pc110_gpio *)S5PC110_GPIO_BASE)->bank))\
-	    - S5PC110_GPIO_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin)
 #endif
 
 /* Pin configurations */
diff --git a/drivers/gpio/s5p_gpio.c b/drivers/gpio/s5p_gpio.c
index 7eeb96d..13aefba 100644
--- a/drivers/gpio/s5p_gpio.c
+++ b/drivers/gpio/s5p_gpio.c
@@ -9,6 +9,11 @@
 #include <asm/io.h>
 #include <asm/gpio.h>
 
+#define S5P_GPIO_GET_BANK(x)	((x >> S5P_GPIO_BANK_SHIFT) \
+				& S5P_GPIO_BANK_MASK)
+
+#define S5P_GPIO_GET_PIN(x)	(x & S5P_GPIO_PIN_MASK)
+
 #define CON_MASK(x)		(0xf << ((x) << 2))
 #define CON_SFR(x, v)		((v) << ((x) << 2))
 
@@ -124,17 +129,15 @@ void s5p_gpio_set_rate(struct s5p_gpio_bank *bank, int gpio, int mode)
 
 struct s5p_gpio_bank *s5p_gpio_get_bank(unsigned gpio)
 {
-	int bank;
-	unsigned g = gpio - s5p_gpio_part_max(gpio);
+	unsigned bank = S5P_GPIO_GET_BANK(gpio);
+	unsigned base = s5p_gpio_base(gpio);
 
-	bank = g / GPIO_PER_BANK;
-	bank *= sizeof(struct s5p_gpio_bank);
-	return (struct s5p_gpio_bank *) (s5p_gpio_base(gpio) + bank);
+	return (struct s5p_gpio_bank *) (base + bank);
 }
 
 int s5p_gpio_get_pin(unsigned gpio)
 {
-	return gpio % GPIO_PER_BANK;
+	return S5P_GPIO_GET_PIN(gpio);
 }
 
 /* Common GPIO API */
diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
index 0590d20..4cdf937 100644
--- a/include/configs/s5p_goni.h
+++ b/include/configs/s5p_goni.h
@@ -208,8 +208,8 @@
 /*
  * I2C Settings
  */
-#define CONFIG_SOFT_I2C_GPIO_SCL s5pc110_gpio_get_nr(j4, 3)
-#define CONFIG_SOFT_I2C_GPIO_SDA s5pc110_gpio_get_nr(j4, 0)
+#define CONFIG_SOFT_I2C_GPIO_SCL s5pc110_gpio_get(j4, 3)
+#define CONFIG_SOFT_I2C_GPIO_SDA s5pc110_gpio_get(j4, 0)
 
 #define CONFIG_SYS_I2C
 #define CONFIG_SYS_I2C_SOFT		/* I2C bit-banged */
diff --git a/include/configs/s5pc210_universal.h b/include/configs/s5pc210_universal.h
index d9e4c56..02a1c99 100644
--- a/include/configs/s5pc210_universal.h
+++ b/include/configs/s5pc210_universal.h
@@ -229,8 +229,8 @@
 /*
  * I2C Settings
  */
-#define CONFIG_SOFT_I2C_GPIO_SCL exynos4_gpio_part1_get_nr(b, 7)
-#define CONFIG_SOFT_I2C_GPIO_SDA exynos4_gpio_part1_get_nr(b, 6)
+#define CONFIG_SOFT_I2C_GPIO_SCL exynos4_gpio_get(1, b, 7)
+#define CONFIG_SOFT_I2C_GPIO_SDA exynos4_gpio_get(1, b, 6)
 
 #define CONFIG_SYS_I2C
 #define CONFIG_SYS_I2C_SOFT		/* I2C bit-banged */
@@ -253,10 +253,10 @@
  */
 #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 CONFIG_SOFT_SPI_GPIO_SCLK exynos4_gpio_get(2, y3, 1)
+#define CONFIG_SOFT_SPI_GPIO_MOSI exynos4_gpio_get(2, y3, 3)
+#define CONFIG_SOFT_SPI_GPIO_MISO exynos4_gpio_get(2, y3, 0)
+#define CONFIG_SOFT_SPI_GPIO_CS exynos4_gpio_get(2, y4, 3)
 
 #define SPI_DELAY udelay(1)
 #undef SPI_INIT
diff --git a/include/configs/trats.h b/include/configs/trats.h
index 8ff9800..2b07fe0 100644
--- a/include/configs/trats.h
+++ b/include/configs/trats.h
@@ -283,12 +283,12 @@
 #include <asm/arch/gpio.h>
 
 /* I2C PMIC */
-#define CONFIG_SOFT_I2C_I2C5_SCL exynos4_gpio_part1_get_nr(b, 7)
-#define CONFIG_SOFT_I2C_I2C5_SDA exynos4_gpio_part1_get_nr(b, 6)
+#define CONFIG_SOFT_I2C_I2C5_SCL exynos4_gpio_get(1, b, 7)
+#define CONFIG_SOFT_I2C_I2C5_SDA exynos4_gpio_get(1, b, 6)
 
 /* I2C FG */
-#define CONFIG_SOFT_I2C_I2C9_SCL exynos4_gpio_part2_get_nr(y4, 1)
-#define CONFIG_SOFT_I2C_I2C9_SDA exynos4_gpio_part2_get_nr(y4, 0)
+#define CONFIG_SOFT_I2C_I2C9_SCL exynos4_gpio_get(2, y4, 1)
+#define CONFIG_SOFT_I2C_I2C9_SDA exynos4_gpio_get(2, y4, 0)
 
 #define CONFIG_SOFT_I2C_GPIO_SCL get_multi_scl_pin()
 #define CONFIG_SOFT_I2C_GPIO_SDA get_multi_sda_pin()
diff --git a/include/configs/trats2.h b/include/configs/trats2.h
index c49a969e..f7d76f8 100644
--- a/include/configs/trats2.h
+++ b/include/configs/trats2.h
@@ -293,12 +293,12 @@
 #define CONFIG_SOFT_I2C_MULTI_BUS
 #define CONFIG_SYS_MAX_I2C_BUS		15
 
-#define CONFIG_SOFT_I2C_I2C5_SCL exynos4x12_gpio_part1_get_nr(d0, 3)
-#define CONFIG_SOFT_I2C_I2C5_SDA exynos4x12_gpio_part1_get_nr(d0, 2)
-#define CONFIG_SOFT_I2C_I2C9_SCL exynos4x12_gpio_part1_get_nr(f1, 4)
-#define CONFIG_SOFT_I2C_I2C9_SDA exynos4x12_gpio_part1_get_nr(f1, 5)
-#define CONFIG_SOFT_I2C_I2C10_SCL exynos4x12_gpio_part2_get_nr(m2, 1)
-#define CONFIG_SOFT_I2C_I2C10_SDA exynos4x12_gpio_part2_get_nr(m2, 0)
+#define CONFIG_SOFT_I2C_I2C5_SCL exynos4x12_gpio_get(1, d0, 3)
+#define CONFIG_SOFT_I2C_I2C5_SDA exynos4x12_gpio_get(1, d0, 2)
+#define CONFIG_SOFT_I2C_I2C9_SCL exynos4x12_gpio_get(1, f1, 4)
+#define CONFIG_SOFT_I2C_I2C9_SDA exynos4x12_gpio_get(1, f1, 5)
+#define CONFIG_SOFT_I2C_I2C10_SCL exynos4x12_gpio_get(2, m2, 1)
+#define CONFIG_SOFT_I2C_I2C10_SDA exynos4x12_gpio_get(2, m2, 0)
 #define CONFIG_SOFT_I2C_GPIO_SCL get_multi_scl_pin()
 #define CONFIG_SOFT_I2C_GPIO_SDA get_multi_sda_pin()
 #define I2C_INIT multi_i2c_init()
-- 
1.7.9.5

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

* [U-Boot] [PATCH 02/10] trats2: Code cleanup.
  2013-12-03 18:03 [U-Boot] [PATCH 00/10] Introduce Samsung misc file and LCD menu Przemyslaw Marczak
  2013-12-03 18:03 ` [U-Boot] [PATCH 01/10] s5p: gpio: change gpio coding method for s5p gpio Przemyslaw Marczak
@ 2013-12-03 18:03 ` Przemyslaw Marczak
  2013-12-03 18:03 ` [U-Boot] [PATCH 03/10] samsung: common: Add misc file and common function misc_init_r() Przemyslaw Marczak
                   ` (13 subsequent siblings)
  15 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2013-12-03 18:03 UTC (permalink / raw)
  To: u-boot

Remove wrong and unused env variables
Trats2 is not as GT-I8800.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
CC: Piotr Wilczek <p.wilczek@samsung.com>

---
 board/samsung/trats2/trats2.c      |   19 ++-----------------
 drivers/power/battery/bat_trats2.c |    2 +-
 include/configs/trats2.h           |    1 -
 3 files changed, 3 insertions(+), 19 deletions(-)

diff --git a/board/samsung/trats2/trats2.c b/board/samsung/trats2/trats2.c
index 9552522..2442d96 100644
--- a/board/samsung/trats2/trats2.c
+++ b/board/samsung/trats2/trats2.c
@@ -72,15 +72,12 @@ static void check_hw_revision(void)
 int checkboard(void)
 {
 	puts("Board:\tTRATS2\n");
+	printf("HW Revision:\t0x%04x\n", board_rev);
+
 	return 0;
 }
 #endif
 
-static void show_hw_revision(void)
-{
-	printf("HW Revision:\t0x%04x\n", board_rev);
-}
-
 u32 get_board_rev(void)
 {
 	return board_rev;
@@ -591,15 +588,3 @@ void init_panel_info(vidinfo_t *vid)
 	exynos_set_dsim_platform_data(&dsim_platform_data);
 }
 #endif /* LCD */
-
-#ifdef CONFIG_MISC_INIT_R
-int misc_init_r(void)
-{
-	setenv("model", "GT-I8800");
-	setenv("board", "TRATS2");
-
-	show_hw_revision();
-
-	return 0;
-}
-#endif
diff --git a/drivers/power/battery/bat_trats2.c b/drivers/power/battery/bat_trats2.c
index f264832..94015aa 100644
--- a/drivers/power/battery/bat_trats2.c
+++ b/drivers/power/battery/bat_trats2.c
@@ -8,7 +8,7 @@
 #include <common.h>
 #include <power/pmic.h>
 #include <power/battery.h>
-#include <power/max8997_pmic.h>
+#include <power/max77693_pmic.h>
 #include <errno.h>
 
 static struct battery battery_trats;
diff --git a/include/configs/trats2.h b/include/configs/trats2.h
index f7d76f8..18270c1 100644
--- a/include/configs/trats2.h
+++ b/include/configs/trats2.h
@@ -271,7 +271,6 @@
 #define CONFIG_EFI_PARTITION
 #define CONFIG_PARTITION_UUIDS
 
-#define CONFIG_MISC_INIT_R
 #define CONFIG_BOARD_EARLY_INIT_F
 
 /* I2C */
-- 
1.7.9.5

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

* [U-Boot] [PATCH 03/10] samsung: common: Add misc file and common function misc_init_r().
  2013-12-03 18:03 [U-Boot] [PATCH 00/10] Introduce Samsung misc file and LCD menu Przemyslaw Marczak
  2013-12-03 18:03 ` [U-Boot] [PATCH 01/10] s5p: gpio: change gpio coding method for s5p gpio Przemyslaw Marczak
  2013-12-03 18:03 ` [U-Boot] [PATCH 02/10] trats2: Code cleanup Przemyslaw Marczak
@ 2013-12-03 18:03 ` Przemyslaw Marczak
  2013-12-11  8:16   ` Minkyu Kang
  2013-12-03 18:03 ` [U-Boot] [PATCH 04/10] samsung: misc: move display logo function to misc.c file Przemyslaw Marczak
                   ` (12 subsequent siblings)
  15 siblings, 1 reply; 147+ messages in thread
From: Przemyslaw Marczak @ 2013-12-03 18:03 UTC (permalink / raw)
  To: u-boot

Config options:
- CONFIG_SAMSUNG - misc.c
- CONFIG_MISC_INIT_R - function misc_init_r();

New file:
- board/samsung/common/misc.c

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
---
 board/samsung/common/Makefile |    1 +
 board/samsung/common/misc.c   |   16 ++++++++++++++++
 2 files changed, 17 insertions(+)
 create mode 100644 board/samsung/common/misc.c

diff --git a/board/samsung/common/Makefile b/board/samsung/common/Makefile
index 501d974..d1eb63f 100644
--- a/board/samsung/common/Makefile
+++ b/board/samsung/common/Makefile
@@ -8,3 +8,4 @@
 obj-$(CONFIG_SOFT_I2C_MULTI_BUS) += multi_i2c.o
 obj-$(CONFIG_THOR_FUNCTION) += thor.o
 obj-$(CONFIG_CMD_USB_MASS_STORAGE) += ums.o
+obj-$(CONFIG_SAMSUNG) += misc.o
diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
new file mode 100644
index 0000000..465895b
--- /dev/null
+++ b/board/samsung/common/misc.c
@@ -0,0 +1,16 @@
+/*
+ * Copyright (C) 2013 Samsung Electronics
+ * Przemyslaw Marczak <p.marczak@samsung.com>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+
+#ifdef CONFIG_MISC_INIT_R
+/* Common for Samsung boards */
+int misc_init_r(void)
+{
+	return 0;
+}
+#endif /* CONFIG_MISC_INIT_R */
-- 
1.7.9.5

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

* [U-Boot] [PATCH 04/10] samsung: misc: move display logo function to misc.c file.
  2013-12-03 18:03 [U-Boot] [PATCH 00/10] Introduce Samsung misc file and LCD menu Przemyslaw Marczak
                   ` (2 preceding siblings ...)
  2013-12-03 18:03 ` [U-Boot] [PATCH 03/10] samsung: common: Add misc file and common function misc_init_r() Przemyslaw Marczak
@ 2013-12-03 18:03 ` Przemyslaw Marczak
  2013-12-10  9:47   ` 황형원
  2013-12-11  8:16   ` Minkyu Kang
  2013-12-03 18:03 ` [U-Boot] [PATCH 05/10] lib: tizen: add Tizen 16bpp logo support Przemyslaw Marczak
                   ` (11 subsequent siblings)
  15 siblings, 2 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2013-12-03 18:03 UTC (permalink / raw)
  To: u-boot

board/samsung/common/misc.c:
- move draw_logo() function from exynos_fb.c
- add get_tizen_logo_info() function call removed from board files

boards:
- update board files
- add CONFIG_MISC_INIT_R to Universal, Trats and Trats2

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
---
 board/samsung/common/misc.c              |   39 ++++++++++++++++++++++++++++++
 board/samsung/trats/trats.c              |    3 ---
 board/samsung/trats2/trats2.c            |    4 ---
 board/samsung/universal_c210/universal.c |    4 ---
 drivers/video/exynos_fb.c                |   28 ---------------------
 include/configs/s5pc210_universal.h      |    3 +++
 include/configs/trats.h                  |    3 +++
 include/configs/trats2.h                 |    3 +++
 8 files changed, 48 insertions(+), 39 deletions(-)

diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
index 465895b..fa97644 100644
--- a/board/samsung/common/misc.c
+++ b/board/samsung/common/misc.c
@@ -6,11 +6,50 @@
  */
 
 #include <common.h>
+#include <lcd.h>
+#include <libtizen.h>
+
+#ifdef CONFIG_MISC_INIT_R
+#ifdef CONFIG_CMD_BMP
+static void draw_logo(void)
+{
+	int x, y;
+	ulong addr;
+
+#ifdef CONFIG_TIZEN
+	get_tizen_logo_info(&panel_info);
+#else
+	return;
+#endif
+
+	if (panel_info.vl_width >= panel_info.logo_width) {
+		x = ((panel_info.vl_width - panel_info.logo_width) >> 1);
+	} else {
+		x = 0;
+		printf("Warning: image width is bigger than display width\n");
+	}
+
+	if (panel_info.vl_height >= panel_info.logo_height) {
+		y = ((panel_info.vl_height - panel_info.logo_height) >> 1);
+	} else {
+		y = 0;
+		printf("Warning: image height is bigger than display height\n");
+	}
+
+	addr = panel_info.logo_addr;
+	bmp_display(addr, x, y);
+}
+#endif /* CONFIG_CMD_BMP */
+#endif /* CONFIG_MISC_INIT_R */
 
 #ifdef CONFIG_MISC_INIT_R
 /* Common for Samsung boards */
 int misc_init_r(void)
 {
+#ifdef CONFIG_CMD_BMP
+	if (panel_info.logo_on)
+		draw_logo();
+#endif
 	return 0;
 }
 #endif /* CONFIG_MISC_INIT_R */
diff --git a/board/samsung/trats/trats.c b/board/samsung/trats/trats.c
index 6bd106e..ce4b41f 100644
--- a/board/samsung/trats/trats.c
+++ b/board/samsung/trats/trats.c
@@ -767,9 +767,6 @@ void init_panel_info(vidinfo_t *vid)
 	vid->resolution	= HD_RESOLUTION,
 	vid->rgb_mode	= MODE_RGB_P,
 
-#ifdef CONFIG_TIZEN
-	get_tizen_logo_info(vid);
-#endif
 	mipi_lcd_device.reverse_panel = 1;
 
 	strcpy(s6e8ax0_platform_data.lcd_panel_name, mipi_lcd_device.name);
diff --git a/board/samsung/trats2/trats2.c b/board/samsung/trats2/trats2.c
index 2442d96..73b8cc1 100644
--- a/board/samsung/trats2/trats2.c
+++ b/board/samsung/trats2/trats2.c
@@ -573,10 +573,6 @@ void init_panel_info(vidinfo_t *vid)
 
 	mipi_lcd_device.reverse_panel = 1;
 
-#ifdef CONFIG_TIZEN
-	get_tizen_logo_info(vid);
-#endif
-
 	strcpy(dsim_platform_data.lcd_panel_name, mipi_lcd_device.name);
 	dsim_platform_data.mipi_power = mipi_power;
 	dsim_platform_data.phy_enable = set_mipi_phy_ctrl;
diff --git a/board/samsung/universal_c210/universal.c b/board/samsung/universal_c210/universal.c
index 54d0e1e..166d5ee 100644
--- a/board/samsung/universal_c210/universal.c
+++ b/board/samsung/universal_c210/universal.c
@@ -484,10 +484,6 @@ void init_panel_info(vidinfo_t *vid)
 	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;
diff --git a/drivers/video/exynos_fb.c b/drivers/video/exynos_fb.c
index 7d4c6e0..00a0a11 100644
--- a/drivers/video/exynos_fb.c
+++ b/drivers/video/exynos_fb.c
@@ -62,31 +62,6 @@ static void exynos_lcd_init(vidinfo_t *vid)
 	lcd_set_flush_dcache(1);
 }
 
-#ifdef CONFIG_CMD_BMP
-static void draw_logo(void)
-{
-	int x, y;
-	ulong addr;
-
-	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);
-}
-#endif
-
 void __exynos_cfg_lcd_gpio(void)
 {
 }
@@ -323,9 +298,6 @@ void lcd_enable(void)
 	if (panel_info.logo_on) {
 		memset((void *) gd->fb_base, 0, panel_width * panel_height *
 				(NBITS(panel_info.vl_bpix) >> 3));
-#ifdef CONFIG_CMD_BMP
-		draw_logo();
-#endif
 	}
 
 	lcd_panel_on(&panel_info);
diff --git a/include/configs/s5pc210_universal.h b/include/configs/s5pc210_universal.h
index 02a1c99..47f0e85 100644
--- a/include/configs/s5pc210_universal.h
+++ b/include/configs/s5pc210_universal.h
@@ -269,6 +269,9 @@ void universal_spi_sda(int bit);
 int universal_spi_read(void);
 #endif
 
+/* Common misc for Samsung */
+#define CONFIG_MISC_INIT_R	1
+
 /*
  * LCD Settings
  */
diff --git a/include/configs/trats.h b/include/configs/trats.h
index 2b07fe0..806f6fe 100644
--- a/include/configs/trats.h
+++ b/include/configs/trats.h
@@ -310,6 +310,9 @@
 #define CONFIG_USB_GADGET_VBUS_DRAW	2
 #define CONFIG_USB_CABLE_CHECK
 
+/* Common misc for Samsung */
+#define CONFIG_MISC_INIT_R	1
+
 /* LCD */
 #define CONFIG_EXYNOS_FB
 #define CONFIG_LCD
diff --git a/include/configs/trats2.h b/include/configs/trats2.h
index 18270c1..91821b4 100644
--- a/include/configs/trats2.h
+++ b/include/configs/trats2.h
@@ -316,6 +316,9 @@
 #define CONFIG_USB_GADGET_VBUS_DRAW	2
 #define CONFIG_USB_CABLE_CHECK
 
+/* Common misc for Samsung */
+#define CONFIG_MISC_INIT_R	1
+
 /* LCD */
 #define CONFIG_EXYNOS_FB
 #define CONFIG_LCD
-- 
1.7.9.5

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

* [U-Boot] [PATCH 05/10] lib: tizen: add Tizen 16bpp logo support.
  2013-12-03 18:03 [U-Boot] [PATCH 00/10] Introduce Samsung misc file and LCD menu Przemyslaw Marczak
                   ` (3 preceding siblings ...)
  2013-12-03 18:03 ` [U-Boot] [PATCH 04/10] samsung: misc: move display logo function to misc.c file Przemyslaw Marczak
@ 2013-12-03 18:03 ` Przemyslaw Marczak
       [not found]   ` <01a201cef56e$6f3e3ac0$4dbab040$@samsung.com>
       [not found]   ` <20131211105613.201446ff68c75747d836fab7@samsung.com>
  2013-12-03 18:03 ` [U-Boot] [PATCH 06/10] video: exynos: fimd: always use 16bpp display mode Przemyslaw Marczak
                   ` (10 subsequent siblings)
  15 siblings, 2 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2013-12-03 18:03 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
---
This is big size patch. Please follow link:
http://www.denx.de/wiki/pub/U-Boot/TooBigPatches/0005-lib-tizen-add-Tizen-16bpp-logo-support.patch

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

* [U-Boot] [PATCH 06/10] video: exynos: fimd: always use 16bpp display mode.
  2013-12-03 18:03 [U-Boot] [PATCH 00/10] Introduce Samsung misc file and LCD menu Przemyslaw Marczak
                   ` (4 preceding siblings ...)
  2013-12-03 18:03 ` [U-Boot] [PATCH 05/10] lib: tizen: add Tizen 16bpp logo support Przemyslaw Marczak
@ 2013-12-03 18:03 ` Przemyslaw Marczak
       [not found]   ` <018001cef563$f1baed50$d530c7f0$@samsung.com>
  2013-12-03 18:03 ` [U-Boot] [PATCH 07/10] samsung: misc: Add LCD download menu Przemyslaw Marczak
                   ` (9 subsequent siblings)
  15 siblings, 1 reply; 147+ messages in thread
From: Przemyslaw Marczak @ 2013-12-03 18:03 UTC (permalink / raw)
  To: u-boot

This change updates exynos board files too.
16 bpp mode is required by LCD console mode.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
---
 board/samsung/trats/trats.c              |    2 +-
 board/samsung/trats2/trats2.c            |    2 +-
 board/samsung/universal_c210/universal.c |    2 +-
 drivers/video/exynos_fimd.c              |   10 ++--------
 include/configs/s5pc210_universal.h      |    2 +-
 include/configs/trats.h                  |    2 +-
 include/configs/trats2.h                 |    2 +-
 7 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/board/samsung/trats/trats.c b/board/samsung/trats/trats.c
index ce4b41f..db527c7 100644
--- a/board/samsung/trats/trats.c
+++ b/board/samsung/trats/trats.c
@@ -739,7 +739,7 @@ vidinfo_t panel_info = {
 	.vl_hsp		= CONFIG_SYS_LOW,
 	.vl_vsp		= CONFIG_SYS_LOW,
 	.vl_dp		= CONFIG_SYS_LOW,
-	.vl_bpix	= 5,	/* Bits per pixel, 2^5 = 32 */
+	.vl_bpix	= 4,	/* Bits per pixel, 2^4 = 16 */
 
 	/* s6e8ax0 Panel infomation */
 	.vl_hspw	= 5,
diff --git a/board/samsung/trats2/trats2.c b/board/samsung/trats2/trats2.c
index 73b8cc1..6fa02c9 100644
--- a/board/samsung/trats2/trats2.c
+++ b/board/samsung/trats2/trats2.c
@@ -542,7 +542,7 @@ vidinfo_t panel_info = {
 	.vl_hsp		= CONFIG_SYS_LOW,
 	.vl_vsp		= CONFIG_SYS_LOW,
 	.vl_dp		= CONFIG_SYS_LOW,
-	.vl_bpix	= 5,	/* Bits per pixel, 2^5 = 32 */
+	.vl_bpix	= 4,	/* Bits per pixel, 2^4 = 16 */
 
 	/* s6e8ax0 Panel infomation */
 	.vl_hspw	= 5,
diff --git a/board/samsung/universal_c210/universal.c b/board/samsung/universal_c210/universal.c
index 166d5ee..1ebea0f 100644
--- a/board/samsung/universal_c210/universal.c
+++ b/board/samsung/universal_c210/universal.c
@@ -446,7 +446,7 @@ vidinfo_t panel_info = {
 	.vl_vsp		= CONFIG_SYS_HIGH,
 	.vl_dp		= CONFIG_SYS_HIGH,
 
-	.vl_bpix	= 5,	/* Bits per pixel */
+	.vl_bpix	= 4,	/* Bits per pixel */
 
 	/* LD9040 LCD Panel */
 	.vl_hspw	= 2,
diff --git a/drivers/video/exynos_fimd.c b/drivers/video/exynos_fimd.c
index f962c4f..847fbe8 100644
--- a/drivers/video/exynos_fimd.c
+++ b/drivers/video/exynos_fimd.c
@@ -73,18 +73,12 @@ static void exynos_fimd_set_par(unsigned int win_id)
 	/* DATAPATH is DMA */
 	cfg |= EXYNOS_WINCON_DATAPATH_DMA;
 
-	if (pvid->logo_on) /* To get proprietary LOGO */
-		cfg |= EXYNOS_WINCON_WSWP_ENABLE;
-	else /* To get output console on LCD */
-		cfg |= EXYNOS_WINCON_HAWSWP_ENABLE;
+	cfg |= EXYNOS_WINCON_HAWSWP_ENABLE;
 
 	/* dma burst is 16 */
 	cfg |= EXYNOS_WINCON_BURSTLEN_16WORD;
 
-	if (pvid->logo_on) /* To get proprietary LOGO */
-		cfg |= EXYNOS_WINCON_BPPMODE_24BPP_888;
-	else /* To get output console on LCD */
-		cfg |= EXYNOS_WINCON_BPPMODE_16BPP_565;
+	cfg |= EXYNOS_WINCON_BPPMODE_16BPP_565;
 
 	writel(cfg, (unsigned int)&fimd_ctrl->wincon0 +
 			EXYNOS_WINCON(win_id));
diff --git a/include/configs/s5pc210_universal.h b/include/configs/s5pc210_universal.h
index 47f0e85..fb1cc6b 100644
--- a/include/configs/s5pc210_universal.h
+++ b/include/configs/s5pc210_universal.h
@@ -278,7 +278,7 @@ int universal_spi_read(void);
 #define CONFIG_EXYNOS_FB
 #define CONFIG_LCD
 #define CONFIG_CMD_BMP
-#define CONFIG_BMP_32BPP
+#define CONFIG_BMP_16BPP
 #define CONFIG_LD9040
 #define CONFIG_EXYNOS_MIPI_DSIM
 #define CONFIG_VIDEO_BMP_GZIP
diff --git a/include/configs/trats.h b/include/configs/trats.h
index 806f6fe..9738a00 100644
--- a/include/configs/trats.h
+++ b/include/configs/trats.h
@@ -317,7 +317,7 @@
 #define CONFIG_EXYNOS_FB
 #define CONFIG_LCD
 #define CONFIG_CMD_BMP
-#define CONFIG_BMP_32BPP
+#define CONFIG_BMP_16BPP
 #define CONFIG_FB_ADDR		0x52504000
 #define CONFIG_S6E8AX0
 #define CONFIG_EXYNOS_MIPI_DSIM
diff --git a/include/configs/trats2.h b/include/configs/trats2.h
index 91821b4..f845437 100644
--- a/include/configs/trats2.h
+++ b/include/configs/trats2.h
@@ -323,7 +323,7 @@
 #define CONFIG_EXYNOS_FB
 #define CONFIG_LCD
 #define CONFIG_CMD_BMP
-#define CONFIG_BMP_32BPP
+#define CONFIG_BMP_16BPP
 #define CONFIG_FB_ADDR		0x52504000
 #define CONFIG_S6E8AX0
 #define CONFIG_EXYNOS_MIPI_DSIM
-- 
1.7.9.5

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

* [U-Boot] [PATCH 07/10] samsung: misc: Add LCD download menu.
  2013-12-03 18:03 [U-Boot] [PATCH 00/10] Introduce Samsung misc file and LCD menu Przemyslaw Marczak
                   ` (5 preceding siblings ...)
  2013-12-03 18:03 ` [U-Boot] [PATCH 06/10] video: exynos: fimd: always use 16bpp display mode Przemyslaw Marczak
@ 2013-12-03 18:03 ` Przemyslaw Marczak
  2013-12-11  8:15   ` Minkyu Kang
  2013-12-03 18:03 ` [U-Boot] [PATCH 08/10] Trats: add LCD download menu support Przemyslaw Marczak
                   ` (8 subsequent siblings)
  15 siblings, 1 reply; 147+ messages in thread
From: Przemyslaw Marczak @ 2013-12-03 18:03 UTC (permalink / raw)
  To: u-boot

New configs:
- CONFIG_LCD_MENU
- CONFIG_LCD_MENU_BOARD
which depends on: CONFIG_MISC_INIT_R

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
---
 board/samsung/common/keys.h |   78 ++++++++++
 board/samsung/common/misc.c |  354 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 432 insertions(+)
 create mode 100644 board/samsung/common/keys.h

diff --git a/board/samsung/common/keys.h b/board/samsung/common/keys.h
new file mode 100644
index 0000000..48822d1
--- /dev/null
+++ b/board/samsung/common/keys.h
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2013 Samsung Electronics
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+#ifndef __SAMSUNG_KEYS__
+#define __SAMSUNG_KEYS__
+
+#ifndef __ASSEMBLY__
+
+#include <config.h>
+#include <common.h>
+#include <power/pmic.h>
+#include <asm/arch/gpio.h>
+
+/* PMIC PWR ON key */
+#if defined(CONFIG_MACH_GONI) || defined(CONFIG_UNIVERSAL)
+
+#include <power/max8998_pmic.h>
+
+#define KEY_PWR_PMIC_NAME		"MAX8998_PMIC"
+
+#define KEY_PWR_STATUS_REG		MAX8998_REG_STATUS1
+#define KEY_PWR_STATUS_MASK		(1 << 7)
+
+#define KEY_PWR_INTERRUPT_REG		MAX8998_REG_IRQ1
+#define KEY_PWR_INTERRUPT_MASK		(1 << 7)
+
+#elif defined(CONFIG_TRATS)
+
+#include <power/max8997_pmic.h>
+
+#define KEY_PWR_PMIC_NAME		"MAX8997_PMIC"
+
+#define KEY_PWR_STATUS_REG		MAX8997_REG_STATUS1
+#define KEY_PWR_STATUS_MASK		(1 << 0)
+
+#define KEY_PWR_INTERRUPT_REG		MAX8997_REG_INT1
+#define KEY_PWR_INTERRUPT_MASK		(1 << 0)
+
+#elif defined(CONFIG_TRATS2)
+
+#include <power/max77686_pmic.h>
+
+#define KEY_PWR_PMIC_NAME		"MAX77686_PMIC"
+
+#define KEY_PWR_STATUS_REG		MAX77686_REG_PMIC_STATUS1
+#define KEY_PWR_STATUS_MASK		(1 << 0)
+
+#define KEY_PWR_INTERRUPT_REG		MAX77686_REG_PMIC_INT1
+#define KEY_PWR_INTERRUPT_MASK		(1 << 1)
+
+#endif /* PMIC PWR ON key */
+
+/* GPIO for Vol Up and Vol Down */
+#if defined(CONFIG_MACH_GONI)
+
+#define KEY_VOL_UP_GPIO			s5pc110_gpio_get(h3, 1)
+#define KEY_VOL_DOWN_GPIO		s5pc110_gpio_get(h3, 2)
+
+#elif defined(CONFIG_UNIVERSAL) || defined(CONFIG_TRATS)
+
+#define KEY_VOL_UP_GPIO			exynos4_gpio_get(2, x2, 0)
+#define KEY_VOL_DOWN_GPIO		exynos4_gpio_get(2, x2, 1)
+
+#elif defined(CONFIG_TRATS2)
+
+#define KEY_VOL_UP_GPIO			exynos4x12_gpio_get(2, x2, 2)
+#define KEY_VOL_DOWN_GPIO		exynos4x12_gpio_get(2, x3, 3)
+
+#else
+#ifdef CONFIG_MISC_INIT_R
+#warning Vol UP and Vol DOWN GPIO are undefined!
+#endif
+#endif /* GPIO for Vol Up and Vol Down */
+
+#endif /* __ASSEMBLY__ */
+#endif /* __SAMSUNG_KEYS__ */
diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
index fa97644..c792b87 100644
--- a/board/samsung/common/misc.c
+++ b/board/samsung/common/misc.c
@@ -8,8 +8,357 @@
 #include <common.h>
 #include <lcd.h>
 #include <libtizen.h>
+#include <errno.h>
+#include <version.h>
+#include <asm/sizes.h>
+#include <asm/arch/cpu.h>
+#include <asm/arch/gpio.h>
+#include <asm/gpio.h>
+#include <linux/input.h>
+#include <lcd.h>
+#include <libtizen.h>
+#include <mmc.h>
+#include "keys.h"
 
 #ifdef CONFIG_MISC_INIT_R
+struct s5p_gpio_bank *s5p_gpio_get_bank(unsigned);
+int s5p_gpio_get_pin(unsigned);
+#ifdef CONFIG_REVISION_TAG
+u32 get_board_rev(void);
+#endif
+
+#ifdef CONFIG_LCD_MENU
+enum {
+	BOOT_MODE_INFO,
+	BOOT_MODE_THOR,
+	BOOT_MODE_UMS,
+	BOOT_MODE_DFU,
+	BOOT_MODE_EXIT,
+};
+
+static int power_key_pressed(int reg)
+{
+	struct pmic *pmic = pmic_get(KEY_PWR_PMIC_NAME);
+	u32 status = 0;
+	u32 mask;
+
+	if (pmic_probe(pmic))
+		return 0;
+
+	if (!pmic) {
+		printf("%s: Not found\n", KEY_PWR_PMIC_NAME);
+		return -ENODEV;
+	}
+
+	if (reg == KEY_PWR_STATUS_REG)
+		mask = KEY_PWR_STATUS_MASK;
+	else
+		mask = KEY_PWR_INTERRUPT_MASK;
+
+	if (pmic_reg_read(pmic, reg, &status))
+		return -EIO;
+
+	return !!(status & mask);
+}
+
+static int key_pressed(int key)
+{
+	int value = 0;
+
+	switch (key) {
+	case KEY_POWER:
+		value = power_key_pressed(KEY_PWR_INTERRUPT_REG);
+		break;
+	case KEY_VOLUMEUP:
+		value = !gpio_get_value(KEY_VOL_UP_GPIO);
+		break;
+	case KEY_VOLUMEDOWN:
+		value = !gpio_get_value(KEY_VOL_DOWN_GPIO);
+		break;
+	default:
+		break;
+	}
+
+	return value;
+}
+
+static int check_keys(void)
+{
+	int keys = 0;
+
+	if (key_pressed(KEY_POWER))
+		keys += KEY_POWER;
+	if (key_pressed(KEY_VOLUMEUP))
+		keys += KEY_VOLUMEUP;
+	if (key_pressed(KEY_VOLUMEDOWN))
+		keys += KEY_VOLUMEDOWN;
+
+	return keys;
+}
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/*
+ * 0 BOOT_MODE_INFO
+ * 1 BOOT_MODE_THOR
+ * 2 BOOT_MODE_UMS
+ * 3 BOOT_MODE_DFU
+ * 4 BOOT_MODE_EXIT
+*/
+static char *
+mode_name[BOOT_MODE_EXIT + 1] = {"DEVICE",
+				"THOR",
+				"UMS",
+				"DFU",
+				"EXIT"};
+
+static char *
+mode_info[BOOT_MODE_EXIT + 1] = {"info",
+				 "downloader",
+				 "mass storage",
+				 "firmware update",
+				 "and run normal boot"};
+
+static char *
+mode_cmd[BOOT_MODE_EXIT + 1] = {"",
+				"thor 0 mmc 0",
+				"ums 0 mmc 0",
+				"dfu 0 mmc 0",
+				""};
+
+static void display_board_info(void)
+{
+	struct mmc *mmc = find_mmc_device(0);
+	vidinfo_t *vid = &panel_info;
+
+	lcd_position_cursor(4, 4);
+
+	lcd_printf("%s\n\t", U_BOOT_VERSION);
+	lcd_puts("\n\t\tBoard Info:\n");
+#ifdef CONFIG_BOARD_NAME
+	lcd_printf("\tBoard name: %s\n", CONFIG_BOARD_NAME);
+#endif
+#ifdef CONFIG_REVISION_TAG
+	lcd_printf("\tBoard rev: %u\n", get_board_rev());
+#endif
+	lcd_printf("\tDRAM banks: %u\n", CONFIG_NR_DRAM_BANKS);
+	lcd_printf("\tDRAM size: %u MB\n", gd->ram_size / SZ_1M);
+
+	if (mmc)
+		lcd_printf("\teMMC size: %llu MB\n", mmc->capacity / SZ_1M);
+
+	if (vid)
+		lcd_printf("\tDisplay resolution: %u x % u\n",
+			   vid->vl_col, vid->vl_row);
+
+	lcd_printf("\tDisplay BPP: %u\n", 1 << vid->vl_bpix);
+}
+
+static int mode_leave_menu(int mode)
+{
+	int mode_supported = 1;
+	int leave = 0;
+	char *exit_option;
+	char *exit_boot = "boot";
+	char *exit_back = "back";
+
+	switch (mode) {
+	case BOOT_MODE_INFO:
+#if !defined(CONFIG_LCD_MENU_BOARD)
+		mode_supported = 0;
+#endif
+		break;
+	case BOOT_MODE_THOR:
+#if !defined(CONFIG_CMD_THOR_DOWNLOAD)
+		mode_supported = 0;
+#endif
+		break;
+	case BOOT_MODE_UMS:
+#if !defined(CONFIG_CMD_USB_MASS_STORAGE)
+		mode_supported = 0;
+#endif
+		break;
+	case BOOT_MODE_DFU:
+#if !defined(CONFIG_CMD_DFU)
+		mode_supported = 0;
+#endif
+		break;
+	case BOOT_MODE_EXIT:
+		leave = 1;
+		goto exit;
+	default:
+		break;
+	}
+
+	lcd_clear();
+
+	if (mode_supported) {
+		if (mode) {
+			lcd_printf("\n\n\t%s %s\n", mode_name[mode],
+						    mode_info[mode]);
+			lcd_puts("\n\tDo not turn off device before finish!\n");
+
+			run_command(mode_cmd[mode], 0);
+			printf("Command finished\n");
+			lcd_clear();
+			lcd_printf("\n\n\t%s finished\n", mode_name[mode]);
+			exit_option = exit_boot;
+			leave = 1;
+		} else {
+			display_board_info();
+			exit_option = exit_back;
+			leave = 0;
+		}
+	} else {
+		lcd_puts("\n\n\tThis mode is not supported.\n");
+		exit_option = exit_back;
+		leave = 0;
+	}
+
+	lcd_printf("\n\n\tPress POWER KEY to %s\n", exit_option);
+
+	/* Wait for PWR key */
+	while (!key_pressed(KEY_POWER))
+		udelay(1000);
+exit:
+	lcd_clear();
+	return leave;
+}
+
+static void display_download_menu(int mode)
+{
+	char *menu_name = "Download Mode Menu";
+	char *indicator = "[=>]";
+	char *blank = "[  ]";
+	char *selection[BOOT_MODE_EXIT + 1];
+	int i;
+
+	for (i = 0; i <= BOOT_MODE_EXIT; i++)
+			selection[i] = blank;
+
+	selection[mode] = indicator;
+
+	lcd_clear();
+	lcd_printf("\n\t\t%s\n", menu_name);
+
+	for (i = 0; i <= BOOT_MODE_EXIT; i++)
+		lcd_printf("\t%s  %s - %s\n\n", selection[i],
+						mode_name[i],
+						mode_info[i]);
+}
+
+void download_menu(void)
+{
+	int mode = 0;
+	int last_mode = 0;
+	int run;
+	int key;
+	int menu_exit = 0;
+
+	display_download_menu(mode);
+
+	while (1) {
+		run = 0;
+		menu_exit = 0;
+
+		if (mode != last_mode)
+			display_download_menu(mode);
+
+		last_mode = mode;
+		udelay(100000);
+
+		key = check_keys();
+		switch (key) {
+		case KEY_POWER:
+			run = 1;
+			break;
+		case KEY_VOLUMEUP:
+			if (mode > 0)
+				mode--;
+			break;
+		case KEY_VOLUMEDOWN:
+			if (mode < BOOT_MODE_EXIT)
+				mode++;
+			break;
+		default:
+			break;
+		}
+
+		if (run) {
+			if (mode_leave_menu(mode))
+				break;
+
+			display_download_menu(mode);
+		}
+	}
+
+	lcd_clear();
+}
+
+static void display_mode_info(void)
+{
+	lcd_position_cursor(4, 4);
+	lcd_printf("%s\n", U_BOOT_VERSION);
+	lcd_puts("\nDownload Mode Menu\n");
+#ifdef CONFIG_BOARD_NAME
+	lcd_printf("Board name: %s\n", CONFIG_BOARD_NAME);
+#endif
+	lcd_printf("Press POWER KEY to display MENU options.");
+}
+
+static int boot_menu(void)
+{
+	int key = 0;
+	int timeout = 10;
+
+	display_mode_info();
+
+	while (timeout--) {
+		lcd_printf("\rNormal boot will start in: %d seconds.", timeout);
+		udelay(1000000);
+
+		key = key_pressed(KEY_POWER);
+		if (key)
+			break;
+	}
+
+	lcd_clear();
+
+	/* If PWR pressed - show download menu */
+	if (key) {
+		printf("Power pressed - go to download menu\n");
+		udelay(1000000);
+		download_menu();
+		printf("Download mode exit.\n");
+	}
+
+	return 0;
+}
+
+static void check_boot_mode(void)
+{
+	int pwr_key;
+
+	pwr_key = power_key_pressed(KEY_PWR_STATUS_REG);
+	if (pwr_key) {
+		/* Clear PWR button Rising edge interrupt status flag */
+		power_key_pressed(KEY_PWR_INTERRUPT_REG);
+
+		if (key_pressed(KEY_VOLUMEUP))
+			boot_menu();
+		else if (key_pressed(KEY_VOLUMEDOWN))
+			mode_leave_menu(BOOT_MODE_THOR);
+	}
+}
+
+static void keys_init(void)
+{
+	/* Set direction to input */
+	gpio_direction_input(KEY_VOL_UP_GPIO);
+	gpio_direction_input(KEY_VOL_DOWN_GPIO);
+}
+#endif /* CONFIG_LCD_MENU */
+
 #ifdef CONFIG_CMD_BMP
 static void draw_logo(void)
 {
@@ -46,10 +395,15 @@ static void draw_logo(void)
 /* Common for Samsung boards */
 int misc_init_r(void)
 {
+#ifdef CONFIG_LCD_MENU
+	keys_init();
+	check_boot_mode();
+#endif
 #ifdef CONFIG_CMD_BMP
 	if (panel_info.logo_on)
 		draw_logo();
 #endif
+
 	return 0;
 }
 #endif /* CONFIG_MISC_INIT_R */
-- 
1.7.9.5

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

* [U-Boot] [PATCH 08/10] Trats: add LCD download menu support
  2013-12-03 18:03 [U-Boot] [PATCH 00/10] Introduce Samsung misc file and LCD menu Przemyslaw Marczak
                   ` (6 preceding siblings ...)
  2013-12-03 18:03 ` [U-Boot] [PATCH 07/10] samsung: misc: Add LCD download menu Przemyslaw Marczak
@ 2013-12-03 18:03 ` Przemyslaw Marczak
  2013-12-04  6:08   ` Lukasz Majewski
  2013-12-11  8:15   ` Minkyu Kang
  2013-12-03 18:03 ` [U-Boot] [PATCH 09/10] trats2: " Przemyslaw Marczak
                   ` (7 subsequent siblings)
  15 siblings, 2 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2013-12-03 18:03 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Cc: Lukasz Majewski <l.majewski@samsung.com>
---
 include/configs/trats.h |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/include/configs/trats.h b/include/configs/trats.h
index 9738a00..d3bed99 100644
--- a/include/configs/trats.h
+++ b/include/configs/trats.h
@@ -19,6 +19,7 @@
 #define CONFIG_EXYNOS4210	/* which is in a EXYNOS4210 */
 #define CONFIG_TRATS		/* working with TRATS */
 #define CONFIG_TIZEN		/* TIZEN lib */
+#define CONFIG_BOARD_NAME	"TRATS"
 
 #include <asm/arch/cpu.h>	/* get chip and board defs */
 
@@ -313,6 +314,15 @@
 /* Common misc for Samsung */
 #define CONFIG_MISC_INIT_R	1
 
+/* Download menu - Samsung common */
+#define CONFIG_LCD_MENU			1
+#define CONFIG_LCD_MENU_BOARD		1
+
+/* LCD console */
+#define LCD_BPP			LCD_COLOR16
+#undef  LCD_TEST_PATTERN
+#define CONFIG_SYS_WHITE_ON_BLACK	1
+
 /* LCD */
 #define CONFIG_EXYNOS_FB
 #define CONFIG_LCD
-- 
1.7.9.5

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

* [U-Boot] [PATCH 09/10] trats2: add LCD download menu support
  2013-12-03 18:03 [U-Boot] [PATCH 00/10] Introduce Samsung misc file and LCD menu Przemyslaw Marczak
                   ` (7 preceding siblings ...)
  2013-12-03 18:03 ` [U-Boot] [PATCH 08/10] Trats: add LCD download menu support Przemyslaw Marczak
@ 2013-12-03 18:03 ` Przemyslaw Marczak
  2013-12-03 18:03 ` [U-Boot] [PATCH 10/10] universal: " Przemyslaw Marczak
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2013-12-03 18:03 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Cc: Piotr Wilczek <p.wilczek@samsung.com>
---
 include/configs/trats2.h |   11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/include/configs/trats2.h b/include/configs/trats2.h
index f845437..8a181fc 100644
--- a/include/configs/trats2.h
+++ b/include/configs/trats2.h
@@ -19,6 +19,8 @@
 #define CONFIG_S5P		/* which is in a S5P Family */
 #define CONFIG_EXYNOS4		/* which is in a EXYNOS4XXX */
 #define CONFIG_TIZEN		/* TIZEN lib */
+#define CONFIG_TRATS2
+#define CONFIG_BOARD_NAME	"TRATS2"
 
 #include <asm/arch/cpu.h>		/* get chip and board defs */
 
@@ -319,6 +321,15 @@
 /* Common misc for Samsung */
 #define CONFIG_MISC_INIT_R	1
 
+/* Download menu - Samsung common */
+#define CONFIG_LCD_MENU			1
+#define CONFIG_LCD_MENU_BOARD		1
+
+/* LCD console */
+#define LCD_BPP                 LCD_COLOR16
+#undef  LCD_TEST_PATTERN
+#define CONFIG_SYS_WHITE_ON_BLACK       1
+
 /* LCD */
 #define CONFIG_EXYNOS_FB
 #define CONFIG_LCD
-- 
1.7.9.5

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

* [U-Boot] [PATCH 10/10] universal: add LCD download menu support
  2013-12-03 18:03 [U-Boot] [PATCH 00/10] Introduce Samsung misc file and LCD menu Przemyslaw Marczak
                   ` (8 preceding siblings ...)
  2013-12-03 18:03 ` [U-Boot] [PATCH 09/10] trats2: " Przemyslaw Marczak
@ 2013-12-03 18:03 ` Przemyslaw Marczak
  2013-12-04  1:29 ` [U-Boot] [PATCH 00/10] Introduce Samsung misc file and LCD menu TigerLiu at viatech.com.cn
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2013-12-03 18:03 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
---
 include/configs/s5pc210_universal.h |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/include/configs/s5pc210_universal.h b/include/configs/s5pc210_universal.h
index fb1cc6b..602c423 100644
--- a/include/configs/s5pc210_universal.h
+++ b/include/configs/s5pc210_universal.h
@@ -19,6 +19,7 @@
 #define CONFIG_EXYNOS4210	1	/* which is in a EXYNOS4210 */
 #define CONFIG_UNIVERSAL	1	/* working with Universal */
 #define CONFIG_TIZEN		1	/* TIZEN lib */
+#define CONFIG_BOARD_NAME	"UNIVERSAL C210"
 
 #include <asm/arch/cpu.h>		/* get chip and board defs */
 
@@ -272,6 +273,15 @@ int universal_spi_read(void);
 /* Common misc for Samsung */
 #define CONFIG_MISC_INIT_R	1
 
+/* Download menu - Samsung common */
+#define CONFIG_LCD_MENU			1
+#define CONFIG_LCD_MENU_BOARD		1
+
+/* LCD console */
+#define LCD_BPP			LCD_COLOR16
+#undef  LCD_TEST_PATTERN
+#define CONFIG_SYS_WHITE_ON_BLACK	1
+
 /*
  * LCD Settings
  */
-- 
1.7.9.5

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

* [U-Boot] [PATCH 00/10] Introduce Samsung misc file and LCD menu.
  2013-12-03 18:03 [U-Boot] [PATCH 00/10] Introduce Samsung misc file and LCD menu Przemyslaw Marczak
                   ` (9 preceding siblings ...)
  2013-12-03 18:03 ` [U-Boot] [PATCH 10/10] universal: " Przemyslaw Marczak
@ 2013-12-04  1:29 ` TigerLiu at viatech.com.cn
  2013-12-04 12:11   ` Przemyslaw Marczak
  2013-12-18 18:31 ` [U-Boot] [PATCH v2 00/13] " Przemyslaw Marczak
                   ` (4 subsequent siblings)
  15 siblings, 1 reply; 147+ messages in thread
From: TigerLiu at viatech.com.cn @ 2013-12-04  1:29 UTC (permalink / raw)
  To: u-boot

Hi, Marczak:
Could i test these feature on S5PV310 platform(Origen Board)?
Such as : console support on LCD

Best wishes,

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

* [U-Boot] [PATCH 08/10] Trats: add LCD download menu support
  2013-12-03 18:03 ` [U-Boot] [PATCH 08/10] Trats: add LCD download menu support Przemyslaw Marczak
@ 2013-12-04  6:08   ` Lukasz Majewski
  2013-12-11  8:15   ` Minkyu Kang
  1 sibling, 0 replies; 147+ messages in thread
From: Lukasz Majewski @ 2013-12-04  6:08 UTC (permalink / raw)
  To: u-boot

Hi Przemyslaw,

> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
> Cc: Lukasz Majewski <l.majewski@samsung.com>
> ---
>  include/configs/trats.h |   10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/include/configs/trats.h b/include/configs/trats.h
> index 9738a00..d3bed99 100644
> --- a/include/configs/trats.h
> +++ b/include/configs/trats.h
> @@ -19,6 +19,7 @@
>  #define CONFIG_EXYNOS4210	/* which is in a EXYNOS4210 */
>  #define CONFIG_TRATS		/* working with TRATS */
>  #define CONFIG_TIZEN		/* TIZEN lib */
> +#define CONFIG_BOARD_NAME	"TRATS"
>  
>  #include <asm/arch/cpu.h>	/* get chip and board defs */
>  
> @@ -313,6 +314,15 @@
>  /* Common misc for Samsung */
>  #define CONFIG_MISC_INIT_R	1
>  
> +/* Download menu - Samsung common */
> +#define CONFIG_LCD_MENU			1
> +#define CONFIG_LCD_MENU_BOARD		1
> +
> +/* LCD console */
> +#define LCD_BPP			LCD_COLOR16
> +#undef  LCD_TEST_PATTERN
> +#define CONFIG_SYS_WHITE_ON_BLACK	1
> +
>  /* LCD */
>  #define CONFIG_EXYNOS_FB
>  #define CONFIG_LCD

Acked-by: Lukasz Majewski <l.majewski@samsung.com>

-- 
-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

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

* [U-Boot] [PATCH 00/10] Introduce Samsung misc file and LCD menu.
  2013-12-04  1:29 ` [U-Boot] [PATCH 00/10] Introduce Samsung misc file and LCD menu TigerLiu at viatech.com.cn
@ 2013-12-04 12:11   ` Przemyslaw Marczak
  0 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2013-12-04 12:11 UTC (permalink / raw)
  To: u-boot

Hi Tiger,

I don't see any LCD panel config in origen board file. So you can't just 
test LCD menu using only my patch set.

Anyway it requires few steps:
- add 16BPP display support to origen.c
  (you can see example in trats.c), so add proper code and proper LCD 
  configs in origen.h (LCD, FB, etc.)

next to add my patch set you should add:
- CONFIG_MISC_INIT_R,
- follow my patch 08 and add corresponding code to origen.h
- follow my patch 07, file keys.h - add there corresponding configs for 
origen board.(pmic registers and gpio for keys)

I hope it's all.

On 12/04/2013 02:29 AM, TigerLiu at viatech.com.cn wrote:
> Hi, Marczak:
> Could i test these feature on S5PV310 platform(Origen Board)?
> Such as : console support on LCD
>
> Best wishes,
>

Thank you
-- 
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com

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

* [U-Boot] FW: [PATCH 06/10] video: exynos: fimd: always use 16bpp display mode.
       [not found]   ` <018001cef563$f1baed50$d530c7f0$@samsung.com>
@ 2013-12-10  5:47     ` Donghwa Lee
  2013-12-10  8:15       ` Przemyslaw Marczak
  0 siblings, 1 reply; 147+ messages in thread
From: Donghwa Lee @ 2013-12-10  5:47 UTC (permalink / raw)
  To: u-boot

Hi,

On 3 Dec 2013 18:03, Przemyslaw wrote:
> This change updates exynos board files too.
> 16 bpp mode is required by LCD console mode.
>
> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
> ---
>  board/samsung/trats/trats.c              |    2 +-
>  board/samsung/trats2/trats2.c            |    2 +-
>  board/samsung/universal_c210/universal.c |    2 +-
>  drivers/video/exynos_fimd.c              |   10 ++--------
>  include/configs/s5pc210_universal.h      |    2 +-
>  include/configs/trats.h                  |    2 +-
>  include/configs/trats2.h                 |    2 +-
>  7 files changed, 8 insertions(+), 14 deletions(-)
>
> diff --git a/board/samsung/trats/trats.c b/board/samsung/trats/trats.c
> index ce4b41f..db527c7 100644
> --- a/board/samsung/trats/trats.c
> +++ b/board/samsung/trats/trats.c
> @@ -739,7 +739,7 @@ vidinfo_t panel_info = {
>  	.vl_hsp		= CONFIG_SYS_LOW,
>  	.vl_vsp		= CONFIG_SYS_LOW,
>  	.vl_dp		= CONFIG_SYS_LOW,
> -	.vl_bpix	= 5,	/* Bits per pixel, 2^5 = 32 */
> +	.vl_bpix	= 4,	/* Bits per pixel, 2^4 = 16 */
>  
>  	/* s6e8ax0 Panel infomation */
>  	.vl_hspw	= 5,
> diff --git a/board/samsung/trats2/trats2.c b/board/samsung/trats2/trats2.c
> index 73b8cc1..6fa02c9 100644
> --- a/board/samsung/trats2/trats2.c
> +++ b/board/samsung/trats2/trats2.c
> @@ -542,7 +542,7 @@ vidinfo_t panel_info = {
>  	.vl_hsp		= CONFIG_SYS_LOW,
>  	.vl_vsp		= CONFIG_SYS_LOW,
>  	.vl_dp		= CONFIG_SYS_LOW,
> -	.vl_bpix	= 5,	/* Bits per pixel, 2^5 = 32 */
> +	.vl_bpix	= 4,	/* Bits per pixel, 2^4 = 16 */
>  
>  	/* s6e8ax0 Panel infomation */
>  	.vl_hspw	= 5,
> diff --git a/board/samsung/universal_c210/universal.c
> b/board/samsung/universal_c210/universal.c
> index 166d5ee..1ebea0f 100644
> --- a/board/samsung/universal_c210/universal.c
> +++ b/board/samsung/universal_c210/universal.c
> @@ -446,7 +446,7 @@ vidinfo_t panel_info = {
>  	.vl_vsp		= CONFIG_SYS_HIGH,
>  	.vl_dp		= CONFIG_SYS_HIGH,
>  
> -	.vl_bpix	= 5,	/* Bits per pixel */
> +	.vl_bpix	= 4,	/* Bits per pixel */
>  
>  	/* LD9040 LCD Panel */
>  	.vl_hspw	= 2,
> diff --git a/drivers/video/exynos_fimd.c b/drivers/video/exynos_fimd.c
> index f962c4f..847fbe8 100644
> --- a/drivers/video/exynos_fimd.c
> +++ b/drivers/video/exynos_fimd.c
> @@ -73,18 +73,12 @@ static void exynos_fimd_set_par(unsigned int win_id)
>  	/* DATAPATH is DMA */
>  	cfg |= EXYNOS_WINCON_DATAPATH_DMA;
>  
> -	if (pvid->logo_on) /* To get proprietary LOGO */
> -		cfg |= EXYNOS_WINCON_WSWP_ENABLE;
> -	else /* To get output console on LCD */
> -		cfg |= EXYNOS_WINCON_HAWSWP_ENABLE;
> +	cfg |= EXYNOS_WINCON_HAWSWP_ENABLE;
>  
>  	/* dma burst is 16 */
>  	cfg |= EXYNOS_WINCON_BURSTLEN_16WORD;
>  
> -	if (pvid->logo_on) /* To get proprietary LOGO */
> -		cfg |= EXYNOS_WINCON_BPPMODE_24BPP_888;
> -	else /* To get output console on LCD */
> -		cfg |= EXYNOS_WINCON_BPPMODE_16BPP_565;
> +	cfg |= EXYNOS_WINCON_BPPMODE_16BPP_565;
>  

Why does exynos fimd always use 16bpp display mode?
It could be used as other bpp modes in exynos.
How do you use above vl_bpix variable in panel_info structure to check bpp mode?


BR,
Donghwa Lee.

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

* [U-Boot] [PATCH 05/10] lib: tizen: add Tizen 16bpp logo support.
       [not found]   ` <01a201cef56e$6f3e3ac0$4dbab040$@samsung.com>
@ 2013-12-10  7:41     ` Przemyslaw Marczak
  0 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2013-12-10  7:41 UTC (permalink / raw)
  To: u-boot

Hello Hyungwon,


On 12/10/2013 07:09 AM, ??? wrote:
> Dear Marczak,
> 
> Please replace the old tizen logo by the new one.
> If you don't have the new one, I can send you.
> 
> Thank you.
> 
> 
> -----Original Message-----
> From: u-boot-bounces at lists.denx.de [mailto:u-boot-bounces at lists.denx.de] On
> Behalf Of Przemyslaw Marczak
> Sent: Wednesday, December 04, 2013 3:03 AM
> To: u-boot at lists.denx.de
> Cc: Przemyslaw Marczak
> Subject: [U-Boot] [PATCH 05/10] lib: tizen: add Tizen 16bpp logo support.
> 
> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
> ---
> This is big size patch. Please follow link:
> http://www.denx.de/wiki/pub/U-Boot/TooBigPatches/0005-lib-tizen-add-Tizen-
> 16bpp-logo-support.patch
> 
> 
> Best regards,
> Hyungwon Hwang
> 
> 

Do you mean silver logo from tizen.org? Actually I can make some but if
you send me one then it will be faster.
Thank you

-- 
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com

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

* [U-Boot] FW: [PATCH 06/10] video: exynos: fimd: always use 16bpp display mode.
  2013-12-10  5:47     ` [U-Boot] FW: " Donghwa Lee
@ 2013-12-10  8:15       ` Przemyslaw Marczak
  2013-12-10  8:55         ` Ajay kumar
  2013-12-10  9:02         ` [U-Boot] " Donghwa Lee
  0 siblings, 2 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2013-12-10  8:15 UTC (permalink / raw)
  To: u-boot

Hello Donghwa,

On 12/10/2013 06:47 AM, Donghwa Lee wrote:
> Hi,
> 
> On 3 Dec 2013 18:03, Przemyslaw wrote:
>> This change updates exynos board files too.
>> 16 bpp mode is required by LCD console mode.
>>
>> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
>> ---
>>   board/samsung/trats/trats.c              |    2 +-
>>   board/samsung/trats2/trats2.c            |    2 +-
>>   board/samsung/universal_c210/universal.c |    2 +-
>>   drivers/video/exynos_fimd.c              |   10 ++--------
>>   include/configs/s5pc210_universal.h      |    2 +-
>>   include/configs/trats.h                  |    2 +-
>>   include/configs/trats2.h                 |    2 +-
>>   7 files changed, 8 insertions(+), 14 deletions(-)
>>
>> diff --git a/board/samsung/trats/trats.c b/board/samsung/trats/trats.c
>> index ce4b41f..db527c7 100644
>> --- a/board/samsung/trats/trats.c
>> +++ b/board/samsung/trats/trats.c
>> @@ -739,7 +739,7 @@ vidinfo_t panel_info = {
>>   	.vl_hsp		= CONFIG_SYS_LOW,
>>   	.vl_vsp		= CONFIG_SYS_LOW,
>>   	.vl_dp		= CONFIG_SYS_LOW,
>> -	.vl_bpix	= 5,	/* Bits per pixel, 2^5 = 32 */
>> +	.vl_bpix	= 4,	/* Bits per pixel, 2^4 = 16 */
>>   
>>   	/* s6e8ax0 Panel infomation */
>>   	.vl_hspw	= 5,
>> diff --git a/board/samsung/trats2/trats2.c b/board/samsung/trats2/trats2.c
>> index 73b8cc1..6fa02c9 100644
>> --- a/board/samsung/trats2/trats2.c
>> +++ b/board/samsung/trats2/trats2.c
>> @@ -542,7 +542,7 @@ vidinfo_t panel_info = {
>>   	.vl_hsp		= CONFIG_SYS_LOW,
>>   	.vl_vsp		= CONFIG_SYS_LOW,
>>   	.vl_dp		= CONFIG_SYS_LOW,
>> -	.vl_bpix	= 5,	/* Bits per pixel, 2^5 = 32 */
>> +	.vl_bpix	= 4,	/* Bits per pixel, 2^4 = 16 */
>>   
>>   	/* s6e8ax0 Panel infomation */
>>   	.vl_hspw	= 5,
>> diff --git a/board/samsung/universal_c210/universal.c
>> b/board/samsung/universal_c210/universal.c
>> index 166d5ee..1ebea0f 100644
>> --- a/board/samsung/universal_c210/universal.c
>> +++ b/board/samsung/universal_c210/universal.c
>> @@ -446,7 +446,7 @@ vidinfo_t panel_info = {
>>   	.vl_vsp		= CONFIG_SYS_HIGH,
>>   	.vl_dp		= CONFIG_SYS_HIGH,
>>   
>> -	.vl_bpix	= 5,	/* Bits per pixel */
>> +	.vl_bpix	= 4,	/* Bits per pixel */
>>   
>>   	/* LD9040 LCD Panel */
>>   	.vl_hspw	= 2,
>> diff --git a/drivers/video/exynos_fimd.c b/drivers/video/exynos_fimd.c
>> index f962c4f..847fbe8 100644
>> --- a/drivers/video/exynos_fimd.c
>> +++ b/drivers/video/exynos_fimd.c
>> @@ -73,18 +73,12 @@ static void exynos_fimd_set_par(unsigned int win_id)
>>   	/* DATAPATH is DMA */
>>   	cfg |= EXYNOS_WINCON_DATAPATH_DMA;
>>   
>> -	if (pvid->logo_on) /* To get proprietary LOGO */
>> -		cfg |= EXYNOS_WINCON_WSWP_ENABLE;
>> -	else /* To get output console on LCD */
>> -		cfg |= EXYNOS_WINCON_HAWSWP_ENABLE;
>> +	cfg |= EXYNOS_WINCON_HAWSWP_ENABLE;
>>   
>>   	/* dma burst is 16 */
>>   	cfg |= EXYNOS_WINCON_BURSTLEN_16WORD;
>>   
>> -	if (pvid->logo_on) /* To get proprietary LOGO */
>> -		cfg |= EXYNOS_WINCON_BPPMODE_24BPP_888;
>> -	else /* To get output console on LCD */
>> -		cfg |= EXYNOS_WINCON_BPPMODE_16BPP_565;
>> +	cfg |= EXYNOS_WINCON_BPPMODE_16BPP_565;
>>   
> 
> Why does exynos fimd always use 16bpp display mode?

Good question. I switched fimd to 16BPP because of LCD framework which
supports in max 16BPP mode for LCD console. Leaving fimd 32BPP mode and
16BPP console is possible but it causes wrong setup of lcd console row
and columns, it also displays wrong size fonts.

> It could be used as other bpp modes in exynos.
> How do you use above vl_bpix variable in panel_info structure to check bpp mode?

Actually vl_bpix was never used to check BPP mode in fimd driver, it was
only used to set proper memory space. Fimd BPP mode was set by checking
logo_on in panel_info structure.
This is good reason to use vl_bpix in fimd driver to set proper BPP. I
will change this to something like this:

if (pvid->vl_bpix == 4)
	cfg |= EXYNOS_WINCON_BPPMODE_16BPP_565;
else
	cfg |= EXYNOS_WINCON_BPPMODE_24BPP_888;

Do you agree?

> 
> 
> BR,
> Donghwa Lee.
> 

Thank you,
-- 
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com

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

* [U-Boot] FW: [PATCH 06/10] video: exynos: fimd: always use 16bpp display mode.
  2013-12-10  8:15       ` Przemyslaw Marczak
@ 2013-12-10  8:55         ` Ajay kumar
  2013-12-10  9:02         ` [U-Boot] " Donghwa Lee
  1 sibling, 0 replies; 147+ messages in thread
From: Ajay kumar @ 2013-12-10  8:55 UTC (permalink / raw)
  To: u-boot

Hi Marczak,


On Tue, Dec 10, 2013 at 1:45 PM, Przemyslaw Marczak
<p.marczak@samsung.com>wrote:

> Hello Donghwa,
>
> On 12/10/2013 06:47 AM, Donghwa Lee wrote:
> > Hi,
> >
> > On 3 Dec 2013 18:03, Przemyslaw wrote:
> >> This change updates exynos board files too.
> >> 16 bpp mode is required by LCD console mode.
> >>
> >> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
> >> ---
> >>   board/samsung/trats/trats.c              |    2 +-
> >>   board/samsung/trats2/trats2.c            |    2 +-
> >>   board/samsung/universal_c210/universal.c |    2 +-
> >>   drivers/video/exynos_fimd.c              |   10 ++--------
> >>   include/configs/s5pc210_universal.h      |    2 +-
> >>   include/configs/trats.h                  |    2 +-
> >>   include/configs/trats2.h                 |    2 +-
> >>   7 files changed, 8 insertions(+), 14 deletions(-)
> >>
> >> diff --git a/board/samsung/trats/trats.c b/board/samsung/trats/trats.c
> >> index ce4b41f..db527c7 100644
> >> --- a/board/samsung/trats/trats.c
> >> +++ b/board/samsung/trats/trats.c
> >> @@ -739,7 +739,7 @@ vidinfo_t panel_info = {
> >>      .vl_hsp         = CONFIG_SYS_LOW,
> >>      .vl_vsp         = CONFIG_SYS_LOW,
> >>      .vl_dp          = CONFIG_SYS_LOW,
> >> -    .vl_bpix        = 5,    /* Bits per pixel, 2^5 = 32 */
> >> +    .vl_bpix        = 4,    /* Bits per pixel, 2^4 = 16 */
> >>
> >>      /* s6e8ax0 Panel infomation */
> >>      .vl_hspw        = 5,
> >> diff --git a/board/samsung/trats2/trats2.c
> b/board/samsung/trats2/trats2.c
> >> index 73b8cc1..6fa02c9 100644
> >> --- a/board/samsung/trats2/trats2.c
> >> +++ b/board/samsung/trats2/trats2.c
> >> @@ -542,7 +542,7 @@ vidinfo_t panel_info = {
> >>      .vl_hsp         = CONFIG_SYS_LOW,
> >>      .vl_vsp         = CONFIG_SYS_LOW,
> >>      .vl_dp          = CONFIG_SYS_LOW,
> >> -    .vl_bpix        = 5,    /* Bits per pixel, 2^5 = 32 */
> >> +    .vl_bpix        = 4,    /* Bits per pixel, 2^4 = 16 */
> >>
> >>      /* s6e8ax0 Panel infomation */
> >>      .vl_hspw        = 5,
> >> diff --git a/board/samsung/universal_c210/universal.c
> >> b/board/samsung/universal_c210/universal.c
> >> index 166d5ee..1ebea0f 100644
> >> --- a/board/samsung/universal_c210/universal.c
> >> +++ b/board/samsung/universal_c210/universal.c
> >> @@ -446,7 +446,7 @@ vidinfo_t panel_info = {
> >>      .vl_vsp         = CONFIG_SYS_HIGH,
> >>      .vl_dp          = CONFIG_SYS_HIGH,
> >>
> >> -    .vl_bpix        = 5,    /* Bits per pixel */
> >> +    .vl_bpix        = 4,    /* Bits per pixel */
> >>
> >>      /* LD9040 LCD Panel */
> >>      .vl_hspw        = 2,
> >> diff --git a/drivers/video/exynos_fimd.c b/drivers/video/exynos_fimd.c
> >> index f962c4f..847fbe8 100644
> >> --- a/drivers/video/exynos_fimd.c
> >> +++ b/drivers/video/exynos_fimd.c
> >> @@ -73,18 +73,12 @@ static void exynos_fimd_set_par(unsigned int win_id)
> >>      /* DATAPATH is DMA */
> >>      cfg |= EXYNOS_WINCON_DATAPATH_DMA;
> >>
> >> -    if (pvid->logo_on) /* To get proprietary LOGO */
> >> -            cfg |= EXYNOS_WINCON_WSWP_ENABLE;
> >> -    else /* To get output console on LCD */
> >> -            cfg |= EXYNOS_WINCON_HAWSWP_ENABLE;
> >> +    cfg |= EXYNOS_WINCON_HAWSWP_ENABLE;
> >>
>
>>      /* dma burst is 16 */
> >>      cfg |= EXYNOS_WINCON_BURSTLEN_16WORD;
> >>
> >> -    if (pvid->logo_on) /* To get proprietary LOGO */
> >> -            cfg |= EXYNOS_WINCON_BPPMODE_24BPP_888;
> >> -    else /* To get output console on LCD */
> >> -            cfg |= EXYNOS_WINCON_BPPMODE_16BPP_565;
> >> +    cfg |= EXYNOS_WINCON_BPPMODE_16BPP_565;
> >>
> >
> > Why does exynos fimd always use 16bpp display mode?
>
> Good question. I switched fimd to 16BPP because of LCD framework which
> supports in max 16BPP mode for LCD console. Leaving fimd 32BPP mode and
> 16BPP console is possible but it causes wrong setup of lcd console row
> and columns, it also displays wrong size fonts.
>
> > It could be used as other bpp modes in exynos.
> > How do you use above vl_bpix variable in panel_info structure to check
> bpp mode?
>
> Actually vl_bpix was never used to check BPP mode in fimd driver, it was
> only used to set proper memory space. Fimd BPP mode was set by checking
> logo_on in panel_info structure.
> This is good reason to use vl_bpix in fimd driver to set proper BPP. I
> will change this to something like this:
>
> if (pvid->vl_bpix == 4)
>         cfg |= EXYNOS_WINCON_BPPMODE_16BPP_565;
> else
>         cfg |= EXYNOS_WINCON_BPPMODE_24BPP_888;
>
> Do you agree?
>
> This change makes sense.
We should actually be using vl_bpix for the check, and not logo_on.

> >
> >
> > BR,
> > Donghwa Lee.
> >
>
> Thank you,
> --
> Przemyslaw Marczak
> Samsung R&D Institute Poland
> Samsung Electronics
> p.marczak at samsung.com
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>

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

* [U-Boot] [PATCH 06/10] video: exynos: fimd: always use 16bpp display mode.
  2013-12-10  8:15       ` Przemyslaw Marczak
  2013-12-10  8:55         ` Ajay kumar
@ 2013-12-10  9:02         ` Donghwa Lee
  1 sibling, 0 replies; 147+ messages in thread
From: Donghwa Lee @ 2013-12-10  9:02 UTC (permalink / raw)
  To: u-boot

On 10 Dec 2013 17:15, Przemyslaw Marczak wrote:
> Hello Donghwa,
>
> On 12/10/2013 06:47 AM, Donghwa Lee wrote:
>> Hi,
>>
>> On 3 Dec 2013 18:03, Przemyslaw wrote:
>>> This change updates exynos board files too.
>>> 16 bpp mode is required by LCD console mode.
>>>
>>> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
>>> ---
>>>   board/samsung/trats/trats.c              |    2 +-
>>>   board/samsung/trats2/trats2.c            |    2 +-
>>>   board/samsung/universal_c210/universal.c |    2 +-
>>>   drivers/video/exynos_fimd.c              |   10 ++--------
>>>   include/configs/s5pc210_universal.h      |    2 +-
>>>   include/configs/trats.h                  |    2 +-
>>>   include/configs/trats2.h                 |    2 +-
>>>   7 files changed, 8 insertions(+), 14 deletions(-)
>>>
>>> diff --git a/board/samsung/trats/trats.c b/board/samsung/trats/trats.c
>>> index ce4b41f..db527c7 100644
>>> --- a/board/samsung/trats/trats.c
>>> +++ b/board/samsung/trats/trats.c
>>> @@ -739,7 +739,7 @@ vidinfo_t panel_info = {
>>>   	.vl_hsp		= CONFIG_SYS_LOW,
>>>   	.vl_vsp		= CONFIG_SYS_LOW,
>>>   	.vl_dp		= CONFIG_SYS_LOW,
>>> -	.vl_bpix	= 5,	/* Bits per pixel, 2^5 = 32 */
>>> +	.vl_bpix	= 4,	/* Bits per pixel, 2^4 = 16 */
>>>   
>>>   	/* s6e8ax0 Panel infomation */
>>>   	.vl_hspw	= 5,
>>> diff --git a/board/samsung/trats2/trats2.c b/board/samsung/trats2/trats2.c
>>> index 73b8cc1..6fa02c9 100644
>>> --- a/board/samsung/trats2/trats2.c
>>> +++ b/board/samsung/trats2/trats2.c
>>> @@ -542,7 +542,7 @@ vidinfo_t panel_info = {
>>>   	.vl_hsp		= CONFIG_SYS_LOW,
>>>   	.vl_vsp		= CONFIG_SYS_LOW,
>>>   	.vl_dp		= CONFIG_SYS_LOW,
>>> -	.vl_bpix	= 5,	/* Bits per pixel, 2^5 = 32 */
>>> +	.vl_bpix	= 4,	/* Bits per pixel, 2^4 = 16 */
>>>   
>>>   	/* s6e8ax0 Panel infomation */
>>>   	.vl_hspw	= 5,
>>> diff --git a/board/samsung/universal_c210/universal.c
>>> b/board/samsung/universal_c210/universal.c
>>> index 166d5ee..1ebea0f 100644
>>> --- a/board/samsung/universal_c210/universal.c
>>> +++ b/board/samsung/universal_c210/universal.c
>>> @@ -446,7 +446,7 @@ vidinfo_t panel_info = {
>>>   	.vl_vsp		= CONFIG_SYS_HIGH,
>>>   	.vl_dp		= CONFIG_SYS_HIGH,
>>>   
>>> -	.vl_bpix	= 5,	/* Bits per pixel */
>>> +	.vl_bpix	= 4,	/* Bits per pixel */
>>>   
>>>   	/* LD9040 LCD Panel */
>>>   	.vl_hspw	= 2,
>>> diff --git a/drivers/video/exynos_fimd.c b/drivers/video/exynos_fimd.c
>>> index f962c4f..847fbe8 100644
>>> --- a/drivers/video/exynos_fimd.c
>>> +++ b/drivers/video/exynos_fimd.c
>>> @@ -73,18 +73,12 @@ static void exynos_fimd_set_par(unsigned int win_id)
>>>   	/* DATAPATH is DMA */
>>>   	cfg |= EXYNOS_WINCON_DATAPATH_DMA;
>>>   
>>> -	if (pvid->logo_on) /* To get proprietary LOGO */
>>> -		cfg |= EXYNOS_WINCON_WSWP_ENABLE;
>>> -	else /* To get output console on LCD */
>>> -		cfg |= EXYNOS_WINCON_HAWSWP_ENABLE;
>>> +	cfg |= EXYNOS_WINCON_HAWSWP_ENABLE;
>>>   
>>>   	/* dma burst is 16 */
>>>   	cfg |= EXYNOS_WINCON_BURSTLEN_16WORD;
>>>   
>>> -	if (pvid->logo_on) /* To get proprietary LOGO */
>>> -		cfg |= EXYNOS_WINCON_BPPMODE_24BPP_888;
>>> -	else /* To get output console on LCD */
>>> -		cfg |= EXYNOS_WINCON_BPPMODE_16BPP_565;
>>> +	cfg |= EXYNOS_WINCON_BPPMODE_16BPP_565;
>>>   
>> Why does exynos fimd always use 16bpp display mode?
> Good question. I switched fimd to 16BPP because of LCD framework which
> supports in max 16BPP mode for LCD console. Leaving fimd 32BPP mode and
> 16BPP console is possible but it causes wrong setup of lcd console row
> and columns, it also displays wrong size fonts.
>
>> It could be used as other bpp modes in exynos.
>> How do you use above vl_bpix variable in panel_info structure to check bpp mode?
> Actually vl_bpix was never used to check BPP mode in fimd driver, it was
> only used to set proper memory space. Fimd BPP mode was set by checking
> logo_on in panel_info structure.
> This is good reason to use vl_bpix in fimd driver to set proper BPP. I
> will change this to something like this:
>
> if (pvid->vl_bpix == 4)
> 	cfg |= EXYNOS_WINCON_BPPMODE_16BPP_565;
> else
> 	cfg |= EXYNOS_WINCON_BPPMODE_24BPP_888;
>
> Do you agree?

There is many others bpp modes, but in most cases, we usually use 16bpp or 24bpp modes.
To support many bpp modes more than two, it looks good to use 'switch' like below.

switch(pvid->vl_bpix) {
case 0;
...
case 1:
...
...
case 5:
...
}

BR,
Donghwa Lee.

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

* [U-Boot] [PATCH 04/10] samsung: misc: move display logo function to misc.c file.
  2013-12-03 18:03 ` [U-Boot] [PATCH 04/10] samsung: misc: move display logo function to misc.c file Przemyslaw Marczak
@ 2013-12-10  9:47   ` 황형원
  2013-12-11  8:16   ` Minkyu Kang
  1 sibling, 0 replies; 147+ messages in thread
From: 황형원 @ 2013-12-10  9:47 UTC (permalink / raw)
  To: u-boot

I tested this code using TRATS2 board, and it worked well.

-----Original Message-----
From: u-boot-bounces@lists.denx.de [mailto:u-boot-bounces at lists.denx.de] On
Behalf Of Przemyslaw Marczak
Sent: Wednesday, December 04, 2013 3:03 AM
To: u-boot at lists.denx.de
Cc: Przemyslaw Marczak
Subject: [U-Boot] [PATCH 04/10] samsung: misc: move display logo function
to misc.c file.

board/samsung/common/misc.c:
- move draw_logo() function from exynos_fb.c
- add get_tizen_logo_info() function call removed from board files

boards:
- update board files
- add CONFIG_MISC_INIT_R to Universal, Trats and Trats2

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Tested-by: Hyungwon Hwang <human.hwang@samsung.com>
---
 board/samsung/common/misc.c              |   39
++++++++++++++++++++++++++++++
 board/samsung/trats/trats.c              |    3 ---
 board/samsung/trats2/trats2.c            |    4 ---
 board/samsung/universal_c210/universal.c |    4 ---
 drivers/video/exynos_fb.c                |   28 ---------------------
 include/configs/s5pc210_universal.h      |    3 +++
 include/configs/trats.h                  |    3 +++
 include/configs/trats2.h                 |    3 +++
 8 files changed, 48 insertions(+), 39 deletions(-)

diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
index 465895b..fa97644 100644
--- a/board/samsung/common/misc.c
+++ b/board/samsung/common/misc.c
@@ -6,11 +6,50 @@
  */
 
 #include <common.h>
+#include <lcd.h>
+#include <libtizen.h>
+
+#ifdef CONFIG_MISC_INIT_R
+#ifdef CONFIG_CMD_BMP
+static void draw_logo(void)
+{
+	int x, y;
+	ulong addr;
+
+#ifdef CONFIG_TIZEN
+	get_tizen_logo_info(&panel_info);
+#else
+	return;
+#endif
+
+	if (panel_info.vl_width >= panel_info.logo_width) {
+		x = ((panel_info.vl_width - panel_info.logo_width) >> 1);
+	} else {
+		x = 0;
+		printf("Warning: image width is bigger than display
width\n");
+	}
+
+	if (panel_info.vl_height >= panel_info.logo_height) {
+		y = ((panel_info.vl_height - panel_info.logo_height) >> 1);
+	} else {
+		y = 0;
+		printf("Warning: image height is bigger than display
height\n");
+	}
+
+	addr = panel_info.logo_addr;
+	bmp_display(addr, x, y);
+}
+#endif /* CONFIG_CMD_BMP */
+#endif /* CONFIG_MISC_INIT_R */
 
 #ifdef CONFIG_MISC_INIT_R
 /* Common for Samsung boards */
 int misc_init_r(void)
 {
+#ifdef CONFIG_CMD_BMP
+	if (panel_info.logo_on)
+		draw_logo();
+#endif
 	return 0;
 }
 #endif /* CONFIG_MISC_INIT_R */
diff --git a/board/samsung/trats/trats.c b/board/samsung/trats/trats.c
index 6bd106e..ce4b41f 100644
--- a/board/samsung/trats/trats.c
+++ b/board/samsung/trats/trats.c
@@ -767,9 +767,6 @@ void init_panel_info(vidinfo_t *vid)
 	vid->resolution	= HD_RESOLUTION,
 	vid->rgb_mode	= MODE_RGB_P,
 
-#ifdef CONFIG_TIZEN
-	get_tizen_logo_info(vid);
-#endif
 	mipi_lcd_device.reverse_panel = 1;
 
 	strcpy(s6e8ax0_platform_data.lcd_panel_name, mipi_lcd_device.name);
diff --git a/board/samsung/trats2/trats2.c b/board/samsung/trats2/trats2.c
index 2442d96..73b8cc1 100644
--- a/board/samsung/trats2/trats2.c
+++ b/board/samsung/trats2/trats2.c
@@ -573,10 +573,6 @@ void init_panel_info(vidinfo_t *vid)
 
 	mipi_lcd_device.reverse_panel = 1;
 
-#ifdef CONFIG_TIZEN
-	get_tizen_logo_info(vid);
-#endif
-
 	strcpy(dsim_platform_data.lcd_panel_name, mipi_lcd_device.name);
 	dsim_platform_data.mipi_power = mipi_power;
 	dsim_platform_data.phy_enable = set_mipi_phy_ctrl; diff --git
a/board/samsung/universal_c210/universal.c
b/board/samsung/universal_c210/universal.c
index 54d0e1e..166d5ee 100644
--- a/board/samsung/universal_c210/universal.c
+++ b/board/samsung/universal_c210/universal.c
@@ -484,10 +484,6 @@ void init_panel_info(vidinfo_t *vid)
 	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;
diff --git a/drivers/video/exynos_fb.c b/drivers/video/exynos_fb.c index
7d4c6e0..00a0a11 100644
--- a/drivers/video/exynos_fb.c
+++ b/drivers/video/exynos_fb.c
@@ -62,31 +62,6 @@ static void exynos_lcd_init(vidinfo_t *vid)
 	lcd_set_flush_dcache(1);
 }
 
-#ifdef CONFIG_CMD_BMP
-static void draw_logo(void)
-{
-	int x, y;
-	ulong addr;
-
-	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);
-}
-#endif
-
 void __exynos_cfg_lcd_gpio(void)
 {
 }
@@ -323,9 +298,6 @@ void lcd_enable(void)
 	if (panel_info.logo_on) {
 		memset((void *) gd->fb_base, 0, panel_width * panel_height *
 				(NBITS(panel_info.vl_bpix) >> 3));
-#ifdef CONFIG_CMD_BMP
-		draw_logo();
-#endif
 	}
 
 	lcd_panel_on(&panel_info);
diff --git a/include/configs/s5pc210_universal.h
b/include/configs/s5pc210_universal.h
index 02a1c99..47f0e85 100644
--- a/include/configs/s5pc210_universal.h
+++ b/include/configs/s5pc210_universal.h
@@ -269,6 +269,9 @@ void universal_spi_sda(int bit);  int
universal_spi_read(void);  #endif
 
+/* Common misc for Samsung */
+#define CONFIG_MISC_INIT_R	1
+
 /*
  * LCD Settings
  */
diff --git a/include/configs/trats.h b/include/configs/trats.h index
2b07fe0..806f6fe 100644
--- a/include/configs/trats.h
+++ b/include/configs/trats.h
@@ -310,6 +310,9 @@
 #define CONFIG_USB_GADGET_VBUS_DRAW	2
 #define CONFIG_USB_CABLE_CHECK
 
+/* Common misc for Samsung */
+#define CONFIG_MISC_INIT_R	1
+
 /* LCD */
 #define CONFIG_EXYNOS_FB
 #define CONFIG_LCD
diff --git a/include/configs/trats2.h b/include/configs/trats2.h index
18270c1..91821b4 100644
--- a/include/configs/trats2.h
+++ b/include/configs/trats2.h
@@ -316,6 +316,9 @@
 #define CONFIG_USB_GADGET_VBUS_DRAW	2
 #define CONFIG_USB_CABLE_CHECK
 
+/* Common misc for Samsung */
+#define CONFIG_MISC_INIT_R	1
+
 /* LCD */
 #define CONFIG_EXYNOS_FB
 #define CONFIG_LCD
--
1.7.9.5

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

---
Hyungwon Hwang
Samsung SWC S/W Platform Team
Smasung Electronics
human.hwang at samsung.com

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

* [U-Boot] [PATCH 08/10] Trats: add LCD download menu support
  2013-12-03 18:03 ` [U-Boot] [PATCH 08/10] Trats: add LCD download menu support Przemyslaw Marczak
  2013-12-04  6:08   ` Lukasz Majewski
@ 2013-12-11  8:15   ` Minkyu Kang
  2013-12-11 13:32     ` Przemyslaw Marczak
  1 sibling, 1 reply; 147+ messages in thread
From: Minkyu Kang @ 2013-12-11  8:15 UTC (permalink / raw)
  To: u-boot

On 04/12/13 03:03, Przemyslaw Marczak wrote:
> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
> Cc: Lukasz Majewski <l.majewski@samsung.com>
> ---
>  include/configs/trats.h |   10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/include/configs/trats.h b/include/configs/trats.h
> index 9738a00..d3bed99 100644
> --- a/include/configs/trats.h
> +++ b/include/configs/trats.h
> @@ -19,6 +19,7 @@
>  #define CONFIG_EXYNOS4210	/* which is in a EXYNOS4210 */
>  #define CONFIG_TRATS		/* working with TRATS */
>  #define CONFIG_TIZEN		/* TIZEN lib */
> +#define CONFIG_BOARD_NAME	"TRATS"
>  
>  #include <asm/arch/cpu.h>	/* get chip and board defs */
>  
> @@ -313,6 +314,15 @@
>  /* Common misc for Samsung */
>  #define CONFIG_MISC_INIT_R	1
>  
> +/* Download menu - Samsung common */
> +#define CONFIG_LCD_MENU			1
> +#define CONFIG_LCD_MENU_BOARD		1
> +
> +/* LCD console */
> +#define LCD_BPP			LCD_COLOR16
> +#undef  LCD_TEST_PATTERN

Where is this define?

> +#define CONFIG_SYS_WHITE_ON_BLACK	1
> +
>  /* LCD */
>  #define CONFIG_EXYNOS_FB
>  #define CONFIG_LCD
> 

Thanks,
Minkyu Kang.

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

* [U-Boot] [PATCH 07/10] samsung: misc: Add LCD download menu.
  2013-12-03 18:03 ` [U-Boot] [PATCH 07/10] samsung: misc: Add LCD download menu Przemyslaw Marczak
@ 2013-12-11  8:15   ` Minkyu Kang
  2013-12-11 12:38     ` Przemyslaw Marczak
  0 siblings, 1 reply; 147+ messages in thread
From: Minkyu Kang @ 2013-12-11  8:15 UTC (permalink / raw)
  To: u-boot

Dear Przemyslaw Marczak,

On 04/12/13 03:03, Przemyslaw Marczak wrote:
> New configs:
> - CONFIG_LCD_MENU
> - CONFIG_LCD_MENU_BOARD
> which depends on: CONFIG_MISC_INIT_R
> 
> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
> ---
>  board/samsung/common/keys.h |   78 ++++++++++
>  board/samsung/common/misc.c |  354 +++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 432 insertions(+)
>  create mode 100644 board/samsung/common/keys.h
> 
> diff --git a/board/samsung/common/keys.h b/board/samsung/common/keys.h
> new file mode 100644
> index 0000000..48822d1
> --- /dev/null
> +++ b/board/samsung/common/keys.h
> @@ -0,0 +1,78 @@
> +/*
> + * Copyright (C) 2013 Samsung Electronics
> + *
> + * SPDX-License-Identifier:	GPL-2.0+
> + */
> +#ifndef __SAMSUNG_KEYS__
> +#define __SAMSUNG_KEYS__
> +
> +#ifndef __ASSEMBLY__
> +
> +#include <config.h>
> +#include <common.h>
> +#include <power/pmic.h>
> +#include <asm/arch/gpio.h>
> +
> +/* PMIC PWR ON key */
> +#if defined(CONFIG_MACH_GONI) || defined(CONFIG_UNIVERSAL)
> +
> +#include <power/max8998_pmic.h>
> +
> +#define KEY_PWR_PMIC_NAME		"MAX8998_PMIC"
> +
> +#define KEY_PWR_STATUS_REG		MAX8998_REG_STATUS1
> +#define KEY_PWR_STATUS_MASK		(1 << 7)
> +
> +#define KEY_PWR_INTERRUPT_REG		MAX8998_REG_IRQ1
> +#define KEY_PWR_INTERRUPT_MASK		(1 << 7)
> +
> +#elif defined(CONFIG_TRATS)
> +
> +#include <power/max8997_pmic.h>
> +
> +#define KEY_PWR_PMIC_NAME		"MAX8997_PMIC"
> +
> +#define KEY_PWR_STATUS_REG		MAX8997_REG_STATUS1
> +#define KEY_PWR_STATUS_MASK		(1 << 0)
> +
> +#define KEY_PWR_INTERRUPT_REG		MAX8997_REG_INT1
> +#define KEY_PWR_INTERRUPT_MASK		(1 << 0)
> +
> +#elif defined(CONFIG_TRATS2)
> +
> +#include <power/max77686_pmic.h>
> +
> +#define KEY_PWR_PMIC_NAME		"MAX77686_PMIC"
> +
> +#define KEY_PWR_STATUS_REG		MAX77686_REG_PMIC_STATUS1
> +#define KEY_PWR_STATUS_MASK		(1 << 0)
> +
> +#define KEY_PWR_INTERRUPT_REG		MAX77686_REG_PMIC_INT1
> +#define KEY_PWR_INTERRUPT_MASK		(1 << 1)
> +
> +#endif /* PMIC PWR ON key */

Hm no. it's a board specific feature so it should be go to each boards.
Maybe we need some.. framework?

> +
> +/* GPIO for Vol Up and Vol Down */
> +#if defined(CONFIG_MACH_GONI)
> +
> +#define KEY_VOL_UP_GPIO			s5pc110_gpio_get(h3, 1)
> +#define KEY_VOL_DOWN_GPIO		s5pc110_gpio_get(h3, 2)
> +
> +#elif defined(CONFIG_UNIVERSAL) || defined(CONFIG_TRATS)
> +
> +#define KEY_VOL_UP_GPIO			exynos4_gpio_get(2, x2, 0)
> +#define KEY_VOL_DOWN_GPIO		exynos4_gpio_get(2, x2, 1)
> +
> +#elif defined(CONFIG_TRATS2)
> +
> +#define KEY_VOL_UP_GPIO			exynos4x12_gpio_get(2, x2, 2)
> +#define KEY_VOL_DOWN_GPIO		exynos4x12_gpio_get(2, x3, 3)
> +
> +#else
> +#ifdef CONFIG_MISC_INIT_R
> +#warning Vol UP and Vol DOWN GPIO are undefined!
> +#endif
> +#endif /* GPIO for Vol Up and Vol Down */

ditto.
Will you add ifdef when you add new boards?
It doesn't make sense.

> +
> +#endif /* __ASSEMBLY__ */
> +#endif /* __SAMSUNG_KEYS__ */
> diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
> index fa97644..c792b87 100644
> --- a/board/samsung/common/misc.c
> +++ b/board/samsung/common/misc.c
> @@ -8,8 +8,357 @@
>  #include <common.h>
>  #include <lcd.h>
>  #include <libtizen.h>
> +#include <errno.h>
> +#include <version.h>
> +#include <asm/sizes.h>
> +#include <asm/arch/cpu.h>
> +#include <asm/arch/gpio.h>
> +#include <asm/gpio.h>
> +#include <linux/input.h>
> +#include <lcd.h>
> +#include <libtizen.h>
> +#include <mmc.h>
> +#include "keys.h"
>  
>  #ifdef CONFIG_MISC_INIT_R
> +struct s5p_gpio_bank *s5p_gpio_get_bank(unsigned);
> +int s5p_gpio_get_pin(unsigned);
> +#ifdef CONFIG_REVISION_TAG
> +u32 get_board_rev(void);
> +#endif
> +
> +#ifdef CONFIG_LCD_MENU
> +enum {
> +	BOOT_MODE_INFO,
> +	BOOT_MODE_THOR,
> +	BOOT_MODE_UMS,
> +	BOOT_MODE_DFU,
> +	BOOT_MODE_EXIT,
> +};
> +
> +static int power_key_pressed(int reg)
> +{
> +	struct pmic *pmic = pmic_get(KEY_PWR_PMIC_NAME);
> +	u32 status = 0;
> +	u32 mask;
> +
> +	if (pmic_probe(pmic))
> +		return 0;
> +
> +	if (!pmic) {
> +		printf("%s: Not found\n", KEY_PWR_PMIC_NAME);
> +		return -ENODEV;
> +	}
> +
> +	if (reg == KEY_PWR_STATUS_REG)
> +		mask = KEY_PWR_STATUS_MASK;
> +	else
> +		mask = KEY_PWR_INTERRUPT_MASK;
> +
> +	if (pmic_reg_read(pmic, reg, &status))
> +		return -EIO;
> +
> +	return !!(status & mask);
> +}
> +
> +static int key_pressed(int key)
> +{
> +	int value = 0;
> +
> +	switch (key) {
> +	case KEY_POWER:
> +		value = power_key_pressed(KEY_PWR_INTERRUPT_REG);
> +		break;
> +	case KEY_VOLUMEUP:
> +		value = !gpio_get_value(KEY_VOL_UP_GPIO);
> +		break;
> +	case KEY_VOLUMEDOWN:
> +		value = !gpio_get_value(KEY_VOL_DOWN_GPIO);
> +		break;
> +	default:
> +		break;
> +	}
> +
> +	return value;
> +}
> +
> +static int check_keys(void)
> +{
> +	int keys = 0;
> +
> +	if (key_pressed(KEY_POWER))
> +		keys += KEY_POWER;
> +	if (key_pressed(KEY_VOLUMEUP))
> +		keys += KEY_VOLUMEUP;
> +	if (key_pressed(KEY_VOLUMEDOWN))
> +		keys += KEY_VOLUMEDOWN;
> +
> +	return keys;
> +}
> +
> +DECLARE_GLOBAL_DATA_PTR;

please move it to top of this file.

> +
> +/*
> + * 0 BOOT_MODE_INFO
> + * 1 BOOT_MODE_THOR
> + * 2 BOOT_MODE_UMS
> + * 3 BOOT_MODE_DFU
> + * 4 BOOT_MODE_EXIT
> +*/
> +static char *
> +mode_name[BOOT_MODE_EXIT + 1] = {"DEVICE",
> +				"THOR",
> +				"UMS",
> +				"DFU",
> +				"EXIT"};
> +
> +static char *
> +mode_info[BOOT_MODE_EXIT + 1] = {"info",
> +				 "downloader",
> +				 "mass storage",
> +				 "firmware update",
> +				 "and run normal boot"};
> +
> +static char *
> +mode_cmd[BOOT_MODE_EXIT + 1] = {"",
> +				"thor 0 mmc 0",
> +				"ums 0 mmc 0",
> +				"dfu 0 mmc 0",
> +				""};
> +
> +static void display_board_info(void)
> +{
> +	struct mmc *mmc = find_mmc_device(0);
> +	vidinfo_t *vid = &panel_info;
> +
> +	lcd_position_cursor(4, 4);
> +
> +	lcd_printf("%s\n\t", U_BOOT_VERSION);
> +	lcd_puts("\n\t\tBoard Info:\n");
> +#ifdef CONFIG_BOARD_NAME
> +	lcd_printf("\tBoard name: %s\n", CONFIG_BOARD_NAME);
> +#endif
> +#ifdef CONFIG_REVISION_TAG
> +	lcd_printf("\tBoard rev: %u\n", get_board_rev());
> +#endif
> +	lcd_printf("\tDRAM banks: %u\n", CONFIG_NR_DRAM_BANKS);
> +	lcd_printf("\tDRAM size: %u MB\n", gd->ram_size / SZ_1M);
> +
> +	if (mmc)
> +		lcd_printf("\teMMC size: %llu MB\n", mmc->capacity / SZ_1M);
> +
> +	if (vid)
> +		lcd_printf("\tDisplay resolution: %u x % u\n",
> +			   vid->vl_col, vid->vl_row);
> +
> +	lcd_printf("\tDisplay BPP: %u\n", 1 << vid->vl_bpix);
> +}
> +
> +static int mode_leave_menu(int mode)
> +{
> +	int mode_supported = 1;
> +	int leave = 0;
> +	char *exit_option;
> +	char *exit_boot = "boot";
> +	char *exit_back = "back";
> +
> +	switch (mode) {
> +	case BOOT_MODE_INFO:
> +#if !defined(CONFIG_LCD_MENU_BOARD)
> +		mode_supported = 0;
> +#endif
> +		break;
> +	case BOOT_MODE_THOR:
> +#if !defined(CONFIG_CMD_THOR_DOWNLOAD)
> +		mode_supported = 0;
> +#endif
> +		break;
> +	case BOOT_MODE_UMS:
> +#if !defined(CONFIG_CMD_USB_MASS_STORAGE)
> +		mode_supported = 0;
> +#endif
> +		break;
> +	case BOOT_MODE_DFU:
> +#if !defined(CONFIG_CMD_DFU)
> +		mode_supported = 0;
> +#endif
> +		break;
> +	case BOOT_MODE_EXIT:
> +		leave = 1;
> +		goto exit;
> +	default:
> +		break;
> +	}
> +
> +	lcd_clear();
> +
> +	if (mode_supported) {
> +		if (mode) {
> +			lcd_printf("\n\n\t%s %s\n", mode_name[mode],
> +						    mode_info[mode]);
> +			lcd_puts("\n\tDo not turn off device before finish!\n");
> +
> +			run_command(mode_cmd[mode], 0);
> +			printf("Command finished\n");
> +			lcd_clear();
> +			lcd_printf("\n\n\t%s finished\n", mode_name[mode]);
> +			exit_option = exit_boot;
> +			leave = 1;
> +		} else {
> +			display_board_info();
> +			exit_option = exit_back;
> +			leave = 0;
> +		}
> +	} else {
> +		lcd_puts("\n\n\tThis mode is not supported.\n");
> +		exit_option = exit_back;
> +		leave = 0;
> +	}
> +
> +	lcd_printf("\n\n\tPress POWER KEY to %s\n", exit_option);
> +
> +	/* Wait for PWR key */
> +	while (!key_pressed(KEY_POWER))
> +		udelay(1000);
> +exit:
> +	lcd_clear();
> +	return leave;
> +}
> +
> +static void display_download_menu(int mode)
> +{
> +	char *menu_name = "Download Mode Menu";
> +	char *indicator = "[=>]";
> +	char *blank = "[  ]";
> +	char *selection[BOOT_MODE_EXIT + 1];
> +	int i;
> +
> +	for (i = 0; i <= BOOT_MODE_EXIT; i++)
> +			selection[i] = blank;

indentation error.

> +
> +	selection[mode] = indicator;
> +
> +	lcd_clear();
> +	lcd_printf("\n\t\t%s\n", menu_name);
> +
> +	for (i = 0; i <= BOOT_MODE_EXIT; i++)
> +		lcd_printf("\t%s  %s - %s\n\n", selection[i],
> +						mode_name[i],
> +						mode_info[i]);
> +}
> +
> +void download_menu(void)
> +{
> +	int mode = 0;
> +	int last_mode = 0;
> +	int run;
> +	int key;
> +	int menu_exit = 0;
> +
> +	display_download_menu(mode);
> +
> +	while (1) {
> +		run = 0;
> +		menu_exit = 0;
> +
> +		if (mode != last_mode)
> +			display_download_menu(mode);
> +
> +		last_mode = mode;
> +		udelay(100000);
> +
> +		key = check_keys();

as your implementation of check_keys function.
you never catch if we pressed multi keys.
What is the expected result of such a situation?

> +		switch (key) {
> +		case KEY_POWER:
> +			run = 1;
> +			break;
> +		case KEY_VOLUMEUP:
> +			if (mode > 0)
> +				mode--;
> +			break;
> +		case KEY_VOLUMEDOWN:
> +			if (mode < BOOT_MODE_EXIT)
> +				mode++;
> +			break;
> +		default:
> +			break;
> +		}
> +
> +		if (run) {
> +			if (mode_leave_menu(mode))
> +				break;
> +
> +			display_download_menu(mode);
> +		}
> +	}
> +
> +	lcd_clear();
> +}
> +
> +static void display_mode_info(void)
> +{
> +	lcd_position_cursor(4, 4);
> +	lcd_printf("%s\n", U_BOOT_VERSION);
> +	lcd_puts("\nDownload Mode Menu\n");
> +#ifdef CONFIG_BOARD_NAME
> +	lcd_printf("Board name: %s\n", CONFIG_BOARD_NAME);
> +#endif
> +	lcd_printf("Press POWER KEY to display MENU options.");
> +}
> +
> +static int boot_menu(void)
> +{
> +	int key = 0;
> +	int timeout = 10;
> +
> +	display_mode_info();
> +
> +	while (timeout--) {
> +		lcd_printf("\rNormal boot will start in: %d seconds.", timeout);
> +		udelay(1000000);
> +
> +		key = key_pressed(KEY_POWER);
> +		if (key)
> +			break;
> +	}
> +
> +	lcd_clear();
> +
> +	/* If PWR pressed - show download menu */
> +	if (key) {
> +		printf("Power pressed - go to download menu\n");
> +		udelay(1000000);
> +		download_menu();
> +		printf("Download mode exit.\n");
> +	}
> +
> +	return 0;
> +}
> +
> +static void check_boot_mode(void)
> +{
> +	int pwr_key;
> +
> +	pwr_key = power_key_pressed(KEY_PWR_STATUS_REG);
> +	if (pwr_key) {

if (!pwr_key) then return;

> +		/* Clear PWR button Rising edge interrupt status flag */
> +		power_key_pressed(KEY_PWR_INTERRUPT_REG);
> +
> +		if (key_pressed(KEY_VOLUMEUP))
> +			boot_menu();
> +		else if (key_pressed(KEY_VOLUMEDOWN))
> +			mode_leave_menu(BOOT_MODE_THOR);
> +	}
> +}
> +
> +static void keys_init(void)
> +{
> +	/* Set direction to input */
> +	gpio_direction_input(KEY_VOL_UP_GPIO);
> +	gpio_direction_input(KEY_VOL_DOWN_GPIO);
> +}
> +#endif /* CONFIG_LCD_MENU */
> +
>  #ifdef CONFIG_CMD_BMP
>  static void draw_logo(void)
>  {
> @@ -46,10 +395,15 @@ static void draw_logo(void)
>  /* Common for Samsung boards */
>  int misc_init_r(void)
>  {
> +#ifdef CONFIG_LCD_MENU
> +	keys_init();
> +	check_boot_mode();
> +#endif
>  #ifdef CONFIG_CMD_BMP
>  	if (panel_info.logo_on)
>  		draw_logo();
>  #endif
> +
>  	return 0;
>  }
>  #endif /* CONFIG_MISC_INIT_R */
> 

Thanks,
Minkyu Kang.

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

* [U-Boot] [PATCH 04/10] samsung: misc: move display logo function to misc.c file.
  2013-12-03 18:03 ` [U-Boot] [PATCH 04/10] samsung: misc: move display logo function to misc.c file Przemyslaw Marczak
  2013-12-10  9:47   ` 황형원
@ 2013-12-11  8:16   ` Minkyu Kang
  1 sibling, 0 replies; 147+ messages in thread
From: Minkyu Kang @ 2013-12-11  8:16 UTC (permalink / raw)
  To: u-boot

On 04/12/13 03:03, Przemyslaw Marczak wrote:
> board/samsung/common/misc.c:
> - move draw_logo() function from exynos_fb.c
> - add get_tizen_logo_info() function call removed from board files
> 
> boards:
> - update board files
> - add CONFIG_MISC_INIT_R to Universal, Trats and Trats2
> 
> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
> ---
>  board/samsung/common/misc.c              |   39 ++++++++++++++++++++++++++++++
>  board/samsung/trats/trats.c              |    3 ---
>  board/samsung/trats2/trats2.c            |    4 ---
>  board/samsung/universal_c210/universal.c |    4 ---
>  drivers/video/exynos_fb.c                |   28 ---------------------
>  include/configs/s5pc210_universal.h      |    3 +++
>  include/configs/trats.h                  |    3 +++
>  include/configs/trats2.h                 |    3 +++
>  8 files changed, 48 insertions(+), 39 deletions(-)
> 
> diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
> index 465895b..fa97644 100644
> --- a/board/samsung/common/misc.c
> +++ b/board/samsung/common/misc.c
> @@ -6,11 +6,50 @@
>   */
>  
>  #include <common.h>
> +#include <lcd.h>
> +#include <libtizen.h>
> +
> +#ifdef CONFIG_MISC_INIT_R
> +#ifdef CONFIG_CMD_BMP
> +static void draw_logo(void)
> +{
> +	int x, y;
> +	ulong addr;
> +
> +#ifdef CONFIG_TIZEN
> +	get_tizen_logo_info(&panel_info);
> +#else
> +	return;
> +#endif
> +
> +	if (panel_info.vl_width >= panel_info.logo_width) {
> +		x = ((panel_info.vl_width - panel_info.logo_width) >> 1);
> +	} else {
> +		x = 0;
> +		printf("Warning: image width is bigger than display width\n");
> +	}
> +
> +	if (panel_info.vl_height >= panel_info.logo_height) {
> +		y = ((panel_info.vl_height - panel_info.logo_height) >> 1);
> +	} else {
> +		y = 0;
> +		printf("Warning: image height is bigger than display height\n");
> +	}
> +
> +	addr = panel_info.logo_addr;
> +	bmp_display(addr, x, y);
> +}
> +#endif /* CONFIG_CMD_BMP */
> +#endif /* CONFIG_MISC_INIT_R */
>  
>  #ifdef CONFIG_MISC_INIT_R
>  /* Common for Samsung boards */
>  int misc_init_r(void)
>  {
> +#ifdef CONFIG_CMD_BMP
> +	if (panel_info.logo_on)
> +		draw_logo();
> +#endif
>  	return 0;
>  }
>  #endif /* CONFIG_MISC_INIT_R */
> diff --git a/board/samsung/trats/trats.c b/board/samsung/trats/trats.c
> index 6bd106e..ce4b41f 100644
> --- a/board/samsung/trats/trats.c
> +++ b/board/samsung/trats/trats.c
> @@ -767,9 +767,6 @@ void init_panel_info(vidinfo_t *vid)
>  	vid->resolution	= HD_RESOLUTION,
>  	vid->rgb_mode	= MODE_RGB_P,
>  
> -#ifdef CONFIG_TIZEN
> -	get_tizen_logo_info(vid);
> -#endif
>  	mipi_lcd_device.reverse_panel = 1;
>  
>  	strcpy(s6e8ax0_platform_data.lcd_panel_name, mipi_lcd_device.name);
> diff --git a/board/samsung/trats2/trats2.c b/board/samsung/trats2/trats2.c
> index 2442d96..73b8cc1 100644
> --- a/board/samsung/trats2/trats2.c
> +++ b/board/samsung/trats2/trats2.c
> @@ -573,10 +573,6 @@ void init_panel_info(vidinfo_t *vid)
>  
>  	mipi_lcd_device.reverse_panel = 1;
>  
> -#ifdef CONFIG_TIZEN
> -	get_tizen_logo_info(vid);
> -#endif
> -
>  	strcpy(dsim_platform_data.lcd_panel_name, mipi_lcd_device.name);
>  	dsim_platform_data.mipi_power = mipi_power;
>  	dsim_platform_data.phy_enable = set_mipi_phy_ctrl;
> diff --git a/board/samsung/universal_c210/universal.c b/board/samsung/universal_c210/universal.c
> index 54d0e1e..166d5ee 100644
> --- a/board/samsung/universal_c210/universal.c
> +++ b/board/samsung/universal_c210/universal.c
> @@ -484,10 +484,6 @@ void init_panel_info(vidinfo_t *vid)
>  	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;
> diff --git a/drivers/video/exynos_fb.c b/drivers/video/exynos_fb.c
> index 7d4c6e0..00a0a11 100644
> --- a/drivers/video/exynos_fb.c
> +++ b/drivers/video/exynos_fb.c
> @@ -62,31 +62,6 @@ static void exynos_lcd_init(vidinfo_t *vid)
>  	lcd_set_flush_dcache(1);
>  }
>  
> -#ifdef CONFIG_CMD_BMP
> -static void draw_logo(void)
> -{
> -	int x, y;
> -	ulong addr;
> -
> -	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);
> -}
> -#endif
> -
>  void __exynos_cfg_lcd_gpio(void)
>  {
>  }
> @@ -323,9 +298,6 @@ void lcd_enable(void)
>  	if (panel_info.logo_on) {
>  		memset((void *) gd->fb_base, 0, panel_width * panel_height *
>  				(NBITS(panel_info.vl_bpix) >> 3));
> -#ifdef CONFIG_CMD_BMP
> -		draw_logo();
> -#endif
>  	}
>  
>  	lcd_panel_on(&panel_info);
> diff --git a/include/configs/s5pc210_universal.h b/include/configs/s5pc210_universal.h
> index 02a1c99..47f0e85 100644
> --- a/include/configs/s5pc210_universal.h
> +++ b/include/configs/s5pc210_universal.h
> @@ -269,6 +269,9 @@ void universal_spi_sda(int bit);
>  int universal_spi_read(void);
>  #endif
>  
> +/* Common misc for Samsung */
> +#define CONFIG_MISC_INIT_R	1

"1" doesn't need.
just define it.
#define CONFIG_MISC_INIT_R

please fix it at your patchset globally.

> +
>  /*
>   * LCD Settings
>   */
> diff --git a/include/configs/trats.h b/include/configs/trats.h
> index 2b07fe0..806f6fe 100644
> --- a/include/configs/trats.h
> +++ b/include/configs/trats.h
> @@ -310,6 +310,9 @@
>  #define CONFIG_USB_GADGET_VBUS_DRAW	2
>  #define CONFIG_USB_CABLE_CHECK
>  
> +/* Common misc for Samsung */
> +#define CONFIG_MISC_INIT_R	1
> +
>  /* LCD */
>  #define CONFIG_EXYNOS_FB
>  #define CONFIG_LCD
> diff --git a/include/configs/trats2.h b/include/configs/trats2.h
> index 18270c1..91821b4 100644
> --- a/include/configs/trats2.h
> +++ b/include/configs/trats2.h
> @@ -316,6 +316,9 @@
>  #define CONFIG_USB_GADGET_VBUS_DRAW	2
>  #define CONFIG_USB_CABLE_CHECK
>  
> +/* Common misc for Samsung */
> +#define CONFIG_MISC_INIT_R	1
> +
>  /* LCD */
>  #define CONFIG_EXYNOS_FB
>  #define CONFIG_LCD
> 

Thanks,
Minkyu Kang.

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

* [U-Boot] [PATCH 03/10] samsung: common: Add misc file and common function misc_init_r().
  2013-12-03 18:03 ` [U-Boot] [PATCH 03/10] samsung: common: Add misc file and common function misc_init_r() Przemyslaw Marczak
@ 2013-12-11  8:16   ` Minkyu Kang
  2013-12-11 10:00     ` Przemyslaw Marczak
  0 siblings, 1 reply; 147+ messages in thread
From: Minkyu Kang @ 2013-12-11  8:16 UTC (permalink / raw)
  To: u-boot

On 04/12/13 03:03, Przemyslaw Marczak wrote:
> Config options:
> - CONFIG_SAMSUNG - misc.c
> - CONFIG_MISC_INIT_R - function misc_init_r();
> 
> New file:
> - board/samsung/common/misc.c
> 
> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
> ---
>  board/samsung/common/Makefile |    1 +
>  board/samsung/common/misc.c   |   16 ++++++++++++++++
>  2 files changed, 17 insertions(+)
>  create mode 100644 board/samsung/common/misc.c
> 
> diff --git a/board/samsung/common/Makefile b/board/samsung/common/Makefile
> index 501d974..d1eb63f 100644
> --- a/board/samsung/common/Makefile
> +++ b/board/samsung/common/Makefile
> @@ -8,3 +8,4 @@
>  obj-$(CONFIG_SOFT_I2C_MULTI_BUS) += multi_i2c.o
>  obj-$(CONFIG_THOR_FUNCTION) += thor.o
>  obj-$(CONFIG_CMD_USB_MASS_STORAGE) += ums.o
> +obj-$(CONFIG_SAMSUNG) += misc.o

Why CONFIG_SAMSUNG?
We know this Makefile is for samsung boards.

> diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
> new file mode 100644
> index 0000000..465895b
> --- /dev/null
> +++ b/board/samsung/common/misc.c
> @@ -0,0 +1,16 @@
> +/*
> + * Copyright (C) 2013 Samsung Electronics
> + * Przemyslaw Marczak <p.marczak@samsung.com>
> + *
> + * SPDX-License-Identifier:	GPL-2.0+
> + */
> +
> +#include <common.h>
> +
> +#ifdef CONFIG_MISC_INIT_R
> +/* Common for Samsung boards */
> +int misc_init_r(void)
> +{
> +	return 0;
> +}
> +#endif /* CONFIG_MISC_INIT_R */
> 

Thanks,
Minkyu Kang.

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

* [U-Boot] [PATCH 03/10] samsung: common: Add misc file and common function misc_init_r().
  2013-12-11  8:16   ` Minkyu Kang
@ 2013-12-11 10:00     ` Przemyslaw Marczak
  0 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2013-12-11 10:00 UTC (permalink / raw)
  To: u-boot

Hello Minkyu,

On 12/11/2013 09:16 AM, Minkyu Kang wrote:
> On 04/12/13 03:03, Przemyslaw Marczak wrote:
>> Config options:
>> - CONFIG_SAMSUNG - misc.c
>> - CONFIG_MISC_INIT_R - function misc_init_r();
>>
>> New file:
>> - board/samsung/common/misc.c
>>
>> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
>> ---
>>   board/samsung/common/Makefile |    1 +
>>   board/samsung/common/misc.c   |   16 ++++++++++++++++
>>   2 files changed, 17 insertions(+)
>>   create mode 100644 board/samsung/common/misc.c
>>
>> diff --git a/board/samsung/common/Makefile b/board/samsung/common/Makefile
>> index 501d974..d1eb63f 100644
>> --- a/board/samsung/common/Makefile
>> +++ b/board/samsung/common/Makefile
>> @@ -8,3 +8,4 @@
>>   obj-$(CONFIG_SOFT_I2C_MULTI_BUS) += multi_i2c.o
>>   obj-$(CONFIG_THOR_FUNCTION) += thor.o
>>   obj-$(CONFIG_CMD_USB_MASS_STORAGE) += ums.o
>> +obj-$(CONFIG_SAMSUNG) += misc.o
>
> Why CONFIG_SAMSUNG?
> We know this Makefile is for samsung boards.
>
Right, I will change it to CONFIG_MISC_INIT_R, and this ifdef will be 
removed from misc.c.

>> diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
>> new file mode 100644
>> index 0000000..465895b
>> --- /dev/null
>> +++ b/board/samsung/common/misc.c
>> @@ -0,0 +1,16 @@
>> +/*
>> + * Copyright (C) 2013 Samsung Electronics
>> + * Przemyslaw Marczak <p.marczak@samsung.com>
>> + *
>> + * SPDX-License-Identifier:	GPL-2.0+
>> + */
>> +
>> +#include <common.h>
>> +
>> +#ifdef CONFIG_MISC_INIT_R
>> +/* Common for Samsung boards */
>> +int misc_init_r(void)
>> +{
>> +	return 0;
>> +}
>> +#endif /* CONFIG_MISC_INIT_R */
>>
>
> Thanks,
> Minkyu Kang.
>
>

Regards
-- 
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com

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

* [U-Boot] [PATCH 07/10] samsung: misc: Add LCD download menu.
  2013-12-11  8:15   ` Minkyu Kang
@ 2013-12-11 12:38     ` Przemyslaw Marczak
  0 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2013-12-11 12:38 UTC (permalink / raw)
  To: u-boot

Dear Minkyu,

On 12/11/2013 09:15 AM, Minkyu Kang wrote:
> Dear Przemyslaw Marczak,
>
> On 04/12/13 03:03, Przemyslaw Marczak wrote:
>> New configs:
>> - CONFIG_LCD_MENU
>> - CONFIG_LCD_MENU_BOARD
>> which depends on: CONFIG_MISC_INIT_R
>>
>> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
>> ---
>>   board/samsung/common/keys.h |   78 ++++++++++
>>   board/samsung/common/misc.c |  354 +++++++++++++++++++++++++++++++++++++++++++
>>   2 files changed, 432 insertions(+)
>>   create mode 100644 board/samsung/common/keys.h
>>
>> diff --git a/board/samsung/common/keys.h b/board/samsung/common/keys.h
>> new file mode 100644
>> index 0000000..48822d1
>> --- /dev/null
>> +++ b/board/samsung/common/keys.h
>> @@ -0,0 +1,78 @@
>> +/*
>> + * Copyright (C) 2013 Samsung Electronics
>> + *
>> + * SPDX-License-Identifier:	GPL-2.0+
>> + */
>> +#ifndef __SAMSUNG_KEYS__
>> +#define __SAMSUNG_KEYS__
>> +
>> +#ifndef __ASSEMBLY__
>> +
>> +#include <config.h>
>> +#include <common.h>
>> +#include <power/pmic.h>
>> +#include <asm/arch/gpio.h>
>> +
>> +/* PMIC PWR ON key */
>> +#if defined(CONFIG_MACH_GONI) || defined(CONFIG_UNIVERSAL)
>> +
>> +#include <power/max8998_pmic.h>
>> +
>> +#define KEY_PWR_PMIC_NAME		"MAX8998_PMIC"
>> +
>> +#define KEY_PWR_STATUS_REG		MAX8998_REG_STATUS1
>> +#define KEY_PWR_STATUS_MASK		(1 << 7)
>> +
>> +#define KEY_PWR_INTERRUPT_REG		MAX8998_REG_IRQ1
>> +#define KEY_PWR_INTERRUPT_MASK		(1 << 7)
>> +
>> +#elif defined(CONFIG_TRATS)
>> +
>> +#include <power/max8997_pmic.h>
>> +
>> +#define KEY_PWR_PMIC_NAME		"MAX8997_PMIC"
>> +
>> +#define KEY_PWR_STATUS_REG		MAX8997_REG_STATUS1
>> +#define KEY_PWR_STATUS_MASK		(1 << 0)
>> +
>> +#define KEY_PWR_INTERRUPT_REG		MAX8997_REG_INT1
>> +#define KEY_PWR_INTERRUPT_MASK		(1 << 0)
>> +
>> +#elif defined(CONFIG_TRATS2)
>> +
>> +#include <power/max77686_pmic.h>
>> +
>> +#define KEY_PWR_PMIC_NAME		"MAX77686_PMIC"
>> +
>> +#define KEY_PWR_STATUS_REG		MAX77686_REG_PMIC_STATUS1
>> +#define KEY_PWR_STATUS_MASK		(1 << 0)
>> +
>> +#define KEY_PWR_INTERRUPT_REG		MAX77686_REG_PMIC_INT1
>> +#define KEY_PWR_INTERRUPT_MASK		(1 << 1)
>> +
>> +#endif /* PMIC PWR ON key */
>
> Hm no. it's a board specific feature so it should be go to each boards.
> Maybe we need some.. framework?
>

Ok, I will move it to boards configs headers.
And one more about some framework. I think this is good idea but I 
prefer to use this simple version first.
We can extend pmic framework with some "ops" to "struct pmic", eg.:
- get_power_key() - status or interrupt
- check_usb_cable()
the same as low_power_mode() which exists.
So at this time we can add two pmic extensions.

Also such pmic framework should provide some generic function to just 
get power key state and usb cable connection with no worry about 
specified pmic name like it is now.
This also adding new problem - what if board has few pmic instances...

This things requires other patch set and adding it here will increase 
this patch set apply time.
So I prefer to just put this code to boards headers.

>> +
>> +/* GPIO for Vol Up and Vol Down */
>> +#if defined(CONFIG_MACH_GONI)
>> +
>> +#define KEY_VOL_UP_GPIO			s5pc110_gpio_get(h3, 1)
>> +#define KEY_VOL_DOWN_GPIO		s5pc110_gpio_get(h3, 2)
>> +
>> +#elif defined(CONFIG_UNIVERSAL) || defined(CONFIG_TRATS)
>> +
>> +#define KEY_VOL_UP_GPIO			exynos4_gpio_get(2, x2, 0)
>> +#define KEY_VOL_DOWN_GPIO		exynos4_gpio_get(2, x2, 1)
>> +
>> +#elif defined(CONFIG_TRATS2)
>> +
>> +#define KEY_VOL_UP_GPIO			exynos4x12_gpio_get(2, x2, 2)
>> +#define KEY_VOL_DOWN_GPIO		exynos4x12_gpio_get(2, x3, 3)
>> +
>> +#else
>> +#ifdef CONFIG_MISC_INIT_R
>> +#warning Vol UP and Vol DOWN GPIO are undefined!
>> +#endif
>> +#endif /* GPIO for Vol Up and Vol Down */
>
> ditto.
> Will you add ifdef when you add new boards?
> It doesn't make sense.
>
>> +
>> +#endif /* __ASSEMBLY__ */
>> +#endif /* __SAMSUNG_KEYS__ */
>> diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
>> index fa97644..c792b87 100644
>> --- a/board/samsung/common/misc.c
>> +++ b/board/samsung/common/misc.c
>> @@ -8,8 +8,357 @@
>>   #include <common.h>
>>   #include <lcd.h>
>>   #include <libtizen.h>
>> +#include <errno.h>
>> +#include <version.h>
>> +#include <asm/sizes.h>
>> +#include <asm/arch/cpu.h>
>> +#include <asm/arch/gpio.h>
>> +#include <asm/gpio.h>
>> +#include <linux/input.h>
>> +#include <lcd.h>
>> +#include <libtizen.h>
>> +#include <mmc.h>
>> +#include "keys.h"
>>
>>   #ifdef CONFIG_MISC_INIT_R
>> +struct s5p_gpio_bank *s5p_gpio_get_bank(unsigned);
>> +int s5p_gpio_get_pin(unsigned);
>> +#ifdef CONFIG_REVISION_TAG
>> +u32 get_board_rev(void);
>> +#endif
>> +
>> +#ifdef CONFIG_LCD_MENU
>> +enum {
>> +	BOOT_MODE_INFO,
>> +	BOOT_MODE_THOR,
>> +	BOOT_MODE_UMS,
>> +	BOOT_MODE_DFU,
>> +	BOOT_MODE_EXIT,
>> +};
>> +
>> +static int power_key_pressed(int reg)
>> +{
>> +	struct pmic *pmic = pmic_get(KEY_PWR_PMIC_NAME);
>> +	u32 status = 0;
>> +	u32 mask;
>> +
>> +	if (pmic_probe(pmic))
>> +		return 0;
>> +
>> +	if (!pmic) {
>> +		printf("%s: Not found\n", KEY_PWR_PMIC_NAME);
>> +		return -ENODEV;
>> +	}
>> +
>> +	if (reg == KEY_PWR_STATUS_REG)
>> +		mask = KEY_PWR_STATUS_MASK;
>> +	else
>> +		mask = KEY_PWR_INTERRUPT_MASK;
>> +
>> +	if (pmic_reg_read(pmic, reg, &status))
>> +		return -EIO;
>> +
>> +	return !!(status & mask);
>> +}
>> +
>> +static int key_pressed(int key)
>> +{
>> +	int value = 0;
>> +
>> +	switch (key) {
>> +	case KEY_POWER:
>> +		value = power_key_pressed(KEY_PWR_INTERRUPT_REG);
>> +		break;
>> +	case KEY_VOLUMEUP:
>> +		value = !gpio_get_value(KEY_VOL_UP_GPIO);
>> +		break;
>> +	case KEY_VOLUMEDOWN:
>> +		value = !gpio_get_value(KEY_VOL_DOWN_GPIO);
>> +		break;
>> +	default:
>> +		break;
>> +	}
>> +
>> +	return value;
>> +}
>> +
>> +static int check_keys(void)
>> +{
>> +	int keys = 0;
>> +
>> +	if (key_pressed(KEY_POWER))
>> +		keys += KEY_POWER;
>> +	if (key_pressed(KEY_VOLUMEUP))
>> +		keys += KEY_VOLUMEUP;
>> +	if (key_pressed(KEY_VOLUMEDOWN))
>> +		keys += KEY_VOLUMEDOWN;
>> +
>> +	return keys;
>> +}
>> +
>> +DECLARE_GLOBAL_DATA_PTR;
>
> please move it to top of this file.
>

OK.

>> +
>> +/*
>> + * 0 BOOT_MODE_INFO
>> + * 1 BOOT_MODE_THOR
>> + * 2 BOOT_MODE_UMS
>> + * 3 BOOT_MODE_DFU
>> + * 4 BOOT_MODE_EXIT
>> +*/
>> +static char *
>> +mode_name[BOOT_MODE_EXIT + 1] = {"DEVICE",
>> +				"THOR",
>> +				"UMS",
>> +				"DFU",
>> +				"EXIT"};
>> +
>> +static char *
>> +mode_info[BOOT_MODE_EXIT + 1] = {"info",
>> +				 "downloader",
>> +				 "mass storage",
>> +				 "firmware update",
>> +				 "and run normal boot"};
>> +
>> +static char *
>> +mode_cmd[BOOT_MODE_EXIT + 1] = {"",
>> +				"thor 0 mmc 0",
>> +				"ums 0 mmc 0",
>> +				"dfu 0 mmc 0",
>> +				""};
>> +
>> +static void display_board_info(void)
>> +{
>> +	struct mmc *mmc = find_mmc_device(0);
>> +	vidinfo_t *vid = &panel_info;
>> +
>> +	lcd_position_cursor(4, 4);
>> +
>> +	lcd_printf("%s\n\t", U_BOOT_VERSION);
>> +	lcd_puts("\n\t\tBoard Info:\n");
>> +#ifdef CONFIG_BOARD_NAME
>> +	lcd_printf("\tBoard name: %s\n", CONFIG_BOARD_NAME);
>> +#endif
>> +#ifdef CONFIG_REVISION_TAG
>> +	lcd_printf("\tBoard rev: %u\n", get_board_rev());
>> +#endif
>> +	lcd_printf("\tDRAM banks: %u\n", CONFIG_NR_DRAM_BANKS);
>> +	lcd_printf("\tDRAM size: %u MB\n", gd->ram_size / SZ_1M);
>> +
>> +	if (mmc)
>> +		lcd_printf("\teMMC size: %llu MB\n", mmc->capacity / SZ_1M);
>> +
>> +	if (vid)
>> +		lcd_printf("\tDisplay resolution: %u x % u\n",
>> +			   vid->vl_col, vid->vl_row);
>> +
>> +	lcd_printf("\tDisplay BPP: %u\n", 1 << vid->vl_bpix);
>> +}
>> +
>> +static int mode_leave_menu(int mode)
>> +{
>> +	int mode_supported = 1;
>> +	int leave = 0;
>> +	char *exit_option;
>> +	char *exit_boot = "boot";
>> +	char *exit_back = "back";
>> +
>> +	switch (mode) {
>> +	case BOOT_MODE_INFO:
>> +#if !defined(CONFIG_LCD_MENU_BOARD)
>> +		mode_supported = 0;
>> +#endif
>> +		break;
>> +	case BOOT_MODE_THOR:
>> +#if !defined(CONFIG_CMD_THOR_DOWNLOAD)
>> +		mode_supported = 0;
>> +#endif
>> +		break;
>> +	case BOOT_MODE_UMS:
>> +#if !defined(CONFIG_CMD_USB_MASS_STORAGE)
>> +		mode_supported = 0;
>> +#endif
>> +		break;
>> +	case BOOT_MODE_DFU:
>> +#if !defined(CONFIG_CMD_DFU)
>> +		mode_supported = 0;
>> +#endif
>> +		break;
>> +	case BOOT_MODE_EXIT:
>> +		leave = 1;
>> +		goto exit;
>> +	default:
>> +		break;
>> +	}
>> +
>> +	lcd_clear();
>> +
>> +	if (mode_supported) {
>> +		if (mode) {
>> +			lcd_printf("\n\n\t%s %s\n", mode_name[mode],
>> +						    mode_info[mode]);
>> +			lcd_puts("\n\tDo not turn off device before finish!\n");
>> +
>> +			run_command(mode_cmd[mode], 0);
>> +			printf("Command finished\n");
>> +			lcd_clear();
>> +			lcd_printf("\n\n\t%s finished\n", mode_name[mode]);
>> +			exit_option = exit_boot;
>> +			leave = 1;
>> +		} else {
>> +			display_board_info();
>> +			exit_option = exit_back;
>> +			leave = 0;
>> +		}
>> +	} else {
>> +		lcd_puts("\n\n\tThis mode is not supported.\n");
>> +		exit_option = exit_back;
>> +		leave = 0;
>> +	}
>> +
>> +	lcd_printf("\n\n\tPress POWER KEY to %s\n", exit_option);
>> +
>> +	/* Wait for PWR key */
>> +	while (!key_pressed(KEY_POWER))
>> +		udelay(1000);
>> +exit:
>> +	lcd_clear();
>> +	return leave;
>> +}
>> +
>> +static void display_download_menu(int mode)
>> +{
>> +	char *menu_name = "Download Mode Menu";
>> +	char *indicator = "[=>]";
>> +	char *blank = "[  ]";
>> +	char *selection[BOOT_MODE_EXIT + 1];
>> +	int i;
>> +
>> +	for (i = 0; i <= BOOT_MODE_EXIT; i++)
>> +			selection[i] = blank;
>
> indentation error.
>
Right
>> +
>> +	selection[mode] = indicator;
>> +
>> +	lcd_clear();
>> +	lcd_printf("\n\t\t%s\n", menu_name);
>> +
>> +	for (i = 0; i <= BOOT_MODE_EXIT; i++)
>> +		lcd_printf("\t%s  %s - %s\n\n", selection[i],
>> +						mode_name[i],
>> +						mode_info[i]);
>> +}
>> +
>> +void download_menu(void)
>> +{
>> +	int mode = 0;
>> +	int last_mode = 0;
>> +	int run;
>> +	int key;
>> +	int menu_exit = 0;
>> +
>> +	display_download_menu(mode);
>> +
>> +	while (1) {
>> +		run = 0;
>> +		menu_exit = 0;
>> +
>> +		if (mode != last_mode)
>> +			display_download_menu(mode);
>> +
>> +		last_mode = mode;
>> +		udelay(100000);
>> +
>> +		key = check_keys();
>
> as your implementation of check_keys function.
> you never catch if we pressed multi keys.
> What is the expected result of such a situation?
>

Multi key was not implemented as any functional meaning.
In this case it is the same as no key was pressed, so it is "default" 
case, and function will keep in loop.
I only use power key as "enter key" - it is intuitive.

>> +		switch (key) {
>> +		case KEY_POWER:
>> +			run = 1;
>> +			break;
>> +		case KEY_VOLUMEUP:
>> +			if (mode > 0)
>> +				mode--;
>> +			break;
>> +		case KEY_VOLUMEDOWN:
>> +			if (mode < BOOT_MODE_EXIT)
>> +				mode++;
>> +			break;
>> +		default:
>> +			break;
>> +		}
>> +
>> +		if (run) {
>> +			if (mode_leave_menu(mode))
>> +				break;
>> +
>> +			display_download_menu(mode);
>> +		}
>> +	}
>> +
>> +	lcd_clear();
>> +}
>> +
>> +static void display_mode_info(void)
>> +{
>> +	lcd_position_cursor(4, 4);
>> +	lcd_printf("%s\n", U_BOOT_VERSION);
>> +	lcd_puts("\nDownload Mode Menu\n");
>> +#ifdef CONFIG_BOARD_NAME
>> +	lcd_printf("Board name: %s\n", CONFIG_BOARD_NAME);
>> +#endif
>> +	lcd_printf("Press POWER KEY to display MENU options.");
>> +}
>> +
>> +static int boot_menu(void)
>> +{
>> +	int key = 0;
>> +	int timeout = 10;
>> +
>> +	display_mode_info();
>> +
>> +	while (timeout--) {
>> +		lcd_printf("\rNormal boot will start in: %d seconds.", timeout);
>> +		udelay(1000000);
>> +
>> +		key = key_pressed(KEY_POWER);
>> +		if (key)
>> +			break;
>> +	}
>> +
>> +	lcd_clear();
>> +
>> +	/* If PWR pressed - show download menu */
>> +	if (key) {
>> +		printf("Power pressed - go to download menu\n");
>> +		udelay(1000000);
>> +		download_menu();
>> +		printf("Download mode exit.\n");
>> +	}
>> +
>> +	return 0;
>> +}
>> +
>> +static void check_boot_mode(void)
>> +{
>> +	int pwr_key;
>> +
>> +	pwr_key = power_key_pressed(KEY_PWR_STATUS_REG);
>> +	if (pwr_key) {
>
> if (!pwr_key) then return;
>
>> +		/* Clear PWR button Rising edge interrupt status flag */
>> +		power_key_pressed(KEY_PWR_INTERRUPT_REG);
>> +
>> +		if (key_pressed(KEY_VOLUMEUP))
>> +			boot_menu();
>> +		else if (key_pressed(KEY_VOLUMEDOWN))
>> +			mode_leave_menu(BOOT_MODE_THOR);
>> +	}
>> +}
>> +
>> +static void keys_init(void)
>> +{
>> +	/* Set direction to input */
>> +	gpio_direction_input(KEY_VOL_UP_GPIO);
>> +	gpio_direction_input(KEY_VOL_DOWN_GPIO);
>> +}
>> +#endif /* CONFIG_LCD_MENU */
>> +
>>   #ifdef CONFIG_CMD_BMP
>>   static void draw_logo(void)
>>   {
>> @@ -46,10 +395,15 @@ static void draw_logo(void)
>>   /* Common for Samsung boards */
>>   int misc_init_r(void)
>>   {
>> +#ifdef CONFIG_LCD_MENU
>> +	keys_init();
>> +	check_boot_mode();
>> +#endif
>>   #ifdef CONFIG_CMD_BMP
>>   	if (panel_info.logo_on)
>>   		draw_logo();
>>   #endif
>> +
>>   	return 0;
>>   }
>>   #endif /* CONFIG_MISC_INIT_R */
>>
>
> Thanks,
> Minkyu Kang.
>

I will apply comments and send next patch set soon.

Regards.
-- 
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com

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

* [U-Boot] [PATCH 08/10] Trats: add LCD download menu support
  2013-12-11  8:15   ` Minkyu Kang
@ 2013-12-11 13:32     ` Przemyslaw Marczak
  0 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2013-12-11 13:32 UTC (permalink / raw)
  To: u-boot

Dear Minkyu,

On 12/11/2013 09:15 AM, Minkyu Kang wrote:
> On 04/12/13 03:03, Przemyslaw Marczak wrote:
>> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
>> Cc: Lukasz Majewski <l.majewski@samsung.com>
>> ---
>>   include/configs/trats.h |   10 ++++++++++
>>   1 file changed, 10 insertions(+)
>>
>> diff --git a/include/configs/trats.h b/include/configs/trats.h
>> index 9738a00..d3bed99 100644
>> --- a/include/configs/trats.h
>> +++ b/include/configs/trats.h
>> @@ -19,6 +19,7 @@
>>   #define CONFIG_EXYNOS4210	/* which is in a EXYNOS4210 */
>>   #define CONFIG_TRATS		/* working with TRATS */
>>   #define CONFIG_TIZEN		/* TIZEN lib */
>> +#define CONFIG_BOARD_NAME	"TRATS"
>>
>>   #include <asm/arch/cpu.h>	/* get chip and board defs */
>>
>> @@ -313,6 +314,15 @@
>>   /* Common misc for Samsung */
>>   #define CONFIG_MISC_INIT_R	1
>>
>> +/* Download menu - Samsung common */
>> +#define CONFIG_LCD_MENU			1
>> +#define CONFIG_LCD_MENU_BOARD		1
>> +
>> +/* LCD console */
>> +#define LCD_BPP			LCD_COLOR16
>> +#undef  LCD_TEST_PATTERN
>
> Where is this define?
>

This left after test. Will be removed from every board header.

>> +#define CONFIG_SYS_WHITE_ON_BLACK	1
>> +
>>   /* LCD */
>>   #define CONFIG_EXYNOS_FB
>>   #define CONFIG_LCD
>>
>
> Thanks,
> Minkyu Kang.
>

Regards
-- 
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com

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

* [U-Boot] [PATCH 05/10] lib: tizen: add Tizen 16bpp logo support.
       [not found]   ` <20131211105613.201446ff68c75747d836fab7@samsung.com>
@ 2013-12-11 13:48     ` Przemyslaw Marczak
  0 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2013-12-11 13:48 UTC (permalink / raw)
  To: u-boot

Hello Inha,

On 12/11/2013 02:56 AM, Inha Song wrote:
>
> Hi, Marczak
>
> I think, this patch can make unalgined access.
>
> (maybe.. this code)
>> if (vid->vl_bpix == 4)
>> 	vid->logo_addr = (ulong)tizen_hd_logo_16bpp;
>> else
>> 	vid->logo_addr = (ulong)tizen_hd_logo;
>
> Compiled using arm-linux-gnueabi (4.6.3 version) and
> When I tested using TRTAS2 board,
>
> I can face data abort error message like this,
>
> //////
> data abort
>
>      MAYBE you should read doc/README.arm-unaligned-accesses
>
> pc : [<7de5d150>]          lr : [<00000244>]
> sp : 78e4beb8  ip : 7de9f921     fp : 43e00020
> r10: 43e3a048  r9 : 78e4bf20     r8 : 11000000
> r7 : 11400000  r6 : 00000000     r5 : 000002d0  r4 : 00000001
> r3 : 00000064  r2 : 0000004d     r1 : 00000004  r0 : 7de9f921
> Flags: nZCv  IRQs off  FIQs on  Mode SVC_32
> Resetting CPU ...
>
> resetting ...
> ///////
>
> Thank you.
>
> ---- Original message ----
>
> On Tue, 03 Dec 2013 19:03:21 +0100
> Przemyslaw Marczak <p.marczak@samsung.com> wrote:
>
>> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
>> ---
>> This is big size patch. Please follow link:
>> http://www.denx.de/wiki/pub/U-Boot/TooBigPatches/0005-lib-tizen-add-Tizen-16bpp-logo-support.patch
>> _______________________________________________
>> U-Boot mailing list
>> U-Boot at lists.denx.de
>> http://lists.denx.de/mailman/listinfo/u-boot
>
>

Actually I used GCC 4.5. Linaro Gcc versions >= 4.6 has unaligned acces 
enabled by default. Maybe flag -mno-unaligned-access will avoid this. I 
will check this issue.

Regards.

-- 
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com

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

* [U-Boot] [PATCH v2 00/13] Introduce Samsung misc file and LCD menu.
  2013-12-03 18:03 [U-Boot] [PATCH 00/10] Introduce Samsung misc file and LCD menu Przemyslaw Marczak
                   ` (10 preceding siblings ...)
  2013-12-04  1:29 ` [U-Boot] [PATCH 00/10] Introduce Samsung misc file and LCD menu TigerLiu at viatech.com.cn
@ 2013-12-18 18:31 ` Przemyslaw Marczak
  2013-12-18 18:31   ` [U-Boot] [PATCH v2 01/13] s5p: gpio: change gpio coding method for s5p gpio Przemyslaw Marczak
                     ` (12 more replies)
  2014-01-03 16:43 ` [U-Boot] [PATCH v3 01/12] s5p: gpio: change gpio coding method for s5p gpio Przemyslaw Marczak
                   ` (3 subsequent siblings)
  15 siblings, 13 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2013-12-18 18:31 UTC (permalink / raw)
  To: u-boot

This patch set includes changes required to:
- properly use of all gpios
- introduce common file for Samsung misc code
- keys support (PWR, VOL:UP,DOWN)
- console support on LCD
- 16bpp logo support
- introduce LCD menu on Samsung devices

Changes v2 are described in each patch commit msg.

Przemyslaw Marczak (13):
  s5p: gpio: change gpio coding method for s5p gpio.
  trats: add optional cflags to board object file.
  trats2: Code cleanup.
  samsung: common: Add misc file and common function misc_init_r().
  samsung: misc: move display logo function to misc.c file.
  common: makefile: Add optional cflags to object: common/lcd.o
  lib: tizen: change Tizen logo with the new one.
  video: exynos: fimd: add support for various display color modes
  samsung: boards: update display configs with 16bpp mode.
  samsung: misc: Add LCD download menu.
  Trats: add LCD download menu support
  trats2: add LCD download menu support
  universal: add LCD download menu support

 arch/arm/include/asm/arch-exynos/gpio.h  |  169 +-
 arch/arm/include/asm/arch-s5pc1xx/gpio.h |   47 +-
 board/samsung/common/Makefile            |    1 +
 board/samsung/common/misc.c              |  396 ++
 board/samsung/common/misc.h              |   18 +
 board/samsung/trats/Makefile             |    2 +
 board/samsung/trats/trats.c              |    5 +-
 board/samsung/trats2/trats2.c            |   25 +-
 board/samsung/universal_c210/universal.c |    6 +-
 common/Makefile                          |    1 +
 drivers/gpio/s5p_gpio.c                  |   15 +-
 drivers/power/battery/bat_trats2.c       |    2 +-
 drivers/video/exynos_fb.c                |   28 -
 drivers/video/exynos_fimd.c              |   15 +-
 include/configs/s5p_goni.h               |    4 +-
 include/configs/s5pc210_universal.h      |   42 +-
 include/configs/trats.h                  |   38 +-
 include/configs/trats2.h                 |   47 +-
 lib/tizen/tizen.c                        |   20 +-
 lib/tizen/tizen_hd_logo.h                | 5057 ---------------
 lib/tizen/tizen_hd_logo_data.h           |   15 -
 lib/tizen/tizen_logo_16bpp.h             |10021 ++++++++++++++++++++++++++++++
 lib/tizen/tizen_logo_16bpp_gzip.h        |  571 ++
 23 files changed, 11250 insertions(+), 5295 deletions(-)
 create mode 100644 board/samsung/common/misc.c
 create mode 100644 board/samsung/common/misc.h
 delete mode 100644 lib/tizen/tizen_hd_logo.h
 delete mode 100644 lib/tizen/tizen_hd_logo_data.h
 create mode 100644 lib/tizen/tizen_logo_16bpp.h
 create mode 100644 lib/tizen/tizen_logo_16bpp_gzip.h

-- 
1.7.9.5

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

* [U-Boot] [PATCH v2 01/13] s5p: gpio: change gpio coding method for s5p gpio.
  2013-12-18 18:31 ` [U-Boot] [PATCH v2 00/13] " Przemyslaw Marczak
@ 2013-12-18 18:31   ` Przemyslaw Marczak
  2014-01-02  6:35     ` Minkyu Kang
  2013-12-18 18:31   ` [U-Boot] [PATCH v2 02/13] trats: add optional cflags to board object file Przemyslaw Marczak
                     ` (11 subsequent siblings)
  12 siblings, 1 reply; 147+ messages in thread
From: Przemyslaw Marczak @ 2013-12-18 18:31 UTC (permalink / raw)
  To: u-boot

Old s5p gpio coding method was not clean and was not working properly
for all parts and banks. New method is clean and easy to extend.

Gpio coding mask:
0x000000ff - pin number
0x00ffff00 - bank offset
0xff000000 - part number

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
---
 arch/arm/include/asm/arch-exynos/gpio.h  |  169 +++++++++++-------------------
 arch/arm/include/asm/arch-s5pc1xx/gpio.h |   47 +++++++--
 drivers/gpio/s5p_gpio.c                  |   15 +--
 include/configs/s5p_goni.h               |    4 +-
 include/configs/s5pc210_universal.h      |   12 +--
 include/configs/trats.h                  |    8 +-
 include/configs/trats2.h                 |   12 +--
 7 files changed, 125 insertions(+), 142 deletions(-)

diff --git a/arch/arm/include/asm/arch-exynos/gpio.h b/arch/arm/include/asm/arch-exynos/gpio.h
index a1a7439..b7dc8f5 100644
--- a/arch/arm/include/asm/arch-exynos/gpio.h
+++ b/arch/arm/include/asm/arch-exynos/gpio.h
@@ -196,117 +196,72 @@ void s5p_gpio_set_rate(struct s5p_gpio_bank *bank, int gpio, int mode);
 /* GPIO pins per bank  */
 #define GPIO_PER_BANK 8
 
-#define exynos4_gpio_part1_get_nr(bank, pin) \
-	((((((unsigned int) &(((struct exynos4_gpio_part1 *) \
-			       EXYNOS4_GPIO_PART1_BASE)->bank)) \
-	    - EXYNOS4_GPIO_PART1_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin)
-
-#define EXYNOS4_GPIO_PART1_MAX ((sizeof(struct exynos4_gpio_part1) \
-			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
-
-#define exynos4_gpio_part2_get_nr(bank, pin) \
-	(((((((unsigned int) &(((struct exynos4_gpio_part2 *) \
-				EXYNOS4_GPIO_PART2_BASE)->bank)) \
-	    - EXYNOS4_GPIO_PART2_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin) + EXYNOS4_GPIO_PART1_MAX)
-
-#define exynos4x12_gpio_part1_get_nr(bank, pin) \
-	((((((unsigned int) &(((struct exynos4x12_gpio_part1 *) \
-			       EXYNOS4X12_GPIO_PART1_BASE)->bank)) \
-	    - EXYNOS4X12_GPIO_PART1_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin)
-
-#define EXYNOS4X12_GPIO_PART1_MAX ((sizeof(struct exynos4x12_gpio_part1) \
-			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
-
-#define exynos4x12_gpio_part2_get_nr(bank, pin) \
-	(((((((unsigned int) &(((struct exynos4x12_gpio_part2 *) \
-				EXYNOS4X12_GPIO_PART2_BASE)->bank)) \
-	    - EXYNOS4X12_GPIO_PART2_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin) + EXYNOS4X12_GPIO_PART1_MAX)
-
-#define EXYNOS4X12_GPIO_PART2_MAX ((sizeof(struct exynos4x12_gpio_part2) \
-			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
-
-#define exynos4x12_gpio_part3_get_nr(bank, pin) \
-	(((((((unsigned int) &(((struct exynos4x12_gpio_part3 *) \
-				EXYNOS4X12_GPIO_PART3_BASE)->bank)) \
-	    - EXYNOS4X12_GPIO_PART3_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin) + EXYNOS4X12_GPIO_PART2_MAX)
-
-#define exynos5_gpio_part1_get_nr(bank, pin) \
-	((((((unsigned int) &(((struct exynos5_gpio_part1 *) \
-			       EXYNOS5_GPIO_PART1_BASE)->bank)) \
-	    - EXYNOS5_GPIO_PART1_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin)
-
-#define EXYNOS5_GPIO_PART1_MAX ((sizeof(struct exynos5_gpio_part1) \
-			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
-
-#define exynos5_gpio_part2_get_nr(bank, pin) \
-	(((((((unsigned int) &(((struct exynos5_gpio_part2 *) \
-				EXYNOS5_GPIO_PART2_BASE)->bank)) \
-	    - EXYNOS5_GPIO_PART2_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin) + EXYNOS5_GPIO_PART1_MAX)
-
-#define EXYNOS5_GPIO_PART2_MAX ((sizeof(struct exynos5_gpio_part2) \
-			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
-
-#define exynos5_gpio_part3_get_nr(bank, pin) \
-	(((((((unsigned int) &(((struct exynos5_gpio_part3 *) \
-				EXYNOS5_GPIO_PART3_BASE)->bank)) \
-	    - EXYNOS5_GPIO_PART3_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin) + EXYNOS5_GPIO_PART2_MAX)
-
-static inline unsigned int s5p_gpio_base(int nr)
+#define S5P_GPIO_PART_SHIFT	(24)
+#define S5P_GPIO_PART_MASK	(0xff)
+#define S5P_GPIO_BANK_SHIFT	(8)
+#define S5P_GPIO_BANK_MASK	(0xffff)
+#define S5P_GPIO_PIN_MASK	(0xff)
+
+#define S5P_GPIO_SET_PART(x) \
+			((x & S5P_GPIO_PART_MASK) << S5P_GPIO_PART_SHIFT)
+
+#define S5P_GPIO_GET_PART(x) \
+			((x >> S5P_GPIO_PART_SHIFT) & S5P_GPIO_PART_MASK)
+
+#define S5P_GPIO_SET_PIN(x) \
+			(x & S5P_GPIO_PIN_MASK)
+
+#define EXYNOS4_GPIO_SET_BANK(part, bank) \
+			((((unsigned)&(((struct exynos4_gpio_part##part *) \
+			EXYNOS4_GPIO_PART##part##_BASE)->bank) \
+			- EXYNOS4_GPIO_PART##part##_BASE) \
+			& S5P_GPIO_BANK_MASK) << S5P_GPIO_BANK_SHIFT)
+
+#define EXYNOS4X12_GPIO_SET_BANK(part, bank) \
+			((((unsigned)&(((struct exynos4x12_gpio_part##part *) \
+			EXYNOS4X12_GPIO_PART##part##_BASE)->bank) \
+			- EXYNOS4X12_GPIO_PART##part##_BASE) \
+			& S5P_GPIO_BANK_MASK) << S5P_GPIO_BANK_SHIFT)
+
+#define EXYNOS5_GPIO_SET_BANK(part, bank) \
+			((((unsigned)&(((struct exynos5_gpio_part##part *) \
+			EXYNOS5_GPIO_PART##part##_BASE)->bank) \
+			- EXYNOS5_GPIO_PART##part##_BASE) \
+			& S5P_GPIO_BANK_MASK) << S5P_GPIO_BANK_SHIFT)
+
+#define exynos4_gpio_get(part, bank, pin) \
+			(S5P_GPIO_SET_PART(part) | \
+			EXYNOS4_GPIO_SET_BANK(part, bank) | \
+			S5P_GPIO_SET_PIN(pin))
+
+#define exynos4x12_gpio_get(part, bank, pin) \
+			(S5P_GPIO_SET_PART(part) | \
+			EXYNOS4X12_GPIO_SET_BANK(part, bank) | \
+			S5P_GPIO_SET_PIN(pin))
+
+#define exynos5_gpio_get(part, bank, pin) \
+			(S5P_GPIO_SET_PART(part) | \
+			EXYNOS5_GPIO_SET_BANK(part, bank) | \
+			S5P_GPIO_SET_PIN(pin))
+
+static inline unsigned int s5p_gpio_base(int gpio)
 {
-	if (cpu_is_exynos5()) {
-		if (nr < EXYNOS5_GPIO_PART1_MAX)
-			return EXYNOS5_GPIO_PART1_BASE;
-		else if (nr < EXYNOS5_GPIO_PART2_MAX)
-			return EXYNOS5_GPIO_PART2_BASE;
-		else
-			return EXYNOS5_GPIO_PART3_BASE;
-
-	} else if (cpu_is_exynos4()) {
-		if (nr < EXYNOS4_GPIO_PART1_MAX)
-			return EXYNOS4_GPIO_PART1_BASE;
-		else
-			return EXYNOS4_GPIO_PART2_BASE;
+	unsigned gpio_part = S5P_GPIO_GET_PART(gpio);
+
+	switch (gpio_part) {
+	case 1:
+		return samsung_get_base_gpio_part1();
+	case 2:
+		return samsung_get_base_gpio_part2();
+	case 3:
+		return samsung_get_base_gpio_part3();
+	case 4:
+		return samsung_get_base_gpio_part4();
+	default:
+		return 0;
 	}
-
-	return 0;
 }
 
-static inline unsigned int s5p_gpio_part_max(int nr)
-{
-	if (cpu_is_exynos5()) {
-		if (nr < EXYNOS5_GPIO_PART1_MAX)
-			return 0;
-		else if (nr < EXYNOS5_GPIO_PART2_MAX)
-			return EXYNOS5_GPIO_PART1_MAX;
-		else
-			return EXYNOS5_GPIO_PART2_MAX;
-
-	} else if (cpu_is_exynos4()) {
-		if (proid_is_exynos4412()) {
-			if (nr < EXYNOS4X12_GPIO_PART1_MAX)
-				return 0;
-			else if (nr < EXYNOS4X12_GPIO_PART2_MAX)
-				return EXYNOS4X12_GPIO_PART1_MAX;
-			else
-				return EXYNOS4X12_GPIO_PART2_MAX;
-		} else {
-			if (nr < EXYNOS4_GPIO_PART1_MAX)
-				return 0;
-			else
-				return EXYNOS4_GPIO_PART1_MAX;
-		}
-	}
-
-	return 0;
-}
 #endif
 
 /* Pin configurations */
diff --git a/arch/arm/include/asm/arch-s5pc1xx/gpio.h b/arch/arm/include/asm/arch-s5pc1xx/gpio.h
index ac60fe6..84a7091 100644
--- a/arch/arm/include/asm/arch-s5pc1xx/gpio.h
+++ b/arch/arm/include/asm/arch-s5pc1xx/gpio.h
@@ -125,20 +125,45 @@ void s5p_gpio_set_rate(struct s5p_gpio_bank *bank, int gpio, int mode);
 /* GPIO pins per bank  */
 #define GPIO_PER_BANK 8
 
-static inline unsigned int s5p_gpio_base(int nr)
-{
-	return S5PC110_GPIO_BASE;
-}
+#define S5P_GPIO_PART_SHIFT	(24)
+#define S5P_GPIO_PART_MASK	(0xff)
+#define S5P_GPIO_BANK_SHIFT	(8)
+#define S5P_GPIO_BANK_MASK	(0xffff)
+#define S5P_GPIO_PIN_MASK	(0xff)
+
+#define S5P_GPIO_SET_PART(x) \
+			((x & S5P_GPIO_PART_MASK) << S5P_GPIO_PART_SHIFT)
+
+#define S5P_GPIO_GET_PART(x) \
+			((x >> S5P_GPIO_PART_SHIFT) & S5P_GPIO_PART_MASK)
+
+#define S5P_GPIO_SET_PIN(x) \
+			(x & S5P_GPIO_PIN_MASK)
 
-static inline unsigned int s5p_gpio_part_max(int nr)
+#define S5PC100_SET_BANK(bank) \
+			(((unsigned)&(((struct s5pc100_gpio *) \
+			S5PC100_GPIO_BASE)->bank) - S5PC100_GPIO_BASE) \
+			& S5P_GPIO_BANK_MASK) << S5P_GPIO_BANK_SHIFT)
+
+#define S5PC110_SET_BANK(bank) \
+			((((unsigned) &(((struct s5pc110_gpio *) \
+			S5PC110_GPIO_BASE)->bank) - S5PC110_GPIO_BASE) \
+			& S5P_GPIO_BANK_MASK) << S5P_GPIO_BANK_SHIFT)
+
+#define s5pc100_gpio_get(bank, pin) \
+			(S5P_GPIO_SET_PART(0) | \
+			S5PC100_SET_BANK(bank) | \
+			S5P_GPIO_SET_PIN(pin))
+
+#define s5pc110_gpio_get(bank, pin) \
+			(S5P_GPIO_SET_PART(0) | \
+			S5PC110_SET_BANK(bank) | \
+			S5P_GPIO_SET_PIN(pin))
+
+static inline unsigned int s5p_gpio_base(int nr)
 {
-	return 0;
+	return samsung_get_base_gpio();
 }
-
-#define s5pc110_gpio_get_nr(bank, pin)	  \
-	((((((unsigned int)&(((struct s5pc110_gpio *)S5PC110_GPIO_BASE)->bank))\
-	    - S5PC110_GPIO_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin)
 #endif
 
 /* Pin configurations */
diff --git a/drivers/gpio/s5p_gpio.c b/drivers/gpio/s5p_gpio.c
index 7eeb96d..13aefba 100644
--- a/drivers/gpio/s5p_gpio.c
+++ b/drivers/gpio/s5p_gpio.c
@@ -9,6 +9,11 @@
 #include <asm/io.h>
 #include <asm/gpio.h>
 
+#define S5P_GPIO_GET_BANK(x)	((x >> S5P_GPIO_BANK_SHIFT) \
+				& S5P_GPIO_BANK_MASK)
+
+#define S5P_GPIO_GET_PIN(x)	(x & S5P_GPIO_PIN_MASK)
+
 #define CON_MASK(x)		(0xf << ((x) << 2))
 #define CON_SFR(x, v)		((v) << ((x) << 2))
 
@@ -124,17 +129,15 @@ void s5p_gpio_set_rate(struct s5p_gpio_bank *bank, int gpio, int mode)
 
 struct s5p_gpio_bank *s5p_gpio_get_bank(unsigned gpio)
 {
-	int bank;
-	unsigned g = gpio - s5p_gpio_part_max(gpio);
+	unsigned bank = S5P_GPIO_GET_BANK(gpio);
+	unsigned base = s5p_gpio_base(gpio);
 
-	bank = g / GPIO_PER_BANK;
-	bank *= sizeof(struct s5p_gpio_bank);
-	return (struct s5p_gpio_bank *) (s5p_gpio_base(gpio) + bank);
+	return (struct s5p_gpio_bank *) (base + bank);
 }
 
 int s5p_gpio_get_pin(unsigned gpio)
 {
-	return gpio % GPIO_PER_BANK;
+	return S5P_GPIO_GET_PIN(gpio);
 }
 
 /* Common GPIO API */
diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
index 0590d20..4cdf937 100644
--- a/include/configs/s5p_goni.h
+++ b/include/configs/s5p_goni.h
@@ -208,8 +208,8 @@
 /*
  * I2C Settings
  */
-#define CONFIG_SOFT_I2C_GPIO_SCL s5pc110_gpio_get_nr(j4, 3)
-#define CONFIG_SOFT_I2C_GPIO_SDA s5pc110_gpio_get_nr(j4, 0)
+#define CONFIG_SOFT_I2C_GPIO_SCL s5pc110_gpio_get(j4, 3)
+#define CONFIG_SOFT_I2C_GPIO_SDA s5pc110_gpio_get(j4, 0)
 
 #define CONFIG_SYS_I2C
 #define CONFIG_SYS_I2C_SOFT		/* I2C bit-banged */
diff --git a/include/configs/s5pc210_universal.h b/include/configs/s5pc210_universal.h
index d9e4c56..02a1c99 100644
--- a/include/configs/s5pc210_universal.h
+++ b/include/configs/s5pc210_universal.h
@@ -229,8 +229,8 @@
 /*
  * I2C Settings
  */
-#define CONFIG_SOFT_I2C_GPIO_SCL exynos4_gpio_part1_get_nr(b, 7)
-#define CONFIG_SOFT_I2C_GPIO_SDA exynos4_gpio_part1_get_nr(b, 6)
+#define CONFIG_SOFT_I2C_GPIO_SCL exynos4_gpio_get(1, b, 7)
+#define CONFIG_SOFT_I2C_GPIO_SDA exynos4_gpio_get(1, b, 6)
 
 #define CONFIG_SYS_I2C
 #define CONFIG_SYS_I2C_SOFT		/* I2C bit-banged */
@@ -253,10 +253,10 @@
  */
 #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 CONFIG_SOFT_SPI_GPIO_SCLK exynos4_gpio_get(2, y3, 1)
+#define CONFIG_SOFT_SPI_GPIO_MOSI exynos4_gpio_get(2, y3, 3)
+#define CONFIG_SOFT_SPI_GPIO_MISO exynos4_gpio_get(2, y3, 0)
+#define CONFIG_SOFT_SPI_GPIO_CS exynos4_gpio_get(2, y4, 3)
 
 #define SPI_DELAY udelay(1)
 #undef SPI_INIT
diff --git a/include/configs/trats.h b/include/configs/trats.h
index 8ff9800..2b07fe0 100644
--- a/include/configs/trats.h
+++ b/include/configs/trats.h
@@ -283,12 +283,12 @@
 #include <asm/arch/gpio.h>
 
 /* I2C PMIC */
-#define CONFIG_SOFT_I2C_I2C5_SCL exynos4_gpio_part1_get_nr(b, 7)
-#define CONFIG_SOFT_I2C_I2C5_SDA exynos4_gpio_part1_get_nr(b, 6)
+#define CONFIG_SOFT_I2C_I2C5_SCL exynos4_gpio_get(1, b, 7)
+#define CONFIG_SOFT_I2C_I2C5_SDA exynos4_gpio_get(1, b, 6)
 
 /* I2C FG */
-#define CONFIG_SOFT_I2C_I2C9_SCL exynos4_gpio_part2_get_nr(y4, 1)
-#define CONFIG_SOFT_I2C_I2C9_SDA exynos4_gpio_part2_get_nr(y4, 0)
+#define CONFIG_SOFT_I2C_I2C9_SCL exynos4_gpio_get(2, y4, 1)
+#define CONFIG_SOFT_I2C_I2C9_SDA exynos4_gpio_get(2, y4, 0)
 
 #define CONFIG_SOFT_I2C_GPIO_SCL get_multi_scl_pin()
 #define CONFIG_SOFT_I2C_GPIO_SDA get_multi_sda_pin()
diff --git a/include/configs/trats2.h b/include/configs/trats2.h
index c49a969e..f7d76f8 100644
--- a/include/configs/trats2.h
+++ b/include/configs/trats2.h
@@ -293,12 +293,12 @@
 #define CONFIG_SOFT_I2C_MULTI_BUS
 #define CONFIG_SYS_MAX_I2C_BUS		15
 
-#define CONFIG_SOFT_I2C_I2C5_SCL exynos4x12_gpio_part1_get_nr(d0, 3)
-#define CONFIG_SOFT_I2C_I2C5_SDA exynos4x12_gpio_part1_get_nr(d0, 2)
-#define CONFIG_SOFT_I2C_I2C9_SCL exynos4x12_gpio_part1_get_nr(f1, 4)
-#define CONFIG_SOFT_I2C_I2C9_SDA exynos4x12_gpio_part1_get_nr(f1, 5)
-#define CONFIG_SOFT_I2C_I2C10_SCL exynos4x12_gpio_part2_get_nr(m2, 1)
-#define CONFIG_SOFT_I2C_I2C10_SDA exynos4x12_gpio_part2_get_nr(m2, 0)
+#define CONFIG_SOFT_I2C_I2C5_SCL exynos4x12_gpio_get(1, d0, 3)
+#define CONFIG_SOFT_I2C_I2C5_SDA exynos4x12_gpio_get(1, d0, 2)
+#define CONFIG_SOFT_I2C_I2C9_SCL exynos4x12_gpio_get(1, f1, 4)
+#define CONFIG_SOFT_I2C_I2C9_SDA exynos4x12_gpio_get(1, f1, 5)
+#define CONFIG_SOFT_I2C_I2C10_SCL exynos4x12_gpio_get(2, m2, 1)
+#define CONFIG_SOFT_I2C_I2C10_SDA exynos4x12_gpio_get(2, m2, 0)
 #define CONFIG_SOFT_I2C_GPIO_SCL get_multi_scl_pin()
 #define CONFIG_SOFT_I2C_GPIO_SDA get_multi_sda_pin()
 #define I2C_INIT multi_i2c_init()
-- 
1.7.9.5

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

* [U-Boot] [PATCH v2 02/13] trats: add optional cflags to board object file.
  2013-12-18 18:31 ` [U-Boot] [PATCH v2 00/13] " Przemyslaw Marczak
  2013-12-18 18:31   ` [U-Boot] [PATCH v2 01/13] s5p: gpio: change gpio coding method for s5p gpio Przemyslaw Marczak
@ 2013-12-18 18:31   ` Przemyslaw Marczak
  2014-01-02  6:35     ` Minkyu Kang
  2013-12-18 18:31   ` [U-Boot] [PATCH v2 03/13] trats2: Code cleanup Przemyslaw Marczak
                     ` (10 subsequent siblings)
  12 siblings, 1 reply; 147+ messages in thread
From: Przemyslaw Marczak @ 2013-12-18 18:31 UTC (permalink / raw)
  To: u-boot

This change avoids unexpected unaligned access.

more info: README.arm-unaligned-accesses

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
cc: Lukasz Majewski <l.majewski@samsung.com>

---
Changes v2:
- new patch
---
 board/samsung/trats/Makefile |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/board/samsung/trats/Makefile b/board/samsung/trats/Makefile
index 5dc8a1f..c1bcd63 100644
--- a/board/samsung/trats/Makefile
+++ b/board/samsung/trats/Makefile
@@ -6,3 +6,5 @@
 #
 
 obj-y	+= trats.o
+
+$(obj)trats.o: CFLAGS += $(PLATFORM_NO_UNALIGNED)
\ No newline at end of file
-- 
1.7.9.5

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

* [U-Boot] [PATCH v2 03/13] trats2: Code cleanup.
  2013-12-18 18:31 ` [U-Boot] [PATCH v2 00/13] " Przemyslaw Marczak
  2013-12-18 18:31   ` [U-Boot] [PATCH v2 01/13] s5p: gpio: change gpio coding method for s5p gpio Przemyslaw Marczak
  2013-12-18 18:31   ` [U-Boot] [PATCH v2 02/13] trats: add optional cflags to board object file Przemyslaw Marczak
@ 2013-12-18 18:31   ` Przemyslaw Marczak
  2013-12-18 18:31   ` [U-Boot] [PATCH v2 04/13] samsung: common: Add misc file and common function misc_init_r() Przemyslaw Marczak
                     ` (9 subsequent siblings)
  12 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2013-12-18 18:31 UTC (permalink / raw)
  To: u-boot

Remove wrong and unused env variables
Trats2 is not as GT-I8800.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Cc: Piotr Wilczek <p.wilczek@samsung.com>
---
 board/samsung/trats2/trats2.c      |   19 ++-----------------
 drivers/power/battery/bat_trats2.c |    2 +-
 include/configs/trats2.h           |    1 -
 3 files changed, 3 insertions(+), 19 deletions(-)

diff --git a/board/samsung/trats2/trats2.c b/board/samsung/trats2/trats2.c
index 9552522..2442d96 100644
--- a/board/samsung/trats2/trats2.c
+++ b/board/samsung/trats2/trats2.c
@@ -72,15 +72,12 @@ static void check_hw_revision(void)
 int checkboard(void)
 {
 	puts("Board:\tTRATS2\n");
+	printf("HW Revision:\t0x%04x\n", board_rev);
+
 	return 0;
 }
 #endif
 
-static void show_hw_revision(void)
-{
-	printf("HW Revision:\t0x%04x\n", board_rev);
-}
-
 u32 get_board_rev(void)
 {
 	return board_rev;
@@ -591,15 +588,3 @@ void init_panel_info(vidinfo_t *vid)
 	exynos_set_dsim_platform_data(&dsim_platform_data);
 }
 #endif /* LCD */
-
-#ifdef CONFIG_MISC_INIT_R
-int misc_init_r(void)
-{
-	setenv("model", "GT-I8800");
-	setenv("board", "TRATS2");
-
-	show_hw_revision();
-
-	return 0;
-}
-#endif
diff --git a/drivers/power/battery/bat_trats2.c b/drivers/power/battery/bat_trats2.c
index f264832..94015aa 100644
--- a/drivers/power/battery/bat_trats2.c
+++ b/drivers/power/battery/bat_trats2.c
@@ -8,7 +8,7 @@
 #include <common.h>
 #include <power/pmic.h>
 #include <power/battery.h>
-#include <power/max8997_pmic.h>
+#include <power/max77693_pmic.h>
 #include <errno.h>
 
 static struct battery battery_trats;
diff --git a/include/configs/trats2.h b/include/configs/trats2.h
index f7d76f8..18270c1 100644
--- a/include/configs/trats2.h
+++ b/include/configs/trats2.h
@@ -271,7 +271,6 @@
 #define CONFIG_EFI_PARTITION
 #define CONFIG_PARTITION_UUIDS
 
-#define CONFIG_MISC_INIT_R
 #define CONFIG_BOARD_EARLY_INIT_F
 
 /* I2C */
-- 
1.7.9.5

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

* [U-Boot] [PATCH v2 04/13] samsung: common: Add misc file and common function misc_init_r().
  2013-12-18 18:31 ` [U-Boot] [PATCH v2 00/13] " Przemyslaw Marczak
                     ` (2 preceding siblings ...)
  2013-12-18 18:31   ` [U-Boot] [PATCH v2 03/13] trats2: Code cleanup Przemyslaw Marczak
@ 2013-12-18 18:31   ` Przemyslaw Marczak
  2014-01-02  6:37     ` Minkyu Kang
  2013-12-18 18:31   ` [U-Boot] [PATCH v2 05/13] samsung: misc: move display logo function to misc.c file Przemyslaw Marczak
                     ` (8 subsequent siblings)
  12 siblings, 1 reply; 147+ messages in thread
From: Przemyslaw Marczak @ 2013-12-18 18:31 UTC (permalink / raw)
  To: u-boot

Config: CONFIG_MISC_INIT_R enables implementation of misc_init_r()
in common file::
- board/samsung/common/misc.c

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>

---
Changes v2:
- change CONFIG_SAMSUNG to CONFIG_MISC_INIT_R
---
 board/samsung/common/Makefile |    1 +
 board/samsung/common/misc.c   |   14 ++++++++++++++
 2 files changed, 15 insertions(+)
 create mode 100644 board/samsung/common/misc.c

diff --git a/board/samsung/common/Makefile b/board/samsung/common/Makefile
index 501d974..c30bb3d 100644
--- a/board/samsung/common/Makefile
+++ b/board/samsung/common/Makefile
@@ -8,3 +8,4 @@
 obj-$(CONFIG_SOFT_I2C_MULTI_BUS) += multi_i2c.o
 obj-$(CONFIG_THOR_FUNCTION) += thor.o
 obj-$(CONFIG_CMD_USB_MASS_STORAGE) += ums.o
+obj-$(CONFIG_MISC_INIT_R) += misc.o
diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
new file mode 100644
index 0000000..3764d12
--- /dev/null
+++ b/board/samsung/common/misc.c
@@ -0,0 +1,14 @@
+/*
+ * Copyright (C) 2013 Samsung Electronics
+ * Przemyslaw Marczak <p.marczak@samsung.com>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+
+/* Common for Samsung boards */
+int misc_init_r(void)
+{
+	return 0;
+}
-- 
1.7.9.5

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

* [U-Boot] [PATCH v2 05/13] samsung: misc: move display logo function to misc.c file.
  2013-12-18 18:31 ` [U-Boot] [PATCH v2 00/13] " Przemyslaw Marczak
                     ` (3 preceding siblings ...)
  2013-12-18 18:31   ` [U-Boot] [PATCH v2 04/13] samsung: common: Add misc file and common function misc_init_r() Przemyslaw Marczak
@ 2013-12-18 18:31   ` Przemyslaw Marczak
  2013-12-18 18:31   ` [U-Boot] [PATCH v2 06/13] common: makefile: Add optional cflags to object: common/lcd.o Przemyslaw Marczak
                     ` (7 subsequent siblings)
  12 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2013-12-18 18:31 UTC (permalink / raw)
  To: u-boot

board/samsung/common/misc.c:
- move draw_logo() function from exynos_fb.c
- add get_tizen_logo_info() function call removed from board files

boards:
- update board files
- add CONFIG_MISC_INIT_R to Universal, Trats and Trats2

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Tested-by: Hyungwon Hwang <human.hwang@samsung.com>

---
changes v2:
- configs cleanup
- add check logo address before display
---
 board/samsung/common/misc.c              |   42 ++++++++++++++++++++++++++++++
 board/samsung/trats/trats.c              |    3 ---
 board/samsung/trats2/trats2.c            |    4 ---
 board/samsung/universal_c210/universal.c |    4 ---
 drivers/video/exynos_fb.c                |   28 --------------------
 include/configs/s5pc210_universal.h      |    3 +++
 include/configs/trats.h                  |    3 +++
 include/configs/trats2.h                 |    3 +++
 8 files changed, 51 insertions(+), 39 deletions(-)

diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
index 3764d12..6188e29 100644
--- a/board/samsung/common/misc.c
+++ b/board/samsung/common/misc.c
@@ -6,9 +6,51 @@
  */
 
 #include <common.h>
+#include <lcd.h>
+#include <libtizen.h>
+
+#ifdef CONFIG_CMD_BMP
+static void draw_logo(void)
+{
+	int x, y;
+	ulong addr;
+
+#ifdef CONFIG_TIZEN
+	get_tizen_logo_info(&panel_info);
+#else
+	return;
+#endif
+
+	addr = panel_info.logo_addr;
+	if (!addr) {
+		error("There is no logo data.");
+		return;
+	}
+
+	if (panel_info.vl_width >= panel_info.logo_width) {
+		x = ((panel_info.vl_width - panel_info.logo_width) >> 1);
+	} else {
+		x = 0;
+		printf("Warning: image width is bigger than display width\n");
+	}
+
+	if (panel_info.vl_height >= panel_info.logo_height) {
+		y = ((panel_info.vl_height - panel_info.logo_height) >> 1);
+	} else {
+		y = 0;
+		printf("Warning: image height is bigger than display height\n");
+	}
+
+	bmp_display(addr, x, y);
+}
+#endif /* CONFIG_CMD_BMP */
 
 /* Common for Samsung boards */
 int misc_init_r(void)
 {
+#ifdef CONFIG_CMD_BMP
+	if (panel_info.logo_on)
+		draw_logo();
+#endif
 	return 0;
 }
diff --git a/board/samsung/trats/trats.c b/board/samsung/trats/trats.c
index 6bd106e..ce4b41f 100644
--- a/board/samsung/trats/trats.c
+++ b/board/samsung/trats/trats.c
@@ -767,9 +767,6 @@ void init_panel_info(vidinfo_t *vid)
 	vid->resolution	= HD_RESOLUTION,
 	vid->rgb_mode	= MODE_RGB_P,
 
-#ifdef CONFIG_TIZEN
-	get_tizen_logo_info(vid);
-#endif
 	mipi_lcd_device.reverse_panel = 1;
 
 	strcpy(s6e8ax0_platform_data.lcd_panel_name, mipi_lcd_device.name);
diff --git a/board/samsung/trats2/trats2.c b/board/samsung/trats2/trats2.c
index 2442d96..73b8cc1 100644
--- a/board/samsung/trats2/trats2.c
+++ b/board/samsung/trats2/trats2.c
@@ -573,10 +573,6 @@ void init_panel_info(vidinfo_t *vid)
 
 	mipi_lcd_device.reverse_panel = 1;
 
-#ifdef CONFIG_TIZEN
-	get_tizen_logo_info(vid);
-#endif
-
 	strcpy(dsim_platform_data.lcd_panel_name, mipi_lcd_device.name);
 	dsim_platform_data.mipi_power = mipi_power;
 	dsim_platform_data.phy_enable = set_mipi_phy_ctrl;
diff --git a/board/samsung/universal_c210/universal.c b/board/samsung/universal_c210/universal.c
index 54d0e1e..166d5ee 100644
--- a/board/samsung/universal_c210/universal.c
+++ b/board/samsung/universal_c210/universal.c
@@ -484,10 +484,6 @@ void init_panel_info(vidinfo_t *vid)
 	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;
diff --git a/drivers/video/exynos_fb.c b/drivers/video/exynos_fb.c
index 7d4c6e0..00a0a11 100644
--- a/drivers/video/exynos_fb.c
+++ b/drivers/video/exynos_fb.c
@@ -62,31 +62,6 @@ static void exynos_lcd_init(vidinfo_t *vid)
 	lcd_set_flush_dcache(1);
 }
 
-#ifdef CONFIG_CMD_BMP
-static void draw_logo(void)
-{
-	int x, y;
-	ulong addr;
-
-	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);
-}
-#endif
-
 void __exynos_cfg_lcd_gpio(void)
 {
 }
@@ -323,9 +298,6 @@ void lcd_enable(void)
 	if (panel_info.logo_on) {
 		memset((void *) gd->fb_base, 0, panel_width * panel_height *
 				(NBITS(panel_info.vl_bpix) >> 3));
-#ifdef CONFIG_CMD_BMP
-		draw_logo();
-#endif
 	}
 
 	lcd_panel_on(&panel_info);
diff --git a/include/configs/s5pc210_universal.h b/include/configs/s5pc210_universal.h
index 02a1c99..8a749f2 100644
--- a/include/configs/s5pc210_universal.h
+++ b/include/configs/s5pc210_universal.h
@@ -269,6 +269,9 @@ void universal_spi_sda(int bit);
 int universal_spi_read(void);
 #endif
 
+/* Common misc for Samsung */
+#define CONFIG_MISC_INIT_R
+
 /*
  * LCD Settings
  */
diff --git a/include/configs/trats.h b/include/configs/trats.h
index 2b07fe0..1b20823 100644
--- a/include/configs/trats.h
+++ b/include/configs/trats.h
@@ -310,6 +310,9 @@
 #define CONFIG_USB_GADGET_VBUS_DRAW	2
 #define CONFIG_USB_CABLE_CHECK
 
+/* Common misc for Samsung */
+#define CONFIG_MISC_INIT_R
+
 /* LCD */
 #define CONFIG_EXYNOS_FB
 #define CONFIG_LCD
diff --git a/include/configs/trats2.h b/include/configs/trats2.h
index 18270c1..a00bfc9 100644
--- a/include/configs/trats2.h
+++ b/include/configs/trats2.h
@@ -316,6 +316,9 @@
 #define CONFIG_USB_GADGET_VBUS_DRAW	2
 #define CONFIG_USB_CABLE_CHECK
 
+/* Common misc for Samsung */
+#define CONFIG_MISC_INIT_R
+
 /* LCD */
 #define CONFIG_EXYNOS_FB
 #define CONFIG_LCD
-- 
1.7.9.5

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

* [U-Boot] [PATCH v2 06/13] common: makefile: Add optional cflags to object: common/lcd.o
  2013-12-18 18:31 ` [U-Boot] [PATCH v2 00/13] " Przemyslaw Marczak
                     ` (4 preceding siblings ...)
  2013-12-18 18:31   ` [U-Boot] [PATCH v2 05/13] samsung: misc: move display logo function to misc.c file Przemyslaw Marczak
@ 2013-12-18 18:31   ` Przemyslaw Marczak
  2013-12-19  5:44     ` Inha Song
  2014-01-02  6:35     ` Minkyu Kang
  2013-12-18 18:31   ` [U-Boot] [PATCH v2 07/13] lib: tizen: change Tizen logo with the new one Przemyslaw Marczak
                     ` (6 subsequent siblings)
  12 siblings, 2 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2013-12-18 18:31 UTC (permalink / raw)
  To: u-boot

This change adds CFLAGS: -mno-unaligned-access
which depends on option: PLATFORM_NO_UNALIGNED

This option avoids unaligned data access exception on armv7, caused
by access to logo data which is mostly unaligned initialized array.

more info: README.arm-unaligned-accesses

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>

---
Changes v2:
- new patch
---
 common/Makefile |    1 +
 1 file changed, 1 insertion(+)

diff --git a/common/Makefile b/common/Makefile
index 74404be..619d72c 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -240,3 +240,4 @@ $(obj)env_embedded.o: $(src)env_embedded.c
 # SEE README.arm-unaligned-accesses
 $(obj)hush.o: CFLAGS += $(PLATFORM_NO_UNALIGNED)
 $(obj)fdt_support.o: CFLAGS += $(PLATFORM_NO_UNALIGNED)
+$(obj)lcd.o: CFLAGS += $(PLATFORM_NO_UNALIGNED)
-- 
1.7.9.5

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

* [U-Boot] [PATCH v2 07/13] lib: tizen: change Tizen logo with the new one.
  2013-12-18 18:31 ` [U-Boot] [PATCH v2 00/13] " Przemyslaw Marczak
                     ` (5 preceding siblings ...)
  2013-12-18 18:31   ` [U-Boot] [PATCH v2 06/13] common: makefile: Add optional cflags to object: common/lcd.o Przemyslaw Marczak
@ 2013-12-18 18:31   ` Przemyslaw Marczak
  2013-12-19  5:40     ` 황형원
  2013-12-18 18:31   ` [U-Boot] [PATCH v2 08/13] video: exynos: fimd: add support for various display color modes Przemyslaw Marczak
                     ` (5 subsequent siblings)
  12 siblings, 1 reply; 147+ messages in thread
From: Przemyslaw Marczak @ 2013-12-18 18:31 UTC (permalink / raw)
  To: u-boot

This is big size patch.
PLease follow the link: http://www.denx.de/wiki/pub/U-Boot/TooBigPatches/0007-lib-tizen-change-Tizen-logo-with-the-new-one.patch

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

* [U-Boot] [PATCH v2 08/13] video: exynos: fimd: add support for various display color modes
  2013-12-18 18:31 ` [U-Boot] [PATCH v2 00/13] " Przemyslaw Marczak
                     ` (6 preceding siblings ...)
  2013-12-18 18:31   ` [U-Boot] [PATCH v2 07/13] lib: tizen: change Tizen logo with the new one Przemyslaw Marczak
@ 2013-12-18 18:31   ` Przemyslaw Marczak
  2013-12-19  5:08     ` Donghwa Lee
  2013-12-18 18:31   ` [U-Boot] [PATCH v2 09/13] samsung: boards: update display configs with 16bpp mode Przemyslaw Marczak
                     ` (4 subsequent siblings)
  12 siblings, 1 reply; 147+ messages in thread
From: Przemyslaw Marczak @ 2013-12-18 18:31 UTC (permalink / raw)
  To: u-boot

Now fimd BPP color mode depends on vl_bpp value in struct "panel_info".

There is only 16BPP mode check, default mode is 24BPP.
Other fimd modes are usually unneeded and also needs some fimd driver
modifications and tests.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>

---
Changes v2:
- check panel_info vl_bpix when setting fimd color mode
- move boards configs update to another commit.
---
 drivers/video/exynos_fimd.c |   15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/video/exynos_fimd.c b/drivers/video/exynos_fimd.c
index f962c4f..cebbba7 100644
--- a/drivers/video/exynos_fimd.c
+++ b/drivers/video/exynos_fimd.c
@@ -73,18 +73,19 @@ static void exynos_fimd_set_par(unsigned int win_id)
 	/* DATAPATH is DMA */
 	cfg |= EXYNOS_WINCON_DATAPATH_DMA;
 
-	if (pvid->logo_on) /* To get proprietary LOGO */
-		cfg |= EXYNOS_WINCON_WSWP_ENABLE;
-	else /* To get output console on LCD */
-		cfg |= EXYNOS_WINCON_HAWSWP_ENABLE;
+	cfg |= EXYNOS_WINCON_HAWSWP_ENABLE;
 
 	/* dma burst is 16 */
 	cfg |= EXYNOS_WINCON_BURSTLEN_16WORD;
 
-	if (pvid->logo_on) /* To get proprietary LOGO */
-		cfg |= EXYNOS_WINCON_BPPMODE_24BPP_888;
-	else /* To get output console on LCD */
+	switch (pvid->vl_bpix) {
+	case 4:
 		cfg |= EXYNOS_WINCON_BPPMODE_16BPP_565;
+		break;
+	default:
+		cfg |= EXYNOS_WINCON_BPPMODE_24BPP_888;
+		break;
+	}
 
 	writel(cfg, (unsigned int)&fimd_ctrl->wincon0 +
 			EXYNOS_WINCON(win_id));
-- 
1.7.9.5

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

* [U-Boot] [PATCH v2 09/13] samsung: boards: update display configs with 16bpp mode.
  2013-12-18 18:31 ` [U-Boot] [PATCH v2 00/13] " Przemyslaw Marczak
                     ` (7 preceding siblings ...)
  2013-12-18 18:31   ` [U-Boot] [PATCH v2 08/13] video: exynos: fimd: add support for various display color modes Przemyslaw Marczak
@ 2013-12-18 18:31   ` Przemyslaw Marczak
  2013-12-18 18:31   ` [U-Boot] [PATCH v2 10/13] samsung: misc: Add LCD download menu Przemyslaw Marczak
                     ` (3 subsequent siblings)
  12 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2013-12-18 18:31 UTC (permalink / raw)
  To: u-boot

16 bpp mode is required by LCD console mode.
This change updates exynos board files.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>

---
Changes v2:
-- new patch
---
 board/samsung/trats/trats.c              |    2 +-
 board/samsung/trats2/trats2.c            |    2 +-
 board/samsung/universal_c210/universal.c |    2 +-
 include/configs/s5pc210_universal.h      |    2 +-
 include/configs/trats.h                  |    2 +-
 include/configs/trats2.h                 |    2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/board/samsung/trats/trats.c b/board/samsung/trats/trats.c
index ce4b41f..db527c7 100644
--- a/board/samsung/trats/trats.c
+++ b/board/samsung/trats/trats.c
@@ -739,7 +739,7 @@ vidinfo_t panel_info = {
 	.vl_hsp		= CONFIG_SYS_LOW,
 	.vl_vsp		= CONFIG_SYS_LOW,
 	.vl_dp		= CONFIG_SYS_LOW,
-	.vl_bpix	= 5,	/* Bits per pixel, 2^5 = 32 */
+	.vl_bpix	= 4,	/* Bits per pixel, 2^4 = 16 */
 
 	/* s6e8ax0 Panel infomation */
 	.vl_hspw	= 5,
diff --git a/board/samsung/trats2/trats2.c b/board/samsung/trats2/trats2.c
index 73b8cc1..6fa02c9 100644
--- a/board/samsung/trats2/trats2.c
+++ b/board/samsung/trats2/trats2.c
@@ -542,7 +542,7 @@ vidinfo_t panel_info = {
 	.vl_hsp		= CONFIG_SYS_LOW,
 	.vl_vsp		= CONFIG_SYS_LOW,
 	.vl_dp		= CONFIG_SYS_LOW,
-	.vl_bpix	= 5,	/* Bits per pixel, 2^5 = 32 */
+	.vl_bpix	= 4,	/* Bits per pixel, 2^4 = 16 */
 
 	/* s6e8ax0 Panel infomation */
 	.vl_hspw	= 5,
diff --git a/board/samsung/universal_c210/universal.c b/board/samsung/universal_c210/universal.c
index 166d5ee..1ebea0f 100644
--- a/board/samsung/universal_c210/universal.c
+++ b/board/samsung/universal_c210/universal.c
@@ -446,7 +446,7 @@ vidinfo_t panel_info = {
 	.vl_vsp		= CONFIG_SYS_HIGH,
 	.vl_dp		= CONFIG_SYS_HIGH,
 
-	.vl_bpix	= 5,	/* Bits per pixel */
+	.vl_bpix	= 4,	/* Bits per pixel */
 
 	/* LD9040 LCD Panel */
 	.vl_hspw	= 2,
diff --git a/include/configs/s5pc210_universal.h b/include/configs/s5pc210_universal.h
index 3c0a974..4079b7c 100644
--- a/include/configs/s5pc210_universal.h
+++ b/include/configs/s5pc210_universal.h
@@ -278,7 +278,7 @@ int universal_spi_read(void);
 #define CONFIG_EXYNOS_FB
 #define CONFIG_LCD
 #define CONFIG_CMD_BMP
-#define CONFIG_BMP_32BPP
+#define CONFIG_BMP_16BPP
 #define CONFIG_LD9040
 #define CONFIG_EXYNOS_MIPI_DSIM
 #define CONFIG_VIDEO_BMP_GZIP
diff --git a/include/configs/trats.h b/include/configs/trats.h
index 6bc14f7..a887d74 100644
--- a/include/configs/trats.h
+++ b/include/configs/trats.h
@@ -317,7 +317,7 @@
 #define CONFIG_EXYNOS_FB
 #define CONFIG_LCD
 #define CONFIG_CMD_BMP
-#define CONFIG_BMP_32BPP
+#define CONFIG_BMP_16BPP
 #define CONFIG_FB_ADDR		0x52504000
 #define CONFIG_S6E8AX0
 #define CONFIG_EXYNOS_MIPI_DSIM
diff --git a/include/configs/trats2.h b/include/configs/trats2.h
index b65afc4..80d3ed0 100644
--- a/include/configs/trats2.h
+++ b/include/configs/trats2.h
@@ -323,7 +323,7 @@
 #define CONFIG_EXYNOS_FB
 #define CONFIG_LCD
 #define CONFIG_CMD_BMP
-#define CONFIG_BMP_32BPP
+#define CONFIG_BMP_16BPP
 #define CONFIG_FB_ADDR		0x52504000
 #define CONFIG_S6E8AX0
 #define CONFIG_EXYNOS_MIPI_DSIM
-- 
1.7.9.5

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

* [U-Boot] [PATCH v2 10/13] samsung: misc: Add LCD download menu.
  2013-12-18 18:31 ` [U-Boot] [PATCH v2 00/13] " Przemyslaw Marczak
                     ` (8 preceding siblings ...)
  2013-12-18 18:31   ` [U-Boot] [PATCH v2 09/13] samsung: boards: update display configs with 16bpp mode Przemyslaw Marczak
@ 2013-12-18 18:31   ` Przemyslaw Marczak
  2013-12-18 18:31   ` [U-Boot] [PATCH v2 11/13] Trats: add LCD download menu support Przemyslaw Marczak
                     ` (2 subsequent siblings)
  12 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2013-12-18 18:31 UTC (permalink / raw)
  To: u-boot

This simple LCD menu allows run one of download mode on device
without writing on console or for fast and easy upgrade.
This feature check user keys combination at boot:
- power key + volume up - download menu
- power key + volume down - thor mode (without menu)

New configs:
- CONFIG_LCD_MENU
- CONFIG_LCD_MENU_BOARD
which depends on: CONFIG_MISC_INIT_R

For proper effect this feature needs following definitions:

Power key:
- KEY_PWR_PMIC_NAME - (string) pmic which supports power key check

Register address:
- KEY_PWR_STATUS_REG
- KEY_PWR_INTERRUPT_REG

Register power key mask:
- KEY_PWR_STATUS_MASK
- KEY_PWR_INTERRUPT_MASK

Gpio numbers:
- KEY_PWR_INTERRUPT_MASK
- KEY_VOL_DOWN_GPIO

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>

---
Changes v2:
- remove keys.h  - definitions should be in boards headers
- add misc.h
- code cleanup
- extend commit msg by more informations
---
 board/samsung/common/misc.c |  340 +++++++++++++++++++++++++++++++++++++++++++
 board/samsung/common/misc.h |   18 +++
 2 files changed, 358 insertions(+)
 create mode 100644 board/samsung/common/misc.h

diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
index 6188e29..caa8b7d 100644
--- a/board/samsung/common/misc.c
+++ b/board/samsung/common/misc.c
@@ -8,6 +8,341 @@
 #include <common.h>
 #include <lcd.h>
 #include <libtizen.h>
+#include <errno.h>
+#include <version.h>
+#include <asm/sizes.h>
+#include <asm/arch/cpu.h>
+#include <asm/arch/gpio.h>
+#include <asm/gpio.h>
+#include <linux/input.h>
+#include <lcd.h>
+#include <libtizen.h>
+#include <power/pmic.h>
+#include <mmc.h>
+#include "misc.h"
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#ifdef CONFIG_LCD_MENU
+static int power_key_pressed(int reg)
+{
+	struct pmic *pmic = pmic_get(KEY_PWR_PMIC_NAME);
+	u32 status = 0;
+	u32 mask;
+
+	if (pmic_probe(pmic))
+		return 0;
+
+	if (!pmic) {
+		printf("%s: Not found\n", KEY_PWR_PMIC_NAME);
+		return 0;
+	}
+
+	if (reg == KEY_PWR_STATUS_REG)
+		mask = KEY_PWR_STATUS_MASK;
+	else
+		mask = KEY_PWR_INTERRUPT_MASK;
+
+	if (pmic_reg_read(pmic, reg, &status))
+		return 0;
+
+	return !!(status & mask);
+}
+
+static int key_pressed(int key)
+{
+	int value = 0;
+
+	switch (key) {
+	case KEY_POWER:
+		value = power_key_pressed(KEY_PWR_INTERRUPT_REG);
+		break;
+	case KEY_VOLUMEUP:
+		value = !gpio_get_value(KEY_VOL_UP_GPIO);
+		break;
+	case KEY_VOLUMEDOWN:
+		value = !gpio_get_value(KEY_VOL_DOWN_GPIO);
+		break;
+	default:
+		break;
+	}
+
+	return value;
+}
+
+static int check_keys(void)
+{
+	int keys = 0;
+
+	if (key_pressed(KEY_POWER))
+		keys += KEY_POWER;
+	if (key_pressed(KEY_VOLUMEUP))
+		keys += KEY_VOLUMEUP;
+	if (key_pressed(KEY_VOLUMEDOWN))
+		keys += KEY_VOLUMEDOWN;
+
+	return keys;
+}
+
+/*
+ * 0 BOOT_MODE_INFO
+ * 1 BOOT_MODE_THOR
+ * 2 BOOT_MODE_UMS
+ * 3 BOOT_MODE_DFU
+ * 4 BOOT_MODE_EXIT
+*/
+static char *
+mode_name[BOOT_MODE_EXIT + 1] = {"DEVICE",
+				"THOR",
+				"UMS",
+				"DFU",
+				"EXIT"};
+
+static char *
+mode_info[BOOT_MODE_EXIT + 1] = {"info",
+				 "downloader",
+				 "mass storage",
+				 "firmware update",
+				 "and run normal boot"};
+
+static char *
+mode_cmd[BOOT_MODE_EXIT + 1] = {"",
+				"thor 0 mmc 0",
+				"ums 0 mmc 0",
+				"dfu 0 mmc 0",
+				""};
+
+static void display_board_info(void)
+{
+	struct mmc *mmc = find_mmc_device(0);
+	vidinfo_t *vid = &panel_info;
+
+	lcd_position_cursor(4, 4);
+
+	lcd_printf("%s\n\t", U_BOOT_VERSION);
+	lcd_puts("\n\t\tBoard Info:\n");
+#ifdef CONFIG_BOARD_NAME
+	lcd_printf("\tBoard name: %s\n", CONFIG_BOARD_NAME);
+#endif
+#ifdef CONFIG_REVISION_TAG
+	lcd_printf("\tBoard rev: %u\n", get_board_rev());
+#endif
+	lcd_printf("\tDRAM banks: %u\n", CONFIG_NR_DRAM_BANKS);
+	lcd_printf("\tDRAM size: %u MB\n", gd->ram_size / SZ_1M);
+
+	if (mmc)
+		lcd_printf("\teMMC size: %llu MB\n", mmc->capacity / SZ_1M);
+
+	if (vid)
+		lcd_printf("\tDisplay resolution: %u x % u\n",
+			   vid->vl_col, vid->vl_row);
+
+	lcd_printf("\tDisplay BPP: %u\n", 1 << vid->vl_bpix);
+}
+
+static int mode_leave_menu(int mode)
+{
+	int mode_supported = 1;
+	int leave = 0;
+	char *exit_option;
+	char *exit_boot = "boot";
+	char *exit_back = "back";
+
+	switch (mode) {
+	case BOOT_MODE_INFO:
+#if !defined(CONFIG_LCD_MENU_BOARD)
+		mode_supported = 0;
+#endif
+		break;
+	case BOOT_MODE_THOR:
+#if !defined(CONFIG_CMD_THOR_DOWNLOAD)
+		mode_supported = 0;
+#endif
+		break;
+	case BOOT_MODE_UMS:
+#if !defined(CONFIG_CMD_USB_MASS_STORAGE)
+		mode_supported = 0;
+#endif
+		break;
+	case BOOT_MODE_DFU:
+#if !defined(CONFIG_CMD_DFU)
+		mode_supported = 0;
+#endif
+		break;
+	case BOOT_MODE_EXIT:
+		leave = 1;
+		goto exit;
+	default:
+		break;
+	}
+
+	lcd_clear();
+
+	if (mode_supported) {
+		if (mode) {
+			lcd_printf("\n\n\t%s %s\n", mode_name[mode],
+						    mode_info[mode]);
+			lcd_puts("\n\tDo not turn off device before finish!\n");
+
+			run_command(mode_cmd[mode], 0);
+			printf("Command finished\n");
+			lcd_clear();
+			lcd_printf("\n\n\t%s finished\n", mode_name[mode]);
+			exit_option = exit_boot;
+			leave = 1;
+		} else {
+			display_board_info();
+			exit_option = exit_back;
+			leave = 0;
+		}
+	} else {
+		lcd_puts("\n\n\tThis mode is not supported.\n");
+		exit_option = exit_back;
+		leave = 0;
+	}
+
+	lcd_printf("\n\n\tPress POWER KEY to %s\n", exit_option);
+
+	/* Wait for PWR key */
+	while (!key_pressed(KEY_POWER))
+		udelay(1000);
+exit:
+	lcd_clear();
+	return leave;
+}
+
+static void display_download_menu(int mode)
+{
+	char *menu_name = "Download Mode Menu";
+	char *indicator = "[=>]";
+	char *blank = "[  ]";
+	char *selection[BOOT_MODE_EXIT + 1];
+	int i;
+
+	for (i = 0; i <= BOOT_MODE_EXIT; i++)
+		selection[i] = blank;
+
+	selection[mode] = indicator;
+
+	lcd_clear();
+	lcd_printf("\n\t\t%s\n", menu_name);
+
+	for (i = 0; i <= BOOT_MODE_EXIT; i++)
+		lcd_printf("\t%s  %s - %s\n\n", selection[i],
+						mode_name[i],
+						mode_info[i]);
+}
+
+static void download_menu(void)
+{
+	int mode = 0;
+	int last_mode = 0;
+	int run;
+	int key;
+
+	display_download_menu(mode);
+
+	while (1) {
+		run = 0;
+
+		if (mode != last_mode)
+			display_download_menu(mode);
+
+		last_mode = mode;
+		udelay(100000);
+
+		key = check_keys();
+		switch (key) {
+		case KEY_POWER:
+			run = 1;
+			break;
+		case KEY_VOLUMEUP:
+			if (mode > 0)
+				mode--;
+			break;
+		case KEY_VOLUMEDOWN:
+			if (mode < BOOT_MODE_EXIT)
+				mode++;
+			break;
+		default:
+			break;
+		}
+
+		if (run) {
+			if (mode_leave_menu(mode))
+				break;
+
+			display_download_menu(mode);
+		}
+	}
+
+	lcd_clear();
+}
+
+static void display_mode_info(void)
+{
+	lcd_position_cursor(4, 4);
+	lcd_printf("%s\n", U_BOOT_VERSION);
+	lcd_puts("\nDownload Mode Menu\n");
+#ifdef CONFIG_BOARD_NAME
+	lcd_printf("Board name: %s\n", CONFIG_BOARD_NAME);
+#endif
+	lcd_printf("Press POWER KEY to display MENU options.");
+}
+
+static int boot_menu(void)
+{
+	int key = 0;
+	int timeout = 10;
+
+	display_mode_info();
+
+	while (timeout--) {
+		lcd_printf("\rNormal boot will start in: %d seconds.", timeout);
+		udelay(1000000);
+
+		key = key_pressed(KEY_POWER);
+		if (key)
+			break;
+	}
+
+	lcd_clear();
+
+	/* If PWR pressed - show download menu */
+	if (key) {
+		printf("Power pressed - go to download menu\n");
+		udelay(1000000);
+		download_menu();
+		printf("Download mode exit.\n");
+	}
+
+	return 0;
+}
+
+static void check_boot_mode(void)
+{
+	int pwr_key;
+
+	pwr_key = power_key_pressed(KEY_PWR_STATUS_REG);
+	if (!pwr_key)
+		return;
+
+	/* Clear PWR button Rising edge interrupt status flag */
+	power_key_pressed(KEY_PWR_INTERRUPT_REG);
+
+	if (key_pressed(KEY_VOLUMEUP))
+		boot_menu();
+	else if (key_pressed(KEY_VOLUMEDOWN))
+		mode_leave_menu(BOOT_MODE_THOR);
+}
+
+static void keys_init(void)
+{
+	/* Set direction to input */
+	gpio_direction_input(KEY_VOL_UP_GPIO);
+	gpio_direction_input(KEY_VOL_DOWN_GPIO);
+}
+#endif /* CONFIG_LCD_MENU */
 
 #ifdef CONFIG_CMD_BMP
 static void draw_logo(void)
@@ -48,9 +383,14 @@ static void draw_logo(void)
 /* Common for Samsung boards */
 int misc_init_r(void)
 {
+#ifdef CONFIG_LCD_MENU
+	keys_init();
+	check_boot_mode();
+#endif
 #ifdef CONFIG_CMD_BMP
 	if (panel_info.logo_on)
 		draw_logo();
 #endif
+
 	return 0;
 }
diff --git a/board/samsung/common/misc.h b/board/samsung/common/misc.h
new file mode 100644
index 0000000..f583552
--- /dev/null
+++ b/board/samsung/common/misc.h
@@ -0,0 +1,18 @@
+#ifndef __SAMSUNG_COMMON_MISC_H__
+#define __SAMSUNG_COMMON_MISC_H__
+
+#ifdef CONFIG_LCD_MENU
+enum {
+	BOOT_MODE_INFO,
+	BOOT_MODE_THOR,
+	BOOT_MODE_UMS,
+	BOOT_MODE_DFU,
+	BOOT_MODE_EXIT,
+};
+
+#ifdef CONFIG_REVISION_TAG
+u32 get_board_rev(void);
+#endif
+#endif /* CONFIG_LCD_MENU */
+
+#endif /* __SAMSUNG_COMMON_MISC_H__ */
\ No newline@end of file
-- 
1.7.9.5

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

* [U-Boot] [PATCH v2 11/13] Trats: add LCD download menu support
  2013-12-18 18:31 ` [U-Boot] [PATCH v2 00/13] " Przemyslaw Marczak
                     ` (9 preceding siblings ...)
  2013-12-18 18:31   ` [U-Boot] [PATCH v2 10/13] samsung: misc: Add LCD download menu Przemyslaw Marczak
@ 2013-12-18 18:31   ` Przemyslaw Marczak
  2013-12-18 18:31   ` [U-Boot] [PATCH v2 12/13] trats2: " Przemyslaw Marczak
  2013-12-18 18:31   ` [U-Boot] [PATCH v2 13/13] universal: " Przemyslaw Marczak
  12 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2013-12-18 18:31 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Lukasz Majewski <l.majewski@samsung.com>

---
changes v2:
- add definitions to check keys
- cleanup config definitions
- add acked-by
---
 include/configs/trats.h |   23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/include/configs/trats.h b/include/configs/trats.h
index a887d74..a88346e 100644
--- a/include/configs/trats.h
+++ b/include/configs/trats.h
@@ -19,6 +19,7 @@
 #define CONFIG_EXYNOS4210	/* which is in a EXYNOS4210 */
 #define CONFIG_TRATS		/* working with TRATS */
 #define CONFIG_TIZEN		/* TIZEN lib */
+#define CONFIG_BOARD_NAME	"TRATS"
 
 #include <asm/arch/cpu.h>	/* get chip and board defs */
 
@@ -313,6 +314,28 @@
 /* Common misc for Samsung */
 #define CONFIG_MISC_INIT_R
 
+/* Download menu - Samsung common */
+#define CONFIG_LCD_MENU
+#define CONFIG_LCD_MENU_BOARD
+
+/* Download menu - definitions for check keys */
+#ifndef __ASSEMBLY__
+#include <power/max8997_pmic.h>
+
+#define KEY_PWR_PMIC_NAME		"MAX8997_PMIC"
+#define KEY_PWR_STATUS_REG		MAX8997_REG_STATUS1
+#define KEY_PWR_STATUS_MASK		(1 << 0)
+#define KEY_PWR_INTERRUPT_REG		MAX8997_REG_INT1
+#define KEY_PWR_INTERRUPT_MASK		(1 << 0)
+
+#define KEY_VOL_UP_GPIO			exynos4_gpio_get(2, x2, 0)
+#define KEY_VOL_DOWN_GPIO		exynos4_gpio_get(2, x2, 1)
+#endif /* __ASSEMBLY__ */
+
+/* LCD console */
+#define LCD_BPP			LCD_COLOR16
+#define CONFIG_SYS_WHITE_ON_BLACK
+
 /* LCD */
 #define CONFIG_EXYNOS_FB
 #define CONFIG_LCD
-- 
1.7.9.5

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

* [U-Boot] [PATCH v2 12/13] trats2: add LCD download menu support
  2013-12-18 18:31 ` [U-Boot] [PATCH v2 00/13] " Przemyslaw Marczak
                     ` (10 preceding siblings ...)
  2013-12-18 18:31   ` [U-Boot] [PATCH v2 11/13] Trats: add LCD download menu support Przemyslaw Marczak
@ 2013-12-18 18:31   ` Przemyslaw Marczak
  2014-01-02  6:34     ` Minkyu Kang
  2013-12-18 18:31   ` [U-Boot] [PATCH v2 13/13] universal: " Przemyslaw Marczak
  12 siblings, 1 reply; 147+ messages in thread
From: Przemyslaw Marczak @ 2013-12-18 18:31 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>

---
changes v2:
- add definitions for check keys
- cleanup config definitions
---
 include/configs/trats2.h |   27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/include/configs/trats2.h b/include/configs/trats2.h
index 80d3ed0..b0dcfa4 100644
--- a/include/configs/trats2.h
+++ b/include/configs/trats2.h
@@ -19,6 +19,8 @@
 #define CONFIG_S5P		/* which is in a S5P Family */
 #define CONFIG_EXYNOS4		/* which is in a EXYNOS4XXX */
 #define CONFIG_TIZEN		/* TIZEN lib */
+#define CONFIG_TRATS2
+#define CONFIG_BOARD_NAME	"TRATS2"
 
 #include <asm/arch/cpu.h>		/* get chip and board defs */
 
@@ -319,6 +321,31 @@
 /* Common misc for Samsung */
 #define CONFIG_MISC_INIT_R
 
+/* Download menu - Samsung common */
+#define CONFIG_LCD_MENU
+#define CONFIG_LCD_MENU_BOARD
+
+/* Download menu - definitions for check keys */
+#ifndef __ASSEMBLY__
+#ifdef __COMMON_H_
+#include <power/pmic.h>
+#include <power/max77686_pmic.h>
+
+#define KEY_PWR_PMIC_NAME		"MAX77686_PMIC"
+#define KEY_PWR_STATUS_REG		MAX77686_REG_PMIC_STATUS1
+#define KEY_PWR_STATUS_MASK		(1 << 0)
+#define KEY_PWR_INTERRUPT_REG		MAX77686_REG_PMIC_INT1
+#define KEY_PWR_INTERRUPT_MASK		(1 << 1)
+
+#define KEY_VOL_UP_GPIO			exynos4x12_gpio_get(2, x2, 2)
+#define KEY_VOL_DOWN_GPIO		exynos4x12_gpio_get(2, x3, 3)
+#endif /* __COMMON_H_ */
+#endif /* __ASSEMBLY__ */
+
+/* LCD console */
+#define LCD_BPP                 LCD_COLOR16
+#define CONFIG_SYS_WHITE_ON_BLACK
+
 /* LCD */
 #define CONFIG_EXYNOS_FB
 #define CONFIG_LCD
-- 
1.7.9.5

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

* [U-Boot] [PATCH v2 13/13] universal: add LCD download menu support
  2013-12-18 18:31 ` [U-Boot] [PATCH v2 00/13] " Przemyslaw Marczak
                     ` (11 preceding siblings ...)
  2013-12-18 18:31   ` [U-Boot] [PATCH v2 12/13] trats2: " Przemyslaw Marczak
@ 2013-12-18 18:31   ` Przemyslaw Marczak
  12 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2013-12-18 18:31 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>

---
changes v2:
- add definitions for check keys
- cleanup config definitions
---
 include/configs/s5pc210_universal.h |   23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/include/configs/s5pc210_universal.h b/include/configs/s5pc210_universal.h
index 4079b7c..bfed7f1 100644
--- a/include/configs/s5pc210_universal.h
+++ b/include/configs/s5pc210_universal.h
@@ -19,6 +19,7 @@
 #define CONFIG_EXYNOS4210	1	/* which is in a EXYNOS4210 */
 #define CONFIG_UNIVERSAL	1	/* working with Universal */
 #define CONFIG_TIZEN		1	/* TIZEN lib */
+#define CONFIG_BOARD_NAME	"UNIVERSAL C210"
 
 #include <asm/arch/cpu.h>		/* get chip and board defs */
 
@@ -272,6 +273,28 @@ int universal_spi_read(void);
 /* Common misc for Samsung */
 #define CONFIG_MISC_INIT_R
 
+/* Download menu - Samsung common */
+#define CONFIG_LCD_MENU
+#define CONFIG_LCD_MENU_BOARD
+
+/* Download menu - definitions for check keys */
+#ifndef __ASSEMBLY__
+#include <power/max8998_pmic.h>
+
+#define KEY_PWR_PMIC_NAME		"MAX8998_PMIC"
+#define KEY_PWR_STATUS_REG		MAX8998_REG_STATUS1
+#define KEY_PWR_STATUS_MASK		(1 << 7)
+#define KEY_PWR_INTERRUPT_REG		MAX8998_REG_IRQ1
+#define KEY_PWR_INTERRUPT_MASK		(1 << 7)
+
+#define KEY_VOL_UP_GPIO			exynos4_gpio_get(2, x2, 0)
+#define KEY_VOL_DOWN_GPIO		exynos4_gpio_get(2, x2, 1)
+#endif /* __ASSEMBLY__ */
+
+/* LCD console */
+#define LCD_BPP			LCD_COLOR16
+#define CONFIG_SYS_WHITE_ON_BLACK
+
 /*
  * LCD Settings
  */
-- 
1.7.9.5

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

* [U-Boot] [PATCH v2 08/13] video: exynos: fimd: add support for various display color modes
  2013-12-18 18:31   ` [U-Boot] [PATCH v2 08/13] video: exynos: fimd: add support for various display color modes Przemyslaw Marczak
@ 2013-12-19  5:08     ` Donghwa Lee
  0 siblings, 0 replies; 147+ messages in thread
From: Donghwa Lee @ 2013-12-19  5:08 UTC (permalink / raw)
  To: u-boot

Hi,

On 19 Dec, 2013 03:31, Przemyslaw Marczak wrote:
> Now fimd BPP color mode depends on vl_bpp value in struct "panel_info".
>
> There is only 16BPP mode check, default mode is 24BPP.
> Other fimd modes are usually unneeded and also needs some fimd driver
> modifications and tests.
>
> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
>
> ---
> Changes v2:
> - check panel_info vl_bpix when setting fimd color mode
> - move boards configs update to another commit.
> ---
>  drivers/video/exynos_fimd.c |   15 ++++++++-------
>  1 file changed, 8 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/video/exynos_fimd.c b/drivers/video/exynos_fimd.c
> index f962c4f..cebbba7 100644
> --- a/drivers/video/exynos_fimd.c
> +++ b/drivers/video/exynos_fimd.c
> @@ -73,18 +73,19 @@ static void exynos_fimd_set_par(unsigned int win_id)
>  	/* DATAPATH is DMA */
>  	cfg |= EXYNOS_WINCON_DATAPATH_DMA;
>  
> -	if (pvid->logo_on) /* To get proprietary LOGO */
> -		cfg |= EXYNOS_WINCON_WSWP_ENABLE;
> -	else /* To get output console on LCD */
> -		cfg |= EXYNOS_WINCON_HAWSWP_ENABLE;
> +	cfg |= EXYNOS_WINCON_HAWSWP_ENABLE;
>  
>  	/* dma burst is 16 */
>  	cfg |= EXYNOS_WINCON_BURSTLEN_16WORD;
>  
> -	if (pvid->logo_on) /* To get proprietary LOGO */
> -		cfg |= EXYNOS_WINCON_BPPMODE_24BPP_888;
> -	else /* To get output console on LCD */
> +	switch (pvid->vl_bpix) {
> +	case 4:
>  		cfg |= EXYNOS_WINCON_BPPMODE_16BPP_565;
> +		break;
> +	default:
> +		cfg |= EXYNOS_WINCON_BPPMODE_24BPP_888;
> +		break;
> +	}
>  
>  	writel(cfg, (unsigned int)&fimd_ctrl->wincon0 +
>  			EXYNOS_WINCON(win_id));

It looks good to me.
Acked-by: Donghwa Lee <dh09.lee@samsung.com>

BR,
Donghwa Lee.

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

* [U-Boot] [PATCH v2 07/13] lib: tizen: change Tizen logo with the new one.
  2013-12-18 18:31   ` [U-Boot] [PATCH v2 07/13] lib: tizen: change Tizen logo with the new one Przemyslaw Marczak
@ 2013-12-19  5:40     ` 황형원
  2013-12-19 10:40       ` Przemyslaw Marczak
  0 siblings, 1 reply; 147+ messages in thread
From: 황형원 @ 2013-12-19  5:40 UTC (permalink / raw)
  To: u-boot

Hi, Marczak.

Is this logo image what I sent you before?

It's a little different what we use,
and also the logo image is not aligned center horizontally.

Best regards,
Hyungwon Hwang

-----Original Message-----
From: Przemyslaw Marczak [mailto:p.marczak at samsung.com] 
Sent: Thursday, December 19, 2013 3:32 AM
To: u-boot at lists.denx.de
Cc: Przemyslaw Marczak; mk7.kang at samsung.com; human.hwang at samsung.com; dh09.
lee at samsung.com; l.majewski at samsung.com; ideal.song at samsung.com
Subject: [PATCH v2 07/13] lib: tizen: change Tizen logo with the new one.

This is big size patch.
PLease follow the link: http://www.denx.de/wiki/pub/U-
Boot/TooBigPatches/0007-lib-tizen-change-Tizen-logo-with-the-new-one.patch

---
Hyungwon Hwang
Samsung SWC S/W Platform Team
Smasung Electronics
human.hwang at samsung.com

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

* [U-Boot] [PATCH v2 06/13] common: makefile: Add optional cflags to object: common/lcd.o
  2013-12-18 18:31   ` [U-Boot] [PATCH v2 06/13] common: makefile: Add optional cflags to object: common/lcd.o Przemyslaw Marczak
@ 2013-12-19  5:44     ` Inha Song
  2014-01-02  6:35     ` Minkyu Kang
  1 sibling, 0 replies; 147+ messages in thread
From: Inha Song @ 2013-12-19  5:44 UTC (permalink / raw)
  To: u-boot


Hi, Marczak

On Wed, 18 Dec 2013 19:31:31 +0100
Przemyslaw Marczak <p.marczak@samsung.com> wrote:

> This change adds CFLAGS: -mno-unaligned-access
> which depends on option: PLATFORM_NO_UNALIGNED
> 
> This option avoids unaligned data access exception on armv7, caused
> by access to logo data which is mostly unaligned initialized array.
> 
> more info: README.arm-unaligned-accesses
> 
> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
> 
> ---
> Changes v2:
> - new patch
> ---
>  common/Makefile |    1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/common/Makefile b/common/Makefile
> index 74404be..619d72c 100644
> --- a/common/Makefile
> +++ b/common/Makefile
> @@ -240,3 +240,4 @@ $(obj)env_embedded.o: $(src)env_embedded.c
>  # SEE README.arm-unaligned-accesses
>  $(obj)hush.o: CFLAGS += $(PLATFORM_NO_UNALIGNED)
>  $(obj)fdt_support.o: CFLAGS += $(PLATFORM_NO_UNALIGNED)
> +$(obj)lcd.o: CFLAGS += $(PLATFORM_NO_UNALIGNED)
> -- 
> 1.7.9.5
> 

Certainly, unaligned data access exception doesn't occur on trats2 board.
- arm-linux-gnueabi-gcc 4.6.3

Thank you.

-- 
Inha Song <ideal.song@samsung.com>

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

* [U-Boot] [PATCH v2 07/13] lib: tizen: change Tizen logo with the new one.
  2013-12-19  5:40     ` 황형원
@ 2013-12-19 10:40       ` Przemyslaw Marczak
  2013-12-20  5:07         ` Hyungwon Hwang
  0 siblings, 1 reply; 147+ messages in thread
From: Przemyslaw Marczak @ 2013-12-19 10:40 UTC (permalink / raw)
  To: u-boot

Hello Hyungwon,

On 12/19/2013 06:40 AM, ??? wrote:
> Hi, Marczak.
> 
> Is this logo image what I sent you before?
> 
> It's a little different what we use,
> and also the logo image is not aligned center horizontally.
> 
> Best regards,
> Hyungwon Hwang
> 

This is not a logo which you sent me. Your logo has 24BPP and actually
it has displayed correctly because of fimd 24bpp mode. When I tried to
convert it to 16bpp with gimp, it was not displayed correctly in 16bpp
mode, there was some lines shift on display so I took logo from
tizen.org and resized it to 500x160 - now it's looking good.

This is the logo location:
https://download.tizen.org/misc/Tizen-Brand/01-Primary-Assets/Lockup/On-Dark/01-RGB/Tizen-Lockup-On-Dark-RGB.png

I can add some x and y offsets to make word "TIZEN" aligned center.
If this logo is really bad, then can you share logo in PNG format? Or
BMP 16bpp?

Regards.
-- 
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com

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

* [U-Boot] [PATCH v2 07/13] lib: tizen: change Tizen logo with the new one.
  2013-12-19 10:40       ` Przemyslaw Marczak
@ 2013-12-20  5:07         ` Hyungwon Hwang
  2013-12-20 11:50           ` Przemyslaw Marczak
  0 siblings, 1 reply; 147+ messages in thread
From: Hyungwon Hwang @ 2013-12-20  5:07 UTC (permalink / raw)
  To: u-boot

Hi, Marczak

On Thu, 19 Dec 2013 11:40:26 +0100
Przemyslaw Marczak <p.marczak@samsung.com> wrote:

> Hello Hyungwon,
> 
> On 12/19/2013 06:40 AM, ??? wrote:
> > Hi, Marczak.
> > 
> > Is this logo image what I sent you before?
> > 
> > It's a little different what we use,
> > and also the logo image is not aligned center horizontally.
> > 
> > Best regards,
> > Hyungwon Hwang
> > 
> 
> This is not a logo which you sent me. Your logo has 24BPP and actually
> it has displayed correctly because of fimd 24bpp mode. When I tried to
> convert it to 16bpp with gimp, it was not displayed correctly in 16bpp
> mode, there was some lines shift on display so I took logo from
> tizen.org and resized it to 500x160 - now it's looking good.
> 
> This is the logo location:
> https://download.tizen.org/misc/Tizen-Brand/01-Primary-Assets/Lockup/On-Dark/01-RGB/Tizen-Lockup-On-Dark-RGB.png
> 
> I can add some x and y offsets to make word "TIZEN" aligned center.
> If this logo is really bad, then can you share logo in PNG format? Or
> BMP 16bpp?

The logo file is OK. Could you adjust alignment?
Also, I think that anti-aliasing is needed.
We can see stair-stepping appearance in diagonal lines.
Can you fix it?

> 
> Regards.



---
Hyungwon Hwang
Samsung SWC S/W Platform Team
Smasung Electronics
human.hwang at samsung.com

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

* [U-Boot] [PATCH v2 07/13] lib: tizen: change Tizen logo with the new one.
  2013-12-20  5:07         ` Hyungwon Hwang
@ 2013-12-20 11:50           ` Przemyslaw Marczak
  2013-12-25 23:39             ` Hyungwon Hwang
  0 siblings, 1 reply; 147+ messages in thread
From: Przemyslaw Marczak @ 2013-12-20 11:50 UTC (permalink / raw)
  To: u-boot

Dear Hyungwon,

On 12/20/2013 06:07 AM, Hyungwon Hwang wrote:
> Hi, Marczak
>
> On Thu, 19 Dec 2013 11:40:26 +0100
> Przemyslaw Marczak <p.marczak@samsung.com> wrote:
>
>> Hello Hyungwon,
>>
>> On 12/19/2013 06:40 AM, ??? wrote:
>>> Hi, Marczak.
>>>
>>> Is this logo image what I sent you before?
>>>
>>> It's a little different what we use,
>>> and also the logo image is not aligned center horizontally.
>>>
>>> Best regards,
>>> Hyungwon Hwang
>>>
>>
>> This is not a logo which you sent me. Your logo has 24BPP and actually
>> it has displayed correctly because of fimd 24bpp mode. When I tried to
>> convert it to 16bpp with gimp, it was not displayed correctly in 16bpp
>> mode, there was some lines shift on display so I took logo from
>> tizen.org and resized it to 500x160 - now it's looking good.
>>
>> This is the logo location:
>> https://download.tizen.org/misc/Tizen-Brand/01-Primary-Assets/Lockup/On-Dark/01-RGB/Tizen-Lockup-On-Dark-RGB.png
>>
>> I can add some x and y offsets to make word "TIZEN" aligned center.
>> If this logo is really bad, then can you share logo in PNG format? Or
>> BMP 16bpp?
>
> The logo file is OK. Could you adjust alignment?
> Also, I think that anti-aliasing is needed.
> We can see stair-stepping appearance in diagonal lines.
> Can you fix it?
>
>>
>> Regards.
>
>
>
> ---
> Hyungwon Hwang
> Samsung SWC S/W Platform Team
> Smasung Electronics
> human.hwang at samsung.com
>

You're right the picture size scalling method which I have chosen was 
not good enough. I fixed it and now logo quality is much better. I also 
introduced logo x and y offset in struct vidinfo, so function get logo 
will be looking like this:

file: lib/tizen/tizen.c

  void get_tizen_logo_info(vidinfo_t *vid)
  {
-	switch (vid->resolution) {
-	case HD_RESOLUTION:
-		vid->logo_width = TIZEN_HD_LOGO_WIDTH;
-		vid->logo_height = TIZEN_HD_LOGO_HEIGHT;
-		vid->logo_addr = (ulong)tizen_hd_logo;
+	switch (vid->vl_bpix) {
+	case 4:
+		vid->logo_width = TIZEN_LOGO_16BPP_WIDTH;
+		vid->logo_height = TIZEN_LOGO_16BPP_HEIGHT;
+		vid->logo_x_offset = TIZEN_LOGO_16BPP_X_OFFSET;
+		vid->logo_y_offset = TIZEN_LOGO_16BPP_Y_OFFSET;
+#if defined(CONFIG_VIDEO_BMP_GZIP)
+		vid->logo_addr = (ulong)tizen_logo_16bpp_gzip;
+#else
+		vid->logo_addr = (ulong)tizen_logo_16bpp;
+#endif
  		break;
  	default:
+		vid->logo_addr = 0;
  		break;
  	}
  }

and set logo position before display:
file: board/samsung/common/misc.c

	x = ((panel_info.vl_width - panel_info.logo_width) >> 1);
+	x += panel_info.logo_x_offset; /* For X center align */

	y = ((panel_info.vl_height - panel_info.logo_height) >> 1);
+	y += panel_info.logo_y_offset; /* For Y center align */

So every new logo in future could be simply center-aligned.
Is it ok?
Regards,

-- 
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com

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

* [U-Boot] [PATCH v2 07/13] lib: tizen: change Tizen logo with the new one.
  2013-12-20 11:50           ` Przemyslaw Marczak
@ 2013-12-25 23:39             ` Hyungwon Hwang
  2013-12-30 15:46               ` Przemyslaw Marczak
  0 siblings, 1 reply; 147+ messages in thread
From: Hyungwon Hwang @ 2013-12-25 23:39 UTC (permalink / raw)
  To: u-boot

Dear Marczak,

On Fri, 20 Dec 2013 12:50:11 +0100
Przemyslaw Marczak <p.marczak@samsung.com> wrote:

> Dear Hyungwon,
> 
> On 12/20/2013 06:07 AM, Hyungwon Hwang wrote:
> > Hi, Marczak
> >
> > On Thu, 19 Dec 2013 11:40:26 +0100
> > Przemyslaw Marczak <p.marczak@samsung.com> wrote:
> >
> >> Hello Hyungwon,
> >>
> >> On 12/19/2013 06:40 AM, ??? wrote:
> >>> Hi, Marczak.
> >>>
> >>> Is this logo image what I sent you before?
> >>>
> >>> It's a little different what we use,
> >>> and also the logo image is not aligned center horizontally.
> >>>
> >>> Best regards,
> >>> Hyungwon Hwang
> >>>
> >>
> >> This is not a logo which you sent me. Your logo has 24BPP and
> >> actually it has displayed correctly because of fimd 24bpp mode.
> >> When I tried to convert it to 16bpp with gimp, it was not
> >> displayed correctly in 16bpp mode, there was some lines shift on
> >> display so I took logo from tizen.org and resized it to 500x160 -
> >> now it's looking good.
> >>
> >> This is the logo location:
> >> https://download.tizen.org/misc/Tizen-Brand/01-Primary-Assets/Lockup/On-Dark/01-RGB/Tizen-Lockup-On-Dark-RGB.png
> >>
> >> I can add some x and y offsets to make word "TIZEN" aligned center.
> >> If this logo is really bad, then can you share logo in PNG format?
> >> Or BMP 16bpp?
> >
> > The logo file is OK. Could you adjust alignment?
> > Also, I think that anti-aliasing is needed.
> > We can see stair-stepping appearance in diagonal lines.
> > Can you fix it?
> >
> >>
> >> Regards.
> >
> >
> >
> > ---
> > Hyungwon Hwang
> > Samsung SWC S/W Platform Team
> > Smasung Electronics
> > human.hwang at samsung.com
> >
> 
> You're right the picture size scalling method which I have chosen was 
> not good enough. I fixed it and now logo quality is much better. I
> also introduced logo x and y offset in struct vidinfo, so function
> get logo will be looking like this:
> 
> file: lib/tizen/tizen.c
> 
>   void get_tizen_logo_info(vidinfo_t *vid)
>   {
> -	switch (vid->resolution) {
> -	case HD_RESOLUTION:
> -		vid->logo_width = TIZEN_HD_LOGO_WIDTH;
> -		vid->logo_height = TIZEN_HD_LOGO_HEIGHT;
> -		vid->logo_addr = (ulong)tizen_hd_logo;
> +	switch (vid->vl_bpix) {
> +	case 4:
> +		vid->logo_width = TIZEN_LOGO_16BPP_WIDTH;
> +		vid->logo_height = TIZEN_LOGO_16BPP_HEIGHT;
> +		vid->logo_x_offset = TIZEN_LOGO_16BPP_X_OFFSET;
> +		vid->logo_y_offset = TIZEN_LOGO_16BPP_Y_OFFSET;
> +#if defined(CONFIG_VIDEO_BMP_GZIP)
> +		vid->logo_addr = (ulong)tizen_logo_16bpp_gzip;
> +#else
> +		vid->logo_addr = (ulong)tizen_logo_16bpp;
> +#endif
>   		break;
>   	default:
> +		vid->logo_addr = 0;
>   		break;
>   	}
>   }
> 
> and set logo position before display:
> file: board/samsung/common/misc.c
> 
> 	x = ((panel_info.vl_width - panel_info.logo_width) >> 1);
> +	x += panel_info.logo_x_offset; /* For X center align */
> 
> 	y = ((panel_info.vl_height - panel_info.logo_height) >> 1);
> +	y += panel_info.logo_y_offset; /* For Y center align */
> 
> So every new logo in future could be simply center-aligned.
> Is it ok?
> Regards,
> 

Can you send the patch? I think that the code above omit the added
variable declaration. So I can't test it.
Thank you.

Best regards,
Hyungwon Hwang

---
Hyungwon Hwang
Samsung SWC S/W Platform Team
Smasung Electronics
human.hwang at samsung.com

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

* [U-Boot] [PATCH v2 07/13] lib: tizen: change Tizen logo with the new one.
  2013-12-25 23:39             ` Hyungwon Hwang
@ 2013-12-30 15:46               ` Przemyslaw Marczak
  0 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2013-12-30 15:46 UTC (permalink / raw)
  To: u-boot

Hello Hyungwon,

On 12/26/2013 12:39 AM, Hyungwon Hwang wrote:> Dear Marczak,
 >
 > On Fri, 20 Dec 2013 12:50:11 +0100
 > Przemyslaw Marczak <p.marczak@samsung.com> wrote:
 >
 >> Dear Hyungwon,
 >>
 >> On 12/20/2013 06:07 AM, Hyungwon Hwang wrote:
 >>> Hi, Marczak
 >>>
 >>> On Thu, 19 Dec 2013 11:40:26 +0100
 >>> Przemyslaw Marczak <p.marczak@samsung.com> wrote:
 >>>
 >>>> Hello Hyungwon,
 >>>>
 >>>> On 12/19/2013 06:40 AM, ??? wrote:
 >>>>> Hi, Marczak.
 >>>>>
 >>>>> Is this logo image what I sent you before?
 >>>>>
 >>>>> It's a little different what we use,
 >>>>> and also the logo image is not aligned center horizontally.
 >>>>>
 >>>>> Best regards,
 >>>>> Hyungwon Hwang
 >>>>>
 >>>>
 >>>> This is not a logo which you sent me. Your logo has 24BPP and
 >>>> actually it has displayed correctly because of fimd 24bpp mode.
 >>>> When I tried to convert it to 16bpp with gimp, it was not
 >>>> displayed correctly in 16bpp mode, there was some lines shift on
 >>>> display so I took logo from tizen.org and resized it to 500x160 -
 >>>> now it's looking good.
 >>>>
 >>>> This is the logo location:
 >>>> 
https://download.tizen.org/misc/Tizen-Brand/01-Primary-Assets/Lockup/On-Dark/01-RGB/Tizen-Lockup-On-Dark-RGB.png
 >>>>
 >>>> I can add some x and y offsets to make word "TIZEN" aligned center.
 >>>> If this logo is really bad, then can you share logo in PNG format?
 >>>> Or BMP 16bpp?
 >>>
 >>> The logo file is OK. Could you adjust alignment?
 >>> Also, I think that anti-aliasing is needed.
 >>> We can see stair-stepping appearance in diagonal lines.
 >>> Can you fix it?
 >>>
 >>>>
 >>>> Regards.
 >>>
 >>>
 >>>
 >>> ---
 >>> Hyungwon Hwang
 >>> Samsung SWC S/W Platform Team
 >>> Smasung Electronics
 >>> human.hwang at samsung.com
 >>>
 >>
 >> You're right the picture size scalling method which I have chosen was
 >> not good enough. I fixed it and now logo quality is much better. I
 >> also introduced logo x and y offset in struct vidinfo, so function
 >> get logo will be looking like this:
 >>
 >> file: lib/tizen/tizen.c
 >>
 >>    void get_tizen_logo_info(vidinfo_t *vid)
 >>    {
 >> -	switch (vid->resolution) {
 >> -	case HD_RESOLUTION:
 >> -		vid->logo_width = TIZEN_HD_LOGO_WIDTH;
 >> -		vid->logo_height = TIZEN_HD_LOGO_HEIGHT;
 >> -		vid->logo_addr = (ulong)tizen_hd_logo;
 >> +	switch (vid->vl_bpix) {
 >> +	case 4:
 >> +		vid->logo_width = TIZEN_LOGO_16BPP_WIDTH;
 >> +		vid->logo_height = TIZEN_LOGO_16BPP_HEIGHT;
 >> +		vid->logo_x_offset = TIZEN_LOGO_16BPP_X_OFFSET;
 >> +		vid->logo_y_offset = TIZEN_LOGO_16BPP_Y_OFFSET;
 >> +#if defined(CONFIG_VIDEO_BMP_GZIP)
 >> +		vid->logo_addr = (ulong)tizen_logo_16bpp_gzip;
 >> +#else
 >> +		vid->logo_addr = (ulong)tizen_logo_16bpp;
 >> +#endif
 >>    		break;
 >>    	default:
 >> +		vid->logo_addr = 0;
 >>    		break;
 >>    	}
 >>    }
 >>
 >> and set logo position before display:
 >> file: board/samsung/common/misc.c
 >>
 >> 	x = ((panel_info.vl_width - panel_info.logo_width) >> 1);
 >> +	x += panel_info.logo_x_offset; /* For X center align */
 >>
 >> 	y = ((panel_info.vl_height - panel_info.logo_height) >> 1);
 >> +	y += panel_info.logo_y_offset; /* For Y center align */
 >>
 >> So every new logo in future could be simply center-aligned.
 >> Is it ok?
 >> Regards,
 >>
 >
 > Can you send the patch? I think that the code above omit the added
 > variable declaration. So I can't test it.
 > Thank you.
 >
 > Best regards,
 > Hyungwon Hwang
 >
 > ---
 > Hyungwon Hwang
 > Samsung SWC S/W Platform Team
 > Smasung Electronics
 > human.hwang at samsung.com
 > _______________________________________________
 > U-Boot mailing list
 > U-Boot at lists.denx.de
 > http://lists.denx.de/mailman/listinfo/u-boot
 >

It was only some pseudo code. I will add some more changes in this patch 
set, so please wait for its next version.
I try to eliminate unaligned access issue on trats board, because now it 
is quite unpredictable. I hope to send changes at the end of this week.
Regards,

-- 
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com

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

* [U-Boot] [PATCH v2 12/13] trats2: add LCD download menu support
  2013-12-18 18:31   ` [U-Boot] [PATCH v2 12/13] trats2: " Przemyslaw Marczak
@ 2014-01-02  6:34     ` Minkyu Kang
  0 siblings, 0 replies; 147+ messages in thread
From: Minkyu Kang @ 2014-01-02  6:34 UTC (permalink / raw)
  To: u-boot

On 19/12/13 03:31, Przemyslaw Marczak wrote:
> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
> 
> ---
> changes v2:
> - add definitions for check keys
> - cleanup config definitions
> ---
>  include/configs/trats2.h |   27 +++++++++++++++++++++++++++
>  1 file changed, 27 insertions(+)
> 
> diff --git a/include/configs/trats2.h b/include/configs/trats2.h
> index 80d3ed0..b0dcfa4 100644
> --- a/include/configs/trats2.h
> +++ b/include/configs/trats2.h
> @@ -19,6 +19,8 @@
>  #define CONFIG_S5P		/* which is in a S5P Family */
>  #define CONFIG_EXYNOS4		/* which is in a EXYNOS4XXX */
>  #define CONFIG_TIZEN		/* TIZEN lib */
> +#define CONFIG_TRATS2
> +#define CONFIG_BOARD_NAME	"TRATS2"
>  
>  #include <asm/arch/cpu.h>		/* get chip and board defs */
>  
> @@ -319,6 +321,31 @@
>  /* Common misc for Samsung */
>  #define CONFIG_MISC_INIT_R
>  
> +/* Download menu - Samsung common */
> +#define CONFIG_LCD_MENU
> +#define CONFIG_LCD_MENU_BOARD
> +
> +/* Download menu - definitions for check keys */
> +#ifndef __ASSEMBLY__
> +#ifdef __COMMON_H_

why this ifdef(__COMMON_H_) is needed?

> +#include <power/pmic.h>
> +#include <power/max77686_pmic.h>
> +
> +#define KEY_PWR_PMIC_NAME		"MAX77686_PMIC"
> +#define KEY_PWR_STATUS_REG		MAX77686_REG_PMIC_STATUS1
> +#define KEY_PWR_STATUS_MASK		(1 << 0)
> +#define KEY_PWR_INTERRUPT_REG		MAX77686_REG_PMIC_INT1
> +#define KEY_PWR_INTERRUPT_MASK		(1 << 1)
> +
> +#define KEY_VOL_UP_GPIO			exynos4x12_gpio_get(2, x2, 2)
> +#define KEY_VOL_DOWN_GPIO		exynos4x12_gpio_get(2, x3, 3)
> +#endif /* __COMMON_H_ */
> +#endif /* __ASSEMBLY__ */
> +
> +/* LCD console */
> +#define LCD_BPP                 LCD_COLOR16
> +#define CONFIG_SYS_WHITE_ON_BLACK
> +
>  /* LCD */
>  #define CONFIG_EXYNOS_FB
>  #define CONFIG_LCD
> 

Thanks,
Minkyu Kang.

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

* [U-Boot] [PATCH v2 06/13] common: makefile: Add optional cflags to object: common/lcd.o
  2013-12-18 18:31   ` [U-Boot] [PATCH v2 06/13] common: makefile: Add optional cflags to object: common/lcd.o Przemyslaw Marczak
  2013-12-19  5:44     ` Inha Song
@ 2014-01-02  6:35     ` Minkyu Kang
  1 sibling, 0 replies; 147+ messages in thread
From: Minkyu Kang @ 2014-01-02  6:35 UTC (permalink / raw)
  To: u-boot

On 19/12/13 03:31, Przemyslaw Marczak wrote:
> This change adds CFLAGS: -mno-unaligned-access
> which depends on option: PLATFORM_NO_UNALIGNED
> 
> This option avoids unaligned data access exception on armv7, caused
> by access to logo data which is mostly unaligned initialized array.

OK. I understood about option.
At here, please write on why you added this option.

> 
> more info: README.arm-unaligned-accesses
> 
> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
> 
> ---
> Changes v2:
> - new patch
> ---
>  common/Makefile |    1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/common/Makefile b/common/Makefile
> index 74404be..619d72c 100644
> --- a/common/Makefile
> +++ b/common/Makefile
> @@ -240,3 +240,4 @@ $(obj)env_embedded.o: $(src)env_embedded.c
>  # SEE README.arm-unaligned-accesses
>  $(obj)hush.o: CFLAGS += $(PLATFORM_NO_UNALIGNED)
>  $(obj)fdt_support.o: CFLAGS += $(PLATFORM_NO_UNALIGNED)
> +$(obj)lcd.o: CFLAGS += $(PLATFORM_NO_UNALIGNED)
> 

Thanks,
Minkyu Kang.

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

* [U-Boot] [PATCH v2 02/13] trats: add optional cflags to board object file.
  2013-12-18 18:31   ` [U-Boot] [PATCH v2 02/13] trats: add optional cflags to board object file Przemyslaw Marczak
@ 2014-01-02  6:35     ` Minkyu Kang
  2014-01-02  8:03       ` Przemyslaw Marczak
  0 siblings, 1 reply; 147+ messages in thread
From: Minkyu Kang @ 2014-01-02  6:35 UTC (permalink / raw)
  To: u-boot

On 19/12/13 03:31, Przemyslaw Marczak wrote:
> This change avoids unexpected unaligned access.
> 
> more info: README.arm-unaligned-accesses
> 
> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
> cc: Lukasz Majewski <l.majewski@samsung.com>
> 
> ---
> Changes v2:
> - new patch
> ---
>  board/samsung/trats/Makefile |    2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/board/samsung/trats/Makefile b/board/samsung/trats/Makefile
> index 5dc8a1f..c1bcd63 100644
> --- a/board/samsung/trats/Makefile
> +++ b/board/samsung/trats/Makefile
> @@ -6,3 +6,5 @@
>  #
>  
>  obj-y	+= trats.o
> +
> +$(obj)trats.o: CFLAGS += $(PLATFORM_NO_UNALIGNED)
> \ No newline at end of file
> 

What is the example of unexpected unaligned access on trats?

Thanks,
Minkyu Kang.

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

* [U-Boot] [PATCH v2 01/13] s5p: gpio: change gpio coding method for s5p gpio.
  2013-12-18 18:31   ` [U-Boot] [PATCH v2 01/13] s5p: gpio: change gpio coding method for s5p gpio Przemyslaw Marczak
@ 2014-01-02  6:35     ` Minkyu Kang
  2014-01-02  7:55       ` Przemyslaw Marczak
  0 siblings, 1 reply; 147+ messages in thread
From: Minkyu Kang @ 2014-01-02  6:35 UTC (permalink / raw)
  To: u-boot

Hi,

On 19/12/13 03:31, Przemyslaw Marczak wrote:
> Old s5p gpio coding method was not clean and was not working properly
> for all parts and banks. New method is clean and easy to extend.
> 
> Gpio coding mask:
> 0x000000ff - pin number
> 0x00ffff00 - bank offset
> 0xff000000 - part number
> 
> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
> ---
>  arch/arm/include/asm/arch-exynos/gpio.h  |  169 +++++++++++-------------------
>  arch/arm/include/asm/arch-s5pc1xx/gpio.h |   47 +++++++--
>  drivers/gpio/s5p_gpio.c                  |   15 +--
>  include/configs/s5p_goni.h               |    4 +-
>  include/configs/s5pc210_universal.h      |   12 +--
>  include/configs/trats.h                  |    8 +-
>  include/configs/trats2.h                 |   12 +--
>  7 files changed, 125 insertions(+), 142 deletions(-)
> 

patch failed.

$ patch --dry-run -p1 < U-Boot-v2-01-13-s5p-gpio-change-gpio-coding-method-for-s5p-gpio..patch 
patching file arch/arm/include/asm/arch-exynos/gpio.h
Hunk #1 FAILED at 196.
1 out of 1 hunk FAILED -- saving rejects to file arch/arm/include/asm/arch-exynos/gpio.h.rej
patching file arch/arm/include/asm/arch-s5pc1xx/gpio.h
patching file drivers/gpio/s5p_gpio.c
patching file include/configs/s5p_goni.h
patching file include/configs/s5pc210_universal.h
patching file include/configs/trats.h
Hunk #1 FAILED at 283.
1 out of 1 hunk FAILED -- saving rejects to file include/configs/trats.h.rej
patching file include/configs/trats2.h
Hunk #1 FAILED@293.
1 out of 1 hunk FAILED -- saving rejects to file include/configs/trats2.h.rej

please check it.

Thanks,
Minkyu Kang.

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

* [U-Boot] [PATCH v2 04/13] samsung: common: Add misc file and common function misc_init_r().
  2013-12-18 18:31   ` [U-Boot] [PATCH v2 04/13] samsung: common: Add misc file and common function misc_init_r() Przemyslaw Marczak
@ 2014-01-02  6:37     ` Minkyu Kang
  2014-01-02  8:09       ` Przemyslaw Marczak
  0 siblings, 1 reply; 147+ messages in thread
From: Minkyu Kang @ 2014-01-02  6:37 UTC (permalink / raw)
  To: u-boot

On 19/12/13 03:31, Przemyslaw Marczak wrote:
> Config: CONFIG_MISC_INIT_R enables implementation of misc_init_r()
> in common file::
> - board/samsung/common/misc.c

I can't understand this commit message.
What means?

> 
> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
> 
> ---
> Changes v2:
> - change CONFIG_SAMSUNG to CONFIG_MISC_INIT_R
> ---
>  board/samsung/common/Makefile |    1 +
>  board/samsung/common/misc.c   |   14 ++++++++++++++
>  2 files changed, 15 insertions(+)
>  create mode 100644 board/samsung/common/misc.c
> 
> diff --git a/board/samsung/common/Makefile b/board/samsung/common/Makefile
> index 501d974..c30bb3d 100644
> --- a/board/samsung/common/Makefile
> +++ b/board/samsung/common/Makefile
> @@ -8,3 +8,4 @@
>  obj-$(CONFIG_SOFT_I2C_MULTI_BUS) += multi_i2c.o
>  obj-$(CONFIG_THOR_FUNCTION) += thor.o
>  obj-$(CONFIG_CMD_USB_MASS_STORAGE) += ums.o
> +obj-$(CONFIG_MISC_INIT_R) += misc.o
> diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
> new file mode 100644
> index 0000000..3764d12
> --- /dev/null
> +++ b/board/samsung/common/misc.c
> @@ -0,0 +1,14 @@
> +/*
> + * Copyright (C) 2013 Samsung Electronics
> + * Przemyslaw Marczak <p.marczak@samsung.com>
> + *
> + * SPDX-License-Identifier:	GPL-2.0+
> + */
> +
> +#include <common.h>
> +
> +/* Common for Samsung boards */
> +int misc_init_r(void)
> +{
> +	return 0;
> +}
> 

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

* [U-Boot] [PATCH v2 01/13] s5p: gpio: change gpio coding method for s5p gpio.
  2014-01-02  6:35     ` Minkyu Kang
@ 2014-01-02  7:55       ` Przemyslaw Marczak
  0 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-02  7:55 UTC (permalink / raw)
  To: u-boot

Hello Minkyu,

On 01/02/2014 07:35 AM, Minkyu Kang wrote:
> Hi,
>
> On 19/12/13 03:31, Przemyslaw Marczak wrote:
>> Old s5p gpio coding method was not clean and was not working properly
>> for all parts and banks. New method is clean and easy to extend.
>>
>> Gpio coding mask:
>> 0x000000ff - pin number
>> 0x00ffff00 - bank offset
>> 0xff000000 - part number
>>
>> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
>> ---
>>   arch/arm/include/asm/arch-exynos/gpio.h  |  169 +++++++++++-------------------
>>   arch/arm/include/asm/arch-s5pc1xx/gpio.h |   47 +++++++--
>>   drivers/gpio/s5p_gpio.c                  |   15 +--
>>   include/configs/s5p_goni.h               |    4 +-
>>   include/configs/s5pc210_universal.h      |   12 +--
>>   include/configs/trats.h                  |    8 +-
>>   include/configs/trats2.h                 |   12 +--
>>   7 files changed, 125 insertions(+), 142 deletions(-)
>>
>
> patch failed.
>
> $ patch --dry-run -p1 < U-Boot-v2-01-13-s5p-gpio-change-gpio-coding-method-for-s5p-gpio..patch
> patching file arch/arm/include/asm/arch-exynos/gpio.h
> Hunk #1 FAILED at 196.
> 1 out of 1 hunk FAILED -- saving rejects to file arch/arm/include/asm/arch-exynos/gpio.h.rej
> patching file arch/arm/include/asm/arch-s5pc1xx/gpio.h
> patching file drivers/gpio/s5p_gpio.c
> patching file include/configs/s5p_goni.h
> patching file include/configs/s5pc210_universal.h
> patching file include/configs/trats.h
> Hunk #1 FAILED at 283.
> 1 out of 1 hunk FAILED -- saving rejects to file include/configs/trats.h.rej
> patching file include/configs/trats2.h
> Hunk #1 FAILED at 293.
> 1 out of 1 hunk FAILED -- saving rejects to file include/configs/trats2.h.rej
>
> please check it.
>
> Thanks,
> Minkyu Kang.
>
>

Thank you for reply. Probably there were some changes in tree since I 
had sent this patch set. I will check this.

Regards
-- 
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com

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

* [U-Boot] [PATCH v2 02/13] trats: add optional cflags to board object file.
  2014-01-02  6:35     ` Minkyu Kang
@ 2014-01-02  8:03       ` Przemyslaw Marczak
  0 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-02  8:03 UTC (permalink / raw)
  To: u-boot

Hello Minkyu,

On 01/02/2014 07:35 AM, Minkyu Kang wrote:
> On 19/12/13 03:31, Przemyslaw Marczak wrote:
>> This change avoids unexpected unaligned access.
>>
>> more info: README.arm-unaligned-accesses
>>
>> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
>> cc: Lukasz Majewski <l.majewski@samsung.com>
>>
>> ---
>> Changes v2:
>> - new patch
>> ---
>>   board/samsung/trats/Makefile |    2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/board/samsung/trats/Makefile b/board/samsung/trats/Makefile
>> index 5dc8a1f..c1bcd63 100644
>> --- a/board/samsung/trats/Makefile
>> +++ b/board/samsung/trats/Makefile
>> @@ -6,3 +6,5 @@
>>   #
>>
>>   obj-y	+= trats.o
>> +
>> +$(obj)trats.o: CFLAGS += $(PLATFORM_NO_UNALIGNED)
>> \ No newline at end of file
>>
>
> What is the example of unexpected unaligned access on trats?
>
> Thanks,
> Minkyu Kang.
>

There was unaligned access exception on Trats before booting the linux 
and I checked that this flag resolved this issue. After adding some v3 
changes I can see that this is not a solution for this issue. I am 
working on it and this commit will be removed in patch set V3.
Regards

-- 
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com

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

* [U-Boot] [PATCH v2 04/13] samsung: common: Add misc file and common function misc_init_r().
  2014-01-02  6:37     ` Minkyu Kang
@ 2014-01-02  8:09       ` Przemyslaw Marczak
  0 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-02  8:09 UTC (permalink / raw)
  To: u-boot

Hello Minkyu,

On 01/02/2014 07:37 AM, Minkyu Kang wrote:
> On 19/12/13 03:31, Przemyslaw Marczak wrote:
>> Config: CONFIG_MISC_INIT_R enables implementation of misc_init_r()
>> in common file::
>> - board/samsung/common/misc.c
>
> I can't understand this commit message.
> What means?
>

I mean that implementation of function misc_init_r() in file 
board/samsung/common/misc.c can be enabled just by adding this config 
(CONFIG_MISC_INIT_R) for Samsung devices.

Regards
-- 
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com

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

* [U-Boot] [PATCH v3 01/12] s5p: gpio: change gpio coding method for s5p gpio.
  2013-12-03 18:03 [U-Boot] [PATCH 00/10] Introduce Samsung misc file and LCD menu Przemyslaw Marczak
                   ` (11 preceding siblings ...)
  2013-12-18 18:31 ` [U-Boot] [PATCH v2 00/13] " Przemyslaw Marczak
@ 2014-01-03 16:43 ` Przemyslaw Marczak
  2014-01-03 16:43   ` [U-Boot] [PATCH v3 02/12] trats2: Code cleanup Przemyslaw Marczak
                     ` (11 more replies)
  2014-01-09 11:23 ` [U-Boot] [PATCH v4 00/12] Introduce Samsung misc file and LCD menu Przemyslaw Marczak
                   ` (2 subsequent siblings)
  15 siblings, 12 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-03 16:43 UTC (permalink / raw)
  To: u-boot

Old s5p gpio coding method was not clean and was not working properly
for all parts and banks. New method is clean and easy to extend.

Gpio coding mask:
0x000000ff - pin number
0x00ffff00 - bank offset
0xff000000 - part number

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>

---
Changes v2:
- none

Changes v3:
- fix merge conflict in arch/arm/include/asm/arch-exynos/gpio.h
- add exynos5420 gpio coding
- update file: board/samsung/trats2/trats2.c

 arch/arm/include/asm/arch-exynos/gpio.h  |  245 +++++++++---------------------
 arch/arm/include/asm/arch-s5pc1xx/gpio.h |   47 ++++--
 board/samsung/trats2/trats2.c            |    8 +-
 drivers/gpio/s5p_gpio.c                  |   15 +-
 include/configs/s5p_goni.h               |    4 +-
 include/configs/s5pc210_universal.h      |   12 +-
 include/configs/trats.h                  |    4 +-
 7 files changed, 132 insertions(+), 203 deletions(-)

diff --git a/arch/arm/include/asm/arch-exynos/gpio.h b/arch/arm/include/asm/arch-exynos/gpio.h
index 2a19852..64bd23b 100644
--- a/arch/arm/include/asm/arch-exynos/gpio.h
+++ b/arch/arm/include/asm/arch-exynos/gpio.h
@@ -247,180 +247,81 @@ void s5p_gpio_set_rate(struct s5p_gpio_bank *bank, int gpio, int mode);
 
 /* GPIO pins per bank  */
 #define GPIO_PER_BANK 8
-
-#define exynos4_gpio_part1_get_nr(bank, pin) \
-	((((((unsigned int) &(((struct exynos4_gpio_part1 *) \
-			       EXYNOS4_GPIO_PART1_BASE)->bank)) \
-	    - EXYNOS4_GPIO_PART1_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin)
-
-#define EXYNOS4_GPIO_PART1_MAX ((sizeof(struct exynos4_gpio_part1) \
-			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
-
-#define exynos4_gpio_part2_get_nr(bank, pin) \
-	(((((((unsigned int) &(((struct exynos4_gpio_part2 *) \
-				EXYNOS4_GPIO_PART2_BASE)->bank)) \
-	    - EXYNOS4_GPIO_PART2_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin) + EXYNOS4_GPIO_PART1_MAX)
-
-#define exynos4x12_gpio_part1_get_nr(bank, pin) \
-	((((((unsigned int) &(((struct exynos4x12_gpio_part1 *) \
-			       EXYNOS4X12_GPIO_PART1_BASE)->bank)) \
-	    - EXYNOS4X12_GPIO_PART1_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin)
-
-#define EXYNOS4X12_GPIO_PART1_MAX ((sizeof(struct exynos4x12_gpio_part1) \
-			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
-
-#define exynos4x12_gpio_part2_get_nr(bank, pin) \
-	(((((((unsigned int) &(((struct exynos4x12_gpio_part2 *) \
-				EXYNOS4X12_GPIO_PART2_BASE)->bank)) \
-	    - EXYNOS4X12_GPIO_PART2_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin) + EXYNOS4X12_GPIO_PART1_MAX)
-
-#define EXYNOS4X12_GPIO_PART2_MAX ((sizeof(struct exynos4x12_gpio_part2) \
-			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
-
-#define exynos4x12_gpio_part3_get_nr(bank, pin) \
-	(((((((unsigned int) &(((struct exynos4x12_gpio_part3 *) \
-				EXYNOS4X12_GPIO_PART3_BASE)->bank)) \
-	    - EXYNOS4X12_GPIO_PART3_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin) + EXYNOS4X12_GPIO_PART2_MAX)
-
-#define exynos5_gpio_part1_get_nr(bank, pin) \
-	((((((unsigned int) &(((struct exynos5_gpio_part1 *) \
-			       EXYNOS5_GPIO_PART1_BASE)->bank)) \
-	    - EXYNOS5_GPIO_PART1_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin)
-
-#define EXYNOS5_GPIO_PART1_MAX ((sizeof(struct exynos5_gpio_part1) \
-			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
-
-#define exynos5_gpio_part2_get_nr(bank, pin) \
-	(((((((unsigned int) &(((struct exynos5_gpio_part2 *) \
-				EXYNOS5_GPIO_PART2_BASE)->bank)) \
-	    - EXYNOS5_GPIO_PART2_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin) + EXYNOS5_GPIO_PART1_MAX)
-
-#define EXYNOS5_GPIO_PART2_MAX ((sizeof(struct exynos5_gpio_part2) \
-			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
-
-#define exynos5_gpio_part3_get_nr(bank, pin) \
-	(((((((unsigned int) &(((struct exynos5_gpio_part3 *) \
-				EXYNOS5_GPIO_PART3_BASE)->bank)) \
-	    - EXYNOS5_GPIO_PART3_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin) + EXYNOS5_GPIO_PART2_MAX)
-
-
-/* EXYNOS5420 */
-#define exynos5420_gpio_part1_get_nr(bank, pin) \
-	((((((unsigned int) &(((struct exynos5420_gpio_part1 *)\
-			       EXYNOS5420_GPIO_PART1_BASE)->bank)) \
-	    - EXYNOS5420_GPIO_PART1_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin)
-
-#define EXYNOS5420_GPIO_PART1_MAX ((sizeof(struct exynos5420_gpio_part1) \
-			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
-
-#define exynos5420_gpio_part2_get_nr(bank, pin) \
-	(((((((unsigned int) &(((struct exynos5420_gpio_part2 *)\
-				EXYNOS5420_GPIO_PART2_BASE)->bank)) \
-	    - EXYNOS5420_GPIO_PART2_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin) + EXYNOS5420_GPIO_PART1_MAX)
-
-#define EXYNOS5420_GPIO_PART2_MAX ((sizeof(struct exynos5420_gpio_part2) \
-			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
-
-#define exynos5420_gpio_part3_get_nr(bank, pin) \
-	(((((((unsigned int) &(((struct exynos5420_gpio_part3 *)\
-				EXYNOS5420_GPIO_PART3_BASE)->bank)) \
-	    - EXYNOS5420_GPIO_PART3_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin) + EXYNOS5420_GPIO_PART2_MAX)
-
-#define EXYNOS5420_GPIO_PART3_MAX ((sizeof(struct exynos5420_gpio_part3) \
-			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
-
-#define exynos5420_gpio_part4_get_nr(bank, pin) \
-	(((((((unsigned int) &(((struct exynos5420_gpio_part4 *)\
-				EXYNOS5420_GPIO_PART4_BASE)->bank)) \
-	    - EXYNOS5420_GPIO_PART4_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin) + EXYNOS5420_GPIO_PART3_MAX)
-
-#define EXYNOS5420_GPIO_PART4_MAX ((sizeof(struct exynos5420_gpio_part4) \
-			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
-
-#define EXYNOS5420_GPIO_PART5_MAX ((sizeof(struct exynos5420_gpio_part5) \
-			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
-
-static inline unsigned int s5p_gpio_base(int nr)
+#define S5P_GPIO_PART_SHIFT	(24)
+#define S5P_GPIO_PART_MASK	(0xff)
+#define S5P_GPIO_BANK_SHIFT	(8)
+#define S5P_GPIO_BANK_MASK	(0xffff)
+#define S5P_GPIO_PIN_MASK	(0xff)
+
+#define S5P_GPIO_SET_PART(x) \
+			((x & S5P_GPIO_PART_MASK) << S5P_GPIO_PART_SHIFT)
+
+#define S5P_GPIO_GET_PART(x) \
+			((x >> S5P_GPIO_PART_SHIFT) & S5P_GPIO_PART_MASK)
+
+#define S5P_GPIO_SET_PIN(x) \
+			(x & S5P_GPIO_PIN_MASK)
+
+#define EXYNOS4_GPIO_SET_BANK(part, bank) \
+			((((unsigned)&(((struct exynos4_gpio_part##part *) \
+			EXYNOS4_GPIO_PART##part##_BASE)->bank) \
+			- EXYNOS4_GPIO_PART##part##_BASE) \
+			& S5P_GPIO_BANK_MASK) << S5P_GPIO_BANK_SHIFT)
+
+#define EXYNOS4X12_GPIO_SET_BANK(part, bank) \
+			((((unsigned)&(((struct exynos4x12_gpio_part##part *) \
+			EXYNOS4X12_GPIO_PART##part##_BASE)->bank) \
+			- EXYNOS4X12_GPIO_PART##part##_BASE) \
+			& S5P_GPIO_BANK_MASK) << S5P_GPIO_BANK_SHIFT)
+
+#define EXYNOS5_GPIO_SET_BANK(part, bank) \
+			((((unsigned)&(((struct exynos5420_gpio_part##part *) \
+			EXYNOS5420_GPIO_PART##part##_BASE)->bank) \
+			- EXYNOS5_GPIO_PART##part##_BASE) \
+			& S5P_GPIO_BANK_MASK) << S5P_GPIO_BANK_SHIFT)
+
+#define EXYNOS5420_GPIO_SET_BANK(part, bank) \
+			((((unsigned)&(((struct exynos5420_gpio_part##part *) \
+			EXYNOS5420_GPIO_PART##part##_BASE)->bank) \
+			- EXYNOS5420_GPIO_PART##part##_BASE) \
+			& S5P_GPIO_BANK_MASK) << S5P_GPIO_BANK_SHIFT)
+
+#define exynos4_gpio_get(part, bank, pin) \
+			(S5P_GPIO_SET_PART(part) | \
+			EXYNOS4_GPIO_SET_BANK(part, bank) | \
+			S5P_GPIO_SET_PIN(pin))
+
+#define exynos4x12_gpio_get(part, bank, pin) \
+			(S5P_GPIO_SET_PART(part) | \
+			EXYNOS4X12_GPIO_SET_BANK(part, bank) | \
+			S5P_GPIO_SET_PIN(pin))
+
+#define exynos5420_gpio_get(part, bank, pin) \
+			(S5P_GPIO_SET_PART(part) | \
+			EXYNOS5420_GPIO_SET_BANK(part, bank) | \
+			S5P_GPIO_SET_PIN(pin))
+
+#define exynos5_gpio_get(part, bank, pin) \
+			(S5P_GPIO_SET_PART(part) | \
+			EXYNOS5_GPIO_SET_BANK(part, bank) | \
+			S5P_GPIO_SET_PIN(pin))
+
+static inline unsigned int s5p_gpio_base(int gpio)
 {
-	if (cpu_is_exynos5()) {
-		if (proid_is_exynos5420()) {
-			if (nr < EXYNOS5420_GPIO_PART1_MAX)
-				return EXYNOS5420_GPIO_PART1_BASE;
-			else if (nr < EXYNOS5420_GPIO_PART2_MAX)
-				return EXYNOS5420_GPIO_PART2_BASE;
-			else if (nr < EXYNOS5420_GPIO_PART3_MAX)
-				return EXYNOS5420_GPIO_PART3_BASE;
-			else
-				return EXYNOS5420_GPIO_PART4_BASE;
-		} else {
-			if (nr < EXYNOS5_GPIO_PART1_MAX)
-				return EXYNOS5_GPIO_PART1_BASE;
-			else if (nr < EXYNOS5_GPIO_PART2_MAX)
-				return EXYNOS5_GPIO_PART2_BASE;
-			else
-				return EXYNOS5_GPIO_PART3_BASE;
-		}
-	} else if (cpu_is_exynos4()) {
-		if (nr < EXYNOS4_GPIO_PART1_MAX)
-			return EXYNOS4_GPIO_PART1_BASE;
-		else
-			return EXYNOS4_GPIO_PART2_BASE;
+	unsigned gpio_part = S5P_GPIO_GET_PART(gpio);
+
+	switch (gpio_part) {
+	case 1:
+		return samsung_get_base_gpio_part1();
+	case 2:
+		return samsung_get_base_gpio_part2();
+	case 3:
+		return samsung_get_base_gpio_part3();
+	case 4:
+		return samsung_get_base_gpio_part4();
+	default:
+		return 0;
 	}
-
-	return 0;
-}
-
-static inline unsigned int s5p_gpio_part_max(int nr)
-{
-	if (cpu_is_exynos5()) {
-		if (proid_is_exynos5420()) {
-			if (nr < EXYNOS5420_GPIO_PART1_MAX)
-				return 0;
-			else if (nr < EXYNOS5420_GPIO_PART2_MAX)
-				return EXYNOS5420_GPIO_PART1_MAX;
-			else if (nr < EXYNOS5420_GPIO_PART3_MAX)
-				return EXYNOS5420_GPIO_PART2_MAX;
-			else if (nr < EXYNOS5420_GPIO_PART4_MAX)
-				return EXYNOS5420_GPIO_PART3_MAX;
-			else
-				return EXYNOS5420_GPIO_PART4_MAX;
-		} else {
-			if (nr < EXYNOS5_GPIO_PART1_MAX)
-				return 0;
-			else if (nr < EXYNOS5_GPIO_PART2_MAX)
-				return EXYNOS5_GPIO_PART1_MAX;
-			else
-				return EXYNOS5_GPIO_PART2_MAX;
-		}
-	} else if (cpu_is_exynos4()) {
-		if (proid_is_exynos4412()) {
-			if (nr < EXYNOS4X12_GPIO_PART1_MAX)
-				return 0;
-			else if (nr < EXYNOS4X12_GPIO_PART2_MAX)
-				return EXYNOS4X12_GPIO_PART1_MAX;
-			else
-				return EXYNOS4X12_GPIO_PART2_MAX;
-		} else {
-			if (nr < EXYNOS4_GPIO_PART1_MAX)
-				return 0;
-			else
-				return EXYNOS4_GPIO_PART1_MAX;
-		}
-	}
-
-	return 0;
 }
 #endif
 
diff --git a/arch/arm/include/asm/arch-s5pc1xx/gpio.h b/arch/arm/include/asm/arch-s5pc1xx/gpio.h
index ac60fe6..c2d9244 100644
--- a/arch/arm/include/asm/arch-s5pc1xx/gpio.h
+++ b/arch/arm/include/asm/arch-s5pc1xx/gpio.h
@@ -125,20 +125,45 @@ void s5p_gpio_set_rate(struct s5p_gpio_bank *bank, int gpio, int mode);
 /* GPIO pins per bank  */
 #define GPIO_PER_BANK 8
 
-static inline unsigned int s5p_gpio_base(int nr)
-{
-	return S5PC110_GPIO_BASE;
-}
+#define S5P_GPIO_PART_SHIFT	(24)
+#define S5P_GPIO_PART_MASK	(0xff)
+#define S5P_GPIO_BANK_SHIFT	(8)
+#define S5P_GPIO_BANK_MASK	(0xffff)
+#define S5P_GPIO_PIN_MASK	(0xff)
+
+#define S5P_GPIO_SET_PART(x) \
+			((x & S5P_GPIO_PART_MASK) << S5P_GPIO_PART_SHIFT)
+
+#define S5P_GPIO_GET_PART(x) \
+			((x >> S5P_GPIO_PART_SHIFT) & S5P_GPIO_PART_MASK)
+
+#define S5P_GPIO_SET_PIN(x) \
+			(x & S5P_GPIO_PIN_MASK)
 
-static inline unsigned int s5p_gpio_part_max(int nr)
+#define S5PC100_SET_BANK(bank) \
+			(((unsigned)&(((struct s5pc100_gpio *) \
+			S5PC100_GPIO_BASE)->bank) - S5PC100_GPIO_BASE) \
+			& S5P_GPIO_BANK_MASK) << S5P_GPIO_BANK_SHIFT)
+
+#define S5PC110_SET_BANK(bank) \
+			((((unsigned)&(((struct s5pc110_gpio *) \
+			S5PC110_GPIO_BASE)->bank) - S5PC110_GPIO_BASE) \
+			& S5P_GPIO_BANK_MASK) << S5P_GPIO_BANK_SHIFT)
+
+#define s5pc100_gpio_get(bank, pin) \
+			(S5P_GPIO_SET_PART(0) | \
+			S5PC100_SET_BANK(bank) | \
+			S5P_GPIO_SET_PIN(pin))
+
+#define s5pc110_gpio_get(bank, pin) \
+			(S5P_GPIO_SET_PART(0) | \
+			S5PC110_SET_BANK(bank) | \
+			S5P_GPIO_SET_PIN(pin))
+
+static inline unsigned int s5p_gpio_base(int nr)
 {
-	return 0;
+	return samsung_get_base_gpio();
 }
-
-#define s5pc110_gpio_get_nr(bank, pin)	  \
-	((((((unsigned int)&(((struct s5pc110_gpio *)S5PC110_GPIO_BASE)->bank))\
-	    - S5PC110_GPIO_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin)
 #endif
 
 /* Pin configurations */
diff --git a/board/samsung/trats2/trats2.c b/board/samsung/trats2/trats2.c
index be15357..1e96fdc 100644
--- a/board/samsung/trats2/trats2.c
+++ b/board/samsung/trats2/trats2.c
@@ -144,17 +144,17 @@ static void board_init_i2c(void)
 int get_soft_i2c_scl_pin(void)
 {
 	if (I2C_ADAP_HWNR)
-		return exynos4x12_gpio_part2_get_nr(m2, 1); /* I2C9 */
+		return exynos4x12_gpio_get(2, m2, 1); /* I2C9 */
 	else
-		return exynos4x12_gpio_part1_get_nr(f1, 4); /* I2C8 */
+		return exynos4x12_gpio_get(1, f1, 4); /* I2C8 */
 }
 
 int get_soft_i2c_sda_pin(void)
 {
 	if (I2C_ADAP_HWNR)
-		return exynos4x12_gpio_part2_get_nr(m2, 0); /* I2C9 */
+		return exynos4x12_gpio_get(2, m2, 0); /* I2C9 */
 	else
-		return exynos4x12_gpio_part1_get_nr(f1, 5); /* I2C8 */
+		return exynos4x12_gpio_get(1, f1, 5); /* I2C8 */
 }
 #endif
 
diff --git a/drivers/gpio/s5p_gpio.c b/drivers/gpio/s5p_gpio.c
index 7eeb96d..11a0472 100644
--- a/drivers/gpio/s5p_gpio.c
+++ b/drivers/gpio/s5p_gpio.c
@@ -9,6 +9,11 @@
 #include <asm/io.h>
 #include <asm/gpio.h>
 
+#define S5P_GPIO_GET_BANK(x)	((x >> S5P_GPIO_BANK_SHIFT) \
+				& S5P_GPIO_BANK_MASK)
+
+#define S5P_GPIO_GET_PIN(x)	(x & S5P_GPIO_PIN_MASK)
+
 #define CON_MASK(x)		(0xf << ((x) << 2))
 #define CON_SFR(x, v)		((v) << ((x) << 2))
 
@@ -124,17 +129,15 @@ void s5p_gpio_set_rate(struct s5p_gpio_bank *bank, int gpio, int mode)
 
 struct s5p_gpio_bank *s5p_gpio_get_bank(unsigned gpio)
 {
-	int bank;
-	unsigned g = gpio - s5p_gpio_part_max(gpio);
+	unsigned bank = S5P_GPIO_GET_BANK(gpio);
+	unsigned base = s5p_gpio_base(gpio);
 
-	bank = g / GPIO_PER_BANK;
-	bank *= sizeof(struct s5p_gpio_bank);
-	return (struct s5p_gpio_bank *) (s5p_gpio_base(gpio) + bank);
+	return (struct s5p_gpio_bank *)(base + bank);
 }
 
 int s5p_gpio_get_pin(unsigned gpio)
 {
-	return gpio % GPIO_PER_BANK;
+	return S5P_GPIO_GET_PIN(gpio);
 }
 
 /* Common GPIO API */
diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
index 0590d20..4cdf937 100644
--- a/include/configs/s5p_goni.h
+++ b/include/configs/s5p_goni.h
@@ -208,8 +208,8 @@
 /*
  * I2C Settings
  */
-#define CONFIG_SOFT_I2C_GPIO_SCL s5pc110_gpio_get_nr(j4, 3)
-#define CONFIG_SOFT_I2C_GPIO_SDA s5pc110_gpio_get_nr(j4, 0)
+#define CONFIG_SOFT_I2C_GPIO_SCL s5pc110_gpio_get(j4, 3)
+#define CONFIG_SOFT_I2C_GPIO_SDA s5pc110_gpio_get(j4, 0)
 
 #define CONFIG_SYS_I2C
 #define CONFIG_SYS_I2C_SOFT		/* I2C bit-banged */
diff --git a/include/configs/s5pc210_universal.h b/include/configs/s5pc210_universal.h
index d9e4c56..02a1c99 100644
--- a/include/configs/s5pc210_universal.h
+++ b/include/configs/s5pc210_universal.h
@@ -229,8 +229,8 @@
 /*
  * I2C Settings
  */
-#define CONFIG_SOFT_I2C_GPIO_SCL exynos4_gpio_part1_get_nr(b, 7)
-#define CONFIG_SOFT_I2C_GPIO_SDA exynos4_gpio_part1_get_nr(b, 6)
+#define CONFIG_SOFT_I2C_GPIO_SCL exynos4_gpio_get(1, b, 7)
+#define CONFIG_SOFT_I2C_GPIO_SDA exynos4_gpio_get(1, b, 6)
 
 #define CONFIG_SYS_I2C
 #define CONFIG_SYS_I2C_SOFT		/* I2C bit-banged */
@@ -253,10 +253,10 @@
  */
 #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 CONFIG_SOFT_SPI_GPIO_SCLK exynos4_gpio_get(2, y3, 1)
+#define CONFIG_SOFT_SPI_GPIO_MOSI exynos4_gpio_get(2, y3, 3)
+#define CONFIG_SOFT_SPI_GPIO_MISO exynos4_gpio_get(2, y3, 0)
+#define CONFIG_SOFT_SPI_GPIO_CS exynos4_gpio_get(2, y4, 3)
 
 #define SPI_DELAY udelay(1)
 #undef SPI_INIT
diff --git a/include/configs/trats.h b/include/configs/trats.h
index 0877142..9727f7a 100644
--- a/include/configs/trats.h
+++ b/include/configs/trats.h
@@ -282,8 +282,8 @@
 #include <asm/arch/gpio.h>
 
 /* I2C FG */
-#define CONFIG_SOFT_I2C_GPIO_SCL exynos4_gpio_part2_get_nr(y4, 1)
-#define CONFIG_SOFT_I2C_GPIO_SDA exynos4_gpio_part2_get_nr(y4, 0)
+#define CONFIG_SOFT_I2C_GPIO_SCL exynos4_gpio_get(2, y4, 1)
+#define CONFIG_SOFT_I2C_GPIO_SDA exynos4_gpio_get(2, y4, 0)
 
 #define CONFIG_POWER
 #define CONFIG_POWER_I2C
-- 
1.7.9.5

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

* [U-Boot] [PATCH v3 02/12] trats2: Code cleanup.
  2014-01-03 16:43 ` [U-Boot] [PATCH v3 01/12] s5p: gpio: change gpio coding method for s5p gpio Przemyslaw Marczak
@ 2014-01-03 16:43   ` Przemyslaw Marczak
  2014-01-03 16:43   ` [U-Boot] [PATCH v3 03/12] samsung: common: Add misc file and common function misc_init_r() Przemyslaw Marczak
                     ` (10 subsequent siblings)
  11 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-03 16:43 UTC (permalink / raw)
  To: u-boot

Remove wrong and unused env variables
Trats2 is not as GT-I8800.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Cc: Piotr Wilczek <p.wilczek@samsung.com>

---
Changes v2:
- none

Changes v3:
- none

 board/samsung/trats2/trats2.c      |   19 ++-----------------
 drivers/power/battery/bat_trats2.c |    2 +-
 include/configs/trats2.h           |    1 -
 3 files changed, 3 insertions(+), 19 deletions(-)

diff --git a/board/samsung/trats2/trats2.c b/board/samsung/trats2/trats2.c
index 1e96fdc..b4ccf51 100644
--- a/board/samsung/trats2/trats2.c
+++ b/board/samsung/trats2/trats2.c
@@ -72,15 +72,12 @@ static void check_hw_revision(void)
 int checkboard(void)
 {
 	puts("Board:\tTRATS2\n");
+	printf("HW Revision:\t0x%04x\n", board_rev);
+
 	return 0;
 }
 #endif
 
-static void show_hw_revision(void)
-{
-	printf("HW Revision:\t0x%04x\n", board_rev);
-}
-
 u32 get_board_rev(void)
 {
 	return board_rev;
@@ -614,15 +611,3 @@ void init_panel_info(vidinfo_t *vid)
 	exynos_set_dsim_platform_data(&dsim_platform_data);
 }
 #endif /* LCD */
-
-#ifdef CONFIG_MISC_INIT_R
-int misc_init_r(void)
-{
-	setenv("model", "GT-I8800");
-	setenv("board", "TRATS2");
-
-	show_hw_revision();
-
-	return 0;
-}
-#endif
diff --git a/drivers/power/battery/bat_trats2.c b/drivers/power/battery/bat_trats2.c
index f264832..94015aa 100644
--- a/drivers/power/battery/bat_trats2.c
+++ b/drivers/power/battery/bat_trats2.c
@@ -8,7 +8,7 @@
 #include <common.h>
 #include <power/pmic.h>
 #include <power/battery.h>
-#include <power/max8997_pmic.h>
+#include <power/max77693_pmic.h>
 #include <errno.h>
 
 static struct battery battery_trats;
diff --git a/include/configs/trats2.h b/include/configs/trats2.h
index c9ce828..7dfbe98 100644
--- a/include/configs/trats2.h
+++ b/include/configs/trats2.h
@@ -272,7 +272,6 @@
 #define CONFIG_EFI_PARTITION
 #define CONFIG_PARTITION_UUIDS
 
-#define CONFIG_MISC_INIT_R
 #define CONFIG_BOARD_EARLY_INIT_F
 
 /* I2C */
-- 
1.7.9.5

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

* [U-Boot] [PATCH v3 03/12] samsung: common: Add misc file and common function misc_init_r().
  2014-01-03 16:43 ` [U-Boot] [PATCH v3 01/12] s5p: gpio: change gpio coding method for s5p gpio Przemyslaw Marczak
  2014-01-03 16:43   ` [U-Boot] [PATCH v3 02/12] trats2: Code cleanup Przemyslaw Marczak
@ 2014-01-03 16:43   ` Przemyslaw Marczak
  2014-01-03 16:43   ` [U-Boot] [PATCH v3 04/12] samsung: misc: move display logo function to misc.c file Przemyslaw Marczak
                     ` (9 subsequent siblings)
  11 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-03 16:43 UTC (permalink / raw)
  To: u-boot

Config: CONFIG_MISC_INIT_R enables implementation of misc_init_r()
in common file::
- board/samsung/common/misc.c

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>

---
Changes v2:
- change CONFIG_SAMSUNG to CONFIG_MISC_INIT_R

Changes v3:
- fix merge conflict in board/samsung/common/Makefile

 board/samsung/common/Makefile |    1 +
 board/samsung/common/misc.c   |   14 ++++++++++++++
 2 files changed, 15 insertions(+)
 create mode 100644 board/samsung/common/misc.c

diff --git a/board/samsung/common/Makefile b/board/samsung/common/Makefile
index 22bd6b1..79547a3 100644
--- a/board/samsung/common/Makefile
+++ b/board/samsung/common/Makefile
@@ -8,6 +8,7 @@
 obj-$(CONFIG_SOFT_I2C_MULTI_BUS) += multi_i2c.o
 obj-$(CONFIG_THOR_FUNCTION) += thor.o
 obj-$(CONFIG_CMD_USB_MASS_STORAGE) += ums.o
+obj-$(CONFIG_MISC_INIT_R) += misc.o
 
 ifndef CONFIG_SPL_BUILD
 obj-$(CONFIG_BOARD_COMMON)	+= board.o
diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
new file mode 100644
index 0000000..3764d12
--- /dev/null
+++ b/board/samsung/common/misc.c
@@ -0,0 +1,14 @@
+/*
+ * Copyright (C) 2013 Samsung Electronics
+ * Przemyslaw Marczak <p.marczak@samsung.com>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+
+/* Common for Samsung boards */
+int misc_init_r(void)
+{
+	return 0;
+}
-- 
1.7.9.5

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

* [U-Boot] [PATCH v3 04/12] samsung: misc: move display logo function to misc.c file.
  2014-01-03 16:43 ` [U-Boot] [PATCH v3 01/12] s5p: gpio: change gpio coding method for s5p gpio Przemyslaw Marczak
  2014-01-03 16:43   ` [U-Boot] [PATCH v3 02/12] trats2: Code cleanup Przemyslaw Marczak
  2014-01-03 16:43   ` [U-Boot] [PATCH v3 03/12] samsung: common: Add misc file and common function misc_init_r() Przemyslaw Marczak
@ 2014-01-03 16:43   ` Przemyslaw Marczak
  2014-01-03 16:43   ` [U-Boot] [PATCH v3 05/12] common: lcd.c: fix data abort exception when try to access bmp header Przemyslaw Marczak
                     ` (8 subsequent siblings)
  11 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-03 16:43 UTC (permalink / raw)
  To: u-boot

board/samsung/common/misc.c:
- move draw_logo() function from exynos_fb.c
- add get_tizen_logo_info() function call removed from board files

boards:
- update board files
- add CONFIG_MISC_INIT_R to Universal, Trats and Trats2

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Tested-by: Hyungwon Hwang <human.hwang@samsung.com>

---
changes v2:
- configs cleanup
- add check logo address before display

Changes v3:
- none

 board/samsung/common/misc.c              |   42 ++++++++++++++++++++++++++++++
 board/samsung/trats/trats.c              |    3 ---
 board/samsung/trats2/trats2.c            |    4 ---
 board/samsung/universal_c210/universal.c |    4 ---
 drivers/video/exynos_fb.c                |   28 --------------------
 include/configs/s5pc210_universal.h      |    3 +++
 include/configs/trats.h                  |    3 +++
 include/configs/trats2.h                 |    3 +++
 8 files changed, 51 insertions(+), 39 deletions(-)

diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
index 3764d12..6188e29 100644
--- a/board/samsung/common/misc.c
+++ b/board/samsung/common/misc.c
@@ -6,9 +6,51 @@
  */
 
 #include <common.h>
+#include <lcd.h>
+#include <libtizen.h>
+
+#ifdef CONFIG_CMD_BMP
+static void draw_logo(void)
+{
+	int x, y;
+	ulong addr;
+
+#ifdef CONFIG_TIZEN
+	get_tizen_logo_info(&panel_info);
+#else
+	return;
+#endif
+
+	addr = panel_info.logo_addr;
+	if (!addr) {
+		error("There is no logo data.");
+		return;
+	}
+
+	if (panel_info.vl_width >= panel_info.logo_width) {
+		x = ((panel_info.vl_width - panel_info.logo_width) >> 1);
+	} else {
+		x = 0;
+		printf("Warning: image width is bigger than display width\n");
+	}
+
+	if (panel_info.vl_height >= panel_info.logo_height) {
+		y = ((panel_info.vl_height - panel_info.logo_height) >> 1);
+	} else {
+		y = 0;
+		printf("Warning: image height is bigger than display height\n");
+	}
+
+	bmp_display(addr, x, y);
+}
+#endif /* CONFIG_CMD_BMP */
 
 /* Common for Samsung boards */
 int misc_init_r(void)
 {
+#ifdef CONFIG_CMD_BMP
+	if (panel_info.logo_on)
+		draw_logo();
+#endif
 	return 0;
 }
diff --git a/board/samsung/trats/trats.c b/board/samsung/trats/trats.c
index 640a193..cd27f18 100644
--- a/board/samsung/trats/trats.c
+++ b/board/samsung/trats/trats.c
@@ -770,9 +770,6 @@ void init_panel_info(vidinfo_t *vid)
 	vid->resolution	= HD_RESOLUTION,
 	vid->rgb_mode	= MODE_RGB_P,
 
-#ifdef CONFIG_TIZEN
-	get_tizen_logo_info(vid);
-#endif
 	mipi_lcd_device.reverse_panel = 1;
 
 	strcpy(s6e8ax0_platform_data.lcd_panel_name, mipi_lcd_device.name);
diff --git a/board/samsung/trats2/trats2.c b/board/samsung/trats2/trats2.c
index b4ccf51..9a2c212 100644
--- a/board/samsung/trats2/trats2.c
+++ b/board/samsung/trats2/trats2.c
@@ -596,10 +596,6 @@ void init_panel_info(vidinfo_t *vid)
 
 	mipi_lcd_device.reverse_panel = 1;
 
-#ifdef CONFIG_TIZEN
-	get_tizen_logo_info(vid);
-#endif
-
 	strcpy(dsim_platform_data.lcd_panel_name, mipi_lcd_device.name);
 	dsim_platform_data.mipi_power = mipi_power;
 	dsim_platform_data.phy_enable = set_mipi_phy_ctrl;
diff --git a/board/samsung/universal_c210/universal.c b/board/samsung/universal_c210/universal.c
index 54d0e1e..166d5ee 100644
--- a/board/samsung/universal_c210/universal.c
+++ b/board/samsung/universal_c210/universal.c
@@ -484,10 +484,6 @@ void init_panel_info(vidinfo_t *vid)
 	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;
diff --git a/drivers/video/exynos_fb.c b/drivers/video/exynos_fb.c
index 7d4c6e0..00a0a11 100644
--- a/drivers/video/exynos_fb.c
+++ b/drivers/video/exynos_fb.c
@@ -62,31 +62,6 @@ static void exynos_lcd_init(vidinfo_t *vid)
 	lcd_set_flush_dcache(1);
 }
 
-#ifdef CONFIG_CMD_BMP
-static void draw_logo(void)
-{
-	int x, y;
-	ulong addr;
-
-	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);
-}
-#endif
-
 void __exynos_cfg_lcd_gpio(void)
 {
 }
@@ -323,9 +298,6 @@ void lcd_enable(void)
 	if (panel_info.logo_on) {
 		memset((void *) gd->fb_base, 0, panel_width * panel_height *
 				(NBITS(panel_info.vl_bpix) >> 3));
-#ifdef CONFIG_CMD_BMP
-		draw_logo();
-#endif
 	}
 
 	lcd_panel_on(&panel_info);
diff --git a/include/configs/s5pc210_universal.h b/include/configs/s5pc210_universal.h
index 02a1c99..8a749f2 100644
--- a/include/configs/s5pc210_universal.h
+++ b/include/configs/s5pc210_universal.h
@@ -269,6 +269,9 @@ void universal_spi_sda(int bit);
 int universal_spi_read(void);
 #endif
 
+/* Common misc for Samsung */
+#define CONFIG_MISC_INIT_R
+
 /*
  * LCD Settings
  */
diff --git a/include/configs/trats.h b/include/configs/trats.h
index 9727f7a..1a75bb3 100644
--- a/include/configs/trats.h
+++ b/include/configs/trats.h
@@ -301,6 +301,9 @@
 #define CONFIG_USB_GADGET_VBUS_DRAW	2
 #define CONFIG_USB_CABLE_CHECK
 
+/* Common misc for Samsung */
+#define CONFIG_MISC_INIT_R
+
 /* LCD */
 #define CONFIG_EXYNOS_FB
 #define CONFIG_LCD
diff --git a/include/configs/trats2.h b/include/configs/trats2.h
index 7dfbe98..e54fe52 100644
--- a/include/configs/trats2.h
+++ b/include/configs/trats2.h
@@ -312,6 +312,9 @@ int get_soft_i2c_sda_pin(void);
 #define CONFIG_USB_GADGET_VBUS_DRAW	2
 #define CONFIG_USB_CABLE_CHECK
 
+/* Common misc for Samsung */
+#define CONFIG_MISC_INIT_R
+
 /* LCD */
 #define CONFIG_EXYNOS_FB
 #define CONFIG_LCD
-- 
1.7.9.5

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

* [U-Boot] [PATCH v3 05/12] common: lcd.c: fix data abort exception when try to access bmp header
  2014-01-03 16:43 ` [U-Boot] [PATCH v3 01/12] s5p: gpio: change gpio coding method for s5p gpio Przemyslaw Marczak
                     ` (2 preceding siblings ...)
  2014-01-03 16:43   ` [U-Boot] [PATCH v3 04/12] samsung: misc: move display logo function to misc.c file Przemyslaw Marczak
@ 2014-01-03 16:43   ` Przemyslaw Marczak
  2014-01-06  5:05     ` Minkyu Kang
  2014-01-06  8:54     ` Anatolij Gustschin
  2014-01-03 16:43   ` [U-Boot] [PATCH v3 06/12] lib: tizen: change Tizen logo with the new one Przemyslaw Marczak
                     ` (7 subsequent siblings)
  11 siblings, 2 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-03 16:43 UTC (permalink / raw)
  To: u-boot

Changes:
- le16_to_cpu() to get_unaligned_le16()
- le32_to_cpu() to get_unaligned_le32()
when access fields in struct bmp header.

This changes avoids data abort exception caused by unaligned data access.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>

---
Changes v2:
- new patch

Changes v3:
- common/Makefile - remove CFLAG: -mno-unaligned-access
- common/lcd.c - fix data abort exception when access bmp_header

 common/lcd.c |   27 +++++++++++++--------------
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/common/lcd.c b/common/lcd.c
index 56bf067..aa81522 100644
--- a/common/lcd.c
+++ b/common/lcd.c
@@ -26,7 +26,7 @@
 #endif
 #include <lcd.h>
 #include <watchdog.h>
-
+#include <asm/unaligned.h>
 #include <splash.h>
 
 #if defined(CONFIG_CPU_PXA25X) || defined(CONFIG_CPU_PXA27X) || \
@@ -777,9 +777,9 @@ static void lcd_display_rle8_bitmap(bmp_image_t *bmp, ushort *cmap, uchar *fb,
 	int x, y;
 	int decode = 1;
 
-	width = le32_to_cpu(bmp->header.width);
-	height = le32_to_cpu(bmp->header.height);
-	bmap = (uchar *)bmp + le32_to_cpu(bmp->header.data_offset);
+	width = get_unaligned_le32(&bmp->header.width);
+	height = get_unaligned_le32(&bmp->header.height);
+	bmap = (uchar *)bmp + get_unaligned_le32(&bmp->header.data_offset);
 
 	x = 0;
 	y = height - 1;
@@ -900,9 +900,10 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
 		return 1;
 	}
 
-	width = le32_to_cpu(bmp->header.width);
-	height = le32_to_cpu(bmp->header.height);
-	bmp_bpix = le16_to_cpu(bmp->header.bit_count);
+	width = get_unaligned_le32(&bmp->header.width);
+	height = get_unaligned_le32(&bmp->header.height);
+	bmp_bpix = get_unaligned_le16(&bmp->header.bit_count);
+
 	colors = 1 << bmp_bpix;
 
 	bpix = NBITS(panel_info.vl_bpix);
@@ -917,9 +918,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
 	/* We support displaying 8bpp BMPs on 16bpp LCDs */
 	if (bpix != bmp_bpix && !(bmp_bpix == 8 && bpix == 16)) {
 		printf ("Error: %d bit/pixel mode, but BMP has %d bit/pixel\n",
-			bpix,
-			le16_to_cpu(bmp->header.bit_count));
-
+			bpix, get_unaligned_le16(&bmp->header.bit_count));
 		return 1;
 	}
 
@@ -956,7 +955,6 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
 		}
 	}
 #endif
-
 	/*
 	 *  BMP format for Monochrome assumes that the state of a
 	 * pixel is described on a per Bit basis, not per Byte.
@@ -987,15 +985,16 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
 	if ((y + height) > panel_info.vl_row)
 		height = panel_info.vl_row - y;
 
-	bmap = (uchar *) bmp + le32_to_cpu(bmp->header.data_offset);
-	fb   = (uchar *) (lcd_base +
+	bmap = (uchar *)bmp + get_unaligned_le32(&bmp->header.data_offset);
+	fb   = (uchar *)(lcd_base +
 		(y + height - 1) * lcd_line_length + x * bpix / 8);
 
 	switch (bmp_bpix) {
 	case 1: /* pass through */
 	case 8:
 #ifdef CONFIG_LCD_BMP_RLE8
-		if (le32_to_cpu(bmp->header.compression) == BMP_BI_RLE8) {
+		u32 compression = get_unaligned_le32(&bmp->header.compression);
+		if (compression == BMP_BI_RLE8) {
 			if (bpix != 16) {
 				/* TODO implement render code for bpix != 16 */
 				printf("Error: only support 16 bpix");
-- 
1.7.9.5

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

* [U-Boot] [PATCH v3 06/12] lib: tizen: change Tizen logo with the new one.
  2014-01-03 16:43 ` [U-Boot] [PATCH v3 01/12] s5p: gpio: change gpio coding method for s5p gpio Przemyslaw Marczak
                     ` (3 preceding siblings ...)
  2014-01-03 16:43   ` [U-Boot] [PATCH v3 05/12] common: lcd.c: fix data abort exception when try to access bmp header Przemyslaw Marczak
@ 2014-01-03 16:43   ` Przemyslaw Marczak
  2014-01-03 16:43   ` [U-Boot] [PATCH v3 07/12] video: exynos: fimd: add support for various display color modes Przemyslaw Marczak
                     ` (6 subsequent siblings)
  11 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-03 16:43 UTC (permalink / raw)
  To: u-boot

Changes:
- check image bpp instead of resolution when returns logo address
- remove 32bpp logo
- add 16bpp logo in two formats: bmp and gzipped bmp
- init logo address with "0" for unsupported bpp mode
- update boards configs with proper image size for gunzip
- extend structure vidinfo by two fields: logo_x_offset and logo_y_offset.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>

---
Changes v2:
- assign 0 value to logo address for unsupported logo bpp mode.
- remove old tizen 32bpp logo
- add new tizen 16bpp logo in two formats: bmp and gzipped bmp
- lib/tizen.c - code cleanup
- update boards configs with proper image size for gunzip

Changes v3:
- fix logo quality issue
- add two fields to struct vidinfo: logo_x_offset and logo_y_offset
  to simplify center logo alignment

 board/samsung/common/misc.c         |    2 +
 include/configs/s5pc210_universal.h |    2 +-
 include/configs/trats.h             |    2 +-
 include/configs/trats2.h            |    2 +-
 include/lcd.h                       |    2 +
 lib/tizen/tizen.c                   |   21 +-
 lib/tizen/tizen_hd_logo.h           | 5057 ------------------
 lib/tizen/tizen_hd_logo_data.h      |   15 -
 lib/tizen/tizen_logo_16bpp.h        |10025 +++++++++++++++++++++++++++++++++++
 lib/tizen/tizen_logo_16bpp_gzip.h   |  727 +++
 10 files changed, 10773 insertions(+), 5082 deletions(-)
 delete mode 100644 lib/tizen/tizen_hd_logo.h
 delete mode 100644 lib/tizen/tizen_hd_logo_data.h
 create mode 100644 lib/tizen/tizen_logo_16bpp.h
 create mode 100644 lib/tizen/tizen_logo_16bpp_gzip.h

This is big size patch. PLease follow the link:

http://www.denx.de/wiki/pub/U-Boot/TooBigPatches/0006-lib-tizen-change-Tizen-logo-with-the-new-one.patch

--
1.7.9.5

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

* [U-Boot] [PATCH v3 07/12] video: exynos: fimd: add support for various display color modes
  2014-01-03 16:43 ` [U-Boot] [PATCH v3 01/12] s5p: gpio: change gpio coding method for s5p gpio Przemyslaw Marczak
                     ` (4 preceding siblings ...)
  2014-01-03 16:43   ` [U-Boot] [PATCH v3 06/12] lib: tizen: change Tizen logo with the new one Przemyslaw Marczak
@ 2014-01-03 16:43   ` Przemyslaw Marczak
  2014-01-03 16:43   ` [U-Boot] [PATCH v3 08/12] samsung: boards: update display configs with 16bpp mode Przemyslaw Marczak
                     ` (5 subsequent siblings)
  11 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-03 16:43 UTC (permalink / raw)
  To: u-boot

Now fimd BPP color mode depends on vl_bpp value in struct "panel_info".

There is only 16BPP mode check, default mode is 24BPP.
Other fimd modes are usually unneeded and also needs some fimd driver
modifications and tests.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>

---
Changes v2:
- check panel_info vl_bpix when setting fimd color mode
- move boards configs update to another commit.

Changes v3:
- none

 drivers/video/exynos_fimd.c |   15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/video/exynos_fimd.c b/drivers/video/exynos_fimd.c
index f962c4f..cebbba7 100644
--- a/drivers/video/exynos_fimd.c
+++ b/drivers/video/exynos_fimd.c
@@ -73,18 +73,19 @@ static void exynos_fimd_set_par(unsigned int win_id)
 	/* DATAPATH is DMA */
 	cfg |= EXYNOS_WINCON_DATAPATH_DMA;
 
-	if (pvid->logo_on) /* To get proprietary LOGO */
-		cfg |= EXYNOS_WINCON_WSWP_ENABLE;
-	else /* To get output console on LCD */
-		cfg |= EXYNOS_WINCON_HAWSWP_ENABLE;
+	cfg |= EXYNOS_WINCON_HAWSWP_ENABLE;
 
 	/* dma burst is 16 */
 	cfg |= EXYNOS_WINCON_BURSTLEN_16WORD;
 
-	if (pvid->logo_on) /* To get proprietary LOGO */
-		cfg |= EXYNOS_WINCON_BPPMODE_24BPP_888;
-	else /* To get output console on LCD */
+	switch (pvid->vl_bpix) {
+	case 4:
 		cfg |= EXYNOS_WINCON_BPPMODE_16BPP_565;
+		break;
+	default:
+		cfg |= EXYNOS_WINCON_BPPMODE_24BPP_888;
+		break;
+	}
 
 	writel(cfg, (unsigned int)&fimd_ctrl->wincon0 +
 			EXYNOS_WINCON(win_id));
-- 
1.7.9.5

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

* [U-Boot] [PATCH v3 08/12] samsung: boards: update display configs with 16bpp mode.
  2014-01-03 16:43 ` [U-Boot] [PATCH v3 01/12] s5p: gpio: change gpio coding method for s5p gpio Przemyslaw Marczak
                     ` (5 preceding siblings ...)
  2014-01-03 16:43   ` [U-Boot] [PATCH v3 07/12] video: exynos: fimd: add support for various display color modes Przemyslaw Marczak
@ 2014-01-03 16:43   ` Przemyslaw Marczak
  2014-01-03 16:43   ` [U-Boot] [PATCH v3 09/12] samsung: misc: Add LCD download menu Przemyslaw Marczak
                     ` (4 subsequent siblings)
  11 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-03 16:43 UTC (permalink / raw)
  To: u-boot

16 bpp mode is required by LCD console mode.
This change updates exynos board files.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>

---
Changes v2:
-- new patch

Changes v3:
- none

 board/samsung/trats/trats.c              |    2 +-
 board/samsung/trats2/trats2.c            |    2 +-
 board/samsung/universal_c210/universal.c |    2 +-
 include/configs/s5pc210_universal.h      |    2 +-
 include/configs/trats.h                  |    2 +-
 include/configs/trats2.h                 |    2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/board/samsung/trats/trats.c b/board/samsung/trats/trats.c
index cd27f18..a849b73 100644
--- a/board/samsung/trats/trats.c
+++ b/board/samsung/trats/trats.c
@@ -742,7 +742,7 @@ vidinfo_t panel_info = {
 	.vl_hsp		= CONFIG_SYS_LOW,
 	.vl_vsp		= CONFIG_SYS_LOW,
 	.vl_dp		= CONFIG_SYS_LOW,
-	.vl_bpix	= 5,	/* Bits per pixel, 2^5 = 32 */
+	.vl_bpix	= 4,	/* Bits per pixel, 2^4 = 16 */
 
 	/* s6e8ax0 Panel infomation */
 	.vl_hspw	= 5,
diff --git a/board/samsung/trats2/trats2.c b/board/samsung/trats2/trats2.c
index 9a2c212..bae8d6c 100644
--- a/board/samsung/trats2/trats2.c
+++ b/board/samsung/trats2/trats2.c
@@ -565,7 +565,7 @@ vidinfo_t panel_info = {
 	.vl_hsp		= CONFIG_SYS_LOW,
 	.vl_vsp		= CONFIG_SYS_LOW,
 	.vl_dp		= CONFIG_SYS_LOW,
-	.vl_bpix	= 5,	/* Bits per pixel, 2^5 = 32 */
+	.vl_bpix	= 4,	/* Bits per pixel, 2^4 = 16 */
 
 	/* s6e8ax0 Panel infomation */
 	.vl_hspw	= 5,
diff --git a/board/samsung/universal_c210/universal.c b/board/samsung/universal_c210/universal.c
index 166d5ee..1ebea0f 100644
--- a/board/samsung/universal_c210/universal.c
+++ b/board/samsung/universal_c210/universal.c
@@ -446,7 +446,7 @@ vidinfo_t panel_info = {
 	.vl_vsp		= CONFIG_SYS_HIGH,
 	.vl_dp		= CONFIG_SYS_HIGH,
 
-	.vl_bpix	= 5,	/* Bits per pixel */
+	.vl_bpix	= 4,	/* Bits per pixel */
 
 	/* LD9040 LCD Panel */
 	.vl_hspw	= 2,
diff --git a/include/configs/s5pc210_universal.h b/include/configs/s5pc210_universal.h
index 3c0a974..4079b7c 100644
--- a/include/configs/s5pc210_universal.h
+++ b/include/configs/s5pc210_universal.h
@@ -278,7 +278,7 @@ int universal_spi_read(void);
 #define CONFIG_EXYNOS_FB
 #define CONFIG_LCD
 #define CONFIG_CMD_BMP
-#define CONFIG_BMP_32BPP
+#define CONFIG_BMP_16BPP
 #define CONFIG_LD9040
 #define CONFIG_EXYNOS_MIPI_DSIM
 #define CONFIG_VIDEO_BMP_GZIP
diff --git a/include/configs/trats.h b/include/configs/trats.h
index 9a7dea1..79f9168 100644
--- a/include/configs/trats.h
+++ b/include/configs/trats.h
@@ -308,7 +308,7 @@
 #define CONFIG_EXYNOS_FB
 #define CONFIG_LCD
 #define CONFIG_CMD_BMP
-#define CONFIG_BMP_32BPP
+#define CONFIG_BMP_16BPP
 #define CONFIG_FB_ADDR		0x52504000
 #define CONFIG_S6E8AX0
 #define CONFIG_EXYNOS_MIPI_DSIM
diff --git a/include/configs/trats2.h b/include/configs/trats2.h
index 8c7c6bd..740ceb1 100644
--- a/include/configs/trats2.h
+++ b/include/configs/trats2.h
@@ -319,7 +319,7 @@ int get_soft_i2c_sda_pin(void);
 #define CONFIG_EXYNOS_FB
 #define CONFIG_LCD
 #define CONFIG_CMD_BMP
-#define CONFIG_BMP_32BPP
+#define CONFIG_BMP_16BPP
 #define CONFIG_FB_ADDR		0x52504000
 #define CONFIG_S6E8AX0
 #define CONFIG_EXYNOS_MIPI_DSIM
-- 
1.7.9.5

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

* [U-Boot] [PATCH v3 09/12] samsung: misc: Add LCD download menu.
  2014-01-03 16:43 ` [U-Boot] [PATCH v3 01/12] s5p: gpio: change gpio coding method for s5p gpio Przemyslaw Marczak
                     ` (6 preceding siblings ...)
  2014-01-03 16:43   ` [U-Boot] [PATCH v3 08/12] samsung: boards: update display configs with 16bpp mode Przemyslaw Marczak
@ 2014-01-03 16:43   ` Przemyslaw Marczak
  2014-01-06 11:38     ` Minkyu Kang
  2014-01-03 16:43   ` [U-Boot] [PATCH v3 10/12] Trats: add LCD download menu support Przemyslaw Marczak
                     ` (3 subsequent siblings)
  11 siblings, 1 reply; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-03 16:43 UTC (permalink / raw)
  To: u-boot

This simple LCD menu allows run one of download mode on device
without writing on console or for fast and easy upgrade.
This feature check user keys combination at boot:
- power key + volume up - download menu
- power key + volume down - thor mode (without menu)

New configs:
- CONFIG_LCD_MENU
- CONFIG_LCD_MENU_BOARD
which depends on: CONFIG_MISC_INIT_R

For proper effect this feature needs following definitions:

Power key:
- KEY_PWR_PMIC_NAME - (string) pmic which supports power key check

Register address:
- KEY_PWR_STATUS_REG
- KEY_PWR_INTERRUPT_REG

Register power key mask:
- KEY_PWR_STATUS_MASK
- KEY_PWR_INTERRUPT_MASK

Gpio numbers:
- KEY_PWR_INTERRUPT_MASK
- KEY_VOL_DOWN_GPIO

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>

---
Changes v2:
- remove keys.h  - definitions should be in boards headers
- add misc.h
- code cleanup
- extend commit msg by more informations

Changes v3:
- none

 board/samsung/common/misc.c |  340 +++++++++++++++++++++++++++++++++++++++++++
 board/samsung/common/misc.h |   18 +++
 2 files changed, 358 insertions(+)
 create mode 100644 board/samsung/common/misc.h

diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
index 3a91d62..93f766c 100644
--- a/board/samsung/common/misc.c
+++ b/board/samsung/common/misc.c
@@ -8,6 +8,341 @@
 #include <common.h>
 #include <lcd.h>
 #include <libtizen.h>
+#include <errno.h>
+#include <version.h>
+#include <asm/sizes.h>
+#include <asm/arch/cpu.h>
+#include <asm/arch/gpio.h>
+#include <asm/gpio.h>
+#include <linux/input.h>
+#include <lcd.h>
+#include <libtizen.h>
+#include <power/pmic.h>
+#include <mmc.h>
+#include "misc.h"
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#ifdef CONFIG_LCD_MENU
+static int power_key_pressed(int reg)
+{
+	struct pmic *pmic = pmic_get(KEY_PWR_PMIC_NAME);
+	u32 status = 0;
+	u32 mask;
+
+	if (pmic_probe(pmic))
+		return 0;
+
+	if (!pmic) {
+		printf("%s: Not found\n", KEY_PWR_PMIC_NAME);
+		return 0;
+	}
+
+	if (reg == KEY_PWR_STATUS_REG)
+		mask = KEY_PWR_STATUS_MASK;
+	else
+		mask = KEY_PWR_INTERRUPT_MASK;
+
+	if (pmic_reg_read(pmic, reg, &status))
+		return 0;
+
+	return !!(status & mask);
+}
+
+static int key_pressed(int key)
+{
+	int value = 0;
+
+	switch (key) {
+	case KEY_POWER:
+		value = power_key_pressed(KEY_PWR_INTERRUPT_REG);
+		break;
+	case KEY_VOLUMEUP:
+		value = !gpio_get_value(KEY_VOL_UP_GPIO);
+		break;
+	case KEY_VOLUMEDOWN:
+		value = !gpio_get_value(KEY_VOL_DOWN_GPIO);
+		break;
+	default:
+		break;
+	}
+
+	return value;
+}
+
+static int check_keys(void)
+{
+	int keys = 0;
+
+	if (key_pressed(KEY_POWER))
+		keys += KEY_POWER;
+	if (key_pressed(KEY_VOLUMEUP))
+		keys += KEY_VOLUMEUP;
+	if (key_pressed(KEY_VOLUMEDOWN))
+		keys += KEY_VOLUMEDOWN;
+
+	return keys;
+}
+
+/*
+ * 0 BOOT_MODE_INFO
+ * 1 BOOT_MODE_THOR
+ * 2 BOOT_MODE_UMS
+ * 3 BOOT_MODE_DFU
+ * 4 BOOT_MODE_EXIT
+ */
+static char *
+mode_name[BOOT_MODE_EXIT + 1] = {"DEVICE",
+				"THOR",
+				"UMS",
+				"DFU",
+				"EXIT"};
+
+static char *
+mode_info[BOOT_MODE_EXIT + 1] = {"info",
+				 "downloader",
+				 "mass storage",
+				 "firmware update",
+				 "and run normal boot"};
+
+static char *
+mode_cmd[BOOT_MODE_EXIT + 1] = {"",
+				"thor 0 mmc 0",
+				"ums 0 mmc 0",
+				"dfu 0 mmc 0",
+				""};
+
+static void display_board_info(void)
+{
+	struct mmc *mmc = find_mmc_device(0);
+	vidinfo_t *vid = &panel_info;
+
+	lcd_position_cursor(4, 4);
+
+	lcd_printf("%s\n\t", U_BOOT_VERSION);
+	lcd_puts("\n\t\tBoard Info:\n");
+#ifdef CONFIG_SYS_BOARD
+	lcd_printf("\tBoard name: %s\n", CONFIG_SYS_BOARD);
+#endif
+#ifdef CONFIG_REVISION_TAG
+	lcd_printf("\tBoard rev: %u\n", get_board_rev());
+#endif
+	lcd_printf("\tDRAM banks: %u\n", CONFIG_NR_DRAM_BANKS);
+	lcd_printf("\tDRAM size: %u MB\n", gd->ram_size / SZ_1M);
+
+	if (mmc)
+		lcd_printf("\teMMC size: %llu MB\n", mmc->capacity / SZ_1M);
+
+	if (vid)
+		lcd_printf("\tDisplay resolution: %u x % u\n",
+			   vid->vl_col, vid->vl_row);
+
+	lcd_printf("\tDisplay BPP: %u\n", 1 << vid->vl_bpix);
+}
+
+static int mode_leave_menu(int mode)
+{
+	int mode_supported = 1;
+	int leave = 0;
+	char *exit_option;
+	char *exit_boot = "boot";
+	char *exit_back = "back";
+
+	switch (mode) {
+	case BOOT_MODE_INFO:
+#if !defined(CONFIG_LCD_MENU_BOARD)
+		mode_supported = 0;
+#endif
+		break;
+	case BOOT_MODE_THOR:
+#if !defined(CONFIG_CMD_THOR_DOWNLOAD)
+		mode_supported = 0;
+#endif
+		break;
+	case BOOT_MODE_UMS:
+#if !defined(CONFIG_CMD_USB_MASS_STORAGE)
+		mode_supported = 0;
+#endif
+		break;
+	case BOOT_MODE_DFU:
+#if !defined(CONFIG_CMD_DFU)
+		mode_supported = 0;
+#endif
+		break;
+	case BOOT_MODE_EXIT:
+		leave = 1;
+		goto exit;
+	default:
+		break;
+	}
+
+	lcd_clear();
+
+	if (mode_supported) {
+		if (mode) {
+			lcd_printf("\n\n\t%s %s\n", mode_name[mode],
+						    mode_info[mode]);
+			lcd_puts("\n\tDo not turn off device before finish!\n");
+
+			run_command(mode_cmd[mode], 0);
+			printf("Command finished\n");
+			lcd_clear();
+			lcd_printf("\n\n\t%s finished\n", mode_name[mode]);
+			exit_option = exit_boot;
+			leave = 1;
+		} else {
+			display_board_info();
+			exit_option = exit_back;
+			leave = 0;
+		}
+	} else {
+		lcd_puts("\n\n\tThis mode is not supported.\n");
+		exit_option = exit_back;
+		leave = 0;
+	}
+
+	lcd_printf("\n\n\tPress POWER KEY to %s\n", exit_option);
+
+	/* Wait for PWR key */
+	while (!key_pressed(KEY_POWER))
+		udelay(1000);
+exit:
+	lcd_clear();
+	return leave;
+}
+
+static void display_download_menu(int mode)
+{
+	char *menu_name = "Download Mode Menu";
+	char *indicator = "[=>]";
+	char *blank = "[  ]";
+	char *selection[BOOT_MODE_EXIT + 1];
+	int i;
+
+	for (i = 0; i <= BOOT_MODE_EXIT; i++)
+		selection[i] = blank;
+
+	selection[mode] = indicator;
+
+	lcd_clear();
+	lcd_printf("\n\t\t%s\n", menu_name);
+
+	for (i = 0; i <= BOOT_MODE_EXIT; i++)
+		lcd_printf("\t%s  %s - %s\n\n", selection[i],
+						mode_name[i],
+						mode_info[i]);
+}
+
+static void download_menu(void)
+{
+	int mode = 0;
+	int last_mode = 0;
+	int run;
+	int key;
+
+	display_download_menu(mode);
+
+	while (1) {
+		run = 0;
+
+		if (mode != last_mode)
+			display_download_menu(mode);
+
+		last_mode = mode;
+		udelay(100000);
+
+		key = check_keys();
+		switch (key) {
+		case KEY_POWER:
+			run = 1;
+			break;
+		case KEY_VOLUMEUP:
+			if (mode > 0)
+				mode--;
+			break;
+		case KEY_VOLUMEDOWN:
+			if (mode < BOOT_MODE_EXIT)
+				mode++;
+			break;
+		default:
+			break;
+		}
+
+		if (run) {
+			if (mode_leave_menu(mode))
+				break;
+
+			display_download_menu(mode);
+		}
+	}
+
+	lcd_clear();
+}
+
+static void display_mode_info(void)
+{
+	lcd_position_cursor(4, 4);
+	lcd_printf("%s\n", U_BOOT_VERSION);
+	lcd_puts("\nDownload Mode Menu\n");
+#ifdef CONFIG_SYS_BOARD
+	lcd_printf("Board name: %s\n", CONFIG_SYS_BOARD);
+#endif
+	lcd_printf("Press POWER KEY to display MENU options.");
+}
+
+static int boot_menu(void)
+{
+	int key = 0;
+	int timeout = 10;
+
+	display_mode_info();
+
+	while (timeout--) {
+		lcd_printf("\rNormal boot will start in: %d seconds.", timeout);
+		udelay(1000000);
+
+		key = key_pressed(KEY_POWER);
+		if (key)
+			break;
+	}
+
+	lcd_clear();
+
+	/* If PWR pressed - show download menu */
+	if (key) {
+		printf("Power pressed - go to download menu\n");
+		udelay(1000000);
+		download_menu();
+		printf("Download mode exit.\n");
+	}
+
+	return 0;
+}
+
+static void check_boot_mode(void)
+{
+	int pwr_key;
+
+	pwr_key = power_key_pressed(KEY_PWR_STATUS_REG);
+	if (!pwr_key)
+		return;
+
+	/* Clear PWR button Rising edge interrupt status flag */
+	power_key_pressed(KEY_PWR_INTERRUPT_REG);
+
+	if (key_pressed(KEY_VOLUMEUP))
+		boot_menu();
+	else if (key_pressed(KEY_VOLUMEDOWN))
+		mode_leave_menu(BOOT_MODE_THOR);
+}
+
+static void keys_init(void)
+{
+	/* Set direction to input */
+	gpio_direction_input(KEY_VOL_UP_GPIO);
+	gpio_direction_input(KEY_VOL_DOWN_GPIO);
+}
+#endif /* CONFIG_LCD_MENU */
 
 #ifdef CONFIG_CMD_BMP
 static void draw_logo(void)
@@ -50,9 +385,14 @@ static void draw_logo(void)
 /* Common for Samsung boards */
 int misc_init_r(void)
 {
+#ifdef CONFIG_LCD_MENU
+	keys_init();
+	check_boot_mode();
+#endif
 #ifdef CONFIG_CMD_BMP
 	if (panel_info.logo_on)
 		draw_logo();
 #endif
+
 	return 0;
 }
diff --git a/board/samsung/common/misc.h b/board/samsung/common/misc.h
new file mode 100644
index 0000000..f583552
--- /dev/null
+++ b/board/samsung/common/misc.h
@@ -0,0 +1,18 @@
+#ifndef __SAMSUNG_COMMON_MISC_H__
+#define __SAMSUNG_COMMON_MISC_H__
+
+#ifdef CONFIG_LCD_MENU
+enum {
+	BOOT_MODE_INFO,
+	BOOT_MODE_THOR,
+	BOOT_MODE_UMS,
+	BOOT_MODE_DFU,
+	BOOT_MODE_EXIT,
+};
+
+#ifdef CONFIG_REVISION_TAG
+u32 get_board_rev(void);
+#endif
+#endif /* CONFIG_LCD_MENU */
+
+#endif /* __SAMSUNG_COMMON_MISC_H__ */
\ No newline@end of file
-- 
1.7.9.5

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

* [U-Boot] [PATCH v3 10/12] Trats: add LCD download menu support
  2014-01-03 16:43 ` [U-Boot] [PATCH v3 01/12] s5p: gpio: change gpio coding method for s5p gpio Przemyslaw Marczak
                     ` (7 preceding siblings ...)
  2014-01-03 16:43   ` [U-Boot] [PATCH v3 09/12] samsung: misc: Add LCD download menu Przemyslaw Marczak
@ 2014-01-03 16:43   ` Przemyslaw Marczak
  2014-01-03 17:20     ` Przemyslaw Marczak
  2014-01-03 16:43   ` [U-Boot] [PATCH v3 11/12] trats2: " Przemyslaw Marczak
                     ` (2 subsequent siblings)
  11 siblings, 1 reply; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-03 16:43 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Lukasz Majewski <l.majewski@samsung.com>

---
changes v2:
- add definitions to check keys
- cleanup config definitions
- add acked-by

Changes v3:
- change CONFIG_BOARD_NAME to CONFIG_SYS_BOARD in include/configs/trats.h

 include/configs/trats.h |   23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/include/configs/trats.h b/include/configs/trats.h
index 79f9168..521fa3e 100644
--- a/include/configs/trats.h
+++ b/include/configs/trats.h
@@ -20,6 +20,7 @@
 #define CONFIG_EXYNOS4210	/* which is in a EXYNOS4210 */
 #define CONFIG_TRATS		/* working with TRATS */
 #define CONFIG_TIZEN		/* TIZEN lib */
+#define CONFIG_SYS_BOARD	"TRATS"
 
 #include <asm/arch/cpu.h>	/* get chip and board defs */
 
@@ -304,6 +305,28 @@
 /* Common misc for Samsung */
 #define CONFIG_MISC_INIT_R
 
+/* Download menu - Samsung common */
+#define CONFIG_LCD_MENU
+#define CONFIG_LCD_MENU_BOARD
+
+/* Download menu - definitions for check keys */
+#ifndef __ASSEMBLY__
+#include <power/max8997_pmic.h>
+
+#define KEY_PWR_PMIC_NAME		"MAX8997_PMIC"
+#define KEY_PWR_STATUS_REG		MAX8997_REG_STATUS1
+#define KEY_PWR_STATUS_MASK		(1 << 0)
+#define KEY_PWR_INTERRUPT_REG		MAX8997_REG_INT1
+#define KEY_PWR_INTERRUPT_MASK		(1 << 0)
+
+#define KEY_VOL_UP_GPIO			exynos4_gpio_get(2, x2, 0)
+#define KEY_VOL_DOWN_GPIO		exynos4_gpio_get(2, x2, 1)
+#endif /* __ASSEMBLY__ */
+
+/* LCD console */
+#define LCD_BPP			LCD_COLOR16
+#define CONFIG_SYS_WHITE_ON_BLACK
+
 /* LCD */
 #define CONFIG_EXYNOS_FB
 #define CONFIG_LCD
-- 
1.7.9.5

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

* [U-Boot] [PATCH v3 11/12] trats2: add LCD download menu support
  2014-01-03 16:43 ` [U-Boot] [PATCH v3 01/12] s5p: gpio: change gpio coding method for s5p gpio Przemyslaw Marczak
                     ` (8 preceding siblings ...)
  2014-01-03 16:43   ` [U-Boot] [PATCH v3 10/12] Trats: add LCD download menu support Przemyslaw Marczak
@ 2014-01-03 16:43   ` Przemyslaw Marczak
  2014-01-03 17:21     ` Przemyslaw Marczak
  2014-01-03 16:43   ` [U-Boot] [PATCH v3 12/12] universal: " Przemyslaw Marczak
  2014-01-06 11:37   ` [U-Boot] [PATCH v3 01/12] s5p: gpio: change gpio coding method for s5p gpio Minkyu Kang
  11 siblings, 1 reply; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-03 16:43 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>

---
changes v2:
- add definitions for check keys
- cleanup config definitions

Changes v3:
- change CONFIG_BOARD_NAME to CONFIG_SYS_BOARD in include/configs/trats2.h

 include/configs/trats2.h |   27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/include/configs/trats2.h b/include/configs/trats2.h
index 740ceb1..4b1a8ea 100644
--- a/include/configs/trats2.h
+++ b/include/configs/trats2.h
@@ -19,6 +19,8 @@
 #define CONFIG_S5P		/* which is in a S5P Family */
 #define CONFIG_EXYNOS4		/* which is in a EXYNOS4XXX */
 #define CONFIG_TIZEN		/* TIZEN lib */
+#define CONFIG_TRATS2
+#define CONFIG_SYS_BOARD	"TRATS2"
 
 #include <asm/arch/cpu.h>		/* get chip and board defs */
 
@@ -315,6 +317,31 @@ int get_soft_i2c_sda_pin(void);
 /* Common misc for Samsung */
 #define CONFIG_MISC_INIT_R
 
+/* Download menu - Samsung common */
+#define CONFIG_LCD_MENU
+#define CONFIG_LCD_MENU_BOARD
+
+/* Download menu - definitions for check keys */
+#ifndef __ASSEMBLY__
+#ifdef __COMMON_H_
+#include <power/pmic.h>
+#include <power/max77686_pmic.h>
+
+#define KEY_PWR_PMIC_NAME		"MAX77686_PMIC"
+#define KEY_PWR_STATUS_REG		MAX77686_REG_PMIC_STATUS1
+#define KEY_PWR_STATUS_MASK		(1 << 0)
+#define KEY_PWR_INTERRUPT_REG		MAX77686_REG_PMIC_INT1
+#define KEY_PWR_INTERRUPT_MASK		(1 << 1)
+
+#define KEY_VOL_UP_GPIO			exynos4x12_gpio_get(2, x2, 2)
+#define KEY_VOL_DOWN_GPIO		exynos4x12_gpio_get(2, x3, 3)
+#endif /* __COMMON_H_ */
+#endif /* __ASSEMBLY__ */
+
+/* LCD console */
+#define LCD_BPP                 LCD_COLOR16
+#define CONFIG_SYS_WHITE_ON_BLACK
+
 /* LCD */
 #define CONFIG_EXYNOS_FB
 #define CONFIG_LCD
-- 
1.7.9.5

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

* [U-Boot] [PATCH v3 12/12] universal: add LCD download menu support
  2014-01-03 16:43 ` [U-Boot] [PATCH v3 01/12] s5p: gpio: change gpio coding method for s5p gpio Przemyslaw Marczak
                     ` (9 preceding siblings ...)
  2014-01-03 16:43   ` [U-Boot] [PATCH v3 11/12] trats2: " Przemyslaw Marczak
@ 2014-01-03 16:43   ` Przemyslaw Marczak
  2014-01-03 17:23     ` Przemyslaw Marczak
  2014-01-06 11:37   ` [U-Boot] [PATCH v3 01/12] s5p: gpio: change gpio coding method for s5p gpio Minkyu Kang
  11 siblings, 1 reply; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-03 16:43 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>

---
changes v2:
- add definitions for check keys
- cleanup config definitions

Changes v3:
- change CONFIG_BOARD_NAME to CONFIG_SYS_BOARD in
  include/configs/5pc210_universal.h

 include/configs/s5pc210_universal.h |   23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/include/configs/s5pc210_universal.h b/include/configs/s5pc210_universal.h
index 4079b7c..b230621 100644
--- a/include/configs/s5pc210_universal.h
+++ b/include/configs/s5pc210_universal.h
@@ -19,6 +19,7 @@
 #define CONFIG_EXYNOS4210	1	/* which is in a EXYNOS4210 */
 #define CONFIG_UNIVERSAL	1	/* working with Universal */
 #define CONFIG_TIZEN		1	/* TIZEN lib */
+#define CONFIG_SYS_BOARD	"UNIVERSAL C210"
 
 #include <asm/arch/cpu.h>		/* get chip and board defs */
 
@@ -272,6 +273,28 @@ int universal_spi_read(void);
 /* Common misc for Samsung */
 #define CONFIG_MISC_INIT_R
 
+/* Download menu - Samsung common */
+#define CONFIG_LCD_MENU
+#define CONFIG_LCD_MENU_BOARD
+
+/* Download menu - definitions for check keys */
+#ifndef __ASSEMBLY__
+#include <power/max8998_pmic.h>
+
+#define KEY_PWR_PMIC_NAME		"MAX8998_PMIC"
+#define KEY_PWR_STATUS_REG		MAX8998_REG_STATUS1
+#define KEY_PWR_STATUS_MASK		(1 << 7)
+#define KEY_PWR_INTERRUPT_REG		MAX8998_REG_IRQ1
+#define KEY_PWR_INTERRUPT_MASK		(1 << 7)
+
+#define KEY_VOL_UP_GPIO			exynos4_gpio_get(2, x2, 0)
+#define KEY_VOL_DOWN_GPIO		exynos4_gpio_get(2, x2, 1)
+#endif /* __ASSEMBLY__ */
+
+/* LCD console */
+#define LCD_BPP			LCD_COLOR16
+#define CONFIG_SYS_WHITE_ON_BLACK
+
 /*
  * LCD Settings
  */
-- 
1.7.9.5

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

* [U-Boot] [PATCH v3 10/12] Trats: add LCD download menu support
  2014-01-03 16:43   ` [U-Boot] [PATCH v3 10/12] Trats: add LCD download menu support Przemyslaw Marczak
@ 2014-01-03 17:20     ` Przemyslaw Marczak
  0 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-03 17:20 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Lukasz Majewski <l.majewski@samsung.com>

---
changes v2:
- add definitions to check keys
- cleanup config definitions
- add acked-by

Changes v3:
- remove CONFIG_BOARD_NAME from include/configs/trats.h

 include/configs/trats.h |   22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/include/configs/trats.h b/include/configs/trats.h
index 79f9168..2979df5 100644
--- a/include/configs/trats.h
+++ b/include/configs/trats.h
@@ -304,6 +304,28 @@
 /* Common misc for Samsung */
 #define CONFIG_MISC_INIT_R
 
+/* Download menu - Samsung common */
+#define CONFIG_LCD_MENU
+#define CONFIG_LCD_MENU_BOARD
+
+/* Download menu - definitions for check keys */
+#ifndef __ASSEMBLY__
+#include <power/max8997_pmic.h>
+
+#define KEY_PWR_PMIC_NAME		"MAX8997_PMIC"
+#define KEY_PWR_STATUS_REG		MAX8997_REG_STATUS1
+#define KEY_PWR_STATUS_MASK		(1 << 0)
+#define KEY_PWR_INTERRUPT_REG		MAX8997_REG_INT1
+#define KEY_PWR_INTERRUPT_MASK		(1 << 0)
+
+#define KEY_VOL_UP_GPIO			exynos4_gpio_get(2, x2, 0)
+#define KEY_VOL_DOWN_GPIO		exynos4_gpio_get(2, x2, 1)
+#endif /* __ASSEMBLY__ */
+
+/* LCD console */
+#define LCD_BPP			LCD_COLOR16
+#define CONFIG_SYS_WHITE_ON_BLACK
+
 /* LCD */
 #define CONFIG_EXYNOS_FB
 #define CONFIG_LCD
-- 
1.7.9.5

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

* [U-Boot] [PATCH v3 11/12] trats2: add LCD download menu support
  2014-01-03 16:43   ` [U-Boot] [PATCH v3 11/12] trats2: " Przemyslaw Marczak
@ 2014-01-03 17:21     ` Przemyslaw Marczak
  2014-01-06 11:37       ` Minkyu Kang
  0 siblings, 1 reply; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-03 17:21 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>

---
changes v2:
- add definitions for check keys
- cleanup config definitions

Changes v3:
- remove CONFIG_BOARD_NAME from include/configs/trats2.h

 include/configs/trats2.h |   26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/include/configs/trats2.h b/include/configs/trats2.h
index 740ceb1..453a37e 100644
--- a/include/configs/trats2.h
+++ b/include/configs/trats2.h
@@ -19,6 +19,7 @@
 #define CONFIG_S5P		/* which is in a S5P Family */
 #define CONFIG_EXYNOS4		/* which is in a EXYNOS4XXX */
 #define CONFIG_TIZEN		/* TIZEN lib */
+#define CONFIG_TRATS2
 
 #include <asm/arch/cpu.h>		/* get chip and board defs */
 
@@ -315,6 +316,31 @@ int get_soft_i2c_sda_pin(void);
 /* Common misc for Samsung */
 #define CONFIG_MISC_INIT_R
 
+/* Download menu - Samsung common */
+#define CONFIG_LCD_MENU
+#define CONFIG_LCD_MENU_BOARD
+
+/* Download menu - definitions for check keys */
+#ifndef __ASSEMBLY__
+#ifdef __COMMON_H_
+#include <power/pmic.h>
+#include <power/max77686_pmic.h>
+
+#define KEY_PWR_PMIC_NAME		"MAX77686_PMIC"
+#define KEY_PWR_STATUS_REG		MAX77686_REG_PMIC_STATUS1
+#define KEY_PWR_STATUS_MASK		(1 << 0)
+#define KEY_PWR_INTERRUPT_REG		MAX77686_REG_PMIC_INT1
+#define KEY_PWR_INTERRUPT_MASK		(1 << 1)
+
+#define KEY_VOL_UP_GPIO			exynos4x12_gpio_get(2, x2, 2)
+#define KEY_VOL_DOWN_GPIO		exynos4x12_gpio_get(2, x3, 3)
+#endif /* __COMMON_H_ */
+#endif /* __ASSEMBLY__ */
+
+/* LCD console */
+#define LCD_BPP                 LCD_COLOR16
+#define CONFIG_SYS_WHITE_ON_BLACK
+
 /* LCD */
 #define CONFIG_EXYNOS_FB
 #define CONFIG_LCD
-- 
1.7.9.5

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

* [U-Boot] [PATCH v3 12/12] universal: add LCD download menu support
  2014-01-03 16:43   ` [U-Boot] [PATCH v3 12/12] universal: " Przemyslaw Marczak
@ 2014-01-03 17:23     ` Przemyslaw Marczak
  2014-01-03 17:31       ` Przemyslaw Marczak
  0 siblings, 1 reply; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-03 17:23 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>

---
changes v2:
- add definitions for check keys
- cleanup config definitions

Changes v3:
- remove CONFIG_BOARD_NAME from include/configs/5pc210_universal.h

 include/configs/s5pc210_universal.h |   22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/include/configs/s5pc210_universal.h b/include/configs/s5pc210_universal.h
index 4079b7c..ec8f991 100644
--- a/include/configs/s5pc210_universal.h
+++ b/include/configs/s5pc210_universal.h
@@ -272,6 +272,28 @@ int universal_spi_read(void);
 /* Common misc for Samsung */
 #define CONFIG_MISC_INIT_R
 
+/* Download menu - Samsung common */
+#define CONFIG_LCD_MENU
+#define CONFIG_LCD_MENU_BOARD
+
+/* Download menu - definitions for check keys */
+#ifndef __ASSEMBLY__
+#include <power/max8998_pmic.h>
+
+#define KEY_PWR_PMIC_NAME		"MAX8998_PMIC"
+#define KEY_PWR_STATUS_REG		MAX8998_REG_STATUS1
+#define KEY_PWR_STATUS_MASK		(1 << 7)
+#define KEY_PWR_INTERRUPT_REG		MAX8998_REG_IRQ1
+#define KEY_PWR_INTERRUPT_MASK		(1 << 7)
+
+#define KEY_VOL_UP_GPIO			exynos4_gpio_get(2, x2, 0)
+#define KEY_VOL_DOWN_GPIO		exynos4_gpio_get(2, x2, 1)
+#endif /* __ASSEMBLY__ */
+
+/* LCD console */
+#define LCD_BPP			LCD_COLOR16
+#define CONFIG_SYS_WHITE_ON_BLACK
+
 /*
  * LCD Settings
  */
-- 
1.7.9.5

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

* [U-Boot] [PATCH v3 12/12] universal: add LCD download menu support
  2014-01-03 17:23     ` Przemyslaw Marczak
@ 2014-01-03 17:31       ` Przemyslaw Marczak
  0 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-03 17:31 UTC (permalink / raw)
  To: u-boot

Dear all,

On 01/03/2014 06:23 PM, Przemyslaw Marczak wrote:
> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
>
> ---
> changes v2:
> - add definitions for check keys
> - cleanup config definitions
>
> Changes v3:
> - remove CONFIG_BOARD_NAME from include/configs/5pc210_universal.h
>
>   include/configs/s5pc210_universal.h |   22 ++++++++++++++++++++++
>   1 file changed, 22 insertions(+)
>

I sent patch set version 3, but there were a mistakes in last three 
patches so I resend again just those three. Sorry for that.

Regards
-- 
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com

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

* [U-Boot] [PATCH v3 05/12] common: lcd.c: fix data abort exception when try to access bmp header
  2014-01-03 16:43   ` [U-Boot] [PATCH v3 05/12] common: lcd.c: fix data abort exception when try to access bmp header Przemyslaw Marczak
@ 2014-01-06  5:05     ` Minkyu Kang
  2014-01-06  8:54     ` Anatolij Gustschin
  1 sibling, 0 replies; 147+ messages in thread
From: Minkyu Kang @ 2014-01-06  5:05 UTC (permalink / raw)
  To: u-boot

Cc: Anatolij Gustschin

On 04/01/14 01:43, Przemyslaw Marczak wrote:
> Changes:
> - le16_to_cpu() to get_unaligned_le16()
> - le32_to_cpu() to get_unaligned_le32()
> when access fields in struct bmp header.
> 
> This changes avoids data abort exception caused by unaligned data access.
> 
> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
> 
> ---
> Changes v2:
> - new patch
> 
> Changes v3:
> - common/Makefile - remove CFLAG: -mno-unaligned-access
> - common/lcd.c - fix data abort exception when access bmp_header
> 
>  common/lcd.c |   27 +++++++++++++--------------
>  1 file changed, 13 insertions(+), 14 deletions(-)
> 
> diff --git a/common/lcd.c b/common/lcd.c
> index 56bf067..aa81522 100644
> --- a/common/lcd.c
> +++ b/common/lcd.c
> @@ -26,7 +26,7 @@
>  #endif
>  #include <lcd.h>
>  #include <watchdog.h>
> -
> +#include <asm/unaligned.h>
>  #include <splash.h>
>  
>  #if defined(CONFIG_CPU_PXA25X) || defined(CONFIG_CPU_PXA27X) || \
> @@ -777,9 +777,9 @@ static void lcd_display_rle8_bitmap(bmp_image_t *bmp, ushort *cmap, uchar *fb,
>  	int x, y;
>  	int decode = 1;
>  
> -	width = le32_to_cpu(bmp->header.width);
> -	height = le32_to_cpu(bmp->header.height);
> -	bmap = (uchar *)bmp + le32_to_cpu(bmp->header.data_offset);
> +	width = get_unaligned_le32(&bmp->header.width);
> +	height = get_unaligned_le32(&bmp->header.height);
> +	bmap = (uchar *)bmp + get_unaligned_le32(&bmp->header.data_offset);
>  
>  	x = 0;
>  	y = height - 1;
> @@ -900,9 +900,10 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
>  		return 1;
>  	}
>  
> -	width = le32_to_cpu(bmp->header.width);
> -	height = le32_to_cpu(bmp->header.height);
> -	bmp_bpix = le16_to_cpu(bmp->header.bit_count);
> +	width = get_unaligned_le32(&bmp->header.width);
> +	height = get_unaligned_le32(&bmp->header.height);
> +	bmp_bpix = get_unaligned_le16(&bmp->header.bit_count);
> +
>  	colors = 1 << bmp_bpix;
>  
>  	bpix = NBITS(panel_info.vl_bpix);
> @@ -917,9 +918,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
>  	/* We support displaying 8bpp BMPs on 16bpp LCDs */
>  	if (bpix != bmp_bpix && !(bmp_bpix == 8 && bpix == 16)) {
>  		printf ("Error: %d bit/pixel mode, but BMP has %d bit/pixel\n",
> -			bpix,
> -			le16_to_cpu(bmp->header.bit_count));
> -
> +			bpix, get_unaligned_le16(&bmp->header.bit_count));
>  		return 1;
>  	}
>  
> @@ -956,7 +955,6 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
>  		}
>  	}
>  #endif
> -
>  	/*
>  	 *  BMP format for Monochrome assumes that the state of a
>  	 * pixel is described on a per Bit basis, not per Byte.
> @@ -987,15 +985,16 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
>  	if ((y + height) > panel_info.vl_row)
>  		height = panel_info.vl_row - y;
>  
> -	bmap = (uchar *) bmp + le32_to_cpu(bmp->header.data_offset);
> -	fb   = (uchar *) (lcd_base +
> +	bmap = (uchar *)bmp + get_unaligned_le32(&bmp->header.data_offset);
> +	fb   = (uchar *)(lcd_base +
>  		(y + height - 1) * lcd_line_length + x * bpix / 8);
>  
>  	switch (bmp_bpix) {
>  	case 1: /* pass through */
>  	case 8:
>  #ifdef CONFIG_LCD_BMP_RLE8
> -		if (le32_to_cpu(bmp->header.compression) == BMP_BI_RLE8) {
> +		u32 compression = get_unaligned_le32(&bmp->header.compression);
> +		if (compression == BMP_BI_RLE8) {
>  			if (bpix != 16) {
>  				/* TODO implement render code for bpix != 16 */
>  				printf("Error: only support 16 bpix");
> 

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

* [U-Boot] [PATCH v3 05/12] common: lcd.c: fix data abort exception when try to access bmp header
  2014-01-03 16:43   ` [U-Boot] [PATCH v3 05/12] common: lcd.c: fix data abort exception when try to access bmp header Przemyslaw Marczak
  2014-01-06  5:05     ` Minkyu Kang
@ 2014-01-06  8:54     ` Anatolij Gustschin
  1 sibling, 0 replies; 147+ messages in thread
From: Anatolij Gustschin @ 2014-01-06  8:54 UTC (permalink / raw)
  To: u-boot

On Fri, 03 Jan 2014 17:43:06 +0100
Przemyslaw Marczak <p.marczak@samsung.com> wrote:

> Changes:
> - le16_to_cpu() to get_unaligned_le16()
> - le32_to_cpu() to get_unaligned_le32()
> when access fields in struct bmp header.
> 
> This changes avoids data abort exception caused by unaligned data access.
> 
> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
> 
> ---
> Changes v2:
> - new patch
> 
> Changes v3:
> - common/Makefile - remove CFLAG: -mno-unaligned-access
> - common/lcd.c - fix data abort exception when access bmp_header
> 
>  common/lcd.c |   27 +++++++++++++--------------
>  1 file changed, 13 insertions(+), 14 deletions(-)

Acked-by: Anatolij Gustschin <agust@denx.de>

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

* [U-Boot] [PATCH v3 11/12] trats2: add LCD download menu support
  2014-01-03 17:21     ` Przemyslaw Marczak
@ 2014-01-06 11:37       ` Minkyu Kang
  2014-01-07 12:54         ` Przemyslaw Marczak
  0 siblings, 1 reply; 147+ messages in thread
From: Minkyu Kang @ 2014-01-06 11:37 UTC (permalink / raw)
  To: u-boot

On 04/01/14 02:21, Przemyslaw Marczak wrote:
> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
> 
> ---
> changes v2:
> - add definitions for check keys
> - cleanup config definitions
> 
> Changes v3:
> - remove CONFIG_BOARD_NAME from include/configs/trats2.h
> 
>  include/configs/trats2.h |   26 ++++++++++++++++++++++++++
>  1 file changed, 26 insertions(+)
> 
> diff --git a/include/configs/trats2.h b/include/configs/trats2.h
> index 740ceb1..453a37e 100644
> --- a/include/configs/trats2.h
> +++ b/include/configs/trats2.h
> @@ -19,6 +19,7 @@
>  #define CONFIG_S5P		/* which is in a S5P Family */
>  #define CONFIG_EXYNOS4		/* which is in a EXYNOS4XXX */
>  #define CONFIG_TIZEN		/* TIZEN lib */
> +#define CONFIG_TRATS2
>  
>  #include <asm/arch/cpu.h>		/* get chip and board defs */
>  
> @@ -315,6 +316,31 @@ int get_soft_i2c_sda_pin(void);
>  /* Common misc for Samsung */
>  #define CONFIG_MISC_INIT_R
>  
> +/* Download menu - Samsung common */
> +#define CONFIG_LCD_MENU
> +#define CONFIG_LCD_MENU_BOARD
> +
> +/* Download menu - definitions for check keys */
> +#ifndef __ASSEMBLY__
> +#ifdef __COMMON_H_

why this ifdef(__COMMON_H_) is needed?

> +#include <power/pmic.h>
> +#include <power/max77686_pmic.h>
> +
> +#define KEY_PWR_PMIC_NAME		"MAX77686_PMIC"
> +#define KEY_PWR_STATUS_REG		MAX77686_REG_PMIC_STATUS1
> +#define KEY_PWR_STATUS_MASK		(1 << 0)
> +#define KEY_PWR_INTERRUPT_REG		MAX77686_REG_PMIC_INT1
> +#define KEY_PWR_INTERRUPT_MASK		(1 << 1)
> +
> +#define KEY_VOL_UP_GPIO			exynos4x12_gpio_get(2, x2, 2)
> +#define KEY_VOL_DOWN_GPIO		exynos4x12_gpio_get(2, x3, 3)
> +#endif /* __COMMON_H_ */
> +#endif /* __ASSEMBLY__ */
> +
> +/* LCD console */
> +#define LCD_BPP                 LCD_COLOR16
> +#define CONFIG_SYS_WHITE_ON_BLACK
> +
>  /* LCD */
>  #define CONFIG_EXYNOS_FB
>  #define CONFIG_LCD
> 

Thanks,
Minkyu Kang.

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

* [U-Boot] [PATCH v3 01/12] s5p: gpio: change gpio coding method for s5p gpio.
  2014-01-03 16:43 ` [U-Boot] [PATCH v3 01/12] s5p: gpio: change gpio coding method for s5p gpio Przemyslaw Marczak
                     ` (10 preceding siblings ...)
  2014-01-03 16:43   ` [U-Boot] [PATCH v3 12/12] universal: " Przemyslaw Marczak
@ 2014-01-06 11:37   ` Minkyu Kang
  2014-01-07 12:56     ` Przemyslaw Marczak
  11 siblings, 1 reply; 147+ messages in thread
From: Minkyu Kang @ 2014-01-06 11:37 UTC (permalink / raw)
  To: u-boot

On 04/01/14 01:43, Przemyslaw Marczak wrote:
> Old s5p gpio coding method was not clean and was not working properly
> for all parts and banks. New method is clean and easy to extend.
> 
> Gpio coding mask:
> 0x000000ff - pin number
> 0x00ffff00 - bank offset
> 0xff000000 - part number
> 
> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
> 
> ---
> Changes v2:
> - none
> 
> Changes v3:
> - fix merge conflict in arch/arm/include/asm/arch-exynos/gpio.h
> - add exynos5420 gpio coding
> - update file: board/samsung/trats2/trats2.c
> 
>  arch/arm/include/asm/arch-exynos/gpio.h  |  245 +++++++++---------------------
>  arch/arm/include/asm/arch-s5pc1xx/gpio.h |   47 ++++--
>  board/samsung/trats2/trats2.c            |    8 +-
>  drivers/gpio/s5p_gpio.c                  |   15 +-
>  include/configs/s5p_goni.h               |    4 +-
>  include/configs/s5pc210_universal.h      |   12 +-
>  include/configs/trats.h                  |    4 +-
>  7 files changed, 132 insertions(+), 203 deletions(-)
> 
> diff --git a/arch/arm/include/asm/arch-exynos/gpio.h b/arch/arm/include/asm/arch-exynos/gpio.h
> index 2a19852..64bd23b 100644
> --- a/arch/arm/include/asm/arch-exynos/gpio.h
> +++ b/arch/arm/include/asm/arch-exynos/gpio.h
> @@ -247,180 +247,81 @@ void s5p_gpio_set_rate(struct s5p_gpio_bank *bank, int gpio, int mode);
>  
>  /* GPIO pins per bank  */
>  #define GPIO_PER_BANK 8
> -
> -#define exynos4_gpio_part1_get_nr(bank, pin) \
> -	((((((unsigned int) &(((struct exynos4_gpio_part1 *) \
> -			       EXYNOS4_GPIO_PART1_BASE)->bank)) \
> -	    - EXYNOS4_GPIO_PART1_BASE) / sizeof(struct s5p_gpio_bank)) \
> -	  * GPIO_PER_BANK) + pin)
> -
> -#define EXYNOS4_GPIO_PART1_MAX ((sizeof(struct exynos4_gpio_part1) \
> -			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
> -
> -#define exynos4_gpio_part2_get_nr(bank, pin) \
> -	(((((((unsigned int) &(((struct exynos4_gpio_part2 *) \
> -				EXYNOS4_GPIO_PART2_BASE)->bank)) \
> -	    - EXYNOS4_GPIO_PART2_BASE) / sizeof(struct s5p_gpio_bank)) \
> -	  * GPIO_PER_BANK) + pin) + EXYNOS4_GPIO_PART1_MAX)
> -
> -#define exynos4x12_gpio_part1_get_nr(bank, pin) \
> -	((((((unsigned int) &(((struct exynos4x12_gpio_part1 *) \
> -			       EXYNOS4X12_GPIO_PART1_BASE)->bank)) \
> -	    - EXYNOS4X12_GPIO_PART1_BASE) / sizeof(struct s5p_gpio_bank)) \
> -	  * GPIO_PER_BANK) + pin)
> -
> -#define EXYNOS4X12_GPIO_PART1_MAX ((sizeof(struct exynos4x12_gpio_part1) \
> -			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
> -
> -#define exynos4x12_gpio_part2_get_nr(bank, pin) \
> -	(((((((unsigned int) &(((struct exynos4x12_gpio_part2 *) \
> -				EXYNOS4X12_GPIO_PART2_BASE)->bank)) \
> -	    - EXYNOS4X12_GPIO_PART2_BASE) / sizeof(struct s5p_gpio_bank)) \
> -	  * GPIO_PER_BANK) + pin) + EXYNOS4X12_GPIO_PART1_MAX)
> -
> -#define EXYNOS4X12_GPIO_PART2_MAX ((sizeof(struct exynos4x12_gpio_part2) \
> -			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
> -
> -#define exynos4x12_gpio_part3_get_nr(bank, pin) \
> -	(((((((unsigned int) &(((struct exynos4x12_gpio_part3 *) \
> -				EXYNOS4X12_GPIO_PART3_BASE)->bank)) \
> -	    - EXYNOS4X12_GPIO_PART3_BASE) / sizeof(struct s5p_gpio_bank)) \
> -	  * GPIO_PER_BANK) + pin) + EXYNOS4X12_GPIO_PART2_MAX)
> -
> -#define exynos5_gpio_part1_get_nr(bank, pin) \
> -	((((((unsigned int) &(((struct exynos5_gpio_part1 *) \
> -			       EXYNOS5_GPIO_PART1_BASE)->bank)) \
> -	    - EXYNOS5_GPIO_PART1_BASE) / sizeof(struct s5p_gpio_bank)) \
> -	  * GPIO_PER_BANK) + pin)
> -
> -#define EXYNOS5_GPIO_PART1_MAX ((sizeof(struct exynos5_gpio_part1) \
> -			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
> -
> -#define exynos5_gpio_part2_get_nr(bank, pin) \
> -	(((((((unsigned int) &(((struct exynos5_gpio_part2 *) \
> -				EXYNOS5_GPIO_PART2_BASE)->bank)) \
> -	    - EXYNOS5_GPIO_PART2_BASE) / sizeof(struct s5p_gpio_bank)) \
> -	  * GPIO_PER_BANK) + pin) + EXYNOS5_GPIO_PART1_MAX)
> -
> -#define EXYNOS5_GPIO_PART2_MAX ((sizeof(struct exynos5_gpio_part2) \
> -			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
> -
> -#define exynos5_gpio_part3_get_nr(bank, pin) \
> -	(((((((unsigned int) &(((struct exynos5_gpio_part3 *) \
> -				EXYNOS5_GPIO_PART3_BASE)->bank)) \
> -	    - EXYNOS5_GPIO_PART3_BASE) / sizeof(struct s5p_gpio_bank)) \
> -	  * GPIO_PER_BANK) + pin) + EXYNOS5_GPIO_PART2_MAX)
> -
> -
> -/* EXYNOS5420 */
> -#define exynos5420_gpio_part1_get_nr(bank, pin) \
> -	((((((unsigned int) &(((struct exynos5420_gpio_part1 *)\
> -			       EXYNOS5420_GPIO_PART1_BASE)->bank)) \
> -	    - EXYNOS5420_GPIO_PART1_BASE) / sizeof(struct s5p_gpio_bank)) \
> -	  * GPIO_PER_BANK) + pin)
> -
> -#define EXYNOS5420_GPIO_PART1_MAX ((sizeof(struct exynos5420_gpio_part1) \
> -			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
> -
> -#define exynos5420_gpio_part2_get_nr(bank, pin) \
> -	(((((((unsigned int) &(((struct exynos5420_gpio_part2 *)\
> -				EXYNOS5420_GPIO_PART2_BASE)->bank)) \
> -	    - EXYNOS5420_GPIO_PART2_BASE) / sizeof(struct s5p_gpio_bank)) \
> -	  * GPIO_PER_BANK) + pin) + EXYNOS5420_GPIO_PART1_MAX)
> -
> -#define EXYNOS5420_GPIO_PART2_MAX ((sizeof(struct exynos5420_gpio_part2) \
> -			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
> -
> -#define exynos5420_gpio_part3_get_nr(bank, pin) \
> -	(((((((unsigned int) &(((struct exynos5420_gpio_part3 *)\
> -				EXYNOS5420_GPIO_PART3_BASE)->bank)) \
> -	    - EXYNOS5420_GPIO_PART3_BASE) / sizeof(struct s5p_gpio_bank)) \
> -	  * GPIO_PER_BANK) + pin) + EXYNOS5420_GPIO_PART2_MAX)
> -
> -#define EXYNOS5420_GPIO_PART3_MAX ((sizeof(struct exynos5420_gpio_part3) \
> -			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
> -
> -#define exynos5420_gpio_part4_get_nr(bank, pin) \
> -	(((((((unsigned int) &(((struct exynos5420_gpio_part4 *)\
> -				EXYNOS5420_GPIO_PART4_BASE)->bank)) \
> -	    - EXYNOS5420_GPIO_PART4_BASE) / sizeof(struct s5p_gpio_bank)) \
> -	  * GPIO_PER_BANK) + pin) + EXYNOS5420_GPIO_PART3_MAX)
> -
> -#define EXYNOS5420_GPIO_PART4_MAX ((sizeof(struct exynos5420_gpio_part4) \
> -			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
> -
> -#define EXYNOS5420_GPIO_PART5_MAX ((sizeof(struct exynos5420_gpio_part5) \
> -			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
> -
> -static inline unsigned int s5p_gpio_base(int nr)
> +#define S5P_GPIO_PART_SHIFT	(24)
> +#define S5P_GPIO_PART_MASK	(0xff)
> +#define S5P_GPIO_BANK_SHIFT	(8)
> +#define S5P_GPIO_BANK_MASK	(0xffff)
> +#define S5P_GPIO_PIN_MASK	(0xff)
> +
> +#define S5P_GPIO_SET_PART(x) \
> +			((x & S5P_GPIO_PART_MASK) << S5P_GPIO_PART_SHIFT)

x should be wrapped with brace.
please fix it globally.

> +
> +#define S5P_GPIO_GET_PART(x) \
> +			((x >> S5P_GPIO_PART_SHIFT) & S5P_GPIO_PART_MASK)
> +
> +#define S5P_GPIO_SET_PIN(x) \
> +			(x & S5P_GPIO_PIN_MASK)
> +
> +#define EXYNOS4_GPIO_SET_BANK(part, bank) \
> +			((((unsigned)&(((struct exynos4_gpio_part##part *) \
> +			EXYNOS4_GPIO_PART##part##_BASE)->bank) \
> +			- EXYNOS4_GPIO_PART##part##_BASE) \
> +			& S5P_GPIO_BANK_MASK) << S5P_GPIO_BANK_SHIFT)
> +
> +#define EXYNOS4X12_GPIO_SET_BANK(part, bank) \
> +			((((unsigned)&(((struct exynos4x12_gpio_part##part *) \
> +			EXYNOS4X12_GPIO_PART##part##_BASE)->bank) \
> +			- EXYNOS4X12_GPIO_PART##part##_BASE) \
> +			& S5P_GPIO_BANK_MASK) << S5P_GPIO_BANK_SHIFT)
> +
> +#define EXYNOS5_GPIO_SET_BANK(part, bank) \
> +			((((unsigned)&(((struct exynos5420_gpio_part##part *) \
> +			EXYNOS5420_GPIO_PART##part##_BASE)->bank) \
> +			- EXYNOS5_GPIO_PART##part##_BASE) \
> +			& S5P_GPIO_BANK_MASK) << S5P_GPIO_BANK_SHIFT)
> +
> +#define EXYNOS5420_GPIO_SET_BANK(part, bank) \
> +			((((unsigned)&(((struct exynos5420_gpio_part##part *) \
> +			EXYNOS5420_GPIO_PART##part##_BASE)->bank) \
> +			- EXYNOS5420_GPIO_PART##part##_BASE) \
> +			& S5P_GPIO_BANK_MASK) << S5P_GPIO_BANK_SHIFT)
> +
> +#define exynos4_gpio_get(part, bank, pin) \
> +			(S5P_GPIO_SET_PART(part) | \
> +			EXYNOS4_GPIO_SET_BANK(part, bank) | \
> +			S5P_GPIO_SET_PIN(pin))
> +
> +#define exynos4x12_gpio_get(part, bank, pin) \
> +			(S5P_GPIO_SET_PART(part) | \
> +			EXYNOS4X12_GPIO_SET_BANK(part, bank) | \
> +			S5P_GPIO_SET_PIN(pin))
> +
> +#define exynos5420_gpio_get(part, bank, pin) \
> +			(S5P_GPIO_SET_PART(part) | \
> +			EXYNOS5420_GPIO_SET_BANK(part, bank) | \
> +			S5P_GPIO_SET_PIN(pin))
> +
> +#define exynos5_gpio_get(part, bank, pin) \
> +			(S5P_GPIO_SET_PART(part) | \
> +			EXYNOS5_GPIO_SET_BANK(part, bank) | \
> +			S5P_GPIO_SET_PIN(pin))
> +
> +static inline unsigned int s5p_gpio_base(int gpio)
>  {
> -	if (cpu_is_exynos5()) {
> -		if (proid_is_exynos5420()) {
> -			if (nr < EXYNOS5420_GPIO_PART1_MAX)
> -				return EXYNOS5420_GPIO_PART1_BASE;
> -			else if (nr < EXYNOS5420_GPIO_PART2_MAX)
> -				return EXYNOS5420_GPIO_PART2_BASE;
> -			else if (nr < EXYNOS5420_GPIO_PART3_MAX)
> -				return EXYNOS5420_GPIO_PART3_BASE;
> -			else
> -				return EXYNOS5420_GPIO_PART4_BASE;
> -		} else {
> -			if (nr < EXYNOS5_GPIO_PART1_MAX)
> -				return EXYNOS5_GPIO_PART1_BASE;
> -			else if (nr < EXYNOS5_GPIO_PART2_MAX)
> -				return EXYNOS5_GPIO_PART2_BASE;
> -			else
> -				return EXYNOS5_GPIO_PART3_BASE;
> -		}
> -	} else if (cpu_is_exynos4()) {
> -		if (nr < EXYNOS4_GPIO_PART1_MAX)
> -			return EXYNOS4_GPIO_PART1_BASE;
> -		else
> -			return EXYNOS4_GPIO_PART2_BASE;
> +	unsigned gpio_part = S5P_GPIO_GET_PART(gpio);
> +
> +	switch (gpio_part) {
> +	case 1:
> +		return samsung_get_base_gpio_part1();
> +	case 2:
> +		return samsung_get_base_gpio_part2();
> +	case 3:
> +		return samsung_get_base_gpio_part3();
> +	case 4:
> +		return samsung_get_base_gpio_part4();
> +	default:
> +		return 0;
>  	}
> -
> -	return 0;
> -}
> -
> -static inline unsigned int s5p_gpio_part_max(int nr)
> -{
> -	if (cpu_is_exynos5()) {
> -		if (proid_is_exynos5420()) {
> -			if (nr < EXYNOS5420_GPIO_PART1_MAX)
> -				return 0;
> -			else if (nr < EXYNOS5420_GPIO_PART2_MAX)
> -				return EXYNOS5420_GPIO_PART1_MAX;
> -			else if (nr < EXYNOS5420_GPIO_PART3_MAX)
> -				return EXYNOS5420_GPIO_PART2_MAX;
> -			else if (nr < EXYNOS5420_GPIO_PART4_MAX)
> -				return EXYNOS5420_GPIO_PART3_MAX;
> -			else
> -				return EXYNOS5420_GPIO_PART4_MAX;
> -		} else {
> -			if (nr < EXYNOS5_GPIO_PART1_MAX)
> -				return 0;
> -			else if (nr < EXYNOS5_GPIO_PART2_MAX)
> -				return EXYNOS5_GPIO_PART1_MAX;
> -			else
> -				return EXYNOS5_GPIO_PART2_MAX;
> -		}
> -	} else if (cpu_is_exynos4()) {
> -		if (proid_is_exynos4412()) {
> -			if (nr < EXYNOS4X12_GPIO_PART1_MAX)
> -				return 0;
> -			else if (nr < EXYNOS4X12_GPIO_PART2_MAX)
> -				return EXYNOS4X12_GPIO_PART1_MAX;
> -			else
> -				return EXYNOS4X12_GPIO_PART2_MAX;
> -		} else {
> -			if (nr < EXYNOS4_GPIO_PART1_MAX)
> -				return 0;
> -			else
> -				return EXYNOS4_GPIO_PART1_MAX;
> -		}
> -	}
> -
> -	return 0;
>  }
>  #endif
>  
> diff --git a/arch/arm/include/asm/arch-s5pc1xx/gpio.h b/arch/arm/include/asm/arch-s5pc1xx/gpio.h
> index ac60fe6..c2d9244 100644
> --- a/arch/arm/include/asm/arch-s5pc1xx/gpio.h
> +++ b/arch/arm/include/asm/arch-s5pc1xx/gpio.h
> @@ -125,20 +125,45 @@ void s5p_gpio_set_rate(struct s5p_gpio_bank *bank, int gpio, int mode);
>  /* GPIO pins per bank  */
>  #define GPIO_PER_BANK 8
>  
> -static inline unsigned int s5p_gpio_base(int nr)
> -{
> -	return S5PC110_GPIO_BASE;
> -}
> +#define S5P_GPIO_PART_SHIFT	(24)
> +#define S5P_GPIO_PART_MASK	(0xff)
> +#define S5P_GPIO_BANK_SHIFT	(8)
> +#define S5P_GPIO_BANK_MASK	(0xffff)
> +#define S5P_GPIO_PIN_MASK	(0xff)
> +
> +#define S5P_GPIO_SET_PART(x) \
> +			((x & S5P_GPIO_PART_MASK) << S5P_GPIO_PART_SHIFT)
> +
> +#define S5P_GPIO_GET_PART(x) \
> +			((x >> S5P_GPIO_PART_SHIFT) & S5P_GPIO_PART_MASK)
> +
> +#define S5P_GPIO_SET_PIN(x) \
> +			(x & S5P_GPIO_PIN_MASK)
>  
> -static inline unsigned int s5p_gpio_part_max(int nr)
> +#define S5PC100_SET_BANK(bank) \
> +			(((unsigned)&(((struct s5pc100_gpio *) \
> +			S5PC100_GPIO_BASE)->bank) - S5PC100_GPIO_BASE) \
> +			& S5P_GPIO_BANK_MASK) << S5P_GPIO_BANK_SHIFT)
> +
> +#define S5PC110_SET_BANK(bank) \
> +			((((unsigned)&(((struct s5pc110_gpio *) \
> +			S5PC110_GPIO_BASE)->bank) - S5PC110_GPIO_BASE) \
> +			& S5P_GPIO_BANK_MASK) << S5P_GPIO_BANK_SHIFT)
> +
> +#define s5pc100_gpio_get(bank, pin) \
> +			(S5P_GPIO_SET_PART(0) | \
> +			S5PC100_SET_BANK(bank) | \
> +			S5P_GPIO_SET_PIN(pin))
> +
> +#define s5pc110_gpio_get(bank, pin) \
> +			(S5P_GPIO_SET_PART(0) | \
> +			S5PC110_SET_BANK(bank) | \
> +			S5P_GPIO_SET_PIN(pin))
> +
> +static inline unsigned int s5p_gpio_base(int nr)
>  {
> -	return 0;
> +	return samsung_get_base_gpio();
>  }
> -
> -#define s5pc110_gpio_get_nr(bank, pin)	  \
> -	((((((unsigned int)&(((struct s5pc110_gpio *)S5PC110_GPIO_BASE)->bank))\
> -	    - S5PC110_GPIO_BASE) / sizeof(struct s5p_gpio_bank)) \
> -	  * GPIO_PER_BANK) + pin)
>  #endif
>  
>  /* Pin configurations */
> diff --git a/board/samsung/trats2/trats2.c b/board/samsung/trats2/trats2.c
> index be15357..1e96fdc 100644
> --- a/board/samsung/trats2/trats2.c
> +++ b/board/samsung/trats2/trats2.c
> @@ -144,17 +144,17 @@ static void board_init_i2c(void)
>  int get_soft_i2c_scl_pin(void)
>  {
>  	if (I2C_ADAP_HWNR)
> -		return exynos4x12_gpio_part2_get_nr(m2, 1); /* I2C9 */
> +		return exynos4x12_gpio_get(2, m2, 1); /* I2C9 */
>  	else
> -		return exynos4x12_gpio_part1_get_nr(f1, 4); /* I2C8 */
> +		return exynos4x12_gpio_get(1, f1, 4); /* I2C8 */
>  }
>  
>  int get_soft_i2c_sda_pin(void)
>  {
>  	if (I2C_ADAP_HWNR)
> -		return exynos4x12_gpio_part2_get_nr(m2, 0); /* I2C9 */
> +		return exynos4x12_gpio_get(2, m2, 0); /* I2C9 */
>  	else
> -		return exynos4x12_gpio_part1_get_nr(f1, 5); /* I2C8 */
> +		return exynos4x12_gpio_get(1, f1, 5); /* I2C8 */
>  }
>  #endif
>  
> diff --git a/drivers/gpio/s5p_gpio.c b/drivers/gpio/s5p_gpio.c
> index 7eeb96d..11a0472 100644
> --- a/drivers/gpio/s5p_gpio.c
> +++ b/drivers/gpio/s5p_gpio.c
> @@ -9,6 +9,11 @@
>  #include <asm/io.h>
>  #include <asm/gpio.h>
>  
> +#define S5P_GPIO_GET_BANK(x)	((x >> S5P_GPIO_BANK_SHIFT) \
> +				& S5P_GPIO_BANK_MASK)
> +
> +#define S5P_GPIO_GET_PIN(x)	(x & S5P_GPIO_PIN_MASK)
> +
>  #define CON_MASK(x)		(0xf << ((x) << 2))
>  #define CON_SFR(x, v)		((v) << ((x) << 2))
>  
> @@ -124,17 +129,15 @@ void s5p_gpio_set_rate(struct s5p_gpio_bank *bank, int gpio, int mode)
>  
>  struct s5p_gpio_bank *s5p_gpio_get_bank(unsigned gpio)
>  {
> -	int bank;
> -	unsigned g = gpio - s5p_gpio_part_max(gpio);
> +	unsigned bank = S5P_GPIO_GET_BANK(gpio);
> +	unsigned base = s5p_gpio_base(gpio);
>  
> -	bank = g / GPIO_PER_BANK;
> -	bank *= sizeof(struct s5p_gpio_bank);
> -	return (struct s5p_gpio_bank *) (s5p_gpio_base(gpio) + bank);
> +	return (struct s5p_gpio_bank *)(base + bank);
>  }
>  
>  int s5p_gpio_get_pin(unsigned gpio)
>  {
> -	return gpio % GPIO_PER_BANK;
> +	return S5P_GPIO_GET_PIN(gpio);
>  }
>  
>  /* Common GPIO API */
> diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
> index 0590d20..4cdf937 100644
> --- a/include/configs/s5p_goni.h
> +++ b/include/configs/s5p_goni.h
> @@ -208,8 +208,8 @@
>  /*
>   * I2C Settings
>   */
> -#define CONFIG_SOFT_I2C_GPIO_SCL s5pc110_gpio_get_nr(j4, 3)
> -#define CONFIG_SOFT_I2C_GPIO_SDA s5pc110_gpio_get_nr(j4, 0)
> +#define CONFIG_SOFT_I2C_GPIO_SCL s5pc110_gpio_get(j4, 3)
> +#define CONFIG_SOFT_I2C_GPIO_SDA s5pc110_gpio_get(j4, 0)
>  
>  #define CONFIG_SYS_I2C
>  #define CONFIG_SYS_I2C_SOFT		/* I2C bit-banged */
> diff --git a/include/configs/s5pc210_universal.h b/include/configs/s5pc210_universal.h
> index d9e4c56..02a1c99 100644
> --- a/include/configs/s5pc210_universal.h
> +++ b/include/configs/s5pc210_universal.h
> @@ -229,8 +229,8 @@
>  /*
>   * I2C Settings
>   */
> -#define CONFIG_SOFT_I2C_GPIO_SCL exynos4_gpio_part1_get_nr(b, 7)
> -#define CONFIG_SOFT_I2C_GPIO_SDA exynos4_gpio_part1_get_nr(b, 6)
> +#define CONFIG_SOFT_I2C_GPIO_SCL exynos4_gpio_get(1, b, 7)
> +#define CONFIG_SOFT_I2C_GPIO_SDA exynos4_gpio_get(1, b, 6)
>  
>  #define CONFIG_SYS_I2C
>  #define CONFIG_SYS_I2C_SOFT		/* I2C bit-banged */
> @@ -253,10 +253,10 @@
>   */
>  #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 CONFIG_SOFT_SPI_GPIO_SCLK exynos4_gpio_get(2, y3, 1)
> +#define CONFIG_SOFT_SPI_GPIO_MOSI exynos4_gpio_get(2, y3, 3)
> +#define CONFIG_SOFT_SPI_GPIO_MISO exynos4_gpio_get(2, y3, 0)
> +#define CONFIG_SOFT_SPI_GPIO_CS exynos4_gpio_get(2, y4, 3)
>  
>  #define SPI_DELAY udelay(1)
>  #undef SPI_INIT
> diff --git a/include/configs/trats.h b/include/configs/trats.h
> index 0877142..9727f7a 100644
> --- a/include/configs/trats.h
> +++ b/include/configs/trats.h
> @@ -282,8 +282,8 @@
>  #include <asm/arch/gpio.h>
>  
>  /* I2C FG */
> -#define CONFIG_SOFT_I2C_GPIO_SCL exynos4_gpio_part2_get_nr(y4, 1)
> -#define CONFIG_SOFT_I2C_GPIO_SDA exynos4_gpio_part2_get_nr(y4, 0)
> +#define CONFIG_SOFT_I2C_GPIO_SCL exynos4_gpio_get(2, y4, 1)
> +#define CONFIG_SOFT_I2C_GPIO_SDA exynos4_gpio_get(2, y4, 0)
>  
>  #define CONFIG_POWER
>  #define CONFIG_POWER_I2C
> 

Thanks,
Minkyu Kang.

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

* [U-Boot] [PATCH v3 09/12] samsung: misc: Add LCD download menu.
  2014-01-03 16:43   ` [U-Boot] [PATCH v3 09/12] samsung: misc: Add LCD download menu Przemyslaw Marczak
@ 2014-01-06 11:38     ` Minkyu Kang
  2014-01-07 12:46       ` Przemyslaw Marczak
  0 siblings, 1 reply; 147+ messages in thread
From: Minkyu Kang @ 2014-01-06 11:38 UTC (permalink / raw)
  To: u-boot

On 04/01/14 01:43, Przemyslaw Marczak wrote:
> This simple LCD menu allows run one of download mode on device
> without writing on console or for fast and easy upgrade.
> This feature check user keys combination at boot:
> - power key + volume up - download menu
> - power key + volume down - thor mode (without menu)
> 
> New configs:
> - CONFIG_LCD_MENU
> - CONFIG_LCD_MENU_BOARD
> which depends on: CONFIG_MISC_INIT_R
> 
> For proper effect this feature needs following definitions:
> 
> Power key:
> - KEY_PWR_PMIC_NAME - (string) pmic which supports power key check
> 
> Register address:
> - KEY_PWR_STATUS_REG
> - KEY_PWR_INTERRUPT_REG
> 
> Register power key mask:
> - KEY_PWR_STATUS_MASK
> - KEY_PWR_INTERRUPT_MASK
> 
> Gpio numbers:
> - KEY_PWR_INTERRUPT_MASK
> - KEY_VOL_DOWN_GPIO
> 
> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
> 
> ---
> Changes v2:
> - remove keys.h  - definitions should be in boards headers
> - add misc.h
> - code cleanup
> - extend commit msg by more informations
> 
> Changes v3:
> - none
> 
>  board/samsung/common/misc.c |  340 +++++++++++++++++++++++++++++++++++++++++++
>  board/samsung/common/misc.h |   18 +++
>  2 files changed, 358 insertions(+)
>  create mode 100644 board/samsung/common/misc.h
> 
> diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
> index 3a91d62..93f766c 100644
> --- a/board/samsung/common/misc.c
> +++ b/board/samsung/common/misc.c
> @@ -8,6 +8,341 @@
>  #include <common.h>
>  #include <lcd.h>
>  #include <libtizen.h>
> +#include <errno.h>
> +#include <version.h>
> +#include <asm/sizes.h>
> +#include <asm/arch/cpu.h>
> +#include <asm/arch/gpio.h>
> +#include <asm/gpio.h>
> +#include <linux/input.h>
> +#include <lcd.h>
> +#include <libtizen.h>
> +#include <power/pmic.h>
> +#include <mmc.h>
> +#include "misc.h"
> +
> +DECLARE_GLOBAL_DATA_PTR;
> +
> +#ifdef CONFIG_LCD_MENU
> +static int power_key_pressed(int reg)

u32 reg?

> +{
> +	struct pmic *pmic = pmic_get(KEY_PWR_PMIC_NAME);
> +	u32 status = 0;

= 0 do not need.
please do not use initial value, if possible.

> +	u32 mask;

please check return value of pmic_get

	pmic = pmic_get(KEY_PWR_PMIC_NAME);
	if !(pmic)
		return 0;

> +
> +	if (pmic_probe(pmic))
> +		return 0;
> +
> +	if (!pmic) {
> +		printf("%s: Not found\n", KEY_PWR_PMIC_NAME);
> +		return 0;
> +	}
> +
> +	if (reg == KEY_PWR_STATUS_REG)
> +		mask = KEY_PWR_STATUS_MASK;
> +	else
> +		mask = KEY_PWR_INTERRUPT_MASK;
> +
> +	if (pmic_reg_read(pmic, reg, &status))
> +		return 0;
> +
> +	return !!(status & mask);
> +}
> +
> +static int key_pressed(int key)
> +{
> +	int value = 0;

please do not use initial value, if possible.
instead, please add "value = 0" at default statement.

> +
> +	switch (key) {
> +	case KEY_POWER:
> +		value = power_key_pressed(KEY_PWR_INTERRUPT_REG);
> +		break;
> +	case KEY_VOLUMEUP:
> +		value = !gpio_get_value(KEY_VOL_UP_GPIO);
> +		break;
> +	case KEY_VOLUMEDOWN:
> +		value = !gpio_get_value(KEY_VOL_DOWN_GPIO);
> +		break;
> +	default:
> +		break;
> +	}
> +
> +	return value;
> +}
> +
> +static int check_keys(void)
> +{
> +	int keys = 0;
> +
> +	if (key_pressed(KEY_POWER))
> +		keys += KEY_POWER;
> +	if (key_pressed(KEY_VOLUMEUP))
> +		keys += KEY_VOLUMEUP;
> +	if (key_pressed(KEY_VOLUMEDOWN))
> +		keys += KEY_VOLUMEDOWN;
> +
> +	return keys;
> +}
> +
> +/*
> + * 0 BOOT_MODE_INFO
> + * 1 BOOT_MODE_THOR
> + * 2 BOOT_MODE_UMS
> + * 3 BOOT_MODE_DFU
> + * 4 BOOT_MODE_EXIT
> + */
> +static char *
> +mode_name[BOOT_MODE_EXIT + 1] = {"DEVICE",

please move the "DEVICE" to next line.

> +				"THOR",
> +				"UMS",
> +				"DFU",
> +				"EXIT"};

please move the brace to next line.

> +
> +static char *
> +mode_info[BOOT_MODE_EXIT + 1] = {"info",
> +				 "downloader",
> +				 "mass storage",
> +				 "firmware update",
> +				 "and run normal boot"};

ditto.

> +
> +static char *
> +mode_cmd[BOOT_MODE_EXIT + 1] = {"",
> +				"thor 0 mmc 0",
> +				"ums 0 mmc 0",
> +				"dfu 0 mmc 0",
> +				""};

ditto.

> +
> +static void display_board_info(void)
> +{

#ifdef CONFIG_GENERIC_MMC
> +	struct mmc *mmc = find_mmc_device(0);
#endif

> +	vidinfo_t *vid = &panel_info;
> +
> +	lcd_position_cursor(4, 4);
> +
> +	lcd_printf("%s\n\t", U_BOOT_VERSION);
> +	lcd_puts("\n\t\tBoard Info:\n");
> +#ifdef CONFIG_SYS_BOARD
> +	lcd_printf("\tBoard name: %s\n", CONFIG_SYS_BOARD);
> +#endif
> +#ifdef CONFIG_REVISION_TAG
> +	lcd_printf("\tBoard rev: %u\n", get_board_rev());
> +#endif
> +	lcd_printf("\tDRAM banks: %u\n", CONFIG_NR_DRAM_BANKS);
> +	lcd_printf("\tDRAM size: %u MB\n", gd->ram_size / SZ_1M);
> +

#ifdef CONFIG_GENERIC_MMC
> +	if (mmc)
> +		lcd_printf("\teMMC size: %llu MB\n", mmc->capacity / SZ_1M);
#endif

maybe, you can access mmc->capacity after do mmc_init.

> +
> +	if (vid)
> +		lcd_printf("\tDisplay resolution: %u x % u\n",
> +			   vid->vl_col, vid->vl_row);
> +
> +	lcd_printf("\tDisplay BPP: %u\n", 1 << vid->vl_bpix);
> +}
> +
> +static int mode_leave_menu(int mode)
> +{
> +	int mode_supported = 1;
> +	int leave = 0;
> +	char *exit_option;
> +	char *exit_boot = "boot";
> +	char *exit_back = "back";
> +
> +	switch (mode) {
> +	case BOOT_MODE_INFO:
> +#if !defined(CONFIG_LCD_MENU_BOARD)
> +		mode_supported = 0;
> +#endif
> +		break;
> +	case BOOT_MODE_THOR:
> +#if !defined(CONFIG_CMD_THOR_DOWNLOAD)
> +		mode_supported = 0;
> +#endif
> +		break;
> +	case BOOT_MODE_UMS:
> +#if !defined(CONFIG_CMD_USB_MASS_STORAGE)
> +		mode_supported = 0;
> +#endif
> +		break;
> +	case BOOT_MODE_DFU:
> +#if !defined(CONFIG_CMD_DFU)
> +		mode_supported = 0;
> +#endif
> +		break;
> +	case BOOT_MODE_EXIT:
> +		leave = 1;
> +		goto exit;

why don't you return directly at here.
goto statement is used here only.

> +	default:

then, mode_supported = 0; maybe?

> +		break;
> +	}
> +
> +	lcd_clear();
> +
> +	if (mode_supported) {
> +		if (mode) {
> +			lcd_printf("\n\n\t%s %s\n", mode_name[mode],
> +						    mode_info[mode]);
> +			lcd_puts("\n\tDo not turn off device before finish!\n");
> +
> +			run_command(mode_cmd[mode], 0);

do not need to check a return value?

> +			printf("Command finished\n");
> +			lcd_clear();
> +			lcd_printf("\n\n\t%s finished\n", mode_name[mode]);
> +			exit_option = exit_boot;
> +			leave = 1;
> +		} else {
> +			display_board_info();
> +			exit_option = exit_back;
> +			leave = 0;
> +		}
> +	} else {
> +		lcd_puts("\n\n\tThis mode is not supported.\n");
> +		exit_option = exit_back;
> +		leave = 0;
> +	}
> +
> +	lcd_printf("\n\n\tPress POWER KEY to %s\n", exit_option);
> +
> +	/* Wait for PWR key */
> +	while (!key_pressed(KEY_POWER))
> +		udelay(1000);
> +exit:
> +	lcd_clear();
> +	return leave;
> +}
> +
> +static void display_download_menu(int mode)
> +{
> +	char *menu_name = "Download Mode Menu";
> +	char *indicator = "[=>]";
> +	char *blank = "[  ]";

Do we need those three variable?

> +	char *selection[BOOT_MODE_EXIT + 1];
> +	int i;
> +
> +	for (i = 0; i <= BOOT_MODE_EXIT; i++)
> +		selection[i] = blank;
> +
> +	selection[mode] = indicator;
> +
> +	lcd_clear();
> +	lcd_printf("\n\t\t%s\n", menu_name);
> +
> +	for (i = 0; i <= BOOT_MODE_EXIT; i++)
> +		lcd_printf("\t%s  %s - %s\n\n", selection[i],
> +						mode_name[i],
> +						mode_info[i]);
> +}
> +
> +static void download_menu(void)
> +{
> +	int mode = 0;
> +	int last_mode = 0;
> +	int run;
> +	int key;
> +
> +	display_download_menu(mode);
> +
> +	while (1) {
> +		run = 0;
> +
> +		if (mode != last_mode)
> +			display_download_menu(mode);
> +
> +		last_mode = mode;
> +		udelay(100000);
> +
> +		key = check_keys();
> +		switch (key) {
> +		case KEY_POWER:
> +			run = 1;
> +			break;
> +		case KEY_VOLUMEUP:
> +			if (mode > 0)
> +				mode--;
> +			break;
> +		case KEY_VOLUMEDOWN:
> +			if (mode < BOOT_MODE_EXIT)
> +				mode++;
> +			break;
> +		default:
> +			break;
> +		}
> +
> +		if (run) {
> +			if (mode_leave_menu(mode))
> +				break;
> +
> +			display_download_menu(mode);
> +		}
> +	}
> +
> +	lcd_clear();
> +}
> +
> +static void display_mode_info(void)
> +{
> +	lcd_position_cursor(4, 4);
> +	lcd_printf("%s\n", U_BOOT_VERSION);
> +	lcd_puts("\nDownload Mode Menu\n");
> +#ifdef CONFIG_SYS_BOARD
> +	lcd_printf("Board name: %s\n", CONFIG_SYS_BOARD);
> +#endif
> +	lcd_printf("Press POWER KEY to display MENU options.");
> +}
> +
> +static int boot_menu(void)
> +{
> +	int key = 0;
> +	int timeout = 10;
> +
> +	display_mode_info();
> +
> +	while (timeout--) {
> +		lcd_printf("\rNormal boot will start in: %d seconds.", timeout);
> +		udelay(1000000);

I think.. user input can be ignored because too long delay.
1 second? it's too long.
and how about use mdelay instead?

> +
> +		key = key_pressed(KEY_POWER);
> +		if (key)
> +			break;
> +	}
> +
> +	lcd_clear();
> +
> +	/* If PWR pressed - show download menu */
> +	if (key) {
> +		printf("Power pressed - go to download menu\n");
> +		udelay(1000000);

delay for 1 second? is it need?

> +		download_menu();
> +		printf("Download mode exit.\n");
> +	}
> +
> +	return 0;
> +}
> +
> +static void check_boot_mode(void)
> +{
> +	int pwr_key;
> +
> +	pwr_key = power_key_pressed(KEY_PWR_STATUS_REG);
> +	if (!pwr_key)
> +		return;
> +
> +	/* Clear PWR button Rising edge interrupt status flag */
> +	power_key_pressed(KEY_PWR_INTERRUPT_REG);
> +
> +	if (key_pressed(KEY_VOLUMEUP))
> +		boot_menu();
> +	else if (key_pressed(KEY_VOLUMEDOWN))
> +		mode_leave_menu(BOOT_MODE_THOR);
> +}
> +
> +static void keys_init(void)
> +{
> +	/* Set direction to input */
> +	gpio_direction_input(KEY_VOL_UP_GPIO);
> +	gpio_direction_input(KEY_VOL_DOWN_GPIO);
> +}
> +#endif /* CONFIG_LCD_MENU */
>  
>  #ifdef CONFIG_CMD_BMP
>  static void draw_logo(void)
> @@ -50,9 +385,14 @@ static void draw_logo(void)
>  /* Common for Samsung boards */
>  int misc_init_r(void)
>  {
> +#ifdef CONFIG_LCD_MENU
> +	keys_init();
> +	check_boot_mode();
> +#endif
>  #ifdef CONFIG_CMD_BMP
>  	if (panel_info.logo_on)
>  		draw_logo();
>  #endif
> +
>  	return 0;
>  }
> diff --git a/board/samsung/common/misc.h b/board/samsung/common/misc.h
> new file mode 100644
> index 0000000..f583552
> --- /dev/null
> +++ b/board/samsung/common/misc.h
> @@ -0,0 +1,18 @@
> +#ifndef __SAMSUNG_COMMON_MISC_H__
> +#define __SAMSUNG_COMMON_MISC_H__
> +
> +#ifdef CONFIG_LCD_MENU
> +enum {
> +	BOOT_MODE_INFO,
> +	BOOT_MODE_THOR,
> +	BOOT_MODE_UMS,
> +	BOOT_MODE_DFU,
> +	BOOT_MODE_EXIT,
> +};
> +
> +#ifdef CONFIG_REVISION_TAG
> +u32 get_board_rev(void);
> +#endif
> +#endif /* CONFIG_LCD_MENU */
> +
> +#endif /* __SAMSUNG_COMMON_MISC_H__ */
> \ No newline at end of file
> 

Thanks,
Minkyu Kang.

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

* [U-Boot] [PATCH v3 09/12] samsung: misc: Add LCD download menu.
  2014-01-06 11:38     ` Minkyu Kang
@ 2014-01-07 12:46       ` Przemyslaw Marczak
  0 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-07 12:46 UTC (permalink / raw)
  To: u-boot

Hello Minkyu,

Thank you for review.

On 01/06/2014 12:38 PM, Minkyu Kang wrote:
> On 04/01/14 01:43, Przemyslaw Marczak wrote:
>> This simple LCD menu allows run one of download mode on device
>> without writing on console or for fast and easy upgrade.
>> This feature check user keys combination at boot:
>> - power key + volume up - download menu
>> - power key + volume down - thor mode (without menu)
>>
>> New configs:
>> - CONFIG_LCD_MENU
>> - CONFIG_LCD_MENU_BOARD
>> which depends on: CONFIG_MISC_INIT_R
>>
>> For proper effect this feature needs following definitions:
>>
>> Power key:
>> - KEY_PWR_PMIC_NAME - (string) pmic which supports power key check
>>
>> Register address:
>> - KEY_PWR_STATUS_REG
>> - KEY_PWR_INTERRUPT_REG
>>
>> Register power key mask:
>> - KEY_PWR_STATUS_MASK
>> - KEY_PWR_INTERRUPT_MASK
>>
>> Gpio numbers:
>> - KEY_PWR_INTERRUPT_MASK
>> - KEY_VOL_DOWN_GPIO
>>
>> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
>>
>> ---
>> Changes v2:
>> - remove keys.h  - definitions should be in boards headers
>> - add misc.h
>> - code cleanup
>> - extend commit msg by more informations
>>
>> Changes v3:
>> - none
>>
>>   board/samsung/common/misc.c |  340 +++++++++++++++++++++++++++++++++++++++++++
>>   board/samsung/common/misc.h |   18 +++
>>   2 files changed, 358 insertions(+)
>>   create mode 100644 board/samsung/common/misc.h
>>
>> diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
>> index 3a91d62..93f766c 100644
>> --- a/board/samsung/common/misc.c
>> +++ b/board/samsung/common/misc.c
>> @@ -8,6 +8,341 @@
>>   #include <common.h>
>>   #include <lcd.h>
>>   #include <libtizen.h>
>> +#include <errno.h>
>> +#include <version.h>
>> +#include <asm/sizes.h>
>> +#include <asm/arch/cpu.h>
>> +#include <asm/arch/gpio.h>
>> +#include <asm/gpio.h>
>> +#include <linux/input.h>
>> +#include <lcd.h>
>> +#include <libtizen.h>
>> +#include <power/pmic.h>
>> +#include <mmc.h>
>> +#include "misc.h"
>> +
>> +DECLARE_GLOBAL_DATA_PTR;
>> +
>> +#ifdef CONFIG_LCD_MENU
>> +static int power_key_pressed(int reg)
>
> u32 reg?
>
>> +{
>> +	struct pmic *pmic = pmic_get(KEY_PWR_PMIC_NAME);
>> +	u32 status = 0;
>
> = 0 do not need.
> please do not use initial value, if possible.
>
>> +	u32 mask;
>
> please check return value of pmic_get
>
> 	pmic = pmic_get(KEY_PWR_PMIC_NAME);
> 	if !(pmic)
> 		return 0;
>
>> +
>> +	if (pmic_probe(pmic))
>> +		return 0;
>> +
>> +	if (!pmic) {
>> +		printf("%s: Not found\n", KEY_PWR_PMIC_NAME);
>> +		return 0;
>> +	}
>> +
>> +	if (reg == KEY_PWR_STATUS_REG)
>> +		mask = KEY_PWR_STATUS_MASK;
>> +	else
>> +		mask = KEY_PWR_INTERRUPT_MASK;
>> +
>> +	if (pmic_reg_read(pmic, reg, &status))
>> +		return 0;
>> +
>> +	return !!(status & mask);
>> +}
>> +
>> +static int key_pressed(int key)
>> +{
>> +	int value = 0;
>
> please do not use initial value, if possible.
> instead, please add "value = 0" at default statement.
>
>> +
>> +	switch (key) {
>> +	case KEY_POWER:
>> +		value = power_key_pressed(KEY_PWR_INTERRUPT_REG);
>> +		break;
>> +	case KEY_VOLUMEUP:
>> +		value = !gpio_get_value(KEY_VOL_UP_GPIO);
>> +		break;
>> +	case KEY_VOLUMEDOWN:
>> +		value = !gpio_get_value(KEY_VOL_DOWN_GPIO);
>> +		break;
>> +	default:
>> +		break;
>> +	}
>> +
>> +	return value;
>> +}
>> +
>> +static int check_keys(void)
>> +{
>> +	int keys = 0;
>> +
>> +	if (key_pressed(KEY_POWER))
>> +		keys += KEY_POWER;
>> +	if (key_pressed(KEY_VOLUMEUP))
>> +		keys += KEY_VOLUMEUP;
>> +	if (key_pressed(KEY_VOLUMEDOWN))
>> +		keys += KEY_VOLUMEDOWN;
>> +
>> +	return keys;
>> +}
>> +
>> +/*
>> + * 0 BOOT_MODE_INFO
>> + * 1 BOOT_MODE_THOR
>> + * 2 BOOT_MODE_UMS
>> + * 3 BOOT_MODE_DFU
>> + * 4 BOOT_MODE_EXIT
>> + */
>> +static char *
>> +mode_name[BOOT_MODE_EXIT + 1] = {"DEVICE",
>
> please move the "DEVICE" to next line.
>
>> +				"THOR",
>> +				"UMS",
>> +				"DFU",
>> +				"EXIT"};
>
> please move the brace to next line.
>
>> +
>> +static char *
>> +mode_info[BOOT_MODE_EXIT + 1] = {"info",
>> +				 "downloader",
>> +				 "mass storage",
>> +				 "firmware update",
>> +				 "and run normal boot"};
>
> ditto.
>
>> +
>> +static char *
>> +mode_cmd[BOOT_MODE_EXIT + 1] = {"",
>> +				"thor 0 mmc 0",
>> +				"ums 0 mmc 0",
>> +				"dfu 0 mmc 0",
>> +				""};
>
> ditto.
>
>> +
>> +static void display_board_info(void)
>> +{
>
> #ifdef CONFIG_GENERIC_MMC
>> +	struct mmc *mmc = find_mmc_device(0);
> #endif
>
>> +	vidinfo_t *vid = &panel_info;
>> +
>> +	lcd_position_cursor(4, 4);
>> +
>> +	lcd_printf("%s\n\t", U_BOOT_VERSION);
>> +	lcd_puts("\n\t\tBoard Info:\n");
>> +#ifdef CONFIG_SYS_BOARD
>> +	lcd_printf("\tBoard name: %s\n", CONFIG_SYS_BOARD);
>> +#endif
>> +#ifdef CONFIG_REVISION_TAG
>> +	lcd_printf("\tBoard rev: %u\n", get_board_rev());
>> +#endif
>> +	lcd_printf("\tDRAM banks: %u\n", CONFIG_NR_DRAM_BANKS);
>> +	lcd_printf("\tDRAM size: %u MB\n", gd->ram_size / SZ_1M);
>> +
>
> #ifdef CONFIG_GENERIC_MMC
>> +	if (mmc)
>> +		lcd_printf("\teMMC size: %llu MB\n", mmc->capacity / SZ_1M);
> #endif
>
> maybe, you can access mmc->capacity after do mmc_init.
>

I will add mmc_init for sure here. But in most cases mmc is initialized 
at misc_init_r stage because of environment initialization.

>> +
>> +	if (vid)
>> +		lcd_printf("\tDisplay resolution: %u x % u\n",
>> +			   vid->vl_col, vid->vl_row);
>> +
>> +	lcd_printf("\tDisplay BPP: %u\n", 1 << vid->vl_bpix);
>> +}
>> +
>> +static int mode_leave_menu(int mode)
>> +{
>> +	int mode_supported = 1;
>> +	int leave = 0;
>> +	char *exit_option;
>> +	char *exit_boot = "boot";
>> +	char *exit_back = "back";
>> +
>> +	switch (mode) {
>> +	case BOOT_MODE_INFO:
>> +#if !defined(CONFIG_LCD_MENU_BOARD)
>> +		mode_supported = 0;
>> +#endif
>> +		break;
>> +	case BOOT_MODE_THOR:
>> +#if !defined(CONFIG_CMD_THOR_DOWNLOAD)
>> +		mode_supported = 0;
>> +#endif
>> +		break;
>> +	case BOOT_MODE_UMS:
>> +#if !defined(CONFIG_CMD_USB_MASS_STORAGE)
>> +		mode_supported = 0;
>> +#endif
>> +		break;
>> +	case BOOT_MODE_DFU:
>> +#if !defined(CONFIG_CMD_DFU)
>> +		mode_supported = 0;
>> +#endif
>> +		break;
>> +	case BOOT_MODE_EXIT:
>> +		leave = 1;
>> +		goto exit;
>
> why don't you return directly at here.
> goto statement is used here only.
>

Ok, will be changed.

>> +	default:
>
> then, mode_supported = 0; maybe?
>
>> +		break;
>> +	}
>> +
>> +	lcd_clear();
>> +
>> +	if (mode_supported) {
>> +		if (mode) {
>> +			lcd_printf("\n\n\t%s %s\n", mode_name[mode],
>> +						    mode_info[mode]);
>> +			lcd_puts("\n\tDo not turn off device before finish!\n");
>> +
>> +			run_command(mode_cmd[mode], 0);
>
> do not need to check a return value?
>

You're right,  I will add checking here.

>> +			printf("Command finished\n");
>> +			lcd_clear();
>> +			lcd_printf("\n\n\t%s finished\n", mode_name[mode]);
>> +			exit_option = exit_boot;
>> +			leave = 1;
>> +		} else {
>> +			display_board_info();
>> +			exit_option = exit_back;
>> +			leave = 0;
>> +		}
>> +	} else {
>> +		lcd_puts("\n\n\tThis mode is not supported.\n");
>> +		exit_option = exit_back;
>> +		leave = 0;
>> +	}
>> +
>> +	lcd_printf("\n\n\tPress POWER KEY to %s\n", exit_option);
>> +
>> +	/* Wait for PWR key */
>> +	while (!key_pressed(KEY_POWER))
>> +		udelay(1000);
>> +exit:
>> +	lcd_clear();
>> +	return leave;
>> +}
>> +
>> +static void display_download_menu(int mode)
>> +{
>> +	char *menu_name = "Download Mode Menu";
>> +	char *indicator = "[=>]";
>> +	char *blank = "[  ]";
>
> Do we need those three variable?
>

Actually we don't. Will be removed.


>> +	char *selection[BOOT_MODE_EXIT + 1];
>> +	int i;
>> +
>> +	for (i = 0; i <= BOOT_MODE_EXIT; i++)
>> +		selection[i] = blank;
>> +
>> +	selection[mode] = indicator;
>> +
>> +	lcd_clear();
>> +	lcd_printf("\n\t\t%s\n", menu_name);
>> +
>> +	for (i = 0; i <= BOOT_MODE_EXIT; i++)
>> +		lcd_printf("\t%s  %s - %s\n\n", selection[i],
>> +						mode_name[i],
>> +						mode_info[i]);
>> +}
>> +
>> +static void download_menu(void)
>> +{
>> +	int mode = 0;
>> +	int last_mode = 0;
>> +	int run;
>> +	int key;
>> +
>> +	display_download_menu(mode);
>> +
>> +	while (1) {
>> +		run = 0;
>> +
>> +		if (mode != last_mode)
>> +			display_download_menu(mode);
>> +
>> +		last_mode = mode;
>> +		udelay(100000);
>> +
>> +		key = check_keys();
>> +		switch (key) {
>> +		case KEY_POWER:
>> +			run = 1;
>> +			break;
>> +		case KEY_VOLUMEUP:
>> +			if (mode > 0)
>> +				mode--;
>> +			break;
>> +		case KEY_VOLUMEDOWN:
>> +			if (mode < BOOT_MODE_EXIT)
>> +				mode++;
>> +			break;
>> +		default:
>> +			break;
>> +		}
>> +
>> +		if (run) {
>> +			if (mode_leave_menu(mode))
>> +				break;
>> +
>> +			display_download_menu(mode);
>> +		}
>> +	}
>> +
>> +	lcd_clear();
>> +}
>> +
>> +static void display_mode_info(void)
>> +{
>> +	lcd_position_cursor(4, 4);
>> +	lcd_printf("%s\n", U_BOOT_VERSION);
>> +	lcd_puts("\nDownload Mode Menu\n");
>> +#ifdef CONFIG_SYS_BOARD
>> +	lcd_printf("Board name: %s\n", CONFIG_SYS_BOARD);
>> +#endif
>> +	lcd_printf("Press POWER KEY to display MENU options.");
>> +}
>> +
>> +static int boot_menu(void)
>> +{
>> +	int key = 0;
>> +	int timeout = 10;
>> +
>> +	display_mode_info();
>> +
>> +	while (timeout--) {
>> +		lcd_printf("\rNormal boot will start in: %d seconds.", timeout);
>> +		udelay(1000000);
>
> I think.. user input can be ignored because too long delay.
> 1 second? it's too long.
> and how about use mdelay instead?
>

User input can't be ignored because key_pressed(KEY_POWER) is using pmic 
interrupt register. It is no matter when user press the power key, if he 
does then he will wait at most 1 second.

>> +
>> +		key = key_pressed(KEY_POWER);
>> +		if (key)
>> +			break;
>> +	}
>> +
>> +	lcd_clear();
>> +
>> +	/* If PWR pressed - show download menu */
>> +	if (key) {
>> +		printf("Power pressed - go to download menu\n");
>> +		udelay(1000000);
>
> delay for 1 second? is it need?
You're right It is unneeded here.

>
>> +		download_menu();
>> +		printf("Download mode exit.\n");
>> +	}
>> +
>> +	return 0;
>> +}
>> +
>> +static void check_boot_mode(void)
>> +{
>> +	int pwr_key;
>> +
>> +	pwr_key = power_key_pressed(KEY_PWR_STATUS_REG);
>> +	if (!pwr_key)
>> +		return;
>> +
>> +	/* Clear PWR button Rising edge interrupt status flag */
>> +	power_key_pressed(KEY_PWR_INTERRUPT_REG);
>> +
>> +	if (key_pressed(KEY_VOLUMEUP))
>> +		boot_menu();
>> +	else if (key_pressed(KEY_VOLUMEDOWN))
>> +		mode_leave_menu(BOOT_MODE_THOR);
>> +}
>> +
>> +static void keys_init(void)
>> +{
>> +	/* Set direction to input */
>> +	gpio_direction_input(KEY_VOL_UP_GPIO);
>> +	gpio_direction_input(KEY_VOL_DOWN_GPIO);
>> +}
>> +#endif /* CONFIG_LCD_MENU */
>>
>>   #ifdef CONFIG_CMD_BMP
>>   static void draw_logo(void)
>> @@ -50,9 +385,14 @@ static void draw_logo(void)
>>   /* Common for Samsung boards */
>>   int misc_init_r(void)
>>   {
>> +#ifdef CONFIG_LCD_MENU
>> +	keys_init();
>> +	check_boot_mode();
>> +#endif
>>   #ifdef CONFIG_CMD_BMP
>>   	if (panel_info.logo_on)
>>   		draw_logo();
>>   #endif
>> +
>>   	return 0;
>>   }
>> diff --git a/board/samsung/common/misc.h b/board/samsung/common/misc.h
>> new file mode 100644
>> index 0000000..f583552
>> --- /dev/null
>> +++ b/board/samsung/common/misc.h
>> @@ -0,0 +1,18 @@
>> +#ifndef __SAMSUNG_COMMON_MISC_H__
>> +#define __SAMSUNG_COMMON_MISC_H__
>> +
>> +#ifdef CONFIG_LCD_MENU
>> +enum {
>> +	BOOT_MODE_INFO,
>> +	BOOT_MODE_THOR,
>> +	BOOT_MODE_UMS,
>> +	BOOT_MODE_DFU,
>> +	BOOT_MODE_EXIT,
>> +};
>> +
>> +#ifdef CONFIG_REVISION_TAG
>> +u32 get_board_rev(void);
>> +#endif
>> +#endif /* CONFIG_LCD_MENU */
>> +
>> +#endif /* __SAMSUNG_COMMON_MISC_H__ */
>> \ No newline at end of file
>>
>
> Thanks,
> Minkyu Kang.
>

Comments will be applied to next version.
Regards
-- 
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com

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

* [U-Boot] [PATCH v3 11/12] trats2: add LCD download menu support
  2014-01-06 11:37       ` Minkyu Kang
@ 2014-01-07 12:54         ` Przemyslaw Marczak
  2014-01-08  1:56           ` Minkyu Kang
  0 siblings, 1 reply; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-07 12:54 UTC (permalink / raw)
  To: u-boot

Hello,

On 01/06/2014 12:37 PM, Minkyu Kang wrote:
> On 04/01/14 02:21, Przemyslaw Marczak wrote:
>> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
>>
>> ---
>> changes v2:
>> - add definitions for check keys
>> - cleanup config definitions
>>
>> Changes v3:
>> - remove CONFIG_BOARD_NAME from include/configs/trats2.h
>>
>>   include/configs/trats2.h |   26 ++++++++++++++++++++++++++
>>   1 file changed, 26 insertions(+)
>>
>> diff --git a/include/configs/trats2.h b/include/configs/trats2.h
>> index 740ceb1..453a37e 100644
>> --- a/include/configs/trats2.h
>> +++ b/include/configs/trats2.h
>> @@ -19,6 +19,7 @@
>>   #define CONFIG_S5P		/* which is in a S5P Family */
>>   #define CONFIG_EXYNOS4		/* which is in a EXYNOS4XXX */
>>   #define CONFIG_TIZEN		/* TIZEN lib */
>> +#define CONFIG_TRATS2
>>
>>   #include <asm/arch/cpu.h>		/* get chip and board defs */
>>
>> @@ -315,6 +316,31 @@ int get_soft_i2c_sda_pin(void);
>>   /* Common misc for Samsung */
>>   #define CONFIG_MISC_INIT_R
>>
>> +/* Download menu - Samsung common */
>> +#define CONFIG_LCD_MENU
>> +#define CONFIG_LCD_MENU_BOARD
>> +
>> +/* Download menu - definitions for check keys */
>> +#ifndef __ASSEMBLY__
>> +#ifdef __COMMON_H_
>
> why this ifdef(__COMMON_H_) is needed?
>

There was some include conflict with pmic which breaks build and this 
macro resolve it.

>> +#include <power/pmic.h>
>> +#include <power/max77686_pmic.h>
>> +
>> +#define KEY_PWR_PMIC_NAME		"MAX77686_PMIC"
>> +#define KEY_PWR_STATUS_REG		MAX77686_REG_PMIC_STATUS1
>> +#define KEY_PWR_STATUS_MASK		(1 << 0)
>> +#define KEY_PWR_INTERRUPT_REG		MAX77686_REG_PMIC_INT1
>> +#define KEY_PWR_INTERRUPT_MASK		(1 << 1)
>> +
>> +#define KEY_VOL_UP_GPIO			exynos4x12_gpio_get(2, x2, 2)
>> +#define KEY_VOL_DOWN_GPIO		exynos4x12_gpio_get(2, x3, 3)
>> +#endif /* __COMMON_H_ */
>> +#endif /* __ASSEMBLY__ */
>> +
>> +/* LCD console */
>> +#define LCD_BPP                 LCD_COLOR16
>> +#define CONFIG_SYS_WHITE_ON_BLACK
>> +
>>   /* LCD */
>>   #define CONFIG_EXYNOS_FB
>>   #define CONFIG_LCD
>>
>
> Thanks,
> Minkyu Kang.
>

Regards
-- 
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com

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

* [U-Boot] [PATCH v3 01/12] s5p: gpio: change gpio coding method for s5p gpio.
  2014-01-06 11:37   ` [U-Boot] [PATCH v3 01/12] s5p: gpio: change gpio coding method for s5p gpio Minkyu Kang
@ 2014-01-07 12:56     ` Przemyslaw Marczak
  0 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-07 12:56 UTC (permalink / raw)
  To: u-boot

Hello,

On 01/06/2014 12:37 PM, Minkyu Kang wrote:
> On 04/01/14 01:43, Przemyslaw Marczak wrote:
>> Old s5p gpio coding method was not clean and was not working properly
>> for all parts and banks. New method is clean and easy to extend.
>>
>> Gpio coding mask:
>> 0x000000ff - pin number
>> 0x00ffff00 - bank offset
>> 0xff000000 - part number
>>
>> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
>>
>> ---
>> Changes v2:
>> - none
>>
>> Changes v3:
>> - fix merge conflict in arch/arm/include/asm/arch-exynos/gpio.h
>> - add exynos5420 gpio coding
>> - update file: board/samsung/trats2/trats2.c
>>
>>   arch/arm/include/asm/arch-exynos/gpio.h  |  245 +++++++++---------------------
>>   arch/arm/include/asm/arch-s5pc1xx/gpio.h |   47 ++++--
>>   board/samsung/trats2/trats2.c            |    8 +-
>>   drivers/gpio/s5p_gpio.c                  |   15 +-
>>   include/configs/s5p_goni.h               |    4 +-
>>   include/configs/s5pc210_universal.h      |   12 +-
>>   include/configs/trats.h                  |    4 +-
>>   7 files changed, 132 insertions(+), 203 deletions(-)
>>
>> diff --git a/arch/arm/include/asm/arch-exynos/gpio.h b/arch/arm/include/asm/arch-exynos/gpio.h
>> index 2a19852..64bd23b 100644
>> --- a/arch/arm/include/asm/arch-exynos/gpio.h
>> +++ b/arch/arm/include/asm/arch-exynos/gpio.h
>> @@ -247,180 +247,81 @@ void s5p_gpio_set_rate(struct s5p_gpio_bank *bank, int gpio, int mode);
>>
>>   /* GPIO pins per bank  */
>>   #define GPIO_PER_BANK 8
>> -
>> -#define exynos4_gpio_part1_get_nr(bank, pin) \
>> -	((((((unsigned int) &(((struct exynos4_gpio_part1 *) \
>> -			       EXYNOS4_GPIO_PART1_BASE)->bank)) \
>> -	    - EXYNOS4_GPIO_PART1_BASE) / sizeof(struct s5p_gpio_bank)) \
>> -	  * GPIO_PER_BANK) + pin)
>> -
>> -#define EXYNOS4_GPIO_PART1_MAX ((sizeof(struct exynos4_gpio_part1) \
>> -			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
>> -
>> -#define exynos4_gpio_part2_get_nr(bank, pin) \
>> -	(((((((unsigned int) &(((struct exynos4_gpio_part2 *) \
>> -				EXYNOS4_GPIO_PART2_BASE)->bank)) \
>> -	    - EXYNOS4_GPIO_PART2_BASE) / sizeof(struct s5p_gpio_bank)) \
>> -	  * GPIO_PER_BANK) + pin) + EXYNOS4_GPIO_PART1_MAX)
>> -
>> -#define exynos4x12_gpio_part1_get_nr(bank, pin) \
>> -	((((((unsigned int) &(((struct exynos4x12_gpio_part1 *) \
>> -			       EXYNOS4X12_GPIO_PART1_BASE)->bank)) \
>> -	    - EXYNOS4X12_GPIO_PART1_BASE) / sizeof(struct s5p_gpio_bank)) \
>> -	  * GPIO_PER_BANK) + pin)
>> -
>> -#define EXYNOS4X12_GPIO_PART1_MAX ((sizeof(struct exynos4x12_gpio_part1) \
>> -			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
>> -
>> -#define exynos4x12_gpio_part2_get_nr(bank, pin) \
>> -	(((((((unsigned int) &(((struct exynos4x12_gpio_part2 *) \
>> -				EXYNOS4X12_GPIO_PART2_BASE)->bank)) \
>> -	    - EXYNOS4X12_GPIO_PART2_BASE) / sizeof(struct s5p_gpio_bank)) \
>> -	  * GPIO_PER_BANK) + pin) + EXYNOS4X12_GPIO_PART1_MAX)
>> -
>> -#define EXYNOS4X12_GPIO_PART2_MAX ((sizeof(struct exynos4x12_gpio_part2) \
>> -			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
>> -
>> -#define exynos4x12_gpio_part3_get_nr(bank, pin) \
>> -	(((((((unsigned int) &(((struct exynos4x12_gpio_part3 *) \
>> -				EXYNOS4X12_GPIO_PART3_BASE)->bank)) \
>> -	    - EXYNOS4X12_GPIO_PART3_BASE) / sizeof(struct s5p_gpio_bank)) \
>> -	  * GPIO_PER_BANK) + pin) + EXYNOS4X12_GPIO_PART2_MAX)
>> -
>> -#define exynos5_gpio_part1_get_nr(bank, pin) \
>> -	((((((unsigned int) &(((struct exynos5_gpio_part1 *) \
>> -			       EXYNOS5_GPIO_PART1_BASE)->bank)) \
>> -	    - EXYNOS5_GPIO_PART1_BASE) / sizeof(struct s5p_gpio_bank)) \
>> -	  * GPIO_PER_BANK) + pin)
>> -
>> -#define EXYNOS5_GPIO_PART1_MAX ((sizeof(struct exynos5_gpio_part1) \
>> -			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
>> -
>> -#define exynos5_gpio_part2_get_nr(bank, pin) \
>> -	(((((((unsigned int) &(((struct exynos5_gpio_part2 *) \
>> -				EXYNOS5_GPIO_PART2_BASE)->bank)) \
>> -	    - EXYNOS5_GPIO_PART2_BASE) / sizeof(struct s5p_gpio_bank)) \
>> -	  * GPIO_PER_BANK) + pin) + EXYNOS5_GPIO_PART1_MAX)
>> -
>> -#define EXYNOS5_GPIO_PART2_MAX ((sizeof(struct exynos5_gpio_part2) \
>> -			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
>> -
>> -#define exynos5_gpio_part3_get_nr(bank, pin) \
>> -	(((((((unsigned int) &(((struct exynos5_gpio_part3 *) \
>> -				EXYNOS5_GPIO_PART3_BASE)->bank)) \
>> -	    - EXYNOS5_GPIO_PART3_BASE) / sizeof(struct s5p_gpio_bank)) \
>> -	  * GPIO_PER_BANK) + pin) + EXYNOS5_GPIO_PART2_MAX)
>> -
>> -
>> -/* EXYNOS5420 */
>> -#define exynos5420_gpio_part1_get_nr(bank, pin) \
>> -	((((((unsigned int) &(((struct exynos5420_gpio_part1 *)\
>> -			       EXYNOS5420_GPIO_PART1_BASE)->bank)) \
>> -	    - EXYNOS5420_GPIO_PART1_BASE) / sizeof(struct s5p_gpio_bank)) \
>> -	  * GPIO_PER_BANK) + pin)
>> -
>> -#define EXYNOS5420_GPIO_PART1_MAX ((sizeof(struct exynos5420_gpio_part1) \
>> -			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
>> -
>> -#define exynos5420_gpio_part2_get_nr(bank, pin) \
>> -	(((((((unsigned int) &(((struct exynos5420_gpio_part2 *)\
>> -				EXYNOS5420_GPIO_PART2_BASE)->bank)) \
>> -	    - EXYNOS5420_GPIO_PART2_BASE) / sizeof(struct s5p_gpio_bank)) \
>> -	  * GPIO_PER_BANK) + pin) + EXYNOS5420_GPIO_PART1_MAX)
>> -
>> -#define EXYNOS5420_GPIO_PART2_MAX ((sizeof(struct exynos5420_gpio_part2) \
>> -			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
>> -
>> -#define exynos5420_gpio_part3_get_nr(bank, pin) \
>> -	(((((((unsigned int) &(((struct exynos5420_gpio_part3 *)\
>> -				EXYNOS5420_GPIO_PART3_BASE)->bank)) \
>> -	    - EXYNOS5420_GPIO_PART3_BASE) / sizeof(struct s5p_gpio_bank)) \
>> -	  * GPIO_PER_BANK) + pin) + EXYNOS5420_GPIO_PART2_MAX)
>> -
>> -#define EXYNOS5420_GPIO_PART3_MAX ((sizeof(struct exynos5420_gpio_part3) \
>> -			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
>> -
>> -#define exynos5420_gpio_part4_get_nr(bank, pin) \
>> -	(((((((unsigned int) &(((struct exynos5420_gpio_part4 *)\
>> -				EXYNOS5420_GPIO_PART4_BASE)->bank)) \
>> -	    - EXYNOS5420_GPIO_PART4_BASE) / sizeof(struct s5p_gpio_bank)) \
>> -	  * GPIO_PER_BANK) + pin) + EXYNOS5420_GPIO_PART3_MAX)
>> -
>> -#define EXYNOS5420_GPIO_PART4_MAX ((sizeof(struct exynos5420_gpio_part4) \
>> -			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
>> -
>> -#define EXYNOS5420_GPIO_PART5_MAX ((sizeof(struct exynos5420_gpio_part5) \
>> -			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
>> -
>> -static inline unsigned int s5p_gpio_base(int nr)
>> +#define S5P_GPIO_PART_SHIFT	(24)
>> +#define S5P_GPIO_PART_MASK	(0xff)
>> +#define S5P_GPIO_BANK_SHIFT	(8)
>> +#define S5P_GPIO_BANK_MASK	(0xffff)
>> +#define S5P_GPIO_PIN_MASK	(0xff)
>> +
>> +#define S5P_GPIO_SET_PART(x) \
>> +			((x & S5P_GPIO_PART_MASK) << S5P_GPIO_PART_SHIFT)
>
> x should be wrapped with brace.
> please fix it globally.
>

Thank you, I will fix it.

>> +
>> +#define S5P_GPIO_GET_PART(x) \
>> +			((x >> S5P_GPIO_PART_SHIFT) & S5P_GPIO_PART_MASK)
>> +
>> +#define S5P_GPIO_SET_PIN(x) \
>> +			(x & S5P_GPIO_PIN_MASK)
>> +
>> +#define EXYNOS4_GPIO_SET_BANK(part, bank) \
>> +			((((unsigned)&(((struct exynos4_gpio_part##part *) \
>> +			EXYNOS4_GPIO_PART##part##_BASE)->bank) \
>> +			- EXYNOS4_GPIO_PART##part##_BASE) \
>> +			& S5P_GPIO_BANK_MASK) << S5P_GPIO_BANK_SHIFT)
>> +
>> +#define EXYNOS4X12_GPIO_SET_BANK(part, bank) \
>> +			((((unsigned)&(((struct exynos4x12_gpio_part##part *) \
>> +			EXYNOS4X12_GPIO_PART##part##_BASE)->bank) \
>> +			- EXYNOS4X12_GPIO_PART##part##_BASE) \
>> +			& S5P_GPIO_BANK_MASK) << S5P_GPIO_BANK_SHIFT)
>> +
>> +#define EXYNOS5_GPIO_SET_BANK(part, bank) \
>> +			((((unsigned)&(((struct exynos5420_gpio_part##part *) \
>> +			EXYNOS5420_GPIO_PART##part##_BASE)->bank) \
>> +			- EXYNOS5_GPIO_PART##part##_BASE) \
>> +			& S5P_GPIO_BANK_MASK) << S5P_GPIO_BANK_SHIFT)
>> +
>> +#define EXYNOS5420_GPIO_SET_BANK(part, bank) \
>> +			((((unsigned)&(((struct exynos5420_gpio_part##part *) \
>> +			EXYNOS5420_GPIO_PART##part##_BASE)->bank) \
>> +			- EXYNOS5420_GPIO_PART##part##_BASE) \
>> +			& S5P_GPIO_BANK_MASK) << S5P_GPIO_BANK_SHIFT)
>> +
>> +#define exynos4_gpio_get(part, bank, pin) \
>> +			(S5P_GPIO_SET_PART(part) | \
>> +			EXYNOS4_GPIO_SET_BANK(part, bank) | \
>> +			S5P_GPIO_SET_PIN(pin))
>> +
>> +#define exynos4x12_gpio_get(part, bank, pin) \
>> +			(S5P_GPIO_SET_PART(part) | \
>> +			EXYNOS4X12_GPIO_SET_BANK(part, bank) | \
>> +			S5P_GPIO_SET_PIN(pin))
>> +
>> +#define exynos5420_gpio_get(part, bank, pin) \
>> +			(S5P_GPIO_SET_PART(part) | \
>> +			EXYNOS5420_GPIO_SET_BANK(part, bank) | \
>> +			S5P_GPIO_SET_PIN(pin))
>> +
>> +#define exynos5_gpio_get(part, bank, pin) \
>> +			(S5P_GPIO_SET_PART(part) | \
>> +			EXYNOS5_GPIO_SET_BANK(part, bank) | \
>> +			S5P_GPIO_SET_PIN(pin))
>> +
>> +static inline unsigned int s5p_gpio_base(int gpio)
>>   {
>> -	if (cpu_is_exynos5()) {
>> -		if (proid_is_exynos5420()) {
>> -			if (nr < EXYNOS5420_GPIO_PART1_MAX)
>> -				return EXYNOS5420_GPIO_PART1_BASE;
>> -			else if (nr < EXYNOS5420_GPIO_PART2_MAX)
>> -				return EXYNOS5420_GPIO_PART2_BASE;
>> -			else if (nr < EXYNOS5420_GPIO_PART3_MAX)
>> -				return EXYNOS5420_GPIO_PART3_BASE;
>> -			else
>> -				return EXYNOS5420_GPIO_PART4_BASE;
>> -		} else {
>> -			if (nr < EXYNOS5_GPIO_PART1_MAX)
>> -				return EXYNOS5_GPIO_PART1_BASE;
>> -			else if (nr < EXYNOS5_GPIO_PART2_MAX)
>> -				return EXYNOS5_GPIO_PART2_BASE;
>> -			else
>> -				return EXYNOS5_GPIO_PART3_BASE;
>> -		}
>> -	} else if (cpu_is_exynos4()) {
>> -		if (nr < EXYNOS4_GPIO_PART1_MAX)
>> -			return EXYNOS4_GPIO_PART1_BASE;
>> -		else
>> -			return EXYNOS4_GPIO_PART2_BASE;
>> +	unsigned gpio_part = S5P_GPIO_GET_PART(gpio);
>> +
>> +	switch (gpio_part) {
>> +	case 1:
>> +		return samsung_get_base_gpio_part1();
>> +	case 2:
>> +		return samsung_get_base_gpio_part2();
>> +	case 3:
>> +		return samsung_get_base_gpio_part3();
>> +	case 4:
>> +		return samsung_get_base_gpio_part4();
>> +	default:
>> +		return 0;
>>   	}
>> -
>> -	return 0;
>> -}
>> -
>> -static inline unsigned int s5p_gpio_part_max(int nr)
>> -{
>> -	if (cpu_is_exynos5()) {
>> -		if (proid_is_exynos5420()) {
>> -			if (nr < EXYNOS5420_GPIO_PART1_MAX)
>> -				return 0;
>> -			else if (nr < EXYNOS5420_GPIO_PART2_MAX)
>> -				return EXYNOS5420_GPIO_PART1_MAX;
>> -			else if (nr < EXYNOS5420_GPIO_PART3_MAX)
>> -				return EXYNOS5420_GPIO_PART2_MAX;
>> -			else if (nr < EXYNOS5420_GPIO_PART4_MAX)
>> -				return EXYNOS5420_GPIO_PART3_MAX;
>> -			else
>> -				return EXYNOS5420_GPIO_PART4_MAX;
>> -		} else {
>> -			if (nr < EXYNOS5_GPIO_PART1_MAX)
>> -				return 0;
>> -			else if (nr < EXYNOS5_GPIO_PART2_MAX)
>> -				return EXYNOS5_GPIO_PART1_MAX;
>> -			else
>> -				return EXYNOS5_GPIO_PART2_MAX;
>> -		}
>> -	} else if (cpu_is_exynos4()) {
>> -		if (proid_is_exynos4412()) {
>> -			if (nr < EXYNOS4X12_GPIO_PART1_MAX)
>> -				return 0;
>> -			else if (nr < EXYNOS4X12_GPIO_PART2_MAX)
>> -				return EXYNOS4X12_GPIO_PART1_MAX;
>> -			else
>> -				return EXYNOS4X12_GPIO_PART2_MAX;
>> -		} else {
>> -			if (nr < EXYNOS4_GPIO_PART1_MAX)
>> -				return 0;
>> -			else
>> -				return EXYNOS4_GPIO_PART1_MAX;
>> -		}
>> -	}
>> -
>> -	return 0;
>>   }
>>   #endif
>>
>> diff --git a/arch/arm/include/asm/arch-s5pc1xx/gpio.h b/arch/arm/include/asm/arch-s5pc1xx/gpio.h
>> index ac60fe6..c2d9244 100644
>> --- a/arch/arm/include/asm/arch-s5pc1xx/gpio.h
>> +++ b/arch/arm/include/asm/arch-s5pc1xx/gpio.h
>> @@ -125,20 +125,45 @@ void s5p_gpio_set_rate(struct s5p_gpio_bank *bank, int gpio, int mode);
>>   /* GPIO pins per bank  */
>>   #define GPIO_PER_BANK 8
>>
>> -static inline unsigned int s5p_gpio_base(int nr)
>> -{
>> -	return S5PC110_GPIO_BASE;
>> -}
>> +#define S5P_GPIO_PART_SHIFT	(24)
>> +#define S5P_GPIO_PART_MASK	(0xff)
>> +#define S5P_GPIO_BANK_SHIFT	(8)
>> +#define S5P_GPIO_BANK_MASK	(0xffff)
>> +#define S5P_GPIO_PIN_MASK	(0xff)
>> +
>> +#define S5P_GPIO_SET_PART(x) \
>> +			((x & S5P_GPIO_PART_MASK) << S5P_GPIO_PART_SHIFT)
>> +
>> +#define S5P_GPIO_GET_PART(x) \
>> +			((x >> S5P_GPIO_PART_SHIFT) & S5P_GPIO_PART_MASK)
>> +
>> +#define S5P_GPIO_SET_PIN(x) \
>> +			(x & S5P_GPIO_PIN_MASK)
>>
>> -static inline unsigned int s5p_gpio_part_max(int nr)
>> +#define S5PC100_SET_BANK(bank) \
>> +			(((unsigned)&(((struct s5pc100_gpio *) \
>> +			S5PC100_GPIO_BASE)->bank) - S5PC100_GPIO_BASE) \
>> +			& S5P_GPIO_BANK_MASK) << S5P_GPIO_BANK_SHIFT)
>> +
>> +#define S5PC110_SET_BANK(bank) \
>> +			((((unsigned)&(((struct s5pc110_gpio *) \
>> +			S5PC110_GPIO_BASE)->bank) - S5PC110_GPIO_BASE) \
>> +			& S5P_GPIO_BANK_MASK) << S5P_GPIO_BANK_SHIFT)
>> +
>> +#define s5pc100_gpio_get(bank, pin) \
>> +			(S5P_GPIO_SET_PART(0) | \
>> +			S5PC100_SET_BANK(bank) | \
>> +			S5P_GPIO_SET_PIN(pin))
>> +
>> +#define s5pc110_gpio_get(bank, pin) \
>> +			(S5P_GPIO_SET_PART(0) | \
>> +			S5PC110_SET_BANK(bank) | \
>> +			S5P_GPIO_SET_PIN(pin))
>> +
>> +static inline unsigned int s5p_gpio_base(int nr)
>>   {
>> -	return 0;
>> +	return samsung_get_base_gpio();
>>   }
>> -
>> -#define s5pc110_gpio_get_nr(bank, pin)	  \
>> -	((((((unsigned int)&(((struct s5pc110_gpio *)S5PC110_GPIO_BASE)->bank))\
>> -	    - S5PC110_GPIO_BASE) / sizeof(struct s5p_gpio_bank)) \
>> -	  * GPIO_PER_BANK) + pin)
>>   #endif
>>
>>   /* Pin configurations */
>> diff --git a/board/samsung/trats2/trats2.c b/board/samsung/trats2/trats2.c
>> index be15357..1e96fdc 100644
>> --- a/board/samsung/trats2/trats2.c
>> +++ b/board/samsung/trats2/trats2.c
>> @@ -144,17 +144,17 @@ static void board_init_i2c(void)
>>   int get_soft_i2c_scl_pin(void)
>>   {
>>   	if (I2C_ADAP_HWNR)
>> -		return exynos4x12_gpio_part2_get_nr(m2, 1); /* I2C9 */
>> +		return exynos4x12_gpio_get(2, m2, 1); /* I2C9 */
>>   	else
>> -		return exynos4x12_gpio_part1_get_nr(f1, 4); /* I2C8 */
>> +		return exynos4x12_gpio_get(1, f1, 4); /* I2C8 */
>>   }
>>
>>   int get_soft_i2c_sda_pin(void)
>>   {
>>   	if (I2C_ADAP_HWNR)
>> -		return exynos4x12_gpio_part2_get_nr(m2, 0); /* I2C9 */
>> +		return exynos4x12_gpio_get(2, m2, 0); /* I2C9 */
>>   	else
>> -		return exynos4x12_gpio_part1_get_nr(f1, 5); /* I2C8 */
>> +		return exynos4x12_gpio_get(1, f1, 5); /* I2C8 */
>>   }
>>   #endif
>>
>> diff --git a/drivers/gpio/s5p_gpio.c b/drivers/gpio/s5p_gpio.c
>> index 7eeb96d..11a0472 100644
>> --- a/drivers/gpio/s5p_gpio.c
>> +++ b/drivers/gpio/s5p_gpio.c
>> @@ -9,6 +9,11 @@
>>   #include <asm/io.h>
>>   #include <asm/gpio.h>
>>
>> +#define S5P_GPIO_GET_BANK(x)	((x >> S5P_GPIO_BANK_SHIFT) \
>> +				& S5P_GPIO_BANK_MASK)
>> +
>> +#define S5P_GPIO_GET_PIN(x)	(x & S5P_GPIO_PIN_MASK)
>> +
>>   #define CON_MASK(x)		(0xf << ((x) << 2))
>>   #define CON_SFR(x, v)		((v) << ((x) << 2))
>>
>> @@ -124,17 +129,15 @@ void s5p_gpio_set_rate(struct s5p_gpio_bank *bank, int gpio, int mode)
>>
>>   struct s5p_gpio_bank *s5p_gpio_get_bank(unsigned gpio)
>>   {
>> -	int bank;
>> -	unsigned g = gpio - s5p_gpio_part_max(gpio);
>> +	unsigned bank = S5P_GPIO_GET_BANK(gpio);
>> +	unsigned base = s5p_gpio_base(gpio);
>>
>> -	bank = g / GPIO_PER_BANK;
>> -	bank *= sizeof(struct s5p_gpio_bank);
>> -	return (struct s5p_gpio_bank *) (s5p_gpio_base(gpio) + bank);
>> +	return (struct s5p_gpio_bank *)(base + bank);
>>   }
>>
>>   int s5p_gpio_get_pin(unsigned gpio)
>>   {
>> -	return gpio % GPIO_PER_BANK;
>> +	return S5P_GPIO_GET_PIN(gpio);
>>   }
>>
>>   /* Common GPIO API */
>> diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
>> index 0590d20..4cdf937 100644
>> --- a/include/configs/s5p_goni.h
>> +++ b/include/configs/s5p_goni.h
>> @@ -208,8 +208,8 @@
>>   /*
>>    * I2C Settings
>>    */
>> -#define CONFIG_SOFT_I2C_GPIO_SCL s5pc110_gpio_get_nr(j4, 3)
>> -#define CONFIG_SOFT_I2C_GPIO_SDA s5pc110_gpio_get_nr(j4, 0)
>> +#define CONFIG_SOFT_I2C_GPIO_SCL s5pc110_gpio_get(j4, 3)
>> +#define CONFIG_SOFT_I2C_GPIO_SDA s5pc110_gpio_get(j4, 0)
>>
>>   #define CONFIG_SYS_I2C
>>   #define CONFIG_SYS_I2C_SOFT		/* I2C bit-banged */
>> diff --git a/include/configs/s5pc210_universal.h b/include/configs/s5pc210_universal.h
>> index d9e4c56..02a1c99 100644
>> --- a/include/configs/s5pc210_universal.h
>> +++ b/include/configs/s5pc210_universal.h
>> @@ -229,8 +229,8 @@
>>   /*
>>    * I2C Settings
>>    */
>> -#define CONFIG_SOFT_I2C_GPIO_SCL exynos4_gpio_part1_get_nr(b, 7)
>> -#define CONFIG_SOFT_I2C_GPIO_SDA exynos4_gpio_part1_get_nr(b, 6)
>> +#define CONFIG_SOFT_I2C_GPIO_SCL exynos4_gpio_get(1, b, 7)
>> +#define CONFIG_SOFT_I2C_GPIO_SDA exynos4_gpio_get(1, b, 6)
>>
>>   #define CONFIG_SYS_I2C
>>   #define CONFIG_SYS_I2C_SOFT		/* I2C bit-banged */
>> @@ -253,10 +253,10 @@
>>    */
>>   #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 CONFIG_SOFT_SPI_GPIO_SCLK exynos4_gpio_get(2, y3, 1)
>> +#define CONFIG_SOFT_SPI_GPIO_MOSI exynos4_gpio_get(2, y3, 3)
>> +#define CONFIG_SOFT_SPI_GPIO_MISO exynos4_gpio_get(2, y3, 0)
>> +#define CONFIG_SOFT_SPI_GPIO_CS exynos4_gpio_get(2, y4, 3)
>>
>>   #define SPI_DELAY udelay(1)
>>   #undef SPI_INIT
>> diff --git a/include/configs/trats.h b/include/configs/trats.h
>> index 0877142..9727f7a 100644
>> --- a/include/configs/trats.h
>> +++ b/include/configs/trats.h
>> @@ -282,8 +282,8 @@
>>   #include <asm/arch/gpio.h>
>>
>>   /* I2C FG */
>> -#define CONFIG_SOFT_I2C_GPIO_SCL exynos4_gpio_part2_get_nr(y4, 1)
>> -#define CONFIG_SOFT_I2C_GPIO_SDA exynos4_gpio_part2_get_nr(y4, 0)
>> +#define CONFIG_SOFT_I2C_GPIO_SCL exynos4_gpio_get(2, y4, 1)
>> +#define CONFIG_SOFT_I2C_GPIO_SDA exynos4_gpio_get(2, y4, 0)
>>
>>   #define CONFIG_POWER
>>   #define CONFIG_POWER_I2C
>>
>
> Thanks,
> Minkyu Kang.
>

Regards
-- 
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com

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

* [U-Boot] [PATCH v3 11/12] trats2: add LCD download menu support
  2014-01-07 12:54         ` Przemyslaw Marczak
@ 2014-01-08  1:56           ` Minkyu Kang
  2014-01-08 13:47             ` Przemyslaw Marczak
  0 siblings, 1 reply; 147+ messages in thread
From: Minkyu Kang @ 2014-01-08  1:56 UTC (permalink / raw)
  To: u-boot

Dear Przemsyslaw Marczak,

On 07/01/14 21:54, Przemyslaw Marczak wrote:
> Hello,
> 
> On 01/06/2014 12:37 PM, Minkyu Kang wrote:
>> On 04/01/14 02:21, Przemyslaw Marczak wrote:
>>> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
>>>
>>> ---
>>> changes v2:
>>> - add definitions for check keys
>>> - cleanup config definitions
>>>
>>> Changes v3:
>>> - remove CONFIG_BOARD_NAME from include/configs/trats2.h
>>>
>>>   include/configs/trats2.h |   26 ++++++++++++++++++++++++++
>>>   1 file changed, 26 insertions(+)
>>>
>>> diff --git a/include/configs/trats2.h b/include/configs/trats2.h
>>> index 740ceb1..453a37e 100644
>>> --- a/include/configs/trats2.h
>>> +++ b/include/configs/trats2.h
>>> @@ -19,6 +19,7 @@
>>>   #define CONFIG_S5P        /* which is in a S5P Family */
>>>   #define CONFIG_EXYNOS4        /* which is in a EXYNOS4XXX */
>>>   #define CONFIG_TIZEN        /* TIZEN lib */
>>> +#define CONFIG_TRATS2
>>>
>>>   #include <asm/arch/cpu.h>        /* get chip and board defs */
>>>
>>> @@ -315,6 +316,31 @@ int get_soft_i2c_sda_pin(void);
>>>   /* Common misc for Samsung */
>>>   #define CONFIG_MISC_INIT_R
>>>
>>> +/* Download menu - Samsung common */
>>> +#define CONFIG_LCD_MENU
>>> +#define CONFIG_LCD_MENU_BOARD
>>> +
>>> +/* Download menu - definitions for check keys */
>>> +#ifndef __ASSEMBLY__
>>> +#ifdef __COMMON_H_
>>
>> why this ifdef(__COMMON_H_) is needed?
>>
> 
> There was some include conflict with pmic which breaks build and this macro resolve it.

What kind of conflict?
I think it is not a solution.

Thanks,
Minkyu Kang.

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

* [U-Boot] [PATCH v3 11/12] trats2: add LCD download menu support
  2014-01-08  1:56           ` Minkyu Kang
@ 2014-01-08 13:47             ` Przemyslaw Marczak
  0 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-08 13:47 UTC (permalink / raw)
  To: u-boot

Hello Minkyu,

On 01/08/2014 02:56 AM, Minkyu Kang wrote:
> Dear Przemsyslaw Marczak,
>
> On 07/01/14 21:54, Przemyslaw Marczak wrote:
>> Hello,
>>
>> On 01/06/2014 12:37 PM, Minkyu Kang wrote:
>>> On 04/01/14 02:21, Przemyslaw Marczak wrote:
>>>> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
>>>>
>>>> ---
>>>> changes v2:
>>>> - add definitions for check keys
>>>> - cleanup config definitions
>>>>
>>>> Changes v3:
>>>> - remove CONFIG_BOARD_NAME from include/configs/trats2.h
>>>>
>>>>    include/configs/trats2.h |   26 ++++++++++++++++++++++++++
>>>>    1 file changed, 26 insertions(+)
>>>>
>>>> diff --git a/include/configs/trats2.h b/include/configs/trats2.h
>>>> index 740ceb1..453a37e 100644
>>>> --- a/include/configs/trats2.h
>>>> +++ b/include/configs/trats2.h
>>>> @@ -19,6 +19,7 @@
>>>>    #define CONFIG_S5P        /* which is in a S5P Family */
>>>>    #define CONFIG_EXYNOS4        /* which is in a EXYNOS4XXX */
>>>>    #define CONFIG_TIZEN        /* TIZEN lib */
>>>> +#define CONFIG_TRATS2
>>>>
>>>>    #include <asm/arch/cpu.h>        /* get chip and board defs */
>>>>
>>>> @@ -315,6 +316,31 @@ int get_soft_i2c_sda_pin(void);
>>>>    /* Common misc for Samsung */
>>>>    #define CONFIG_MISC_INIT_R
>>>>
>>>> +/* Download menu - Samsung common */
>>>> +#define CONFIG_LCD_MENU
>>>> +#define CONFIG_LCD_MENU_BOARD
>>>> +
>>>> +/* Download menu - definitions for check keys */
>>>> +#ifndef __ASSEMBLY__
>>>> +#ifdef __COMMON_H_
>>>
>>> why this ifdef(__COMMON_H_) is needed?
>>>
>>
>> There was some include conflict with pmic which breaks build and this macro resolve it.
>
> What kind of conflict?
> I think it is not a solution.
>
> Thanks,
> Minkyu Kang.
>

There was various errors with conflicting declaration types.

It was looking like "common.h" was not included for some file when I add 
include of pmic.h to file trats2.h.

The conflict was because of max77686_pmic.h which needs pmic.h(functions 
declarations with struct pmic).

File pmic.h includes common.h but it is unneeded there.
Remove common.h from pmic.h solved this issue.

I will resend patches soon.

Thank you
-- 
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com

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

* [U-Boot] [PATCH v4 00/12] Introduce Samsung misc file and LCD menu.
  2013-12-03 18:03 [U-Boot] [PATCH 00/10] Introduce Samsung misc file and LCD menu Przemyslaw Marczak
                   ` (12 preceding siblings ...)
  2014-01-03 16:43 ` [U-Boot] [PATCH v3 01/12] s5p: gpio: change gpio coding method for s5p gpio Przemyslaw Marczak
@ 2014-01-09 11:23 ` Przemyslaw Marczak
  2014-01-09 11:23   ` [U-Boot] [PATCH v4 01/12] s5p: gpio: change gpio coding method for s5p gpio Przemyslaw Marczak
                     ` (12 more replies)
  2014-01-10 14:31 ` [U-Boot] [PATCH v5 " Przemyslaw Marczak
  2014-01-22 10:24 ` [U-Boot] [PATCH v6 00/11] Introduce Samsung misc file and LCD menu Przemyslaw Marczak
  15 siblings, 13 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-09 11:23 UTC (permalink / raw)
  To: u-boot

This patch set includes changes required to:
- properly use of all gpios
- introduce common file for Samsung misc code
- keys support (PWR, VOL:UP,DOWN)
- console support on LCD
- 16bpp logo support
- introduce LCD menu on Samsung devices

Each version changes are described in each patch commit msg.

Przemyslaw Marczak (12):
  s5p: gpio: change gpio coding method for s5p gpio.
  trats2: Code cleanup.
  samsung: common: Add misc file and common function misc_init_r().
  samsung: misc: move display logo function to misc.c file.
  common: lcd.c: fix data abort exception when try to access bmp header
  lib: tizen: change Tizen logo with the new one.
  video: exynos: fimd: add support for various display color modes
  samsung: boards: update display configs with 16bpp mode.
  samsung: misc: Add LCD download menu.
  Trats: add LCD download menu support
  trats2: add LCD download menu support
  universal: add LCD download menu support

 arch/arm/include/asm/arch-exynos/gpio.h  |  245 +-
 arch/arm/include/asm/arch-s5pc1xx/gpio.h |   47 +-
 board/samsung/common/Makefile            |    1 +
 board/samsung/common/misc.c              |  407 ++
 board/samsung/common/misc.h              |   18 +
 board/samsung/trats/trats.c              |    5 +-
 board/samsung/trats2/trats2.c            |   33 +-
 board/samsung/universal_c210/universal.c |    6 +-
 common/lcd.c                             |   27 +-
 drivers/gpio/s5p_gpio.c                  |   15 +-
 drivers/power/battery/bat_trats2.c       |    2 +-
 drivers/video/exynos_fb.c                |   28 -
 drivers/video/exynos_fimd.c              |   15 +-
 include/configs/s5p_goni.h               |    4 +-
 include/configs/s5pc210_universal.h      |   41 +-
 include/configs/trats.h                  |   33 +-
 include/configs/trats2.h                 |   31 +-
 include/lcd.h                            |    2 +
 include/power/max77686_pmic.h            |    2 +
 include/power/pmic.h                     |    1 -
 lib/tizen/tizen.c                        |   21 +-
 lib/tizen/tizen_hd_logo.h                | 5057 ---------------
 lib/tizen/tizen_hd_logo_data.h           |   15 -
 lib/tizen/tizen_logo_16bpp.h             |10025 ++++++++++++++++++++++++++++++
 lib/tizen/tizen_logo_16bpp_gzip.h        |  727 +++
 25 files changed, 11437 insertions(+), 5371 deletions(-)
 create mode 100644 board/samsung/common/misc.c
 create mode 100644 board/samsung/common/misc.h
 delete mode 100644 lib/tizen/tizen_hd_logo.h
 delete mode 100644 lib/tizen/tizen_hd_logo_data.h
 create mode 100644 lib/tizen/tizen_logo_16bpp.h
 create mode 100644 lib/tizen/tizen_logo_16bpp_gzip.h

-- 
1.7.9.5

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

* [U-Boot] [PATCH v4 01/12] s5p: gpio: change gpio coding method for s5p gpio.
  2014-01-09 11:23 ` [U-Boot] [PATCH v4 00/12] Introduce Samsung misc file and LCD menu Przemyslaw Marczak
@ 2014-01-09 11:23   ` Przemyslaw Marczak
  2014-01-09 11:23   ` [U-Boot] [PATCH v4 02/12] trats2: Code cleanup Przemyslaw Marczak
                     ` (11 subsequent siblings)
  12 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-09 11:23 UTC (permalink / raw)
  To: u-boot

Old s5p gpio coding method was not clean and was not working properly
for all parts and banks. New method is clean and easy to extend.

Gpio coding mask:
0x000000ff - pin number
0x00ffff00 - bank offset
0xff000000 - part number

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>

---
Changes v2:
- none

Changes v3:
- fix merge conflict in arch/arm/include/asm/arch-exynos/gpio.h
- add exynos5420 gpio coding
- update file: board/samsung/trats2/trats2.c

Changes v4:
- code cleanup

 arch/arm/include/asm/arch-exynos/gpio.h  |  245 +++++++++---------------------
 arch/arm/include/asm/arch-s5pc1xx/gpio.h |   47 ++++--
 board/samsung/trats2/trats2.c            |    8 +-
 drivers/gpio/s5p_gpio.c                  |   15 +-
 include/configs/s5p_goni.h               |    4 +-
 include/configs/s5pc210_universal.h      |   12 +-
 include/configs/trats.h                  |    4 +-
 7 files changed, 132 insertions(+), 203 deletions(-)

diff --git a/arch/arm/include/asm/arch-exynos/gpio.h b/arch/arm/include/asm/arch-exynos/gpio.h
index 2a19852..d6868fa 100644
--- a/arch/arm/include/asm/arch-exynos/gpio.h
+++ b/arch/arm/include/asm/arch-exynos/gpio.h
@@ -247,180 +247,81 @@ void s5p_gpio_set_rate(struct s5p_gpio_bank *bank, int gpio, int mode);
 
 /* GPIO pins per bank  */
 #define GPIO_PER_BANK 8
-
-#define exynos4_gpio_part1_get_nr(bank, pin) \
-	((((((unsigned int) &(((struct exynos4_gpio_part1 *) \
-			       EXYNOS4_GPIO_PART1_BASE)->bank)) \
-	    - EXYNOS4_GPIO_PART1_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin)
-
-#define EXYNOS4_GPIO_PART1_MAX ((sizeof(struct exynos4_gpio_part1) \
-			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
-
-#define exynos4_gpio_part2_get_nr(bank, pin) \
-	(((((((unsigned int) &(((struct exynos4_gpio_part2 *) \
-				EXYNOS4_GPIO_PART2_BASE)->bank)) \
-	    - EXYNOS4_GPIO_PART2_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin) + EXYNOS4_GPIO_PART1_MAX)
-
-#define exynos4x12_gpio_part1_get_nr(bank, pin) \
-	((((((unsigned int) &(((struct exynos4x12_gpio_part1 *) \
-			       EXYNOS4X12_GPIO_PART1_BASE)->bank)) \
-	    - EXYNOS4X12_GPIO_PART1_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin)
-
-#define EXYNOS4X12_GPIO_PART1_MAX ((sizeof(struct exynos4x12_gpio_part1) \
-			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
-
-#define exynos4x12_gpio_part2_get_nr(bank, pin) \
-	(((((((unsigned int) &(((struct exynos4x12_gpio_part2 *) \
-				EXYNOS4X12_GPIO_PART2_BASE)->bank)) \
-	    - EXYNOS4X12_GPIO_PART2_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin) + EXYNOS4X12_GPIO_PART1_MAX)
-
-#define EXYNOS4X12_GPIO_PART2_MAX ((sizeof(struct exynos4x12_gpio_part2) \
-			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
-
-#define exynos4x12_gpio_part3_get_nr(bank, pin) \
-	(((((((unsigned int) &(((struct exynos4x12_gpio_part3 *) \
-				EXYNOS4X12_GPIO_PART3_BASE)->bank)) \
-	    - EXYNOS4X12_GPIO_PART3_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin) + EXYNOS4X12_GPIO_PART2_MAX)
-
-#define exynos5_gpio_part1_get_nr(bank, pin) \
-	((((((unsigned int) &(((struct exynos5_gpio_part1 *) \
-			       EXYNOS5_GPIO_PART1_BASE)->bank)) \
-	    - EXYNOS5_GPIO_PART1_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin)
-
-#define EXYNOS5_GPIO_PART1_MAX ((sizeof(struct exynos5_gpio_part1) \
-			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
-
-#define exynos5_gpio_part2_get_nr(bank, pin) \
-	(((((((unsigned int) &(((struct exynos5_gpio_part2 *) \
-				EXYNOS5_GPIO_PART2_BASE)->bank)) \
-	    - EXYNOS5_GPIO_PART2_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin) + EXYNOS5_GPIO_PART1_MAX)
-
-#define EXYNOS5_GPIO_PART2_MAX ((sizeof(struct exynos5_gpio_part2) \
-			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
-
-#define exynos5_gpio_part3_get_nr(bank, pin) \
-	(((((((unsigned int) &(((struct exynos5_gpio_part3 *) \
-				EXYNOS5_GPIO_PART3_BASE)->bank)) \
-	    - EXYNOS5_GPIO_PART3_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin) + EXYNOS5_GPIO_PART2_MAX)
-
-
-/* EXYNOS5420 */
-#define exynos5420_gpio_part1_get_nr(bank, pin) \
-	((((((unsigned int) &(((struct exynos5420_gpio_part1 *)\
-			       EXYNOS5420_GPIO_PART1_BASE)->bank)) \
-	    - EXYNOS5420_GPIO_PART1_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin)
-
-#define EXYNOS5420_GPIO_PART1_MAX ((sizeof(struct exynos5420_gpio_part1) \
-			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
-
-#define exynos5420_gpio_part2_get_nr(bank, pin) \
-	(((((((unsigned int) &(((struct exynos5420_gpio_part2 *)\
-				EXYNOS5420_GPIO_PART2_BASE)->bank)) \
-	    - EXYNOS5420_GPIO_PART2_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin) + EXYNOS5420_GPIO_PART1_MAX)
-
-#define EXYNOS5420_GPIO_PART2_MAX ((sizeof(struct exynos5420_gpio_part2) \
-			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
-
-#define exynos5420_gpio_part3_get_nr(bank, pin) \
-	(((((((unsigned int) &(((struct exynos5420_gpio_part3 *)\
-				EXYNOS5420_GPIO_PART3_BASE)->bank)) \
-	    - EXYNOS5420_GPIO_PART3_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin) + EXYNOS5420_GPIO_PART2_MAX)
-
-#define EXYNOS5420_GPIO_PART3_MAX ((sizeof(struct exynos5420_gpio_part3) \
-			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
-
-#define exynos5420_gpio_part4_get_nr(bank, pin) \
-	(((((((unsigned int) &(((struct exynos5420_gpio_part4 *)\
-				EXYNOS5420_GPIO_PART4_BASE)->bank)) \
-	    - EXYNOS5420_GPIO_PART4_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin) + EXYNOS5420_GPIO_PART3_MAX)
-
-#define EXYNOS5420_GPIO_PART4_MAX ((sizeof(struct exynos5420_gpio_part4) \
-			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
-
-#define EXYNOS5420_GPIO_PART5_MAX ((sizeof(struct exynos5420_gpio_part5) \
-			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
-
-static inline unsigned int s5p_gpio_base(int nr)
+#define S5P_GPIO_PART_SHIFT	(24)
+#define S5P_GPIO_PART_MASK	(0xff)
+#define S5P_GPIO_BANK_SHIFT	(8)
+#define S5P_GPIO_BANK_MASK	(0xffff)
+#define S5P_GPIO_PIN_MASK	(0xff)
+
+#define S5P_GPIO_SET_PART(x) \
+			(((x) & S5P_GPIO_PART_MASK) << S5P_GPIO_PART_SHIFT)
+
+#define S5P_GPIO_GET_PART(x) \
+			(((x) >> S5P_GPIO_PART_SHIFT) & S5P_GPIO_PART_MASK)
+
+#define S5P_GPIO_SET_PIN(x) \
+			((x) & S5P_GPIO_PIN_MASK)
+
+#define EXYNOS4_GPIO_SET_BANK(part, bank) \
+			((((unsigned)&(((struct exynos4_gpio_part##part *) \
+			EXYNOS4_GPIO_PART##part##_BASE)->bank) \
+			- EXYNOS4_GPIO_PART##part##_BASE) \
+			& S5P_GPIO_BANK_MASK) << S5P_GPIO_BANK_SHIFT)
+
+#define EXYNOS4X12_GPIO_SET_BANK(part, bank) \
+			((((unsigned)&(((struct exynos4x12_gpio_part##part *) \
+			EXYNOS4X12_GPIO_PART##part##_BASE)->bank) \
+			- EXYNOS4X12_GPIO_PART##part##_BASE) \
+			& S5P_GPIO_BANK_MASK) << S5P_GPIO_BANK_SHIFT)
+
+#define EXYNOS5_GPIO_SET_BANK(part, bank) \
+			((((unsigned)&(((struct exynos5420_gpio_part##part *) \
+			EXYNOS5420_GPIO_PART##part##_BASE)->bank) \
+			- EXYNOS5_GPIO_PART##part##_BASE) \
+			& S5P_GPIO_BANK_MASK) << S5P_GPIO_BANK_SHIFT)
+
+#define EXYNOS5420_GPIO_SET_BANK(part, bank) \
+			((((unsigned)&(((struct exynos5420_gpio_part##part *) \
+			EXYNOS5420_GPIO_PART##part##_BASE)->bank) \
+			- EXYNOS5420_GPIO_PART##part##_BASE) \
+			& S5P_GPIO_BANK_MASK) << S5P_GPIO_BANK_SHIFT)
+
+#define exynos4_gpio_get(part, bank, pin) \
+			(S5P_GPIO_SET_PART(part) | \
+			EXYNOS4_GPIO_SET_BANK(part, bank) | \
+			S5P_GPIO_SET_PIN(pin))
+
+#define exynos4x12_gpio_get(part, bank, pin) \
+			(S5P_GPIO_SET_PART(part) | \
+			EXYNOS4X12_GPIO_SET_BANK(part, bank) | \
+			S5P_GPIO_SET_PIN(pin))
+
+#define exynos5420_gpio_get(part, bank, pin) \
+			(S5P_GPIO_SET_PART(part) | \
+			EXYNOS5420_GPIO_SET_BANK(part, bank) | \
+			S5P_GPIO_SET_PIN(pin))
+
+#define exynos5_gpio_get(part, bank, pin) \
+			(S5P_GPIO_SET_PART(part) | \
+			EXYNOS5_GPIO_SET_BANK(part, bank) | \
+			S5P_GPIO_SET_PIN(pin))
+
+static inline unsigned int s5p_gpio_base(int gpio)
 {
-	if (cpu_is_exynos5()) {
-		if (proid_is_exynos5420()) {
-			if (nr < EXYNOS5420_GPIO_PART1_MAX)
-				return EXYNOS5420_GPIO_PART1_BASE;
-			else if (nr < EXYNOS5420_GPIO_PART2_MAX)
-				return EXYNOS5420_GPIO_PART2_BASE;
-			else if (nr < EXYNOS5420_GPIO_PART3_MAX)
-				return EXYNOS5420_GPIO_PART3_BASE;
-			else
-				return EXYNOS5420_GPIO_PART4_BASE;
-		} else {
-			if (nr < EXYNOS5_GPIO_PART1_MAX)
-				return EXYNOS5_GPIO_PART1_BASE;
-			else if (nr < EXYNOS5_GPIO_PART2_MAX)
-				return EXYNOS5_GPIO_PART2_BASE;
-			else
-				return EXYNOS5_GPIO_PART3_BASE;
-		}
-	} else if (cpu_is_exynos4()) {
-		if (nr < EXYNOS4_GPIO_PART1_MAX)
-			return EXYNOS4_GPIO_PART1_BASE;
-		else
-			return EXYNOS4_GPIO_PART2_BASE;
+	unsigned gpio_part = S5P_GPIO_GET_PART(gpio);
+
+	switch (gpio_part) {
+	case 1:
+		return samsung_get_base_gpio_part1();
+	case 2:
+		return samsung_get_base_gpio_part2();
+	case 3:
+		return samsung_get_base_gpio_part3();
+	case 4:
+		return samsung_get_base_gpio_part4();
+	default:
+		return 0;
 	}
-
-	return 0;
-}
-
-static inline unsigned int s5p_gpio_part_max(int nr)
-{
-	if (cpu_is_exynos5()) {
-		if (proid_is_exynos5420()) {
-			if (nr < EXYNOS5420_GPIO_PART1_MAX)
-				return 0;
-			else if (nr < EXYNOS5420_GPIO_PART2_MAX)
-				return EXYNOS5420_GPIO_PART1_MAX;
-			else if (nr < EXYNOS5420_GPIO_PART3_MAX)
-				return EXYNOS5420_GPIO_PART2_MAX;
-			else if (nr < EXYNOS5420_GPIO_PART4_MAX)
-				return EXYNOS5420_GPIO_PART3_MAX;
-			else
-				return EXYNOS5420_GPIO_PART4_MAX;
-		} else {
-			if (nr < EXYNOS5_GPIO_PART1_MAX)
-				return 0;
-			else if (nr < EXYNOS5_GPIO_PART2_MAX)
-				return EXYNOS5_GPIO_PART1_MAX;
-			else
-				return EXYNOS5_GPIO_PART2_MAX;
-		}
-	} else if (cpu_is_exynos4()) {
-		if (proid_is_exynos4412()) {
-			if (nr < EXYNOS4X12_GPIO_PART1_MAX)
-				return 0;
-			else if (nr < EXYNOS4X12_GPIO_PART2_MAX)
-				return EXYNOS4X12_GPIO_PART1_MAX;
-			else
-				return EXYNOS4X12_GPIO_PART2_MAX;
-		} else {
-			if (nr < EXYNOS4_GPIO_PART1_MAX)
-				return 0;
-			else
-				return EXYNOS4_GPIO_PART1_MAX;
-		}
-	}
-
-	return 0;
 }
 #endif
 
diff --git a/arch/arm/include/asm/arch-s5pc1xx/gpio.h b/arch/arm/include/asm/arch-s5pc1xx/gpio.h
index ac60fe6..da8df74 100644
--- a/arch/arm/include/asm/arch-s5pc1xx/gpio.h
+++ b/arch/arm/include/asm/arch-s5pc1xx/gpio.h
@@ -125,20 +125,45 @@ void s5p_gpio_set_rate(struct s5p_gpio_bank *bank, int gpio, int mode);
 /* GPIO pins per bank  */
 #define GPIO_PER_BANK 8
 
-static inline unsigned int s5p_gpio_base(int nr)
-{
-	return S5PC110_GPIO_BASE;
-}
+#define S5P_GPIO_PART_SHIFT	(24)
+#define S5P_GPIO_PART_MASK	(0xff)
+#define S5P_GPIO_BANK_SHIFT	(8)
+#define S5P_GPIO_BANK_MASK	(0xffff)
+#define S5P_GPIO_PIN_MASK	(0xff)
+
+#define S5P_GPIO_SET_PART(x) \
+			(((x) & S5P_GPIO_PART_MASK) << S5P_GPIO_PART_SHIFT)
+
+#define S5P_GPIO_GET_PART(x) \
+			(((x) >> S5P_GPIO_PART_SHIFT) & S5P_GPIO_PART_MASK)
+
+#define S5P_GPIO_SET_PIN(x) \
+			((x) & S5P_GPIO_PIN_MASK)
 
-static inline unsigned int s5p_gpio_part_max(int nr)
+#define S5PC100_SET_BANK(bank) \
+			(((unsigned)&(((struct s5pc100_gpio *) \
+			S5PC100_GPIO_BASE)->bank) - S5PC100_GPIO_BASE) \
+			& S5P_GPIO_BANK_MASK) << S5P_GPIO_BANK_SHIFT)
+
+#define S5PC110_SET_BANK(bank) \
+			((((unsigned)&(((struct s5pc110_gpio *) \
+			S5PC110_GPIO_BASE)->bank) - S5PC110_GPIO_BASE) \
+			& S5P_GPIO_BANK_MASK) << S5P_GPIO_BANK_SHIFT)
+
+#define s5pc100_gpio_get(bank, pin) \
+			(S5P_GPIO_SET_PART(0) | \
+			S5PC100_SET_BANK(bank) | \
+			S5P_GPIO_SET_PIN(pin))
+
+#define s5pc110_gpio_get(bank, pin) \
+			(S5P_GPIO_SET_PART(0) | \
+			S5PC110_SET_BANK(bank) | \
+			S5P_GPIO_SET_PIN(pin))
+
+static inline unsigned int s5p_gpio_base(int nr)
 {
-	return 0;
+	return samsung_get_base_gpio();
 }
-
-#define s5pc110_gpio_get_nr(bank, pin)	  \
-	((((((unsigned int)&(((struct s5pc110_gpio *)S5PC110_GPIO_BASE)->bank))\
-	    - S5PC110_GPIO_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin)
 #endif
 
 /* Pin configurations */
diff --git a/board/samsung/trats2/trats2.c b/board/samsung/trats2/trats2.c
index be15357..1e96fdc 100644
--- a/board/samsung/trats2/trats2.c
+++ b/board/samsung/trats2/trats2.c
@@ -144,17 +144,17 @@ static void board_init_i2c(void)
 int get_soft_i2c_scl_pin(void)
 {
 	if (I2C_ADAP_HWNR)
-		return exynos4x12_gpio_part2_get_nr(m2, 1); /* I2C9 */
+		return exynos4x12_gpio_get(2, m2, 1); /* I2C9 */
 	else
-		return exynos4x12_gpio_part1_get_nr(f1, 4); /* I2C8 */
+		return exynos4x12_gpio_get(1, f1, 4); /* I2C8 */
 }
 
 int get_soft_i2c_sda_pin(void)
 {
 	if (I2C_ADAP_HWNR)
-		return exynos4x12_gpio_part2_get_nr(m2, 0); /* I2C9 */
+		return exynos4x12_gpio_get(2, m2, 0); /* I2C9 */
 	else
-		return exynos4x12_gpio_part1_get_nr(f1, 5); /* I2C8 */
+		return exynos4x12_gpio_get(1, f1, 5); /* I2C8 */
 }
 #endif
 
diff --git a/drivers/gpio/s5p_gpio.c b/drivers/gpio/s5p_gpio.c
index 7eeb96d..11a0472 100644
--- a/drivers/gpio/s5p_gpio.c
+++ b/drivers/gpio/s5p_gpio.c
@@ -9,6 +9,11 @@
 #include <asm/io.h>
 #include <asm/gpio.h>
 
+#define S5P_GPIO_GET_BANK(x)	((x >> S5P_GPIO_BANK_SHIFT) \
+				& S5P_GPIO_BANK_MASK)
+
+#define S5P_GPIO_GET_PIN(x)	(x & S5P_GPIO_PIN_MASK)
+
 #define CON_MASK(x)		(0xf << ((x) << 2))
 #define CON_SFR(x, v)		((v) << ((x) << 2))
 
@@ -124,17 +129,15 @@ void s5p_gpio_set_rate(struct s5p_gpio_bank *bank, int gpio, int mode)
 
 struct s5p_gpio_bank *s5p_gpio_get_bank(unsigned gpio)
 {
-	int bank;
-	unsigned g = gpio - s5p_gpio_part_max(gpio);
+	unsigned bank = S5P_GPIO_GET_BANK(gpio);
+	unsigned base = s5p_gpio_base(gpio);
 
-	bank = g / GPIO_PER_BANK;
-	bank *= sizeof(struct s5p_gpio_bank);
-	return (struct s5p_gpio_bank *) (s5p_gpio_base(gpio) + bank);
+	return (struct s5p_gpio_bank *)(base + bank);
 }
 
 int s5p_gpio_get_pin(unsigned gpio)
 {
-	return gpio % GPIO_PER_BANK;
+	return S5P_GPIO_GET_PIN(gpio);
 }
 
 /* Common GPIO API */
diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
index 0590d20..4cdf937 100644
--- a/include/configs/s5p_goni.h
+++ b/include/configs/s5p_goni.h
@@ -208,8 +208,8 @@
 /*
  * I2C Settings
  */
-#define CONFIG_SOFT_I2C_GPIO_SCL s5pc110_gpio_get_nr(j4, 3)
-#define CONFIG_SOFT_I2C_GPIO_SDA s5pc110_gpio_get_nr(j4, 0)
+#define CONFIG_SOFT_I2C_GPIO_SCL s5pc110_gpio_get(j4, 3)
+#define CONFIG_SOFT_I2C_GPIO_SDA s5pc110_gpio_get(j4, 0)
 
 #define CONFIG_SYS_I2C
 #define CONFIG_SYS_I2C_SOFT		/* I2C bit-banged */
diff --git a/include/configs/s5pc210_universal.h b/include/configs/s5pc210_universal.h
index d9e4c56..02a1c99 100644
--- a/include/configs/s5pc210_universal.h
+++ b/include/configs/s5pc210_universal.h
@@ -229,8 +229,8 @@
 /*
  * I2C Settings
  */
-#define CONFIG_SOFT_I2C_GPIO_SCL exynos4_gpio_part1_get_nr(b, 7)
-#define CONFIG_SOFT_I2C_GPIO_SDA exynos4_gpio_part1_get_nr(b, 6)
+#define CONFIG_SOFT_I2C_GPIO_SCL exynos4_gpio_get(1, b, 7)
+#define CONFIG_SOFT_I2C_GPIO_SDA exynos4_gpio_get(1, b, 6)
 
 #define CONFIG_SYS_I2C
 #define CONFIG_SYS_I2C_SOFT		/* I2C bit-banged */
@@ -253,10 +253,10 @@
  */
 #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 CONFIG_SOFT_SPI_GPIO_SCLK exynos4_gpio_get(2, y3, 1)
+#define CONFIG_SOFT_SPI_GPIO_MOSI exynos4_gpio_get(2, y3, 3)
+#define CONFIG_SOFT_SPI_GPIO_MISO exynos4_gpio_get(2, y3, 0)
+#define CONFIG_SOFT_SPI_GPIO_CS exynos4_gpio_get(2, y4, 3)
 
 #define SPI_DELAY udelay(1)
 #undef SPI_INIT
diff --git a/include/configs/trats.h b/include/configs/trats.h
index 0877142..9727f7a 100644
--- a/include/configs/trats.h
+++ b/include/configs/trats.h
@@ -282,8 +282,8 @@
 #include <asm/arch/gpio.h>
 
 /* I2C FG */
-#define CONFIG_SOFT_I2C_GPIO_SCL exynos4_gpio_part2_get_nr(y4, 1)
-#define CONFIG_SOFT_I2C_GPIO_SDA exynos4_gpio_part2_get_nr(y4, 0)
+#define CONFIG_SOFT_I2C_GPIO_SCL exynos4_gpio_get(2, y4, 1)
+#define CONFIG_SOFT_I2C_GPIO_SDA exynos4_gpio_get(2, y4, 0)
 
 #define CONFIG_POWER
 #define CONFIG_POWER_I2C
-- 
1.7.9.5

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

* [U-Boot] [PATCH v4 02/12] trats2: Code cleanup.
  2014-01-09 11:23 ` [U-Boot] [PATCH v4 00/12] Introduce Samsung misc file and LCD menu Przemyslaw Marczak
  2014-01-09 11:23   ` [U-Boot] [PATCH v4 01/12] s5p: gpio: change gpio coding method for s5p gpio Przemyslaw Marczak
@ 2014-01-09 11:23   ` Przemyslaw Marczak
  2014-01-09 12:59     ` Jaehoon Chung
  2014-01-09 11:23   ` [U-Boot] [PATCH v4 03/12] samsung: common: Add misc file and common function misc_init_r() Przemyslaw Marczak
                     ` (10 subsequent siblings)
  12 siblings, 1 reply; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-09 11:23 UTC (permalink / raw)
  To: u-boot

Remove wrong and unused env variables
Trats2 is not as GT-I8800.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Cc: Piotr Wilczek <p.wilczek@samsung.com>

---
Changes v2:
- none

Changes v3:
- none

Changes v4:
- add "include pmic.h" to "max77686_pmic.h"

 board/samsung/trats2/trats2.c      |   19 ++-----------------
 drivers/power/battery/bat_trats2.c |    2 +-
 include/configs/trats2.h           |    1 -
 include/power/max77686_pmic.h      |    2 ++
 4 files changed, 5 insertions(+), 19 deletions(-)

diff --git a/board/samsung/trats2/trats2.c b/board/samsung/trats2/trats2.c
index 1e96fdc..b4ccf51 100644
--- a/board/samsung/trats2/trats2.c
+++ b/board/samsung/trats2/trats2.c
@@ -72,15 +72,12 @@ static void check_hw_revision(void)
 int checkboard(void)
 {
 	puts("Board:\tTRATS2\n");
+	printf("HW Revision:\t0x%04x\n", board_rev);
+
 	return 0;
 }
 #endif
 
-static void show_hw_revision(void)
-{
-	printf("HW Revision:\t0x%04x\n", board_rev);
-}
-
 u32 get_board_rev(void)
 {
 	return board_rev;
@@ -614,15 +611,3 @@ void init_panel_info(vidinfo_t *vid)
 	exynos_set_dsim_platform_data(&dsim_platform_data);
 }
 #endif /* LCD */
-
-#ifdef CONFIG_MISC_INIT_R
-int misc_init_r(void)
-{
-	setenv("model", "GT-I8800");
-	setenv("board", "TRATS2");
-
-	show_hw_revision();
-
-	return 0;
-}
-#endif
diff --git a/drivers/power/battery/bat_trats2.c b/drivers/power/battery/bat_trats2.c
index f264832..94015aa 100644
--- a/drivers/power/battery/bat_trats2.c
+++ b/drivers/power/battery/bat_trats2.c
@@ -8,7 +8,7 @@
 #include <common.h>
 #include <power/pmic.h>
 #include <power/battery.h>
-#include <power/max8997_pmic.h>
+#include <power/max77693_pmic.h>
 #include <errno.h>
 
 static struct battery battery_trats;
diff --git a/include/configs/trats2.h b/include/configs/trats2.h
index c9ce828..7dfbe98 100644
--- a/include/configs/trats2.h
+++ b/include/configs/trats2.h
@@ -272,7 +272,6 @@
 #define CONFIG_EFI_PARTITION
 #define CONFIG_PARTITION_UUIDS
 
-#define CONFIG_MISC_INIT_R
 #define CONFIG_BOARD_EARLY_INIT_F
 
 /* I2C */
diff --git a/include/power/max77686_pmic.h b/include/power/max77686_pmic.h
index 16e9016..c2a772a 100644
--- a/include/power/max77686_pmic.h
+++ b/include/power/max77686_pmic.h
@@ -8,6 +8,8 @@
 #ifndef __MAX77686_H_
 #define __MAX77686_H_
 
+#include <power/pmic.h>
+
 enum {
 	MAX77686_REG_PMIC_ID		= 0x0,
 	MAX77686_REG_PMIC_INTSRC,
-- 
1.7.9.5

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

* [U-Boot] [PATCH v4 03/12] samsung: common: Add misc file and common function misc_init_r().
  2014-01-09 11:23 ` [U-Boot] [PATCH v4 00/12] Introduce Samsung misc file and LCD menu Przemyslaw Marczak
  2014-01-09 11:23   ` [U-Boot] [PATCH v4 01/12] s5p: gpio: change gpio coding method for s5p gpio Przemyslaw Marczak
  2014-01-09 11:23   ` [U-Boot] [PATCH v4 02/12] trats2: Code cleanup Przemyslaw Marczak
@ 2014-01-09 11:23   ` Przemyslaw Marczak
  2014-01-09 13:00     ` Jaehoon Chung
  2014-01-09 11:23   ` [U-Boot] [PATCH v4 04/12] samsung: misc: move display logo function to misc.c file Przemyslaw Marczak
                     ` (9 subsequent siblings)
  12 siblings, 1 reply; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-09 11:23 UTC (permalink / raw)
  To: u-boot

Config: CONFIG_MISC_INIT_R enables implementation of misc_init_r()
in common file::
- board/samsung/common/misc.c

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>

---
Changes v2:
- change CONFIG_SAMSUNG to CONFIG_MISC_INIT_R

Changes v3:
- fix merge conflict in board/samsung/common/Makefile

Changes v4:
- none

 board/samsung/common/Makefile |    1 +
 board/samsung/common/misc.c   |   14 ++++++++++++++
 2 files changed, 15 insertions(+)
 create mode 100644 board/samsung/common/misc.c

diff --git a/board/samsung/common/Makefile b/board/samsung/common/Makefile
index 22bd6b1..79547a3 100644
--- a/board/samsung/common/Makefile
+++ b/board/samsung/common/Makefile
@@ -8,6 +8,7 @@
 obj-$(CONFIG_SOFT_I2C_MULTI_BUS) += multi_i2c.o
 obj-$(CONFIG_THOR_FUNCTION) += thor.o
 obj-$(CONFIG_CMD_USB_MASS_STORAGE) += ums.o
+obj-$(CONFIG_MISC_INIT_R) += misc.o
 
 ifndef CONFIG_SPL_BUILD
 obj-$(CONFIG_BOARD_COMMON)	+= board.o
diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
new file mode 100644
index 0000000..3764d12
--- /dev/null
+++ b/board/samsung/common/misc.c
@@ -0,0 +1,14 @@
+/*
+ * Copyright (C) 2013 Samsung Electronics
+ * Przemyslaw Marczak <p.marczak@samsung.com>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+
+/* Common for Samsung boards */
+int misc_init_r(void)
+{
+	return 0;
+}
-- 
1.7.9.5

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

* [U-Boot] [PATCH v4 04/12] samsung: misc: move display logo function to misc.c file.
  2014-01-09 11:23 ` [U-Boot] [PATCH v4 00/12] Introduce Samsung misc file and LCD menu Przemyslaw Marczak
                     ` (2 preceding siblings ...)
  2014-01-09 11:23   ` [U-Boot] [PATCH v4 03/12] samsung: common: Add misc file and common function misc_init_r() Przemyslaw Marczak
@ 2014-01-09 11:23   ` Przemyslaw Marczak
  2014-01-09 11:23   ` [U-Boot] [PATCH v4 05/12] common: lcd.c: fix data abort exception when try to access bmp header Przemyslaw Marczak
                     ` (8 subsequent siblings)
  12 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-09 11:23 UTC (permalink / raw)
  To: u-boot

board/samsung/common/misc.c:
- move draw_logo() function from exynos_fb.c
- add get_tizen_logo_info() function call removed from board files

boards:
- update board files
- add CONFIG_MISC_INIT_R to Universal, Trats and Trats2

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Tested-by: Hyungwon Hwang <human.hwang@samsung.com>

---
changes v2:
- configs cleanup
- add check logo address before display

Changes v3:
- none

Changes v4:
- none

 board/samsung/common/misc.c              |   42 ++++++++++++++++++++++++++++++
 board/samsung/trats/trats.c              |    3 ---
 board/samsung/trats2/trats2.c            |    4 ---
 board/samsung/universal_c210/universal.c |    4 ---
 drivers/video/exynos_fb.c                |   28 --------------------
 include/configs/s5pc210_universal.h      |    3 +++
 include/configs/trats.h                  |    3 +++
 include/configs/trats2.h                 |    3 +++
 8 files changed, 51 insertions(+), 39 deletions(-)

diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
index 3764d12..6188e29 100644
--- a/board/samsung/common/misc.c
+++ b/board/samsung/common/misc.c
@@ -6,9 +6,51 @@
  */
 
 #include <common.h>
+#include <lcd.h>
+#include <libtizen.h>
+
+#ifdef CONFIG_CMD_BMP
+static void draw_logo(void)
+{
+	int x, y;
+	ulong addr;
+
+#ifdef CONFIG_TIZEN
+	get_tizen_logo_info(&panel_info);
+#else
+	return;
+#endif
+
+	addr = panel_info.logo_addr;
+	if (!addr) {
+		error("There is no logo data.");
+		return;
+	}
+
+	if (panel_info.vl_width >= panel_info.logo_width) {
+		x = ((panel_info.vl_width - panel_info.logo_width) >> 1);
+	} else {
+		x = 0;
+		printf("Warning: image width is bigger than display width\n");
+	}
+
+	if (panel_info.vl_height >= panel_info.logo_height) {
+		y = ((panel_info.vl_height - panel_info.logo_height) >> 1);
+	} else {
+		y = 0;
+		printf("Warning: image height is bigger than display height\n");
+	}
+
+	bmp_display(addr, x, y);
+}
+#endif /* CONFIG_CMD_BMP */
 
 /* Common for Samsung boards */
 int misc_init_r(void)
 {
+#ifdef CONFIG_CMD_BMP
+	if (panel_info.logo_on)
+		draw_logo();
+#endif
 	return 0;
 }
diff --git a/board/samsung/trats/trats.c b/board/samsung/trats/trats.c
index 640a193..cd27f18 100644
--- a/board/samsung/trats/trats.c
+++ b/board/samsung/trats/trats.c
@@ -770,9 +770,6 @@ void init_panel_info(vidinfo_t *vid)
 	vid->resolution	= HD_RESOLUTION,
 	vid->rgb_mode	= MODE_RGB_P,
 
-#ifdef CONFIG_TIZEN
-	get_tizen_logo_info(vid);
-#endif
 	mipi_lcd_device.reverse_panel = 1;
 
 	strcpy(s6e8ax0_platform_data.lcd_panel_name, mipi_lcd_device.name);
diff --git a/board/samsung/trats2/trats2.c b/board/samsung/trats2/trats2.c
index b4ccf51..9a2c212 100644
--- a/board/samsung/trats2/trats2.c
+++ b/board/samsung/trats2/trats2.c
@@ -596,10 +596,6 @@ void init_panel_info(vidinfo_t *vid)
 
 	mipi_lcd_device.reverse_panel = 1;
 
-#ifdef CONFIG_TIZEN
-	get_tizen_logo_info(vid);
-#endif
-
 	strcpy(dsim_platform_data.lcd_panel_name, mipi_lcd_device.name);
 	dsim_platform_data.mipi_power = mipi_power;
 	dsim_platform_data.phy_enable = set_mipi_phy_ctrl;
diff --git a/board/samsung/universal_c210/universal.c b/board/samsung/universal_c210/universal.c
index 54d0e1e..166d5ee 100644
--- a/board/samsung/universal_c210/universal.c
+++ b/board/samsung/universal_c210/universal.c
@@ -484,10 +484,6 @@ void init_panel_info(vidinfo_t *vid)
 	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;
diff --git a/drivers/video/exynos_fb.c b/drivers/video/exynos_fb.c
index 7d4c6e0..00a0a11 100644
--- a/drivers/video/exynos_fb.c
+++ b/drivers/video/exynos_fb.c
@@ -62,31 +62,6 @@ static void exynos_lcd_init(vidinfo_t *vid)
 	lcd_set_flush_dcache(1);
 }
 
-#ifdef CONFIG_CMD_BMP
-static void draw_logo(void)
-{
-	int x, y;
-	ulong addr;
-
-	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);
-}
-#endif
-
 void __exynos_cfg_lcd_gpio(void)
 {
 }
@@ -323,9 +298,6 @@ void lcd_enable(void)
 	if (panel_info.logo_on) {
 		memset((void *) gd->fb_base, 0, panel_width * panel_height *
 				(NBITS(panel_info.vl_bpix) >> 3));
-#ifdef CONFIG_CMD_BMP
-		draw_logo();
-#endif
 	}
 
 	lcd_panel_on(&panel_info);
diff --git a/include/configs/s5pc210_universal.h b/include/configs/s5pc210_universal.h
index 02a1c99..8a749f2 100644
--- a/include/configs/s5pc210_universal.h
+++ b/include/configs/s5pc210_universal.h
@@ -269,6 +269,9 @@ void universal_spi_sda(int bit);
 int universal_spi_read(void);
 #endif
 
+/* Common misc for Samsung */
+#define CONFIG_MISC_INIT_R
+
 /*
  * LCD Settings
  */
diff --git a/include/configs/trats.h b/include/configs/trats.h
index 9727f7a..1a75bb3 100644
--- a/include/configs/trats.h
+++ b/include/configs/trats.h
@@ -301,6 +301,9 @@
 #define CONFIG_USB_GADGET_VBUS_DRAW	2
 #define CONFIG_USB_CABLE_CHECK
 
+/* Common misc for Samsung */
+#define CONFIG_MISC_INIT_R
+
 /* LCD */
 #define CONFIG_EXYNOS_FB
 #define CONFIG_LCD
diff --git a/include/configs/trats2.h b/include/configs/trats2.h
index 7dfbe98..e54fe52 100644
--- a/include/configs/trats2.h
+++ b/include/configs/trats2.h
@@ -312,6 +312,9 @@ int get_soft_i2c_sda_pin(void);
 #define CONFIG_USB_GADGET_VBUS_DRAW	2
 #define CONFIG_USB_CABLE_CHECK
 
+/* Common misc for Samsung */
+#define CONFIG_MISC_INIT_R
+
 /* LCD */
 #define CONFIG_EXYNOS_FB
 #define CONFIG_LCD
-- 
1.7.9.5

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

* [U-Boot] [PATCH v4 05/12] common: lcd.c: fix data abort exception when try to access bmp header
  2014-01-09 11:23 ` [U-Boot] [PATCH v4 00/12] Introduce Samsung misc file and LCD menu Przemyslaw Marczak
                     ` (3 preceding siblings ...)
  2014-01-09 11:23   ` [U-Boot] [PATCH v4 04/12] samsung: misc: move display logo function to misc.c file Przemyslaw Marczak
@ 2014-01-09 11:23   ` Przemyslaw Marczak
  2014-01-09 11:23   ` [U-Boot] [PATCH v4 06/12] lib: tizen: change Tizen logo with the new one Przemyslaw Marczak
                     ` (7 subsequent siblings)
  12 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-09 11:23 UTC (permalink / raw)
  To: u-boot

Changes:
- le16_to_cpu() to get_unaligned_le16()
- le32_to_cpu() to get_unaligned_le32()
when access fields in struct bmp header.

This changes avoids data abort exception caused by unaligned data access.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Anatolij Gustschin <agust@denx.de>

---
Changes v2:
- new patch

Changes v3:
- common/Makefile - remove CFLAG: -mno-unaligned-access
- common/lcd.c - fix data abort exception when access bmp_header

Changes v4:
- add Acked-by

 common/lcd.c |   27 +++++++++++++--------------
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/common/lcd.c b/common/lcd.c
index 56bf067..aa81522 100644
--- a/common/lcd.c
+++ b/common/lcd.c
@@ -26,7 +26,7 @@
 #endif
 #include <lcd.h>
 #include <watchdog.h>
-
+#include <asm/unaligned.h>
 #include <splash.h>
 
 #if defined(CONFIG_CPU_PXA25X) || defined(CONFIG_CPU_PXA27X) || \
@@ -777,9 +777,9 @@ static void lcd_display_rle8_bitmap(bmp_image_t *bmp, ushort *cmap, uchar *fb,
 	int x, y;
 	int decode = 1;
 
-	width = le32_to_cpu(bmp->header.width);
-	height = le32_to_cpu(bmp->header.height);
-	bmap = (uchar *)bmp + le32_to_cpu(bmp->header.data_offset);
+	width = get_unaligned_le32(&bmp->header.width);
+	height = get_unaligned_le32(&bmp->header.height);
+	bmap = (uchar *)bmp + get_unaligned_le32(&bmp->header.data_offset);
 
 	x = 0;
 	y = height - 1;
@@ -900,9 +900,10 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
 		return 1;
 	}
 
-	width = le32_to_cpu(bmp->header.width);
-	height = le32_to_cpu(bmp->header.height);
-	bmp_bpix = le16_to_cpu(bmp->header.bit_count);
+	width = get_unaligned_le32(&bmp->header.width);
+	height = get_unaligned_le32(&bmp->header.height);
+	bmp_bpix = get_unaligned_le16(&bmp->header.bit_count);
+
 	colors = 1 << bmp_bpix;
 
 	bpix = NBITS(panel_info.vl_bpix);
@@ -917,9 +918,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
 	/* We support displaying 8bpp BMPs on 16bpp LCDs */
 	if (bpix != bmp_bpix && !(bmp_bpix == 8 && bpix == 16)) {
 		printf ("Error: %d bit/pixel mode, but BMP has %d bit/pixel\n",
-			bpix,
-			le16_to_cpu(bmp->header.bit_count));
-
+			bpix, get_unaligned_le16(&bmp->header.bit_count));
 		return 1;
 	}
 
@@ -956,7 +955,6 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
 		}
 	}
 #endif
-
 	/*
 	 *  BMP format for Monochrome assumes that the state of a
 	 * pixel is described on a per Bit basis, not per Byte.
@@ -987,15 +985,16 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
 	if ((y + height) > panel_info.vl_row)
 		height = panel_info.vl_row - y;
 
-	bmap = (uchar *) bmp + le32_to_cpu(bmp->header.data_offset);
-	fb   = (uchar *) (lcd_base +
+	bmap = (uchar *)bmp + get_unaligned_le32(&bmp->header.data_offset);
+	fb   = (uchar *)(lcd_base +
 		(y + height - 1) * lcd_line_length + x * bpix / 8);
 
 	switch (bmp_bpix) {
 	case 1: /* pass through */
 	case 8:
 #ifdef CONFIG_LCD_BMP_RLE8
-		if (le32_to_cpu(bmp->header.compression) == BMP_BI_RLE8) {
+		u32 compression = get_unaligned_le32(&bmp->header.compression);
+		if (compression == BMP_BI_RLE8) {
 			if (bpix != 16) {
 				/* TODO implement render code for bpix != 16 */
 				printf("Error: only support 16 bpix");
-- 
1.7.9.5

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

* [U-Boot] [PATCH v4 06/12] lib: tizen: change Tizen logo with the new one.
  2014-01-09 11:23 ` [U-Boot] [PATCH v4 00/12] Introduce Samsung misc file and LCD menu Przemyslaw Marczak
                     ` (4 preceding siblings ...)
  2014-01-09 11:23   ` [U-Boot] [PATCH v4 05/12] common: lcd.c: fix data abort exception when try to access bmp header Przemyslaw Marczak
@ 2014-01-09 11:23   ` Przemyslaw Marczak
  2014-01-10  7:09     ` Hyungwon Hwang
  2014-01-10  9:26     ` Hyungwon Hwang
  2014-01-09 11:23   ` [U-Boot] [PATCH v4 07/12] video: exynos: fimd: add support for various display color modes Przemyslaw Marczak
                     ` (6 subsequent siblings)
  12 siblings, 2 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-09 11:23 UTC (permalink / raw)
  To: u-boot

This is big size patch. Please follow the link:

http://www.denx.de/wiki/pub/U-Boot/TooBigPatches/0006-lib-tizen-change-Tizen-logo-with-the-new-one.patch

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

* [U-Boot] [PATCH v4 07/12] video: exynos: fimd: add support for various display color modes
  2014-01-09 11:23 ` [U-Boot] [PATCH v4 00/12] Introduce Samsung misc file and LCD menu Przemyslaw Marczak
                     ` (5 preceding siblings ...)
  2014-01-09 11:23   ` [U-Boot] [PATCH v4 06/12] lib: tizen: change Tizen logo with the new one Przemyslaw Marczak
@ 2014-01-09 11:23   ` Przemyslaw Marczak
  2014-01-09 11:23   ` [U-Boot] [PATCH v4 08/12] samsung: boards: update display configs with 16bpp mode Przemyslaw Marczak
                     ` (5 subsequent siblings)
  12 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-09 11:23 UTC (permalink / raw)
  To: u-boot

Now fimd BPP color mode depends on vl_bpp value in struct "panel_info".

There is only 16BPP mode check, default mode is 24BPP.
Other fimd modes are usually unneeded and also needs some fimd driver
modifications and tests.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>

---
Changes v2:
- check panel_info vl_bpix when setting fimd color mode
- move boards configs update to another commit.

Changes v3:
- none

Changes v4:
- none

 drivers/video/exynos_fimd.c |   15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/video/exynos_fimd.c b/drivers/video/exynos_fimd.c
index f962c4f..cebbba7 100644
--- a/drivers/video/exynos_fimd.c
+++ b/drivers/video/exynos_fimd.c
@@ -73,18 +73,19 @@ static void exynos_fimd_set_par(unsigned int win_id)
 	/* DATAPATH is DMA */
 	cfg |= EXYNOS_WINCON_DATAPATH_DMA;
 
-	if (pvid->logo_on) /* To get proprietary LOGO */
-		cfg |= EXYNOS_WINCON_WSWP_ENABLE;
-	else /* To get output console on LCD */
-		cfg |= EXYNOS_WINCON_HAWSWP_ENABLE;
+	cfg |= EXYNOS_WINCON_HAWSWP_ENABLE;
 
 	/* dma burst is 16 */
 	cfg |= EXYNOS_WINCON_BURSTLEN_16WORD;
 
-	if (pvid->logo_on) /* To get proprietary LOGO */
-		cfg |= EXYNOS_WINCON_BPPMODE_24BPP_888;
-	else /* To get output console on LCD */
+	switch (pvid->vl_bpix) {
+	case 4:
 		cfg |= EXYNOS_WINCON_BPPMODE_16BPP_565;
+		break;
+	default:
+		cfg |= EXYNOS_WINCON_BPPMODE_24BPP_888;
+		break;
+	}
 
 	writel(cfg, (unsigned int)&fimd_ctrl->wincon0 +
 			EXYNOS_WINCON(win_id));
-- 
1.7.9.5

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

* [U-Boot] [PATCH v4 08/12] samsung: boards: update display configs with 16bpp mode.
  2014-01-09 11:23 ` [U-Boot] [PATCH v4 00/12] Introduce Samsung misc file and LCD menu Przemyslaw Marczak
                     ` (6 preceding siblings ...)
  2014-01-09 11:23   ` [U-Boot] [PATCH v4 07/12] video: exynos: fimd: add support for various display color modes Przemyslaw Marczak
@ 2014-01-09 11:23   ` Przemyslaw Marczak
  2014-01-09 11:23   ` [U-Boot] [PATCH v4 09/12] samsung: misc: Add LCD download menu Przemyslaw Marczak
                     ` (4 subsequent siblings)
  12 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-09 11:23 UTC (permalink / raw)
  To: u-boot

16 bpp mode is required by LCD console mode.
This change updates exynos board files.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>

---
Changes v2:
-- new patch

Changes v3:
- none

Changes v4:
- none

 board/samsung/trats/trats.c              |    2 +-
 board/samsung/trats2/trats2.c            |    2 +-
 board/samsung/universal_c210/universal.c |    2 +-
 include/configs/s5pc210_universal.h      |    2 +-
 include/configs/trats.h                  |    2 +-
 include/configs/trats2.h                 |    2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/board/samsung/trats/trats.c b/board/samsung/trats/trats.c
index cd27f18..a849b73 100644
--- a/board/samsung/trats/trats.c
+++ b/board/samsung/trats/trats.c
@@ -742,7 +742,7 @@ vidinfo_t panel_info = {
 	.vl_hsp		= CONFIG_SYS_LOW,
 	.vl_vsp		= CONFIG_SYS_LOW,
 	.vl_dp		= CONFIG_SYS_LOW,
-	.vl_bpix	= 5,	/* Bits per pixel, 2^5 = 32 */
+	.vl_bpix	= 4,	/* Bits per pixel, 2^4 = 16 */
 
 	/* s6e8ax0 Panel infomation */
 	.vl_hspw	= 5,
diff --git a/board/samsung/trats2/trats2.c b/board/samsung/trats2/trats2.c
index 9a2c212..bae8d6c 100644
--- a/board/samsung/trats2/trats2.c
+++ b/board/samsung/trats2/trats2.c
@@ -565,7 +565,7 @@ vidinfo_t panel_info = {
 	.vl_hsp		= CONFIG_SYS_LOW,
 	.vl_vsp		= CONFIG_SYS_LOW,
 	.vl_dp		= CONFIG_SYS_LOW,
-	.vl_bpix	= 5,	/* Bits per pixel, 2^5 = 32 */
+	.vl_bpix	= 4,	/* Bits per pixel, 2^4 = 16 */
 
 	/* s6e8ax0 Panel infomation */
 	.vl_hspw	= 5,
diff --git a/board/samsung/universal_c210/universal.c b/board/samsung/universal_c210/universal.c
index 166d5ee..1ebea0f 100644
--- a/board/samsung/universal_c210/universal.c
+++ b/board/samsung/universal_c210/universal.c
@@ -446,7 +446,7 @@ vidinfo_t panel_info = {
 	.vl_vsp		= CONFIG_SYS_HIGH,
 	.vl_dp		= CONFIG_SYS_HIGH,
 
-	.vl_bpix	= 5,	/* Bits per pixel */
+	.vl_bpix	= 4,	/* Bits per pixel */
 
 	/* LD9040 LCD Panel */
 	.vl_hspw	= 2,
diff --git a/include/configs/s5pc210_universal.h b/include/configs/s5pc210_universal.h
index 3c0a974..4079b7c 100644
--- a/include/configs/s5pc210_universal.h
+++ b/include/configs/s5pc210_universal.h
@@ -278,7 +278,7 @@ int universal_spi_read(void);
 #define CONFIG_EXYNOS_FB
 #define CONFIG_LCD
 #define CONFIG_CMD_BMP
-#define CONFIG_BMP_32BPP
+#define CONFIG_BMP_16BPP
 #define CONFIG_LD9040
 #define CONFIG_EXYNOS_MIPI_DSIM
 #define CONFIG_VIDEO_BMP_GZIP
diff --git a/include/configs/trats.h b/include/configs/trats.h
index 9a7dea1..79f9168 100644
--- a/include/configs/trats.h
+++ b/include/configs/trats.h
@@ -308,7 +308,7 @@
 #define CONFIG_EXYNOS_FB
 #define CONFIG_LCD
 #define CONFIG_CMD_BMP
-#define CONFIG_BMP_32BPP
+#define CONFIG_BMP_16BPP
 #define CONFIG_FB_ADDR		0x52504000
 #define CONFIG_S6E8AX0
 #define CONFIG_EXYNOS_MIPI_DSIM
diff --git a/include/configs/trats2.h b/include/configs/trats2.h
index 8c7c6bd..740ceb1 100644
--- a/include/configs/trats2.h
+++ b/include/configs/trats2.h
@@ -319,7 +319,7 @@ int get_soft_i2c_sda_pin(void);
 #define CONFIG_EXYNOS_FB
 #define CONFIG_LCD
 #define CONFIG_CMD_BMP
-#define CONFIG_BMP_32BPP
+#define CONFIG_BMP_16BPP
 #define CONFIG_FB_ADDR		0x52504000
 #define CONFIG_S6E8AX0
 #define CONFIG_EXYNOS_MIPI_DSIM
-- 
1.7.9.5

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

* [U-Boot] [PATCH v4 09/12] samsung: misc: Add LCD download menu.
  2014-01-09 11:23 ` [U-Boot] [PATCH v4 00/12] Introduce Samsung misc file and LCD menu Przemyslaw Marczak
                     ` (7 preceding siblings ...)
  2014-01-09 11:23   ` [U-Boot] [PATCH v4 08/12] samsung: boards: update display configs with 16bpp mode Przemyslaw Marczak
@ 2014-01-09 11:23   ` Przemyslaw Marczak
  2014-01-10  1:37     ` Minkyu Kang
  2014-01-09 11:23   ` [U-Boot] [PATCH v4 10/12] Trats: add LCD download menu support Przemyslaw Marczak
                     ` (3 subsequent siblings)
  12 siblings, 1 reply; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-09 11:23 UTC (permalink / raw)
  To: u-boot

This simple LCD menu allows run one of download mode on device
without writing on console or for fast and easy upgrade.
This feature check user keys combination at boot:
- power key + volume up - download menu
- power key + volume down - thor mode (without menu)

New configs:
- CONFIG_LCD_MENU
- CONFIG_LCD_MENU_BOARD
which depends on: CONFIG_MISC_INIT_R

For proper effect this feature needs following definitions:

Power key:
- KEY_PWR_PMIC_NAME - (string) pmic which supports power key check

Register address:
- KEY_PWR_STATUS_REG
- KEY_PWR_INTERRUPT_REG

Register power key mask:
- KEY_PWR_STATUS_MASK
- KEY_PWR_INTERRUPT_MASK

Gpio numbers:
- KEY_PWR_INTERRUPT_MASK
- KEY_VOL_DOWN_GPIO

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>

---
Changes v2:
- remove keys.h  - definitions should be in boards headers
- add misc.h
- code cleanup
- extend commit msg by more informations

Changes v3:
- none

Changes v4:
- code cleanup in board/samsung/common/misc.c
- add command result check
- clear PWR button interrupt flag after command finish to prevent immediately
  mode exit in mode_leave_menu() function.
- introduce MODE_CMD_ARGC - max number of command arguments
- split array mode_cmd[] to mode_cmd[][] with separated arguments
- command support checking is now achieved without preprocessor ifdefs

 board/samsung/common/misc.c |  349 +++++++++++++++++++++++++++++++++++++++++++
 board/samsung/common/misc.h |   18 +++
 2 files changed, 367 insertions(+)
 create mode 100644 board/samsung/common/misc.h

diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
index 3a91d62..f29fca4 100644
--- a/board/samsung/common/misc.c
+++ b/board/samsung/common/misc.c
@@ -8,6 +8,350 @@
 #include <common.h>
 #include <lcd.h>
 #include <libtizen.h>
+#include <errno.h>
+#include <version.h>
+#include <asm/sizes.h>
+#include <asm/arch/cpu.h>
+#include <asm/arch/gpio.h>
+#include <asm/gpio.h>
+#include <linux/input.h>
+#include <lcd.h>
+#include <libtizen.h>
+#include <power/pmic.h>
+#include <mmc.h>
+#include "misc.h"
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#ifdef CONFIG_LCD_MENU
+static int power_key_pressed(u32 reg)
+{
+	struct pmic *pmic;
+	u32 status;
+	u32 mask;
+
+	pmic = pmic_get(KEY_PWR_PMIC_NAME);
+	if (!pmic) {
+		printf("%s: Not found\n", KEY_PWR_PMIC_NAME);
+		return 0;
+	}
+
+	if (pmic_probe(pmic))
+		return 0;
+
+	if (reg == KEY_PWR_STATUS_REG)
+		mask = KEY_PWR_STATUS_MASK;
+	else
+		mask = KEY_PWR_INTERRUPT_MASK;
+
+	if (pmic_reg_read(pmic, reg, &status))
+		return 0;
+
+	return !!(status & mask);
+}
+
+static int key_pressed(int key)
+{
+	int value;
+
+	switch (key) {
+	case KEY_POWER:
+		value = power_key_pressed(KEY_PWR_INTERRUPT_REG);
+		break;
+	case KEY_VOLUMEUP:
+		value = !gpio_get_value(KEY_VOL_UP_GPIO);
+		break;
+	case KEY_VOLUMEDOWN:
+		value = !gpio_get_value(KEY_VOL_DOWN_GPIO);
+		break;
+	default:
+		value = 0;
+		break;
+	}
+
+	return value;
+}
+
+static int check_keys(void)
+{
+	int keys = 0;
+
+	if (key_pressed(KEY_POWER))
+		keys += KEY_POWER;
+	if (key_pressed(KEY_VOLUMEUP))
+		keys += KEY_VOLUMEUP;
+	if (key_pressed(KEY_VOLUMEDOWN))
+		keys += KEY_VOLUMEDOWN;
+
+	return keys;
+}
+
+/*
+ * 0 BOOT_MODE_INFO
+ * 1 BOOT_MODE_THOR
+ * 2 BOOT_MODE_UMS
+ * 3 BOOT_MODE_DFU
+ * 4 BOOT_MODE_EXIT
+ */
+static char *
+mode_name[BOOT_MODE_EXIT + 1] = {
+	"DEVICE",
+	"THOR",
+	"UMS",
+	"DFU",
+	"EXIT"
+};
+
+static char *
+mode_info[BOOT_MODE_EXIT + 1] = {
+	"info",
+	"downloader",
+	"mass storage",
+	"firmware update",
+	"and run normal boot"
+};
+
+#define MODE_CMD_ARGC	4
+
+static char *
+mode_cmd[BOOT_MODE_EXIT + 1][MODE_CMD_ARGC] = {
+	{"", "", "", ""},
+	{"thor", "0", "mmc", "0"},
+	{"ums", "0", "mmc", "0"},
+	{"dfu", "0", "mmc", "0"},
+	{"", "", "", ""},
+};
+
+static void display_board_info(void)
+{
+	struct mmc *mmc = find_mmc_device(0);
+	vidinfo_t *vid = &panel_info;
+
+	lcd_position_cursor(4, 4);
+
+	lcd_printf("%s\n\t", U_BOOT_VERSION);
+	lcd_puts("\n\t\tBoard Info:\n");
+#ifdef CONFIG_SYS_BOARD
+	lcd_printf("\tBoard name: %s\n", CONFIG_SYS_BOARD);
+#endif
+#ifdef CONFIG_REVISION_TAG
+	lcd_printf("\tBoard rev: %u\n", get_board_rev());
+#endif
+	lcd_printf("\tDRAM banks: %u\n", CONFIG_NR_DRAM_BANKS);
+	lcd_printf("\tDRAM size: %u MB\n", gd->ram_size / SZ_1M);
+
+	if (mmc) {
+		if (!mmc->capacity)
+			mmc_init(mmc);
+
+		lcd_printf("\teMMC size: %llu MB\n", mmc->capacity / SZ_1M);
+	}
+
+	if (vid)
+		lcd_printf("\tDisplay resolution: %u x % u\n",
+			   vid->vl_col, vid->vl_row);
+
+	lcd_printf("\tDisplay BPP: %u\n", 1 << vid->vl_bpix);
+}
+
+static int mode_leave_menu(int mode)
+{
+	char *exit_option;
+	char *exit_boot = "boot";
+	char *exit_back = "back";
+	cmd_tbl_t *cmd;
+	int cmd_result;
+	int cmd_repeatable;
+	int leave;
+
+	lcd_clear();
+
+	switch (mode) {
+	case BOOT_MODE_EXIT:
+		return 1;
+	case BOOT_MODE_INFO:
+		display_board_info();
+		exit_option = exit_back;
+		leave = 0;
+		break;
+	default:
+		cmd = find_cmd(mode_cmd[mode][0]);
+		if (cmd) {
+			printf("Enter: %s %s\n", mode_name[mode],
+						 mode_info[mode]);
+			lcd_printf("\n\n\t%s %s\n", mode_name[mode],
+						    mode_info[mode]);
+			lcd_puts("\n\tDo not turn off device before finish!\n");
+
+			cmd_result = cmd_process(0, MODE_CMD_ARGC,
+						 *(mode_cmd + mode),
+						 &cmd_repeatable, NULL);
+
+			if (cmd_result == CMD_RET_SUCCESS) {
+				printf("Command finished\n");
+				lcd_clear();
+				lcd_printf("\n\n\t%s finished\n",
+					   mode_name[mode]);
+
+				exit_option = exit_boot;
+				leave = 1;
+			} else {
+				printf("Command error\n");
+				lcd_clear();
+				lcd_printf("\n\n\t%s command error\n",
+					   mode_name[mode]);
+
+				exit_option = exit_back;
+				leave = 0;
+			}
+		} else {
+			lcd_puts("\n\n\tThis mode is not supported.\n");
+			exit_option = exit_back;
+			leave = 0;
+		}
+	}
+
+	lcd_printf("\n\n\tPress POWER KEY to %s\n", exit_option);
+
+	/* Clear PWR button Rising edge interrupt status flag */
+	power_key_pressed(KEY_PWR_INTERRUPT_REG);
+
+	/* Wait for PWR key */
+	while (!key_pressed(KEY_POWER))
+		udelay(1000);
+
+	lcd_clear();
+	return leave;
+}
+
+static void display_download_menu(int mode)
+{
+	char *selection[BOOT_MODE_EXIT + 1];
+	int i;
+
+	for (i = 0; i <= BOOT_MODE_EXIT; i++)
+		selection[i] = "[  ]";
+
+	selection[mode] = "[=>]";
+
+	lcd_clear();
+	lcd_printf("\n\t\tDownload Mode Menu\n");
+
+	for (i = 0; i <= BOOT_MODE_EXIT; i++)
+		lcd_printf("\t%s  %s - %s\n\n", selection[i],
+						mode_name[i],
+						mode_info[i]);
+}
+
+static void download_menu(void)
+{
+	int mode = 0;
+	int last_mode = 0;
+	int run;
+	int key;
+
+	display_download_menu(mode);
+
+	while (1) {
+		run = 0;
+
+		if (mode != last_mode)
+			display_download_menu(mode);
+
+		last_mode = mode;
+		udelay(100000);
+
+		key = check_keys();
+		switch (key) {
+		case KEY_POWER:
+			run = 1;
+			break;
+		case KEY_VOLUMEUP:
+			if (mode > 0)
+				mode--;
+			break;
+		case KEY_VOLUMEDOWN:
+			if (mode < BOOT_MODE_EXIT)
+				mode++;
+			break;
+		default:
+			break;
+		}
+
+		if (run) {
+			if (mode_leave_menu(mode))
+				break;
+
+			display_download_menu(mode);
+		}
+	}
+
+	lcd_clear();
+}
+
+static void display_mode_info(void)
+{
+	lcd_position_cursor(4, 4);
+	lcd_printf("%s\n", U_BOOT_VERSION);
+	lcd_puts("\nDownload Mode Menu\n");
+#ifdef CONFIG_SYS_BOARD
+	lcd_printf("Board name: %s\n", CONFIG_SYS_BOARD);
+#endif
+	lcd_printf("Press POWER KEY to display MENU options.");
+}
+
+static int boot_menu(void)
+{
+	int key = 0;
+	int timeout = 10;
+
+	display_mode_info();
+
+	while (timeout--) {
+		lcd_printf("\rNormal boot will start in: %d seconds.", timeout);
+		udelay(1000000);
+
+		key = key_pressed(KEY_POWER);
+		if (key)
+			break;
+	}
+
+	lcd_clear();
+
+	/* If PWR pressed - show download menu */
+	if (key) {
+		printf("Power pressed - go to download menu\n");
+		download_menu();
+		printf("Download mode exit.\n");
+	}
+
+	return 0;
+}
+
+static void check_boot_mode(void)
+{
+	int pwr_key;
+
+	pwr_key = power_key_pressed(KEY_PWR_STATUS_REG);
+	if (!pwr_key)
+		return;
+
+	/* Clear PWR button Rising edge interrupt status flag */
+	power_key_pressed(KEY_PWR_INTERRUPT_REG);
+
+	if (key_pressed(KEY_VOLUMEUP))
+		boot_menu();
+	else if (key_pressed(KEY_VOLUMEDOWN))
+		mode_leave_menu(BOOT_MODE_THOR);
+}
+
+static void keys_init(void)
+{
+	/* Set direction to input */
+	gpio_direction_input(KEY_VOL_UP_GPIO);
+	gpio_direction_input(KEY_VOL_DOWN_GPIO);
+}
+#endif /* CONFIG_LCD_MENU */
 
 #ifdef CONFIG_CMD_BMP
 static void draw_logo(void)
@@ -50,9 +394,14 @@ static void draw_logo(void)
 /* Common for Samsung boards */
 int misc_init_r(void)
 {
+#ifdef CONFIG_LCD_MENU
+	keys_init();
+	check_boot_mode();
+#endif
 #ifdef CONFIG_CMD_BMP
 	if (panel_info.logo_on)
 		draw_logo();
 #endif
+
 	return 0;
 }
diff --git a/board/samsung/common/misc.h b/board/samsung/common/misc.h
new file mode 100644
index 0000000..f583552
--- /dev/null
+++ b/board/samsung/common/misc.h
@@ -0,0 +1,18 @@
+#ifndef __SAMSUNG_COMMON_MISC_H__
+#define __SAMSUNG_COMMON_MISC_H__
+
+#ifdef CONFIG_LCD_MENU
+enum {
+	BOOT_MODE_INFO,
+	BOOT_MODE_THOR,
+	BOOT_MODE_UMS,
+	BOOT_MODE_DFU,
+	BOOT_MODE_EXIT,
+};
+
+#ifdef CONFIG_REVISION_TAG
+u32 get_board_rev(void);
+#endif
+#endif /* CONFIG_LCD_MENU */
+
+#endif /* __SAMSUNG_COMMON_MISC_H__ */
-- 
1.7.9.5

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

* [U-Boot] [PATCH v4 10/12] Trats: add LCD download menu support
  2014-01-09 11:23 ` [U-Boot] [PATCH v4 00/12] Introduce Samsung misc file and LCD menu Przemyslaw Marczak
                     ` (8 preceding siblings ...)
  2014-01-09 11:23   ` [U-Boot] [PATCH v4 09/12] samsung: misc: Add LCD download menu Przemyslaw Marczak
@ 2014-01-09 11:23   ` Przemyslaw Marczak
  2014-01-09 11:23   ` [U-Boot] [PATCH v4 11/12] trats2: " Przemyslaw Marczak
                     ` (2 subsequent siblings)
  12 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-09 11:23 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Lukasz Majewski <l.majewski@samsung.com>

---
changes v2:
- add definitions to check keys
- cleanup config definitions
- add acked-by

Changes v3:
- remove CONFIG_BOARD_NAME from include/configs/trats.h

Changes v4:
- none

 include/configs/trats.h |   22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/include/configs/trats.h b/include/configs/trats.h
index 79f9168..2979df5 100644
--- a/include/configs/trats.h
+++ b/include/configs/trats.h
@@ -304,6 +304,28 @@
 /* Common misc for Samsung */
 #define CONFIG_MISC_INIT_R
 
+/* Download menu - Samsung common */
+#define CONFIG_LCD_MENU
+#define CONFIG_LCD_MENU_BOARD
+
+/* Download menu - definitions for check keys */
+#ifndef __ASSEMBLY__
+#include <power/max8997_pmic.h>
+
+#define KEY_PWR_PMIC_NAME		"MAX8997_PMIC"
+#define KEY_PWR_STATUS_REG		MAX8997_REG_STATUS1
+#define KEY_PWR_STATUS_MASK		(1 << 0)
+#define KEY_PWR_INTERRUPT_REG		MAX8997_REG_INT1
+#define KEY_PWR_INTERRUPT_MASK		(1 << 0)
+
+#define KEY_VOL_UP_GPIO			exynos4_gpio_get(2, x2, 0)
+#define KEY_VOL_DOWN_GPIO		exynos4_gpio_get(2, x2, 1)
+#endif /* __ASSEMBLY__ */
+
+/* LCD console */
+#define LCD_BPP			LCD_COLOR16
+#define CONFIG_SYS_WHITE_ON_BLACK
+
 /* LCD */
 #define CONFIG_EXYNOS_FB
 #define CONFIG_LCD
-- 
1.7.9.5

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

* [U-Boot] [PATCH v4 11/12] trats2: add LCD download menu support
  2014-01-09 11:23 ` [U-Boot] [PATCH v4 00/12] Introduce Samsung misc file and LCD menu Przemyslaw Marczak
                     ` (9 preceding siblings ...)
  2014-01-09 11:23   ` [U-Boot] [PATCH v4 10/12] Trats: add LCD download menu support Przemyslaw Marczak
@ 2014-01-09 11:23   ` Przemyslaw Marczak
  2014-01-09 11:23   ` [U-Boot] [PATCH v4 12/12] universal: " Przemyslaw Marczak
  2014-01-10  6:45   ` [U-Boot] [PATCH v4 00/12] Introduce Samsung misc file and LCD menu Hyungwon Hwang
  12 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-09 11:23 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>

---
changes v2:
- add definitions for check keys
- cleanup config definitions

Changes v3:
- remove CONFIG_BOARD_NAME from include/configs/trats2.h

Changes v4:
- remove include of pmic.h from trats2.h
- remove include of common.h from pmic.h

 include/configs/trats2.h |   23 +++++++++++++++++++++++
 include/power/pmic.h     |    1 -
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/include/configs/trats2.h b/include/configs/trats2.h
index 740ceb1..59a2ad6 100644
--- a/include/configs/trats2.h
+++ b/include/configs/trats2.h
@@ -19,6 +19,7 @@
 #define CONFIG_S5P		/* which is in a S5P Family */
 #define CONFIG_EXYNOS4		/* which is in a EXYNOS4XXX */
 #define CONFIG_TIZEN		/* TIZEN lib */
+#define CONFIG_TRATS2
 
 #include <asm/arch/cpu.h>		/* get chip and board defs */
 
@@ -315,6 +316,28 @@ int get_soft_i2c_sda_pin(void);
 /* Common misc for Samsung */
 #define CONFIG_MISC_INIT_R
 
+/* Download menu - Samsung common */
+#define CONFIG_LCD_MENU
+#define CONFIG_LCD_MENU_BOARD
+
+/* Download menu - definitions for check keys */
+#ifndef __ASSEMBLY__
+#include <power/max77686_pmic.h>
+
+#define KEY_PWR_PMIC_NAME		"MAX77686_PMIC"
+#define KEY_PWR_STATUS_REG		MAX77686_REG_PMIC_STATUS1
+#define KEY_PWR_STATUS_MASK		(1 << 0)
+#define KEY_PWR_INTERRUPT_REG		MAX77686_REG_PMIC_INT1
+#define KEY_PWR_INTERRUPT_MASK		(1 << 1)
+
+#define KEY_VOL_UP_GPIO			exynos4x12_gpio_get(2, x2, 2)
+#define KEY_VOL_DOWN_GPIO		exynos4x12_gpio_get(2, x3, 3)
+#endif /* __ASSEMBLY__ */
+
+/* LCD console */
+#define LCD_BPP                 LCD_COLOR16
+#define CONFIG_SYS_WHITE_ON_BLACK
+
 /* LCD */
 #define CONFIG_EXYNOS_FB
 #define CONFIG_LCD
diff --git a/include/power/pmic.h b/include/power/pmic.h
index 0e7aa31..8f282dd 100644
--- a/include/power/pmic.h
+++ b/include/power/pmic.h
@@ -8,7 +8,6 @@
 #ifndef __CORE_PMIC_H_
 #define __CORE_PMIC_H_
 
-#include <common.h>
 #include <linux/list.h>
 #include <i2c.h>
 #include <power/power_chrg.h>
-- 
1.7.9.5

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

* [U-Boot] [PATCH v4 12/12] universal: add LCD download menu support
  2014-01-09 11:23 ` [U-Boot] [PATCH v4 00/12] Introduce Samsung misc file and LCD menu Przemyslaw Marczak
                     ` (10 preceding siblings ...)
  2014-01-09 11:23   ` [U-Boot] [PATCH v4 11/12] trats2: " Przemyslaw Marczak
@ 2014-01-09 11:23   ` Przemyslaw Marczak
  2014-01-10  6:45   ` [U-Boot] [PATCH v4 00/12] Introduce Samsung misc file and LCD menu Hyungwon Hwang
  12 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-09 11:23 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
---
changes v2:
- add definitions for check keys
- cleanup config definitions

Changes v3:
- remove CONFIG_BOARD_NAME from include/configs/5pc210_universal.h

Changes v4:
- none

 include/configs/s5pc210_universal.h |   22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/include/configs/s5pc210_universal.h b/include/configs/s5pc210_universal.h
index 4079b7c..ec8f991 100644
--- a/include/configs/s5pc210_universal.h
+++ b/include/configs/s5pc210_universal.h
@@ -272,6 +272,28 @@ int universal_spi_read(void);
 /* Common misc for Samsung */
 #define CONFIG_MISC_INIT_R
 
+/* Download menu - Samsung common */
+#define CONFIG_LCD_MENU
+#define CONFIG_LCD_MENU_BOARD
+
+/* Download menu - definitions for check keys */
+#ifndef __ASSEMBLY__
+#include <power/max8998_pmic.h>
+
+#define KEY_PWR_PMIC_NAME		"MAX8998_PMIC"
+#define KEY_PWR_STATUS_REG		MAX8998_REG_STATUS1
+#define KEY_PWR_STATUS_MASK		(1 << 7)
+#define KEY_PWR_INTERRUPT_REG		MAX8998_REG_IRQ1
+#define KEY_PWR_INTERRUPT_MASK		(1 << 7)
+
+#define KEY_VOL_UP_GPIO			exynos4_gpio_get(2, x2, 0)
+#define KEY_VOL_DOWN_GPIO		exynos4_gpio_get(2, x2, 1)
+#endif /* __ASSEMBLY__ */
+
+/* LCD console */
+#define LCD_BPP			LCD_COLOR16
+#define CONFIG_SYS_WHITE_ON_BLACK
+
 /*
  * LCD Settings
  */
-- 
1.7.9.5

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

* [U-Boot] [PATCH v4 02/12] trats2: Code cleanup.
  2014-01-09 11:23   ` [U-Boot] [PATCH v4 02/12] trats2: Code cleanup Przemyslaw Marczak
@ 2014-01-09 12:59     ` Jaehoon Chung
  0 siblings, 0 replies; 147+ messages in thread
From: Jaehoon Chung @ 2014-01-09 12:59 UTC (permalink / raw)
  To: u-boot

Acked-by: Jaehoon Chung <jh80.chung@samsung.com>

On 01/09/2014 08:23 PM, Przemyslaw Marczak wrote:
> Remove wrong and unused env variables
> Trats2 is not as GT-I8800.
> 
> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
> Cc: Piotr Wilczek <p.wilczek@samsung.com>
> 
> ---
> Changes v2:
> - none
> 
> Changes v3:
> - none
> 
> Changes v4:
> - add "include pmic.h" to "max77686_pmic.h"
> 
>  board/samsung/trats2/trats2.c      |   19 ++-----------------
>  drivers/power/battery/bat_trats2.c |    2 +-
>  include/configs/trats2.h           |    1 -
>  include/power/max77686_pmic.h      |    2 ++
>  4 files changed, 5 insertions(+), 19 deletions(-)
> 
> diff --git a/board/samsung/trats2/trats2.c b/board/samsung/trats2/trats2.c
> index 1e96fdc..b4ccf51 100644
> --- a/board/samsung/trats2/trats2.c
> +++ b/board/samsung/trats2/trats2.c
> @@ -72,15 +72,12 @@ static void check_hw_revision(void)
>  int checkboard(void)
>  {
>  	puts("Board:\tTRATS2\n");
> +	printf("HW Revision:\t0x%04x\n", board_rev);
> +
>  	return 0;
>  }
>  #endif
>  
> -static void show_hw_revision(void)
> -{
> -	printf("HW Revision:\t0x%04x\n", board_rev);
> -}
> -
>  u32 get_board_rev(void)
>  {
>  	return board_rev;
> @@ -614,15 +611,3 @@ void init_panel_info(vidinfo_t *vid)
>  	exynos_set_dsim_platform_data(&dsim_platform_data);
>  }
>  #endif /* LCD */
> -
> -#ifdef CONFIG_MISC_INIT_R
> -int misc_init_r(void)
> -{
> -	setenv("model", "GT-I8800");
> -	setenv("board", "TRATS2");
> -
> -	show_hw_revision();
> -
> -	return 0;
> -}
> -#endif
> diff --git a/drivers/power/battery/bat_trats2.c b/drivers/power/battery/bat_trats2.c
> index f264832..94015aa 100644
> --- a/drivers/power/battery/bat_trats2.c
> +++ b/drivers/power/battery/bat_trats2.c
> @@ -8,7 +8,7 @@
>  #include <common.h>
>  #include <power/pmic.h>
>  #include <power/battery.h>
> -#include <power/max8997_pmic.h>
> +#include <power/max77693_pmic.h>
>  #include <errno.h>
>  
>  static struct battery battery_trats;
> diff --git a/include/configs/trats2.h b/include/configs/trats2.h
> index c9ce828..7dfbe98 100644
> --- a/include/configs/trats2.h
> +++ b/include/configs/trats2.h
> @@ -272,7 +272,6 @@
>  #define CONFIG_EFI_PARTITION
>  #define CONFIG_PARTITION_UUIDS
>  
> -#define CONFIG_MISC_INIT_R
>  #define CONFIG_BOARD_EARLY_INIT_F
>  
>  /* I2C */
> diff --git a/include/power/max77686_pmic.h b/include/power/max77686_pmic.h
> index 16e9016..c2a772a 100644
> --- a/include/power/max77686_pmic.h
> +++ b/include/power/max77686_pmic.h
> @@ -8,6 +8,8 @@
>  #ifndef __MAX77686_H_
>  #define __MAX77686_H_
>  
> +#include <power/pmic.h>
> +
>  enum {
>  	MAX77686_REG_PMIC_ID		= 0x0,
>  	MAX77686_REG_PMIC_INTSRC,
> 

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

* [U-Boot] [PATCH v4 03/12] samsung: common: Add misc file and common function misc_init_r().
  2014-01-09 11:23   ` [U-Boot] [PATCH v4 03/12] samsung: common: Add misc file and common function misc_init_r() Przemyslaw Marczak
@ 2014-01-09 13:00     ` Jaehoon Chung
  0 siblings, 0 replies; 147+ messages in thread
From: Jaehoon Chung @ 2014-01-09 13:00 UTC (permalink / raw)
  To: u-boot

Acked-by: Jaehoon Chung <jh80.chung@samsung.com>

On 01/09/2014 08:23 PM, Przemyslaw Marczak wrote:
> Config: CONFIG_MISC_INIT_R enables implementation of misc_init_r()
> in common file::
> - board/samsung/common/misc.c
> 
> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
> 
> ---
> Changes v2:
> - change CONFIG_SAMSUNG to CONFIG_MISC_INIT_R
> 
> Changes v3:
> - fix merge conflict in board/samsung/common/Makefile
> 
> Changes v4:
> - none
> 
>  board/samsung/common/Makefile |    1 +
>  board/samsung/common/misc.c   |   14 ++++++++++++++
>  2 files changed, 15 insertions(+)
>  create mode 100644 board/samsung/common/misc.c
> 
> diff --git a/board/samsung/common/Makefile b/board/samsung/common/Makefile
> index 22bd6b1..79547a3 100644
> --- a/board/samsung/common/Makefile
> +++ b/board/samsung/common/Makefile
> @@ -8,6 +8,7 @@
>  obj-$(CONFIG_SOFT_I2C_MULTI_BUS) += multi_i2c.o
>  obj-$(CONFIG_THOR_FUNCTION) += thor.o
>  obj-$(CONFIG_CMD_USB_MASS_STORAGE) += ums.o
> +obj-$(CONFIG_MISC_INIT_R) += misc.o
>  
>  ifndef CONFIG_SPL_BUILD
>  obj-$(CONFIG_BOARD_COMMON)	+= board.o
> diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
> new file mode 100644
> index 0000000..3764d12
> --- /dev/null
> +++ b/board/samsung/common/misc.c
> @@ -0,0 +1,14 @@
> +/*
> + * Copyright (C) 2013 Samsung Electronics
> + * Przemyslaw Marczak <p.marczak@samsung.com>
> + *
> + * SPDX-License-Identifier:	GPL-2.0+
> + */
> +
> +#include <common.h>
> +
> +/* Common for Samsung boards */
> +int misc_init_r(void)
> +{
> +	return 0;
> +}
> 

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

* [U-Boot] [PATCH v4 09/12] samsung: misc: Add LCD download menu.
  2014-01-09 11:23   ` [U-Boot] [PATCH v4 09/12] samsung: misc: Add LCD download menu Przemyslaw Marczak
@ 2014-01-10  1:37     ` Minkyu Kang
  2014-01-10  9:37       ` Przemyslaw Marczak
  0 siblings, 1 reply; 147+ messages in thread
From: Minkyu Kang @ 2014-01-10  1:37 UTC (permalink / raw)
  To: u-boot

On 09/01/14 20:23, Przemyslaw Marczak wrote:
> This simple LCD menu allows run one of download mode on device
> without writing on console or for fast and easy upgrade.
> This feature check user keys combination at boot:
> - power key + volume up - download menu
> - power key + volume down - thor mode (without menu)
> 
> New configs:
> - CONFIG_LCD_MENU
> - CONFIG_LCD_MENU_BOARD
> which depends on: CONFIG_MISC_INIT_R
> 
> For proper effect this feature needs following definitions:
> 
> Power key:
> - KEY_PWR_PMIC_NAME - (string) pmic which supports power key check
> 
> Register address:
> - KEY_PWR_STATUS_REG
> - KEY_PWR_INTERRUPT_REG
> 
> Register power key mask:
> - KEY_PWR_STATUS_MASK
> - KEY_PWR_INTERRUPT_MASK
> 
> Gpio numbers:
> - KEY_PWR_INTERRUPT_MASK
> - KEY_VOL_DOWN_GPIO
> 
> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
> 
> ---
> Changes v2:
> - remove keys.h  - definitions should be in boards headers
> - add misc.h
> - code cleanup
> - extend commit msg by more informations
> 
> Changes v3:
> - none
> 
> Changes v4:
> - code cleanup in board/samsung/common/misc.c
> - add command result check
> - clear PWR button interrupt flag after command finish to prevent immediately
>   mode exit in mode_leave_menu() function.
> - introduce MODE_CMD_ARGC - max number of command arguments
> - split array mode_cmd[] to mode_cmd[][] with separated arguments
> - command support checking is now achieved without preprocessor ifdefs
> 
>  board/samsung/common/misc.c |  349 +++++++++++++++++++++++++++++++++++++++++++
>  board/samsung/common/misc.h |   18 +++
>  2 files changed, 367 insertions(+)
>  create mode 100644 board/samsung/common/misc.h
> 
> diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
> index 3a91d62..f29fca4 100644
> --- a/board/samsung/common/misc.c
> +++ b/board/samsung/common/misc.c
> @@ -8,6 +8,350 @@
>  #include <common.h>
>  #include <lcd.h>
>  #include <libtizen.h>
> +#include <errno.h>
> +#include <version.h>
> +#include <asm/sizes.h>
> +#include <asm/arch/cpu.h>
> +#include <asm/arch/gpio.h>
> +#include <asm/gpio.h>
> +#include <linux/input.h>
> +#include <lcd.h>
> +#include <libtizen.h>

lcd.h, libtizen.h are duplicated.

> +#include <power/pmic.h>
> +#include <mmc.h>
> +#include "misc.h"
> +
> +DECLARE_GLOBAL_DATA_PTR;
> +
> +#ifdef CONFIG_LCD_MENU
> +static int power_key_pressed(u32 reg)
> +{
> +	struct pmic *pmic;
> +	u32 status;
> +	u32 mask;
> +
> +	pmic = pmic_get(KEY_PWR_PMIC_NAME);
> +	if (!pmic) {
> +		printf("%s: Not found\n", KEY_PWR_PMIC_NAME);
> +		return 0;
> +	}
> +
> +	if (pmic_probe(pmic))
> +		return 0;
> +
> +	if (reg == KEY_PWR_STATUS_REG)
> +		mask = KEY_PWR_STATUS_MASK;
> +	else
> +		mask = KEY_PWR_INTERRUPT_MASK;
> +
> +	if (pmic_reg_read(pmic, reg, &status))
> +		return 0;
> +
> +	return !!(status & mask);
> +}
> +
> +static int key_pressed(int key)
> +{
> +	int value;
> +
> +	switch (key) {
> +	case KEY_POWER:
> +		value = power_key_pressed(KEY_PWR_INTERRUPT_REG);
> +		break;
> +	case KEY_VOLUMEUP:
> +		value = !gpio_get_value(KEY_VOL_UP_GPIO);
> +		break;
> +	case KEY_VOLUMEDOWN:
> +		value = !gpio_get_value(KEY_VOL_DOWN_GPIO);
> +		break;
> +	default:
> +		value = 0;
> +		break;
> +	}
> +
> +	return value;
> +}
> +
> +static int check_keys(void)
> +{
> +	int keys = 0;
> +
> +	if (key_pressed(KEY_POWER))
> +		keys += KEY_POWER;
> +	if (key_pressed(KEY_VOLUMEUP))
> +		keys += KEY_VOLUMEUP;
> +	if (key_pressed(KEY_VOLUMEDOWN))
> +		keys += KEY_VOLUMEDOWN;
> +
> +	return keys;
> +}
> +
> +/*
> + * 0 BOOT_MODE_INFO
> + * 1 BOOT_MODE_THOR
> + * 2 BOOT_MODE_UMS
> + * 3 BOOT_MODE_DFU
> + * 4 BOOT_MODE_EXIT
> + */
> +static char *
> +mode_name[BOOT_MODE_EXIT + 1] = {
> +	"DEVICE",
> +	"THOR",
> +	"UMS",
> +	"DFU",
> +	"EXIT"
> +};
> +
> +static char *
> +mode_info[BOOT_MODE_EXIT + 1] = {
> +	"info",
> +	"downloader",
> +	"mass storage",
> +	"firmware update",
> +	"and run normal boot"
> +};
> +
> +#define MODE_CMD_ARGC	4
> +
> +static char *
> +mode_cmd[BOOT_MODE_EXIT + 1][MODE_CMD_ARGC] = {
> +	{"", "", "", ""},
> +	{"thor", "0", "mmc", "0"},
> +	{"ums", "0", "mmc", "0"},
> +	{"dfu", "0", "mmc", "0"},
> +	{"", "", "", ""},
> +};
> +
> +static void display_board_info(void)
> +{

#ifdef CONFIG_GENERIC_MMC
> +	struct mmc *mmc = find_mmc_device(0);
#endif

> +	vidinfo_t *vid = &panel_info;
> +
> +	lcd_position_cursor(4, 4);
> +
> +	lcd_printf("%s\n\t", U_BOOT_VERSION);
> +	lcd_puts("\n\t\tBoard Info:\n");
> +#ifdef CONFIG_SYS_BOARD
> +	lcd_printf("\tBoard name: %s\n", CONFIG_SYS_BOARD);
> +#endif
> +#ifdef CONFIG_REVISION_TAG
> +	lcd_printf("\tBoard rev: %u\n", get_board_rev());
> +#endif
> +	lcd_printf("\tDRAM banks: %u\n", CONFIG_NR_DRAM_BANKS);
> +	lcd_printf("\tDRAM size: %u MB\n", gd->ram_size / SZ_1M);
> +

#ifdef CONFIG_GENERIC_MMC
> +	if (mmc) {
> +		if (!mmc->capacity)
> +			mmc_init(mmc);
> +
> +		lcd_printf("\teMMC size: %llu MB\n", mmc->capacity / SZ_1M);
> +	}
#endif

> +
> +	if (vid)
> +		lcd_printf("\tDisplay resolution: %u x % u\n",
> +			   vid->vl_col, vid->vl_row);
> +
> +	lcd_printf("\tDisplay BPP: %u\n", 1 << vid->vl_bpix);
> +}
> +
> +static int boot_menu(void)
> +{
> +	int key = 0;
> +	int timeout = 10;
> +
> +	display_mode_info();
> +
> +	while (timeout--) {
> +		lcd_printf("\rNormal boot will start in: %d seconds.", timeout);
> +		udelay(1000000);

mdelay(1000)?

> +
> +		key = key_pressed(KEY_POWER);
> +		if (key)
> +			break;
> +	}
> +
> +	lcd_clear();
> +
> +	/* If PWR pressed - show download menu */
> +	if (key) {
> +		printf("Power pressed - go to download menu\n");
> +		download_menu();
> +		printf("Download mode exit.\n");
> +	}
> +
> +	return 0;
> +}
> +

Thanks,
Minkyu Kang.

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

* [U-Boot] [PATCH v4 00/12] Introduce Samsung misc file and LCD menu.
  2014-01-09 11:23 ` [U-Boot] [PATCH v4 00/12] Introduce Samsung misc file and LCD menu Przemyslaw Marczak
                     ` (11 preceding siblings ...)
  2014-01-09 11:23   ` [U-Boot] [PATCH v4 12/12] universal: " Przemyslaw Marczak
@ 2014-01-10  6:45   ` Hyungwon Hwang
  2014-01-10  7:06     ` Hyungwon Hwang
  2014-01-10  9:31     ` Przemyslaw Marczak
  12 siblings, 2 replies; 147+ messages in thread
From: Hyungwon Hwang @ 2014-01-10  6:45 UTC (permalink / raw)
  To: u-boot

Hi Marczak,

On Thu, 09 Jan 2014 12:23:04 +0100
Przemyslaw Marczak <p.marczak@samsung.com> wrote:

> This patch set includes changes required to:
> - properly use of all gpios
> - introduce common file for Samsung misc code
> - keys support (PWR, VOL:UP,DOWN)
> - console support on LCD
> - 16bpp logo support
> - introduce LCD menu on Samsung devices
> 
> Each version changes are described in each patch commit msg.
> 
> Przemyslaw Marczak (12):
>   s5p: gpio: change gpio coding method for s5p gpio.
>   trats2: Code cleanup.
>   samsung: common: Add misc file and common function misc_init_r().
>   samsung: misc: move display logo function to misc.c file.
>   common: lcd.c: fix data abort exception when try to access bmp
> header lib: tizen: change Tizen logo with the new one.
>   video: exynos: fimd: add support for various display color modes
>   samsung: boards: update display configs with 16bpp mode.
>   samsung: misc: Add LCD download menu.
>   Trats: add LCD download menu support
>   trats2: add LCD download menu support
>   universal: add LCD download menu support
> 
>  arch/arm/include/asm/arch-exynos/gpio.h  |  245 +-
>  arch/arm/include/asm/arch-s5pc1xx/gpio.h |   47 +-
>  board/samsung/common/Makefile            |    1 +
>  board/samsung/common/misc.c              |  407 ++
>  board/samsung/common/misc.h              |   18 +
>  board/samsung/trats/trats.c              |    5 +-
>  board/samsung/trats2/trats2.c            |   33 +-
>  board/samsung/universal_c210/universal.c |    6 +-
>  common/lcd.c                             |   27 +-
>  drivers/gpio/s5p_gpio.c                  |   15 +-
>  drivers/power/battery/bat_trats2.c       |    2 +-
>  drivers/video/exynos_fb.c                |   28 -
>  drivers/video/exynos_fimd.c              |   15 +-
>  include/configs/s5p_goni.h               |    4 +-
>  include/configs/s5pc210_universal.h      |   41 +-
>  include/configs/trats.h                  |   33 +-
>  include/configs/trats2.h                 |   31 +-
>  include/lcd.h                            |    2 +
>  include/power/max77686_pmic.h            |    2 +
>  include/power/pmic.h                     |    1 -
>  lib/tizen/tizen.c                        |   21 +-
>  lib/tizen/tizen_hd_logo.h                | 5057 ---------------
>  lib/tizen/tizen_hd_logo_data.h           |   15 -
>  lib/tizen/tizen_logo_16bpp.h             |10025
> ++++++++++++++++++++++++++++++
> lib/tizen/tizen_logo_16bpp_gzip.h        |  727 +++ 25 files changed,
> 11437 insertions(+), 5371 deletions(-) create mode 100644
> board/samsung/common/misc.c create mode 100644
> board/samsung/common/misc.h delete mode 100644
> lib/tizen/tizen_hd_logo.h delete mode 100644
> lib/tizen/tizen_hd_logo_data.h create mode 100644
> lib/tizen/tizen_logo_16bpp.h create mode 100644
> lib/tizen/tizen_logo_16bpp_gzip.h
> 

I downloaded the newest version of u-boot-samsung,
applied all patches you sent, build it, and
write it on M0 board.
Logo image doesn't appear.

On the console, I found the below error message.
"Error: 16 bit/pixel mode, but BMP has 32 bit/pixel"

Is there anything wrong I did? or should something
be changed in your code?

Thanks,
---
Hyungwon Hwang
Samsung SWC S/W Platform Team
Smasung Electronics
human.hwang at samsung.com

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

* [U-Boot] [PATCH v4 00/12] Introduce Samsung misc file and LCD menu.
  2014-01-10  6:45   ` [U-Boot] [PATCH v4 00/12] Introduce Samsung misc file and LCD menu Hyungwon Hwang
@ 2014-01-10  7:06     ` Hyungwon Hwang
  2014-01-10  9:31     ` Przemyslaw Marczak
  1 sibling, 0 replies; 147+ messages in thread
From: Hyungwon Hwang @ 2014-01-10  7:06 UTC (permalink / raw)
  To: u-boot

On Fri, 10 Jan 2014 15:45:52 +0900
Hyungwon Hwang <human.hwang@samsung.com> wrote:
Hi Marczak,

> Hi Marczak,
> 
> On Thu, 09 Jan 2014 12:23:04 +0100
> Przemyslaw Marczak <p.marczak@samsung.com> wrote:
> 
> > This patch set includes changes required to:
> > - properly use of all gpios
> > - introduce common file for Samsung misc code
> > - keys support (PWR, VOL:UP,DOWN)
> > - console support on LCD
> > - 16bpp logo support
> > - introduce LCD menu on Samsung devices
> > 
> > Each version changes are described in each patch commit msg.
> > 
> > Przemyslaw Marczak (12):
> >   s5p: gpio: change gpio coding method for s5p gpio.
> >   trats2: Code cleanup.
> >   samsung: common: Add misc file and common function misc_init_r().
> >   samsung: misc: move display logo function to misc.c file.
> >   common: lcd.c: fix data abort exception when try to access bmp
> > header lib: tizen: change Tizen logo with the new one.
> >   video: exynos: fimd: add support for various display color modes
> >   samsung: boards: update display configs with 16bpp mode.
> >   samsung: misc: Add LCD download menu.
> >   Trats: add LCD download menu support
> >   trats2: add LCD download menu support
> >   universal: add LCD download menu support
> > 
> >  arch/arm/include/asm/arch-exynos/gpio.h  |  245 +-
> >  arch/arm/include/asm/arch-s5pc1xx/gpio.h |   47 +-
> >  board/samsung/common/Makefile            |    1 +
> >  board/samsung/common/misc.c              |  407 ++
> >  board/samsung/common/misc.h              |   18 +
> >  board/samsung/trats/trats.c              |    5 +-
> >  board/samsung/trats2/trats2.c            |   33 +-
> >  board/samsung/universal_c210/universal.c |    6 +-
> >  common/lcd.c                             |   27 +-
> >  drivers/gpio/s5p_gpio.c                  |   15 +-
> >  drivers/power/battery/bat_trats2.c       |    2 +-
> >  drivers/video/exynos_fb.c                |   28 -
> >  drivers/video/exynos_fimd.c              |   15 +-
> >  include/configs/s5p_goni.h               |    4 +-
> >  include/configs/s5pc210_universal.h      |   41 +-
> >  include/configs/trats.h                  |   33 +-
> >  include/configs/trats2.h                 |   31 +-
> >  include/lcd.h                            |    2 +
> >  include/power/max77686_pmic.h            |    2 +
> >  include/power/pmic.h                     |    1 -
> >  lib/tizen/tizen.c                        |   21 +-
> >  lib/tizen/tizen_hd_logo.h                | 5057 ---------------
> >  lib/tizen/tizen_hd_logo_data.h           |   15 -
> >  lib/tizen/tizen_logo_16bpp.h             |10025
> > ++++++++++++++++++++++++++++++
> > lib/tizen/tizen_logo_16bpp_gzip.h        |  727 +++ 25 files changed,
> > 11437 insertions(+), 5371 deletions(-) create mode 100644
> > board/samsung/common/misc.c create mode 100644
> > board/samsung/common/misc.h delete mode 100644
> > lib/tizen/tizen_hd_logo.h delete mode 100644
> > lib/tizen/tizen_hd_logo_data.h create mode 100644
> > lib/tizen/tizen_logo_16bpp.h create mode 100644
> > lib/tizen/tizen_logo_16bpp_gzip.h
> > 
> 
> I downloaded the newest version of u-boot-samsung,
> applied all patches you sent, build it, and
> write it on M0 board.
> Logo image doesn't appear.
> 
> On the console, I found the below error message.
> "Error: 16 bit/pixel mode, but BMP has 32 bit/pixel"
> 
> Is there anything wrong I did? or should something
> be changed in your code?

I made a mistake. Just ignore it.
Sorry.

> 
> Thanks,
> ---
> Hyungwon Hwang
> Samsung SWC S/W Platform Team
> Smasung Electronics
> human.hwang at samsung.com
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot



Thanks,
---
Hyungwon Hwang
S/W Platform Team, Software center
Samsung Electronics.
human.hwang at samsung.com

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

* [U-Boot] [PATCH v4 06/12] lib: tizen: change Tizen logo with the new one.
  2014-01-09 11:23   ` [U-Boot] [PATCH v4 06/12] lib: tizen: change Tizen logo with the new one Przemyslaw Marczak
@ 2014-01-10  7:09     ` Hyungwon Hwang
  2014-01-10  9:26     ` Hyungwon Hwang
  1 sibling, 0 replies; 147+ messages in thread
From: Hyungwon Hwang @ 2014-01-10  7:09 UTC (permalink / raw)
  To: u-boot

Hi, Marczak

On Thu, 09 Jan 2014 12:23:10 +0100
Przemyslaw Marczak <p.marczak@samsung.com> wrote:

> This is big size patch. Please follow the link:
> 
> http://www.denx.de/wiki/pub/U-Boot/TooBigPatches/0006-lib-tizen-change-Tizen-logo-with-the-new-one.patch
> 

I tested it on M0 board, and the image shows center-aligned in high quality.
Thank you.

Best regards,
Hyungwon Hwang

-- 
Hyungwon Hwang
S/W Platform Team, Software center
Samsung Electronics.
human.hwang at samsung.com

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

* [U-Boot] [PATCH v4 06/12] lib: tizen: change Tizen logo with the new one.
  2014-01-09 11:23   ` [U-Boot] [PATCH v4 06/12] lib: tizen: change Tizen logo with the new one Przemyslaw Marczak
  2014-01-10  7:09     ` Hyungwon Hwang
@ 2014-01-10  9:26     ` Hyungwon Hwang
  2014-01-10  9:35       ` Przemyslaw Marczak
  1 sibling, 1 reply; 147+ messages in thread
From: Hyungwon Hwang @ 2014-01-10  9:26 UTC (permalink / raw)
  To: u-boot

Hi, Marczak

On Thu, 09 Jan 2014 12:23:10 +0100
Przemyslaw Marczak <p.marczak@samsung.com> wrote:

> This is big size patch. Please follow the link:
> 
> http://www.denx.de/wiki/pub/U-Boot/TooBigPatches/0006-lib-tizen-change-Tizen-logo-with-the-new-one.patch
> 

I tested it on M0 board, and the image shows center-aligned in high quality.
Thank you.

Best regards,
Hyungwon Hwang

Tested-by: Hyungwon Hwang <human.hwang@samsung.com>

-- 
Hyungwon Hwang
S/W Platform Team, Software Center
Samsung Electronics.
human.hwang at samsung.com

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

* [U-Boot] [PATCH v4 00/12] Introduce Samsung misc file and LCD menu.
  2014-01-10  6:45   ` [U-Boot] [PATCH v4 00/12] Introduce Samsung misc file and LCD menu Hyungwon Hwang
  2014-01-10  7:06     ` Hyungwon Hwang
@ 2014-01-10  9:31     ` Przemyslaw Marczak
  1 sibling, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-10  9:31 UTC (permalink / raw)
  To: u-boot

Hello Hyungwon,

On 01/10/2014 07:45 AM, Hyungwon Hwang wrote:
> Hi Marczak,
>
> On Thu, 09 Jan 2014 12:23:04 +0100
> Przemyslaw Marczak <p.marczak@samsung.com> wrote:
>
>> This patch set includes changes required to:
>> - properly use of all gpios
>> - introduce common file for Samsung misc code
>> - keys support (PWR, VOL:UP,DOWN)
>> - console support on LCD
>> - 16bpp logo support
>> - introduce LCD menu on Samsung devices
>>
>> Each version changes are described in each patch commit msg.
>>
>> Przemyslaw Marczak (12):
>>    s5p: gpio: change gpio coding method for s5p gpio.
>>    trats2: Code cleanup.
>>    samsung: common: Add misc file and common function misc_init_r().
>>    samsung: misc: move display logo function to misc.c file.
>>    common: lcd.c: fix data abort exception when try to access bmp
>> header lib: tizen: change Tizen logo with the new one.
>>    video: exynos: fimd: add support for various display color modes
>>    samsung: boards: update display configs with 16bpp mode.
>>    samsung: misc: Add LCD download menu.
>>    Trats: add LCD download menu support
>>    trats2: add LCD download menu support
>>    universal: add LCD download menu support
>>
>>   arch/arm/include/asm/arch-exynos/gpio.h  |  245 +-
>>   arch/arm/include/asm/arch-s5pc1xx/gpio.h |   47 +-
>>   board/samsung/common/Makefile            |    1 +
>>   board/samsung/common/misc.c              |  407 ++
>>   board/samsung/common/misc.h              |   18 +
>>   board/samsung/trats/trats.c              |    5 +-
>>   board/samsung/trats2/trats2.c            |   33 +-
>>   board/samsung/universal_c210/universal.c |    6 +-
>>   common/lcd.c                             |   27 +-
>>   drivers/gpio/s5p_gpio.c                  |   15 +-
>>   drivers/power/battery/bat_trats2.c       |    2 +-
>>   drivers/video/exynos_fb.c                |   28 -
>>   drivers/video/exynos_fimd.c              |   15 +-
>>   include/configs/s5p_goni.h               |    4 +-
>>   include/configs/s5pc210_universal.h      |   41 +-
>>   include/configs/trats.h                  |   33 +-
>>   include/configs/trats2.h                 |   31 +-
>>   include/lcd.h                            |    2 +
>>   include/power/max77686_pmic.h            |    2 +
>>   include/power/pmic.h                     |    1 -
>>   lib/tizen/tizen.c                        |   21 +-
>>   lib/tizen/tizen_hd_logo.h                | 5057 ---------------
>>   lib/tizen/tizen_hd_logo_data.h           |   15 -
>>   lib/tizen/tizen_logo_16bpp.h             |10025
>> ++++++++++++++++++++++++++++++
>> lib/tizen/tizen_logo_16bpp_gzip.h        |  727 +++ 25 files changed,
>> 11437 insertions(+), 5371 deletions(-) create mode 100644
>> board/samsung/common/misc.c create mode 100644
>> board/samsung/common/misc.h delete mode 100644
>> lib/tizen/tizen_hd_logo.h delete mode 100644
>> lib/tizen/tizen_hd_logo_data.h create mode 100644
>> lib/tizen/tizen_logo_16bpp.h create mode 100644
>> lib/tizen/tizen_logo_16bpp_gzip.h
>>
>
> I downloaded the newest version of u-boot-samsung,
> applied all patches you sent, build it, and
> write it on M0 board.
> Logo image doesn't appear.
>
> On the console, I found the below error message.
> "Error: 16 bit/pixel mode, but BMP has 32 bit/pixel"
>
> Is there anything wrong I did? or should something
> be changed in your code?
>
> Thanks,
> ---
> Hyungwon Hwang
> Samsung SWC S/W Platform Team
> Smasung Electronics
> human.hwang at samsung.com
>

I assume that it was because you missed the big size patch, right?

Regards
-- 
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com

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

* [U-Boot] [PATCH v4 06/12] lib: tizen: change Tizen logo with the new one.
  2014-01-10  9:26     ` Hyungwon Hwang
@ 2014-01-10  9:35       ` Przemyslaw Marczak
  0 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-10  9:35 UTC (permalink / raw)
  To: u-boot

Hi Hyungwon,

On 01/10/2014 10:26 AM, Hyungwon Hwang wrote:
> Hi, Marczak
>
> On Thu, 09 Jan 2014 12:23:10 +0100
> Przemyslaw Marczak <p.marczak@samsung.com> wrote:
>
>> This is big size patch. Please follow the link:
>>
>> http://www.denx.de/wiki/pub/U-Boot/TooBigPatches/0006-lib-tizen-change-Tizen-logo-with-the-new-one.patch
>>
>
> I tested it on M0 board, and the image shows center-aligned in high quality.
> Thank you.
>
> Best regards,
> Hyungwon Hwang
>
> Tested-by: Hyungwon Hwang <human.hwang@samsung.com>
>

Thank you for testing.

Regards
-- 
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com

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

* [U-Boot] [PATCH v4 09/12] samsung: misc: Add LCD download menu.
  2014-01-10  1:37     ` Minkyu Kang
@ 2014-01-10  9:37       ` Przemyslaw Marczak
  2014-01-10  9:43         ` Minkyu Kang
  0 siblings, 1 reply; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-10  9:37 UTC (permalink / raw)
  To: u-boot

Hello Minkyu,

On 01/10/2014 02:37 AM, Minkyu Kang wrote:
> On 09/01/14 20:23, Przemyslaw Marczak wrote:
>> This simple LCD menu allows run one of download mode on device
>> without writing on console or for fast and easy upgrade.
>> This feature check user keys combination at boot:
>> - power key + volume up - download menu
>> - power key + volume down - thor mode (without menu)
>>
>> New configs:
>> - CONFIG_LCD_MENU
>> - CONFIG_LCD_MENU_BOARD
>> which depends on: CONFIG_MISC_INIT_R
>>
>> For proper effect this feature needs following definitions:
>>
>> Power key:
>> - KEY_PWR_PMIC_NAME - (string) pmic which supports power key check
>>
>> Register address:
>> - KEY_PWR_STATUS_REG
>> - KEY_PWR_INTERRUPT_REG
>>
>> Register power key mask:
>> - KEY_PWR_STATUS_MASK
>> - KEY_PWR_INTERRUPT_MASK
>>
>> Gpio numbers:
>> - KEY_PWR_INTERRUPT_MASK
>> - KEY_VOL_DOWN_GPIO
>>
>> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
>>
>> ---
>> Changes v2:
>> - remove keys.h  - definitions should be in boards headers
>> - add misc.h
>> - code cleanup
>> - extend commit msg by more informations
>>
>> Changes v3:
>> - none
>>
>> Changes v4:
>> - code cleanup in board/samsung/common/misc.c
>> - add command result check
>> - clear PWR button interrupt flag after command finish to prevent immediately
>>    mode exit in mode_leave_menu() function.
>> - introduce MODE_CMD_ARGC - max number of command arguments
>> - split array mode_cmd[] to mode_cmd[][] with separated arguments
>> - command support checking is now achieved without preprocessor ifdefs
>>
>>   board/samsung/common/misc.c |  349 +++++++++++++++++++++++++++++++++++++++++++
>>   board/samsung/common/misc.h |   18 +++
>>   2 files changed, 367 insertions(+)
>>   create mode 100644 board/samsung/common/misc.h
>>
>> diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
>> index 3a91d62..f29fca4 100644
>> --- a/board/samsung/common/misc.c
>> +++ b/board/samsung/common/misc.c
>> @@ -8,6 +8,350 @@
>>   #include <common.h>
>>   #include <lcd.h>
>>   #include <libtizen.h>
>> +#include <errno.h>
>> +#include <version.h>
>> +#include <asm/sizes.h>
>> +#include <asm/arch/cpu.h>
>> +#include <asm/arch/gpio.h>
>> +#include <asm/gpio.h>
>> +#include <linux/input.h>
>> +#include <lcd.h>
>> +#include <libtizen.h>
>
> lcd.h, libtizen.h are duplicated.
>

Thanks, will be removed.

>> +#include <power/pmic.h>
>> +#include <mmc.h>
>> +#include "misc.h"
>> +
>> +DECLARE_GLOBAL_DATA_PTR;
>> +
>> +#ifdef CONFIG_LCD_MENU
>> +static int power_key_pressed(u32 reg)
>> +{
>> +	struct pmic *pmic;
>> +	u32 status;
>> +	u32 mask;
>> +
>> +	pmic = pmic_get(KEY_PWR_PMIC_NAME);
>> +	if (!pmic) {
>> +		printf("%s: Not found\n", KEY_PWR_PMIC_NAME);
>> +		return 0;
>> +	}
>> +
>> +	if (pmic_probe(pmic))
>> +		return 0;
>> +
>> +	if (reg == KEY_PWR_STATUS_REG)
>> +		mask = KEY_PWR_STATUS_MASK;
>> +	else
>> +		mask = KEY_PWR_INTERRUPT_MASK;
>> +
>> +	if (pmic_reg_read(pmic, reg, &status))
>> +		return 0;
>> +
>> +	return !!(status & mask);
>> +}
>> +
>> +static int key_pressed(int key)
>> +{
>> +	int value;
>> +
>> +	switch (key) {
>> +	case KEY_POWER:
>> +		value = power_key_pressed(KEY_PWR_INTERRUPT_REG);
>> +		break;
>> +	case KEY_VOLUMEUP:
>> +		value = !gpio_get_value(KEY_VOL_UP_GPIO);
>> +		break;
>> +	case KEY_VOLUMEDOWN:
>> +		value = !gpio_get_value(KEY_VOL_DOWN_GPIO);
>> +		break;
>> +	default:
>> +		value = 0;
>> +		break;
>> +	}
>> +
>> +	return value;
>> +}
>> +
>> +static int check_keys(void)
>> +{
>> +	int keys = 0;
>> +
>> +	if (key_pressed(KEY_POWER))
>> +		keys += KEY_POWER;
>> +	if (key_pressed(KEY_VOLUMEUP))
>> +		keys += KEY_VOLUMEUP;
>> +	if (key_pressed(KEY_VOLUMEDOWN))
>> +		keys += KEY_VOLUMEDOWN;
>> +
>> +	return keys;
>> +}
>> +
>> +/*
>> + * 0 BOOT_MODE_INFO
>> + * 1 BOOT_MODE_THOR
>> + * 2 BOOT_MODE_UMS
>> + * 3 BOOT_MODE_DFU
>> + * 4 BOOT_MODE_EXIT
>> + */
>> +static char *
>> +mode_name[BOOT_MODE_EXIT + 1] = {
>> +	"DEVICE",
>> +	"THOR",
>> +	"UMS",
>> +	"DFU",
>> +	"EXIT"
>> +};
>> +
>> +static char *
>> +mode_info[BOOT_MODE_EXIT + 1] = {
>> +	"info",
>> +	"downloader",
>> +	"mass storage",
>> +	"firmware update",
>> +	"and run normal boot"
>> +};
>> +
>> +#define MODE_CMD_ARGC	4
>> +
>> +static char *
>> +mode_cmd[BOOT_MODE_EXIT + 1][MODE_CMD_ARGC] = {
>> +	{"", "", "", ""},
>> +	{"thor", "0", "mmc", "0"},
>> +	{"ums", "0", "mmc", "0"},
>> +	{"dfu", "0", "mmc", "0"},
>> +	{"", "", "", ""},
>> +};
>> +
>> +static void display_board_info(void)
>> +{
>
> #ifdef CONFIG_GENERIC_MMC
>> +	struct mmc *mmc = find_mmc_device(0);
> #endif
>
>> +	vidinfo_t *vid = &panel_info;
>> +
>> +	lcd_position_cursor(4, 4);
>> +
>> +	lcd_printf("%s\n\t", U_BOOT_VERSION);
>> +	lcd_puts("\n\t\tBoard Info:\n");
>> +#ifdef CONFIG_SYS_BOARD
>> +	lcd_printf("\tBoard name: %s\n", CONFIG_SYS_BOARD);
>> +#endif
>> +#ifdef CONFIG_REVISION_TAG
>> +	lcd_printf("\tBoard rev: %u\n", get_board_rev());
>> +#endif
>> +	lcd_printf("\tDRAM banks: %u\n", CONFIG_NR_DRAM_BANKS);
>> +	lcd_printf("\tDRAM size: %u MB\n", gd->ram_size / SZ_1M);
>> +
>
> #ifdef CONFIG_GENERIC_MMC
>> +	if (mmc) {
>> +		if (!mmc->capacity)
>> +			mmc_init(mmc);
>> +
>> +		lcd_printf("\teMMC size: %llu MB\n", mmc->capacity / SZ_1M);
>> +	}
> #endif
>
>> +
>> +	if (vid)
>> +		lcd_printf("\tDisplay resolution: %u x % u\n",
>> +			   vid->vl_col, vid->vl_row);
>> +
>> +	lcd_printf("\tDisplay BPP: %u\n", 1 << vid->vl_bpix);
>> +}
>> +
>> +static int boot_menu(void)
>> +{
>> +	int key = 0;
>> +	int timeout = 10;
>> +
>> +	display_mode_info();
>> +
>> +	while (timeout--) {
>> +		lcd_printf("\rNormal boot will start in: %d seconds.", timeout);
>> +		udelay(1000000);
>
> mdelay(1000)?
>

OK.

>> +
>> +		key = key_pressed(KEY_POWER);
>> +		if (key)
>> +			break;
>> +	}
>> +
>> +	lcd_clear();
>> +
>> +	/* If PWR pressed - show download menu */
>> +	if (key) {
>> +		printf("Power pressed - go to download menu\n");
>> +		download_menu();
>> +		printf("Download mode exit.\n");
>> +	}
>> +
>> +	return 0;
>> +}
>> +
>
> Thanks,
> Minkyu Kang.
>
>

Thank you for review.

Regards
-- 
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com

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

* [U-Boot] [PATCH v4 09/12] samsung: misc: Add LCD download menu.
  2014-01-10  9:37       ` Przemyslaw Marczak
@ 2014-01-10  9:43         ` Minkyu Kang
  2014-01-10  9:48           ` Przemyslaw Marczak
  0 siblings, 1 reply; 147+ messages in thread
From: Minkyu Kang @ 2014-01-10  9:43 UTC (permalink / raw)
  To: u-boot

On 10/01/14 18:37, Przemyslaw Marczak wrote:
> Hello Minkyu,
> 
> On 01/10/2014 02:37 AM, Minkyu Kang wrote:
>> On 09/01/14 20:23, Przemyslaw Marczak wrote:
>>> This simple LCD menu allows run one of download mode on device
>>> without writing on console or for fast and easy upgrade.
>>> This feature check user keys combination at boot:
>>> - power key + volume up - download menu
>>> - power key + volume down - thor mode (without menu)
>>>
>>> New configs:
>>> - CONFIG_LCD_MENU
>>> - CONFIG_LCD_MENU_BOARD
>>> which depends on: CONFIG_MISC_INIT_R
>>>
>>> For proper effect this feature needs following definitions:
>>>
>>> Power key:
>>> - KEY_PWR_PMIC_NAME - (string) pmic which supports power key check
>>>
>>> Register address:
>>> - KEY_PWR_STATUS_REG
>>> - KEY_PWR_INTERRUPT_REG
>>>
>>> Register power key mask:
>>> - KEY_PWR_STATUS_MASK
>>> - KEY_PWR_INTERRUPT_MASK
>>>
>>> Gpio numbers:
>>> - KEY_PWR_INTERRUPT_MASK
>>> - KEY_VOL_DOWN_GPIO
>>>
>>> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
>>>
>>> ---
>>> Changes v2:
>>> - remove keys.h  - definitions should be in boards headers
>>> - add misc.h
>>> - code cleanup
>>> - extend commit msg by more informations
>>>
>>> Changes v3:
>>> - none
>>>
>>> Changes v4:
>>> - code cleanup in board/samsung/common/misc.c
>>> - add command result check
>>> - clear PWR button interrupt flag after command finish to prevent immediately
>>>    mode exit in mode_leave_menu() function.
>>> - introduce MODE_CMD_ARGC - max number of command arguments
>>> - split array mode_cmd[] to mode_cmd[][] with separated arguments
>>> - command support checking is now achieved without preprocessor ifdefs
>>>
>>>   board/samsung/common/misc.c |  349 +++++++++++++++++++++++++++++++++++++++++++
>>>   board/samsung/common/misc.h |   18 +++
>>>   2 files changed, 367 insertions(+)
>>>   create mode 100644 board/samsung/common/misc.h
>>>
>>> diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
>>> index 3a91d62..f29fca4 100644
>>> --- a/board/samsung/common/misc.c
>>> +++ b/board/samsung/common/misc.c
>>> @@ -8,6 +8,350 @@
>>>   #include <common.h>
>>>   #include <lcd.h>
>>>   #include <libtizen.h>
>>> +#include <errno.h>
>>> +#include <version.h>
>>> +#include <asm/sizes.h>
>>> +#include <asm/arch/cpu.h>
>>> +#include <asm/arch/gpio.h>
>>> +#include <asm/gpio.h>
>>> +#include <linux/input.h>
>>> +#include <lcd.h>
>>> +#include <libtizen.h>
>>
>> lcd.h, libtizen.h are duplicated.
>>
> 
> Thanks, will be removed.
> 
>>> +#include <power/pmic.h>
>>> +#include <mmc.h>
>>> +#include "misc.h"
>>> +
>>> +DECLARE_GLOBAL_DATA_PTR;
>>> +
>>> +#ifdef CONFIG_LCD_MENU
>>> +static int power_key_pressed(u32 reg)
>>> +{
>>> +    struct pmic *pmic;
>>> +    u32 status;
>>> +    u32 mask;
>>> +
>>> +    pmic = pmic_get(KEY_PWR_PMIC_NAME);
>>> +    if (!pmic) {
>>> +        printf("%s: Not found\n", KEY_PWR_PMIC_NAME);
>>> +        return 0;
>>> +    }
>>> +
>>> +    if (pmic_probe(pmic))
>>> +        return 0;
>>> +
>>> +    if (reg == KEY_PWR_STATUS_REG)
>>> +        mask = KEY_PWR_STATUS_MASK;
>>> +    else
>>> +        mask = KEY_PWR_INTERRUPT_MASK;
>>> +
>>> +    if (pmic_reg_read(pmic, reg, &status))
>>> +        return 0;
>>> +
>>> +    return !!(status & mask);
>>> +}
>>> +
>>> +static int key_pressed(int key)
>>> +{
>>> +    int value;
>>> +
>>> +    switch (key) {
>>> +    case KEY_POWER:
>>> +        value = power_key_pressed(KEY_PWR_INTERRUPT_REG);
>>> +        break;
>>> +    case KEY_VOLUMEUP:
>>> +        value = !gpio_get_value(KEY_VOL_UP_GPIO);
>>> +        break;
>>> +    case KEY_VOLUMEDOWN:
>>> +        value = !gpio_get_value(KEY_VOL_DOWN_GPIO);
>>> +        break;
>>> +    default:
>>> +        value = 0;
>>> +        break;
>>> +    }
>>> +
>>> +    return value;
>>> +}
>>> +
>>> +static int check_keys(void)
>>> +{
>>> +    int keys = 0;
>>> +
>>> +    if (key_pressed(KEY_POWER))
>>> +        keys += KEY_POWER;
>>> +    if (key_pressed(KEY_VOLUMEUP))
>>> +        keys += KEY_VOLUMEUP;
>>> +    if (key_pressed(KEY_VOLUMEDOWN))
>>> +        keys += KEY_VOLUMEDOWN;
>>> +
>>> +    return keys;
>>> +}
>>> +
>>> +/*
>>> + * 0 BOOT_MODE_INFO
>>> + * 1 BOOT_MODE_THOR
>>> + * 2 BOOT_MODE_UMS
>>> + * 3 BOOT_MODE_DFU
>>> + * 4 BOOT_MODE_EXIT
>>> + */
>>> +static char *
>>> +mode_name[BOOT_MODE_EXIT + 1] = {
>>> +    "DEVICE",
>>> +    "THOR",
>>> +    "UMS",
>>> +    "DFU",
>>> +    "EXIT"
>>> +};
>>> +
>>> +static char *
>>> +mode_info[BOOT_MODE_EXIT + 1] = {
>>> +    "info",
>>> +    "downloader",
>>> +    "mass storage",
>>> +    "firmware update",
>>> +    "and run normal boot"
>>> +};
>>> +
>>> +#define MODE_CMD_ARGC    4
>>> +
>>> +static char *
>>> +mode_cmd[BOOT_MODE_EXIT + 1][MODE_CMD_ARGC] = {
>>> +    {"", "", "", ""},
>>> +    {"thor", "0", "mmc", "0"},
>>> +    {"ums", "0", "mmc", "0"},
>>> +    {"dfu", "0", "mmc", "0"},
>>> +    {"", "", "", ""},
>>> +};
>>> +
>>> +static void display_board_info(void)
>>> +{
>>
>> #ifdef CONFIG_GENERIC_MMC

Did you check this comment also?

>>> +    struct mmc *mmc = find_mmc_device(0);
>> #endif
>>
>>> +    vidinfo_t *vid = &panel_info;
>>> +
>>> +    lcd_position_cursor(4, 4);
>>> +
>>> +    lcd_printf("%s\n\t", U_BOOT_VERSION);
>>> +    lcd_puts("\n\t\tBoard Info:\n");
>>> +#ifdef CONFIG_SYS_BOARD
>>> +    lcd_printf("\tBoard name: %s\n", CONFIG_SYS_BOARD);
>>> +#endif
>>> +#ifdef CONFIG_REVISION_TAG
>>> +    lcd_printf("\tBoard rev: %u\n", get_board_rev());
>>> +#endif
>>> +    lcd_printf("\tDRAM banks: %u\n", CONFIG_NR_DRAM_BANKS);
>>> +    lcd_printf("\tDRAM size: %u MB\n", gd->ram_size / SZ_1M);
>>> +
>>
>> #ifdef CONFIG_GENERIC_MMC

ditto.

>>> +    if (mmc) {
>>> +        if (!mmc->capacity)
>>> +            mmc_init(mmc);
>>> +
>>> +        lcd_printf("\teMMC size: %llu MB\n", mmc->capacity / SZ_1M);
>>> +    }
>> #endif
>>
>>> +
>>> +    if (vid)
>>> +        lcd_printf("\tDisplay resolution: %u x % u\n",
>>> +               vid->vl_col, vid->vl_row);
>>> +
>>> +    lcd_printf("\tDisplay BPP: %u\n", 1 << vid->vl_bpix);
>>> +}
>>> +

Thanks,
Minkyu Kang.

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

* [U-Boot] [PATCH v4 09/12] samsung: misc: Add LCD download menu.
  2014-01-10  9:43         ` Minkyu Kang
@ 2014-01-10  9:48           ` Przemyslaw Marczak
  0 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-10  9:48 UTC (permalink / raw)
  To: u-boot

On 01/10/2014 10:43 AM, Minkyu Kang wrote:
> On 10/01/14 18:37, Przemyslaw Marczak wrote:
>> Hello Minkyu,
>>
>> On 01/10/2014 02:37 AM, Minkyu Kang wrote:
>>> On 09/01/14 20:23, Przemyslaw Marczak wrote:
>>>> This simple LCD menu allows run one of download mode on device
>>>> without writing on console or for fast and easy upgrade.
>>>> This feature check user keys combination at boot:
>>>> - power key + volume up - download menu
>>>> - power key + volume down - thor mode (without menu)
>>>>
>>>> New configs:
>>>> - CONFIG_LCD_MENU
>>>> - CONFIG_LCD_MENU_BOARD
>>>> which depends on: CONFIG_MISC_INIT_R
>>>>
>>>> For proper effect this feature needs following definitions:
>>>>
>>>> Power key:
>>>> - KEY_PWR_PMIC_NAME - (string) pmic which supports power key check
>>>>
>>>> Register address:
>>>> - KEY_PWR_STATUS_REG
>>>> - KEY_PWR_INTERRUPT_REG
>>>>
>>>> Register power key mask:
>>>> - KEY_PWR_STATUS_MASK
>>>> - KEY_PWR_INTERRUPT_MASK
>>>>
>>>> Gpio numbers:
>>>> - KEY_PWR_INTERRUPT_MASK
>>>> - KEY_VOL_DOWN_GPIO
>>>>
>>>> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
>>>>
>>>> ---
>>>> Changes v2:
>>>> - remove keys.h  - definitions should be in boards headers
>>>> - add misc.h
>>>> - code cleanup
>>>> - extend commit msg by more informations
>>>>
>>>> Changes v3:
>>>> - none
>>>>
>>>> Changes v4:
>>>> - code cleanup in board/samsung/common/misc.c
>>>> - add command result check
>>>> - clear PWR button interrupt flag after command finish to prevent immediately
>>>>     mode exit in mode_leave_menu() function.
>>>> - introduce MODE_CMD_ARGC - max number of command arguments
>>>> - split array mode_cmd[] to mode_cmd[][] with separated arguments
>>>> - command support checking is now achieved without preprocessor ifdefs
>>>>
>>>>    board/samsung/common/misc.c |  349 +++++++++++++++++++++++++++++++++++++++++++
>>>>    board/samsung/common/misc.h |   18 +++
>>>>    2 files changed, 367 insertions(+)
>>>>    create mode 100644 board/samsung/common/misc.h
>>>>
>>>> diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
>>>> index 3a91d62..f29fca4 100644
>>>> --- a/board/samsung/common/misc.c
>>>> +++ b/board/samsung/common/misc.c
>>>> @@ -8,6 +8,350 @@
>>>>    #include <common.h>
>>>>    #include <lcd.h>
>>>>    #include <libtizen.h>
>>>> +#include <errno.h>
>>>> +#include <version.h>
>>>> +#include <asm/sizes.h>
>>>> +#include <asm/arch/cpu.h>
>>>> +#include <asm/arch/gpio.h>
>>>> +#include <asm/gpio.h>
>>>> +#include <linux/input.h>
>>>> +#include <lcd.h>
>>>> +#include <libtizen.h>
>>>
>>> lcd.h, libtizen.h are duplicated.
>>>
>>
>> Thanks, will be removed.
>>
>>>> +#include <power/pmic.h>
>>>> +#include <mmc.h>
>>>> +#include "misc.h"
>>>> +
>>>> +DECLARE_GLOBAL_DATA_PTR;
>>>> +
>>>> +#ifdef CONFIG_LCD_MENU
>>>> +static int power_key_pressed(u32 reg)
>>>> +{
>>>> +    struct pmic *pmic;
>>>> +    u32 status;
>>>> +    u32 mask;
>>>> +
>>>> +    pmic = pmic_get(KEY_PWR_PMIC_NAME);
>>>> +    if (!pmic) {
>>>> +        printf("%s: Not found\n", KEY_PWR_PMIC_NAME);
>>>> +        return 0;
>>>> +    }
>>>> +
>>>> +    if (pmic_probe(pmic))
>>>> +        return 0;
>>>> +
>>>> +    if (reg == KEY_PWR_STATUS_REG)
>>>> +        mask = KEY_PWR_STATUS_MASK;
>>>> +    else
>>>> +        mask = KEY_PWR_INTERRUPT_MASK;
>>>> +
>>>> +    if (pmic_reg_read(pmic, reg, &status))
>>>> +        return 0;
>>>> +
>>>> +    return !!(status & mask);
>>>> +}
>>>> +
>>>> +static int key_pressed(int key)
>>>> +{
>>>> +    int value;
>>>> +
>>>> +    switch (key) {
>>>> +    case KEY_POWER:
>>>> +        value = power_key_pressed(KEY_PWR_INTERRUPT_REG);
>>>> +        break;
>>>> +    case KEY_VOLUMEUP:
>>>> +        value = !gpio_get_value(KEY_VOL_UP_GPIO);
>>>> +        break;
>>>> +    case KEY_VOLUMEDOWN:
>>>> +        value = !gpio_get_value(KEY_VOL_DOWN_GPIO);
>>>> +        break;
>>>> +    default:
>>>> +        value = 0;
>>>> +        break;
>>>> +    }
>>>> +
>>>> +    return value;
>>>> +}
>>>> +
>>>> +static int check_keys(void)
>>>> +{
>>>> +    int keys = 0;
>>>> +
>>>> +    if (key_pressed(KEY_POWER))
>>>> +        keys += KEY_POWER;
>>>> +    if (key_pressed(KEY_VOLUMEUP))
>>>> +        keys += KEY_VOLUMEUP;
>>>> +    if (key_pressed(KEY_VOLUMEDOWN))
>>>> +        keys += KEY_VOLUMEDOWN;
>>>> +
>>>> +    return keys;
>>>> +}
>>>> +
>>>> +/*
>>>> + * 0 BOOT_MODE_INFO
>>>> + * 1 BOOT_MODE_THOR
>>>> + * 2 BOOT_MODE_UMS
>>>> + * 3 BOOT_MODE_DFU
>>>> + * 4 BOOT_MODE_EXIT
>>>> + */
>>>> +static char *
>>>> +mode_name[BOOT_MODE_EXIT + 1] = {
>>>> +    "DEVICE",
>>>> +    "THOR",
>>>> +    "UMS",
>>>> +    "DFU",
>>>> +    "EXIT"
>>>> +};
>>>> +
>>>> +static char *
>>>> +mode_info[BOOT_MODE_EXIT + 1] = {
>>>> +    "info",
>>>> +    "downloader",
>>>> +    "mass storage",
>>>> +    "firmware update",
>>>> +    "and run normal boot"
>>>> +};
>>>> +
>>>> +#define MODE_CMD_ARGC    4
>>>> +
>>>> +static char *
>>>> +mode_cmd[BOOT_MODE_EXIT + 1][MODE_CMD_ARGC] = {
>>>> +    {"", "", "", ""},
>>>> +    {"thor", "0", "mmc", "0"},
>>>> +    {"ums", "0", "mmc", "0"},
>>>> +    {"dfu", "0", "mmc", "0"},
>>>> +    {"", "", "", ""},
>>>> +};
>>>> +
>>>> +static void display_board_info(void)
>>>> +{
>>>
>>> #ifdef CONFIG_GENERIC_MMC
>
> Did you check this comment also?
>
>>>> +    struct mmc *mmc = find_mmc_device(0);
>>> #endif
>>>
>>>> +    vidinfo_t *vid = &panel_info;
>>>> +
>>>> +    lcd_position_cursor(4, 4);
>>>> +
>>>> +    lcd_printf("%s\n\t", U_BOOT_VERSION);
>>>> +    lcd_puts("\n\t\tBoard Info:\n");
>>>> +#ifdef CONFIG_SYS_BOARD
>>>> +    lcd_printf("\tBoard name: %s\n", CONFIG_SYS_BOARD);
>>>> +#endif
>>>> +#ifdef CONFIG_REVISION_TAG
>>>> +    lcd_printf("\tBoard rev: %u\n", get_board_rev());
>>>> +#endif
>>>> +    lcd_printf("\tDRAM banks: %u\n", CONFIG_NR_DRAM_BANKS);
>>>> +    lcd_printf("\tDRAM size: %u MB\n", gd->ram_size / SZ_1M);
>>>> +
>>>
>>> #ifdef CONFIG_GENERIC_MMC
>
> ditto.
>

Yes, these will apply too.

>>>> +    if (mmc) {
>>>> +        if (!mmc->capacity)
>>>> +            mmc_init(mmc);
>>>> +
>>>> +        lcd_printf("\teMMC size: %llu MB\n", mmc->capacity / SZ_1M);
>>>> +    }
>>> #endif
>>>
>>>> +
>>>> +    if (vid)
>>>> +        lcd_printf("\tDisplay resolution: %u x % u\n",
>>>> +               vid->vl_col, vid->vl_row);
>>>> +
>>>> +    lcd_printf("\tDisplay BPP: %u\n", 1 << vid->vl_bpix);
>>>> +}
>>>> +
>
> Thanks,
> Minkyu Kang.
>

Thank you,
-- 
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com

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

* [U-Boot] [PATCH v5 00/12] Introduce Samsung misc file and LCD menu.
  2013-12-03 18:03 [U-Boot] [PATCH 00/10] Introduce Samsung misc file and LCD menu Przemyslaw Marczak
                   ` (13 preceding siblings ...)
  2014-01-09 11:23 ` [U-Boot] [PATCH v4 00/12] Introduce Samsung misc file and LCD menu Przemyslaw Marczak
@ 2014-01-10 14:31 ` Przemyslaw Marczak
  2014-01-10 14:31   ` [U-Boot] [PATCH v5 01/12] s5p: gpio: change gpio coding method for s5p gpio Przemyslaw Marczak
                     ` (11 more replies)
  2014-01-22 10:24 ` [U-Boot] [PATCH v6 00/11] Introduce Samsung misc file and LCD menu Przemyslaw Marczak
  15 siblings, 12 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-10 14:31 UTC (permalink / raw)
  To: u-boot

This patch set includes changes required to:
- properly use of all gpios
- introduce common file for Samsung misc code
- keys support (PWR, VOL:UP,DOWN)
- console support on LCD
- 16bpp logo support
- introduce LCD menu on Samsung devices

Each version changes are described in each patch commit msg.

Przemyslaw Marczak (12):
  s5p: gpio: change gpio coding method for s5p gpio.
  trats2: Code cleanup.
  samsung: common: Add misc file and common function misc_init_r().
  samsung: misc: move display logo function to misc.c file.
  common: lcd.c: fix data abort exception when try to access bmp header
  lib: tizen: change Tizen logo with the new one.
  video: exynos: fimd: add support for various display color modes
  samsung: boards: update display configs with 16bpp mode.
  samsung: misc: Add LCD download menu.
  Trats: add LCD download menu support
  trats2: add LCD download menu support
  universal: add LCD download menu support

 arch/arm/include/asm/arch-exynos/gpio.h  |  245 +-
 arch/arm/include/asm/arch-s5pc1xx/gpio.h |   47 +-
 board/samsung/common/Makefile            |    1 +
 board/samsung/common/misc.c              |  408 ++
 board/samsung/common/misc.h              |   18 +
 board/samsung/trats/trats.c              |    5 +-
 board/samsung/trats2/trats2.c            |   33 +-
 board/samsung/universal_c210/universal.c |    6 +-
 common/lcd.c                             |   27 +-
 drivers/gpio/s5p_gpio.c                  |   15 +-
 drivers/power/battery/bat_trats2.c       |    2 +-
 drivers/video/exynos_fb.c                |   28 -
 drivers/video/exynos_fimd.c              |   15 +-
 include/configs/s5p_goni.h               |    4 +-
 include/configs/s5pc210_universal.h      |   41 +-
 include/configs/trats.h                  |   33 +-
 include/configs/trats2.h                 |   31 +-
 include/lcd.h                            |    2 +
 include/power/max77686_pmic.h            |    2 +
 include/power/pmic.h                     |    1 -
 lib/tizen/tizen.c                        |   21 +-
 lib/tizen/tizen_hd_logo.h                | 5057 ---------------
 lib/tizen/tizen_hd_logo_data.h           |   15 -
 lib/tizen/tizen_logo_16bpp.h             |10025 ++++++++++++++++++++++++++++++
 lib/tizen/tizen_logo_16bpp_gzip.h        |  727 +++
 25 files changed, 11438 insertions(+), 5371 deletions(-)
 create mode 100644 board/samsung/common/misc.c
 create mode 100644 board/samsung/common/misc.h
 delete mode 100644 lib/tizen/tizen_hd_logo.h
 delete mode 100644 lib/tizen/tizen_hd_logo_data.h
 create mode 100644 lib/tizen/tizen_logo_16bpp.h
 create mode 100644 lib/tizen/tizen_logo_16bpp_gzip.h

-- 
1.7.9.5

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

* [U-Boot] [PATCH v5 01/12] s5p: gpio: change gpio coding method for s5p gpio.
  2014-01-10 14:31 ` [U-Boot] [PATCH v5 " Przemyslaw Marczak
@ 2014-01-10 14:31   ` Przemyslaw Marczak
  2014-01-10 14:31   ` [U-Boot] [PATCH v5 02/12] trats2: Code cleanup Przemyslaw Marczak
                     ` (10 subsequent siblings)
  11 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-10 14:31 UTC (permalink / raw)
  To: u-boot

Old s5p gpio coding method was not clean and was not working properly
for all parts and banks. New method is clean and easy to extend.

Gpio coding mask:
0x000000ff - pin number
0x00ffff00 - bank offset
0xff000000 - part number

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
---
Changes v2:
- none

Changes v3:
- fix merge conflict in arch/arm/include/asm/arch-exynos/gpio.h
- add exynos5420 gpio coding
- update file: board/samsung/trats2/trats2.c

Changes v4:
- code cleanup

Changes v5:
- none

 arch/arm/include/asm/arch-exynos/gpio.h  |  245 +++++++++---------------------
 arch/arm/include/asm/arch-s5pc1xx/gpio.h |   47 ++++--
 board/samsung/trats2/trats2.c            |    8 +-
 drivers/gpio/s5p_gpio.c                  |   15 +-
 include/configs/s5p_goni.h               |    4 +-
 include/configs/s5pc210_universal.h      |   12 +-
 include/configs/trats.h                  |    4 +-
 7 files changed, 132 insertions(+), 203 deletions(-)

diff --git a/arch/arm/include/asm/arch-exynos/gpio.h b/arch/arm/include/asm/arch-exynos/gpio.h
index 2a19852..d6868fa 100644
--- a/arch/arm/include/asm/arch-exynos/gpio.h
+++ b/arch/arm/include/asm/arch-exynos/gpio.h
@@ -247,180 +247,81 @@ void s5p_gpio_set_rate(struct s5p_gpio_bank *bank, int gpio, int mode);
 
 /* GPIO pins per bank  */
 #define GPIO_PER_BANK 8
-
-#define exynos4_gpio_part1_get_nr(bank, pin) \
-	((((((unsigned int) &(((struct exynos4_gpio_part1 *) \
-			       EXYNOS4_GPIO_PART1_BASE)->bank)) \
-	    - EXYNOS4_GPIO_PART1_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin)
-
-#define EXYNOS4_GPIO_PART1_MAX ((sizeof(struct exynos4_gpio_part1) \
-			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
-
-#define exynos4_gpio_part2_get_nr(bank, pin) \
-	(((((((unsigned int) &(((struct exynos4_gpio_part2 *) \
-				EXYNOS4_GPIO_PART2_BASE)->bank)) \
-	    - EXYNOS4_GPIO_PART2_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin) + EXYNOS4_GPIO_PART1_MAX)
-
-#define exynos4x12_gpio_part1_get_nr(bank, pin) \
-	((((((unsigned int) &(((struct exynos4x12_gpio_part1 *) \
-			       EXYNOS4X12_GPIO_PART1_BASE)->bank)) \
-	    - EXYNOS4X12_GPIO_PART1_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin)
-
-#define EXYNOS4X12_GPIO_PART1_MAX ((sizeof(struct exynos4x12_gpio_part1) \
-			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
-
-#define exynos4x12_gpio_part2_get_nr(bank, pin) \
-	(((((((unsigned int) &(((struct exynos4x12_gpio_part2 *) \
-				EXYNOS4X12_GPIO_PART2_BASE)->bank)) \
-	    - EXYNOS4X12_GPIO_PART2_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin) + EXYNOS4X12_GPIO_PART1_MAX)
-
-#define EXYNOS4X12_GPIO_PART2_MAX ((sizeof(struct exynos4x12_gpio_part2) \
-			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
-
-#define exynos4x12_gpio_part3_get_nr(bank, pin) \
-	(((((((unsigned int) &(((struct exynos4x12_gpio_part3 *) \
-				EXYNOS4X12_GPIO_PART3_BASE)->bank)) \
-	    - EXYNOS4X12_GPIO_PART3_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin) + EXYNOS4X12_GPIO_PART2_MAX)
-
-#define exynos5_gpio_part1_get_nr(bank, pin) \
-	((((((unsigned int) &(((struct exynos5_gpio_part1 *) \
-			       EXYNOS5_GPIO_PART1_BASE)->bank)) \
-	    - EXYNOS5_GPIO_PART1_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin)
-
-#define EXYNOS5_GPIO_PART1_MAX ((sizeof(struct exynos5_gpio_part1) \
-			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
-
-#define exynos5_gpio_part2_get_nr(bank, pin) \
-	(((((((unsigned int) &(((struct exynos5_gpio_part2 *) \
-				EXYNOS5_GPIO_PART2_BASE)->bank)) \
-	    - EXYNOS5_GPIO_PART2_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin) + EXYNOS5_GPIO_PART1_MAX)
-
-#define EXYNOS5_GPIO_PART2_MAX ((sizeof(struct exynos5_gpio_part2) \
-			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
-
-#define exynos5_gpio_part3_get_nr(bank, pin) \
-	(((((((unsigned int) &(((struct exynos5_gpio_part3 *) \
-				EXYNOS5_GPIO_PART3_BASE)->bank)) \
-	    - EXYNOS5_GPIO_PART3_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin) + EXYNOS5_GPIO_PART2_MAX)
-
-
-/* EXYNOS5420 */
-#define exynos5420_gpio_part1_get_nr(bank, pin) \
-	((((((unsigned int) &(((struct exynos5420_gpio_part1 *)\
-			       EXYNOS5420_GPIO_PART1_BASE)->bank)) \
-	    - EXYNOS5420_GPIO_PART1_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin)
-
-#define EXYNOS5420_GPIO_PART1_MAX ((sizeof(struct exynos5420_gpio_part1) \
-			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
-
-#define exynos5420_gpio_part2_get_nr(bank, pin) \
-	(((((((unsigned int) &(((struct exynos5420_gpio_part2 *)\
-				EXYNOS5420_GPIO_PART2_BASE)->bank)) \
-	    - EXYNOS5420_GPIO_PART2_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin) + EXYNOS5420_GPIO_PART1_MAX)
-
-#define EXYNOS5420_GPIO_PART2_MAX ((sizeof(struct exynos5420_gpio_part2) \
-			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
-
-#define exynos5420_gpio_part3_get_nr(bank, pin) \
-	(((((((unsigned int) &(((struct exynos5420_gpio_part3 *)\
-				EXYNOS5420_GPIO_PART3_BASE)->bank)) \
-	    - EXYNOS5420_GPIO_PART3_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin) + EXYNOS5420_GPIO_PART2_MAX)
-
-#define EXYNOS5420_GPIO_PART3_MAX ((sizeof(struct exynos5420_gpio_part3) \
-			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
-
-#define exynos5420_gpio_part4_get_nr(bank, pin) \
-	(((((((unsigned int) &(((struct exynos5420_gpio_part4 *)\
-				EXYNOS5420_GPIO_PART4_BASE)->bank)) \
-	    - EXYNOS5420_GPIO_PART4_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin) + EXYNOS5420_GPIO_PART3_MAX)
-
-#define EXYNOS5420_GPIO_PART4_MAX ((sizeof(struct exynos5420_gpio_part4) \
-			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
-
-#define EXYNOS5420_GPIO_PART5_MAX ((sizeof(struct exynos5420_gpio_part5) \
-			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
-
-static inline unsigned int s5p_gpio_base(int nr)
+#define S5P_GPIO_PART_SHIFT	(24)
+#define S5P_GPIO_PART_MASK	(0xff)
+#define S5P_GPIO_BANK_SHIFT	(8)
+#define S5P_GPIO_BANK_MASK	(0xffff)
+#define S5P_GPIO_PIN_MASK	(0xff)
+
+#define S5P_GPIO_SET_PART(x) \
+			(((x) & S5P_GPIO_PART_MASK) << S5P_GPIO_PART_SHIFT)
+
+#define S5P_GPIO_GET_PART(x) \
+			(((x) >> S5P_GPIO_PART_SHIFT) & S5P_GPIO_PART_MASK)
+
+#define S5P_GPIO_SET_PIN(x) \
+			((x) & S5P_GPIO_PIN_MASK)
+
+#define EXYNOS4_GPIO_SET_BANK(part, bank) \
+			((((unsigned)&(((struct exynos4_gpio_part##part *) \
+			EXYNOS4_GPIO_PART##part##_BASE)->bank) \
+			- EXYNOS4_GPIO_PART##part##_BASE) \
+			& S5P_GPIO_BANK_MASK) << S5P_GPIO_BANK_SHIFT)
+
+#define EXYNOS4X12_GPIO_SET_BANK(part, bank) \
+			((((unsigned)&(((struct exynos4x12_gpio_part##part *) \
+			EXYNOS4X12_GPIO_PART##part##_BASE)->bank) \
+			- EXYNOS4X12_GPIO_PART##part##_BASE) \
+			& S5P_GPIO_BANK_MASK) << S5P_GPIO_BANK_SHIFT)
+
+#define EXYNOS5_GPIO_SET_BANK(part, bank) \
+			((((unsigned)&(((struct exynos5420_gpio_part##part *) \
+			EXYNOS5420_GPIO_PART##part##_BASE)->bank) \
+			- EXYNOS5_GPIO_PART##part##_BASE) \
+			& S5P_GPIO_BANK_MASK) << S5P_GPIO_BANK_SHIFT)
+
+#define EXYNOS5420_GPIO_SET_BANK(part, bank) \
+			((((unsigned)&(((struct exynos5420_gpio_part##part *) \
+			EXYNOS5420_GPIO_PART##part##_BASE)->bank) \
+			- EXYNOS5420_GPIO_PART##part##_BASE) \
+			& S5P_GPIO_BANK_MASK) << S5P_GPIO_BANK_SHIFT)
+
+#define exynos4_gpio_get(part, bank, pin) \
+			(S5P_GPIO_SET_PART(part) | \
+			EXYNOS4_GPIO_SET_BANK(part, bank) | \
+			S5P_GPIO_SET_PIN(pin))
+
+#define exynos4x12_gpio_get(part, bank, pin) \
+			(S5P_GPIO_SET_PART(part) | \
+			EXYNOS4X12_GPIO_SET_BANK(part, bank) | \
+			S5P_GPIO_SET_PIN(pin))
+
+#define exynos5420_gpio_get(part, bank, pin) \
+			(S5P_GPIO_SET_PART(part) | \
+			EXYNOS5420_GPIO_SET_BANK(part, bank) | \
+			S5P_GPIO_SET_PIN(pin))
+
+#define exynos5_gpio_get(part, bank, pin) \
+			(S5P_GPIO_SET_PART(part) | \
+			EXYNOS5_GPIO_SET_BANK(part, bank) | \
+			S5P_GPIO_SET_PIN(pin))
+
+static inline unsigned int s5p_gpio_base(int gpio)
 {
-	if (cpu_is_exynos5()) {
-		if (proid_is_exynos5420()) {
-			if (nr < EXYNOS5420_GPIO_PART1_MAX)
-				return EXYNOS5420_GPIO_PART1_BASE;
-			else if (nr < EXYNOS5420_GPIO_PART2_MAX)
-				return EXYNOS5420_GPIO_PART2_BASE;
-			else if (nr < EXYNOS5420_GPIO_PART3_MAX)
-				return EXYNOS5420_GPIO_PART3_BASE;
-			else
-				return EXYNOS5420_GPIO_PART4_BASE;
-		} else {
-			if (nr < EXYNOS5_GPIO_PART1_MAX)
-				return EXYNOS5_GPIO_PART1_BASE;
-			else if (nr < EXYNOS5_GPIO_PART2_MAX)
-				return EXYNOS5_GPIO_PART2_BASE;
-			else
-				return EXYNOS5_GPIO_PART3_BASE;
-		}
-	} else if (cpu_is_exynos4()) {
-		if (nr < EXYNOS4_GPIO_PART1_MAX)
-			return EXYNOS4_GPIO_PART1_BASE;
-		else
-			return EXYNOS4_GPIO_PART2_BASE;
+	unsigned gpio_part = S5P_GPIO_GET_PART(gpio);
+
+	switch (gpio_part) {
+	case 1:
+		return samsung_get_base_gpio_part1();
+	case 2:
+		return samsung_get_base_gpio_part2();
+	case 3:
+		return samsung_get_base_gpio_part3();
+	case 4:
+		return samsung_get_base_gpio_part4();
+	default:
+		return 0;
 	}
-
-	return 0;
-}
-
-static inline unsigned int s5p_gpio_part_max(int nr)
-{
-	if (cpu_is_exynos5()) {
-		if (proid_is_exynos5420()) {
-			if (nr < EXYNOS5420_GPIO_PART1_MAX)
-				return 0;
-			else if (nr < EXYNOS5420_GPIO_PART2_MAX)
-				return EXYNOS5420_GPIO_PART1_MAX;
-			else if (nr < EXYNOS5420_GPIO_PART3_MAX)
-				return EXYNOS5420_GPIO_PART2_MAX;
-			else if (nr < EXYNOS5420_GPIO_PART4_MAX)
-				return EXYNOS5420_GPIO_PART3_MAX;
-			else
-				return EXYNOS5420_GPIO_PART4_MAX;
-		} else {
-			if (nr < EXYNOS5_GPIO_PART1_MAX)
-				return 0;
-			else if (nr < EXYNOS5_GPIO_PART2_MAX)
-				return EXYNOS5_GPIO_PART1_MAX;
-			else
-				return EXYNOS5_GPIO_PART2_MAX;
-		}
-	} else if (cpu_is_exynos4()) {
-		if (proid_is_exynos4412()) {
-			if (nr < EXYNOS4X12_GPIO_PART1_MAX)
-				return 0;
-			else if (nr < EXYNOS4X12_GPIO_PART2_MAX)
-				return EXYNOS4X12_GPIO_PART1_MAX;
-			else
-				return EXYNOS4X12_GPIO_PART2_MAX;
-		} else {
-			if (nr < EXYNOS4_GPIO_PART1_MAX)
-				return 0;
-			else
-				return EXYNOS4_GPIO_PART1_MAX;
-		}
-	}
-
-	return 0;
 }
 #endif
 
diff --git a/arch/arm/include/asm/arch-s5pc1xx/gpio.h b/arch/arm/include/asm/arch-s5pc1xx/gpio.h
index ac60fe6..da8df74 100644
--- a/arch/arm/include/asm/arch-s5pc1xx/gpio.h
+++ b/arch/arm/include/asm/arch-s5pc1xx/gpio.h
@@ -125,20 +125,45 @@ void s5p_gpio_set_rate(struct s5p_gpio_bank *bank, int gpio, int mode);
 /* GPIO pins per bank  */
 #define GPIO_PER_BANK 8
 
-static inline unsigned int s5p_gpio_base(int nr)
-{
-	return S5PC110_GPIO_BASE;
-}
+#define S5P_GPIO_PART_SHIFT	(24)
+#define S5P_GPIO_PART_MASK	(0xff)
+#define S5P_GPIO_BANK_SHIFT	(8)
+#define S5P_GPIO_BANK_MASK	(0xffff)
+#define S5P_GPIO_PIN_MASK	(0xff)
+
+#define S5P_GPIO_SET_PART(x) \
+			(((x) & S5P_GPIO_PART_MASK) << S5P_GPIO_PART_SHIFT)
+
+#define S5P_GPIO_GET_PART(x) \
+			(((x) >> S5P_GPIO_PART_SHIFT) & S5P_GPIO_PART_MASK)
+
+#define S5P_GPIO_SET_PIN(x) \
+			((x) & S5P_GPIO_PIN_MASK)
 
-static inline unsigned int s5p_gpio_part_max(int nr)
+#define S5PC100_SET_BANK(bank) \
+			(((unsigned)&(((struct s5pc100_gpio *) \
+			S5PC100_GPIO_BASE)->bank) - S5PC100_GPIO_BASE) \
+			& S5P_GPIO_BANK_MASK) << S5P_GPIO_BANK_SHIFT)
+
+#define S5PC110_SET_BANK(bank) \
+			((((unsigned)&(((struct s5pc110_gpio *) \
+			S5PC110_GPIO_BASE)->bank) - S5PC110_GPIO_BASE) \
+			& S5P_GPIO_BANK_MASK) << S5P_GPIO_BANK_SHIFT)
+
+#define s5pc100_gpio_get(bank, pin) \
+			(S5P_GPIO_SET_PART(0) | \
+			S5PC100_SET_BANK(bank) | \
+			S5P_GPIO_SET_PIN(pin))
+
+#define s5pc110_gpio_get(bank, pin) \
+			(S5P_GPIO_SET_PART(0) | \
+			S5PC110_SET_BANK(bank) | \
+			S5P_GPIO_SET_PIN(pin))
+
+static inline unsigned int s5p_gpio_base(int nr)
 {
-	return 0;
+	return samsung_get_base_gpio();
 }
-
-#define s5pc110_gpio_get_nr(bank, pin)	  \
-	((((((unsigned int)&(((struct s5pc110_gpio *)S5PC110_GPIO_BASE)->bank))\
-	    - S5PC110_GPIO_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin)
 #endif
 
 /* Pin configurations */
diff --git a/board/samsung/trats2/trats2.c b/board/samsung/trats2/trats2.c
index be15357..1e96fdc 100644
--- a/board/samsung/trats2/trats2.c
+++ b/board/samsung/trats2/trats2.c
@@ -144,17 +144,17 @@ static void board_init_i2c(void)
 int get_soft_i2c_scl_pin(void)
 {
 	if (I2C_ADAP_HWNR)
-		return exynos4x12_gpio_part2_get_nr(m2, 1); /* I2C9 */
+		return exynos4x12_gpio_get(2, m2, 1); /* I2C9 */
 	else
-		return exynos4x12_gpio_part1_get_nr(f1, 4); /* I2C8 */
+		return exynos4x12_gpio_get(1, f1, 4); /* I2C8 */
 }
 
 int get_soft_i2c_sda_pin(void)
 {
 	if (I2C_ADAP_HWNR)
-		return exynos4x12_gpio_part2_get_nr(m2, 0); /* I2C9 */
+		return exynos4x12_gpio_get(2, m2, 0); /* I2C9 */
 	else
-		return exynos4x12_gpio_part1_get_nr(f1, 5); /* I2C8 */
+		return exynos4x12_gpio_get(1, f1, 5); /* I2C8 */
 }
 #endif
 
diff --git a/drivers/gpio/s5p_gpio.c b/drivers/gpio/s5p_gpio.c
index 7eeb96d..11a0472 100644
--- a/drivers/gpio/s5p_gpio.c
+++ b/drivers/gpio/s5p_gpio.c
@@ -9,6 +9,11 @@
 #include <asm/io.h>
 #include <asm/gpio.h>
 
+#define S5P_GPIO_GET_BANK(x)	((x >> S5P_GPIO_BANK_SHIFT) \
+				& S5P_GPIO_BANK_MASK)
+
+#define S5P_GPIO_GET_PIN(x)	(x & S5P_GPIO_PIN_MASK)
+
 #define CON_MASK(x)		(0xf << ((x) << 2))
 #define CON_SFR(x, v)		((v) << ((x) << 2))
 
@@ -124,17 +129,15 @@ void s5p_gpio_set_rate(struct s5p_gpio_bank *bank, int gpio, int mode)
 
 struct s5p_gpio_bank *s5p_gpio_get_bank(unsigned gpio)
 {
-	int bank;
-	unsigned g = gpio - s5p_gpio_part_max(gpio);
+	unsigned bank = S5P_GPIO_GET_BANK(gpio);
+	unsigned base = s5p_gpio_base(gpio);
 
-	bank = g / GPIO_PER_BANK;
-	bank *= sizeof(struct s5p_gpio_bank);
-	return (struct s5p_gpio_bank *) (s5p_gpio_base(gpio) + bank);
+	return (struct s5p_gpio_bank *)(base + bank);
 }
 
 int s5p_gpio_get_pin(unsigned gpio)
 {
-	return gpio % GPIO_PER_BANK;
+	return S5P_GPIO_GET_PIN(gpio);
 }
 
 /* Common GPIO API */
diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
index 0590d20..4cdf937 100644
--- a/include/configs/s5p_goni.h
+++ b/include/configs/s5p_goni.h
@@ -208,8 +208,8 @@
 /*
  * I2C Settings
  */
-#define CONFIG_SOFT_I2C_GPIO_SCL s5pc110_gpio_get_nr(j4, 3)
-#define CONFIG_SOFT_I2C_GPIO_SDA s5pc110_gpio_get_nr(j4, 0)
+#define CONFIG_SOFT_I2C_GPIO_SCL s5pc110_gpio_get(j4, 3)
+#define CONFIG_SOFT_I2C_GPIO_SDA s5pc110_gpio_get(j4, 0)
 
 #define CONFIG_SYS_I2C
 #define CONFIG_SYS_I2C_SOFT		/* I2C bit-banged */
diff --git a/include/configs/s5pc210_universal.h b/include/configs/s5pc210_universal.h
index d9e4c56..02a1c99 100644
--- a/include/configs/s5pc210_universal.h
+++ b/include/configs/s5pc210_universal.h
@@ -229,8 +229,8 @@
 /*
  * I2C Settings
  */
-#define CONFIG_SOFT_I2C_GPIO_SCL exynos4_gpio_part1_get_nr(b, 7)
-#define CONFIG_SOFT_I2C_GPIO_SDA exynos4_gpio_part1_get_nr(b, 6)
+#define CONFIG_SOFT_I2C_GPIO_SCL exynos4_gpio_get(1, b, 7)
+#define CONFIG_SOFT_I2C_GPIO_SDA exynos4_gpio_get(1, b, 6)
 
 #define CONFIG_SYS_I2C
 #define CONFIG_SYS_I2C_SOFT		/* I2C bit-banged */
@@ -253,10 +253,10 @@
  */
 #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 CONFIG_SOFT_SPI_GPIO_SCLK exynos4_gpio_get(2, y3, 1)
+#define CONFIG_SOFT_SPI_GPIO_MOSI exynos4_gpio_get(2, y3, 3)
+#define CONFIG_SOFT_SPI_GPIO_MISO exynos4_gpio_get(2, y3, 0)
+#define CONFIG_SOFT_SPI_GPIO_CS exynos4_gpio_get(2, y4, 3)
 
 #define SPI_DELAY udelay(1)
 #undef SPI_INIT
diff --git a/include/configs/trats.h b/include/configs/trats.h
index 0877142..9727f7a 100644
--- a/include/configs/trats.h
+++ b/include/configs/trats.h
@@ -282,8 +282,8 @@
 #include <asm/arch/gpio.h>
 
 /* I2C FG */
-#define CONFIG_SOFT_I2C_GPIO_SCL exynos4_gpio_part2_get_nr(y4, 1)
-#define CONFIG_SOFT_I2C_GPIO_SDA exynos4_gpio_part2_get_nr(y4, 0)
+#define CONFIG_SOFT_I2C_GPIO_SCL exynos4_gpio_get(2, y4, 1)
+#define CONFIG_SOFT_I2C_GPIO_SDA exynos4_gpio_get(2, y4, 0)
 
 #define CONFIG_POWER
 #define CONFIG_POWER_I2C
-- 
1.7.9.5

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

* [U-Boot] [PATCH v5 02/12] trats2: Code cleanup.
  2014-01-10 14:31 ` [U-Boot] [PATCH v5 " Przemyslaw Marczak
  2014-01-10 14:31   ` [U-Boot] [PATCH v5 01/12] s5p: gpio: change gpio coding method for s5p gpio Przemyslaw Marczak
@ 2014-01-10 14:31   ` Przemyslaw Marczak
  2014-01-10 14:31   ` [U-Boot] [PATCH v5 03/12] samsung: common: Add misc file and common function misc_init_r() Przemyslaw Marczak
                     ` (9 subsequent siblings)
  11 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-10 14:31 UTC (permalink / raw)
  To: u-boot

Remove wrong and unused env variables
Trats2 is not as GT-I8800.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
Cc: Piotr Wilczek <p.wilczek@samsung.com>
---
Changes v2:
- none

Changes v3:
- none

Changes v4:
- add "include pmic.h" to "max77686_pmic.h"

Changes v5:
- add acked-by

 board/samsung/trats2/trats2.c      |   19 ++-----------------
 drivers/power/battery/bat_trats2.c |    2 +-
 include/configs/trats2.h           |    1 -
 include/power/max77686_pmic.h      |    2 ++
 4 files changed, 5 insertions(+), 19 deletions(-)

diff --git a/board/samsung/trats2/trats2.c b/board/samsung/trats2/trats2.c
index 1e96fdc..b4ccf51 100644
--- a/board/samsung/trats2/trats2.c
+++ b/board/samsung/trats2/trats2.c
@@ -72,15 +72,12 @@ static void check_hw_revision(void)
 int checkboard(void)
 {
 	puts("Board:\tTRATS2\n");
+	printf("HW Revision:\t0x%04x\n", board_rev);
+
 	return 0;
 }
 #endif
 
-static void show_hw_revision(void)
-{
-	printf("HW Revision:\t0x%04x\n", board_rev);
-}
-
 u32 get_board_rev(void)
 {
 	return board_rev;
@@ -614,15 +611,3 @@ void init_panel_info(vidinfo_t *vid)
 	exynos_set_dsim_platform_data(&dsim_platform_data);
 }
 #endif /* LCD */
-
-#ifdef CONFIG_MISC_INIT_R
-int misc_init_r(void)
-{
-	setenv("model", "GT-I8800");
-	setenv("board", "TRATS2");
-
-	show_hw_revision();
-
-	return 0;
-}
-#endif
diff --git a/drivers/power/battery/bat_trats2.c b/drivers/power/battery/bat_trats2.c
index f264832..94015aa 100644
--- a/drivers/power/battery/bat_trats2.c
+++ b/drivers/power/battery/bat_trats2.c
@@ -8,7 +8,7 @@
 #include <common.h>
 #include <power/pmic.h>
 #include <power/battery.h>
-#include <power/max8997_pmic.h>
+#include <power/max77693_pmic.h>
 #include <errno.h>
 
 static struct battery battery_trats;
diff --git a/include/configs/trats2.h b/include/configs/trats2.h
index c9ce828..7dfbe98 100644
--- a/include/configs/trats2.h
+++ b/include/configs/trats2.h
@@ -272,7 +272,6 @@
 #define CONFIG_EFI_PARTITION
 #define CONFIG_PARTITION_UUIDS
 
-#define CONFIG_MISC_INIT_R
 #define CONFIG_BOARD_EARLY_INIT_F
 
 /* I2C */
diff --git a/include/power/max77686_pmic.h b/include/power/max77686_pmic.h
index 16e9016..c2a772a 100644
--- a/include/power/max77686_pmic.h
+++ b/include/power/max77686_pmic.h
@@ -8,6 +8,8 @@
 #ifndef __MAX77686_H_
 #define __MAX77686_H_
 
+#include <power/pmic.h>
+
 enum {
 	MAX77686_REG_PMIC_ID		= 0x0,
 	MAX77686_REG_PMIC_INTSRC,
-- 
1.7.9.5

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

* [U-Boot] [PATCH v5 03/12] samsung: common: Add misc file and common function misc_init_r().
  2014-01-10 14:31 ` [U-Boot] [PATCH v5 " Przemyslaw Marczak
  2014-01-10 14:31   ` [U-Boot] [PATCH v5 01/12] s5p: gpio: change gpio coding method for s5p gpio Przemyslaw Marczak
  2014-01-10 14:31   ` [U-Boot] [PATCH v5 02/12] trats2: Code cleanup Przemyslaw Marczak
@ 2014-01-10 14:31   ` Przemyslaw Marczak
  2014-01-14 13:55     ` Przemyslaw Marczak
  2014-01-10 14:31   ` [U-Boot] [PATCH v5 04/12] samsung: misc: move display logo function to misc.c file Przemyslaw Marczak
                     ` (8 subsequent siblings)
  11 siblings, 1 reply; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-10 14:31 UTC (permalink / raw)
  To: u-boot

Config: CONFIG_MISC_INIT_R enables implementation of misc_init_r()
in common file::
- board/samsung/common/misc.c

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
---
Changes v2:
- change CONFIG_SAMSUNG to CONFIG_MISC_INIT_R

Changes v3:
- fix merge conflict in board/samsung/common/Makefile

Changes v4:
- none

Changes v5:
- add acked-by

 board/samsung/common/Makefile |    1 +
 board/samsung/common/misc.c   |   14 ++++++++++++++
 2 files changed, 15 insertions(+)
 create mode 100644 board/samsung/common/misc.c

diff --git a/board/samsung/common/Makefile b/board/samsung/common/Makefile
index 22bd6b1..79547a3 100644
--- a/board/samsung/common/Makefile
+++ b/board/samsung/common/Makefile
@@ -8,6 +8,7 @@
 obj-$(CONFIG_SOFT_I2C_MULTI_BUS) += multi_i2c.o
 obj-$(CONFIG_THOR_FUNCTION) += thor.o
 obj-$(CONFIG_CMD_USB_MASS_STORAGE) += ums.o
+obj-$(CONFIG_MISC_INIT_R) += misc.o
 
 ifndef CONFIG_SPL_BUILD
 obj-$(CONFIG_BOARD_COMMON)	+= board.o
diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
new file mode 100644
index 0000000..3764d12
--- /dev/null
+++ b/board/samsung/common/misc.c
@@ -0,0 +1,14 @@
+/*
+ * Copyright (C) 2013 Samsung Electronics
+ * Przemyslaw Marczak <p.marczak@samsung.com>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+
+/* Common for Samsung boards */
+int misc_init_r(void)
+{
+	return 0;
+}
-- 
1.7.9.5

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

* [U-Boot] [PATCH v5 04/12] samsung: misc: move display logo function to misc.c file.
  2014-01-10 14:31 ` [U-Boot] [PATCH v5 " Przemyslaw Marczak
                     ` (2 preceding siblings ...)
  2014-01-10 14:31   ` [U-Boot] [PATCH v5 03/12] samsung: common: Add misc file and common function misc_init_r() Przemyslaw Marczak
@ 2014-01-10 14:31   ` Przemyslaw Marczak
  2014-01-14  3:41     ` Jaehoon Chung
  2014-01-10 14:31   ` [U-Boot] [PATCH v5 05/12] common: lcd.c: fix data abort exception when try to access bmp header Przemyslaw Marczak
                     ` (7 subsequent siblings)
  11 siblings, 1 reply; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-10 14:31 UTC (permalink / raw)
  To: u-boot

board/samsung/common/misc.c:
- move draw_logo() function from exynos_fb.c
- add get_tizen_logo_info() function call removed from board files

boards:
- update board files
- add CONFIG_MISC_INIT_R to Universal, Trats and Trats2

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Tested-by: Hyungwon Hwang <human.hwang@samsung.com>
---
changes v2:
- configs cleanup
- add check logo address before display

Changes v3:
- none

Changes v4:
- none

Changes v5:
- none

 board/samsung/common/misc.c              |   42 ++++++++++++++++++++++++++++++
 board/samsung/trats/trats.c              |    3 ---
 board/samsung/trats2/trats2.c            |    4 ---
 board/samsung/universal_c210/universal.c |    4 ---
 drivers/video/exynos_fb.c                |   28 --------------------
 include/configs/s5pc210_universal.h      |    3 +++
 include/configs/trats.h                  |    3 +++
 include/configs/trats2.h                 |    3 +++
 8 files changed, 51 insertions(+), 39 deletions(-)

diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
index 3764d12..6188e29 100644
--- a/board/samsung/common/misc.c
+++ b/board/samsung/common/misc.c
@@ -6,9 +6,51 @@
  */
 
 #include <common.h>
+#include <lcd.h>
+#include <libtizen.h>
+
+#ifdef CONFIG_CMD_BMP
+static void draw_logo(void)
+{
+	int x, y;
+	ulong addr;
+
+#ifdef CONFIG_TIZEN
+	get_tizen_logo_info(&panel_info);
+#else
+	return;
+#endif
+
+	addr = panel_info.logo_addr;
+	if (!addr) {
+		error("There is no logo data.");
+		return;
+	}
+
+	if (panel_info.vl_width >= panel_info.logo_width) {
+		x = ((panel_info.vl_width - panel_info.logo_width) >> 1);
+	} else {
+		x = 0;
+		printf("Warning: image width is bigger than display width\n");
+	}
+
+	if (panel_info.vl_height >= panel_info.logo_height) {
+		y = ((panel_info.vl_height - panel_info.logo_height) >> 1);
+	} else {
+		y = 0;
+		printf("Warning: image height is bigger than display height\n");
+	}
+
+	bmp_display(addr, x, y);
+}
+#endif /* CONFIG_CMD_BMP */
 
 /* Common for Samsung boards */
 int misc_init_r(void)
 {
+#ifdef CONFIG_CMD_BMP
+	if (panel_info.logo_on)
+		draw_logo();
+#endif
 	return 0;
 }
diff --git a/board/samsung/trats/trats.c b/board/samsung/trats/trats.c
index 640a193..cd27f18 100644
--- a/board/samsung/trats/trats.c
+++ b/board/samsung/trats/trats.c
@@ -770,9 +770,6 @@ void init_panel_info(vidinfo_t *vid)
 	vid->resolution	= HD_RESOLUTION,
 	vid->rgb_mode	= MODE_RGB_P,
 
-#ifdef CONFIG_TIZEN
-	get_tizen_logo_info(vid);
-#endif
 	mipi_lcd_device.reverse_panel = 1;
 
 	strcpy(s6e8ax0_platform_data.lcd_panel_name, mipi_lcd_device.name);
diff --git a/board/samsung/trats2/trats2.c b/board/samsung/trats2/trats2.c
index b4ccf51..9a2c212 100644
--- a/board/samsung/trats2/trats2.c
+++ b/board/samsung/trats2/trats2.c
@@ -596,10 +596,6 @@ void init_panel_info(vidinfo_t *vid)
 
 	mipi_lcd_device.reverse_panel = 1;
 
-#ifdef CONFIG_TIZEN
-	get_tizen_logo_info(vid);
-#endif
-
 	strcpy(dsim_platform_data.lcd_panel_name, mipi_lcd_device.name);
 	dsim_platform_data.mipi_power = mipi_power;
 	dsim_platform_data.phy_enable = set_mipi_phy_ctrl;
diff --git a/board/samsung/universal_c210/universal.c b/board/samsung/universal_c210/universal.c
index 54d0e1e..166d5ee 100644
--- a/board/samsung/universal_c210/universal.c
+++ b/board/samsung/universal_c210/universal.c
@@ -484,10 +484,6 @@ void init_panel_info(vidinfo_t *vid)
 	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;
diff --git a/drivers/video/exynos_fb.c b/drivers/video/exynos_fb.c
index 7d4c6e0..00a0a11 100644
--- a/drivers/video/exynos_fb.c
+++ b/drivers/video/exynos_fb.c
@@ -62,31 +62,6 @@ static void exynos_lcd_init(vidinfo_t *vid)
 	lcd_set_flush_dcache(1);
 }
 
-#ifdef CONFIG_CMD_BMP
-static void draw_logo(void)
-{
-	int x, y;
-	ulong addr;
-
-	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);
-}
-#endif
-
 void __exynos_cfg_lcd_gpio(void)
 {
 }
@@ -323,9 +298,6 @@ void lcd_enable(void)
 	if (panel_info.logo_on) {
 		memset((void *) gd->fb_base, 0, panel_width * panel_height *
 				(NBITS(panel_info.vl_bpix) >> 3));
-#ifdef CONFIG_CMD_BMP
-		draw_logo();
-#endif
 	}
 
 	lcd_panel_on(&panel_info);
diff --git a/include/configs/s5pc210_universal.h b/include/configs/s5pc210_universal.h
index 02a1c99..8a749f2 100644
--- a/include/configs/s5pc210_universal.h
+++ b/include/configs/s5pc210_universal.h
@@ -269,6 +269,9 @@ void universal_spi_sda(int bit);
 int universal_spi_read(void);
 #endif
 
+/* Common misc for Samsung */
+#define CONFIG_MISC_INIT_R
+
 /*
  * LCD Settings
  */
diff --git a/include/configs/trats.h b/include/configs/trats.h
index 9727f7a..1a75bb3 100644
--- a/include/configs/trats.h
+++ b/include/configs/trats.h
@@ -301,6 +301,9 @@
 #define CONFIG_USB_GADGET_VBUS_DRAW	2
 #define CONFIG_USB_CABLE_CHECK
 
+/* Common misc for Samsung */
+#define CONFIG_MISC_INIT_R
+
 /* LCD */
 #define CONFIG_EXYNOS_FB
 #define CONFIG_LCD
diff --git a/include/configs/trats2.h b/include/configs/trats2.h
index 7dfbe98..e54fe52 100644
--- a/include/configs/trats2.h
+++ b/include/configs/trats2.h
@@ -312,6 +312,9 @@ int get_soft_i2c_sda_pin(void);
 #define CONFIG_USB_GADGET_VBUS_DRAW	2
 #define CONFIG_USB_CABLE_CHECK
 
+/* Common misc for Samsung */
+#define CONFIG_MISC_INIT_R
+
 /* LCD */
 #define CONFIG_EXYNOS_FB
 #define CONFIG_LCD
-- 
1.7.9.5

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

* [U-Boot] [PATCH v5 05/12] common: lcd.c: fix data abort exception when try to access bmp header
  2014-01-10 14:31 ` [U-Boot] [PATCH v5 " Przemyslaw Marczak
                     ` (3 preceding siblings ...)
  2014-01-10 14:31   ` [U-Boot] [PATCH v5 04/12] samsung: misc: move display logo function to misc.c file Przemyslaw Marczak
@ 2014-01-10 14:31   ` Przemyslaw Marczak
  2014-01-10 14:32   ` [U-Boot] [PATCH v5 06/12] lib: tizen: change Tizen logo with the new one Przemyslaw Marczak
                     ` (6 subsequent siblings)
  11 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-10 14:31 UTC (permalink / raw)
  To: u-boot

Changes:
- le16_to_cpu() to get_unaligned_le16()
- le32_to_cpu() to get_unaligned_le32()
when access fields in struct bmp header.

This changes avoids data abort exception caused by unaligned data access.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Anatolij Gustschin <agust@denx.de>
---
Changes v2:
- new patch

Changes v3:
- common/Makefile - remove CFLAG: -mno-unaligned-access
- common/lcd.c - fix data abort exception when access bmp_header

Changes v4:
- add Acked-by

Changes v5:
- none

 common/lcd.c |   27 +++++++++++++--------------
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/common/lcd.c b/common/lcd.c
index 56bf067..aa81522 100644
--- a/common/lcd.c
+++ b/common/lcd.c
@@ -26,7 +26,7 @@
 #endif
 #include <lcd.h>
 #include <watchdog.h>
-
+#include <asm/unaligned.h>
 #include <splash.h>
 
 #if defined(CONFIG_CPU_PXA25X) || defined(CONFIG_CPU_PXA27X) || \
@@ -777,9 +777,9 @@ static void lcd_display_rle8_bitmap(bmp_image_t *bmp, ushort *cmap, uchar *fb,
 	int x, y;
 	int decode = 1;
 
-	width = le32_to_cpu(bmp->header.width);
-	height = le32_to_cpu(bmp->header.height);
-	bmap = (uchar *)bmp + le32_to_cpu(bmp->header.data_offset);
+	width = get_unaligned_le32(&bmp->header.width);
+	height = get_unaligned_le32(&bmp->header.height);
+	bmap = (uchar *)bmp + get_unaligned_le32(&bmp->header.data_offset);
 
 	x = 0;
 	y = height - 1;
@@ -900,9 +900,10 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
 		return 1;
 	}
 
-	width = le32_to_cpu(bmp->header.width);
-	height = le32_to_cpu(bmp->header.height);
-	bmp_bpix = le16_to_cpu(bmp->header.bit_count);
+	width = get_unaligned_le32(&bmp->header.width);
+	height = get_unaligned_le32(&bmp->header.height);
+	bmp_bpix = get_unaligned_le16(&bmp->header.bit_count);
+
 	colors = 1 << bmp_bpix;
 
 	bpix = NBITS(panel_info.vl_bpix);
@@ -917,9 +918,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
 	/* We support displaying 8bpp BMPs on 16bpp LCDs */
 	if (bpix != bmp_bpix && !(bmp_bpix == 8 && bpix == 16)) {
 		printf ("Error: %d bit/pixel mode, but BMP has %d bit/pixel\n",
-			bpix,
-			le16_to_cpu(bmp->header.bit_count));
-
+			bpix, get_unaligned_le16(&bmp->header.bit_count));
 		return 1;
 	}
 
@@ -956,7 +955,6 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
 		}
 	}
 #endif
-
 	/*
 	 *  BMP format for Monochrome assumes that the state of a
 	 * pixel is described on a per Bit basis, not per Byte.
@@ -987,15 +985,16 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
 	if ((y + height) > panel_info.vl_row)
 		height = panel_info.vl_row - y;
 
-	bmap = (uchar *) bmp + le32_to_cpu(bmp->header.data_offset);
-	fb   = (uchar *) (lcd_base +
+	bmap = (uchar *)bmp + get_unaligned_le32(&bmp->header.data_offset);
+	fb   = (uchar *)(lcd_base +
 		(y + height - 1) * lcd_line_length + x * bpix / 8);
 
 	switch (bmp_bpix) {
 	case 1: /* pass through */
 	case 8:
 #ifdef CONFIG_LCD_BMP_RLE8
-		if (le32_to_cpu(bmp->header.compression) == BMP_BI_RLE8) {
+		u32 compression = get_unaligned_le32(&bmp->header.compression);
+		if (compression == BMP_BI_RLE8) {
 			if (bpix != 16) {
 				/* TODO implement render code for bpix != 16 */
 				printf("Error: only support 16 bpix");
-- 
1.7.9.5

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

* [U-Boot] [PATCH v5 06/12] lib: tizen: change Tizen logo with the new one.
  2014-01-10 14:31 ` [U-Boot] [PATCH v5 " Przemyslaw Marczak
                     ` (4 preceding siblings ...)
  2014-01-10 14:31   ` [U-Boot] [PATCH v5 05/12] common: lcd.c: fix data abort exception when try to access bmp header Przemyslaw Marczak
@ 2014-01-10 14:32   ` Przemyslaw Marczak
  2014-01-10 14:32   ` [U-Boot] [PATCH v5 07/12] video: exynos: fimd: add support for various display color modes Przemyslaw Marczak
                     ` (5 subsequent siblings)
  11 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-10 14:32 UTC (permalink / raw)
  To: u-boot

This is big size patch. PLease follow the link:
http://www.denx.de/wiki/pub/U-Boot/TooBigPatches/0006-lib-tizen-change-Tizen-logo.patch

-- 
1.7.9.5

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

* [U-Boot] [PATCH v5 07/12] video: exynos: fimd: add support for various display color modes
  2014-01-10 14:31 ` [U-Boot] [PATCH v5 " Przemyslaw Marczak
                     ` (5 preceding siblings ...)
  2014-01-10 14:32   ` [U-Boot] [PATCH v5 06/12] lib: tizen: change Tizen logo with the new one Przemyslaw Marczak
@ 2014-01-10 14:32   ` Przemyslaw Marczak
  2014-01-10 14:32   ` [U-Boot] [PATCH v5 08/12] samsung: boards: update display configs with 16bpp mode Przemyslaw Marczak
                     ` (4 subsequent siblings)
  11 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-10 14:32 UTC (permalink / raw)
  To: u-boot

Now fimd BPP color mode depends on vl_bpp value in struct "panel_info".

There is only 16BPP mode check, default mode is 24BPP.
Other fimd modes are usually unneeded and also needs some fimd driver
modifications and tests.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
---
Changes v2:
- check panel_info vl_bpix when setting fimd color mode
- move boards configs update to another commit.

Changes v3:
- none

Changes v4:
- none

Changes v5:
- none

 drivers/video/exynos_fimd.c |   15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/video/exynos_fimd.c b/drivers/video/exynos_fimd.c
index f962c4f..cebbba7 100644
--- a/drivers/video/exynos_fimd.c
+++ b/drivers/video/exynos_fimd.c
@@ -73,18 +73,19 @@ static void exynos_fimd_set_par(unsigned int win_id)
 	/* DATAPATH is DMA */
 	cfg |= EXYNOS_WINCON_DATAPATH_DMA;
 
-	if (pvid->logo_on) /* To get proprietary LOGO */
-		cfg |= EXYNOS_WINCON_WSWP_ENABLE;
-	else /* To get output console on LCD */
-		cfg |= EXYNOS_WINCON_HAWSWP_ENABLE;
+	cfg |= EXYNOS_WINCON_HAWSWP_ENABLE;
 
 	/* dma burst is 16 */
 	cfg |= EXYNOS_WINCON_BURSTLEN_16WORD;
 
-	if (pvid->logo_on) /* To get proprietary LOGO */
-		cfg |= EXYNOS_WINCON_BPPMODE_24BPP_888;
-	else /* To get output console on LCD */
+	switch (pvid->vl_bpix) {
+	case 4:
 		cfg |= EXYNOS_WINCON_BPPMODE_16BPP_565;
+		break;
+	default:
+		cfg |= EXYNOS_WINCON_BPPMODE_24BPP_888;
+		break;
+	}
 
 	writel(cfg, (unsigned int)&fimd_ctrl->wincon0 +
 			EXYNOS_WINCON(win_id));
-- 
1.7.9.5

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

* [U-Boot] [PATCH v5 08/12] samsung: boards: update display configs with 16bpp mode.
  2014-01-10 14:31 ` [U-Boot] [PATCH v5 " Przemyslaw Marczak
                     ` (6 preceding siblings ...)
  2014-01-10 14:32   ` [U-Boot] [PATCH v5 07/12] video: exynos: fimd: add support for various display color modes Przemyslaw Marczak
@ 2014-01-10 14:32   ` Przemyslaw Marczak
  2014-01-10 14:32   ` [U-Boot] [PATCH v5 09/12] samsung: misc: Add LCD download menu Przemyslaw Marczak
                     ` (3 subsequent siblings)
  11 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-10 14:32 UTC (permalink / raw)
  To: u-boot

16 bpp mode is required by LCD console mode.
This change updates exynos board files.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
---
Changes v2:
-- new patch

Changes v3:
- none

Changes v4:
- none

Changes v5:
- none

 board/samsung/trats/trats.c              |    2 +-
 board/samsung/trats2/trats2.c            |    2 +-
 board/samsung/universal_c210/universal.c |    2 +-
 include/configs/s5pc210_universal.h      |    2 +-
 include/configs/trats.h                  |    2 +-
 include/configs/trats2.h                 |    2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/board/samsung/trats/trats.c b/board/samsung/trats/trats.c
index cd27f18..a849b73 100644
--- a/board/samsung/trats/trats.c
+++ b/board/samsung/trats/trats.c
@@ -742,7 +742,7 @@ vidinfo_t panel_info = {
 	.vl_hsp		= CONFIG_SYS_LOW,
 	.vl_vsp		= CONFIG_SYS_LOW,
 	.vl_dp		= CONFIG_SYS_LOW,
-	.vl_bpix	= 5,	/* Bits per pixel, 2^5 = 32 */
+	.vl_bpix	= 4,	/* Bits per pixel, 2^4 = 16 */
 
 	/* s6e8ax0 Panel infomation */
 	.vl_hspw	= 5,
diff --git a/board/samsung/trats2/trats2.c b/board/samsung/trats2/trats2.c
index 9a2c212..bae8d6c 100644
--- a/board/samsung/trats2/trats2.c
+++ b/board/samsung/trats2/trats2.c
@@ -565,7 +565,7 @@ vidinfo_t panel_info = {
 	.vl_hsp		= CONFIG_SYS_LOW,
 	.vl_vsp		= CONFIG_SYS_LOW,
 	.vl_dp		= CONFIG_SYS_LOW,
-	.vl_bpix	= 5,	/* Bits per pixel, 2^5 = 32 */
+	.vl_bpix	= 4,	/* Bits per pixel, 2^4 = 16 */
 
 	/* s6e8ax0 Panel infomation */
 	.vl_hspw	= 5,
diff --git a/board/samsung/universal_c210/universal.c b/board/samsung/universal_c210/universal.c
index 166d5ee..1ebea0f 100644
--- a/board/samsung/universal_c210/universal.c
+++ b/board/samsung/universal_c210/universal.c
@@ -446,7 +446,7 @@ vidinfo_t panel_info = {
 	.vl_vsp		= CONFIG_SYS_HIGH,
 	.vl_dp		= CONFIG_SYS_HIGH,
 
-	.vl_bpix	= 5,	/* Bits per pixel */
+	.vl_bpix	= 4,	/* Bits per pixel */
 
 	/* LD9040 LCD Panel */
 	.vl_hspw	= 2,
diff --git a/include/configs/s5pc210_universal.h b/include/configs/s5pc210_universal.h
index 3c0a974..4079b7c 100644
--- a/include/configs/s5pc210_universal.h
+++ b/include/configs/s5pc210_universal.h
@@ -278,7 +278,7 @@ int universal_spi_read(void);
 #define CONFIG_EXYNOS_FB
 #define CONFIG_LCD
 #define CONFIG_CMD_BMP
-#define CONFIG_BMP_32BPP
+#define CONFIG_BMP_16BPP
 #define CONFIG_LD9040
 #define CONFIG_EXYNOS_MIPI_DSIM
 #define CONFIG_VIDEO_BMP_GZIP
diff --git a/include/configs/trats.h b/include/configs/trats.h
index 9a7dea1..79f9168 100644
--- a/include/configs/trats.h
+++ b/include/configs/trats.h
@@ -308,7 +308,7 @@
 #define CONFIG_EXYNOS_FB
 #define CONFIG_LCD
 #define CONFIG_CMD_BMP
-#define CONFIG_BMP_32BPP
+#define CONFIG_BMP_16BPP
 #define CONFIG_FB_ADDR		0x52504000
 #define CONFIG_S6E8AX0
 #define CONFIG_EXYNOS_MIPI_DSIM
diff --git a/include/configs/trats2.h b/include/configs/trats2.h
index 8c7c6bd..740ceb1 100644
--- a/include/configs/trats2.h
+++ b/include/configs/trats2.h
@@ -319,7 +319,7 @@ int get_soft_i2c_sda_pin(void);
 #define CONFIG_EXYNOS_FB
 #define CONFIG_LCD
 #define CONFIG_CMD_BMP
-#define CONFIG_BMP_32BPP
+#define CONFIG_BMP_16BPP
 #define CONFIG_FB_ADDR		0x52504000
 #define CONFIG_S6E8AX0
 #define CONFIG_EXYNOS_MIPI_DSIM
-- 
1.7.9.5

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

* [U-Boot] [PATCH v5 09/12] samsung: misc: Add LCD download menu.
  2014-01-10 14:31 ` [U-Boot] [PATCH v5 " Przemyslaw Marczak
                     ` (7 preceding siblings ...)
  2014-01-10 14:32   ` [U-Boot] [PATCH v5 08/12] samsung: boards: update display configs with 16bpp mode Przemyslaw Marczak
@ 2014-01-10 14:32   ` Przemyslaw Marczak
  2014-01-10 14:32   ` [U-Boot] [PATCH v5 10/12] Trats: add LCD download menu support Przemyslaw Marczak
                     ` (2 subsequent siblings)
  11 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-10 14:32 UTC (permalink / raw)
  To: u-boot

This simple LCD menu allows run one of download mode on device
without writing on console or for fast and easy upgrade.
This feature check user keys combination at boot:
- power key + volume up - download menu
- power key + volume down - thor mode (without menu)

New configs:
- CONFIG_LCD_MENU
- CONFIG_LCD_MENU_BOARD
which depends on: CONFIG_MISC_INIT_R

For proper effect this feature needs following definitions:

Power key:
- KEY_PWR_PMIC_NAME - (string) pmic which supports power key check

Register address:
- KEY_PWR_STATUS_REG
- KEY_PWR_INTERRUPT_REG

Register power key mask:
- KEY_PWR_STATUS_MASK
- KEY_PWR_INTERRUPT_MASK

Gpio numbers:
- KEY_PWR_INTERRUPT_MASK
- KEY_VOL_DOWN_GPIO

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>

---
Changes v2:
- remove keys.h  - definitions should be in boards headers
- add misc.h
- code cleanup
- extend commit msg by more informations

Changes v3:
- none

Changes v4:
- code cleanup in board/samsung/common/misc.c
- add command result check
- clear PWR button interrupt flag after command finish to prevent immediately
  mode exit in mode_leave_menu() function.
- introduce MODE_CMD_ARGC - max number of command arguments
- split array mode_cmd[] to mode_cmd[][] with separated arguments
- command support checking is now achieved without preprocessor ifdefs

Changes v5:
- remove duplicated headers
- add #ifdef CONFIG_GENERIC_MMC
- change udelay to mdelay

 board/samsung/common/misc.c |  350 +++++++++++++++++++++++++++++++++++++++++++
 board/samsung/common/misc.h |   18 +++
 2 files changed, 368 insertions(+)
 create mode 100644 board/samsung/common/misc.h

diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
index 3a91d62..c481928 100644
--- a/board/samsung/common/misc.c
+++ b/board/samsung/common/misc.c
@@ -8,6 +8,351 @@
 #include <common.h>
 #include <lcd.h>
 #include <libtizen.h>
+#include <errno.h>
+#include <version.h>
+#include <asm/sizes.h>
+#include <asm/arch/cpu.h>
+#include <asm/arch/gpio.h>
+#include <asm/gpio.h>
+#include <linux/input.h>
+#include <power/pmic.h>
+#include <mmc.h>
+#include "misc.h"
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#ifdef CONFIG_LCD_MENU
+static int power_key_pressed(u32 reg)
+{
+	struct pmic *pmic;
+	u32 status;
+	u32 mask;
+
+	pmic = pmic_get(KEY_PWR_PMIC_NAME);
+	if (!pmic) {
+		printf("%s: Not found\n", KEY_PWR_PMIC_NAME);
+		return 0;
+	}
+
+	if (pmic_probe(pmic))
+		return 0;
+
+	if (reg == KEY_PWR_STATUS_REG)
+		mask = KEY_PWR_STATUS_MASK;
+	else
+		mask = KEY_PWR_INTERRUPT_MASK;
+
+	if (pmic_reg_read(pmic, reg, &status))
+		return 0;
+
+	return !!(status & mask);
+}
+
+static int key_pressed(int key)
+{
+	int value;
+
+	switch (key) {
+	case KEY_POWER:
+		value = power_key_pressed(KEY_PWR_INTERRUPT_REG);
+		break;
+	case KEY_VOLUMEUP:
+		value = !gpio_get_value(KEY_VOL_UP_GPIO);
+		break;
+	case KEY_VOLUMEDOWN:
+		value = !gpio_get_value(KEY_VOL_DOWN_GPIO);
+		break;
+	default:
+		value = 0;
+		break;
+	}
+
+	return value;
+}
+
+static int check_keys(void)
+{
+	int keys = 0;
+
+	if (key_pressed(KEY_POWER))
+		keys += KEY_POWER;
+	if (key_pressed(KEY_VOLUMEUP))
+		keys += KEY_VOLUMEUP;
+	if (key_pressed(KEY_VOLUMEDOWN))
+		keys += KEY_VOLUMEDOWN;
+
+	return keys;
+}
+
+/*
+ * 0 BOOT_MODE_INFO
+ * 1 BOOT_MODE_THOR
+ * 2 BOOT_MODE_UMS
+ * 3 BOOT_MODE_DFU
+ * 4 BOOT_MODE_EXIT
+ */
+static char *
+mode_name[BOOT_MODE_EXIT + 1] = {
+	"DEVICE",
+	"THOR",
+	"UMS",
+	"DFU",
+	"EXIT"
+};
+
+static char *
+mode_info[BOOT_MODE_EXIT + 1] = {
+	"info",
+	"downloader",
+	"mass storage",
+	"firmware update",
+	"and run normal boot"
+};
+
+#define MODE_CMD_ARGC	4
+
+static char *
+mode_cmd[BOOT_MODE_EXIT + 1][MODE_CMD_ARGC] = {
+	{"", "", "", ""},
+	{"thor", "0", "mmc", "0"},
+	{"ums", "0", "mmc", "0"},
+	{"dfu", "0", "mmc", "0"},
+	{"", "", "", ""},
+};
+
+static void display_board_info(void)
+{
+#ifdef CONFIG_GENERIC_MMC
+	struct mmc *mmc = find_mmc_device(0);
+#endif
+	vidinfo_t *vid = &panel_info;
+
+	lcd_position_cursor(4, 4);
+
+	lcd_printf("%s\n\t", U_BOOT_VERSION);
+	lcd_puts("\n\t\tBoard Info:\n");
+#ifdef CONFIG_SYS_BOARD
+	lcd_printf("\tBoard name: %s\n", CONFIG_SYS_BOARD);
+#endif
+#ifdef CONFIG_REVISION_TAG
+	lcd_printf("\tBoard rev: %u\n", get_board_rev());
+#endif
+	lcd_printf("\tDRAM banks: %u\n", CONFIG_NR_DRAM_BANKS);
+	lcd_printf("\tDRAM size: %u MB\n", gd->ram_size / SZ_1M);
+
+#ifdef CONFIG_GENERIC_MMC
+	if (mmc) {
+		if (!mmc->capacity)
+			mmc_init(mmc);
+
+		lcd_printf("\teMMC size: %llu MB\n", mmc->capacity / SZ_1M);
+	}
+#endif
+	if (vid)
+		lcd_printf("\tDisplay resolution: %u x % u\n",
+			   vid->vl_col, vid->vl_row);
+
+	lcd_printf("\tDisplay BPP: %u\n", 1 << vid->vl_bpix);
+}
+
+static int mode_leave_menu(int mode)
+{
+	char *exit_option;
+	char *exit_boot = "boot";
+	char *exit_back = "back";
+	cmd_tbl_t *cmd;
+	int cmd_result;
+	int cmd_repeatable;
+	int leave;
+
+	lcd_clear();
+
+	switch (mode) {
+	case BOOT_MODE_EXIT:
+		return 1;
+	case BOOT_MODE_INFO:
+		display_board_info();
+		exit_option = exit_back;
+		leave = 0;
+		break;
+	default:
+		cmd = find_cmd(mode_cmd[mode][0]);
+		if (cmd) {
+			printf("Enter: %s %s\n", mode_name[mode],
+						 mode_info[mode]);
+			lcd_printf("\n\n\t%s %s\n", mode_name[mode],
+						    mode_info[mode]);
+			lcd_puts("\n\tDo not turn off device before finish!\n");
+
+			cmd_result = cmd_process(0, MODE_CMD_ARGC,
+						 *(mode_cmd + mode),
+						 &cmd_repeatable, NULL);
+
+			if (cmd_result == CMD_RET_SUCCESS) {
+				printf("Command finished\n");
+				lcd_clear();
+				lcd_printf("\n\n\t%s finished\n",
+					   mode_name[mode]);
+
+				exit_option = exit_boot;
+				leave = 1;
+			} else {
+				printf("Command error\n");
+				lcd_clear();
+				lcd_printf("\n\n\t%s command error\n",
+					   mode_name[mode]);
+
+				exit_option = exit_back;
+				leave = 0;
+			}
+		} else {
+			lcd_puts("\n\n\tThis mode is not supported.\n");
+			exit_option = exit_back;
+			leave = 0;
+		}
+	}
+
+	lcd_printf("\n\n\tPress POWER KEY to %s\n", exit_option);
+
+	/* Clear PWR button Rising edge interrupt status flag */
+	power_key_pressed(KEY_PWR_INTERRUPT_REG);
+
+	/* Wait for PWR key */
+	while (!key_pressed(KEY_POWER))
+		mdelay(1);
+
+	lcd_clear();
+	return leave;
+}
+
+static void display_download_menu(int mode)
+{
+	char *selection[BOOT_MODE_EXIT + 1];
+	int i;
+
+	for (i = 0; i <= BOOT_MODE_EXIT; i++)
+		selection[i] = "[  ]";
+
+	selection[mode] = "[=>]";
+
+	lcd_clear();
+	lcd_printf("\n\t\tDownload Mode Menu\n");
+
+	for (i = 0; i <= BOOT_MODE_EXIT; i++)
+		lcd_printf("\t%s  %s - %s\n\n", selection[i],
+						mode_name[i],
+						mode_info[i]);
+}
+
+static void download_menu(void)
+{
+	int mode = 0;
+	int last_mode = 0;
+	int run;
+	int key;
+
+	display_download_menu(mode);
+
+	while (1) {
+		run = 0;
+
+		if (mode != last_mode)
+			display_download_menu(mode);
+
+		last_mode = mode;
+		mdelay(100);
+
+		key = check_keys();
+		switch (key) {
+		case KEY_POWER:
+			run = 1;
+			break;
+		case KEY_VOLUMEUP:
+			if (mode > 0)
+				mode--;
+			break;
+		case KEY_VOLUMEDOWN:
+			if (mode < BOOT_MODE_EXIT)
+				mode++;
+			break;
+		default:
+			break;
+		}
+
+		if (run) {
+			if (mode_leave_menu(mode))
+				break;
+
+			display_download_menu(mode);
+		}
+	}
+
+	lcd_clear();
+}
+
+static void display_mode_info(void)
+{
+	lcd_position_cursor(4, 4);
+	lcd_printf("%s\n", U_BOOT_VERSION);
+	lcd_puts("\nDownload Mode Menu\n");
+#ifdef CONFIG_SYS_BOARD
+	lcd_printf("Board name: %s\n", CONFIG_SYS_BOARD);
+#endif
+	lcd_printf("Press POWER KEY to display MENU options.");
+}
+
+static int boot_menu(void)
+{
+	int key = 0;
+	int timeout = 10;
+
+	display_mode_info();
+
+	while (timeout--) {
+		lcd_printf("\rNormal boot will start in: %d seconds.", timeout);
+		mdelay(1000);
+
+		key = key_pressed(KEY_POWER);
+		if (key)
+			break;
+	}
+
+	lcd_clear();
+
+	/* If PWR pressed - show download menu */
+	if (key) {
+		printf("Power pressed - go to download menu\n");
+		download_menu();
+		printf("Download mode exit.\n");
+	}
+
+	return 0;
+}
+
+static void check_boot_mode(void)
+{
+	int pwr_key;
+
+	pwr_key = power_key_pressed(KEY_PWR_STATUS_REG);
+	if (!pwr_key)
+		return;
+
+	/* Clear PWR button Rising edge interrupt status flag */
+	power_key_pressed(KEY_PWR_INTERRUPT_REG);
+
+	if (key_pressed(KEY_VOLUMEUP))
+		boot_menu();
+	else if (key_pressed(KEY_VOLUMEDOWN))
+		mode_leave_menu(BOOT_MODE_THOR);
+}
+
+static void keys_init(void)
+{
+	/* Set direction to input */
+	gpio_direction_input(KEY_VOL_UP_GPIO);
+	gpio_direction_input(KEY_VOL_DOWN_GPIO);
+}
+#endif /* CONFIG_LCD_MENU */
 
 #ifdef CONFIG_CMD_BMP
 static void draw_logo(void)
@@ -50,9 +395,14 @@ static void draw_logo(void)
 /* Common for Samsung boards */
 int misc_init_r(void)
 {
+#ifdef CONFIG_LCD_MENU
+	keys_init();
+	check_boot_mode();
+#endif
 #ifdef CONFIG_CMD_BMP
 	if (panel_info.logo_on)
 		draw_logo();
 #endif
+
 	return 0;
 }
diff --git a/board/samsung/common/misc.h b/board/samsung/common/misc.h
new file mode 100644
index 0000000..f583552
--- /dev/null
+++ b/board/samsung/common/misc.h
@@ -0,0 +1,18 @@
+#ifndef __SAMSUNG_COMMON_MISC_H__
+#define __SAMSUNG_COMMON_MISC_H__
+
+#ifdef CONFIG_LCD_MENU
+enum {
+	BOOT_MODE_INFO,
+	BOOT_MODE_THOR,
+	BOOT_MODE_UMS,
+	BOOT_MODE_DFU,
+	BOOT_MODE_EXIT,
+};
+
+#ifdef CONFIG_REVISION_TAG
+u32 get_board_rev(void);
+#endif
+#endif /* CONFIG_LCD_MENU */
+
+#endif /* __SAMSUNG_COMMON_MISC_H__ */
-- 
1.7.9.5

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

* [U-Boot] [PATCH v5 10/12] Trats: add LCD download menu support
  2014-01-10 14:31 ` [U-Boot] [PATCH v5 " Przemyslaw Marczak
                     ` (8 preceding siblings ...)
  2014-01-10 14:32   ` [U-Boot] [PATCH v5 09/12] samsung: misc: Add LCD download menu Przemyslaw Marczak
@ 2014-01-10 14:32   ` Przemyslaw Marczak
  2014-01-10 14:32   ` [U-Boot] [PATCH v5 11/12] trats2: " Przemyslaw Marczak
  2014-01-10 14:32   ` [U-Boot] [PATCH v5 12/12] universal: " Przemyslaw Marczak
  11 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-10 14:32 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Lukasz Majewski <l.majewski@samsung.com>

---
changes v2:
- add definitions to check keys
- cleanup config definitions
- add acked-by

Changes v3:
- remove CONFIG_BOARD_NAME from include/configs/trats.h

Changes v4:
- none

Changes v5:
- none

 include/configs/trats.h |   22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/include/configs/trats.h b/include/configs/trats.h
index 79f9168..2979df5 100644
--- a/include/configs/trats.h
+++ b/include/configs/trats.h
@@ -304,6 +304,28 @@
 /* Common misc for Samsung */
 #define CONFIG_MISC_INIT_R
 
+/* Download menu - Samsung common */
+#define CONFIG_LCD_MENU
+#define CONFIG_LCD_MENU_BOARD
+
+/* Download menu - definitions for check keys */
+#ifndef __ASSEMBLY__
+#include <power/max8997_pmic.h>
+
+#define KEY_PWR_PMIC_NAME		"MAX8997_PMIC"
+#define KEY_PWR_STATUS_REG		MAX8997_REG_STATUS1
+#define KEY_PWR_STATUS_MASK		(1 << 0)
+#define KEY_PWR_INTERRUPT_REG		MAX8997_REG_INT1
+#define KEY_PWR_INTERRUPT_MASK		(1 << 0)
+
+#define KEY_VOL_UP_GPIO			exynos4_gpio_get(2, x2, 0)
+#define KEY_VOL_DOWN_GPIO		exynos4_gpio_get(2, x2, 1)
+#endif /* __ASSEMBLY__ */
+
+/* LCD console */
+#define LCD_BPP			LCD_COLOR16
+#define CONFIG_SYS_WHITE_ON_BLACK
+
 /* LCD */
 #define CONFIG_EXYNOS_FB
 #define CONFIG_LCD
-- 
1.7.9.5

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

* [U-Boot] [PATCH v5 11/12] trats2: add LCD download menu support
  2014-01-10 14:31 ` [U-Boot] [PATCH v5 " Przemyslaw Marczak
                     ` (9 preceding siblings ...)
  2014-01-10 14:32   ` [U-Boot] [PATCH v5 10/12] Trats: add LCD download menu support Przemyslaw Marczak
@ 2014-01-10 14:32   ` Przemyslaw Marczak
  2014-01-10 14:32   ` [U-Boot] [PATCH v5 12/12] universal: " Przemyslaw Marczak
  11 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-10 14:32 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
---
changes v2:
- add definitions for check keys
- cleanup config definitions

Changes v3:
- remove CONFIG_BOARD_NAME from include/configs/trats2.h

Changes v4:
- remove include of pmic.h from trats2.h
- remove include of common.h from pmic.h

Changes v5:
- none

 include/configs/trats2.h |   23 +++++++++++++++++++++++
 include/power/pmic.h     |    1 -
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/include/configs/trats2.h b/include/configs/trats2.h
index 740ceb1..59a2ad6 100644
--- a/include/configs/trats2.h
+++ b/include/configs/trats2.h
@@ -19,6 +19,7 @@
 #define CONFIG_S5P		/* which is in a S5P Family */
 #define CONFIG_EXYNOS4		/* which is in a EXYNOS4XXX */
 #define CONFIG_TIZEN		/* TIZEN lib */
+#define CONFIG_TRATS2
 
 #include <asm/arch/cpu.h>		/* get chip and board defs */
 
@@ -315,6 +316,28 @@ int get_soft_i2c_sda_pin(void);
 /* Common misc for Samsung */
 #define CONFIG_MISC_INIT_R
 
+/* Download menu - Samsung common */
+#define CONFIG_LCD_MENU
+#define CONFIG_LCD_MENU_BOARD
+
+/* Download menu - definitions for check keys */
+#ifndef __ASSEMBLY__
+#include <power/max77686_pmic.h>
+
+#define KEY_PWR_PMIC_NAME		"MAX77686_PMIC"
+#define KEY_PWR_STATUS_REG		MAX77686_REG_PMIC_STATUS1
+#define KEY_PWR_STATUS_MASK		(1 << 0)
+#define KEY_PWR_INTERRUPT_REG		MAX77686_REG_PMIC_INT1
+#define KEY_PWR_INTERRUPT_MASK		(1 << 1)
+
+#define KEY_VOL_UP_GPIO			exynos4x12_gpio_get(2, x2, 2)
+#define KEY_VOL_DOWN_GPIO		exynos4x12_gpio_get(2, x3, 3)
+#endif /* __ASSEMBLY__ */
+
+/* LCD console */
+#define LCD_BPP                 LCD_COLOR16
+#define CONFIG_SYS_WHITE_ON_BLACK
+
 /* LCD */
 #define CONFIG_EXYNOS_FB
 #define CONFIG_LCD
diff --git a/include/power/pmic.h b/include/power/pmic.h
index 0e7aa31..8f282dd 100644
--- a/include/power/pmic.h
+++ b/include/power/pmic.h
@@ -8,7 +8,6 @@
 #ifndef __CORE_PMIC_H_
 #define __CORE_PMIC_H_
 
-#include <common.h>
 #include <linux/list.h>
 #include <i2c.h>
 #include <power/power_chrg.h>
-- 
1.7.9.5

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

* [U-Boot] [PATCH v5 12/12] universal: add LCD download menu support
  2014-01-10 14:31 ` [U-Boot] [PATCH v5 " Przemyslaw Marczak
                     ` (10 preceding siblings ...)
  2014-01-10 14:32   ` [U-Boot] [PATCH v5 11/12] trats2: " Przemyslaw Marczak
@ 2014-01-10 14:32   ` Przemyslaw Marczak
  11 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-10 14:32 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
---
changes v2:
- add definitions for check keys
- cleanup config definitions

Changes v3:
- remove CONFIG_BOARD_NAME from include/configs/5pc210_universal.h

Changes v4:
- none

Changes v5:
- none

 include/configs/s5pc210_universal.h |   22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/include/configs/s5pc210_universal.h b/include/configs/s5pc210_universal.h
index 4079b7c..ec8f991 100644
--- a/include/configs/s5pc210_universal.h
+++ b/include/configs/s5pc210_universal.h
@@ -272,6 +272,28 @@ int universal_spi_read(void);
 /* Common misc for Samsung */
 #define CONFIG_MISC_INIT_R
 
+/* Download menu - Samsung common */
+#define CONFIG_LCD_MENU
+#define CONFIG_LCD_MENU_BOARD
+
+/* Download menu - definitions for check keys */
+#ifndef __ASSEMBLY__
+#include <power/max8998_pmic.h>
+
+#define KEY_PWR_PMIC_NAME		"MAX8998_PMIC"
+#define KEY_PWR_STATUS_REG		MAX8998_REG_STATUS1
+#define KEY_PWR_STATUS_MASK		(1 << 7)
+#define KEY_PWR_INTERRUPT_REG		MAX8998_REG_IRQ1
+#define KEY_PWR_INTERRUPT_MASK		(1 << 7)
+
+#define KEY_VOL_UP_GPIO			exynos4_gpio_get(2, x2, 0)
+#define KEY_VOL_DOWN_GPIO		exynos4_gpio_get(2, x2, 1)
+#endif /* __ASSEMBLY__ */
+
+/* LCD console */
+#define LCD_BPP			LCD_COLOR16
+#define CONFIG_SYS_WHITE_ON_BLACK
+
 /*
  * LCD Settings
  */
-- 
1.7.9.5

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

* [U-Boot] [PATCH v5 04/12] samsung: misc: move display logo function to misc.c file.
  2014-01-10 14:31   ` [U-Boot] [PATCH v5 04/12] samsung: misc: move display logo function to misc.c file Przemyslaw Marczak
@ 2014-01-14  3:41     ` Jaehoon Chung
  2014-01-14  8:02       ` Przemyslaw Marczak
  0 siblings, 1 reply; 147+ messages in thread
From: Jaehoon Chung @ 2014-01-14  3:41 UTC (permalink / raw)
  To: u-boot

Dear Przemyslaw,

On 01/10/2014 11:31 PM, Przemyslaw Marczak wrote:
> board/samsung/common/misc.c:
> - move draw_logo() function from exynos_fb.c
> - add get_tizen_logo_info() function call removed from board files
> 
> boards:
> - update board files
> - add CONFIG_MISC_INIT_R to Universal, Trats and Trats2
> 
> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
> Tested-by: Hyungwon Hwang <human.hwang@samsung.com>
> ---
> changes v2:
> - configs cleanup
> - add check logo address before display
> 
> Changes v3:
> - none
> 
> Changes v4:
> - none
> 
> Changes v5:
> - none
> 
>  board/samsung/common/misc.c              |   42 ++++++++++++++++++++++++++++++
>  board/samsung/trats/trats.c              |    3 ---
>  board/samsung/trats2/trats2.c            |    4 ---
>  board/samsung/universal_c210/universal.c |    4 ---
>  drivers/video/exynos_fb.c                |   28 --------------------
>  include/configs/s5pc210_universal.h      |    3 +++
>  include/configs/trats.h                  |    3 +++
>  include/configs/trats2.h                 |    3 +++
>  8 files changed, 51 insertions(+), 39 deletions(-)
> 
> diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
> index 3764d12..6188e29 100644
> --- a/board/samsung/common/misc.c
> +++ b/board/samsung/common/misc.c
> @@ -6,9 +6,51 @@
>   */
>  
>  #include <common.h>
> +#include <lcd.h>
> +#include <libtizen.h>
> +
> +#ifdef CONFIG_CMD_BMP
> +static void draw_logo(void)
> +{
> +	int x, y;
> +	ulong addr;
> +
> +#ifdef CONFIG_TIZEN
> +	get_tizen_logo_info(&panel_info);
> +#else
> +	return;
if CONFIG_TINZE didn't set, draw_logo should be just return, right?
Then I think this point could be changed more readable.

#ifdef CONFIG_TIZEN
	int x, y;
	ulong addr;

	get_tizen_logo_info(...);
	
	add = panel_info.logo_addr;
	...
	bmp_display(addr, x, y);
#endif

how about?

Best Regards,
Jaehoon Chung


> +#endif
> +
> +	addr = panel_info.logo_addr;
> +	if (!addr) {
> +		error("There is no logo data.");
> +		return;
> +	}
> +
> +	if (panel_info.vl_width >= panel_info.logo_width) {
> +		x = ((panel_info.vl_width - panel_info.logo_width) >> 1);
> +	} else {
> +		x = 0;
> +		printf("Warning: image width is bigger than display width\n");
> +	}
> +
> +	if (panel_info.vl_height >= panel_info.logo_height) {
> +		y = ((panel_info.vl_height - panel_info.logo_height) >> 1);
> +	} else {
> +		y = 0;
> +		printf("Warning: image height is bigger than display height\n");
> +	}
> +
> +	bmp_display(addr, x, y);
> +}
> +#endif /* CONFIG_CMD_BMP */
>  
>  /* Common for Samsung boards */
>  int misc_init_r(void)
>  {
> +#ifdef CONFIG_CMD_BMP
> +	if (panel_info.logo_on)
> +		draw_logo();
> +#endif
>  	return 0;
>  }
> diff --git a/board/samsung/trats/trats.c b/board/samsung/trats/trats.c
> index 640a193..cd27f18 100644
> --- a/board/samsung/trats/trats.c
> +++ b/board/samsung/trats/trats.c
> @@ -770,9 +770,6 @@ void init_panel_info(vidinfo_t *vid)
>  	vid->resolution	= HD_RESOLUTION,
>  	vid->rgb_mode	= MODE_RGB_P,
>  
> -#ifdef CONFIG_TIZEN
> -	get_tizen_logo_info(vid);
> -#endif
>  	mipi_lcd_device.reverse_panel = 1;
>  
>  	strcpy(s6e8ax0_platform_data.lcd_panel_name, mipi_lcd_device.name);
> diff --git a/board/samsung/trats2/trats2.c b/board/samsung/trats2/trats2.c
> index b4ccf51..9a2c212 100644
> --- a/board/samsung/trats2/trats2.c
> +++ b/board/samsung/trats2/trats2.c
> @@ -596,10 +596,6 @@ void init_panel_info(vidinfo_t *vid)
>  
>  	mipi_lcd_device.reverse_panel = 1;
>  
> -#ifdef CONFIG_TIZEN
> -	get_tizen_logo_info(vid);
> -#endif
> -
>  	strcpy(dsim_platform_data.lcd_panel_name, mipi_lcd_device.name);
>  	dsim_platform_data.mipi_power = mipi_power;
>  	dsim_platform_data.phy_enable = set_mipi_phy_ctrl;
> diff --git a/board/samsung/universal_c210/universal.c b/board/samsung/universal_c210/universal.c
> index 54d0e1e..166d5ee 100644
> --- a/board/samsung/universal_c210/universal.c
> +++ b/board/samsung/universal_c210/universal.c
> @@ -484,10 +484,6 @@ void init_panel_info(vidinfo_t *vid)
>  	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;
> diff --git a/drivers/video/exynos_fb.c b/drivers/video/exynos_fb.c
> index 7d4c6e0..00a0a11 100644
> --- a/drivers/video/exynos_fb.c
> +++ b/drivers/video/exynos_fb.c
> @@ -62,31 +62,6 @@ static void exynos_lcd_init(vidinfo_t *vid)
>  	lcd_set_flush_dcache(1);
>  }
>  
> -#ifdef CONFIG_CMD_BMP
> -static void draw_logo(void)
> -{
> -	int x, y;
> -	ulong addr;
> -
> -	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);
> -}
> -#endif
> -
>  void __exynos_cfg_lcd_gpio(void)
>  {
>  }
> @@ -323,9 +298,6 @@ void lcd_enable(void)
>  	if (panel_info.logo_on) {
>  		memset((void *) gd->fb_base, 0, panel_width * panel_height *
>  				(NBITS(panel_info.vl_bpix) >> 3));
> -#ifdef CONFIG_CMD_BMP
> -		draw_logo();
> -#endif
>  	}
>  
>  	lcd_panel_on(&panel_info);
> diff --git a/include/configs/s5pc210_universal.h b/include/configs/s5pc210_universal.h
> index 02a1c99..8a749f2 100644
> --- a/include/configs/s5pc210_universal.h
> +++ b/include/configs/s5pc210_universal.h
> @@ -269,6 +269,9 @@ void universal_spi_sda(int bit);
>  int universal_spi_read(void);
>  #endif
>  
> +/* Common misc for Samsung */
> +#define CONFIG_MISC_INIT_R
> +
>  /*
>   * LCD Settings
>   */
> diff --git a/include/configs/trats.h b/include/configs/trats.h
> index 9727f7a..1a75bb3 100644
> --- a/include/configs/trats.h
> +++ b/include/configs/trats.h
> @@ -301,6 +301,9 @@
>  #define CONFIG_USB_GADGET_VBUS_DRAW	2
>  #define CONFIG_USB_CABLE_CHECK
>  
> +/* Common misc for Samsung */
> +#define CONFIG_MISC_INIT_R
> +
>  /* LCD */
>  #define CONFIG_EXYNOS_FB
>  #define CONFIG_LCD
> diff --git a/include/configs/trats2.h b/include/configs/trats2.h
> index 7dfbe98..e54fe52 100644
> --- a/include/configs/trats2.h
> +++ b/include/configs/trats2.h
> @@ -312,6 +312,9 @@ int get_soft_i2c_sda_pin(void);
>  #define CONFIG_USB_GADGET_VBUS_DRAW	2
>  #define CONFIG_USB_CABLE_CHECK
>  
> +/* Common misc for Samsung */
> +#define CONFIG_MISC_INIT_R
> +
>  /* LCD */
>  #define CONFIG_EXYNOS_FB
>  #define CONFIG_LCD
> 

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

* [U-Boot] [PATCH v5 04/12] samsung: misc: move display logo function to misc.c file.
  2014-01-14  3:41     ` Jaehoon Chung
@ 2014-01-14  8:02       ` Przemyslaw Marczak
  2014-01-14  8:55         ` Minkyu Kang
  0 siblings, 1 reply; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-14  8:02 UTC (permalink / raw)
  To: u-boot

Hello Jaehoon,

On 01/14/2014 04:41 AM, Jaehoon Chung wrote:
> Dear Przemyslaw,
>
> On 01/10/2014 11:31 PM, Przemyslaw Marczak wrote:
>> board/samsung/common/misc.c:
>> - move draw_logo() function from exynos_fb.c
>> - add get_tizen_logo_info() function call removed from board files
>>
>> boards:
>> - update board files
>> - add CONFIG_MISC_INIT_R to Universal, Trats and Trats2
>>
>> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
>> Tested-by: Hyungwon Hwang <human.hwang@samsung.com>
>> ---
>> changes v2:
>> - configs cleanup
>> - add check logo address before display
>>
>> Changes v3:
>> - none
>>
>> Changes v4:
>> - none
>>
>> Changes v5:
>> - none
>>
>>   board/samsung/common/misc.c              |   42 ++++++++++++++++++++++++++++++
>>   board/samsung/trats/trats.c              |    3 ---
>>   board/samsung/trats2/trats2.c            |    4 ---
>>   board/samsung/universal_c210/universal.c |    4 ---
>>   drivers/video/exynos_fb.c                |   28 --------------------
>>   include/configs/s5pc210_universal.h      |    3 +++
>>   include/configs/trats.h                  |    3 +++
>>   include/configs/trats2.h                 |    3 +++
>>   8 files changed, 51 insertions(+), 39 deletions(-)
>>
>> diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
>> index 3764d12..6188e29 100644
>> --- a/board/samsung/common/misc.c
>> +++ b/board/samsung/common/misc.c
>> @@ -6,9 +6,51 @@
>>    */
>>
>>   #include <common.h>
>> +#include <lcd.h>
>> +#include <libtizen.h>
>> +
>> +#ifdef CONFIG_CMD_BMP
>> +static void draw_logo(void)
>> +{
>> +	int x, y;
>> +	ulong addr;
>> +
>> +#ifdef CONFIG_TIZEN
>> +	get_tizen_logo_info(&panel_info);
>> +#else
>> +	return;
> if CONFIG_TINZE didn't set, draw_logo should be just return, right?
> Then I think this point could be changed more readable.
>
> #ifdef CONFIG_TIZEN
> 	int x, y;
> 	ulong addr;
>
> 	get_tizen_logo_info(...);
> 	
> 	add = panel_info.logo_addr;
> 	...
> 	bmp_display(addr, x, y);
> #endif
>
> how about?
>
> Best Regards,
> Jaehoon Chung
>
>

You know, this file is common for all Samsung platforms, and I think 
this function should not depends only on Tizen logo. In this case user 
can choose other logo just by adding function like "get_logo" instead of 
the return statement. I also think that there is need for some common 
function which allows set proper logo by board config, but maybe not in 
this patch set?

Thank you,
-- 
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com

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

* [U-Boot] [PATCH v5 04/12] samsung: misc: move display logo function to misc.c file.
  2014-01-14  8:02       ` Przemyslaw Marczak
@ 2014-01-14  8:55         ` Minkyu Kang
  2014-01-15 10:20           ` Przemyslaw Marczak
  0 siblings, 1 reply; 147+ messages in thread
From: Minkyu Kang @ 2014-01-14  8:55 UTC (permalink / raw)
  To: u-boot

Dear Przemyslaw Marczak,

On 14/01/14 17:02, Przemyslaw Marczak wrote:
> Hello Jaehoon,
> 
> On 01/14/2014 04:41 AM, Jaehoon Chung wrote:
>> Dear Przemyslaw,
>>
>> On 01/10/2014 11:31 PM, Przemyslaw Marczak wrote:
>>> board/samsung/common/misc.c:
>>> - move draw_logo() function from exynos_fb.c
>>> - add get_tizen_logo_info() function call removed from board files
>>>
>>> boards:
>>> - update board files
>>> - add CONFIG_MISC_INIT_R to Universal, Trats and Trats2
>>>
>>> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
>>> Tested-by: Hyungwon Hwang <human.hwang@samsung.com>
>>> ---
>>> changes v2:
>>> - configs cleanup
>>> - add check logo address before display
>>>
>>> Changes v3:
>>> - none
>>>
>>> Changes v4:
>>> - none
>>>
>>> Changes v5:
>>> - none
>>>
>>>   board/samsung/common/misc.c              |   42 ++++++++++++++++++++++++++++++
>>>   board/samsung/trats/trats.c              |    3 ---
>>>   board/samsung/trats2/trats2.c            |    4 ---
>>>   board/samsung/universal_c210/universal.c |    4 ---
>>>   drivers/video/exynos_fb.c                |   28 --------------------
>>>   include/configs/s5pc210_universal.h      |    3 +++
>>>   include/configs/trats.h                  |    3 +++
>>>   include/configs/trats2.h                 |    3 +++
>>>   8 files changed, 51 insertions(+), 39 deletions(-)
>>>
>>> diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
>>> index 3764d12..6188e29 100644
>>> --- a/board/samsung/common/misc.c
>>> +++ b/board/samsung/common/misc.c
>>> @@ -6,9 +6,51 @@
>>>    */
>>>
>>>   #include <common.h>
>>> +#include <lcd.h>
>>> +#include <libtizen.h>
>>> +
>>> +#ifdef CONFIG_CMD_BMP
>>> +static void draw_logo(void)
>>> +{
>>> +    int x, y;
>>> +    ulong addr;
>>> +
>>> +#ifdef CONFIG_TIZEN
>>> +    get_tizen_logo_info(&panel_info);
>>> +#else
>>> +    return;
>> if CONFIG_TINZE didn't set, draw_logo should be just return, right?
>> Then I think this point could be changed more readable.
>>
>> #ifdef CONFIG_TIZEN
>>     int x, y;
>>     ulong addr;
>>
>>     get_tizen_logo_info(...);
>>     
>>     add = panel_info.logo_addr;
>>     ...
>>     bmp_display(addr, x, y);
>> #endif
>>
>> how about?
>>
>> Best Regards,
>> Jaehoon Chung
>>
>>
> 
> You know, this file is common for all Samsung platforms,and I think this function should not depends only on Tizen logo. In this case user can choose other logo just by adding function like "get_logo" instead of the return statement. I also think that there is need for some common function which allows set proper logo by board config, but maybe not in this patch set?

I agreed with you.

You said that "there is need for some common function which allows set proper logo by board config".
At previous version of board files, you already have common function (init_panel_info - even though this function is not for the logo but I think, it's enough).

@@ -484,10 +484,6 @@ void init_panel_info(vidinfo_t *vid)
 	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;

If you remove this change at each boards, then you don't have add ifdef CONFIG_TIZEN at draw_logo function.
It can be split common stuffs and board specific stuffs efficiently.
How you think?

Thanks,
Minkyu Kang.

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

* [U-Boot] [PATCH v5 03/12] samsung: common: Add misc file and common function misc_init_r().
  2014-01-10 14:31   ` [U-Boot] [PATCH v5 03/12] samsung: common: Add misc file and common function misc_init_r() Przemyslaw Marczak
@ 2014-01-14 13:55     ` Przemyslaw Marczak
  2014-01-15  7:35       ` Minkyu Kang
  0 siblings, 1 reply; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-14 13:55 UTC (permalink / raw)
  To: u-boot

Hello,
In case of discussion with Piotr Wilczek maybe it is better to make some 
changes in this patch.

On 01/10/2014 03:31 PM, Przemyslaw Marczak wrote:
> Config: CONFIG_MISC_INIT_R enables implementation of misc_init_r()
> in common file::
> - board/samsung/common/misc.c
>
> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
> Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
> ---
> Changes v2:
> - change CONFIG_SAMSUNG to CONFIG_MISC_INIT_R
>
> Changes v3:
> - fix merge conflict in board/samsung/common/Makefile
>
> Changes v4:
> - none
>
> Changes v5:
> - add acked-by
>
>   board/samsung/common/Makefile |    1 +
>   board/samsung/common/misc.c   |   14 ++++++++++++++
>   2 files changed, 15 insertions(+)
>   create mode 100644 board/samsung/common/misc.c
>
> diff --git a/board/samsung/common/Makefile b/board/samsung/common/Makefile
> index 22bd6b1..79547a3 100644
> --- a/board/samsung/common/Makefile
> +++ b/board/samsung/common/Makefile
> @@ -8,6 +8,7 @@
>   obj-$(CONFIG_SOFT_I2C_MULTI_BUS) += multi_i2c.o
>   obj-$(CONFIG_THOR_FUNCTION) += thor.o
>   obj-$(CONFIG_CMD_USB_MASS_STORAGE) += ums.o
> +obj-$(CONFIG_MISC_INIT_R) += misc.o
here change to:
obj-y += misc.o

>
>   ifndef CONFIG_SPL_BUILD
>   obj-$(CONFIG_BOARD_COMMON)	+= board.o
> diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
> new file mode 100644
> index 0000000..3764d12
> --- /dev/null
> +++ b/board/samsung/common/misc.c
> @@ -0,0 +1,14 @@
> +/*
> + * Copyright (C) 2013 Samsung Electronics
> + * Przemyslaw Marczak <p.marczak@samsung.com>
> + *
> + * SPDX-License-Identifier:	GPL-2.0+
> + */
> +
> +#include <common.h>
> +

and here:
#ifdef CONFIG_MISC_INIT_R

> +/* Common for Samsung boards */
> +int misc_init_r(void)
> +{
> +	return 0;
> +}
>
#endif

In this way we can add other functions in the future even without 
CONFIG_MISC_INIT_R.

Is it better solution?

Thank you,
-- 
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com

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

* [U-Boot] [PATCH v5 03/12] samsung: common: Add misc file and common function misc_init_r().
  2014-01-14 13:55     ` Przemyslaw Marczak
@ 2014-01-15  7:35       ` Minkyu Kang
  2014-01-15  7:51         ` Przemyslaw Marczak
  0 siblings, 1 reply; 147+ messages in thread
From: Minkyu Kang @ 2014-01-15  7:35 UTC (permalink / raw)
  To: u-boot

On 14/01/14 22:55, Przemyslaw Marczak wrote:
> Hello,
> In case of discussion with Piotr Wilczek maybe it is better to make some changes in this patch.
> 
> On 01/10/2014 03:31 PM, Przemyslaw Marczak wrote:
>> Config: CONFIG_MISC_INIT_R enables implementation of misc_init_r()
>> in common file::
>> - board/samsung/common/misc.c
>>
>> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
>> Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
>> ---
>> Changes v2:
>> - change CONFIG_SAMSUNG to CONFIG_MISC_INIT_R
>>
>> Changes v3:
>> - fix merge conflict in board/samsung/common/Makefile
>>
>> Changes v4:
>> - none
>>
>> Changes v5:
>> - add acked-by
>>
>>   board/samsung/common/Makefile |    1 +
>>   board/samsung/common/misc.c   |   14 ++++++++++++++
>>   2 files changed, 15 insertions(+)
>>   create mode 100644 board/samsung/common/misc.c
>>
>> diff --git a/board/samsung/common/Makefile b/board/samsung/common/Makefile
>> index 22bd6b1..79547a3 100644
>> --- a/board/samsung/common/Makefile
>> +++ b/board/samsung/common/Makefile
>> @@ -8,6 +8,7 @@
>>   obj-$(CONFIG_SOFT_I2C_MULTI_BUS) += multi_i2c.o
>>   obj-$(CONFIG_THOR_FUNCTION) += thor.o
>>   obj-$(CONFIG_CMD_USB_MASS_STORAGE) += ums.o
>> +obj-$(CONFIG_MISC_INIT_R) += misc.o
> here change to:
> obj-y += misc.o
> 
>>
>>   ifndef CONFIG_SPL_BUILD
>>   obj-$(CONFIG_BOARD_COMMON)    += board.o
>> diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
>> new file mode 100644
>> index 0000000..3764d12
>> --- /dev/null
>> +++ b/board/samsung/common/misc.c
>> @@ -0,0 +1,14 @@
>> +/*
>> + * Copyright (C) 2013 Samsung Electronics
>> + * Przemyslaw Marczak <p.marczak@samsung.com>
>> + *
>> + * SPDX-License-Identifier:    GPL-2.0+
>> + */
>> +
>> +#include <common.h>
>> +
> 
> and here:
> #ifdef CONFIG_MISC_INIT_R
> 
>> +/* Common for Samsung boards */
>> +int misc_init_r(void)
>> +{
>> +    return 0;
>> +}
>>
> #endif
> 
> In this way we can add other functions in the future even without CONFIG_MISC_INIT_R.

partly agree.
But, I doubt what is the role of misc.c file.
because of the meaning of miscellaneous is ambiguous,
this file have possibility to be messy.
So, please let me know what is your plan to this file.

> 
> Is it better solution?
> 
> Thank you,

Thanks,
Minkyu Kang.

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

* [U-Boot] [PATCH v5 03/12] samsung: common: Add misc file and common function misc_init_r().
  2014-01-15  7:35       ` Minkyu Kang
@ 2014-01-15  7:51         ` Przemyslaw Marczak
  2014-01-15  8:08           ` Piotr Wilczek
  0 siblings, 1 reply; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-15  7:51 UTC (permalink / raw)
  To: u-boot

Hello,

On 01/15/2014 08:35 AM, Minkyu Kang wrote:
> On 14/01/14 22:55, Przemyslaw Marczak wrote:
>> Hello,
>> In case of discussion with Piotr Wilczek maybe it is better to make some changes in this patch.
>>
>> On 01/10/2014 03:31 PM, Przemyslaw Marczak wrote:
>>> Config: CONFIG_MISC_INIT_R enables implementation of misc_init_r()
>>> in common file::
>>> - board/samsung/common/misc.c
>>>
>>> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
>>> Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
>>> ---
>>> Changes v2:
>>> - change CONFIG_SAMSUNG to CONFIG_MISC_INIT_R
>>>
>>> Changes v3:
>>> - fix merge conflict in board/samsung/common/Makefile
>>>
>>> Changes v4:
>>> - none
>>>
>>> Changes v5:
>>> - add acked-by
>>>
>>>    board/samsung/common/Makefile |    1 +
>>>    board/samsung/common/misc.c   |   14 ++++++++++++++
>>>    2 files changed, 15 insertions(+)
>>>    create mode 100644 board/samsung/common/misc.c
>>>
>>> diff --git a/board/samsung/common/Makefile b/board/samsung/common/Makefile
>>> index 22bd6b1..79547a3 100644
>>> --- a/board/samsung/common/Makefile
>>> +++ b/board/samsung/common/Makefile
>>> @@ -8,6 +8,7 @@
>>>    obj-$(CONFIG_SOFT_I2C_MULTI_BUS) += multi_i2c.o
>>>    obj-$(CONFIG_THOR_FUNCTION) += thor.o
>>>    obj-$(CONFIG_CMD_USB_MASS_STORAGE) += ums.o
>>> +obj-$(CONFIG_MISC_INIT_R) += misc.o
>> here change to:
>> obj-y += misc.o
>>
>>>
>>>    ifndef CONFIG_SPL_BUILD
>>>    obj-$(CONFIG_BOARD_COMMON)    += board.o
>>> diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
>>> new file mode 100644
>>> index 0000000..3764d12
>>> --- /dev/null
>>> +++ b/board/samsung/common/misc.c
>>> @@ -0,0 +1,14 @@
>>> +/*
>>> + * Copyright (C) 2013 Samsung Electronics
>>> + * Przemyslaw Marczak <p.marczak@samsung.com>
>>> + *
>>> + * SPDX-License-Identifier:    GPL-2.0+
>>> + */
>>> +
>>> +#include <common.h>
>>> +
>>
>> and here:
>> #ifdef CONFIG_MISC_INIT_R
>>
>>> +/* Common for Samsung boards */
>>> +int misc_init_r(void)
>>> +{
>>> +    return 0;
>>> +}
>>>
>> #endif
>>
>> In this way we can add other functions in the future even without CONFIG_MISC_INIT_R.
>
> partly agree.
> But, I doubt what is the role of misc.c file.
> because of the meaning of miscellaneous is ambiguous,
> this file have possibility to be messy.
> So, please let me know what is your plan to this file.
>

I first planned put there only implementation of misc_init_r() and it's 
subfunctions - as the easy way to display logo and menu for Samsung boards.
Piotr has suggested to change the purpose of this file as misc not only 
for misc_init_r implementation...

>>
>> Is it better solution?
>>
>> Thank you,
>
> Thanks,
> Minkyu Kang.
>

Thank you,
-- 
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com

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

* [U-Boot] [PATCH v5 03/12] samsung: common: Add misc file and common function misc_init_r().
  2014-01-15  7:51         ` Przemyslaw Marczak
@ 2014-01-15  8:08           ` Piotr Wilczek
  2014-01-15  8:18             ` Przemyslaw Marczak
  0 siblings, 1 reply; 147+ messages in thread
From: Piotr Wilczek @ 2014-01-15  8:08 UTC (permalink / raw)
  To: u-boot

Dear Przemyslaw,

> -----Original Message-----
> From: Przemyslaw Marczak [mailto:p.marczak at samsung.com]
> Sent: Wednesday, January 15, 2014 8:51 AM
> To: Minkyu Kang
> Cc: u-boot at lists.denx.de; jh80.chung at samsung.com;
> human.hwang at samsung.com; dh09.lee at samsung.com; ideal.song at samsung.com;
> Piotr Wilczek; Lukasz Majewski
> Subject: Re: [PATCH v5 03/12] samsung: common: Add misc file and common
> function misc_init_r().
> 
> Hello,
> 
> On 01/15/2014 08:35 AM, Minkyu Kang wrote:
> > On 14/01/14 22:55, Przemyslaw Marczak wrote:
> >> Hello,
> >> In case of discussion with Piotr Wilczek maybe it is better to make
> some changes in this patch.
> >>
> >> On 01/10/2014 03:31 PM, Przemyslaw Marczak wrote:
> >>> Config: CONFIG_MISC_INIT_R enables implementation of misc_init_r()
> >>> in common file::
> >>> - board/samsung/common/misc.c
> >>>
> >>> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
> >>> Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
> >>> ---
> >>> Changes v2:
> >>> - change CONFIG_SAMSUNG to CONFIG_MISC_INIT_R
> >>>
> >>> Changes v3:
> >>> - fix merge conflict in board/samsung/common/Makefile
> >>>
> >>> Changes v4:
> >>> - none
> >>>
> >>> Changes v5:
> >>> - add acked-by
> >>>
> >>>    board/samsung/common/Makefile |    1 +
> >>>    board/samsung/common/misc.c   |   14 ++++++++++++++
> >>>    2 files changed, 15 insertions(+)
> >>>    create mode 100644 board/samsung/common/misc.c
> >>>
> >>> diff --git a/board/samsung/common/Makefile
> >>> b/board/samsung/common/Makefile index 22bd6b1..79547a3 100644
> >>> --- a/board/samsung/common/Makefile
> >>> +++ b/board/samsung/common/Makefile
> >>> @@ -8,6 +8,7 @@
> >>>    obj-$(CONFIG_SOFT_I2C_MULTI_BUS) += multi_i2c.o
> >>>    obj-$(CONFIG_THOR_FUNCTION) += thor.o
> >>>    obj-$(CONFIG_CMD_USB_MASS_STORAGE) += ums.o
> >>> +obj-$(CONFIG_MISC_INIT_R) += misc.o
> >> here change to:
> >> obj-y += misc.o
> >>
> >>>
> >>>    ifndef CONFIG_SPL_BUILD
> >>>    obj-$(CONFIG_BOARD_COMMON)    += board.o
> >>> diff --git a/board/samsung/common/misc.c
> >>> b/board/samsung/common/misc.c new file mode 100644 index
> >>> 0000000..3764d12
> >>> --- /dev/null
> >>> +++ b/board/samsung/common/misc.c
> >>> @@ -0,0 +1,14 @@
> >>> +/*
> >>> + * Copyright (C) 2013 Samsung Electronics
> >>> + * Przemyslaw Marczak <p.marczak@samsung.com>
> >>> + *
> >>> + * SPDX-License-Identifier:    GPL-2.0+
> >>> + */
> >>> +
> >>> +#include <common.h>
> >>> +
> >>
> >> and here:
> >> #ifdef CONFIG_MISC_INIT_R
> >>
> >>> +/* Common for Samsung boards */
> >>> +int misc_init_r(void)
> >>> +{
> >>> +    return 0;
> >>> +}
> >>>
> >> #endif
> >>
> >> In this way we can add other functions in the future even without
> CONFIG_MISC_INIT_R.
> >
> > partly agree.
> > But, I doubt what is the role of misc.c file.
> > because of the meaning of miscellaneous is ambiguous, this file have
> > possibility to be messy.
> > So, please let me know what is your plan to this file.
> >
> 
> I first planned put there only implementation of misc_init_r() and it's
> subfunctions - as the easy way to display logo and menu for Samsung
> boards.
> Piotr has suggested to change the purpose of this file as misc not only
> for misc_init_r implementation...
Przemyslaw, I asked you question: what is the misc.c file for?
If for misc_init_r only then I think the file name "misc.c" is confusing.
If also other common functions can be put there, then the define MISC_INIT_R
to compile this file is wrong.

> 
> >>
> >> Is it better solution?
> >>
> >> Thank you,
> >
> > Thanks,
> > Minkyu Kang.
> >
> 
> Thank you,
> --
> Przemyslaw Marczak
> Samsung R&D Institute Poland
> Samsung Electronics
> p.marczak at samsung.com

Best regards,
Piotr Wilczek

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

* [U-Boot] [PATCH v5 03/12] samsung: common: Add misc file and common function misc_init_r().
  2014-01-15  8:08           ` Piotr Wilczek
@ 2014-01-15  8:18             ` Przemyslaw Marczak
  2014-01-17  6:26               ` Minkyu Kang
  0 siblings, 1 reply; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-15  8:18 UTC (permalink / raw)
  To: u-boot

Hello Piotr,

On 01/15/2014 09:08 AM, Piotr Wilczek wrote:
> Dear Przemyslaw,
>
>> -----Original Message-----
>> From: Przemyslaw Marczak [mailto:p.marczak at samsung.com]
>> Sent: Wednesday, January 15, 2014 8:51 AM
>> To: Minkyu Kang
>> Cc: u-boot at lists.denx.de; jh80.chung at samsung.com;
>> human.hwang at samsung.com; dh09.lee at samsung.com; ideal.song at samsung.com;
>> Piotr Wilczek; Lukasz Majewski
>> Subject: Re: [PATCH v5 03/12] samsung: common: Add misc file and common
>> function misc_init_r().
>>
>> Hello,
>>
>> On 01/15/2014 08:35 AM, Minkyu Kang wrote:
>>> On 14/01/14 22:55, Przemyslaw Marczak wrote:
>>>> Hello,
>>>> In case of discussion with Piotr Wilczek maybe it is better to make
>> some changes in this patch.
>>>>
>>>> On 01/10/2014 03:31 PM, Przemyslaw Marczak wrote:
>>>>> Config: CONFIG_MISC_INIT_R enables implementation of misc_init_r()
>>>>> in common file::
>>>>> - board/samsung/common/misc.c
>>>>>
>>>>> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
>>>>> Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
>>>>> ---
>>>>> Changes v2:
>>>>> - change CONFIG_SAMSUNG to CONFIG_MISC_INIT_R
>>>>>
>>>>> Changes v3:
>>>>> - fix merge conflict in board/samsung/common/Makefile
>>>>>
>>>>> Changes v4:
>>>>> - none
>>>>>
>>>>> Changes v5:
>>>>> - add acked-by
>>>>>
>>>>>     board/samsung/common/Makefile |    1 +
>>>>>     board/samsung/common/misc.c   |   14 ++++++++++++++
>>>>>     2 files changed, 15 insertions(+)
>>>>>     create mode 100644 board/samsung/common/misc.c
>>>>>
>>>>> diff --git a/board/samsung/common/Makefile
>>>>> b/board/samsung/common/Makefile index 22bd6b1..79547a3 100644
>>>>> --- a/board/samsung/common/Makefile
>>>>> +++ b/board/samsung/common/Makefile
>>>>> @@ -8,6 +8,7 @@
>>>>>     obj-$(CONFIG_SOFT_I2C_MULTI_BUS) += multi_i2c.o
>>>>>     obj-$(CONFIG_THOR_FUNCTION) += thor.o
>>>>>     obj-$(CONFIG_CMD_USB_MASS_STORAGE) += ums.o
>>>>> +obj-$(CONFIG_MISC_INIT_R) += misc.o
>>>> here change to:
>>>> obj-y += misc.o
>>>>
>>>>>
>>>>>     ifndef CONFIG_SPL_BUILD
>>>>>     obj-$(CONFIG_BOARD_COMMON)    += board.o
>>>>> diff --git a/board/samsung/common/misc.c
>>>>> b/board/samsung/common/misc.c new file mode 100644 index
>>>>> 0000000..3764d12
>>>>> --- /dev/null
>>>>> +++ b/board/samsung/common/misc.c
>>>>> @@ -0,0 +1,14 @@
>>>>> +/*
>>>>> + * Copyright (C) 2013 Samsung Electronics
>>>>> + * Przemyslaw Marczak <p.marczak@samsung.com>
>>>>> + *
>>>>> + * SPDX-License-Identifier:    GPL-2.0+
>>>>> + */
>>>>> +
>>>>> +#include <common.h>
>>>>> +
>>>>
>>>> and here:
>>>> #ifdef CONFIG_MISC_INIT_R
>>>>
>>>>> +/* Common for Samsung boards */
>>>>> +int misc_init_r(void)
>>>>> +{
>>>>> +    return 0;
>>>>> +}
>>>>>
>>>> #endif
>>>>
>>>> In this way we can add other functions in the future even without
>> CONFIG_MISC_INIT_R.
>>>
>>> partly agree.
>>> But, I doubt what is the role of misc.c file.
>>> because of the meaning of miscellaneous is ambiguous, this file have
>>> possibility to be messy.
>>> So, please let me know what is your plan to this file.
>>>
>>
>> I first planned put there only implementation of misc_init_r() and it's
>> subfunctions - as the easy way to display logo and menu for Samsung
>> boards.
>> Piotr has suggested to change the purpose of this file as misc not only
>> for misc_init_r implementation...
> Przemyslaw, I asked you question: what is the misc.c file for?
> If for misc_init_r only then I think the file name "misc.c" is confusing.
> If also other common functions can be put there, then the define MISC_INIT_R
> to compile this file is wrong.
>

Yes, and next I said that maybe I will change this config dependency, 
and now I try to do it.

>>
>>>>
>>>> Is it better solution?
>>>>
>>>> Thank you,
>>>
>>> Thanks,
>>> Minkyu Kang.
>>>
>>
>> Thank you,
>> --
>> Przemyslaw Marczak
>> Samsung R&D Institute Poland
>> Samsung Electronics
>> p.marczak at samsung.com
>
> Best regards,
> Piotr Wilczek
>
>
>
>

Thank you,
-- 
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com

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

* [U-Boot] [PATCH v5 04/12] samsung: misc: move display logo function to misc.c file.
  2014-01-14  8:55         ` Minkyu Kang
@ 2014-01-15 10:20           ` Przemyslaw Marczak
  0 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-15 10:20 UTC (permalink / raw)
  To: u-boot

Hi Minkyu,

On 01/14/2014 09:55 AM, Minkyu Kang wrote:
> Dear Przemyslaw Marczak,
>
> On 14/01/14 17:02, Przemyslaw Marczak wrote:
>> Hello Jaehoon,
>>
>> On 01/14/2014 04:41 AM, Jaehoon Chung wrote:
>>> Dear Przemyslaw,
>>>
>>> On 01/10/2014 11:31 PM, Przemyslaw Marczak wrote:
>>>> board/samsung/common/misc.c:
>>>> - move draw_logo() function from exynos_fb.c
>>>> - add get_tizen_logo_info() function call removed from board files
>>>>
>>>> boards:
>>>> - update board files
>>>> - add CONFIG_MISC_INIT_R to Universal, Trats and Trats2
>>>>
>>>> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
>>>> Tested-by: Hyungwon Hwang <human.hwang@samsung.com>
>>>> ---
>>>> changes v2:
>>>> - configs cleanup
>>>> - add check logo address before display
>>>>
>>>> Changes v3:
>>>> - none
>>>>
>>>> Changes v4:
>>>> - none
>>>>
>>>> Changes v5:
>>>> - none
>>>>
>>>>    board/samsung/common/misc.c              |   42 ++++++++++++++++++++++++++++++
>>>>    board/samsung/trats/trats.c              |    3 ---
>>>>    board/samsung/trats2/trats2.c            |    4 ---
>>>>    board/samsung/universal_c210/universal.c |    4 ---
>>>>    drivers/video/exynos_fb.c                |   28 --------------------
>>>>    include/configs/s5pc210_universal.h      |    3 +++
>>>>    include/configs/trats.h                  |    3 +++
>>>>    include/configs/trats2.h                 |    3 +++
>>>>    8 files changed, 51 insertions(+), 39 deletions(-)
>>>>
>>>> diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
>>>> index 3764d12..6188e29 100644
>>>> --- a/board/samsung/common/misc.c
>>>> +++ b/board/samsung/common/misc.c
>>>> @@ -6,9 +6,51 @@
>>>>     */
>>>>
>>>>    #include <common.h>
>>>> +#include <lcd.h>
>>>> +#include <libtizen.h>
>>>> +
>>>> +#ifdef CONFIG_CMD_BMP
>>>> +static void draw_logo(void)
>>>> +{
>>>> +    int x, y;
>>>> +    ulong addr;
>>>> +
>>>> +#ifdef CONFIG_TIZEN
>>>> +    get_tizen_logo_info(&panel_info);
>>>> +#else
>>>> +    return;
>>> if CONFIG_TINZE didn't set, draw_logo should be just return, right?
>>> Then I think this point could be changed more readable.
>>>
>>> #ifdef CONFIG_TIZEN
>>>      int x, y;
>>>      ulong addr;
>>>
>>>      get_tizen_logo_info(...);
>>>
>>>      add = panel_info.logo_addr;
>>>      ...
>>>      bmp_display(addr, x, y);
>>> #endif
>>>
>>> how about?
>>>
>>> Best Regards,
>>> Jaehoon Chung
>>>
>>>
>>
>> You know, this file is common for all Samsung platforms,and I think this function should not depends only on Tizen logo. In this case user can choose other logo just by adding function like "get_logo" instead of the return statement. I also think that there is need for some common function which allows set proper logo by board config, but maybe not in this patch set?
>
> I agreed with you.
>
> You said that "there is need for some common function which allows set proper logo by board config".
> At previous version of board files, you already have common function (init_panel_info - even though this function is not for the logo but I think, it's enough).
>
> @@ -484,10 +484,6 @@ void init_panel_info(vidinfo_t *vid)
>   	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;
>
> If you remove this change at each boards, then you don't have add ifdef CONFIG_TIZEN at draw_logo function.
> It can be split common stuffs and board specific stuffs efficiently.
> How you think?
>
> Thanks,
> Minkyu Kang.
>

Actually I had something else on my mind but this is more simply, so I 
will change this back.

Thank you,
-- 
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com

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

* [U-Boot] [PATCH v5 03/12] samsung: common: Add misc file and common function misc_init_r().
  2014-01-15  8:18             ` Przemyslaw Marczak
@ 2014-01-17  6:26               ` Minkyu Kang
  2014-01-17  8:36                 ` Przemyslaw Marczak
  0 siblings, 1 reply; 147+ messages in thread
From: Minkyu Kang @ 2014-01-17  6:26 UTC (permalink / raw)
  To: u-boot

On 15/01/14 17:18, Przemyslaw Marczak wrote:
> Hello Piotr,
> 
> On 01/15/2014 09:08 AM, Piotr Wilczek wrote:
>> Dear Przemyslaw,
>>
>>> -----Original Message-----
>>> From: Przemyslaw Marczak [mailto:p.marczak at samsung.com]
>>> Sent: Wednesday, January 15, 2014 8:51 AM
>>> To: Minkyu Kang
>>> Cc: u-boot at lists.denx.de; jh80.chung at samsung.com;
>>> human.hwang at samsung.com; dh09.lee at samsung.com; ideal.song at samsung.com;
>>> Piotr Wilczek; Lukasz Majewski
>>> Subject: Re: [PATCH v5 03/12] samsung: common: Add misc file and common
>>> function misc_init_r().
>>>
>>> Hello,
>>>
>>> On 01/15/2014 08:35 AM, Minkyu Kang wrote:
>>>> On 14/01/14 22:55, Przemyslaw Marczak wrote:
>>>>> Hello,
>>>>> In case of discussion with Piotr Wilczek maybe it is better to make
>>> some changes in this patch.
>>>>>
>>>>> On 01/10/2014 03:31 PM, Przemyslaw Marczak wrote:
>>>>>> Config: CONFIG_MISC_INIT_R enables implementation of misc_init_r()
>>>>>> in common file::
>>>>>> - board/samsung/common/misc.c
>>>>>>
>>>>>> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
>>>>>> Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
>>>>>> ---
>>>>>> Changes v2:
>>>>>> - change CONFIG_SAMSUNG to CONFIG_MISC_INIT_R
>>>>>>
>>>>>> Changes v3:
>>>>>> - fix merge conflict in board/samsung/common/Makefile
>>>>>>
>>>>>> Changes v4:
>>>>>> - none
>>>>>>
>>>>>> Changes v5:
>>>>>> - add acked-by
>>>>>>
>>>>>>     board/samsung/common/Makefile |    1 +
>>>>>>     board/samsung/common/misc.c   |   14 ++++++++++++++
>>>>>>     2 files changed, 15 insertions(+)
>>>>>>     create mode 100644 board/samsung/common/misc.c
>>>>>>
>>>>>> diff --git a/board/samsung/common/Makefile
>>>>>> b/board/samsung/common/Makefile index 22bd6b1..79547a3 100644
>>>>>> --- a/board/samsung/common/Makefile
>>>>>> +++ b/board/samsung/common/Makefile
>>>>>> @@ -8,6 +8,7 @@
>>>>>>     obj-$(CONFIG_SOFT_I2C_MULTI_BUS) += multi_i2c.o
>>>>>>     obj-$(CONFIG_THOR_FUNCTION) += thor.o
>>>>>>     obj-$(CONFIG_CMD_USB_MASS_STORAGE) += ums.o
>>>>>> +obj-$(CONFIG_MISC_INIT_R) += misc.o
>>>>> here change to:
>>>>> obj-y += misc.o
>>>>>
>>>>>>
>>>>>>     ifndef CONFIG_SPL_BUILD
>>>>>>     obj-$(CONFIG_BOARD_COMMON)    += board.o
>>>>>> diff --git a/board/samsung/common/misc.c
>>>>>> b/board/samsung/common/misc.c new file mode 100644 index
>>>>>> 0000000..3764d12
>>>>>> --- /dev/null
>>>>>> +++ b/board/samsung/common/misc.c
>>>>>> @@ -0,0 +1,14 @@
>>>>>> +/*
>>>>>> + * Copyright (C) 2013 Samsung Electronics
>>>>>> + * Przemyslaw Marczak <p.marczak@samsung.com>
>>>>>> + *
>>>>>> + * SPDX-License-Identifier:    GPL-2.0+
>>>>>> + */
>>>>>> +
>>>>>> +#include <common.h>
>>>>>> +
>>>>>
>>>>> and here:
>>>>> #ifdef CONFIG_MISC_INIT_R
>>>>>
>>>>>> +/* Common for Samsung boards */
>>>>>> +int misc_init_r(void)
>>>>>> +{
>>>>>> +    return 0;
>>>>>> +}
>>>>>>
>>>>> #endif
>>>>>
>>>>> In this way we can add other functions in the future even without
>>> CONFIG_MISC_INIT_R.
>>>>
>>>> partly agree.
>>>> But, I doubt what is the role of misc.c file.
>>>> because of the meaning of miscellaneous is ambiguous, this file have
>>>> possibility to be messy.
>>>> So, please let me know what is your plan to this file.
>>>>
>>>
>>> I first planned put there only implementation of misc_init_r() and it's
>>> subfunctions - as the easy way to display logo and menu for Samsung
>>> boards.
>>> Piotr has suggested to change the purpose of this file as misc not only
>>> for misc_init_r implementation...
>> Przemyslaw, I asked you question: what is the misc.c file for?
>> If for misc_init_r only then I think the file name "misc.c" is confusing.
>> If also other common functions can be put there, then the define MISC_INIT_R
>> to compile this file is wrong.
>>
> 
> Yes, and next I said that maybe I will change this config dependency, and now I try to do it.
> 

Actually, I feel negative to this changes.
Because misc_init_r is a board specific.
How you can support if someone want to do something (board specific things) on misc_init_r?
I totally understand why you add misc_init_r to common directory. - It means you don't have to explain why you added it :)
but it looks little weird.
So we will discuss that misc_init_r should go to each boards or stay here? (misc_init_r function only, not including key, menu, logo.. etc)

Please let me know your opinions.

Thanks,
Minkyu Kang.

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

* [U-Boot] [PATCH v5 03/12] samsung: common: Add misc file and common function misc_init_r().
  2014-01-17  6:26               ` Minkyu Kang
@ 2014-01-17  8:36                 ` Przemyslaw Marczak
  2014-01-20  7:06                   ` Minkyu Kang
  0 siblings, 1 reply; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-17  8:36 UTC (permalink / raw)
  To: u-boot

On 01/17/2014 07:26 AM, Minkyu Kang wrote:
> On 15/01/14 17:18, Przemyslaw Marczak wrote:
>> Hello Piotr,
>>
>> On 01/15/2014 09:08 AM, Piotr Wilczek wrote:
>>> Dear Przemyslaw,
>>>
>>>> -----Original Message-----
>>>> From: Przemyslaw Marczak [mailto:p.marczak at samsung.com]
>>>> Sent: Wednesday, January 15, 2014 8:51 AM
>>>> To: Minkyu Kang
>>>> Cc: u-boot at lists.denx.de; jh80.chung at samsung.com;
>>>> human.hwang at samsung.com; dh09.lee at samsung.com; ideal.song at samsung.com;
>>>> Piotr Wilczek; Lukasz Majewski
>>>> Subject: Re: [PATCH v5 03/12] samsung: common: Add misc file and common
>>>> function misc_init_r().
>>>>
>>>> Hello,
>>>>
>>>> On 01/15/2014 08:35 AM, Minkyu Kang wrote:
>>>>> On 14/01/14 22:55, Przemyslaw Marczak wrote:
>>>>>> Hello,
>>>>>> In case of discussion with Piotr Wilczek maybe it is better to make
>>>> some changes in this patch.
>>>>>>
>>>>>> On 01/10/2014 03:31 PM, Przemyslaw Marczak wrote:
>>>>>>> Config: CONFIG_MISC_INIT_R enables implementation of misc_init_r()
>>>>>>> in common file::
>>>>>>> - board/samsung/common/misc.c
>>>>>>>
>>>>>>> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
>>>>>>> Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
>>>>>>> ---
>>>>>>> Changes v2:
>>>>>>> - change CONFIG_SAMSUNG to CONFIG_MISC_INIT_R
>>>>>>>
>>>>>>> Changes v3:
>>>>>>> - fix merge conflict in board/samsung/common/Makefile
>>>>>>>
>>>>>>> Changes v4:
>>>>>>> - none
>>>>>>>
>>>>>>> Changes v5:
>>>>>>> - add acked-by
>>>>>>>
>>>>>>>      board/samsung/common/Makefile |    1 +
>>>>>>>      board/samsung/common/misc.c   |   14 ++++++++++++++
>>>>>>>      2 files changed, 15 insertions(+)
>>>>>>>      create mode 100644 board/samsung/common/misc.c
>>>>>>>
>>>>>>> diff --git a/board/samsung/common/Makefile
>>>>>>> b/board/samsung/common/Makefile index 22bd6b1..79547a3 100644
>>>>>>> --- a/board/samsung/common/Makefile
>>>>>>> +++ b/board/samsung/common/Makefile
>>>>>>> @@ -8,6 +8,7 @@
>>>>>>>      obj-$(CONFIG_SOFT_I2C_MULTI_BUS) += multi_i2c.o
>>>>>>>      obj-$(CONFIG_THOR_FUNCTION) += thor.o
>>>>>>>      obj-$(CONFIG_CMD_USB_MASS_STORAGE) += ums.o
>>>>>>> +obj-$(CONFIG_MISC_INIT_R) += misc.o
>>>>>> here change to:
>>>>>> obj-y += misc.o
>>>>>>
>>>>>>>
>>>>>>>      ifndef CONFIG_SPL_BUILD
>>>>>>>      obj-$(CONFIG_BOARD_COMMON)    += board.o
>>>>>>> diff --git a/board/samsung/common/misc.c
>>>>>>> b/board/samsung/common/misc.c new file mode 100644 index
>>>>>>> 0000000..3764d12
>>>>>>> --- /dev/null
>>>>>>> +++ b/board/samsung/common/misc.c
>>>>>>> @@ -0,0 +1,14 @@
>>>>>>> +/*
>>>>>>> + * Copyright (C) 2013 Samsung Electronics
>>>>>>> + * Przemyslaw Marczak <p.marczak@samsung.com>
>>>>>>> + *
>>>>>>> + * SPDX-License-Identifier:    GPL-2.0+
>>>>>>> + */
>>>>>>> +
>>>>>>> +#include <common.h>
>>>>>>> +
>>>>>>
>>>>>> and here:
>>>>>> #ifdef CONFIG_MISC_INIT_R
>>>>>>
>>>>>>> +/* Common for Samsung boards */
>>>>>>> +int misc_init_r(void)
>>>>>>> +{
>>>>>>> +    return 0;
>>>>>>> +}
>>>>>>>
>>>>>> #endif
>>>>>>
>>>>>> In this way we can add other functions in the future even without
>>>> CONFIG_MISC_INIT_R.
>>>>>
>>>>> partly agree.
>>>>> But, I doubt what is the role of misc.c file.
>>>>> because of the meaning of miscellaneous is ambiguous, this file have
>>>>> possibility to be messy.
>>>>> So, please let me know what is your plan to this file.
>>>>>
>>>>
>>>> I first planned put there only implementation of misc_init_r() and it's
>>>> subfunctions - as the easy way to display logo and menu for Samsung
>>>> boards.
>>>> Piotr has suggested to change the purpose of this file as misc not only
>>>> for misc_init_r implementation...
>>> Przemyslaw, I asked you question: what is the misc.c file for?
>>> If for misc_init_r only then I think the file name "misc.c" is confusing.
>>> If also other common functions can be put there, then the define MISC_INIT_R
>>> to compile this file is wrong.
>>>
>>
>> Yes, and next I said that maybe I will change this config dependency, and now I try to do it.
>>
>
> Actually, I feel negative to this changes.
> Because misc_init_r is a board specific.
> How you can support if someone want to do something (board specific things) on misc_init_r?
> I totally understand why you add misc_init_r to common directory. - It means you don't have to explain why you added it :)
> but it looks little weird.
> So we will discuss that misc_init_r should go to each boards or stay here? (misc_init_r function only, not including key, menu, logo.. etc)
>
> Please let me know your opinions.
>
> Thanks,
> Minkyu Kang.
>
>

The reason why I used misc_init_r for a common purposes is that it is 
called after all hardware initialization and before u-boot main_loop(), 
then I don't need to introduce another generic function just to check 
buttons - this is the only reason.

Moreover at this time misc_init_r() is implemented only in Trats2, and 
there are easy to move things.

You're right - misc_init_r is board specific, but if we make it as a 
common function, then we also can add board specific code, called here 
but implemented in board files.

If this is wrong, then where is the better place for check keys, display 
logo and any more vendor common things?

Or maybe the better solution is just add new function callback to 
board_init_r() for some vendor specific purposes - and then it can be 
used for other vendors platforms too.

Thank you,
-- 
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com

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

* [U-Boot] [PATCH v5 03/12] samsung: common: Add misc file and common function misc_init_r().
  2014-01-17  8:36                 ` Przemyslaw Marczak
@ 2014-01-20  7:06                   ` Minkyu Kang
  0 siblings, 0 replies; 147+ messages in thread
From: Minkyu Kang @ 2014-01-20  7:06 UTC (permalink / raw)
  To: u-boot

On 17/01/14 17:36, Przemyslaw Marczak wrote:
> On 01/17/2014 07:26 AM, Minkyu Kang wrote:
>> On 15/01/14 17:18, Przemyslaw Marczak wrote:
>>>>>>>
>>>>>>> In this way we can add other functions in the future even without
>>>>> CONFIG_MISC_INIT_R.
>>>>>>
>>>>>> partly agree.
>>>>>> But, I doubt what is the role of misc.c file.
>>>>>> because of the meaning of miscellaneous is ambiguous, this file have
>>>>>> possibility to be messy.
>>>>>> So, please let me know what is your plan to this file.
>>>>>>
>>>>>
>>>>> I first planned put there only implementation of misc_init_r() and it's
>>>>> subfunctions - as the easy way to display logo and menu for Samsung
>>>>> boards.
>>>>> Piotr has suggested to change the purpose of this file as misc not only
>>>>> for misc_init_r implementation...
>>>> Przemyslaw, I asked you question: what is the misc.c file for?
>>>> If for misc_init_r only then I think the file name "misc.c" is confusing.
>>>> If also other common functions can be put there, then the define MISC_INIT_R
>>>> to compile this file is wrong.
>>>>
>>>
>>> Yes, and next I said that maybe I will change this config dependency, and now I try to do it.
>>>
>>
>> Actually, I feel negative to this changes.
>> Because misc_init_r is a board specific.
>> How you can support if someone want to do something (board specific things) on misc_init_r?
>> I totally understand why you add misc_init_r to common directory. - It means you don't have to explain why you added it :)
>> but it looks little weird.
>> So we will discuss that misc_init_r should go to each boards or stay here? (misc_init_r function only, not including key, menu, logo.. etc)
>>
>> Please let me know your opinions.
>>
>> Thanks,
>> Minkyu Kang.
>>
>>
> 
> The reason why I used misc_init_r for a common purposes is that it is called after all hardware initialization and before u-boot main_loop(), then I don't need to introduce another generic function just to check buttons - this is the only reason.
> 
> Moreover at this time misc_init_r() is implemented only in Trats2, and there are easy to move things.
> 
> You're right - misc_init_r is board specific, but if we make it as a common function, then we also can add board specific code, called here but implemented in board files.

No. it looks wrong architecture.

> 
> If this is wrong, then where is the better place for check keys, display logo and any more vendor common things?

Stay at common directory.

> 
> Or maybe the better solution is just add new function callback to board_init_r() for some vendor specific purposes - and then it can be used for other vendors platforms too.

No.

Here, I've made pseudo code for it.
How you think?

diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
new file mode 100644
index 0000000..cdc48bb
--- /dev/null
+++ b/board/samsung/common/misc.c
@@ -0,0 +1,18 @@
+#ifdef CONFIG_LCD_MENU
+void keys_init(void)
+{
+       /* TODO */
+}
+
+void check_boot_mode(void)
+{
+       /* TODO */
+}
+#endif
+
+#ifdef CONFIG_CMD_BMP
+void draw_logo(void)
+{
+       /* TODO */
+}
+#endif
diff --git a/board/samsung/trats2/trats2.c b/board/samsung/trats2/trats2.c
index be15357..eb4f4dc 100644
--- a/board/samsung/trats2/trats2.c
+++ b/board/samsung/trats2/trats2.c
@@ -623,6 +623,16 @@ int misc_init_r(void)
 
        show_hw_revision();
 
+#ifdef CONFIG_LCD_MENU
+       keys_init();
+       check_boot_mode();
+#endif
+
+#ifdef CONFIG_CMD_BMP
+       if (panel_info.logo_on)
+               draw_logo();
+#endif
+
        return 0;
 }
 #endif

Thanks,
Minkyu Kang.

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

* [U-Boot] [PATCH v6 00/11] Introduce Samsung misc file and LCD menu.
  2013-12-03 18:03 [U-Boot] [PATCH 00/10] Introduce Samsung misc file and LCD menu Przemyslaw Marczak
                   ` (14 preceding siblings ...)
  2014-01-10 14:31 ` [U-Boot] [PATCH v5 " Przemyslaw Marczak
@ 2014-01-22 10:24 ` Przemyslaw Marczak
  2014-01-22 10:24   ` [U-Boot] [PATCH v6 01/11] s5p: gpio: change gpio coding method for s5p gpio Przemyslaw Marczak
                     ` (11 more replies)
  15 siblings, 12 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-22 10:24 UTC (permalink / raw)
  To: u-boot

This patch set includes changes required to:
- properly use of all gpios
- introduce common file for Samsung misc code
- keys support (PWR, VOL:UP,DOWN)
- console support on LCD
- 16bpp logo support
- introduce LCD menu on Samsung devices

Each version changes are described in each patch commit msg.

Przemyslaw Marczak (11):
  s5p: gpio: change gpio coding method for s5p gpio.
  trats2: Code cleanup.
  samsung: common: Add file for common functions, draw_logo() cleanup.
  common: lcd.c: fix data abort exception when try to access bmp header
  lib: tizen: change Tizen logo with the new one.
  video: exynos: fimd: add support for various display color modes
  samsung: boards: update display configs with 16bpp mode.
  samsung: misc: Add LCD download menu.
  trats: add LCD download menu support
  trats2: add LCD download menu support
  universal: add LCD download menu support

 arch/arm/include/asm/arch-exynos/gpio.h  |  245 +-
 arch/arm/include/asm/arch-s5pc1xx/gpio.h |   47 +-
 board/samsung/common/Makefile            |    1 +
 board/samsung/common/misc.c              |  387 ++
 board/samsung/trats/trats.c              |   18 +-
 board/samsung/trats2/trats2.c            |   31 +-
 board/samsung/universal_c210/universal.c |   18 +-
 common/lcd.c                             |   27 +-
 drivers/gpio/s5p_gpio.c                  |   15 +-
 drivers/power/battery/bat_trats2.c       |    2 +-
 drivers/video/exynos_fb.c                |   28 -
 drivers/video/exynos_fimd.c              |   15 +-
 include/configs/s5p_goni.h               |    4 +-
 include/configs/s5pc210_universal.h      |   43 +-
 include/configs/trats.h                  |   35 +-
 include/configs/trats2.h                 |   32 +-
 include/lcd.h                            |    2 +
 include/power/max77686_pmic.h            |    2 +
 include/power/pmic.h                     |    1 -
 include/samsung/misc.h                   |   25 +
 lib/tizen/tizen.c                        |   21 +-
 lib/tizen/tizen_hd_logo.h                | 5057 ---------------
 lib/tizen/tizen_hd_logo_data.h           |   15 -
 lib/tizen/tizen_logo_16bpp.h             |10025 ++++++++++++++++++++++++++++++
 lib/tizen/tizen_logo_16bpp_gzip.h        |  727 +++
 25 files changed, 11470 insertions(+), 5353 deletions(-)
 create mode 100644 board/samsung/common/misc.c
 create mode 100644 include/samsung/misc.h
 delete mode 100644 lib/tizen/tizen_hd_logo.h
 delete mode 100644 lib/tizen/tizen_hd_logo_data.h
 create mode 100644 lib/tizen/tizen_logo_16bpp.h
 create mode 100644 lib/tizen/tizen_logo_16bpp_gzip.h

-- 
1.7.9.5

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

* [U-Boot] [PATCH v6 01/11] s5p: gpio: change gpio coding method for s5p gpio.
  2014-01-22 10:24 ` [U-Boot] [PATCH v6 00/11] Introduce Samsung misc file and LCD menu Przemyslaw Marczak
@ 2014-01-22 10:24   ` Przemyslaw Marczak
  2014-01-22 10:24   ` [U-Boot] [PATCH v6 02/11] trats2: Code cleanup Przemyslaw Marczak
                     ` (10 subsequent siblings)
  11 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-22 10:24 UTC (permalink / raw)
  To: u-boot

Old s5p gpio coding method was not clean and was not working properly
for all parts and banks. New method is clean and easy to extend.

Gpio coding mask:
0x000000ff - pin number
0x00ffff00 - bank offset
0xff000000 - part number

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>

---
Changes v2:
- none

Changes v3:
- fix merge conflict in arch/arm/include/asm/arch-exynos/gpio.h
- add exynos5420 gpio coding
- update file: board/samsung/trats2/trats2.c

Changes v4:
- code cleanup

Changes v5:
- none

Changes v6:
- none

 arch/arm/include/asm/arch-exynos/gpio.h  |  245 +++++++++---------------------
 arch/arm/include/asm/arch-s5pc1xx/gpio.h |   47 ++++--
 board/samsung/trats2/trats2.c            |    8 +-
 drivers/gpio/s5p_gpio.c                  |   15 +-
 include/configs/s5p_goni.h               |    4 +-
 include/configs/s5pc210_universal.h      |   12 +-
 include/configs/trats.h                  |    4 +-
 7 files changed, 132 insertions(+), 203 deletions(-)

diff --git a/arch/arm/include/asm/arch-exynos/gpio.h b/arch/arm/include/asm/arch-exynos/gpio.h
index 2a19852..d6868fa 100644
--- a/arch/arm/include/asm/arch-exynos/gpio.h
+++ b/arch/arm/include/asm/arch-exynos/gpio.h
@@ -247,180 +247,81 @@ void s5p_gpio_set_rate(struct s5p_gpio_bank *bank, int gpio, int mode);
 
 /* GPIO pins per bank  */
 #define GPIO_PER_BANK 8
-
-#define exynos4_gpio_part1_get_nr(bank, pin) \
-	((((((unsigned int) &(((struct exynos4_gpio_part1 *) \
-			       EXYNOS4_GPIO_PART1_BASE)->bank)) \
-	    - EXYNOS4_GPIO_PART1_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin)
-
-#define EXYNOS4_GPIO_PART1_MAX ((sizeof(struct exynos4_gpio_part1) \
-			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
-
-#define exynos4_gpio_part2_get_nr(bank, pin) \
-	(((((((unsigned int) &(((struct exynos4_gpio_part2 *) \
-				EXYNOS4_GPIO_PART2_BASE)->bank)) \
-	    - EXYNOS4_GPIO_PART2_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin) + EXYNOS4_GPIO_PART1_MAX)
-
-#define exynos4x12_gpio_part1_get_nr(bank, pin) \
-	((((((unsigned int) &(((struct exynos4x12_gpio_part1 *) \
-			       EXYNOS4X12_GPIO_PART1_BASE)->bank)) \
-	    - EXYNOS4X12_GPIO_PART1_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin)
-
-#define EXYNOS4X12_GPIO_PART1_MAX ((sizeof(struct exynos4x12_gpio_part1) \
-			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
-
-#define exynos4x12_gpio_part2_get_nr(bank, pin) \
-	(((((((unsigned int) &(((struct exynos4x12_gpio_part2 *) \
-				EXYNOS4X12_GPIO_PART2_BASE)->bank)) \
-	    - EXYNOS4X12_GPIO_PART2_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin) + EXYNOS4X12_GPIO_PART1_MAX)
-
-#define EXYNOS4X12_GPIO_PART2_MAX ((sizeof(struct exynos4x12_gpio_part2) \
-			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
-
-#define exynos4x12_gpio_part3_get_nr(bank, pin) \
-	(((((((unsigned int) &(((struct exynos4x12_gpio_part3 *) \
-				EXYNOS4X12_GPIO_PART3_BASE)->bank)) \
-	    - EXYNOS4X12_GPIO_PART3_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin) + EXYNOS4X12_GPIO_PART2_MAX)
-
-#define exynos5_gpio_part1_get_nr(bank, pin) \
-	((((((unsigned int) &(((struct exynos5_gpio_part1 *) \
-			       EXYNOS5_GPIO_PART1_BASE)->bank)) \
-	    - EXYNOS5_GPIO_PART1_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin)
-
-#define EXYNOS5_GPIO_PART1_MAX ((sizeof(struct exynos5_gpio_part1) \
-			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
-
-#define exynos5_gpio_part2_get_nr(bank, pin) \
-	(((((((unsigned int) &(((struct exynos5_gpio_part2 *) \
-				EXYNOS5_GPIO_PART2_BASE)->bank)) \
-	    - EXYNOS5_GPIO_PART2_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin) + EXYNOS5_GPIO_PART1_MAX)
-
-#define EXYNOS5_GPIO_PART2_MAX ((sizeof(struct exynos5_gpio_part2) \
-			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
-
-#define exynos5_gpio_part3_get_nr(bank, pin) \
-	(((((((unsigned int) &(((struct exynos5_gpio_part3 *) \
-				EXYNOS5_GPIO_PART3_BASE)->bank)) \
-	    - EXYNOS5_GPIO_PART3_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin) + EXYNOS5_GPIO_PART2_MAX)
-
-
-/* EXYNOS5420 */
-#define exynos5420_gpio_part1_get_nr(bank, pin) \
-	((((((unsigned int) &(((struct exynos5420_gpio_part1 *)\
-			       EXYNOS5420_GPIO_PART1_BASE)->bank)) \
-	    - EXYNOS5420_GPIO_PART1_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin)
-
-#define EXYNOS5420_GPIO_PART1_MAX ((sizeof(struct exynos5420_gpio_part1) \
-			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
-
-#define exynos5420_gpio_part2_get_nr(bank, pin) \
-	(((((((unsigned int) &(((struct exynos5420_gpio_part2 *)\
-				EXYNOS5420_GPIO_PART2_BASE)->bank)) \
-	    - EXYNOS5420_GPIO_PART2_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin) + EXYNOS5420_GPIO_PART1_MAX)
-
-#define EXYNOS5420_GPIO_PART2_MAX ((sizeof(struct exynos5420_gpio_part2) \
-			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
-
-#define exynos5420_gpio_part3_get_nr(bank, pin) \
-	(((((((unsigned int) &(((struct exynos5420_gpio_part3 *)\
-				EXYNOS5420_GPIO_PART3_BASE)->bank)) \
-	    - EXYNOS5420_GPIO_PART3_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin) + EXYNOS5420_GPIO_PART2_MAX)
-
-#define EXYNOS5420_GPIO_PART3_MAX ((sizeof(struct exynos5420_gpio_part3) \
-			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
-
-#define exynos5420_gpio_part4_get_nr(bank, pin) \
-	(((((((unsigned int) &(((struct exynos5420_gpio_part4 *)\
-				EXYNOS5420_GPIO_PART4_BASE)->bank)) \
-	    - EXYNOS5420_GPIO_PART4_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin) + EXYNOS5420_GPIO_PART3_MAX)
-
-#define EXYNOS5420_GPIO_PART4_MAX ((sizeof(struct exynos5420_gpio_part4) \
-			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
-
-#define EXYNOS5420_GPIO_PART5_MAX ((sizeof(struct exynos5420_gpio_part5) \
-			    / sizeof(struct s5p_gpio_bank)) * GPIO_PER_BANK)
-
-static inline unsigned int s5p_gpio_base(int nr)
+#define S5P_GPIO_PART_SHIFT	(24)
+#define S5P_GPIO_PART_MASK	(0xff)
+#define S5P_GPIO_BANK_SHIFT	(8)
+#define S5P_GPIO_BANK_MASK	(0xffff)
+#define S5P_GPIO_PIN_MASK	(0xff)
+
+#define S5P_GPIO_SET_PART(x) \
+			(((x) & S5P_GPIO_PART_MASK) << S5P_GPIO_PART_SHIFT)
+
+#define S5P_GPIO_GET_PART(x) \
+			(((x) >> S5P_GPIO_PART_SHIFT) & S5P_GPIO_PART_MASK)
+
+#define S5P_GPIO_SET_PIN(x) \
+			((x) & S5P_GPIO_PIN_MASK)
+
+#define EXYNOS4_GPIO_SET_BANK(part, bank) \
+			((((unsigned)&(((struct exynos4_gpio_part##part *) \
+			EXYNOS4_GPIO_PART##part##_BASE)->bank) \
+			- EXYNOS4_GPIO_PART##part##_BASE) \
+			& S5P_GPIO_BANK_MASK) << S5P_GPIO_BANK_SHIFT)
+
+#define EXYNOS4X12_GPIO_SET_BANK(part, bank) \
+			((((unsigned)&(((struct exynos4x12_gpio_part##part *) \
+			EXYNOS4X12_GPIO_PART##part##_BASE)->bank) \
+			- EXYNOS4X12_GPIO_PART##part##_BASE) \
+			& S5P_GPIO_BANK_MASK) << S5P_GPIO_BANK_SHIFT)
+
+#define EXYNOS5_GPIO_SET_BANK(part, bank) \
+			((((unsigned)&(((struct exynos5420_gpio_part##part *) \
+			EXYNOS5420_GPIO_PART##part##_BASE)->bank) \
+			- EXYNOS5_GPIO_PART##part##_BASE) \
+			& S5P_GPIO_BANK_MASK) << S5P_GPIO_BANK_SHIFT)
+
+#define EXYNOS5420_GPIO_SET_BANK(part, bank) \
+			((((unsigned)&(((struct exynos5420_gpio_part##part *) \
+			EXYNOS5420_GPIO_PART##part##_BASE)->bank) \
+			- EXYNOS5420_GPIO_PART##part##_BASE) \
+			& S5P_GPIO_BANK_MASK) << S5P_GPIO_BANK_SHIFT)
+
+#define exynos4_gpio_get(part, bank, pin) \
+			(S5P_GPIO_SET_PART(part) | \
+			EXYNOS4_GPIO_SET_BANK(part, bank) | \
+			S5P_GPIO_SET_PIN(pin))
+
+#define exynos4x12_gpio_get(part, bank, pin) \
+			(S5P_GPIO_SET_PART(part) | \
+			EXYNOS4X12_GPIO_SET_BANK(part, bank) | \
+			S5P_GPIO_SET_PIN(pin))
+
+#define exynos5420_gpio_get(part, bank, pin) \
+			(S5P_GPIO_SET_PART(part) | \
+			EXYNOS5420_GPIO_SET_BANK(part, bank) | \
+			S5P_GPIO_SET_PIN(pin))
+
+#define exynos5_gpio_get(part, bank, pin) \
+			(S5P_GPIO_SET_PART(part) | \
+			EXYNOS5_GPIO_SET_BANK(part, bank) | \
+			S5P_GPIO_SET_PIN(pin))
+
+static inline unsigned int s5p_gpio_base(int gpio)
 {
-	if (cpu_is_exynos5()) {
-		if (proid_is_exynos5420()) {
-			if (nr < EXYNOS5420_GPIO_PART1_MAX)
-				return EXYNOS5420_GPIO_PART1_BASE;
-			else if (nr < EXYNOS5420_GPIO_PART2_MAX)
-				return EXYNOS5420_GPIO_PART2_BASE;
-			else if (nr < EXYNOS5420_GPIO_PART3_MAX)
-				return EXYNOS5420_GPIO_PART3_BASE;
-			else
-				return EXYNOS5420_GPIO_PART4_BASE;
-		} else {
-			if (nr < EXYNOS5_GPIO_PART1_MAX)
-				return EXYNOS5_GPIO_PART1_BASE;
-			else if (nr < EXYNOS5_GPIO_PART2_MAX)
-				return EXYNOS5_GPIO_PART2_BASE;
-			else
-				return EXYNOS5_GPIO_PART3_BASE;
-		}
-	} else if (cpu_is_exynos4()) {
-		if (nr < EXYNOS4_GPIO_PART1_MAX)
-			return EXYNOS4_GPIO_PART1_BASE;
-		else
-			return EXYNOS4_GPIO_PART2_BASE;
+	unsigned gpio_part = S5P_GPIO_GET_PART(gpio);
+
+	switch (gpio_part) {
+	case 1:
+		return samsung_get_base_gpio_part1();
+	case 2:
+		return samsung_get_base_gpio_part2();
+	case 3:
+		return samsung_get_base_gpio_part3();
+	case 4:
+		return samsung_get_base_gpio_part4();
+	default:
+		return 0;
 	}
-
-	return 0;
-}
-
-static inline unsigned int s5p_gpio_part_max(int nr)
-{
-	if (cpu_is_exynos5()) {
-		if (proid_is_exynos5420()) {
-			if (nr < EXYNOS5420_GPIO_PART1_MAX)
-				return 0;
-			else if (nr < EXYNOS5420_GPIO_PART2_MAX)
-				return EXYNOS5420_GPIO_PART1_MAX;
-			else if (nr < EXYNOS5420_GPIO_PART3_MAX)
-				return EXYNOS5420_GPIO_PART2_MAX;
-			else if (nr < EXYNOS5420_GPIO_PART4_MAX)
-				return EXYNOS5420_GPIO_PART3_MAX;
-			else
-				return EXYNOS5420_GPIO_PART4_MAX;
-		} else {
-			if (nr < EXYNOS5_GPIO_PART1_MAX)
-				return 0;
-			else if (nr < EXYNOS5_GPIO_PART2_MAX)
-				return EXYNOS5_GPIO_PART1_MAX;
-			else
-				return EXYNOS5_GPIO_PART2_MAX;
-		}
-	} else if (cpu_is_exynos4()) {
-		if (proid_is_exynos4412()) {
-			if (nr < EXYNOS4X12_GPIO_PART1_MAX)
-				return 0;
-			else if (nr < EXYNOS4X12_GPIO_PART2_MAX)
-				return EXYNOS4X12_GPIO_PART1_MAX;
-			else
-				return EXYNOS4X12_GPIO_PART2_MAX;
-		} else {
-			if (nr < EXYNOS4_GPIO_PART1_MAX)
-				return 0;
-			else
-				return EXYNOS4_GPIO_PART1_MAX;
-		}
-	}
-
-	return 0;
 }
 #endif
 
diff --git a/arch/arm/include/asm/arch-s5pc1xx/gpio.h b/arch/arm/include/asm/arch-s5pc1xx/gpio.h
index ac60fe6..da8df74 100644
--- a/arch/arm/include/asm/arch-s5pc1xx/gpio.h
+++ b/arch/arm/include/asm/arch-s5pc1xx/gpio.h
@@ -125,20 +125,45 @@ void s5p_gpio_set_rate(struct s5p_gpio_bank *bank, int gpio, int mode);
 /* GPIO pins per bank  */
 #define GPIO_PER_BANK 8
 
-static inline unsigned int s5p_gpio_base(int nr)
-{
-	return S5PC110_GPIO_BASE;
-}
+#define S5P_GPIO_PART_SHIFT	(24)
+#define S5P_GPIO_PART_MASK	(0xff)
+#define S5P_GPIO_BANK_SHIFT	(8)
+#define S5P_GPIO_BANK_MASK	(0xffff)
+#define S5P_GPIO_PIN_MASK	(0xff)
+
+#define S5P_GPIO_SET_PART(x) \
+			(((x) & S5P_GPIO_PART_MASK) << S5P_GPIO_PART_SHIFT)
+
+#define S5P_GPIO_GET_PART(x) \
+			(((x) >> S5P_GPIO_PART_SHIFT) & S5P_GPIO_PART_MASK)
+
+#define S5P_GPIO_SET_PIN(x) \
+			((x) & S5P_GPIO_PIN_MASK)
 
-static inline unsigned int s5p_gpio_part_max(int nr)
+#define S5PC100_SET_BANK(bank) \
+			(((unsigned)&(((struct s5pc100_gpio *) \
+			S5PC100_GPIO_BASE)->bank) - S5PC100_GPIO_BASE) \
+			& S5P_GPIO_BANK_MASK) << S5P_GPIO_BANK_SHIFT)
+
+#define S5PC110_SET_BANK(bank) \
+			((((unsigned)&(((struct s5pc110_gpio *) \
+			S5PC110_GPIO_BASE)->bank) - S5PC110_GPIO_BASE) \
+			& S5P_GPIO_BANK_MASK) << S5P_GPIO_BANK_SHIFT)
+
+#define s5pc100_gpio_get(bank, pin) \
+			(S5P_GPIO_SET_PART(0) | \
+			S5PC100_SET_BANK(bank) | \
+			S5P_GPIO_SET_PIN(pin))
+
+#define s5pc110_gpio_get(bank, pin) \
+			(S5P_GPIO_SET_PART(0) | \
+			S5PC110_SET_BANK(bank) | \
+			S5P_GPIO_SET_PIN(pin))
+
+static inline unsigned int s5p_gpio_base(int nr)
 {
-	return 0;
+	return samsung_get_base_gpio();
 }
-
-#define s5pc110_gpio_get_nr(bank, pin)	  \
-	((((((unsigned int)&(((struct s5pc110_gpio *)S5PC110_GPIO_BASE)->bank))\
-	    - S5PC110_GPIO_BASE) / sizeof(struct s5p_gpio_bank)) \
-	  * GPIO_PER_BANK) + pin)
 #endif
 
 /* Pin configurations */
diff --git a/board/samsung/trats2/trats2.c b/board/samsung/trats2/trats2.c
index be15357..1e96fdc 100644
--- a/board/samsung/trats2/trats2.c
+++ b/board/samsung/trats2/trats2.c
@@ -144,17 +144,17 @@ static void board_init_i2c(void)
 int get_soft_i2c_scl_pin(void)
 {
 	if (I2C_ADAP_HWNR)
-		return exynos4x12_gpio_part2_get_nr(m2, 1); /* I2C9 */
+		return exynos4x12_gpio_get(2, m2, 1); /* I2C9 */
 	else
-		return exynos4x12_gpio_part1_get_nr(f1, 4); /* I2C8 */
+		return exynos4x12_gpio_get(1, f1, 4); /* I2C8 */
 }
 
 int get_soft_i2c_sda_pin(void)
 {
 	if (I2C_ADAP_HWNR)
-		return exynos4x12_gpio_part2_get_nr(m2, 0); /* I2C9 */
+		return exynos4x12_gpio_get(2, m2, 0); /* I2C9 */
 	else
-		return exynos4x12_gpio_part1_get_nr(f1, 5); /* I2C8 */
+		return exynos4x12_gpio_get(1, f1, 5); /* I2C8 */
 }
 #endif
 
diff --git a/drivers/gpio/s5p_gpio.c b/drivers/gpio/s5p_gpio.c
index 7eeb96d..11a0472 100644
--- a/drivers/gpio/s5p_gpio.c
+++ b/drivers/gpio/s5p_gpio.c
@@ -9,6 +9,11 @@
 #include <asm/io.h>
 #include <asm/gpio.h>
 
+#define S5P_GPIO_GET_BANK(x)	((x >> S5P_GPIO_BANK_SHIFT) \
+				& S5P_GPIO_BANK_MASK)
+
+#define S5P_GPIO_GET_PIN(x)	(x & S5P_GPIO_PIN_MASK)
+
 #define CON_MASK(x)		(0xf << ((x) << 2))
 #define CON_SFR(x, v)		((v) << ((x) << 2))
 
@@ -124,17 +129,15 @@ void s5p_gpio_set_rate(struct s5p_gpio_bank *bank, int gpio, int mode)
 
 struct s5p_gpio_bank *s5p_gpio_get_bank(unsigned gpio)
 {
-	int bank;
-	unsigned g = gpio - s5p_gpio_part_max(gpio);
+	unsigned bank = S5P_GPIO_GET_BANK(gpio);
+	unsigned base = s5p_gpio_base(gpio);
 
-	bank = g / GPIO_PER_BANK;
-	bank *= sizeof(struct s5p_gpio_bank);
-	return (struct s5p_gpio_bank *) (s5p_gpio_base(gpio) + bank);
+	return (struct s5p_gpio_bank *)(base + bank);
 }
 
 int s5p_gpio_get_pin(unsigned gpio)
 {
-	return gpio % GPIO_PER_BANK;
+	return S5P_GPIO_GET_PIN(gpio);
 }
 
 /* Common GPIO API */
diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
index 0590d20..4cdf937 100644
--- a/include/configs/s5p_goni.h
+++ b/include/configs/s5p_goni.h
@@ -208,8 +208,8 @@
 /*
  * I2C Settings
  */
-#define CONFIG_SOFT_I2C_GPIO_SCL s5pc110_gpio_get_nr(j4, 3)
-#define CONFIG_SOFT_I2C_GPIO_SDA s5pc110_gpio_get_nr(j4, 0)
+#define CONFIG_SOFT_I2C_GPIO_SCL s5pc110_gpio_get(j4, 3)
+#define CONFIG_SOFT_I2C_GPIO_SDA s5pc110_gpio_get(j4, 0)
 
 #define CONFIG_SYS_I2C
 #define CONFIG_SYS_I2C_SOFT		/* I2C bit-banged */
diff --git a/include/configs/s5pc210_universal.h b/include/configs/s5pc210_universal.h
index d9e4c56..02a1c99 100644
--- a/include/configs/s5pc210_universal.h
+++ b/include/configs/s5pc210_universal.h
@@ -229,8 +229,8 @@
 /*
  * I2C Settings
  */
-#define CONFIG_SOFT_I2C_GPIO_SCL exynos4_gpio_part1_get_nr(b, 7)
-#define CONFIG_SOFT_I2C_GPIO_SDA exynos4_gpio_part1_get_nr(b, 6)
+#define CONFIG_SOFT_I2C_GPIO_SCL exynos4_gpio_get(1, b, 7)
+#define CONFIG_SOFT_I2C_GPIO_SDA exynos4_gpio_get(1, b, 6)
 
 #define CONFIG_SYS_I2C
 #define CONFIG_SYS_I2C_SOFT		/* I2C bit-banged */
@@ -253,10 +253,10 @@
  */
 #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 CONFIG_SOFT_SPI_GPIO_SCLK exynos4_gpio_get(2, y3, 1)
+#define CONFIG_SOFT_SPI_GPIO_MOSI exynos4_gpio_get(2, y3, 3)
+#define CONFIG_SOFT_SPI_GPIO_MISO exynos4_gpio_get(2, y3, 0)
+#define CONFIG_SOFT_SPI_GPIO_CS exynos4_gpio_get(2, y4, 3)
 
 #define SPI_DELAY udelay(1)
 #undef SPI_INIT
diff --git a/include/configs/trats.h b/include/configs/trats.h
index 6cd15c2..6480424 100644
--- a/include/configs/trats.h
+++ b/include/configs/trats.h
@@ -283,8 +283,8 @@
 #include <asm/arch/gpio.h>
 
 /* I2C FG */
-#define CONFIG_SOFT_I2C_GPIO_SCL exynos4_gpio_part2_get_nr(y4, 1)
-#define CONFIG_SOFT_I2C_GPIO_SDA exynos4_gpio_part2_get_nr(y4, 0)
+#define CONFIG_SOFT_I2C_GPIO_SCL exynos4_gpio_get(2, y4, 1)
+#define CONFIG_SOFT_I2C_GPIO_SDA exynos4_gpio_get(2, y4, 0)
 
 #define CONFIG_POWER
 #define CONFIG_POWER_I2C
-- 
1.7.9.5

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

* [U-Boot] [PATCH v6 02/11] trats2: Code cleanup.
  2014-01-22 10:24 ` [U-Boot] [PATCH v6 00/11] Introduce Samsung misc file and LCD menu Przemyslaw Marczak
  2014-01-22 10:24   ` [U-Boot] [PATCH v6 01/11] s5p: gpio: change gpio coding method for s5p gpio Przemyslaw Marczak
@ 2014-01-22 10:24   ` Przemyslaw Marczak
  2014-01-22 10:24   ` [U-Boot] [PATCH v6 03/11] samsung: common: Add file for common functions, draw_logo() cleanup Przemyslaw Marczak
                     ` (9 subsequent siblings)
  11 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-22 10:24 UTC (permalink / raw)
  To: u-boot

Remove wrong and unused env variables
Trats2 is not as GT-I8800.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
Cc: Piotr Wilczek <p.wilczek@samsung.com>

---
Changes v2:
- none

Changes v3:
- none

Changes v4:
- add "include pmic.h" to "max77686_pmic.h"

Changes v5:
- add acked-by

Changes v6:
- misc_init_r() - leave in trats2.c

 board/samsung/trats2/trats2.c      |   12 ++----------
 drivers/power/battery/bat_trats2.c |    2 +-
 include/power/max77686_pmic.h      |    2 ++
 3 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/board/samsung/trats2/trats2.c b/board/samsung/trats2/trats2.c
index 1e96fdc..feb6c4c 100644
--- a/board/samsung/trats2/trats2.c
+++ b/board/samsung/trats2/trats2.c
@@ -72,15 +72,12 @@ static void check_hw_revision(void)
 int checkboard(void)
 {
 	puts("Board:\tTRATS2\n");
+	printf("HW Revision:\t0x%04x\n", board_rev);
+
 	return 0;
 }
 #endif
 
-static void show_hw_revision(void)
-{
-	printf("HW Revision:\t0x%04x\n", board_rev);
-}
-
 u32 get_board_rev(void)
 {
 	return board_rev;
@@ -618,11 +615,6 @@ void init_panel_info(vidinfo_t *vid)
 #ifdef CONFIG_MISC_INIT_R
 int misc_init_r(void)
 {
-	setenv("model", "GT-I8800");
-	setenv("board", "TRATS2");
-
-	show_hw_revision();
-
 	return 0;
 }
 #endif
diff --git a/drivers/power/battery/bat_trats2.c b/drivers/power/battery/bat_trats2.c
index f264832..94015aa 100644
--- a/drivers/power/battery/bat_trats2.c
+++ b/drivers/power/battery/bat_trats2.c
@@ -8,7 +8,7 @@
 #include <common.h>
 #include <power/pmic.h>
 #include <power/battery.h>
-#include <power/max8997_pmic.h>
+#include <power/max77693_pmic.h>
 #include <errno.h>
 
 static struct battery battery_trats;
diff --git a/include/power/max77686_pmic.h b/include/power/max77686_pmic.h
index 16e9016..c2a772a 100644
--- a/include/power/max77686_pmic.h
+++ b/include/power/max77686_pmic.h
@@ -8,6 +8,8 @@
 #ifndef __MAX77686_H_
 #define __MAX77686_H_
 
+#include <power/pmic.h>
+
 enum {
 	MAX77686_REG_PMIC_ID		= 0x0,
 	MAX77686_REG_PMIC_INTSRC,
-- 
1.7.9.5

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

* [U-Boot] [PATCH v6 03/11] samsung: common: Add file for common functions, draw_logo() cleanup.
  2014-01-22 10:24 ` [U-Boot] [PATCH v6 00/11] Introduce Samsung misc file and LCD menu Przemyslaw Marczak
  2014-01-22 10:24   ` [U-Boot] [PATCH v6 01/11] s5p: gpio: change gpio coding method for s5p gpio Przemyslaw Marczak
  2014-01-22 10:24   ` [U-Boot] [PATCH v6 02/11] trats2: Code cleanup Przemyslaw Marczak
@ 2014-01-22 10:24   ` Przemyslaw Marczak
  2014-01-22 10:24   ` [U-Boot] [PATCH v6 04/11] common: lcd.c: fix data abort exception when try to access bmp header Przemyslaw Marczak
                     ` (8 subsequent siblings)
  11 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-22 10:24 UTC (permalink / raw)
  To: u-boot

Changes:

new file:
- board/samsung/common/misc.c
  depends on: CONFIG_MISC_COMMON
- move draw_logo() to misc.c

configs: trats, trats2, universal:
- enable CONFIG_MISC_COMMON,
- enable CONFIG_MISC_INIT_R,
- add misc_init_r() and call draw_logo() in it.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
---
Changes v2:
- change CONFIG_SAMSUNG to CONFIG_MISC_INIT_R

Changes v3:
- fix merge conflict in board/samsung/common/Makefile

Changes v4:
- none

Changes v5:
- add acked-by

Changes v6:
- move board/samsung/common/misc.h to include/samsung/misc.h
- squash with v5 commit: "samsung: misc: move display logo function
  to misc.c file."
- change config name to CONFIG_MISC_COMMON in board/samsung/common/Makefile
- trats, trats2, universal - call draw logo() in misc_init_r()

 board/samsung/common/Makefile            |    1 +
 board/samsung/common/misc.c              |   41 ++++++++++++++++++++++++++++++
 board/samsung/trats/trats.c              |   11 ++++++++
 board/samsung/trats2/trats2.c            |    4 +++
 board/samsung/universal_c210/universal.c |   11 ++++++++
 drivers/video/exynos_fb.c                |   28 --------------------
 include/configs/s5pc210_universal.h      |    5 ++++
 include/configs/trats.h                  |    5 ++++
 include/configs/trats2.h                 |    6 ++++-
 include/samsung/misc.h                   |    8 ++++++
 10 files changed, 91 insertions(+), 29 deletions(-)
 create mode 100644 board/samsung/common/misc.c
 create mode 100644 include/samsung/misc.h

diff --git a/board/samsung/common/Makefile b/board/samsung/common/Makefile
index 22bd6b1..7d2bb8c 100644
--- a/board/samsung/common/Makefile
+++ b/board/samsung/common/Makefile
@@ -8,6 +8,7 @@
 obj-$(CONFIG_SOFT_I2C_MULTI_BUS) += multi_i2c.o
 obj-$(CONFIG_THOR_FUNCTION) += thor.o
 obj-$(CONFIG_CMD_USB_MASS_STORAGE) += ums.o
+obj-$(CONFIG_MISC_COMMON) += misc.o
 
 ifndef CONFIG_SPL_BUILD
 obj-$(CONFIG_BOARD_COMMON)	+= board.o
diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
new file mode 100644
index 0000000..f6be891
--- /dev/null
+++ b/board/samsung/common/misc.c
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2013 Samsung Electronics
+ * Przemyslaw Marczak <p.marczak@samsung.com>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+#include <lcd.h>
+#include <libtizen.h>
+#include <samsung/misc.h>
+
+#ifdef CONFIG_CMD_BMP
+void draw_logo(void)
+{
+	int x, y;
+	ulong addr;
+
+	addr = panel_info.logo_addr;
+	if (!addr) {
+		error("There is no logo data.");
+		return;
+	}
+
+	if (panel_info.vl_width >= panel_info.logo_width) {
+		x = ((panel_info.vl_width - panel_info.logo_width) >> 1);
+	} else {
+		x = 0;
+		printf("Warning: image width is bigger than display width\n");
+	}
+
+	if (panel_info.vl_height >= panel_info.logo_height) {
+		y = ((panel_info.vl_height - panel_info.logo_height) >> 1);
+	} else {
+		y = 0;
+		printf("Warning: image height is bigger than display height\n");
+	}
+
+	bmp_display(addr, x, y);
+}
+#endif /* CONFIG_CMD_BMP */
diff --git a/board/samsung/trats/trats.c b/board/samsung/trats/trats.c
index 640a193..a644b60 100644
--- a/board/samsung/trats/trats.c
+++ b/board/samsung/trats/trats.c
@@ -786,3 +786,14 @@ void init_panel_info(vidinfo_t *vid)
 
 	setenv("lcdinfo", "lcd=s6e8ax0");
 }
+
+#ifdef CONFIG_MISC_INIT_R
+int misc_init_r(void)
+{
+#ifdef CONFIG_CMD_BMP
+	if (panel_info.logo_on)
+		draw_logo();
+#endif
+	return 0;
+}
+#endif
diff --git a/board/samsung/trats2/trats2.c b/board/samsung/trats2/trats2.c
index feb6c4c..4834f90 100644
--- a/board/samsung/trats2/trats2.c
+++ b/board/samsung/trats2/trats2.c
@@ -615,6 +615,10 @@ void init_panel_info(vidinfo_t *vid)
 #ifdef CONFIG_MISC_INIT_R
 int misc_init_r(void)
 {
+#ifdef CONFIG_CMD_BMP
+	if (panel_info.logo_on)
+		draw_logo();
+#endif
 	return 0;
 }
 #endif
diff --git a/board/samsung/universal_c210/universal.c b/board/samsung/universal_c210/universal.c
index 54d0e1e..1c8b8b8 100644
--- a/board/samsung/universal_c210/universal.c
+++ b/board/samsung/universal_c210/universal.c
@@ -511,3 +511,14 @@ int board_init(void)
 
 	return 0;
 }
+
+#ifdef CONFIG_MISC_INIT_R
+int misc_init_r(void)
+{
+#ifdef CONFIG_CMD_BMP
+	if (panel_info.logo_on)
+		draw_logo();
+#endif
+	return 0;
+}
+#endif
diff --git a/drivers/video/exynos_fb.c b/drivers/video/exynos_fb.c
index 7d4c6e0..00a0a11 100644
--- a/drivers/video/exynos_fb.c
+++ b/drivers/video/exynos_fb.c
@@ -62,31 +62,6 @@ static void exynos_lcd_init(vidinfo_t *vid)
 	lcd_set_flush_dcache(1);
 }
 
-#ifdef CONFIG_CMD_BMP
-static void draw_logo(void)
-{
-	int x, y;
-	ulong addr;
-
-	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);
-}
-#endif
-
 void __exynos_cfg_lcd_gpio(void)
 {
 }
@@ -323,9 +298,6 @@ void lcd_enable(void)
 	if (panel_info.logo_on) {
 		memset((void *) gd->fb_base, 0, panel_width * panel_height *
 				(NBITS(panel_info.vl_bpix) >> 3));
-#ifdef CONFIG_CMD_BMP
-		draw_logo();
-#endif
 	}
 
 	lcd_panel_on(&panel_info);
diff --git a/include/configs/s5pc210_universal.h b/include/configs/s5pc210_universal.h
index 02a1c99..6b98bed 100644
--- a/include/configs/s5pc210_universal.h
+++ b/include/configs/s5pc210_universal.h
@@ -269,6 +269,11 @@ void universal_spi_sda(int bit);
 int universal_spi_read(void);
 #endif
 
+/* Common misc for Samsung */
+#define CONFIG_MISC_COMMON
+
+#define CONFIG_MISC_INIT_R
+
 /*
  * LCD Settings
  */
diff --git a/include/configs/trats.h b/include/configs/trats.h
index 6480424..0b93e03 100644
--- a/include/configs/trats.h
+++ b/include/configs/trats.h
@@ -302,6 +302,11 @@
 #define CONFIG_USB_GADGET_VBUS_DRAW	2
 #define CONFIG_USB_CABLE_CHECK
 
+/* Common misc for Samsung */
+#define CONFIG_MISC_COMMON
+
+#define CONFIG_MISC_INIT_R
+
 /* LCD */
 #define CONFIG_EXYNOS_FB
 #define CONFIG_LCD
diff --git a/include/configs/trats2.h b/include/configs/trats2.h
index c9ce828..8ba8a0f 100644
--- a/include/configs/trats2.h
+++ b/include/configs/trats2.h
@@ -272,7 +272,6 @@
 #define CONFIG_EFI_PARTITION
 #define CONFIG_PARTITION_UUIDS
 
-#define CONFIG_MISC_INIT_R
 #define CONFIG_BOARD_EARLY_INIT_F
 
 /* I2C */
@@ -313,6 +312,11 @@ int get_soft_i2c_sda_pin(void);
 #define CONFIG_USB_GADGET_VBUS_DRAW	2
 #define CONFIG_USB_CABLE_CHECK
 
+/* Common misc for Samsung */
+#define CONFIG_MISC_COMMON
+
+#define CONFIG_MISC_INIT_R
+
 /* LCD */
 #define CONFIG_EXYNOS_FB
 #define CONFIG_LCD
diff --git a/include/samsung/misc.h b/include/samsung/misc.h
new file mode 100644
index 0000000..8ea9223
--- /dev/null
+++ b/include/samsung/misc.h
@@ -0,0 +1,8 @@
+#ifndef __SAMSUNG_MISC_COMMON_H__
+#define __SAMSUNG_MISC_COMMON_H__
+
+#ifdef CONFIG_CMD_BMP
+void draw_logo(void);
+#endif
+
+#endif /* __SAMSUNG_MISC_COMMON_H__ */
-- 
1.7.9.5

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

* [U-Boot] [PATCH v6 04/11] common: lcd.c: fix data abort exception when try to access bmp header
  2014-01-22 10:24 ` [U-Boot] [PATCH v6 00/11] Introduce Samsung misc file and LCD menu Przemyslaw Marczak
                     ` (2 preceding siblings ...)
  2014-01-22 10:24   ` [U-Boot] [PATCH v6 03/11] samsung: common: Add file for common functions, draw_logo() cleanup Przemyslaw Marczak
@ 2014-01-22 10:24   ` Przemyslaw Marczak
  2014-01-22 10:24   ` [U-Boot] [PATCH v6 05/11] lib: tizen: change Tizen logo with the new one Przemyslaw Marczak
                     ` (7 subsequent siblings)
  11 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-22 10:24 UTC (permalink / raw)
  To: u-boot

Changes:
- le16_to_cpu() to get_unaligned_le16()
- le32_to_cpu() to get_unaligned_le32()
when access fields in struct bmp header.

This changes avoids data abort exception caused by unaligned data access.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Anatolij Gustschin <agust@denx.de>

---
Changes v2:
- new patch

Changes v3:
- common/Makefile - remove CFLAG: -mno-unaligned-access
- common/lcd.c - fix data abort exception when access bmp_header

Changes v4:
- add Acked-by

Changes v5:
- none

Changes v6:
- none

 common/lcd.c |   27 +++++++++++++--------------
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/common/lcd.c b/common/lcd.c
index 56bf067..aa81522 100644
--- a/common/lcd.c
+++ b/common/lcd.c
@@ -26,7 +26,7 @@
 #endif
 #include <lcd.h>
 #include <watchdog.h>
-
+#include <asm/unaligned.h>
 #include <splash.h>
 
 #if defined(CONFIG_CPU_PXA25X) || defined(CONFIG_CPU_PXA27X) || \
@@ -777,9 +777,9 @@ static void lcd_display_rle8_bitmap(bmp_image_t *bmp, ushort *cmap, uchar *fb,
 	int x, y;
 	int decode = 1;
 
-	width = le32_to_cpu(bmp->header.width);
-	height = le32_to_cpu(bmp->header.height);
-	bmap = (uchar *)bmp + le32_to_cpu(bmp->header.data_offset);
+	width = get_unaligned_le32(&bmp->header.width);
+	height = get_unaligned_le32(&bmp->header.height);
+	bmap = (uchar *)bmp + get_unaligned_le32(&bmp->header.data_offset);
 
 	x = 0;
 	y = height - 1;
@@ -900,9 +900,10 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
 		return 1;
 	}
 
-	width = le32_to_cpu(bmp->header.width);
-	height = le32_to_cpu(bmp->header.height);
-	bmp_bpix = le16_to_cpu(bmp->header.bit_count);
+	width = get_unaligned_le32(&bmp->header.width);
+	height = get_unaligned_le32(&bmp->header.height);
+	bmp_bpix = get_unaligned_le16(&bmp->header.bit_count);
+
 	colors = 1 << bmp_bpix;
 
 	bpix = NBITS(panel_info.vl_bpix);
@@ -917,9 +918,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
 	/* We support displaying 8bpp BMPs on 16bpp LCDs */
 	if (bpix != bmp_bpix && !(bmp_bpix == 8 && bpix == 16)) {
 		printf ("Error: %d bit/pixel mode, but BMP has %d bit/pixel\n",
-			bpix,
-			le16_to_cpu(bmp->header.bit_count));
-
+			bpix, get_unaligned_le16(&bmp->header.bit_count));
 		return 1;
 	}
 
@@ -956,7 +955,6 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
 		}
 	}
 #endif
-
 	/*
 	 *  BMP format for Monochrome assumes that the state of a
 	 * pixel is described on a per Bit basis, not per Byte.
@@ -987,15 +985,16 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
 	if ((y + height) > panel_info.vl_row)
 		height = panel_info.vl_row - y;
 
-	bmap = (uchar *) bmp + le32_to_cpu(bmp->header.data_offset);
-	fb   = (uchar *) (lcd_base +
+	bmap = (uchar *)bmp + get_unaligned_le32(&bmp->header.data_offset);
+	fb   = (uchar *)(lcd_base +
 		(y + height - 1) * lcd_line_length + x * bpix / 8);
 
 	switch (bmp_bpix) {
 	case 1: /* pass through */
 	case 8:
 #ifdef CONFIG_LCD_BMP_RLE8
-		if (le32_to_cpu(bmp->header.compression) == BMP_BI_RLE8) {
+		u32 compression = get_unaligned_le32(&bmp->header.compression);
+		if (compression == BMP_BI_RLE8) {
 			if (bpix != 16) {
 				/* TODO implement render code for bpix != 16 */
 				printf("Error: only support 16 bpix");
-- 
1.7.9.5

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

* [U-Boot] [PATCH v6 05/11] lib: tizen: change Tizen logo with the new one.
  2014-01-22 10:24 ` [U-Boot] [PATCH v6 00/11] Introduce Samsung misc file and LCD menu Przemyslaw Marczak
                     ` (3 preceding siblings ...)
  2014-01-22 10:24   ` [U-Boot] [PATCH v6 04/11] common: lcd.c: fix data abort exception when try to access bmp header Przemyslaw Marczak
@ 2014-01-22 10:24   ` Przemyslaw Marczak
  2014-01-22 10:24   ` [U-Boot] [PATCH v6 06/11] video: exynos: fimd: add support for various display color modes Przemyslaw Marczak
                     ` (6 subsequent siblings)
  11 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-22 10:24 UTC (permalink / raw)
  To: u-boot

This is big size patch. Please follow the link:
http://www.denx.de/wiki/pub/U-Boot/TooBigPatches/0005-lib-tizen-change-Tizen-logo-with-the-new-one.patch

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

* [U-Boot] [PATCH v6 06/11] video: exynos: fimd: add support for various display color modes
  2014-01-22 10:24 ` [U-Boot] [PATCH v6 00/11] Introduce Samsung misc file and LCD menu Przemyslaw Marczak
                     ` (4 preceding siblings ...)
  2014-01-22 10:24   ` [U-Boot] [PATCH v6 05/11] lib: tizen: change Tizen logo with the new one Przemyslaw Marczak
@ 2014-01-22 10:24   ` Przemyslaw Marczak
  2014-01-22 10:24   ` [U-Boot] [PATCH v6 07/11] samsung: boards: update display configs with 16bpp mode Przemyslaw Marczak
                     ` (5 subsequent siblings)
  11 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-22 10:24 UTC (permalink / raw)
  To: u-boot

Now fimd BPP color mode depends on vl_bpp value in struct "panel_info".

There is only 16BPP mode check, default mode is 24BPP.
Other fimd modes are usually unneeded and also needs some fimd driver
modifications and tests.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>

---
Changes v2:
- check panel_info vl_bpix when setting fimd color mode
- move boards configs update to another commit.

Changes v3:
- none

Changes v4:
- none

Changes v5:
- none

Changes v6:
- none

 drivers/video/exynos_fimd.c |   15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/video/exynos_fimd.c b/drivers/video/exynos_fimd.c
index f962c4f..cebbba7 100644
--- a/drivers/video/exynos_fimd.c
+++ b/drivers/video/exynos_fimd.c
@@ -73,18 +73,19 @@ static void exynos_fimd_set_par(unsigned int win_id)
 	/* DATAPATH is DMA */
 	cfg |= EXYNOS_WINCON_DATAPATH_DMA;
 
-	if (pvid->logo_on) /* To get proprietary LOGO */
-		cfg |= EXYNOS_WINCON_WSWP_ENABLE;
-	else /* To get output console on LCD */
-		cfg |= EXYNOS_WINCON_HAWSWP_ENABLE;
+	cfg |= EXYNOS_WINCON_HAWSWP_ENABLE;
 
 	/* dma burst is 16 */
 	cfg |= EXYNOS_WINCON_BURSTLEN_16WORD;
 
-	if (pvid->logo_on) /* To get proprietary LOGO */
-		cfg |= EXYNOS_WINCON_BPPMODE_24BPP_888;
-	else /* To get output console on LCD */
+	switch (pvid->vl_bpix) {
+	case 4:
 		cfg |= EXYNOS_WINCON_BPPMODE_16BPP_565;
+		break;
+	default:
+		cfg |= EXYNOS_WINCON_BPPMODE_24BPP_888;
+		break;
+	}
 
 	writel(cfg, (unsigned int)&fimd_ctrl->wincon0 +
 			EXYNOS_WINCON(win_id));
-- 
1.7.9.5

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

* [U-Boot] [PATCH v6 07/11] samsung: boards: update display configs with 16bpp mode.
  2014-01-22 10:24 ` [U-Boot] [PATCH v6 00/11] Introduce Samsung misc file and LCD menu Przemyslaw Marczak
                     ` (5 preceding siblings ...)
  2014-01-22 10:24   ` [U-Boot] [PATCH v6 06/11] video: exynos: fimd: add support for various display color modes Przemyslaw Marczak
@ 2014-01-22 10:24   ` Przemyslaw Marczak
  2014-01-22 10:24   ` [U-Boot] [PATCH v6 08/11] samsung: misc: Add LCD download menu Przemyslaw Marczak
                     ` (4 subsequent siblings)
  11 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-22 10:24 UTC (permalink / raw)
  To: u-boot

16 bpp mode is required by LCD console mode.
This change updates exynos board files.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>

---
Changes v2:
-- new patch

Changes v3:
- none

Changes v4:
- none

Changes v5:
- none

Changes v6:
- none

 board/samsung/trats/trats.c              |    2 +-
 board/samsung/trats2/trats2.c            |    2 +-
 board/samsung/universal_c210/universal.c |    2 +-
 include/configs/s5pc210_universal.h      |    2 +-
 include/configs/trats.h                  |    2 +-
 include/configs/trats2.h                 |    2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/board/samsung/trats/trats.c b/board/samsung/trats/trats.c
index a644b60..32a6cee 100644
--- a/board/samsung/trats/trats.c
+++ b/board/samsung/trats/trats.c
@@ -742,7 +742,7 @@ vidinfo_t panel_info = {
 	.vl_hsp		= CONFIG_SYS_LOW,
 	.vl_vsp		= CONFIG_SYS_LOW,
 	.vl_dp		= CONFIG_SYS_LOW,
-	.vl_bpix	= 5,	/* Bits per pixel, 2^5 = 32 */
+	.vl_bpix	= 4,	/* Bits per pixel, 2^4 = 16 */
 
 	/* s6e8ax0 Panel infomation */
 	.vl_hspw	= 5,
diff --git a/board/samsung/trats2/trats2.c b/board/samsung/trats2/trats2.c
index 4834f90..b60a2da 100644
--- a/board/samsung/trats2/trats2.c
+++ b/board/samsung/trats2/trats2.c
@@ -565,7 +565,7 @@ vidinfo_t panel_info = {
 	.vl_hsp		= CONFIG_SYS_LOW,
 	.vl_vsp		= CONFIG_SYS_LOW,
 	.vl_dp		= CONFIG_SYS_LOW,
-	.vl_bpix	= 5,	/* Bits per pixel, 2^5 = 32 */
+	.vl_bpix	= 4,	/* Bits per pixel, 2^4 = 16 */
 
 	/* s6e8ax0 Panel infomation */
 	.vl_hspw	= 5,
diff --git a/board/samsung/universal_c210/universal.c b/board/samsung/universal_c210/universal.c
index 1c8b8b8..e300da3 100644
--- a/board/samsung/universal_c210/universal.c
+++ b/board/samsung/universal_c210/universal.c
@@ -446,7 +446,7 @@ vidinfo_t panel_info = {
 	.vl_vsp		= CONFIG_SYS_HIGH,
 	.vl_dp		= CONFIG_SYS_HIGH,
 
-	.vl_bpix	= 5,	/* Bits per pixel */
+	.vl_bpix	= 4,	/* Bits per pixel */
 
 	/* LD9040 LCD Panel */
 	.vl_hspw	= 2,
diff --git a/include/configs/s5pc210_universal.h b/include/configs/s5pc210_universal.h
index 67b08fc..93b9dfb 100644
--- a/include/configs/s5pc210_universal.h
+++ b/include/configs/s5pc210_universal.h
@@ -280,7 +280,7 @@ int universal_spi_read(void);
 #define CONFIG_EXYNOS_FB
 #define CONFIG_LCD
 #define CONFIG_CMD_BMP
-#define CONFIG_BMP_32BPP
+#define CONFIG_BMP_16BPP
 #define CONFIG_LD9040
 #define CONFIG_EXYNOS_MIPI_DSIM
 #define CONFIG_VIDEO_BMP_GZIP
diff --git a/include/configs/trats.h b/include/configs/trats.h
index b1bdeaa..f5e796a 100644
--- a/include/configs/trats.h
+++ b/include/configs/trats.h
@@ -311,7 +311,7 @@
 #define CONFIG_EXYNOS_FB
 #define CONFIG_LCD
 #define CONFIG_CMD_BMP
-#define CONFIG_BMP_32BPP
+#define CONFIG_BMP_16BPP
 #define CONFIG_FB_ADDR		0x52504000
 #define CONFIG_S6E8AX0
 #define CONFIG_EXYNOS_MIPI_DSIM
diff --git a/include/configs/trats2.h b/include/configs/trats2.h
index 528e9a3..a856b56 100644
--- a/include/configs/trats2.h
+++ b/include/configs/trats2.h
@@ -321,7 +321,7 @@ int get_soft_i2c_sda_pin(void);
 #define CONFIG_EXYNOS_FB
 #define CONFIG_LCD
 #define CONFIG_CMD_BMP
-#define CONFIG_BMP_32BPP
+#define CONFIG_BMP_16BPP
 #define CONFIG_FB_ADDR		0x52504000
 #define CONFIG_S6E8AX0
 #define CONFIG_EXYNOS_MIPI_DSIM
-- 
1.7.9.5

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

* [U-Boot] [PATCH v6 08/11] samsung: misc: Add LCD download menu.
  2014-01-22 10:24 ` [U-Boot] [PATCH v6 00/11] Introduce Samsung misc file and LCD menu Przemyslaw Marczak
                     ` (6 preceding siblings ...)
  2014-01-22 10:24   ` [U-Boot] [PATCH v6 07/11] samsung: boards: update display configs with 16bpp mode Przemyslaw Marczak
@ 2014-01-22 10:24   ` Przemyslaw Marczak
  2014-01-22 10:24   ` [U-Boot] [PATCH v6 09/11] trats: add LCD download menu support Przemyslaw Marczak
                     ` (3 subsequent siblings)
  11 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-22 10:24 UTC (permalink / raw)
  To: u-boot

This simple LCD menu allows run one of download mode on device
without writing on console or for fast and easy upgrade.

This feature check user keys combination at boot:
- power key + volume up - download menu
- power key + volume down - thor mode (without menu)

New configs:
- CONFIG_LCD_MENU
- CONFIG_LCD_MENU_BOARD

For proper effect this feature needs following definitions:

Power key:
- KEY_PWR_PMIC_NAME - (string) pmic which supports power key check

Register address:
- KEY_PWR_STATUS_REG
- KEY_PWR_INTERRUPT_REG

Register power key mask:
- KEY_PWR_STATUS_MASK
- KEY_PWR_INTERRUPT_MASK

Gpio numbers:
- KEY_PWR_INTERRUPT_MASK
- KEY_VOL_DOWN_GPIO

Functions needs to be called:
- keys_init() - for set proper gpio direction
- check_boot_mode() - menu - main function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>

---
Changes v2:
- remove keys.h  - definitions should be in boards headers
- add misc.h
- code cleanup
- extend commit msg by more informations

Changes v3:
- none

Changes v4:
- code cleanup in board/samsung/common/misc.c
- add command result check
- clear PWR button interrupt flag after command finish to prevent immediatel
  mode exit in mode_leave_menu() function.
- introduce MODE_CMD_ARGC - max number of command arguments
- split array mode_cmd[] to mode_cmd[][] with separated arguments
- command support checking is now achieved without preprocessor ifdefs

Changes v5:
- remove duplicated headers
- add #ifdef CONFIG_GENERIC_MMC
- change udelay to mdelay

Changes v6:
- none

 board/samsung/common/misc.c |  344 +++++++++++++++++++++++++++++++++++++++++++
 include/samsung/misc.h      |   17 +++
 2 files changed, 361 insertions(+)

diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
index 15775e3..643f957 100644
--- a/board/samsung/common/misc.c
+++ b/board/samsung/common/misc.c
@@ -9,6 +9,350 @@
 #include <lcd.h>
 #include <libtizen.h>
 #include <samsung/misc.h>
+#include <errno.h>
+#include <version.h>
+#include <asm/sizes.h>
+#include <asm/arch/cpu.h>
+#include <asm/arch/gpio.h>
+#include <asm/gpio.h>
+#include <linux/input.h>
+#include <power/pmic.h>
+#include <mmc.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#ifdef CONFIG_LCD_MENU
+static int power_key_pressed(u32 reg)
+{
+	struct pmic *pmic;
+	u32 status;
+	u32 mask;
+
+	pmic = pmic_get(KEY_PWR_PMIC_NAME);
+	if (!pmic) {
+		printf("%s: Not found\n", KEY_PWR_PMIC_NAME);
+		return 0;
+	}
+
+	if (pmic_probe(pmic))
+		return 0;
+
+	if (reg == KEY_PWR_STATUS_REG)
+		mask = KEY_PWR_STATUS_MASK;
+	else
+		mask = KEY_PWR_INTERRUPT_MASK;
+
+	if (pmic_reg_read(pmic, reg, &status))
+		return 0;
+
+	return !!(status & mask);
+}
+
+static int key_pressed(int key)
+{
+	int value;
+
+	switch (key) {
+	case KEY_POWER:
+		value = power_key_pressed(KEY_PWR_INTERRUPT_REG);
+		break;
+	case KEY_VOLUMEUP:
+		value = !gpio_get_value(KEY_VOL_UP_GPIO);
+		break;
+	case KEY_VOLUMEDOWN:
+		value = !gpio_get_value(KEY_VOL_DOWN_GPIO);
+		break;
+	default:
+		value = 0;
+		break;
+	}
+
+	return value;
+}
+
+static int check_keys(void)
+{
+	int keys = 0;
+
+	if (key_pressed(KEY_POWER))
+		keys += KEY_POWER;
+	if (key_pressed(KEY_VOLUMEUP))
+		keys += KEY_VOLUMEUP;
+	if (key_pressed(KEY_VOLUMEDOWN))
+		keys += KEY_VOLUMEDOWN;
+
+	return keys;
+}
+
+/*
+ * 0 BOOT_MODE_INFO
+ * 1 BOOT_MODE_THOR
+ * 2 BOOT_MODE_UMS
+ * 3 BOOT_MODE_DFU
+ * 4 BOOT_MODE_EXIT
+ */
+static char *
+mode_name[BOOT_MODE_EXIT + 1] = {
+	"DEVICE",
+	"THOR",
+	"UMS",
+	"DFU",
+	"EXIT"
+};
+
+static char *
+mode_info[BOOT_MODE_EXIT + 1] = {
+	"info",
+	"downloader",
+	"mass storage",
+	"firmware update",
+	"and run normal boot"
+};
+
+#define MODE_CMD_ARGC	4
+
+static char *
+mode_cmd[BOOT_MODE_EXIT + 1][MODE_CMD_ARGC] = {
+	{"", "", "", ""},
+	{"thor", "0", "mmc", "0"},
+	{"ums", "0", "mmc", "0"},
+	{"dfu", "0", "mmc", "0"},
+	{"", "", "", ""},
+};
+
+static void display_board_info(void)
+{
+#ifdef CONFIG_GENERIC_MMC
+	struct mmc *mmc = find_mmc_device(0);
+#endif
+	vidinfo_t *vid = &panel_info;
+
+	lcd_position_cursor(4, 4);
+
+	lcd_printf("%s\n\t", U_BOOT_VERSION);
+	lcd_puts("\n\t\tBoard Info:\n");
+#ifdef CONFIG_SYS_BOARD
+	lcd_printf("\tBoard name: %s\n", CONFIG_SYS_BOARD);
+#endif
+#ifdef CONFIG_REVISION_TAG
+	lcd_printf("\tBoard rev: %u\n", get_board_rev());
+#endif
+	lcd_printf("\tDRAM banks: %u\n", CONFIG_NR_DRAM_BANKS);
+	lcd_printf("\tDRAM size: %u MB\n", gd->ram_size / SZ_1M);
+
+#ifdef CONFIG_GENERIC_MMC
+	if (mmc) {
+		if (!mmc->capacity)
+			mmc_init(mmc);
+
+		lcd_printf("\teMMC size: %llu MB\n", mmc->capacity / SZ_1M);
+	}
+#endif
+	if (vid)
+		lcd_printf("\tDisplay resolution: %u x % u\n",
+			   vid->vl_col, vid->vl_row);
+
+	lcd_printf("\tDisplay BPP: %u\n", 1 << vid->vl_bpix);
+}
+
+static int mode_leave_menu(int mode)
+{
+	char *exit_option;
+	char *exit_boot = "boot";
+	char *exit_back = "back";
+	cmd_tbl_t *cmd;
+	int cmd_result;
+	int cmd_repeatable;
+	int leave;
+
+	lcd_clear();
+
+	switch (mode) {
+	case BOOT_MODE_EXIT:
+		return 1;
+	case BOOT_MODE_INFO:
+		display_board_info();
+		exit_option = exit_back;
+		leave = 0;
+		break;
+	default:
+		cmd = find_cmd(mode_cmd[mode][0]);
+		if (cmd) {
+			printf("Enter: %s %s\n", mode_name[mode],
+						 mode_info[mode]);
+			lcd_printf("\n\n\t%s %s\n", mode_name[mode],
+						    mode_info[mode]);
+			lcd_puts("\n\tDo not turn off device before finish!\n");
+
+			cmd_result = cmd_process(0, MODE_CMD_ARGC,
+						 *(mode_cmd + mode),
+						 &cmd_repeatable, NULL);
+
+			if (cmd_result == CMD_RET_SUCCESS) {
+				printf("Command finished\n");
+				lcd_clear();
+				lcd_printf("\n\n\t%s finished\n",
+					   mode_name[mode]);
+
+				exit_option = exit_boot;
+				leave = 1;
+			} else {
+				printf("Command error\n");
+				lcd_clear();
+				lcd_printf("\n\n\t%s command error\n",
+					   mode_name[mode]);
+
+				exit_option = exit_back;
+				leave = 0;
+			}
+		} else {
+			lcd_puts("\n\n\tThis mode is not supported.\n");
+			exit_option = exit_back;
+			leave = 0;
+		}
+	}
+
+	lcd_printf("\n\n\tPress POWER KEY to %s\n", exit_option);
+
+	/* Clear PWR button Rising edge interrupt status flag */
+	power_key_pressed(KEY_PWR_INTERRUPT_REG);
+
+	/* Wait for PWR key */
+	while (!key_pressed(KEY_POWER))
+		mdelay(1);
+
+	lcd_clear();
+	return leave;
+}
+
+static void display_download_menu(int mode)
+{
+	char *selection[BOOT_MODE_EXIT + 1];
+	int i;
+
+	for (i = 0; i <= BOOT_MODE_EXIT; i++)
+		selection[i] = "[  ]";
+
+	selection[mode] = "[=>]";
+
+	lcd_clear();
+	lcd_printf("\n\t\tDownload Mode Menu\n");
+
+	for (i = 0; i <= BOOT_MODE_EXIT; i++)
+		lcd_printf("\t%s  %s - %s\n\n", selection[i],
+						mode_name[i],
+						mode_info[i]);
+}
+
+static void download_menu(void)
+{
+	int mode = 0;
+	int last_mode = 0;
+	int run;
+	int key;
+
+	display_download_menu(mode);
+
+	while (1) {
+		run = 0;
+
+		if (mode != last_mode)
+			display_download_menu(mode);
+
+		last_mode = mode;
+		mdelay(100);
+
+		key = check_keys();
+		switch (key) {
+		case KEY_POWER:
+			run = 1;
+			break;
+		case KEY_VOLUMEUP:
+			if (mode > 0)
+				mode--;
+			break;
+		case KEY_VOLUMEDOWN:
+			if (mode < BOOT_MODE_EXIT)
+				mode++;
+			break;
+		default:
+			break;
+		}
+
+		if (run) {
+			if (mode_leave_menu(mode))
+				break;
+
+			display_download_menu(mode);
+		}
+	}
+
+	lcd_clear();
+}
+
+static void display_mode_info(void)
+{
+	lcd_position_cursor(4, 4);
+	lcd_printf("%s\n", U_BOOT_VERSION);
+	lcd_puts("\nDownload Mode Menu\n");
+#ifdef CONFIG_SYS_BOARD
+	lcd_printf("Board name: %s\n", CONFIG_SYS_BOARD);
+#endif
+	lcd_printf("Press POWER KEY to display MENU options.");
+}
+
+static int boot_menu(void)
+{
+	int key = 0;
+	int timeout = 10;
+
+	display_mode_info();
+
+	while (timeout--) {
+		lcd_printf("\rNormal boot will start in: %d seconds.", timeout);
+		mdelay(1000);
+
+		key = key_pressed(KEY_POWER);
+		if (key)
+			break;
+	}
+
+	lcd_clear();
+
+	/* If PWR pressed - show download menu */
+	if (key) {
+		printf("Power pressed - go to download menu\n");
+		download_menu();
+		printf("Download mode exit.\n");
+	}
+
+	return 0;
+}
+
+void check_boot_mode(void)
+{
+	int pwr_key;
+
+	pwr_key = power_key_pressed(KEY_PWR_STATUS_REG);
+	if (!pwr_key)
+		return;
+
+	/* Clear PWR button Rising edge interrupt status flag */
+	power_key_pressed(KEY_PWR_INTERRUPT_REG);
+
+	if (key_pressed(KEY_VOLUMEUP))
+		boot_menu();
+	else if (key_pressed(KEY_VOLUMEDOWN))
+		mode_leave_menu(BOOT_MODE_THOR);
+}
+
+void keys_init(void)
+{
+	/* Set direction to input */
+	gpio_direction_input(KEY_VOL_UP_GPIO);
+	gpio_direction_input(KEY_VOL_DOWN_GPIO);
+}
+#endif /* CONFIG_LCD_MENU */
 
 #ifdef CONFIG_CMD_BMP
 void draw_logo(void)
diff --git a/include/samsung/misc.h b/include/samsung/misc.h
index 8ea9223..1a6d47f 100644
--- a/include/samsung/misc.h
+++ b/include/samsung/misc.h
@@ -1,6 +1,23 @@
 #ifndef __SAMSUNG_MISC_COMMON_H__
 #define __SAMSUNG_MISC_COMMON_H__
 
+#ifdef CONFIG_LCD_MENU
+enum {
+	BOOT_MODE_INFO,
+	BOOT_MODE_THOR,
+	BOOT_MODE_UMS,
+	BOOT_MODE_DFU,
+	BOOT_MODE_EXIT,
+};
+
+#ifdef CONFIG_REVISION_TAG
+u32 get_board_rev(void);
+#endif
+
+void keys_init(void);
+void check_boot_mode(void);
+#endif /* CONFIG_LCD_MENU */
+
 #ifdef CONFIG_CMD_BMP
 void draw_logo(void);
 #endif
-- 
1.7.9.5

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

* [U-Boot] [PATCH v6 09/11] trats: add LCD download menu support
  2014-01-22 10:24 ` [U-Boot] [PATCH v6 00/11] Introduce Samsung misc file and LCD menu Przemyslaw Marczak
                     ` (7 preceding siblings ...)
  2014-01-22 10:24   ` [U-Boot] [PATCH v6 08/11] samsung: misc: Add LCD download menu Przemyslaw Marczak
@ 2014-01-22 10:24   ` Przemyslaw Marczak
  2014-01-22 10:24   ` [U-Boot] [PATCH v6 10/11] trats2: " Przemyslaw Marczak
                     ` (2 subsequent siblings)
  11 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-22 10:24 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Lukasz Majewski <l.majewski@samsung.com>

---
changes v2:
- add definitions to check keys
- cleanup config definitions
- add acked-by

Changes v3:
- remove CONFIG_BOARD_NAME from include/configs/trats.h

Changes v4:
- none

Changes v5:
- none

Changes v6:
- trats.c : call boot menu from board file.

 board/samsung/trats/trats.c |    5 +++++
 include/configs/trats.h     |   22 ++++++++++++++++++++++
 2 files changed, 27 insertions(+)

diff --git a/board/samsung/trats/trats.c b/board/samsung/trats/trats.c
index 32a6cee..c6664e7 100644
--- a/board/samsung/trats/trats.c
+++ b/board/samsung/trats/trats.c
@@ -28,6 +28,7 @@
 #include <power/max17042_fg.h>
 #include <usb.h>
 #include <usb_mass_storage.h>
+#include <samsung/misc.h>
 
 #include "setup.h"
 
@@ -790,6 +791,10 @@ void init_panel_info(vidinfo_t *vid)
 #ifdef CONFIG_MISC_INIT_R
 int misc_init_r(void)
 {
+#ifdef CONFIG_LCD_MENU
+	keys_init();
+	check_boot_mode();
+#endif
 #ifdef CONFIG_CMD_BMP
 	if (panel_info.logo_on)
 		draw_logo();
diff --git a/include/configs/trats.h b/include/configs/trats.h
index f5e796a..1de971c 100644
--- a/include/configs/trats.h
+++ b/include/configs/trats.h
@@ -307,6 +307,28 @@
 
 #define CONFIG_MISC_INIT_R
 
+/* Download menu - Samsung common */
+#define CONFIG_LCD_MENU
+#define CONFIG_LCD_MENU_BOARD
+
+/* Download menu - definitions for check keys */
+#ifndef __ASSEMBLY__
+#include <power/max8997_pmic.h>
+
+#define KEY_PWR_PMIC_NAME		"MAX8997_PMIC"
+#define KEY_PWR_STATUS_REG		MAX8997_REG_STATUS1
+#define KEY_PWR_STATUS_MASK		(1 << 0)
+#define KEY_PWR_INTERRUPT_REG		MAX8997_REG_INT1
+#define KEY_PWR_INTERRUPT_MASK		(1 << 0)
+
+#define KEY_VOL_UP_GPIO			exynos4_gpio_get(2, x2, 0)
+#define KEY_VOL_DOWN_GPIO		exynos4_gpio_get(2, x2, 1)
+#endif /* __ASSEMBLY__ */
+
+/* LCD console */
+#define LCD_BPP			LCD_COLOR16
+#define CONFIG_SYS_WHITE_ON_BLACK
+
 /* LCD */
 #define CONFIG_EXYNOS_FB
 #define CONFIG_LCD
-- 
1.7.9.5

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

* [U-Boot] [PATCH v6 10/11] trats2: add LCD download menu support
  2014-01-22 10:24 ` [U-Boot] [PATCH v6 00/11] Introduce Samsung misc file and LCD menu Przemyslaw Marczak
                     ` (8 preceding siblings ...)
  2014-01-22 10:24   ` [U-Boot] [PATCH v6 09/11] trats: add LCD download menu support Przemyslaw Marczak
@ 2014-01-22 10:24   ` Przemyslaw Marczak
  2014-01-22 10:24   ` [U-Boot] [PATCH v6 11/11] universal: " Przemyslaw Marczak
  2014-02-03  7:06   ` [U-Boot] [PATCH v6 00/11] Introduce Samsung misc file and LCD menu Minkyu Kang
  11 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-22 10:24 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>

---
changes v2:
- add definitions for check keys
- cleanup config definitions

Changes v3:
- remove CONFIG_BOARD_NAME from include/configs/trats2.h

Changes v4:
- remove include of pmic.h from trats2.h
- remove include of common.h from pmic.h

Changes v5:
- none

Changes v6:
- trats2.c : call boot menu from board file
- trats.h: remove definition CONFIG_TRATS2

 board/samsung/trats2/trats2.c |    5 +++++
 include/configs/trats2.h      |   22 ++++++++++++++++++++++
 include/power/pmic.h          |    1 -
 3 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/board/samsung/trats2/trats2.c b/board/samsung/trats2/trats2.c
index b60a2da..62e7fd2 100644
--- a/board/samsung/trats2/trats2.c
+++ b/board/samsung/trats2/trats2.c
@@ -28,6 +28,7 @@
 #include <usb.h>
 #include <usb/s3c_udc.h>
 #include <usb_mass_storage.h>
+#include <samsung/misc.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -615,6 +616,10 @@ void init_panel_info(vidinfo_t *vid)
 #ifdef CONFIG_MISC_INIT_R
 int misc_init_r(void)
 {
+#ifdef CONFIG_LCD_MENU
+	keys_init();
+	check_boot_mode();
+#endif
 #ifdef CONFIG_CMD_BMP
 	if (panel_info.logo_on)
 		draw_logo();
diff --git a/include/configs/trats2.h b/include/configs/trats2.h
index a856b56..c48e3f5 100644
--- a/include/configs/trats2.h
+++ b/include/configs/trats2.h
@@ -317,6 +317,28 @@ int get_soft_i2c_sda_pin(void);
 
 #define CONFIG_MISC_INIT_R
 
+/* Download menu - Samsung common */
+#define CONFIG_LCD_MENU
+#define CONFIG_LCD_MENU_BOARD
+
+/* Download menu - definitions for check keys */
+#ifndef __ASSEMBLY__
+#include <power/max77686_pmic.h>
+
+#define KEY_PWR_PMIC_NAME		"MAX77686_PMIC"
+#define KEY_PWR_STATUS_REG		MAX77686_REG_PMIC_STATUS1
+#define KEY_PWR_STATUS_MASK		(1 << 0)
+#define KEY_PWR_INTERRUPT_REG		MAX77686_REG_PMIC_INT1
+#define KEY_PWR_INTERRUPT_MASK		(1 << 1)
+
+#define KEY_VOL_UP_GPIO			exynos4x12_gpio_get(2, x2, 2)
+#define KEY_VOL_DOWN_GPIO		exynos4x12_gpio_get(2, x3, 3)
+#endif /* __ASSEMBLY__ */
+
+/* LCD console */
+#define LCD_BPP                 LCD_COLOR16
+#define CONFIG_SYS_WHITE_ON_BLACK
+
 /* LCD */
 #define CONFIG_EXYNOS_FB
 #define CONFIG_LCD
diff --git a/include/power/pmic.h b/include/power/pmic.h
index 0e7aa31..8f282dd 100644
--- a/include/power/pmic.h
+++ b/include/power/pmic.h
@@ -8,7 +8,6 @@
 #ifndef __CORE_PMIC_H_
 #define __CORE_PMIC_H_
 
-#include <common.h>
 #include <linux/list.h>
 #include <i2c.h>
 #include <power/power_chrg.h>
-- 
1.7.9.5

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

* [U-Boot] [PATCH v6 11/11] universal: add LCD download menu support
  2014-01-22 10:24 ` [U-Boot] [PATCH v6 00/11] Introduce Samsung misc file and LCD menu Przemyslaw Marczak
                     ` (9 preceding siblings ...)
  2014-01-22 10:24   ` [U-Boot] [PATCH v6 10/11] trats2: " Przemyslaw Marczak
@ 2014-01-22 10:24   ` Przemyslaw Marczak
  2014-02-03  7:06   ` [U-Boot] [PATCH v6 00/11] Introduce Samsung misc file and LCD menu Minkyu Kang
  11 siblings, 0 replies; 147+ messages in thread
From: Przemyslaw Marczak @ 2014-01-22 10:24 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>

---
changes v2:
- add definitions for check keys
- cleanup config definitions

Changes v3:
- remove CONFIG_BOARD_NAME from include/configs/5pc210_universal.h

Changes v4:
- none

Changes v5:
- none

Changes v6:
- universal.c : call boot menu from board file.

 board/samsung/universal_c210/universal.c |    5 +++++
 include/configs/s5pc210_universal.h      |   22 ++++++++++++++++++++++
 2 files changed, 27 insertions(+)

diff --git a/board/samsung/universal_c210/universal.c b/board/samsung/universal_c210/universal.c
index e300da3..98b387f 100644
--- a/board/samsung/universal_c210/universal.c
+++ b/board/samsung/universal_c210/universal.c
@@ -22,6 +22,7 @@
 #include <usb/s3c_udc.h>
 #include <asm/arch/cpu.h>
 #include <power/max8998_pmic.h>
+#include <samsung/misc.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -515,6 +516,10 @@ int board_init(void)
 #ifdef CONFIG_MISC_INIT_R
 int misc_init_r(void)
 {
+#ifdef CONFIG_LCD_MENU
+	keys_init();
+	check_boot_mode();
+#endif
 #ifdef CONFIG_CMD_BMP
 	if (panel_info.logo_on)
 		draw_logo();
diff --git a/include/configs/s5pc210_universal.h b/include/configs/s5pc210_universal.h
index 93b9dfb..bfb044b 100644
--- a/include/configs/s5pc210_universal.h
+++ b/include/configs/s5pc210_universal.h
@@ -274,6 +274,28 @@ int universal_spi_read(void);
 
 #define CONFIG_MISC_INIT_R
 
+/* Download menu - Samsung common */
+#define CONFIG_LCD_MENU
+#define CONFIG_LCD_MENU_BOARD
+
+/* Download menu - definitions for check keys */
+#ifndef __ASSEMBLY__
+#include <power/max8998_pmic.h>
+
+#define KEY_PWR_PMIC_NAME		"MAX8998_PMIC"
+#define KEY_PWR_STATUS_REG		MAX8998_REG_STATUS1
+#define KEY_PWR_STATUS_MASK		(1 << 7)
+#define KEY_PWR_INTERRUPT_REG		MAX8998_REG_IRQ1
+#define KEY_PWR_INTERRUPT_MASK		(1 << 7)
+
+#define KEY_VOL_UP_GPIO			exynos4_gpio_get(2, x2, 0)
+#define KEY_VOL_DOWN_GPIO		exynos4_gpio_get(2, x2, 1)
+#endif /* __ASSEMBLY__ */
+
+/* LCD console */
+#define LCD_BPP			LCD_COLOR16
+#define CONFIG_SYS_WHITE_ON_BLACK
+
 /*
  * LCD Settings
  */
-- 
1.7.9.5

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

* [U-Boot] [PATCH v6 00/11] Introduce Samsung misc file and LCD menu.
  2014-01-22 10:24 ` [U-Boot] [PATCH v6 00/11] Introduce Samsung misc file and LCD menu Przemyslaw Marczak
                     ` (10 preceding siblings ...)
  2014-01-22 10:24   ` [U-Boot] [PATCH v6 11/11] universal: " Przemyslaw Marczak
@ 2014-02-03  7:06   ` Minkyu Kang
  11 siblings, 0 replies; 147+ messages in thread
From: Minkyu Kang @ 2014-02-03  7:06 UTC (permalink / raw)
  To: u-boot

On 22/01/14 19:24, Przemyslaw Marczak wrote:
> This patch set includes changes required to:
> - properly use of all gpios
> - introduce common file for Samsung misc code
> - keys support (PWR, VOL:UP,DOWN)
> - console support on LCD
> - 16bpp logo support
> - introduce LCD menu on Samsung devices
> 
> Each version changes are described in each patch commit msg.
> 
> Przemyslaw Marczak (11):
>   s5p: gpio: change gpio coding method for s5p gpio.
>   trats2: Code cleanup.
>   samsung: common: Add file for common functions, draw_logo() cleanup.
>   common: lcd.c: fix data abort exception when try to access bmp header
>   lib: tizen: change Tizen logo with the new one.
>   video: exynos: fimd: add support for various display color modes
>   samsung: boards: update display configs with 16bpp mode.
>   samsung: misc: Add LCD download menu.
>   trats: add LCD download menu support
>   trats2: add LCD download menu support
>   universal: add LCD download menu support
> 
>  arch/arm/include/asm/arch-exynos/gpio.h  |  245 +-
>  arch/arm/include/asm/arch-s5pc1xx/gpio.h |   47 +-
>  board/samsung/common/Makefile            |    1 +
>  board/samsung/common/misc.c              |  387 ++
>  board/samsung/trats/trats.c              |   18 +-
>  board/samsung/trats2/trats2.c            |   31 +-
>  board/samsung/universal_c210/universal.c |   18 +-
>  common/lcd.c                             |   27 +-
>  drivers/gpio/s5p_gpio.c                  |   15 +-
>  drivers/power/battery/bat_trats2.c       |    2 +-
>  drivers/video/exynos_fb.c                |   28 -
>  drivers/video/exynos_fimd.c              |   15 +-
>  include/configs/s5p_goni.h               |    4 +-
>  include/configs/s5pc210_universal.h      |   43 +-
>  include/configs/trats.h                  |   35 +-
>  include/configs/trats2.h                 |   32 +-
>  include/lcd.h                            |    2 +
>  include/power/max77686_pmic.h            |    2 +
>  include/power/pmic.h                     |    1 -
>  include/samsung/misc.h                   |   25 +
>  lib/tizen/tizen.c                        |   21 +-
>  lib/tizen/tizen_hd_logo.h                | 5057 ---------------
>  lib/tizen/tizen_hd_logo_data.h           |   15 -
>  lib/tizen/tizen_logo_16bpp.h             |10025 ++++++++++++++++++++++++++++++
>  lib/tizen/tizen_logo_16bpp_gzip.h        |  727 +++
>  25 files changed, 11470 insertions(+), 5353 deletions(-)
>  create mode 100644 board/samsung/common/misc.c
>  create mode 100644 include/samsung/misc.h
>  delete mode 100644 lib/tizen/tizen_hd_logo.h
>  delete mode 100644 lib/tizen/tizen_hd_logo_data.h
>  create mode 100644 lib/tizen/tizen_logo_16bpp.h
>  create mode 100644 lib/tizen/tizen_logo_16bpp_gzip.h
> 

applied to u-boot-samsung.

Thanks,
Minkyu Kang.

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

end of thread, other threads:[~2014-02-03  7:06 UTC | newest]

Thread overview: 147+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-03 18:03 [U-Boot] [PATCH 00/10] Introduce Samsung misc file and LCD menu Przemyslaw Marczak
2013-12-03 18:03 ` [U-Boot] [PATCH 01/10] s5p: gpio: change gpio coding method for s5p gpio Przemyslaw Marczak
2013-12-03 18:03 ` [U-Boot] [PATCH 02/10] trats2: Code cleanup Przemyslaw Marczak
2013-12-03 18:03 ` [U-Boot] [PATCH 03/10] samsung: common: Add misc file and common function misc_init_r() Przemyslaw Marczak
2013-12-11  8:16   ` Minkyu Kang
2013-12-11 10:00     ` Przemyslaw Marczak
2013-12-03 18:03 ` [U-Boot] [PATCH 04/10] samsung: misc: move display logo function to misc.c file Przemyslaw Marczak
2013-12-10  9:47   ` 황형원
2013-12-11  8:16   ` Minkyu Kang
2013-12-03 18:03 ` [U-Boot] [PATCH 05/10] lib: tizen: add Tizen 16bpp logo support Przemyslaw Marczak
     [not found]   ` <01a201cef56e$6f3e3ac0$4dbab040$@samsung.com>
2013-12-10  7:41     ` Przemyslaw Marczak
     [not found]   ` <20131211105613.201446ff68c75747d836fab7@samsung.com>
2013-12-11 13:48     ` Przemyslaw Marczak
2013-12-03 18:03 ` [U-Boot] [PATCH 06/10] video: exynos: fimd: always use 16bpp display mode Przemyslaw Marczak
     [not found]   ` <018001cef563$f1baed50$d530c7f0$@samsung.com>
2013-12-10  5:47     ` [U-Boot] FW: " Donghwa Lee
2013-12-10  8:15       ` Przemyslaw Marczak
2013-12-10  8:55         ` Ajay kumar
2013-12-10  9:02         ` [U-Boot] " Donghwa Lee
2013-12-03 18:03 ` [U-Boot] [PATCH 07/10] samsung: misc: Add LCD download menu Przemyslaw Marczak
2013-12-11  8:15   ` Minkyu Kang
2013-12-11 12:38     ` Przemyslaw Marczak
2013-12-03 18:03 ` [U-Boot] [PATCH 08/10] Trats: add LCD download menu support Przemyslaw Marczak
2013-12-04  6:08   ` Lukasz Majewski
2013-12-11  8:15   ` Minkyu Kang
2013-12-11 13:32     ` Przemyslaw Marczak
2013-12-03 18:03 ` [U-Boot] [PATCH 09/10] trats2: " Przemyslaw Marczak
2013-12-03 18:03 ` [U-Boot] [PATCH 10/10] universal: " Przemyslaw Marczak
2013-12-04  1:29 ` [U-Boot] [PATCH 00/10] Introduce Samsung misc file and LCD menu TigerLiu at viatech.com.cn
2013-12-04 12:11   ` Przemyslaw Marczak
2013-12-18 18:31 ` [U-Boot] [PATCH v2 00/13] " Przemyslaw Marczak
2013-12-18 18:31   ` [U-Boot] [PATCH v2 01/13] s5p: gpio: change gpio coding method for s5p gpio Przemyslaw Marczak
2014-01-02  6:35     ` Minkyu Kang
2014-01-02  7:55       ` Przemyslaw Marczak
2013-12-18 18:31   ` [U-Boot] [PATCH v2 02/13] trats: add optional cflags to board object file Przemyslaw Marczak
2014-01-02  6:35     ` Minkyu Kang
2014-01-02  8:03       ` Przemyslaw Marczak
2013-12-18 18:31   ` [U-Boot] [PATCH v2 03/13] trats2: Code cleanup Przemyslaw Marczak
2013-12-18 18:31   ` [U-Boot] [PATCH v2 04/13] samsung: common: Add misc file and common function misc_init_r() Przemyslaw Marczak
2014-01-02  6:37     ` Minkyu Kang
2014-01-02  8:09       ` Przemyslaw Marczak
2013-12-18 18:31   ` [U-Boot] [PATCH v2 05/13] samsung: misc: move display logo function to misc.c file Przemyslaw Marczak
2013-12-18 18:31   ` [U-Boot] [PATCH v2 06/13] common: makefile: Add optional cflags to object: common/lcd.o Przemyslaw Marczak
2013-12-19  5:44     ` Inha Song
2014-01-02  6:35     ` Minkyu Kang
2013-12-18 18:31   ` [U-Boot] [PATCH v2 07/13] lib: tizen: change Tizen logo with the new one Przemyslaw Marczak
2013-12-19  5:40     ` 황형원
2013-12-19 10:40       ` Przemyslaw Marczak
2013-12-20  5:07         ` Hyungwon Hwang
2013-12-20 11:50           ` Przemyslaw Marczak
2013-12-25 23:39             ` Hyungwon Hwang
2013-12-30 15:46               ` Przemyslaw Marczak
2013-12-18 18:31   ` [U-Boot] [PATCH v2 08/13] video: exynos: fimd: add support for various display color modes Przemyslaw Marczak
2013-12-19  5:08     ` Donghwa Lee
2013-12-18 18:31   ` [U-Boot] [PATCH v2 09/13] samsung: boards: update display configs with 16bpp mode Przemyslaw Marczak
2013-12-18 18:31   ` [U-Boot] [PATCH v2 10/13] samsung: misc: Add LCD download menu Przemyslaw Marczak
2013-12-18 18:31   ` [U-Boot] [PATCH v2 11/13] Trats: add LCD download menu support Przemyslaw Marczak
2013-12-18 18:31   ` [U-Boot] [PATCH v2 12/13] trats2: " Przemyslaw Marczak
2014-01-02  6:34     ` Minkyu Kang
2013-12-18 18:31   ` [U-Boot] [PATCH v2 13/13] universal: " Przemyslaw Marczak
2014-01-03 16:43 ` [U-Boot] [PATCH v3 01/12] s5p: gpio: change gpio coding method for s5p gpio Przemyslaw Marczak
2014-01-03 16:43   ` [U-Boot] [PATCH v3 02/12] trats2: Code cleanup Przemyslaw Marczak
2014-01-03 16:43   ` [U-Boot] [PATCH v3 03/12] samsung: common: Add misc file and common function misc_init_r() Przemyslaw Marczak
2014-01-03 16:43   ` [U-Boot] [PATCH v3 04/12] samsung: misc: move display logo function to misc.c file Przemyslaw Marczak
2014-01-03 16:43   ` [U-Boot] [PATCH v3 05/12] common: lcd.c: fix data abort exception when try to access bmp header Przemyslaw Marczak
2014-01-06  5:05     ` Minkyu Kang
2014-01-06  8:54     ` Anatolij Gustschin
2014-01-03 16:43   ` [U-Boot] [PATCH v3 06/12] lib: tizen: change Tizen logo with the new one Przemyslaw Marczak
2014-01-03 16:43   ` [U-Boot] [PATCH v3 07/12] video: exynos: fimd: add support for various display color modes Przemyslaw Marczak
2014-01-03 16:43   ` [U-Boot] [PATCH v3 08/12] samsung: boards: update display configs with 16bpp mode Przemyslaw Marczak
2014-01-03 16:43   ` [U-Boot] [PATCH v3 09/12] samsung: misc: Add LCD download menu Przemyslaw Marczak
2014-01-06 11:38     ` Minkyu Kang
2014-01-07 12:46       ` Przemyslaw Marczak
2014-01-03 16:43   ` [U-Boot] [PATCH v3 10/12] Trats: add LCD download menu support Przemyslaw Marczak
2014-01-03 17:20     ` Przemyslaw Marczak
2014-01-03 16:43   ` [U-Boot] [PATCH v3 11/12] trats2: " Przemyslaw Marczak
2014-01-03 17:21     ` Przemyslaw Marczak
2014-01-06 11:37       ` Minkyu Kang
2014-01-07 12:54         ` Przemyslaw Marczak
2014-01-08  1:56           ` Minkyu Kang
2014-01-08 13:47             ` Przemyslaw Marczak
2014-01-03 16:43   ` [U-Boot] [PATCH v3 12/12] universal: " Przemyslaw Marczak
2014-01-03 17:23     ` Przemyslaw Marczak
2014-01-03 17:31       ` Przemyslaw Marczak
2014-01-06 11:37   ` [U-Boot] [PATCH v3 01/12] s5p: gpio: change gpio coding method for s5p gpio Minkyu Kang
2014-01-07 12:56     ` Przemyslaw Marczak
2014-01-09 11:23 ` [U-Boot] [PATCH v4 00/12] Introduce Samsung misc file and LCD menu Przemyslaw Marczak
2014-01-09 11:23   ` [U-Boot] [PATCH v4 01/12] s5p: gpio: change gpio coding method for s5p gpio Przemyslaw Marczak
2014-01-09 11:23   ` [U-Boot] [PATCH v4 02/12] trats2: Code cleanup Przemyslaw Marczak
2014-01-09 12:59     ` Jaehoon Chung
2014-01-09 11:23   ` [U-Boot] [PATCH v4 03/12] samsung: common: Add misc file and common function misc_init_r() Przemyslaw Marczak
2014-01-09 13:00     ` Jaehoon Chung
2014-01-09 11:23   ` [U-Boot] [PATCH v4 04/12] samsung: misc: move display logo function to misc.c file Przemyslaw Marczak
2014-01-09 11:23   ` [U-Boot] [PATCH v4 05/12] common: lcd.c: fix data abort exception when try to access bmp header Przemyslaw Marczak
2014-01-09 11:23   ` [U-Boot] [PATCH v4 06/12] lib: tizen: change Tizen logo with the new one Przemyslaw Marczak
2014-01-10  7:09     ` Hyungwon Hwang
2014-01-10  9:26     ` Hyungwon Hwang
2014-01-10  9:35       ` Przemyslaw Marczak
2014-01-09 11:23   ` [U-Boot] [PATCH v4 07/12] video: exynos: fimd: add support for various display color modes Przemyslaw Marczak
2014-01-09 11:23   ` [U-Boot] [PATCH v4 08/12] samsung: boards: update display configs with 16bpp mode Przemyslaw Marczak
2014-01-09 11:23   ` [U-Boot] [PATCH v4 09/12] samsung: misc: Add LCD download menu Przemyslaw Marczak
2014-01-10  1:37     ` Minkyu Kang
2014-01-10  9:37       ` Przemyslaw Marczak
2014-01-10  9:43         ` Minkyu Kang
2014-01-10  9:48           ` Przemyslaw Marczak
2014-01-09 11:23   ` [U-Boot] [PATCH v4 10/12] Trats: add LCD download menu support Przemyslaw Marczak
2014-01-09 11:23   ` [U-Boot] [PATCH v4 11/12] trats2: " Przemyslaw Marczak
2014-01-09 11:23   ` [U-Boot] [PATCH v4 12/12] universal: " Przemyslaw Marczak
2014-01-10  6:45   ` [U-Boot] [PATCH v4 00/12] Introduce Samsung misc file and LCD menu Hyungwon Hwang
2014-01-10  7:06     ` Hyungwon Hwang
2014-01-10  9:31     ` Przemyslaw Marczak
2014-01-10 14:31 ` [U-Boot] [PATCH v5 " Przemyslaw Marczak
2014-01-10 14:31   ` [U-Boot] [PATCH v5 01/12] s5p: gpio: change gpio coding method for s5p gpio Przemyslaw Marczak
2014-01-10 14:31   ` [U-Boot] [PATCH v5 02/12] trats2: Code cleanup Przemyslaw Marczak
2014-01-10 14:31   ` [U-Boot] [PATCH v5 03/12] samsung: common: Add misc file and common function misc_init_r() Przemyslaw Marczak
2014-01-14 13:55     ` Przemyslaw Marczak
2014-01-15  7:35       ` Minkyu Kang
2014-01-15  7:51         ` Przemyslaw Marczak
2014-01-15  8:08           ` Piotr Wilczek
2014-01-15  8:18             ` Przemyslaw Marczak
2014-01-17  6:26               ` Minkyu Kang
2014-01-17  8:36                 ` Przemyslaw Marczak
2014-01-20  7:06                   ` Minkyu Kang
2014-01-10 14:31   ` [U-Boot] [PATCH v5 04/12] samsung: misc: move display logo function to misc.c file Przemyslaw Marczak
2014-01-14  3:41     ` Jaehoon Chung
2014-01-14  8:02       ` Przemyslaw Marczak
2014-01-14  8:55         ` Minkyu Kang
2014-01-15 10:20           ` Przemyslaw Marczak
2014-01-10 14:31   ` [U-Boot] [PATCH v5 05/12] common: lcd.c: fix data abort exception when try to access bmp header Przemyslaw Marczak
2014-01-10 14:32   ` [U-Boot] [PATCH v5 06/12] lib: tizen: change Tizen logo with the new one Przemyslaw Marczak
2014-01-10 14:32   ` [U-Boot] [PATCH v5 07/12] video: exynos: fimd: add support for various display color modes Przemyslaw Marczak
2014-01-10 14:32   ` [U-Boot] [PATCH v5 08/12] samsung: boards: update display configs with 16bpp mode Przemyslaw Marczak
2014-01-10 14:32   ` [U-Boot] [PATCH v5 09/12] samsung: misc: Add LCD download menu Przemyslaw Marczak
2014-01-10 14:32   ` [U-Boot] [PATCH v5 10/12] Trats: add LCD download menu support Przemyslaw Marczak
2014-01-10 14:32   ` [U-Boot] [PATCH v5 11/12] trats2: " Przemyslaw Marczak
2014-01-10 14:32   ` [U-Boot] [PATCH v5 12/12] universal: " Przemyslaw Marczak
2014-01-22 10:24 ` [U-Boot] [PATCH v6 00/11] Introduce Samsung misc file and LCD menu Przemyslaw Marczak
2014-01-22 10:24   ` [U-Boot] [PATCH v6 01/11] s5p: gpio: change gpio coding method for s5p gpio Przemyslaw Marczak
2014-01-22 10:24   ` [U-Boot] [PATCH v6 02/11] trats2: Code cleanup Przemyslaw Marczak
2014-01-22 10:24   ` [U-Boot] [PATCH v6 03/11] samsung: common: Add file for common functions, draw_logo() cleanup Przemyslaw Marczak
2014-01-22 10:24   ` [U-Boot] [PATCH v6 04/11] common: lcd.c: fix data abort exception when try to access bmp header Przemyslaw Marczak
2014-01-22 10:24   ` [U-Boot] [PATCH v6 05/11] lib: tizen: change Tizen logo with the new one Przemyslaw Marczak
2014-01-22 10:24   ` [U-Boot] [PATCH v6 06/11] video: exynos: fimd: add support for various display color modes Przemyslaw Marczak
2014-01-22 10:24   ` [U-Boot] [PATCH v6 07/11] samsung: boards: update display configs with 16bpp mode Przemyslaw Marczak
2014-01-22 10:24   ` [U-Boot] [PATCH v6 08/11] samsung: misc: Add LCD download menu Przemyslaw Marczak
2014-01-22 10:24   ` [U-Boot] [PATCH v6 09/11] trats: add LCD download menu support Przemyslaw Marczak
2014-01-22 10:24   ` [U-Boot] [PATCH v6 10/11] trats2: " Przemyslaw Marczak
2014-01-22 10:24   ` [U-Boot] [PATCH v6 11/11] universal: " Przemyslaw Marczak
2014-02-03  7:06   ` [U-Boot] [PATCH v6 00/11] Introduce Samsung misc file and LCD menu Minkyu Kang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.