Skip to contentSkip to conversation

Introduce Samsung misc file and LCD menu.

PATCH New Przemyslaw Marczak 11 participants 147 messages Dec 3, 2013 – Feb 3, 2014 3 messages not in the archive Page 1 of 2

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover Introduce Samsung misc file and LCD menu.

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
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/10 s5p: gpio: change gpio coding method for s5p gpio.

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

---
 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(-)
arch/arm/include/asm/arch-exynos/gpio.h +62 -107
index a1a7439..b7dc8f5 100644
@@ -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 */
arch/arm/include/asm/arch-s5pc1xx/gpio.h +36 -11

56 lines not on this page · raw message

drivers/gpio/s5p_gpio.c +9 -6
index 7eeb96d..13aefba 100644
@@ -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 */
include/configs/s5p_goni.h +2 -2
index 0590d20..4cdf937 100644
@@ -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 */
include/configs/s5pc210_universal.h +6 -6
index d9e4c56..02a1c99 100644
@@ -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
include/configs/trats.h +4 -4
index 8ff9800..2b07fe0 100644
@@ -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()
include/configs/trats2.h +6 -6
index c49a969e..f7d76f8 100644
@@ -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()
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 2/10 trats2: Code cleanup.

In reply to Przemyslaw Marczak

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

---
 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(-)
board/samsung/trats2/trats2.c +2 -17
index 9552522..2442d96 100644
@@ -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
drivers/power/battery/bat_trats2.c +1 -1
index f264832..94015aa 100644
@@ -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;
include/configs/trats2.h +0 -1
index f7d76f8..18270c1 100644
@@ -271,7 +271,6 @@
 #define CONFIG_EFI_PARTITION
 #define CONFIG_PARTITION_UUIDS
 
-#define CONFIG_MISC_INIT_R
 #define CONFIG_BOARD_EARLY_INIT_F
 
 /* I2C */
Signature · 1 line
1.7.9.5
#3 lore raw

PATCH 3/10 samsung: common: Add misc file and common function misc_init_r().

In reply to Przemyslaw Marczak

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

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

---
 board/samsung/common/Makefile |    1 +
 board/samsung/common/misc.c   |   16 ++++++++++++++++
 2 files changed, 17 insertions(+)
 create mode 100644 board/samsung/common/misc.c
board/samsung/common/Makefile +1 -0
index 501d974..d1eb63f 100644
@@ -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
board/samsung/common/misc.c new file +16 -0
new file mode 100644
index 0000000..465895b
@@ -0,0 +1,16 @@
+/*
+ * Copyright (C) 2013 Samsung Electronics
+ * Przemyslaw Marczak <[email protected]>
+ *
+ * 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 */
Signature · 1 line
1.7.9.5
#4 lore raw

PATCH 3/10 samsung: common: Add misc file and common function misc_init_r().

Quoted 19 lines · Przemyslaw Marczak

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

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

---
 board/samsung/common/Makefile |    1 +
 board/samsung/common/misc.c   |   16 ++++++++++++++++
 2 files changed, 17 insertions(+)
 create mode 100644 board/samsung/common/misc.c
board/samsung/common/Makefile +0 -0
index 501d974..d1eb63f 100644

board/samsung/common/Makefile line 11

Quoted 4 lines
board/samsung/common/Makefile +1 -0
@@ -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.

Quoted 13 lines
board/samsung/common/misc.c new file +6 -0
new file mode 100644
index 0000000..465895b
@@ -0,0 +1,16 @@
+/*
+ * Copyright (C) 2013 Samsung Electronics
+ * Przemyslaw Marczak <[email protected]>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */

board/samsung/common/misc.c line 16

Quoted 10 lines
board/samsung/common/misc.c new file +10 -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.

#5 lore raw

PATCH 3/10 samsung: common: Add misc file and common function misc_init_r().

Hello Minkyu,

Quoted 15 lines · Minkyu Kang
Quoted 14 lines · Przemyslaw Marczak

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

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

---
  board/samsung/common/Makefile |    1 +
  board/samsung/common/misc.c   |   16 ++++++++++++++++
  2 files changed, 17 insertions(+)

create mode 100644 board/samsung/common/misc.c

Quoted 13 lines

board/samsung/common/Makefile line 11

Quoted 9 lines
board/samsung/common/Makefile +1 -0
index 501d974..d1eb63f 100644
@@ -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.

Quoted 18 lines
Quoted 18 lines
board/samsung/common/misc.c new file +12 -0
new file mode 100644
index 0000000..465895b
@@ -0,0 +1,16 @@
+/*
+ * Copyright (C) 2013 Samsung Electronics
+ * Przemyslaw Marczak <[email protected]>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+
+#ifdef CONFIG_MISC_INIT_R
+/* Common for Samsung boards */
+int misc_init_r(void)
Quoted 10 lines

board/samsung/common/misc.c line 16

Quoted 5 lines
board/samsung/common/misc.c new file +4 -0
+{
+	return 0;
+}
+#endif /* CONFIG_MISC_INIT_R */

Thanks,
Minkyu Kang.

Regards

Signature · 4 lines
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com
#6 lore raw

PATCH 4/10 samsung: misc: move display logo function to misc.c file.

In reply to Przemyslaw Marczak

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

---
 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(-)
board/samsung/common/misc.c +39 -0
index 465895b..fa97644 100644
@@ -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 */
board/samsung/trats/trats.c +0 -3
index 6bd106e..ce4b41f 100644
@@ -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);
board/samsung/trats2/trats2.c +0 -4
index 2442d96..73b8cc1 100644
@@ -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;
board/samsung/universal_c210/universal.c +0 -4
index 54d0e1e..166d5ee 100644
@@ -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;
drivers/video/exynos_fb.c +0 -28
index 7d4c6e0..00a0a11 100644
@@ -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);
include/configs/s5pc210_universal.h +3 -0
index 02a1c99..47f0e85 100644
@@ -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
  */
include/configs/trats.h +3 -0
index 2b07fe0..806f6fe 100644
@@ -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
include/configs/trats2.h +3 -0
index 18270c1..91821b4 100644
@@ -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
Signature · 1 line
1.7.9.5
#7 lore raw

PATCH 4/10 samsung: misc: move display logo function to misc.c file.

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

-----Original Message-----
From: [email protected] [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

---
 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(-)
board/samsung/common/misc.c +21 -0
index 465895b..fa97644 100644
@@ -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 */

board/samsung/trats/trats.c +0 -3
index 6bd106e..ce4b41f 100644
@@ -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);
board/samsung/trats2/trats2.c +0 -4
index 2442d96..73b8cc1 100644
@@ -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

board/samsung/universal_c210/universal.c +0 -4
@@ -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;
drivers/video/exynos_fb.c index renamed from drivers/video/exynos_fb.c +0 -0

7d4c6e0..00a0a11 100644

drivers/video/exynos_fb.c +0 -11
@@ -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);

(quoted diff) +0 -0

b/include/configs/s5pc210_universal.h
index 02a1c99..47f0e85 100644

include/configs/s5pc210_universal.h +0 -0
@@ -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
*/

include/configs/trats.h index renamed from include/configs/trats.h +0 -0

2b07fe0..806f6fe 100644

include/configs/trats.h +3 -0
@@ -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
include/configs/trats2.h index renamed from include/configs/trats2.h +0 -0

18270c1..91821b4 100644

include/configs/trats2.h +3 -0
@@ -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

#8 lore raw

PATCH 4/10 samsung: misc: move display logo function to misc.c file.

In reply to Przemyslaw Marczak
Quoted 170 lines · Przemyslaw Marczak

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

---
 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(-)
board/samsung/common/misc.c +39 -0
index 465895b..fa97644 100644
@@ -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 */
board/samsung/trats/trats.c +0 -3
index 6bd106e..ce4b41f 100644
@@ -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);
board/samsung/trats2/trats2.c +0 -4
index 2442d96..73b8cc1 100644
@@ -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;
board/samsung/universal_c210/universal.c +0 -4
index 54d0e1e..166d5ee 100644
@@ -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;
drivers/video/exynos_fb.c +0 -28
index 7d4c6e0..00a0a11 100644
@@ -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);
include/configs/s5pc210_universal.h +0 -0
index 02a1c99..47f0e85 100644

include/configs/s5pc210_universal.h void universal_spi_sda(int bit); · line 273

Quoted 5 lines
include/configs/s5pc210_universal.h +2 -0
@@ -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.

Quoted 24 lines
include/configs/s5pc210_universal.h +1 -0
+
 /*
  * LCD Settings
  */
include/configs/trats.h +3 -0
index 2b07fe0..806f6fe 100644
@@ -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
include/configs/trats2.h +0 -0
index 18270c1..91821b4 100644

include/configs/trats2.h line 324

Quoted 9 lines
include/configs/trats2.h +3 -0
@@ -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.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#11 lore raw

PATCH 5/10 lib: tizen: add Tizen 16bpp logo support.

Hello Hyungwon,

Quoted 17 lines · ???

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.

Quoted 10 lines

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

Signature · 4 lines
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com

A message that is not in the archive (sent off-list or not yet received): [email protected]

#13 lore raw

PATCH 5/10 lib: tizen: add Tizen 16bpp logo support.

Hello Inha,

Quoted 32 lines · Inha Song

Hi, Marczak

I think, this patch can make unalgined access.

(maybe.. this code)

Quoted 4 lines

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 ...
///////

Quoted 17 lines

Thank you.

---- Original message ----

Quoted 8 lines · On Tue, 03 Dec 2013 19:03:21 +0100 Przemyslaw Marczak <[email protected]>…

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

Signature · 4 lines
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com
#14 lore raw

PATCH 6/10 video: exynos: fimd: always use 16bpp display mode.

In reply to Przemyslaw Marczak

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

---
 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(-)
board/samsung/trats/trats.c +1 -1
index ce4b41f..db527c7 100644
@@ -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,
board/samsung/trats2/trats2.c +1 -1
index 73b8cc1..6fa02c9 100644
@@ -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,
board/samsung/universal_c210/universal.c +1 -1
index 166d5ee..1ebea0f 100644
@@ -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,
drivers/video/exynos_fimd.c +2 -8
index f962c4f..847fbe8 100644
@@ -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));
include/configs/s5pc210_universal.h +1 -1
index 47f0e85..fb1cc6b 100644
@@ -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
include/configs/trats.h +1 -1
index 806f6fe..9738a00 100644
@@ -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
include/configs/trats2.h +1 -1
index 91821b4..f845437 100644
@@ -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
Signature · 1 line
1.7.9.5

A message that is not in the archive (sent off-list or not yet received): [email protected]

#16 lore raw

PATCH 6/10 video: exynos: fimd: always use 16bpp display mode.

Hi,

Quoted 67 lines · Przemyslaw

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

---
 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(-)
board/samsung/trats/trats.c +1 -1
index ce4b41f..db527c7 100644
@@ -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,
board/samsung/trats2/trats2.c +1 -1
index 73b8cc1..6fa02c9 100644
@@ -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,
board/samsung/universal_c210/universal.c +1 -1
index 166d5ee..1ebea0f 100644
@@ -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,
drivers/video/exynos_fimd.c +1 -4
index f962c4f..847fbe8 100644
@@ -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;

drivers/video/exynos_fimd.c static void exynos_fimd_set_par(unsigned int win_id) · line 82

Quoted 10 lines
drivers/video/exynos_fimd.c +1 -4
 
 	/* 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.

#17 lore raw

PATCH 6/10 video: exynos: fimd: always use 16bpp display mode.

Hello Donghwa,

Quoted 74 lines · Donghwa Lee

Hi,

Quoted 71 lines · Przemyslaw

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

---
  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(-)
board/samsung/trats/trats.c +1 -1
index ce4b41f..db527c7 100644
@@ -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,
board/samsung/trats2/trats2.c +1 -1
index 73b8cc1..6fa02c9 100644
@@ -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,
board/samsung/universal_c210/universal.c +1 -1
index 166d5ee..1ebea0f 100644
@@ -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,
drivers/video/exynos_fimd.c +1 -4
index f962c4f..847fbe8 100644
@@ -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;
 
Quoted 8 lines

drivers/video/exynos_fimd.c static void exynos_fimd_set_par(unsigned int win_id) · line 82

Quoted 6 lines
drivers/video/exynos_fimd.c +1 -4
-	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.

Quoted 2 lines

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?

Quoted 5 lines

BR,
Donghwa Lee.

Thank you,

Signature · 4 lines
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com
#18 lore raw

PATCH 6/10 video: exynos: fimd: always use 16bpp display mode.

Hi Marczak,

Quoted 103 lines · Przemyslaw Marczak

Hello Donghwa,

Quoted 28 lines · Donghwa Lee

Hi,

Quoted 25 lines · Przemyslaw

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

---
  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(-)
board/samsung/trats/trats.c +1 -1
index ce4b41f..db527c7 100644
@@ -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 */
 
Quoted 3 lines

Review

Quoted 3 lines
board/samsung/trats/trats.c +0 -0
     /* s6e8ax0 Panel infomation */
     .vl_hspw        = 5,
(quoted diff) +0 -0

b/board/samsung/trats2/trats2.c

Quoted 44 lines
Quoted 31 lines

index 73b8cc1..6fa02c9 100644

board/samsung/trats2/trats2.c +1 -1
@@ -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,
board/samsung/universal_c210/universal.c +1 -1
index 166d5ee..1ebea0f 100644
@@ -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,
drivers/video/exynos_fimd.c +0 -0
index f962c4f..847fbe8 100644

drivers/video/exynos_fimd.c static void exynos_fimd_set_par(unsigned int win_id) · line 77

Quoted 9 lines
drivers/video/exynos_fimd.c +1 -4
@@ -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 */
Quoted 2 lines
drivers/video/exynos_fimd.c +0 -0
     cfg |= EXYNOS_WINCON_BURSTLEN_16WORD;
 
Quoted 8 lines

drivers/video/exynos_fimd.c static void exynos_fimd_set_par(unsigned int win_id) · line 82

Quoted 6 lines
drivers/video/exynos_fimd.c +1 -4
-    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.

Quoted 2 lines

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:

Quoted 8 lines

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.

Quoted 17 lines
Quoted 5 lines

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

#19 lore raw

PATCH 6/10 video: exynos: fimd: always use 16bpp display mode.

In reply to Przemyslaw Marczak
Quoted 97 lines · Przemyslaw Marczak

Hello Donghwa,

Quoted 74 lines · Donghwa Lee

Hi,

Quoted 71 lines · Przemyslaw

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

---
  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(-)
board/samsung/trats/trats.c +1 -1
index ce4b41f..db527c7 100644
@@ -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,
board/samsung/trats2/trats2.c +1 -1
index 73b8cc1..6fa02c9 100644
@@ -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,
board/samsung/universal_c210/universal.c +1 -1
index 166d5ee..1ebea0f 100644
@@ -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,
drivers/video/exynos_fimd.c +1 -4
index f962c4f..847fbe8 100644
@@ -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;
 
Quoted 7 lines

drivers/video/exynos_fimd.c static void exynos_fimd_set_par(unsigned int win_id) · line 82

Quoted 6 lines
drivers/video/exynos_fimd.c +1 -4
-	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.

Quoted 2 lines

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:

Quoted 6 lines

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.

#20 lore raw

PATCH 7/10 samsung: misc: Add LCD download menu.

In reply to Przemyslaw Marczak

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

---
 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
board/samsung/common/keys.h new file +78 -0
new file mode 100644
index 0000000..48822d1
@@ -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__ */
board/samsung/common/misc.c +354 -0

372 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#21 lore raw

PATCH 7/10 samsung: misc: Add LCD download menu.

Dear Przemyslaw Marczak,

Quoted 61 lines · Przemyslaw Marczak

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

---
 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
board/samsung/common/keys.h new file +43 -0
new file mode 100644
index 0000000..48822d1
@@ -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>

board/samsung/common/keys.h line 53

Quoted 10 lines
board/samsung/common/keys.h new file +10 -0
+
+#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?

Quoted 12 lines
board/samsung/common/keys.h new file +12 -0
+
+/* 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)
+

board/samsung/common/keys.h line 75

Quoted 10 lines
board/samsung/common/keys.h new file +10 -0
+#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.

Quoted 90 lines
board/samsung/common/keys.h new file +3 -0
+
+#endif /* __ASSEMBLY__ */
+#endif /* __SAMSUNG_KEYS__ */
board/samsung/common/misc.c +77 -0
index fa97644..c792b87 100644
@@ -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))

board/samsung/common/misc.c line 99

Quoted 10 lines
board/samsung/common/misc.c +10 -0
+		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.

Quoted 128 lines
board/samsung/common/misc.c +128 -0
+
+/*
+ * 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;
+}
+

board/samsung/common/misc.c line 237

Quoted 10 lines
board/samsung/common/misc.c +10 -0
+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.

Quoted 23 lines
board/samsung/common/misc.c +23 -0
+
+	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) {

board/samsung/common/misc.c line 270

Quoted 10 lines
board/samsung/common/misc.c +10 -0
+		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?

Quoted 63 lines
board/samsung/common/misc.c +63 -0
+		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");
+	}

board/samsung/common/misc.c line 343

Quoted 10 lines
board/samsung/common/misc.c +10 -0
+
+	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;

Quoted 28 lines
board/samsung/common/misc.c +20 -0
+		/* 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();

board/samsung/common/misc.c static void draw_logo(void) · line 409

Quoted 10 lines
board/samsung/common/misc.c +3 -0
+	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.

#22 lore raw

PATCH 7/10 samsung: misc: Add LCD download menu.

Dear Minkyu,

Quoted 69 lines · Minkyu Kang

Dear Przemyslaw Marczak,

Quoted 66 lines · Przemyslaw Marczak

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

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

board/samsung/common/keys.h new file +48 -0
new file mode 100644
index 0000000..48822d1
@@ -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)
Quoted 9 lines

board/samsung/common/keys.h line 53

Quoted 5 lines
board/samsung/common/keys.h new file +5 -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.

Quoted 121 lines
Quoted 12 lines
board/samsung/common/keys.h new file +12 -0
+
+/* 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)
+

board/samsung/common/keys.h line 75

Quoted 10 lines
board/samsung/common/keys.h new file +10 -0
+#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.

Quoted 94 lines
board/samsung/common/keys.h new file +3 -0
+
+#endif /* __ASSEMBLY__ */
+#endif /* __SAMSUNG_KEYS__ */
board/samsung/common/misc.c +81 -0
index fa97644..c792b87 100644
@@ -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))
Quoted 9 lines

board/samsung/common/misc.c line 99

Quoted 6 lines
board/samsung/common/misc.c +6 -0
+		keys += KEY_VOLUMEDOWN;
+
+	return keys;
+}
+
+DECLARE_GLOBAL_DATA_PTR;

please move it to top of this file.

OK.

Quoted 132 lines
Quoted 132 lines
board/samsung/common/misc.c +132 -0
+
+/*
+ * 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 = "[=>]";
Quoted 9 lines

board/samsung/common/misc.c line 237

Quoted 6 lines
board/samsung/common/misc.c +6 -0
+	char *blank = "[  ]";
+	char *selection[BOOT_MODE_EXIT + 1];
+	int i;
+
+	for (i = 0; i <= BOOT_MODE_EXIT; i++)
+			selection[i] = blank;

indentation error.

Right

Quoted 29 lines
Quoted 29 lines
board/samsung/common/misc.c +29 -0
+
+	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);
+
Quoted 9 lines

board/samsung/common/misc.c line 270

Quoted 4 lines
board/samsung/common/misc.c +4 -0
+		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.

Quoted 109 lines
Quoted 63 lines
board/samsung/common/misc.c +63 -0
+		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");
+	}

board/samsung/common/misc.c line 343

Quoted 10 lines
board/samsung/common/misc.c +10 -0
+
+	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;

Quoted 33 lines
board/samsung/common/misc.c +22 -0
+		/* 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
Quoted 9 lines

board/samsung/common/misc.c static void draw_logo(void) · line 409

Quoted 5 lines
board/samsung/common/misc.c +1 -0
+
  	return 0;
  }
  #endif /* CONFIG_MISC_INIT_R */

Thanks,
Minkyu Kang.

I will apply comments and send next patch set soon.

Regards.

Signature · 4 lines
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com
#23 lore raw

PATCH 8/10 Trats: add LCD download menu support

In reply to Przemyslaw Marczak
---
 include/configs/trats.h |   10 ++++++++++
 1 file changed, 10 insertions(+)
include/configs/trats.h +10 -0
index 9738a00..d3bed99 100644
@@ -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
Signature · 1 line
1.7.9.5
#24 lore raw

PATCH 8/10 Trats: add LCD download menu support

Hi Przemyslaw,

Quoted 24 lines
---
 include/configs/trats.h |   10 ++++++++++
 1 file changed, 10 insertions(+)
include/configs/trats.h +3 -0
index 9738a00..d3bed99 100644
@@ -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

include/configs/trats.h line 328

Quoted 10 lines
include/configs/trats.h +7 -0
+#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
Signature · 6 lines
-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
#25 lore raw

PATCH 8/10 Trats: add LCD download menu support

In reply to Przemyslaw Marczak
Quoted 19 lines · Przemyslaw Marczak
---
 include/configs/trats.h |   10 ++++++++++
 1 file changed, 10 insertions(+)
include/configs/trats.h +1 -0
index 9738a00..d3bed99 100644
@@ -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 */
 

include/configs/trats.h line 323

Quoted 10 lines
include/configs/trats.h +7 -0
@@ -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?

include/configs/trats.h line 328

Quoted 6 lines
include/configs/trats.h +2 -0
+#define CONFIG_SYS_WHITE_ON_BLACK	1
+
 /* LCD */
 #define CONFIG_EXYNOS_FB
 #define CONFIG_LCD

Thanks,
Minkyu Kang.

#26 lore raw

PATCH 8/10 Trats: add LCD download menu support

Dear Minkyu,

Quoted 23 lines · Minkyu Kang
Quoted 22 lines · Przemyslaw Marczak
---
  include/configs/trats.h |   10 ++++++++++
  1 file changed, 10 insertions(+)
include/configs/trats.h +1 -0
index 9738a00..d3bed99 100644
@@ -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
 
Quoted 10 lines

include/configs/trats.h line 323

Quoted 7 lines
include/configs/trats.h +7 -0
+/* 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.

Quoted 10 lines

include/configs/trats.h line 328

Quoted 6 lines
include/configs/trats.h +2 -0
+#define CONFIG_SYS_WHITE_ON_BLACK	1
+
  /* LCD */
  #define CONFIG_EXYNOS_FB
  #define CONFIG_LCD

Thanks,
Minkyu Kang.

Regards

Signature · 4 lines
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com
#27 lore raw

PATCH 9/10 trats2: add LCD download menu support

In reply to Przemyslaw Marczak
---
 include/configs/trats2.h |   11 +++++++++++
 1 file changed, 11 insertions(+)
include/configs/trats2.h +11 -0
index f845437..8a181fc 100644
@@ -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
Signature · 1 line
1.7.9.5
#28 lore raw

PATCH 10/10 universal: add LCD download menu support

In reply to Przemyslaw Marczak
---
 include/configs/s5pc210_universal.h |   10 ++++++++++
 1 file changed, 10 insertions(+)
include/configs/s5pc210_universal.h +10 -0
index fb1cc6b..602c423 100644
@@ -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
  */
Signature · 1 line
1.7.9.5
#30 lore raw

cover Introduce Samsung misc file and LCD menu.

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.

Quoted 6 lines · TigerLiu at viatech.com.cn

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

Best wishes,

Thank you

Signature · 4 lines
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com
#31 lore raw

v2 cover Introduce Samsung misc file and LCD menu.

In reply to Przemyslaw Marczak

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
Signature · 1 line
1.7.9.5
#32 lore raw

PATCH v2 1/13 s5p: gpio: change gpio coding method for s5p gpio.

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

---
 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(-)
arch/arm/include/asm/arch-exynos/gpio.h +62 -107
index a1a7439..b7dc8f5 100644
@@ -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 */
arch/arm/include/asm/arch-s5pc1xx/gpio.h +36 -11

56 lines not on this page · raw message

drivers/gpio/s5p_gpio.c +9 -6
index 7eeb96d..13aefba 100644
@@ -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 */
include/configs/s5p_goni.h +2 -2
index 0590d20..4cdf937 100644
@@ -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 */
include/configs/s5pc210_universal.h +6 -6
index d9e4c56..02a1c99 100644
@@ -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
include/configs/trats.h +4 -4
index 8ff9800..2b07fe0 100644
@@ -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()
include/configs/trats2.h +6 -6
index c49a969e..f7d76f8 100644
@@ -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()
Signature · 1 line
1.7.9.5
#33 lore raw

PATCH v2 1/13 s5p: gpio: change gpio coding method for s5p gpio.

Hi,

Quoted 9 lines · Przemyslaw Marczak

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

Quoted 10 lines
---
 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.

#34 lore raw

PATCH v2 1/13 s5p: gpio: change gpio coding method for s5p gpio.

Hello Minkyu,

Quoted 40 lines · Minkyu Kang

Hi,

Quoted 9 lines · Przemyslaw Marczak

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

Quoted 10 lines
---
  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
Quoted 6 lines

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

Signature · 4 lines
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com
#35 lore raw

PATCH v2 2/13 trats: add optional cflags to board object file.

In reply to Przemyslaw Marczak

This change avoids unexpected unaligned access.

more info: README.arm-unaligned-accesses

---
Changes v2:
- new patch

---
 board/samsung/trats/Makefile |    2 ++
 1 file changed, 2 insertions(+)
board/samsung/trats/Makefile +2 -0
index 5dc8a1f..c1bcd63 100644
@@ -6,3 +6,5 @@
 #
 
 obj-y	+= trats.o
+
+$(obj)trats.o: CFLAGS += $(PLATFORM_NO_UNALIGNED)
\ No newline at end of file
Signature · 1 line
1.7.9.5
#36 lore raw

PATCH v2 2/13 trats: add optional cflags to board object file.

Quoted 20 lines · Przemyslaw Marczak

This change avoids unexpected unaligned access.

more info: README.arm-unaligned-accesses

---
Changes v2:
- new patch

---
 board/samsung/trats/Makefile |    2 ++
 1 file changed, 2 insertions(+)
board/samsung/trats/Makefile +0 -0
index 5dc8a1f..c1bcd63 100644

board/samsung/trats/Makefile line 10

Quoted 6 lines
board/samsung/trats/Makefile +2 -0
@@ -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.

#37 lore raw

PATCH v2 2/13 trats: add optional cflags to board object file.

Hello Minkyu,

Quoted 30 lines · Minkyu Kang
Quoted 20 lines · Przemyslaw Marczak

This change avoids unexpected unaligned access.

more info: README.arm-unaligned-accesses

---
Changes v2:
- new patch

---
  board/samsung/trats/Makefile |    2 ++
  1 file changed, 2 insertions(+)
board/samsung/trats/Makefile +0 -0
index 5dc8a1f..c1bcd63 100644

board/samsung/trats/Makefile line 10

Quoted 6 lines
board/samsung/trats/Makefile +2 -0
@@ -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?

Quoted 3 lines

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

Signature · 4 lines
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com
#38 lore raw

PATCH v2 3/13 trats2: Code cleanup.

In reply to Przemyslaw Marczak

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

---
 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(-)
board/samsung/trats2/trats2.c +2 -17
index 9552522..2442d96 100644
@@ -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
drivers/power/battery/bat_trats2.c +1 -1
index f264832..94015aa 100644
@@ -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;
include/configs/trats2.h +0 -1
index f7d76f8..18270c1 100644
@@ -271,7 +271,6 @@
 #define CONFIG_EFI_PARTITION
 #define CONFIG_PARTITION_UUIDS
 
-#define CONFIG_MISC_INIT_R
 #define CONFIG_BOARD_EARLY_INIT_F
 
 /* I2C */
Signature · 1 line
1.7.9.5
#39 lore raw

PATCH v2 4/13 samsung: common: Add misc file and common function misc_init_r().

In reply to Przemyslaw Marczak

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

---
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
board/samsung/common/Makefile +1 -0
index 501d974..c30bb3d 100644
@@ -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
board/samsung/common/misc.c new file +14 -0
new file mode 100644
index 0000000..3764d12
@@ -0,0 +1,14 @@
+/*
+ * Copyright (C) 2013 Samsung Electronics
+ * Przemyslaw Marczak <[email protected]>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+
+/* Common for Samsung boards */
+int misc_init_r(void)
+{
+	return 0;
+}
Signature · 1 line
1.7.9.5
#40 lore raw

PATCH v2 4/13 samsung: common: Add misc file and common function misc_init_r().

Quoted 3 lines · Przemyslaw Marczak

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?

Quoted 42 lines

---
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
board/samsung/common/Makefile +1 -0
index 501d974..c30bb3d 100644
@@ -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
board/samsung/common/misc.c new file +14 -0
new file mode 100644
index 0000000..3764d12
@@ -0,0 +1,14 @@
+/*
+ * Copyright (C) 2013 Samsung Electronics
+ * Przemyslaw Marczak <[email protected]>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+
+/* Common for Samsung boards */
+int misc_init_r(void)
+{
+	return 0;
+}
#41 lore raw

PATCH v2 4/13 samsung: common: Add misc file and common function misc_init_r().

Hello Minkyu,

Quoted 8 lines · Minkyu Kang
Quoted 3 lines · Przemyslaw Marczak

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

Signature · 4 lines
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com
#42 lore raw

PATCH v2 5/13 samsung: misc: move display logo function to misc.c file.

In reply to Przemyslaw Marczak

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

---
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(-)
board/samsung/common/misc.c +42 -0
index 3764d12..6188e29 100644
@@ -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;
 }
board/samsung/trats/trats.c +0 -3
index 6bd106e..ce4b41f 100644
@@ -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);
board/samsung/trats2/trats2.c +0 -4
index 2442d96..73b8cc1 100644
@@ -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;
board/samsung/universal_c210/universal.c +0 -4
index 54d0e1e..166d5ee 100644
@@ -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;
drivers/video/exynos_fb.c +0 -28
index 7d4c6e0..00a0a11 100644
@@ -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);
include/configs/s5pc210_universal.h +3 -0
index 02a1c99..8a749f2 100644
@@ -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
  */
include/configs/trats.h +3 -0
index 2b07fe0..1b20823 100644
@@ -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
include/configs/trats2.h +3 -0
index 18270c1..a00bfc9 100644
@@ -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
Signature · 1 line
1.7.9.5
#43 lore raw

PATCH v2 6/13 common: makefile: Add optional cflags to object: common/lcd.o

In reply to Przemyslaw Marczak

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

---
Changes v2:
- new patch

---
 common/Makefile |    1 +
 1 file changed, 1 insertion(+)
common/Makefile +1 -0
index 74404be..619d72c 100644
@@ -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)
Signature · 1 line
1.7.9.5
#44 lore raw

PATCH v2 6/13 common: makefile: Add optional cflags to object: common/lcd.o

Hi, Marczak

Quoted 29 lines · On Wed, 18 Dec 2013 19:31:31 +0100 Przemyslaw Marczak <[email protected]>…

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

---
Changes v2:
- new patch

---
 common/Makefile |    1 +
 1 file changed, 1 insertion(+)
common/Makefile +1 -0
index 74404be..619d72c 100644
@@ -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)
Signature · 1 line
1.7.9.5

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

Thank you.

Signature · 1 line
Inha Song <[email protected]>
#45 lore raw

PATCH v2 6/13 common: makefile: Add optional cflags to object: common/lcd.o

In reply to Przemyslaw Marczak
Quoted 5 lines · Przemyslaw Marczak

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.

Quoted 18 lines

more info: README.arm-unaligned-accesses

---
Changes v2:
- new patch

---
 common/Makefile |    1 +
 1 file changed, 1 insertion(+)
common/Makefile +0 -0
index 74404be..619d72c 100644

common/Makefile $(obj)env_embedded.o: $(src)env_embedded.c · line 243

Quoted 4 lines
common/Makefile +1 -0
@@ -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.

#47 lore raw

PATCH v2 7/13 lib: tizen: change Tizen logo with the new one.

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

#48 lore raw

PATCH v2 7/13 lib: tizen: change Tizen logo with the new one.

Hello Hyungwon,

Quoted 10 lines · ???

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.

Signature · 4 lines
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com
#49 lore raw

PATCH v2 7/13 lib: tizen: change Tizen logo with the new one.

Hi, Marczak

Quoted 20 lines · On Thu, 19 Dec 2013 11:40:26 +0100 Przemyslaw Marczak <[email protected]>…

Hello Hyungwon,

Quoted 10 lines · ???

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.

Quoted 6 lines

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?

Quoted 2 lines

Regards.

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

#50 lore raw

PATCH v2 7/13 lib: tizen: change Tizen logo with the new one.

Dear Hyungwon,

Quoted 42 lines · Hyungwon Hwang

Hi, Marczak

Quoted 20 lines · On Thu, 19 Dec 2013 11:40:26 +0100 Przemyslaw Marczak <[email protected]>…

Hello Hyungwon,

Quoted 10 lines · ???

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.

Quoted 6 lines

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?

Quoted 2 lines

Regards.

Quoted 6 lines

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

Signature · 4 lines
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com
#51 lore raw

PATCH v2 7/13 lib: tizen: change Tizen logo with the new one.

Dear Marczak,

Quoted 94 lines · On Fri, 20 Dec 2013 12:50:11 +0100 Przemyslaw Marczak <[email protected]>…

Dear Hyungwon,

Quoted 43 lines · Hyungwon Hwang

Hi, Marczak

Quoted 21 lines · On Thu, 19 Dec 2013 11:40:26 +0100 Przemyslaw Marczak <[email protected]>…

Hello Hyungwon,

Quoted 10 lines · ???

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.

Quoted 6 lines

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?

Quoted 2 lines

Regards.

Quoted 6 lines

---
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)
  {
(quoted diff) +12 -5
-	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);
(quoted diff) +1 -0
+	x += panel_info.logo_x_offset; /* For X center align */
	y = ((panel_info.vl_height - panel_info.logo_height) >> 1);
(quoted diff) +1 -0
+	y += panel_info.logo_y_offset; /* For Y center align */
Quoted 4 lines

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

#52 lore raw

PATCH v2 7/13 lib: tizen: change Tizen logo with the new one.

Hello Hyungwon,

On 12/26/2013 12:39 AM, Hyungwon Hwang wrote:> Dear Marczak,

Quoted 33 lines
Quoted 29 lines · On Fri, 20 Dec 2013 12:50:11 +0100 Przemyslaw Marczak <[email protected]>…

Dear Hyungwon,

Quoted 26 lines · Hyungwon Hwang

Hi, Marczak

Quoted 21 lines · On Thu, 19 Dec 2013 11:40:26 +0100 Przemyslaw Marczak <[email protected]>…

Hello Hyungwon,

Quoted 10 lines · ???

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.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

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

Quoted 75 lines
Quoted 63 lines
Quoted 15 lines
Quoted 4 lines

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?

Quoted 2 lines

Regards.

Quoted 6 lines

---
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)
   {
(quoted diff) +12 -5
-	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);
(quoted diff) +1 -0
+	x += panel_info.logo_x_offset; /* For X center align */
	y = ((panel_info.vl_height - panel_info.logo_height) >> 1);
(quoted diff) +1 -0
+	y += panel_info.logo_y_offset; /* For Y center align */
Quoted 4 lines

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

Quoted 10 lines

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

Signature · 4 lines
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com
#53 lore raw

PATCH v2 8/13 video: exynos: fimd: add support for various display color modes

In reply to Przemyslaw Marczak

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.

---
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(-)
drivers/video/exynos_fimd.c +8 -7
index f962c4f..cebbba7 100644
@@ -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));
Signature · 1 line
1.7.9.5
#54 lore raw

PATCH v2 8/13 video: exynos: fimd: add support for various display color modes

Hi,

Quoted 37 lines · Przemyslaw Marczak

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.

---
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(-)
drivers/video/exynos_fimd.c +2 -7
index f962c4f..cebbba7 100644
@@ -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) {

drivers/video/exynos_fimd.c static void exynos_fimd_set_par(unsigned int win_id) · line 91

Quoted 10 lines
drivers/video/exynos_fimd.c +6 -0
+	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.

BR,
Donghwa Lee.

#55 lore raw

PATCH v2 9/13 samsung: boards: update display configs with 16bpp mode.

In reply to Przemyslaw Marczak

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

---
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(-)
board/samsung/trats/trats.c +1 -1
index ce4b41f..db527c7 100644
@@ -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,
board/samsung/trats2/trats2.c +1 -1
index 73b8cc1..6fa02c9 100644
@@ -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,
board/samsung/universal_c210/universal.c +1 -1
index 166d5ee..1ebea0f 100644
@@ -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,
include/configs/s5pc210_universal.h +1 -1
index 3c0a974..4079b7c 100644
@@ -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
include/configs/trats.h +1 -1
index 6bc14f7..a887d74 100644
@@ -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
include/configs/trats2.h +1 -1
index b65afc4..80d3ed0 100644
@@ -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
Signature · 1 line
1.7.9.5
#56 lore raw

PATCH v2 10/13 samsung: misc: Add LCD download menu.

In reply to Przemyslaw Marczak

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

---
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
board/samsung/common/misc.c +340 -0
index 6188e29..caa8b7d 100644
@@ -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;
 }
board/samsung/common/misc.h new file +18 -0
new file mode 100644
index 0000000..f583552
@@ -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
Signature · 1 line
1.7.9.5
#57 lore raw

PATCH v2 11/13 Trats: add LCD download menu support

In reply to Przemyslaw Marczak

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

---
 include/configs/trats.h |   23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
include/configs/trats.h +23 -0
index a887d74..a88346e 100644
@@ -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
Signature · 1 line
1.7.9.5
#58 lore raw

PATCH v2 12/13 trats2: add LCD download menu support

In reply to Przemyslaw Marczak

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

---
 include/configs/trats2.h |   27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
include/configs/trats2.h +27 -0
index 80d3ed0..b0dcfa4 100644
@@ -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
Signature · 1 line
1.7.9.5
#59 lore raw

PATCH v2 12/13 trats2: add LCD download menu support

Quoted 24 lines · Przemyslaw Marczak

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

---
 include/configs/trats2.h |   27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
include/configs/trats2.h +2 -0
index 80d3ed0..b0dcfa4 100644
@@ -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 */
 

include/configs/trats2.h line 330

Quoted 10 lines
include/configs/trats2.h +7 -0
@@ -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?

Quoted 12 lines
include/configs/trats2.h +11 -0
+#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)

include/configs/trats2.h line 351

Quoted 10 lines
include/configs/trats2.h +7 -0
+#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.

#60 lore raw

PATCH v2 13/13 universal: add LCD download menu support

In reply to Przemyslaw Marczak

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

---
 include/configs/s5pc210_universal.h |   23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
include/configs/s5pc210_universal.h +23 -0
index 4079b7c..bfed7f1 100644
@@ -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
  */
Signature · 1 line
1.7.9.5
#61 lore raw

PATCH v3 1/12 s5p: gpio: change gpio coding method for s5p gpio.

In reply to Przemyslaw Marczak

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

---
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(-)
arch/arm/include/asm/arch-exynos/gpio.h +73 -172
index 2a19852..64bd23b 100644
@@ -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
 
arch/arm/include/asm/arch-s5pc1xx/gpio.h +36 -11

56 lines not on this page · raw message

board/samsung/trats2/trats2.c +4 -4
index be15357..1e96fdc 100644
@@ -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
 
drivers/gpio/s5p_gpio.c +9 -6
index 7eeb96d..11a0472 100644
@@ -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 */
include/configs/s5p_goni.h +2 -2
index 0590d20..4cdf937 100644
@@ -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 */
include/configs/s5pc210_universal.h +6 -6
index d9e4c56..02a1c99 100644
@@ -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
include/configs/trats.h +2 -2
index 0877142..9727f7a 100644
@@ -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
Signature · 1 line
1.7.9.5
#62 lore raw

PATCH v3 2/12 trats2: Code cleanup.

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

---
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(-)
board/samsung/trats2/trats2.c +2 -17
index 1e96fdc..b4ccf51 100644
@@ -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
drivers/power/battery/bat_trats2.c +1 -1
index f264832..94015aa 100644
@@ -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;
include/configs/trats2.h +0 -1
index c9ce828..7dfbe98 100644
@@ -272,7 +272,6 @@
 #define CONFIG_EFI_PARTITION
 #define CONFIG_PARTITION_UUIDS
 
-#define CONFIG_MISC_INIT_R
 #define CONFIG_BOARD_EARLY_INIT_F
 
 /* I2C */
Signature · 1 line
1.7.9.5
#63 lore raw

PATCH v3 3/12 samsung: common: Add misc file and common function misc_init_r().

In reply to Przemyslaw Marczak

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

---
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
board/samsung/common/Makefile +1 -0
index 22bd6b1..79547a3 100644
@@ -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
board/samsung/common/misc.c new file +14 -0
new file mode 100644
index 0000000..3764d12
@@ -0,0 +1,14 @@
+/*
+ * Copyright (C) 2013 Samsung Electronics
+ * Przemyslaw Marczak <[email protected]>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+
+/* Common for Samsung boards */
+int misc_init_r(void)
+{
+	return 0;
+}
Signature · 1 line
1.7.9.5
#64 lore raw

PATCH v3 4/12 samsung: misc: move display logo function to misc.c file.

In reply to Przemyslaw Marczak

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

---
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(-)
board/samsung/common/misc.c +42 -0
index 3764d12..6188e29 100644
@@ -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;
 }
board/samsung/trats/trats.c +0 -3
index 640a193..cd27f18 100644
@@ -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);
board/samsung/trats2/trats2.c +0 -4
index b4ccf51..9a2c212 100644
@@ -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;
board/samsung/universal_c210/universal.c +0 -4
index 54d0e1e..166d5ee 100644
@@ -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;
drivers/video/exynos_fb.c +0 -28
index 7d4c6e0..00a0a11 100644
@@ -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);
include/configs/s5pc210_universal.h +3 -0
index 02a1c99..8a749f2 100644
@@ -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
  */
include/configs/trats.h +3 -0
index 9727f7a..1a75bb3 100644
@@ -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
include/configs/trats2.h +3 -0
index 7dfbe98..e54fe52 100644
@@ -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
Signature · 1 line
1.7.9.5
#65 lore raw

PATCH v3 5/12 common: lcd.c: fix data abort exception when try to access bmp header

In reply to Przemyslaw Marczak

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.

---
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(-)
common/lcd.c +13 -14
index 56bf067..aa81522 100644
@@ -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");
Signature · 1 line
1.7.9.5
#66 lore raw

PATCH v3 5/12 common: lcd.c: fix data abort exception when try to access bmp header

Cc Anatolij Gustschin
Quoted 100 lines · Przemyslaw Marczak

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.

---
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(-)
common/lcd.c +13 -14
index 56bf067..aa81522 100644
@@ -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");
#67 lore raw

PATCH v3 5/12 common: lcd.c: fix data abort exception when try to access bmp header

In reply to Przemyslaw Marczak
Quoted 13 lines · On Fri, 03 Jan 2014 17:43:06 +0100 Przemyslaw Marczak <[email protected]>…

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.

---
Changes v2:
- new patch

Quoted 6 lines

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(-)
#68 lore raw

PATCH v3 6/12 lib: tizen: change Tizen logo with the new one.

In reply to Przemyslaw Marczak

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.

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

#69 lore raw

PATCH v3 7/12 video: exynos: fimd: add support for various display color modes

In reply to Przemyslaw Marczak

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.

---
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(-)
drivers/video/exynos_fimd.c +8 -7
index f962c4f..cebbba7 100644
@@ -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));
Signature · 1 line
1.7.9.5
#70 lore raw

PATCH v3 8/12 samsung: boards: update display configs with 16bpp mode.

In reply to Przemyslaw Marczak

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

---
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(-)
board/samsung/trats/trats.c +1 -1
index cd27f18..a849b73 100644
@@ -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,
board/samsung/trats2/trats2.c +1 -1
index 9a2c212..bae8d6c 100644
@@ -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,
board/samsung/universal_c210/universal.c +1 -1
index 166d5ee..1ebea0f 100644
@@ -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,
include/configs/s5pc210_universal.h +1 -1
index 3c0a974..4079b7c 100644
@@ -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
include/configs/trats.h +1 -1
index 9a7dea1..79f9168 100644
@@ -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
include/configs/trats2.h +1 -1
index 8c7c6bd..740ceb1 100644
@@ -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
Signature · 1 line
1.7.9.5
#71 lore raw

PATCH v3 9/12 samsung: misc: Add LCD download menu.

In reply to Przemyslaw Marczak

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

---
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
board/samsung/common/misc.c +340 -0
index 3a91d62..93f766c 100644
@@ -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;
 }
board/samsung/common/misc.h new file +18 -0
new file mode 100644
index 0000000..f583552
@@ -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
Signature · 1 line
1.7.9.5
#72 lore raw

PATCH v3 9/12 samsung: misc: Add LCD download menu.

Quoted 60 lines · Przemyslaw Marczak

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

---
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
board/samsung/common/misc.c +7 -0
index 3a91d62..93f766c 100644
@@ -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>

board/samsung/common/misc.c line 27

Quoted 10 lines
board/samsung/common/misc.c +10 -0
+#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?

board/samsung/common/misc.c line 30

Quoted 3 lines
board/samsung/common/misc.c +3 -0
+{
+	struct pmic *pmic = pmic_get(KEY_PWR_PMIC_NAME);
+	u32 status = 0;

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

board/samsung/common/misc.c line 31

Quoted 1 line
board/samsung/common/misc.c +1 -0
+	u32 mask;

please check return value of pmic_get

	pmic = pmic_get(KEY_PWR_PMIC_NAME);
	if !(pmic)
		return 0;
Quoted 13 lines
board/samsung/common/misc.c +13 -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;

board/samsung/common/misc.c line 54

Quoted 10 lines
board/samsung/common/misc.c +10 -0
+
+	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.

Quoted 31 lines
board/samsung/common/misc.c +31 -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;
+}

board/samsung/common/misc.c line 95

Quoted 10 lines
board/samsung/common/misc.c +10 -0
+
+/*
+ * 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.

board/samsung/common/misc.c line 99

Quoted 4 lines
board/samsung/common/misc.c +4 -0
+				"THOR",
+				"UMS",
+				"DFU",
+				"EXIT"};

please move the brace to next line.

board/samsung/common/misc.c line 106

Quoted 7 lines
board/samsung/common/misc.c +7 -0
+
+static char *
+mode_info[BOOT_MODE_EXIT + 1] = {"info",
+				 "downloader",
+				 "mass storage",
+				 "firmware update",
+				 "and run normal boot"};

ditto.

board/samsung/common/misc.c line 113

Quoted 7 lines
board/samsung/common/misc.c +7 -0
+
+static char *
+mode_cmd[BOOT_MODE_EXIT + 1] = {"",
+				"thor 0 mmc 0",
+				"ums 0 mmc 0",
+				"dfu 0 mmc 0",
+				""};

ditto.

board/samsung/common/misc.c line 116

Quoted 3 lines
board/samsung/common/misc.c +3 -0
+
+static void display_board_info(void)
+{

#ifdef CONFIG_GENERIC_MMC

board/samsung/common/misc.c line 117

Quoted 1 line
board/samsung/common/misc.c +1 -0
+	struct mmc *mmc = find_mmc_device(0);

#endif

Quoted 5 lines
board/samsung/common/misc.c +5 -0
+	vidinfo_t *vid = &panel_info;
+
+	lcd_position_cursor(4, 4);
+
+	lcd_printf("%s\n\t", U_BOOT_VERSION);

board/samsung/common/misc.c line 132

Quoted 10 lines
board/samsung/common/misc.c +10 -0
+	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

board/samsung/common/misc.c line 134

Quoted 2 lines
board/samsung/common/misc.c +2 -0
+	if (mmc)
+		lcd_printf("\teMMC size: %llu MB\n", mmc->capacity / SZ_1M);

#endif

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

Quoted 30 lines
board/samsung/common/misc.c +30 -0
+
+	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;

board/samsung/common/misc.c line 174

Quoted 10 lines
board/samsung/common/misc.c +10 -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.

board/samsung/common/misc.c line 175

Quoted 1 line
board/samsung/common/misc.c +1 -0
+	default:

then, mode_supported = 0; maybe?

board/samsung/common/misc.c line 187

Quoted 12 lines
board/samsung/common/misc.c +12 -0
+		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?

Quoted 21 lines
board/samsung/common/misc.c +21 -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);

board/samsung/common/misc.c line 218

Quoted 10 lines
board/samsung/common/misc.c +10 -0
+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?

Quoted 74 lines
board/samsung/common/misc.c +74 -0
+	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.");
+}
+

board/samsung/common/misc.c line 302

Quoted 10 lines
board/samsung/common/misc.c +10 -0
+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?

board/samsung/common/misc.c line 314

Quoted 12 lines
board/samsung/common/misc.c +12 -0
+
+		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?

Quoted 65 lines
board/samsung/common/misc.c +36 -0
+		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;
 }
board/samsung/common/misc.h new file +9 -0
new file mode 100644
index 0000000..f583552
@@ -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,

board/samsung/common/misc.h line 18

Quoted 10 lines
board/samsung/common/misc.h new file +9 -0
+	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.

#73 lore raw

PATCH v3 9/12 samsung: misc: Add LCD download menu.

Hello Minkyu,

Thank you for review.

Quoted 212 lines · Minkyu Kang
Quoted 60 lines · Przemyslaw Marczak

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

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

board/samsung/common/misc.c +7 -0
index 3a91d62..93f766c 100644
@@ -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>

board/samsung/common/misc.c line 27

Quoted 10 lines
board/samsung/common/misc.c +10 -0
+#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?

board/samsung/common/misc.c line 30

Quoted 3 lines
board/samsung/common/misc.c +3 -0
+{
+	struct pmic *pmic = pmic_get(KEY_PWR_PMIC_NAME);
+	u32 status = 0;

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

board/samsung/common/misc.c line 31

Quoted 1 line
board/samsung/common/misc.c +1 -0
+	u32 mask;

please check return value of pmic_get

	pmic = pmic_get(KEY_PWR_PMIC_NAME);
	if !(pmic)
		return 0;
Quoted 13 lines
board/samsung/common/misc.c +13 -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;

board/samsung/common/misc.c line 54

Quoted 10 lines
board/samsung/common/misc.c +10 -0
+
+	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.

Quoted 31 lines
board/samsung/common/misc.c +31 -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;
+}

board/samsung/common/misc.c line 95

Quoted 10 lines
board/samsung/common/misc.c +10 -0
+
+/*
+ * 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.

board/samsung/common/misc.c line 99

Quoted 4 lines
board/samsung/common/misc.c +4 -0
+				"THOR",
+				"UMS",
+				"DFU",
+				"EXIT"};

please move the brace to next line.

board/samsung/common/misc.c line 106

Quoted 7 lines
board/samsung/common/misc.c +7 -0
+
+static char *
+mode_info[BOOT_MODE_EXIT + 1] = {"info",
+				 "downloader",
+				 "mass storage",
+				 "firmware update",
+				 "and run normal boot"};

ditto.

board/samsung/common/misc.c line 113

Quoted 7 lines
board/samsung/common/misc.c +7 -0
+
+static char *
+mode_cmd[BOOT_MODE_EXIT + 1] = {"",
+				"thor 0 mmc 0",
+				"ums 0 mmc 0",
+				"dfu 0 mmc 0",
+				""};

ditto.

board/samsung/common/misc.c line 116

Quoted 3 lines
board/samsung/common/misc.c +3 -0
+
+static void display_board_info(void)
+{

#ifdef CONFIG_GENERIC_MMC

board/samsung/common/misc.c line 117

Quoted 1 line
board/samsung/common/misc.c +1 -0
+	struct mmc *mmc = find_mmc_device(0);

#endif

Quoted 5 lines
board/samsung/common/misc.c +5 -0
+	vidinfo_t *vid = &panel_info;
+
+	lcd_position_cursor(4, 4);
+
+	lcd_printf("%s\n\t", U_BOOT_VERSION);

board/samsung/common/misc.c line 132

Quoted 10 lines
board/samsung/common/misc.c +10 -0
+	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

Quoted 6 lines

board/samsung/common/misc.c line 134

Quoted 2 lines
board/samsung/common/misc.c +2 -0
+	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.

Quoted 35 lines
Quoted 35 lines
board/samsung/common/misc.c +35 -0
+
+	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;
Quoted 9 lines

board/samsung/common/misc.c line 174

Quoted 5 lines
board/samsung/common/misc.c +5 -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.

Quoted 4 lines

board/samsung/common/misc.c line 175

Quoted 1 line
board/samsung/common/misc.c +1 -0
+	default:

then, mode_supported = 0; maybe?

Quoted 15 lines

board/samsung/common/misc.c line 187

Quoted 12 lines
board/samsung/common/misc.c +12 -0
+		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.

Quoted 25 lines
Quoted 25 lines
board/samsung/common/misc.c +25 -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;
+}
Quoted 9 lines

board/samsung/common/misc.c line 218

Quoted 6 lines
board/samsung/common/misc.c +6 -0
+
+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.

Quoted 80 lines
Quoted 80 lines
board/samsung/common/misc.c +80 -0
+	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();
Quoted 9 lines

board/samsung/common/misc.c line 302

Quoted 4 lines
board/samsung/common/misc.c +4 -0
+
+	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.

Quoted 6 lines
Quoted 6 lines
board/samsung/common/misc.c +6 -0
+
+		key = key_pressed(KEY_POWER);
+		if (key)
+			break;
+	}
+
Quoted 8 lines

board/samsung/common/misc.c line 314

Quoted 6 lines
board/samsung/common/misc.c +6 -0
+	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.

Quoted 71 lines
Quoted 71 lines
board/samsung/common/misc.c +36 -0
+		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;
  }
board/samsung/common/misc.h new file +15 -0
new file mode 100644
index 0000000..f583552
@@ -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
Quoted 9 lines

board/samsung/common/misc.h line 18

Quoted 5 lines
board/samsung/common/misc.h new file +3 -0
+#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

Signature · 4 lines
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com
#74 lore raw

PATCH v3 10/12 Trats: add LCD download menu support

In reply to Przemyslaw Marczak

---
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(+)
include/configs/trats.h +23 -0
index 79f9168..521fa3e 100644
@@ -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
Signature · 1 line
1.7.9.5
#75 lore raw

PATCH v3 10/12 Trats: add LCD download menu support

---
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(+)
include/configs/trats.h +22 -0
index 79f9168..2979df5 100644
@@ -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
Signature · 1 line
1.7.9.5
#76 lore raw

PATCH v3 11/12 trats2: add LCD download menu support

In reply to Przemyslaw Marczak

---
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(+)
include/configs/trats2.h +27 -0
index 740ceb1..4b1a8ea 100644
@@ -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
Signature · 1 line
1.7.9.5
#77 lore raw

PATCH v3 11/12 trats2: add LCD download menu support

---
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(+)
include/configs/trats2.h +26 -0
index 740ceb1..453a37e 100644
@@ -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
Signature · 1 line
1.7.9.5
#78 lore raw

PATCH v3 11/12 trats2: add LCD download menu support

Quoted 26 lines · Przemyslaw Marczak

---
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(+)
include/configs/trats2.h +1 -0
index 740ceb1..453a37e 100644
@@ -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 */
 

include/configs/trats2.h int get_soft_i2c_sda_pin(void); · line 325

Quoted 10 lines
include/configs/trats2.h +7 -0
@@ -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?

Quoted 12 lines
include/configs/trats2.h +11 -0
+#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)

include/configs/trats2.h int get_soft_i2c_sda_pin(void); · line 346

Quoted 10 lines
include/configs/trats2.h +7 -0
+#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.

#79 lore raw

PATCH v3 11/12 trats2: add LCD download menu support

Hello,

Quoted 30 lines · Minkyu Kang
Quoted 29 lines · Przemyslaw Marczak

---
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(+)
include/configs/trats2.h +1 -0
index 740ceb1..453a37e 100644
@@ -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
 
Quoted 10 lines

include/configs/trats2.h int get_soft_i2c_sda_pin(void); · line 325

Quoted 7 lines
include/configs/trats2.h +7 -0
+/* 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.

Quoted 17 lines
Quoted 17 lines
include/configs/trats2.h +17 -0
+#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
Quoted 9 lines

include/configs/trats2.h int get_soft_i2c_sda_pin(void); · line 346

Quoted 5 lines
include/configs/trats2.h +1 -0
+
  /* LCD */
  #define CONFIG_EXYNOS_FB
  #define CONFIG_LCD

Thanks,
Minkyu Kang.

Regards

Signature · 4 lines
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com
#80 lore raw

PATCH v3 11/12 trats2: add LCD download menu support

Dear Przemsyslaw Marczak,

Quoted 44 lines · Przemyslaw Marczak

Hello,

Quoted 30 lines · Minkyu Kang
Quoted 29 lines · Przemyslaw Marczak

---
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(+)
include/configs/trats2.h +1 -0
index 740ceb1..453a37e 100644
@@ -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
 
Quoted 10 lines

include/configs/trats2.h int get_soft_i2c_sda_pin(void); · line 325

Quoted 7 lines
include/configs/trats2.h +7 -0
+/* 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?

Quoted 1 line

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.

#81 lore raw

PATCH v3 11/12 trats2: add LCD download menu support

Hello Minkyu,

Quoted 47 lines · Minkyu Kang

Dear Przemsyslaw Marczak,

Quoted 44 lines · Przemyslaw Marczak

Hello,

Quoted 40 lines · Minkyu Kang
Quoted 26 lines · Przemyslaw Marczak

---
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(+)
include/configs/trats2.h +1 -0
index 740ceb1..453a37e 100644
@@ -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 */
 

include/configs/trats2.h int get_soft_i2c_sda_pin(void); · line 325

Quoted 10 lines
include/configs/trats2.h +7 -0
@@ -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?

Quoted 8 lines
Quoted 1 line

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

Signature · 4 lines
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com
#82 lore raw

PATCH v3 12/12 universal: add LCD download menu support

In reply to Przemyslaw Marczak

---
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(+)
include/configs/s5pc210_universal.h +23 -0
index 4079b7c..b230621 100644
@@ -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
  */
Signature · 1 line
1.7.9.5
#83 lore raw

PATCH v3 12/12 universal: add LCD download menu support

---
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(+)
include/configs/s5pc210_universal.h +22 -0
index 4079b7c..ec8f991 100644
@@ -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
  */
Signature · 1 line
1.7.9.5
#84 lore raw

PATCH v3 12/12 universal: add LCD download menu support

Dear all,

Quoted 7 lines · Przemyslaw Marczak

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

Quoted 6 lines

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

Signature · 4 lines
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com
#85 lore raw

PATCH v3 1/12 s5p: gpio: change gpio coding method for s5p gpio.

In reply to Przemyslaw Marczak
Quoted 140 lines · Przemyslaw Marczak

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

---
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(-)
arch/arm/include/asm/arch-exynos/gpio.h +0 -104
index 2a19852..64bd23b 100644
@@ -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)

arch/arm/include/asm/arch-exynos/gpio.h void s5p_gpio_set_rate(struct s5p_gpio_bank *bank, int gpio, int mode); · line 257

Quoted 10 lines
arch/arm/include/asm/arch-exynos/gpio.h +8 -2
-
-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.

Quoted 312 lines
arch/arm/include/asm/arch-exynos/gpio.h +65 -66
+
+#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
 
arch/arm/include/asm/arch-s5pc1xx/gpio.h +36 -11
index ac60fe6..c2d9244 100644
@@ -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 */
board/samsung/trats2/trats2.c +4 -4
index be15357..1e96fdc 100644
@@ -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
 
drivers/gpio/s5p_gpio.c +9 -6
index 7eeb96d..11a0472 100644
@@ -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 */
include/configs/s5p_goni.h +2 -2
index 0590d20..4cdf937 100644
@@ -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 */
include/configs/s5pc210_universal.h +6 -6
index d9e4c56..02a1c99 100644
@@ -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
include/configs/trats.h +0 -0
index 0877142..9727f7a 100644

include/configs/trats.h line 289

Quoted 10 lines
include/configs/trats.h +2 -2
@@ -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.

#86 lore raw

PATCH v3 1/12 s5p: gpio: change gpio coding method for s5p gpio.

Hello,

Quoted 146 lines · Minkyu Kang
Quoted 145 lines · Przemyslaw Marczak

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

---
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(-)
arch/arm/include/asm/arch-exynos/gpio.h +3 -106
index 2a19852..64bd23b 100644
@@ -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)
Quoted 9 lines

arch/arm/include/asm/arch-exynos/gpio.h void s5p_gpio_set_rate(struct s5p_gpio_bank *bank, int gpio, int mode); · line 257

Quoted 5 lines
arch/arm/include/asm/arch-exynos/gpio.h +5 -0
+#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.

Quoted 319 lines
Quoted 319 lines
arch/arm/include/asm/arch-exynos/gpio.h +65 -66
+
+#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
 
arch/arm/include/asm/arch-s5pc1xx/gpio.h +36 -11
index ac60fe6..c2d9244 100644
@@ -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 */
board/samsung/trats2/trats2.c +4 -4
index be15357..1e96fdc 100644
@@ -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
 
drivers/gpio/s5p_gpio.c +9 -6
index 7eeb96d..11a0472 100644
@@ -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 */
include/configs/s5p_goni.h +2 -2
index 0590d20..4cdf937 100644
@@ -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 */
include/configs/s5pc210_universal.h +6 -6
index d9e4c56..02a1c99 100644
@@ -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
include/configs/trats.h +2 -2
index 0877142..9727f7a 100644
@@ -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)
 
Quoted 7 lines

include/configs/trats.h line 289

Quoted 3 lines
include/configs/trats.h +0 -0
  #define CONFIG_POWER
  #define CONFIG_POWER_I2C

Thanks,
Minkyu Kang.

Regards

Signature · 4 lines
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com
#87 lore raw

v4 cover Introduce Samsung misc file and LCD menu.

In reply to Przemyslaw Marczak

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
Signature · 1 line
1.7.9.5
#88 lore raw

PATCH v4 1/12 s5p: gpio: change gpio coding method for s5p gpio.

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

---
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(-)
arch/arm/include/asm/arch-exynos/gpio.h +73 -172
index 2a19852..d6868fa 100644
@@ -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
 
arch/arm/include/asm/arch-s5pc1xx/gpio.h +36 -11

56 lines not on this page · raw message

board/samsung/trats2/trats2.c +4 -4
index be15357..1e96fdc 100644
@@ -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
 
drivers/gpio/s5p_gpio.c +9 -6
index 7eeb96d..11a0472 100644
@@ -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 */
include/configs/s5p_goni.h +2 -2
index 0590d20..4cdf937 100644
@@ -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 */
include/configs/s5pc210_universal.h +6 -6
index d9e4c56..02a1c99 100644
@@ -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
include/configs/trats.h +2 -2
index 0877142..9727f7a 100644
@@ -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
Signature · 1 line
1.7.9.5
#89 lore raw

PATCH v4 2/12 trats2: Code cleanup.

In reply to Przemyslaw Marczak

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

---
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(-)
board/samsung/trats2/trats2.c +2 -17
index 1e96fdc..b4ccf51 100644
@@ -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
drivers/power/battery/bat_trats2.c +1 -1
index f264832..94015aa 100644
@@ -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;
include/configs/trats2.h +0 -1
index c9ce828..7dfbe98 100644
@@ -272,7 +272,6 @@
 #define CONFIG_EFI_PARTITION
 #define CONFIG_PARTITION_UUIDS
 
-#define CONFIG_MISC_INIT_R
 #define CONFIG_BOARD_EARLY_INIT_F
 
 /* I2C */
include/power/max77686_pmic.h +2 -0
index 16e9016..c2a772a 100644
@@ -8,6 +8,8 @@
 #ifndef __MAX77686_H_
 #define __MAX77686_H_
 
+#include <power/pmic.h>
+
 enum {
 	MAX77686_REG_PMIC_ID		= 0x0,
 	MAX77686_REG_PMIC_INTSRC,
Signature · 1 line
1.7.9.5
#90 lore raw

PATCH v4 2/12 trats2: Code cleanup.

Quoted 99 lines · Przemyslaw Marczak

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

---
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(-)
board/samsung/trats2/trats2.c +2 -17
index 1e96fdc..b4ccf51 100644
@@ -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
drivers/power/battery/bat_trats2.c +1 -1
index f264832..94015aa 100644
@@ -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;
include/configs/trats2.h +0 -1
index c9ce828..7dfbe98 100644
@@ -272,7 +272,6 @@
 #define CONFIG_EFI_PARTITION
 #define CONFIG_PARTITION_UUIDS
 
-#define CONFIG_MISC_INIT_R
 #define CONFIG_BOARD_EARLY_INIT_F
 
 /* I2C */
include/power/max77686_pmic.h +2 -0
index 16e9016..c2a772a 100644
@@ -8,6 +8,8 @@
 #ifndef __MAX77686_H_
 #define __MAX77686_H_
 
+#include <power/pmic.h>
+
 enum {
 	MAX77686_REG_PMIC_ID		= 0x0,
 	MAX77686_REG_PMIC_INTSRC,
#91 lore raw

PATCH v4 3/12 samsung: common: Add misc file and common function misc_init_r().

In reply to Przemyslaw Marczak

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

---
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
board/samsung/common/Makefile +1 -0
index 22bd6b1..79547a3 100644
@@ -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
board/samsung/common/misc.c new file +14 -0
new file mode 100644
index 0000000..3764d12
@@ -0,0 +1,14 @@
+/*
+ * Copyright (C) 2013 Samsung Electronics
+ * Przemyslaw Marczak <[email protected]>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+
+/* Common for Samsung boards */
+int misc_init_r(void)
+{
+	return 0;
+}
Signature · 1 line
1.7.9.5
#92 lore raw

PATCH v4 3/12 samsung: common: Add misc file and common function misc_init_r().

Quoted 54 lines · Przemyslaw Marczak

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

---
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
board/samsung/common/Makefile +1 -0
index 22bd6b1..79547a3 100644
@@ -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
board/samsung/common/misc.c new file +14 -0
new file mode 100644
index 0000000..3764d12
@@ -0,0 +1,14 @@
+/*
+ * Copyright (C) 2013 Samsung Electronics
+ * Przemyslaw Marczak <[email protected]>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+
+/* Common for Samsung boards */
+int misc_init_r(void)
+{
+	return 0;
+}
#93 lore raw

PATCH v4 4/12 samsung: misc: move display logo function to misc.c file.

In reply to Przemyslaw Marczak

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

---
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(-)
board/samsung/common/misc.c +42 -0
index 3764d12..6188e29 100644
@@ -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;
 }
board/samsung/trats/trats.c +0 -3
index 640a193..cd27f18 100644
@@ -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);
board/samsung/trats2/trats2.c +0 -4
index b4ccf51..9a2c212 100644
@@ -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;
board/samsung/universal_c210/universal.c +0 -4
index 54d0e1e..166d5ee 100644
@@ -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;
drivers/video/exynos_fb.c +0 -28
index 7d4c6e0..00a0a11 100644
@@ -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);
include/configs/s5pc210_universal.h +3 -0
index 02a1c99..8a749f2 100644
@@ -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
  */
include/configs/trats.h +3 -0
index 9727f7a..1a75bb3 100644
@@ -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
include/configs/trats2.h +3 -0
index 7dfbe98..e54fe52 100644
@@ -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
Signature · 1 line
1.7.9.5
#94 lore raw

PATCH v4 5/12 common: lcd.c: fix data abort exception when try to access bmp header

In reply to Przemyslaw Marczak

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.

---
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(-)
common/lcd.c +13 -14
index 56bf067..aa81522 100644
@@ -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");
Signature · 1 line
1.7.9.5
#96 lore raw

PATCH v4 6/12 lib: tizen: change Tizen logo with the new one.

Hi, Marczak

Quoted 4 lines · On Thu, 09 Jan 2014 12:23:10 +0100 Przemyslaw Marczak <[email protected]>…

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

Signature · 4 lines
Hyungwon Hwang
S/W Platform Team, Software center
Samsung Electronics.
human.hwang at samsung.com
#97 lore raw

PATCH v4 6/12 lib: tizen: change Tizen logo with the new one.

In reply to Przemyslaw Marczak

Hi, Marczak

Quoted 4 lines · On Thu, 09 Jan 2014 12:23:10 +0100 Przemyslaw Marczak <[email protected]>…

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

Signature · 4 lines
Hyungwon Hwang
S/W Platform Team, Software Center
Samsung Electronics.
human.hwang at samsung.com
#98 lore raw

PATCH v4 6/12 lib: tizen: change Tizen logo with the new one.

Hi Hyungwon,

Quoted 10 lines · Hyungwon Hwang

Hi, Marczak

Quoted 4 lines · On Thu, 09 Jan 2014 12:23:10 +0100 Przemyslaw Marczak <[email protected]>…

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

Quoted 8 lines

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

Best regards,
Hyungwon Hwang

Thank you for testing.

Regards

Signature · 4 lines
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com
#99 lore raw

PATCH v4 7/12 video: exynos: fimd: add support for various display color modes

In reply to Przemyslaw Marczak

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.

---
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(-)
drivers/video/exynos_fimd.c +8 -7
index f962c4f..cebbba7 100644
@@ -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));
Signature · 1 line
1.7.9.5
#100 lore raw

PATCH v4 8/12 samsung: boards: update display configs with 16bpp mode.

In reply to Przemyslaw Marczak

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

---
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(-)
board/samsung/trats/trats.c +1 -1
index cd27f18..a849b73 100644
@@ -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,
board/samsung/trats2/trats2.c +1 -1
index 9a2c212..bae8d6c 100644
@@ -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,
board/samsung/universal_c210/universal.c +1 -1
index 166d5ee..1ebea0f 100644
@@ -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,
include/configs/s5pc210_universal.h +1 -1
index 3c0a974..4079b7c 100644
@@ -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
include/configs/trats.h +1 -1
index 9a7dea1..79f9168 100644
@@ -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
include/configs/trats2.h +1 -1
index 8c7c6bd..740ceb1 100644
@@ -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
Signature · 1 line
1.7.9.5
#101 lore raw

PATCH v4 9/12 samsung: misc: Add LCD download menu.

In reply to Przemyslaw Marczak

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

---
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
board/samsung/common/misc.c +349 -0
index 3a91d62..f29fca4 100644
@@ -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;
 }
board/samsung/common/misc.h new file +18 -0
new file mode 100644
index 0000000..f583552
@@ -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__ */
Signature · 1 line
1.7.9.5
#102 lore raw

PATCH v4 9/12 samsung: misc: Add LCD download menu.

Quoted 61 lines · Przemyslaw Marczak

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

---
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
board/samsung/common/misc.c +0 -0
index 3a91d62..f29fca4 100644
@@ -8,6 +8,350 @@
 #include <common.h>
 #include <lcd.h>

board/samsung/common/misc.c line 19

Quoted 10 lines
board/samsung/common/misc.c +9 -0
 #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.

Quoted 97 lines
board/samsung/common/misc.c +97 -0
+#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 *

board/samsung/common/misc.c line 126

Quoted 10 lines
board/samsung/common/misc.c +10 -0
+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

board/samsung/common/misc.c line 127

Quoted 1 line
board/samsung/common/misc.c +1 -0
+	struct mmc *mmc = find_mmc_device(0);

#endif

Quoted 5 lines
board/samsung/common/misc.c +5 -0
+	vidinfo_t *vid = &panel_info;
+
+	lcd_position_cursor(4, 4);
+
+	lcd_printf("%s\n\t", U_BOOT_VERSION);

board/samsung/common/misc.c line 142

Quoted 10 lines
board/samsung/common/misc.c +10 -0
+	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

board/samsung/common/misc.c line 148

Quoted 6 lines
board/samsung/common/misc.c +6 -0
+	if (mmc) {
+		if (!mmc->capacity)
+			mmc_init(mmc);
+
+		lcd_printf("\teMMC size: %llu MB\n", mmc->capacity / SZ_1M);
+	}

#endif

Quoted 8 lines
board/samsung/common/misc.c +8 -0
+
+	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);
+}
+

board/samsung/common/misc.c

Quoted 10 lines
board/samsung/common/misc.c +10 -0
+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)?

Quoted 8 lines
board/samsung/common/misc.c +8 -0
+
+		key = key_pressed(KEY_POWER);
+		if (key)
+			break;
+	}
+
+	lcd_clear();
+

board/samsung/common/misc.c line 330

Quoted 10 lines
board/samsung/common/misc.c +10 -0
+	/* 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.

#103 lore raw

PATCH v4 9/12 samsung: misc: Add LCD download menu.

Hello Minkyu,

Quoted 66 lines · Minkyu Kang
Quoted 65 lines · Przemyslaw Marczak

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

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

board/samsung/common/misc.c +3 -0
index 3a91d62..f29fca4 100644
@@ -8,6 +8,350 @@
  #include <common.h>
  #include <lcd.h>
  #include <libtizen.h>
+#include <errno.h>
+#include <version.h>
+#include <asm/sizes.h>
Quoted 9 lines

board/samsung/common/misc.c line 19

Quoted 6 lines
board/samsung/common/misc.c +6 -0
+#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.

Quoted 149 lines
Quoted 97 lines
board/samsung/common/misc.c +97 -0
+#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 *

board/samsung/common/misc.c line 126

Quoted 10 lines
board/samsung/common/misc.c +10 -0
+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

board/samsung/common/misc.c line 127

Quoted 1 line
board/samsung/common/misc.c +1 -0
+	struct mmc *mmc = find_mmc_device(0);

#endif

Quoted 5 lines
board/samsung/common/misc.c +5 -0
+	vidinfo_t *vid = &panel_info;
+
+	lcd_position_cursor(4, 4);
+
+	lcd_printf("%s\n\t", U_BOOT_VERSION);

board/samsung/common/misc.c line 142

Quoted 10 lines
board/samsung/common/misc.c +10 -0
+	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

board/samsung/common/misc.c line 148

Quoted 6 lines
board/samsung/common/misc.c +6 -0
+	if (mmc) {
+		if (!mmc->capacity)
+			mmc_init(mmc);
+
+		lcd_printf("\teMMC size: %llu MB\n", mmc->capacity / SZ_1M);
+	}

#endif

Quoted 12 lines
board/samsung/common/misc.c +12 -0
+
+	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;
Quoted 9 lines

board/samsung/common/misc.c line 312

Quoted 6 lines
board/samsung/common/misc.c +6 -0
+
+	display_mode_info();
+
+	while (timeout--) {
+		lcd_printf("\rNormal boot will start in: %d seconds.", timeout);
+		udelay(1000000);

mdelay(1000)?

OK.

Quoted 13 lines
Quoted 13 lines
board/samsung/common/misc.c +13 -0
+
+		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");
Quoted 10 lines

board/samsung/common/misc.c line 52

Quoted 5 lines
board/samsung/common/misc.c +5 -0
+	}
+
+	return 0;
+}
+

Thanks,
Minkyu Kang.

Thank you for review.

Regards

Signature · 4 lines
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com
#104 lore raw

PATCH v4 9/12 samsung: misc: Add LCD download menu.

Quoted 79 lines · Przemyslaw Marczak

Hello Minkyu,

Quoted 66 lines · Minkyu Kang
Quoted 65 lines · Przemyslaw Marczak

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

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

board/samsung/common/misc.c +3 -0
index 3a91d62..f29fca4 100644
@@ -8,6 +8,350 @@
  #include <common.h>
  #include <lcd.h>
  #include <libtizen.h>
+#include <errno.h>
+#include <version.h>
+#include <asm/sizes.h>
Quoted 9 lines

board/samsung/common/misc.c line 19

Quoted 6 lines
board/samsung/common/misc.c +6 -0
+#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.

Quoted 111 lines

Thanks, will be removed.

Quoted 109 lines
Quoted 97 lines
board/samsung/common/misc.c +97 -0
+#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 *

board/samsung/common/misc.c line 126

Quoted 10 lines
board/samsung/common/misc.c +10 -0
+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?

Quoted 12 lines
Quoted 12 lines

board/samsung/common/misc.c line 127

Quoted 1 line
board/samsung/common/misc.c +1 -0
+    struct mmc *mmc = find_mmc_device(0);

#endif

Quoted 9 lines
board/samsung/common/misc.c +9 -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
Quoted 8 lines
Quoted 8 lines

board/samsung/common/misc.c line 142

Quoted 6 lines
board/samsung/common/misc.c +6 -0
+#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.

Quoted 8 lines
Quoted 8 lines

board/samsung/common/misc.c line 148

Quoted 6 lines
board/samsung/common/misc.c +6 -0
+    if (mmc) {
+        if (!mmc->capacity)
+            mmc_init(mmc);
+
+        lcd_printf("\teMMC size: %llu MB\n", mmc->capacity / SZ_1M);
+    }

#endif

Quoted 8 lines
Quoted 8 lines

board/samsung/common/misc.c line 156

Quoted 8 lines
board/samsung/common/misc.c +8 -0
+
+    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.

#105 lore raw

PATCH v4 9/12 samsung: misc: Add LCD download menu.

Quoted 215 lines · Minkyu Kang
Quoted 79 lines · Przemyslaw Marczak

Hello Minkyu,

Quoted 66 lines · Minkyu Kang
Quoted 65 lines · Przemyslaw Marczak

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

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

board/samsung/common/misc.c +3 -0
index 3a91d62..f29fca4 100644
@@ -8,6 +8,350 @@
   #include <common.h>
   #include <lcd.h>
   #include <libtizen.h>
+#include <errno.h>
+#include <version.h>
+#include <asm/sizes.h>
Quoted 9 lines

board/samsung/common/misc.c line 19

Quoted 6 lines
board/samsung/common/misc.c +6 -0
+#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.

Quoted 111 lines

Thanks, will be removed.

Quoted 109 lines
Quoted 97 lines
board/samsung/common/misc.c +97 -0
+#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 *

board/samsung/common/misc.c line 126

Quoted 10 lines
board/samsung/common/misc.c +10 -0
+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?

Quoted 12 lines
Quoted 12 lines

board/samsung/common/misc.c line 127

Quoted 1 line
board/samsung/common/misc.c +1 -0
+    struct mmc *mmc = find_mmc_device(0);

#endif

Quoted 9 lines
board/samsung/common/misc.c +9 -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
Quoted 8 lines
Quoted 8 lines

board/samsung/common/misc.c line 142

Quoted 6 lines
board/samsung/common/misc.c +6 -0
+#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

Quoted 2 lines

ditto.

Yes, these will apply too.

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

board/samsung/common/misc.c line 148

Quoted 6 lines
board/samsung/common/misc.c +6 -0
+    if (mmc) {
+        if (!mmc->capacity)
+            mmc_init(mmc);
+
+        lcd_printf("\teMMC size: %llu MB\n", mmc->capacity / SZ_1M);
+    }

#endif

Quoted 12 lines
Quoted 8 lines
Quoted 8 lines

board/samsung/common/misc.c line 156

Quoted 8 lines
board/samsung/common/misc.c +8 -0
+
+    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,

Signature · 4 lines
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com
#106 lore raw

PATCH v4 10/12 Trats: add LCD download menu support

In reply to Przemyslaw Marczak

---
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(+)
include/configs/trats.h +22 -0
index 79f9168..2979df5 100644
@@ -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
Signature · 1 line
1.7.9.5
#107 lore raw

PATCH v4 11/12 trats2: add LCD download menu support

In reply to Przemyslaw Marczak

---
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(-)
include/configs/trats2.h +23 -0
index 740ceb1..59a2ad6 100644
@@ -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
include/power/pmic.h +0 -1
index 0e7aa31..8f282dd 100644
@@ -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>
Signature · 1 line
1.7.9.5
#108 lore raw

PATCH v4 12/12 universal: add LCD download menu support

In reply to Przemyslaw Marczak

---
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(+)
include/configs/s5pc210_universal.h +22 -0
index 4079b7c..ec8f991 100644
@@ -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
  */
Signature · 1 line
1.7.9.5
#109 lore raw

v4 cover Introduce Samsung misc file and LCD menu.

In reply to Przemyslaw Marczak

Hi Marczak,

Quoted 48 lines · On Thu, 09 Jan 2014 12:23:04 +0100 Przemyslaw Marczak <[email protected]>…

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
Quoted 10 lines

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

#110 lore raw

v4 cover Introduce Samsung misc file and LCD menu.

On Fri, 10 Jan 2014 15:45:52 +0900
Hyungwon Hwang <[email protected]> wrote:
Hi Marczak,

Quoted 69 lines

Hi Marczak,

Quoted 48 lines · On Thu, 09 Jan 2014 12:23:04 +0100 Przemyslaw Marczak <[email protected]>…

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
Quoted 10 lines

++++++++++++++++++++++++++++++
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.

Quoted 5 lines

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.

Quoted 11 lines

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

#111 lore raw

v4 cover Introduce Samsung misc file and LCD menu.

In reply to Hyungwon Hwang

Hello Hyungwon,

Quoted 75 lines · Hyungwon Hwang

Hi Marczak,

Quoted 48 lines · On Thu, 09 Jan 2014 12:23:04 +0100 Przemyslaw Marczak <[email protected]>…

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
Quoted 10 lines

++++++++++++++++++++++++++++++
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?

Quoted 7 lines

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

Signature · 4 lines
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com
#112 lore raw

v5 cover Introduce Samsung misc file and LCD menu.

In reply to Przemyslaw Marczak

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
Signature · 1 line
1.7.9.5
#113 lore raw

PATCH v5 1/12 s5p: gpio: change gpio coding method for s5p gpio.

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

---
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(-)
arch/arm/include/asm/arch-exynos/gpio.h +73 -172
index 2a19852..d6868fa 100644
@@ -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
 
arch/arm/include/asm/arch-s5pc1xx/gpio.h +36 -11

56 lines not on this page · raw message

board/samsung/trats2/trats2.c +4 -4
index be15357..1e96fdc 100644
@@ -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
 
drivers/gpio/s5p_gpio.c +9 -6
index 7eeb96d..11a0472 100644
@@ -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 */
include/configs/s5p_goni.h +2 -2
index 0590d20..4cdf937 100644
@@ -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 */
include/configs/s5pc210_universal.h +6 -6
index d9e4c56..02a1c99 100644
@@ -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
include/configs/trats.h +2 -2
index 0877142..9727f7a 100644
@@ -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
Signature · 1 line
1.7.9.5
#114 lore raw

PATCH v5 2/12 trats2: Code cleanup.

In reply to Przemyslaw Marczak

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

---
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(-)
board/samsung/trats2/trats2.c +2 -17
index 1e96fdc..b4ccf51 100644
@@ -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
drivers/power/battery/bat_trats2.c +1 -1
index f264832..94015aa 100644
@@ -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;
include/configs/trats2.h +0 -1
index c9ce828..7dfbe98 100644
@@ -272,7 +272,6 @@
 #define CONFIG_EFI_PARTITION
 #define CONFIG_PARTITION_UUIDS
 
-#define CONFIG_MISC_INIT_R
 #define CONFIG_BOARD_EARLY_INIT_F
 
 /* I2C */
include/power/max77686_pmic.h +2 -0
index 16e9016..c2a772a 100644
@@ -8,6 +8,8 @@
 #ifndef __MAX77686_H_
 #define __MAX77686_H_
 
+#include <power/pmic.h>
+
 enum {
 	MAX77686_REG_PMIC_ID		= 0x0,
 	MAX77686_REG_PMIC_INTSRC,
Signature · 1 line
1.7.9.5
#115 lore raw

PATCH v5 3/12 samsung: common: Add misc file and common function misc_init_r().

In reply to Przemyslaw Marczak

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

---
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
board/samsung/common/Makefile +1 -0
index 22bd6b1..79547a3 100644
@@ -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
board/samsung/common/misc.c new file +14 -0
new file mode 100644
index 0000000..3764d12
@@ -0,0 +1,14 @@
+/*
+ * Copyright (C) 2013 Samsung Electronics
+ * Przemyslaw Marczak <[email protected]>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+
+/* Common for Samsung boards */
+int misc_init_r(void)
+{
+	return 0;
+}
Signature · 1 line
1.7.9.5
#116 lore raw

PATCH v5 3/12 samsung: common: Add misc file and common function misc_init_r().

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

Quoted 29 lines · Przemyslaw Marczak

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

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

board/samsung/common/Makefile +0 -0
index 22bd6b1..79547a3 100644

board/samsung/common/Makefile line 11

Quoted 4 lines
board/samsung/common/Makefile +1 -0
@@ -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

Quoted 9 lines
board/samsung/common/Makefile +0 -0
  ifndef CONFIG_SPL_BUILD
  obj-$(CONFIG_BOARD_COMMON)	+= board.o
board/samsung/common/misc.c new file +0 -0
new file mode 100644
index 0000000..3764d12

board/samsung/common/misc.c line 9

Quoted 9 lines
board/samsung/common/misc.c new file +9 -0
@@ -0,0 +1,14 @@
+/*
+ * Copyright (C) 2013 Samsung Electronics
+ * Przemyslaw Marczak <[email protected]>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+

and here:
#ifdef CONFIG_MISC_INIT_R

board/samsung/common/misc.c line 14

Quoted 6 lines
board/samsung/common/misc.c new file +5 -0
+/* 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,

Signature · 4 lines
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com
#117 lore raw

PATCH v5 3/12 samsung: common: Add misc file and common function misc_init_r().

Quoted 70 lines · Przemyslaw Marczak

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

Quoted 29 lines · Przemyslaw Marczak

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

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

board/samsung/common/Makefile +0 -0
index 22bd6b1..79547a3 100644

board/samsung/common/Makefile line 11

Quoted 4 lines
board/samsung/common/Makefile +1 -0
@@ -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

Quoted 9 lines
board/samsung/common/Makefile +0 -0
  ifndef CONFIG_SPL_BUILD
  obj-$(CONFIG_BOARD_COMMON)    += board.o
board/samsung/common/misc.c new file +0 -0
new file mode 100644
index 0000000..3764d12

board/samsung/common/misc.c line 9

Quoted 9 lines
board/samsung/common/misc.c new file +9 -0
@@ -0,0 +1,14 @@
+/*
+ * Copyright (C) 2013 Samsung Electronics
+ * Przemyslaw Marczak <[email protected]>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#include <common.h>
+

and here:
#ifdef CONFIG_MISC_INIT_R

board/samsung/common/misc.c line 14

Quoted 6 lines
board/samsung/common/misc.c new file +5 -0
+/* Common for Samsung boards */
+int misc_init_r(void)
+{
+    return 0;
+}

#endif

Quoted 1 line

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.

Quoted 4 lines

Is it better solution?

Thank you,

Thanks,
Minkyu Kang.

#118 lore raw

PATCH v5 3/12 samsung: common: Add misc file and common function misc_init_r().

Hello,

Quoted 71 lines · Minkyu Kang
Quoted 70 lines · Przemyslaw Marczak

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

Quoted 29 lines · Przemyslaw Marczak

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

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

board/samsung/common/Makefile +0 -0
index 22bd6b1..79547a3 100644

board/samsung/common/Makefile line 11

Quoted 4 lines
board/samsung/common/Makefile +1 -0
@@ -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

Quoted 9 lines
board/samsung/common/Makefile +0 -0
   ifndef CONFIG_SPL_BUILD
   obj-$(CONFIG_BOARD_COMMON)    += board.o
board/samsung/common/misc.c new file +0 -0
new file mode 100644
index 0000000..3764d12

board/samsung/common/misc.c line 9

Quoted 9 lines
board/samsung/common/misc.c new file +9 -0
@@ -0,0 +1,14 @@
+/*
+ * Copyright (C) 2013 Samsung Electronics
+ * Przemyslaw Marczak <[email protected]>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#include <common.h>
+

and here:
#ifdef CONFIG_MISC_INIT_R

board/samsung/common/misc.c line 14

Quoted 6 lines
board/samsung/common/misc.c new file +5 -0
+/* Common for Samsung boards */
+int misc_init_r(void)
+{
+    return 0;
+}

#endif

Quoted 8 lines
Quoted 1 line

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

Quoted 8 lines
Quoted 4 lines

Is it better solution?

Thank you,

Thanks,
Minkyu Kang.

Thank you,

Signature · 4 lines
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com
#119 lore raw

PATCH v5 3/12 samsung: common: Add misc file and common function misc_init_r().

Dear Przemyslaw,

Quoted 95 lines

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

Quoted 3 lines · Minkyu Kang
Quoted 2 lines · Przemyslaw Marczak

Hello,
In case of discussion with Piotr Wilczek maybe it is better to make

some changes in this patch.

Quoted 68 lines
Quoted 68 lines · Przemyslaw Marczak
Quoted 29 lines

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

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

(quoted diff) +0 -0

b/board/samsung/common/Makefile index 22bd6b1..79547a3 100644

board/samsung/common/Makefile line 11

Quoted 4 lines
board/samsung/common/Makefile +1 -0
@@ -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

Quoted 9 lines
board/samsung/common/Makefile +0 -0
   ifndef CONFIG_SPL_BUILD
   obj-$(CONFIG_BOARD_COMMON)    += board.o
(quoted diff) +0 -0

b/board/samsung/common/misc.c new file mode 100644 index 0000000..3764d12

board/samsung/common/misc.c line 9

Quoted 9 lines
board/samsung/common/misc.c new file +9 -0
@@ -0,0 +1,14 @@
+/*
+ * Copyright (C) 2013 Samsung Electronics
+ * Przemyslaw Marczak <[email protected]>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#include <common.h>
+

and here:
#ifdef CONFIG_MISC_INIT_R

board/samsung/common/misc.c line 14

Quoted 6 lines
board/samsung/common/misc.c new file +5 -0
+/* Common for Samsung boards */
+int misc_init_r(void)
+{
+    return 0;
+}

#endif

Quoted 1 line
Quoted 1 line

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

CONFIG_MISC_INIT_R.

Quoted 7 lines

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.

Quoted 5 lines

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.

Quoted 10 lines
Quoted 9 lines
Quoted 5 lines

Is it better solution?

Thank you,

Thanks,
Minkyu Kang.

Quoted 6 lines

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

Best regards,
Piotr Wilczek