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

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

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

In reply to Piotr Wilczek

Hello Piotr,

Quoted 102 lines · Piotr Wilczek

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

Quoted 5 lines

Przemyslaw, I asked you question: what is the misc.c file for? If for misc_init_r only then I think the file name "misc.c" is confusing. If also other common functions can be put there, then the define MISC_INIT_R to compile this file is wrong.

Yes, and next I said that maybe I will change this config dependency, and now I try to do it.

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

Quoted 6 lines

Best regards,
Piotr Wilczek

Thank you,

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

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

Quoted 105 lines · Przemyslaw Marczak

Hello Piotr,

Quoted 102 lines · Piotr Wilczek

Dear Przemyslaw,

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

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

Przemyslaw, I asked you question: what is the misc.c file for? If for misc_init_r only then I think the file name "misc.c" is confusing. If also other common functions can be put there, then the define MISC_INIT_R to compile this file is wrong.

Yes, and next I said that maybe I will change this config dependency, and now I try to do it.

Actually, I feel negative to this changes.
Because misc_init_r is a board specific.
How you can support if someone want to do something (board specific things) on misc_init_r?
I totally understand why you add misc_init_r to common directory. - It means you don't have to explain why you added it :) but it looks little weird.
So we will discuss that misc_init_r should go to each boards or stay here? (misc_init_r function only, not including key, menu, logo.. etc)

Please let me know your opinions.

Thanks,
Minkyu Kang.

#122 lore raw

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

Quoted 122 lines · Minkyu Kang
Quoted 105 lines · Przemyslaw Marczak

Hello Piotr,

Quoted 102 lines · Piotr Wilczek

Dear Przemyslaw,

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

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

Przemyslaw, I asked you question: what is the misc.c file for? If for misc_init_r only then I think the file name "misc.c" is confusing. If also other common functions can be put there, then the define MISC_INIT_R to compile this file is wrong.

Yes, and next I said that maybe I will change this config dependency, and now I try to do it.

Actually, I feel negative to this changes.
Because misc_init_r is a board specific.
How you can support if someone want to do something (board specific things) on misc_init_r?
I totally understand why you add misc_init_r to common directory. - It means you don't have to explain why you added it :) but it looks little weird.
So we will discuss that misc_init_r should go to each boards or stay here? (misc_init_r function only, not including key, menu, logo.. etc)

Quoted 6 lines

Please let me know your opinions.

Thanks,
Minkyu Kang.

The reason why I used misc_init_r for a common purposes is that it is called after all hardware initialization and before u-boot main_loop(), then I don't need to introduce another generic function just to check buttons - this is the only reason.

Moreover at this time misc_init_r() is implemented only in Trats2, and there are easy to move things.

You're right - misc_init_r is board specific, but if we make it as a common function, then we also can add board specific code, called here but implemented in board files.

If this is wrong, then where is the better place for check keys, display logo and any more vendor common things?

Or maybe the better solution is just add new function callback to board_init_r() for some vendor specific purposes - and then it can be used for other vendors platforms too.

Thank you,

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

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

Quoted 41 lines · Przemyslaw Marczak
Quoted 33 lines · Minkyu Kang
Quoted 16 lines · Przemyslaw Marczak
Quoted 16 lines
Quoted 16 lines
Quoted 2 lines
Quoted 2 lines

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.

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

Przemyslaw, I asked you question: what is the misc.c file for? If for misc_init_r only then I think the file name "misc.c" is confusing. If also other common functions can be put there, then the define MISC_INIT_R to compile this file is wrong.

Yes, and next I said that maybe I will change this config dependency, and now I try to do it.

Actually, I feel negative to this changes.
Because misc_init_r is a board specific.
How you can support if someone want to do something (board specific things) on misc_init_r?
I totally understand why you add misc_init_r to common directory. - It means you don't have to explain why you added it :) but it looks little weird.
So we will discuss that misc_init_r should go to each boards or stay here? (misc_init_r function only, not including key, menu, logo.. etc)

Quoted 6 lines

Please let me know your opinions.

Thanks,
Minkyu Kang.

Quoted 5 lines

The reason why I used misc_init_r for a common purposes is that it is called after all hardware initialization and before u-boot main_loop(), then I don't need to introduce another generic function just to check buttons - this is the only reason.

Moreover at this time misc_init_r() is implemented only in Trats2, and there are easy to move things.

You're right - misc_init_r is board specific, but if we make it as a common function, then we also can add board specific code, called here but implemented in board files.

No. it looks wrong architecture.

Quoted 2 lines

If this is wrong, then where is the better place for check keys, display logo and any more vendor common things?

Stay at common directory.

Quoted 2 lines

Or maybe the better solution is just add new function callback to board_init_r() for some vendor specific purposes - and then it can be used for other vendors platforms too.

No.

Here, I've made pseudo code for it.
How you think?

board/samsung/common/misc.c new file +18 -0
new file mode 100644
index 0000000..cdc48bb
@@ -0,0 +1,18 @@
+#ifdef CONFIG_LCD_MENU
+void keys_init(void)
+{
+       /* TODO */
+}
+
+void check_boot_mode(void)
+{
+       /* TODO */
+}
+#endif
+
+#ifdef CONFIG_CMD_BMP
+void draw_logo(void)
+{
+       /* TODO */
+}
+#endif
board/samsung/trats2/trats2.c +10 -0
index be15357..eb4f4dc 100644
@@ -623,6 +623,16 @@ int misc_init_r(void)
 
        show_hw_revision();
 
+#ifdef CONFIG_LCD_MENU
+       keys_init();
+       check_boot_mode();
+#endif
+
+#ifdef CONFIG_CMD_BMP
+       if (panel_info.logo_on)
+               draw_logo();
+#endif
+
        return 0;
 }
 #endif

Thanks,
Minkyu Kang.

#124 lore raw

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

Changes v5:
- none

 board/samsung/common/misc.c              |   42 ++++++++++++++++++++++++++++++
 board/samsung/trats/trats.c              |    3 ---
 board/samsung/trats2/trats2.c            |    4 ---
 board/samsung/universal_c210/universal.c |    4 ---
 drivers/video/exynos_fb.c                |   28 --------------------
 include/configs/s5pc210_universal.h      |    3 +++
 include/configs/trats.h                  |    3 +++
 include/configs/trats2.h                 |    3 +++
 8 files changed, 51 insertions(+), 39 deletions(-)
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
#125 lore raw

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

Dear Przemyslaw,

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

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

Changes v3:
- none

Changes v4:
- none

Changes v5:
- none

 board/samsung/common/misc.c              |   42 ++++++++++++++++++++++++++++++
 board/samsung/trats/trats.c              |    3 ---
 board/samsung/trats2/trats2.c            |    4 ---
 board/samsung/universal_c210/universal.c |    4 ---
 drivers/video/exynos_fb.c                |   28 --------------------
 include/configs/s5pc210_universal.h      |    3 +++
 include/configs/trats.h                  |    3 +++
 include/configs/trats2.h                 |    3 +++
 8 files changed, 51 insertions(+), 39 deletions(-)
board/samsung/common/misc.c +3 -0
index 3764d12..6188e29 100644
@@ -6,9 +6,51 @@
  */
 
 #include <common.h>
+#include <lcd.h>
+#include <libtizen.h>
+

board/samsung/common/misc.c line 21

Quoted 10 lines
board/samsung/common/misc.c +10 -0
+#ifdef CONFIG_CMD_BMP
+static void draw_logo(void)
+{
+	int x, y;
+	ulong addr;
+
+#ifdef CONFIG_TIZEN
+	get_tizen_logo_info(&panel_info);
+#else
+	return;

if CONFIG_TINZE didn't set, draw_logo should be just return, right? Then I think this point could be changed more readable.

#ifdef CONFIG_TIZEN
	int x, y;
	ulong addr;

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

#endif

how about?

Best Regards,
Jaehoon Chung

Quoted 168 lines
board/samsung/common/misc.c +29 -0
+#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
#126 lore raw

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

Hello Jaehoon,

Quoted 70 lines · Jaehoon Chung

Dear Przemyslaw,

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

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

Changes v3:
- none

Changes v4:
- none

Changes v5:
- none

  board/samsung/common/misc.c              |   42 ++++++++++++++++++++++++++++++
  board/samsung/trats/trats.c              |    3 ---
  board/samsung/trats2/trats2.c            |    4 ---
  board/samsung/universal_c210/universal.c |    4 ---
  drivers/video/exynos_fb.c                |   28 --------------------
  include/configs/s5pc210_universal.h      |    3 +++
  include/configs/trats.h                  |    3 +++
  include/configs/trats2.h                 |    3 +++
  8 files changed, 51 insertions(+), 39 deletions(-)
board/samsung/common/misc.c +3 -0
index 3764d12..6188e29 100644
@@ -6,9 +6,51 @@
   */
 
  #include <common.h>
+#include <lcd.h>
+#include <libtizen.h>
+

board/samsung/common/misc.c line 21

Quoted 10 lines
board/samsung/common/misc.c +10 -0
+#ifdef CONFIG_CMD_BMP
+static void draw_logo(void)
+{
+	int x, y;
+	ulong addr;
+
+#ifdef CONFIG_TIZEN
+	get_tizen_logo_info(&panel_info);
+#else
+	return;

if CONFIG_TINZE didn't set, draw_logo should be just return, right? Then I think this point could be changed more readable.

#ifdef CONFIG_TIZEN
	int x, y;
	ulong addr;

	get_tizen_logo_info(...);
	
	add = panel_info.logo_addr;
	...
	bmp_display(addr, x, y);
Quoted 8 lines

#endif

how about?

Best Regards,
Jaehoon Chung

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

Thank you,

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

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

Dear Przemyslaw Marczak,

Quoted 75 lines · Przemyslaw Marczak

Hello Jaehoon,

Quoted 72 lines · Jaehoon Chung

Dear Przemyslaw,

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

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

Changes v3:
- none

Changes v4:
- none

Changes v5:
- none

  board/samsung/common/misc.c              |   42 ++++++++++++++++++++++++++++++
  board/samsung/trats/trats.c              |    3 ---
  board/samsung/trats2/trats2.c            |    4 ---
  board/samsung/universal_c210/universal.c |    4 ---
  drivers/video/exynos_fb.c                |   28 --------------------
  include/configs/s5pc210_universal.h      |    3 +++
  include/configs/trats.h                  |    3 +++
  include/configs/trats2.h                 |    3 +++
  8 files changed, 51 insertions(+), 39 deletions(-)
board/samsung/common/misc.c +3 -0
index 3764d12..6188e29 100644
@@ -6,9 +6,51 @@
   */
 
  #include <common.h>
+#include <lcd.h>
+#include <libtizen.h>
+

board/samsung/common/misc.c line 21

Quoted 10 lines
board/samsung/common/misc.c +10 -0
+#ifdef CONFIG_CMD_BMP
+static void draw_logo(void)
+{
+    int x, y;
+    ulong addr;
+
+#ifdef CONFIG_TIZEN
+    get_tizen_logo_info(&panel_info);
+#else
+    return;

if CONFIG_TINZE didn't set, draw_logo should be just return, right? Then I think this point could be changed more readable.

#ifdef CONFIG_TIZEN
    int x, y;
    ulong addr;

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

#endif

Quoted 8 lines
Quoted 6 lines

how about?

Best Regards,
Jaehoon Chung

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

I agreed with you.

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

@@ -484,10 +484,6 @@ void init_panel_info(vidinfo_t *vid)
vid->resolution = HD_RESOLUTION;
vid->rgb_mode = MODE_RGB_P;

-#ifdef CONFIG_TIZEN
- get_tizen_logo_info(vid);
-#endif
-
/* for LD9040. */
vid->pclk_name = 1; /* MPLL */
vid->sclk_div = 1;

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

Thanks,
Minkyu Kang.

#128 lore raw

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

Hi Minkyu,

Quoted 104 lines · Minkyu Kang

Dear Przemyslaw Marczak,

Quoted 75 lines · Przemyslaw Marczak

Hello Jaehoon,

Quoted 72 lines · Jaehoon Chung

Dear Przemyslaw,

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

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

Changes v3:
- none

Changes v4:
- none

Changes v5:
- none

   board/samsung/common/misc.c              |   42 ++++++++++++++++++++++++++++++
   board/samsung/trats/trats.c              |    3 ---
   board/samsung/trats2/trats2.c            |    4 ---
   board/samsung/universal_c210/universal.c |    4 ---
   drivers/video/exynos_fb.c                |   28 --------------------
   include/configs/s5pc210_universal.h      |    3 +++
   include/configs/trats.h                  |    3 +++
   include/configs/trats2.h                 |    3 +++
   8 files changed, 51 insertions(+), 39 deletions(-)
board/samsung/common/misc.c +3 -0
index 3764d12..6188e29 100644
@@ -6,9 +6,51 @@
    */
 
   #include <common.h>
+#include <lcd.h>
+#include <libtizen.h>
+

board/samsung/common/misc.c line 21

Quoted 10 lines
board/samsung/common/misc.c +10 -0
+#ifdef CONFIG_CMD_BMP
+static void draw_logo(void)
+{
+    int x, y;
+    ulong addr;
+
+#ifdef CONFIG_TIZEN
+    get_tizen_logo_info(&panel_info);
+#else
+    return;

if CONFIG_TINZE didn't set, draw_logo should be just return, right? Then I think this point could be changed more readable.

#ifdef CONFIG_TIZEN
     int x, y;
     ulong addr;

     get_tizen_logo_info(...);

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

#endif

Quoted 8 lines
Quoted 6 lines

how about?

Best Regards,
Jaehoon Chung

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

I agreed with you.

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

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

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

Thanks,
Minkyu Kang.

Actually I had something else on my mind but this is more simply, so I will change this back.

Thank you,

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

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

Changes v5:
- none

 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
#131 lore raw

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

Changes v5:
- 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
#132 lore raw

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

Changes v5:
- none

 board/samsung/trats/trats.c              |    2 +-
 board/samsung/trats2/trats2.c            |    2 +-
 board/samsung/universal_c210/universal.c |    2 +-
 include/configs/s5pc210_universal.h      |    2 +-
 include/configs/trats.h                  |    2 +-
 include/configs/trats2.h                 |    2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)
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
#133 lore raw

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

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

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

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

Changes v5:
- 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
#135 lore raw

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

Changes v5:
- none

 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
#136 lore raw

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

Changes v5:
- 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
#137 lore raw

v6 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 (11):
s5p: gpio: change gpio coding method for s5p gpio.
trats2: Code cleanup.
samsung: common: Add file for common functions, draw_logo() cleanup.
common: lcd.c: fix data abort exception when try to access bmp header
lib: tizen: change Tizen logo with the new one.
video: exynos: fimd: add support for various display color modes
samsung: boards: update display configs with 16bpp mode.
samsung: misc: Add LCD download menu.
trats: add LCD download menu support
trats2: add LCD download menu support
universal: add LCD download menu support

 arch/arm/include/asm/arch-exynos/gpio.h  |  245 +-
 arch/arm/include/asm/arch-s5pc1xx/gpio.h |   47 +-
 board/samsung/common/Makefile            |    1 +
 board/samsung/common/misc.c              |  387 ++
 board/samsung/trats/trats.c              |   18 +-
 board/samsung/trats2/trats2.c            |   31 +-
 board/samsung/universal_c210/universal.c |   18 +-
 common/lcd.c                             |   27 +-
 drivers/gpio/s5p_gpio.c                  |   15 +-
 drivers/power/battery/bat_trats2.c       |    2 +-
 drivers/video/exynos_fb.c                |   28 -
 drivers/video/exynos_fimd.c              |   15 +-
 include/configs/s5p_goni.h               |    4 +-
 include/configs/s5pc210_universal.h      |   43 +-
 include/configs/trats.h                  |   35 +-
 include/configs/trats2.h                 |   32 +-
 include/lcd.h                            |    2 +
 include/power/max77686_pmic.h            |    2 +
 include/power/pmic.h                     |    1 -
 include/samsung/misc.h                   |   25 +
 lib/tizen/tizen.c                        |   21 +-
 lib/tizen/tizen_hd_logo.h                | 5057 ---------------
 lib/tizen/tizen_hd_logo_data.h           |   15 -
 lib/tizen/tizen_logo_16bpp.h             |10025 ++++++++++++++++++++++++++++++
 lib/tizen/tizen_logo_16bpp_gzip.h        |  727 +++
 25 files changed, 11470 insertions(+), 5353 deletions(-)
 create mode 100644 board/samsung/common/misc.c
 create mode 100644 include/samsung/misc.h
 delete mode 100644 lib/tizen/tizen_hd_logo.h
 delete mode 100644 lib/tizen/tizen_hd_logo_data.h
 create mode 100644 lib/tizen/tizen_logo_16bpp.h
 create mode 100644 lib/tizen/tizen_logo_16bpp_gzip.h
Signature · 1 line
1.7.9.5
#138 lore raw

PATCH v6 1/11 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

Changes v6:
- none

 arch/arm/include/asm/arch-exynos/gpio.h  |  245 +++++++++---------------------
 arch/arm/include/asm/arch-s5pc1xx/gpio.h |   47 ++++--
 board/samsung/trats2/trats2.c            |    8 +-
 drivers/gpio/s5p_gpio.c                  |   15 +-
 include/configs/s5p_goni.h               |    4 +-
 include/configs/s5pc210_universal.h      |   12 +-
 include/configs/trats.h                  |    4 +-
 7 files changed, 132 insertions(+), 203 deletions(-)
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 6cd15c2..6480424 100644
@@ -283,8 +283,8 @@
 #include <asm/arch/gpio.h>
 
 /* I2C FG */
-#define CONFIG_SOFT_I2C_GPIO_SCL exynos4_gpio_part2_get_nr(y4, 1)
-#define CONFIG_SOFT_I2C_GPIO_SDA exynos4_gpio_part2_get_nr(y4, 0)
+#define CONFIG_SOFT_I2C_GPIO_SCL exynos4_gpio_get(2, y4, 1)
+#define CONFIG_SOFT_I2C_GPIO_SDA exynos4_gpio_get(2, y4, 0)
 
 #define CONFIG_POWER
 #define CONFIG_POWER_I2C
Signature · 1 line
1.7.9.5
#139 lore raw

PATCH v6 2/11 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

Changes v6:
- misc_init_r() - leave in trats2.c

 board/samsung/trats2/trats2.c      |   12 ++----------
 drivers/power/battery/bat_trats2.c |    2 +-
 include/power/max77686_pmic.h      |    2 ++
 3 files changed, 5 insertions(+), 11 deletions(-)
board/samsung/trats2/trats2.c +2 -10
index 1e96fdc..feb6c4c 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;
@@ -618,11 +615,6 @@ void init_panel_info(vidinfo_t *vid)
 #ifdef CONFIG_MISC_INIT_R
 int misc_init_r(void)
 {
-	setenv("model", "GT-I8800");
-	setenv("board", "TRATS2");
-
-	show_hw_revision();
-
 	return 0;
 }
 #endif
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/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
#140 lore raw

PATCH v6 3/11 samsung: common: Add file for common functions, draw_logo() cleanup.

In reply to Przemyslaw Marczak

Changes:

new file:
- board/samsung/common/misc.c
depends on: CONFIG_MISC_COMMON
- move draw_logo() to misc.c

configs: trats, trats2, universal:
- enable CONFIG_MISC_COMMON,
- enable CONFIG_MISC_INIT_R,
- add misc_init_r() and call draw_logo() in it.

---
Changes v2:
- change CONFIG_SAMSUNG to CONFIG_MISC_INIT_R

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

Changes v4:
- none

Changes v5:
- add acked-by

Changes v6:
- move board/samsung/common/misc.h to include/samsung/misc.h
- squash with v5 commit: "samsung: misc: move display logo function to misc.c file."
- change config name to CONFIG_MISC_COMMON in board/samsung/common/Makefile
- trats, trats2, universal - call draw logo() in misc_init_r()

 board/samsung/common/Makefile            |    1 +
 board/samsung/common/misc.c              |   41 ++++++++++++++++++++++++++++++
 board/samsung/trats/trats.c              |   11 ++++++++
 board/samsung/trats2/trats2.c            |    4 +++
 board/samsung/universal_c210/universal.c |   11 ++++++++
 drivers/video/exynos_fb.c                |   28 --------------------
 include/configs/s5pc210_universal.h      |    5 ++++
 include/configs/trats.h                  |    5 ++++
 include/configs/trats2.h                 |    6 ++++-
 include/samsung/misc.h                   |    8 ++++++
 10 files changed, 91 insertions(+), 29 deletions(-)
 create mode 100644 board/samsung/common/misc.c
 create mode 100644 include/samsung/misc.h
board/samsung/common/Makefile +1 -0
index 22bd6b1..7d2bb8c 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_COMMON) += misc.o
 
 ifndef CONFIG_SPL_BUILD
 obj-$(CONFIG_BOARD_COMMON)	+= board.o
board/samsung/common/misc.c new file +41 -0

41 lines not on this page · raw message

board/samsung/trats/trats.c +11 -0
index 640a193..a644b60 100644
@@ -786,3 +786,14 @@ void init_panel_info(vidinfo_t *vid)
 
 	setenv("lcdinfo", "lcd=s6e8ax0");
 }
+
+#ifdef CONFIG_MISC_INIT_R
+int misc_init_r(void)
+{
+#ifdef CONFIG_CMD_BMP
+	if (panel_info.logo_on)
+		draw_logo();
+#endif
+	return 0;
+}
+#endif
board/samsung/trats2/trats2.c +4 -0
index feb6c4c..4834f90 100644
@@ -615,6 +615,10 @@ void init_panel_info(vidinfo_t *vid)
 #ifdef CONFIG_MISC_INIT_R
 int misc_init_r(void)
 {
+#ifdef CONFIG_CMD_BMP
+	if (panel_info.logo_on)
+		draw_logo();
+#endif
 	return 0;
 }
 #endif
board/samsung/universal_c210/universal.c +11 -0
index 54d0e1e..1c8b8b8 100644
@@ -511,3 +511,14 @@ int board_init(void)
 
 	return 0;
 }
+
+#ifdef CONFIG_MISC_INIT_R
+int misc_init_r(void)
+{
+#ifdef CONFIG_CMD_BMP
+	if (panel_info.logo_on)
+		draw_logo();
+#endif
+	return 0;
+}
+#endif
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 +5 -0
index 02a1c99..6b98bed 100644
@@ -269,6 +269,11 @@ void universal_spi_sda(int bit);
 int universal_spi_read(void);
 #endif
 
+/* Common misc for Samsung */
+#define CONFIG_MISC_COMMON
+
+#define CONFIG_MISC_INIT_R
+
 /*
  * LCD Settings
  */
include/configs/trats.h +5 -0
index 6480424..0b93e03 100644
@@ -302,6 +302,11 @@
 #define CONFIG_USB_GADGET_VBUS_DRAW	2
 #define CONFIG_USB_CABLE_CHECK
 
+/* Common misc for Samsung */
+#define CONFIG_MISC_COMMON
+
+#define CONFIG_MISC_INIT_R
+
 /* LCD */
 #define CONFIG_EXYNOS_FB
 #define CONFIG_LCD
include/configs/trats2.h +5 -1
index c9ce828..8ba8a0f 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 */
@@ -313,6 +312,11 @@ int get_soft_i2c_sda_pin(void);
 #define CONFIG_USB_GADGET_VBUS_DRAW	2
 #define CONFIG_USB_CABLE_CHECK
 
+/* Common misc for Samsung */
+#define CONFIG_MISC_COMMON
+
+#define CONFIG_MISC_INIT_R
+
 /* LCD */
 #define CONFIG_EXYNOS_FB
 #define CONFIG_LCD
include/samsung/misc.h new file +8 -0
new file mode 100644
index 0000000..8ea9223
@@ -0,0 +1,8 @@
+#ifndef __SAMSUNG_MISC_COMMON_H__
+#define __SAMSUNG_MISC_COMMON_H__
+
+#ifdef CONFIG_CMD_BMP
+void draw_logo(void);
+#endif
+
+#endif /* __SAMSUNG_MISC_COMMON_H__ */
Signature · 1 line
1.7.9.5
#141 lore raw

PATCH v6 4/11 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

Changes v5:
- none

Changes v6:
- none

 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
#143 lore raw

PATCH v6 6/11 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

Changes v5:
- none

Changes v6:
- 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
#144 lore raw

PATCH v6 7/11 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

Changes v5:
- none

Changes v6:
- none

 board/samsung/trats/trats.c              |    2 +-
 board/samsung/trats2/trats2.c            |    2 +-
 board/samsung/universal_c210/universal.c |    2 +-
 include/configs/s5pc210_universal.h      |    2 +-
 include/configs/trats.h                  |    2 +-
 include/configs/trats2.h                 |    2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)
board/samsung/trats/trats.c +1 -1
index a644b60..32a6cee 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 4834f90..b60a2da 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 1c8b8b8..e300da3 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 67b08fc..93b9dfb 100644
@@ -280,7 +280,7 @@ int universal_spi_read(void);
 #define CONFIG_EXYNOS_FB
 #define CONFIG_LCD
 #define CONFIG_CMD_BMP
-#define CONFIG_BMP_32BPP
+#define CONFIG_BMP_16BPP
 #define CONFIG_LD9040
 #define CONFIG_EXYNOS_MIPI_DSIM
 #define CONFIG_VIDEO_BMP_GZIP
include/configs/trats.h +1 -1
index b1bdeaa..f5e796a 100644
@@ -311,7 +311,7 @@
 #define CONFIG_EXYNOS_FB
 #define CONFIG_LCD
 #define CONFIG_CMD_BMP
-#define CONFIG_BMP_32BPP
+#define CONFIG_BMP_16BPP
 #define CONFIG_FB_ADDR		0x52504000
 #define CONFIG_S6E8AX0
 #define CONFIG_EXYNOS_MIPI_DSIM
include/configs/trats2.h +1 -1
index 528e9a3..a856b56 100644
@@ -321,7 +321,7 @@ int get_soft_i2c_sda_pin(void);
 #define CONFIG_EXYNOS_FB
 #define CONFIG_LCD
 #define CONFIG_CMD_BMP
-#define CONFIG_BMP_32BPP
+#define CONFIG_BMP_16BPP
 #define CONFIG_FB_ADDR		0x52504000
 #define CONFIG_S6E8AX0
 #define CONFIG_EXYNOS_MIPI_DSIM
Signature · 1 line
1.7.9.5
#145 lore raw

PATCH v6 8/11 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

For proper effect this feature needs following definitions:

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

Register address:
- KEY_PWR_STATUS_REG
- KEY_PWR_INTERRUPT_REG

Register power key mask:
- KEY_PWR_STATUS_MASK
- KEY_PWR_INTERRUPT_MASK

Gpio numbers:
- KEY_PWR_INTERRUPT_MASK
- KEY_VOL_DOWN_GPIO

Functions needs to be called:
- keys_init() - for set proper gpio direction
- check_boot_mode() - menu - main function

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

Changes v3:
- none

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

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

Changes v6:
- none

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

PATCH v6 9/11 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

Changes v5:
- none

Changes v6:
- trats.c : call boot menu from board file.

 board/samsung/trats/trats.c |    5 +++++
 include/configs/trats.h     |   22 ++++++++++++++++++++++
 2 files changed, 27 insertions(+)
board/samsung/trats/trats.c +5 -0
index 32a6cee..c6664e7 100644
@@ -28,6 +28,7 @@
 #include <power/max17042_fg.h>
 #include <usb.h>
 #include <usb_mass_storage.h>
+#include <samsung/misc.h>
 
 #include "setup.h"
 
@@ -790,6 +791,10 @@ void init_panel_info(vidinfo_t *vid)
 #ifdef CONFIG_MISC_INIT_R
 int misc_init_r(void)
 {
+#ifdef CONFIG_LCD_MENU
+	keys_init();
+	check_boot_mode();
+#endif
 #ifdef CONFIG_CMD_BMP
 	if (panel_info.logo_on)
 		draw_logo();
include/configs/trats.h +22 -0
index f5e796a..1de971c 100644
@@ -307,6 +307,28 @@
 
 #define CONFIG_MISC_INIT_R
 
+/* Download menu - Samsung common */
+#define CONFIG_LCD_MENU
+#define CONFIG_LCD_MENU_BOARD
+
+/* Download menu - definitions for check keys */
+#ifndef __ASSEMBLY__
+#include <power/max8997_pmic.h>
+
+#define KEY_PWR_PMIC_NAME		"MAX8997_PMIC"
+#define KEY_PWR_STATUS_REG		MAX8997_REG_STATUS1
+#define KEY_PWR_STATUS_MASK		(1 << 0)
+#define KEY_PWR_INTERRUPT_REG		MAX8997_REG_INT1
+#define KEY_PWR_INTERRUPT_MASK		(1 << 0)
+
+#define KEY_VOL_UP_GPIO			exynos4_gpio_get(2, x2, 0)
+#define KEY_VOL_DOWN_GPIO		exynos4_gpio_get(2, x2, 1)
+#endif /* __ASSEMBLY__ */
+
+/* LCD console */
+#define LCD_BPP			LCD_COLOR16
+#define CONFIG_SYS_WHITE_ON_BLACK
+
 /* LCD */
 #define CONFIG_EXYNOS_FB
 #define CONFIG_LCD
Signature · 1 line
1.7.9.5
#147 lore raw

PATCH v6 10/11 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

Changes v5:
- none

Changes v6:
- trats2.c : call boot menu from board file
- trats.h: remove definition CONFIG_TRATS2

 board/samsung/trats2/trats2.c |    5 +++++
 include/configs/trats2.h      |   22 ++++++++++++++++++++++
 include/power/pmic.h          |    1 -
 3 files changed, 27 insertions(+), 1 deletion(-)
board/samsung/trats2/trats2.c +5 -0
index b60a2da..62e7fd2 100644
@@ -28,6 +28,7 @@
 #include <usb.h>
 #include <usb/s3c_udc.h>
 #include <usb_mass_storage.h>
+#include <samsung/misc.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -615,6 +616,10 @@ void init_panel_info(vidinfo_t *vid)
 #ifdef CONFIG_MISC_INIT_R
 int misc_init_r(void)
 {
+#ifdef CONFIG_LCD_MENU
+	keys_init();
+	check_boot_mode();
+#endif
 #ifdef CONFIG_CMD_BMP
 	if (panel_info.logo_on)
 		draw_logo();
include/configs/trats2.h +22 -0
index a856b56..c48e3f5 100644
@@ -317,6 +317,28 @@ int get_soft_i2c_sda_pin(void);
 
 #define CONFIG_MISC_INIT_R
 
+/* Download menu - Samsung common */
+#define CONFIG_LCD_MENU
+#define CONFIG_LCD_MENU_BOARD
+
+/* Download menu - definitions for check keys */
+#ifndef __ASSEMBLY__
+#include <power/max77686_pmic.h>
+
+#define KEY_PWR_PMIC_NAME		"MAX77686_PMIC"
+#define KEY_PWR_STATUS_REG		MAX77686_REG_PMIC_STATUS1
+#define KEY_PWR_STATUS_MASK		(1 << 0)
+#define KEY_PWR_INTERRUPT_REG		MAX77686_REG_PMIC_INT1
+#define KEY_PWR_INTERRUPT_MASK		(1 << 1)
+
+#define KEY_VOL_UP_GPIO			exynos4x12_gpio_get(2, x2, 2)
+#define KEY_VOL_DOWN_GPIO		exynos4x12_gpio_get(2, x3, 3)
+#endif /* __ASSEMBLY__ */
+
+/* LCD console */
+#define LCD_BPP                 LCD_COLOR16
+#define CONFIG_SYS_WHITE_ON_BLACK
+
 /* LCD */
 #define CONFIG_EXYNOS_FB
 #define CONFIG_LCD
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
#148 lore raw

PATCH v6 11/11 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

Changes v5:
- none

Changes v6:
- universal.c : call boot menu from board file.

 board/samsung/universal_c210/universal.c |    5 +++++
 include/configs/s5pc210_universal.h      |   22 ++++++++++++++++++++++
 2 files changed, 27 insertions(+)
board/samsung/universal_c210/universal.c +5 -0
index e300da3..98b387f 100644
@@ -22,6 +22,7 @@
 #include <usb/s3c_udc.h>
 #include <asm/arch/cpu.h>
 #include <power/max8998_pmic.h>
+#include <samsung/misc.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -515,6 +516,10 @@ int board_init(void)
 #ifdef CONFIG_MISC_INIT_R
 int misc_init_r(void)
 {
+#ifdef CONFIG_LCD_MENU
+	keys_init();
+	check_boot_mode();
+#endif
 #ifdef CONFIG_CMD_BMP
 	if (panel_info.logo_on)
 		draw_logo();
include/configs/s5pc210_universal.h +22 -0
index 93b9dfb..bfb044b 100644
@@ -274,6 +274,28 @@ int universal_spi_read(void);
 
 #define CONFIG_MISC_INIT_R
 
+/* Download menu - Samsung common */
+#define CONFIG_LCD_MENU
+#define CONFIG_LCD_MENU_BOARD
+
+/* Download menu - definitions for check keys */
+#ifndef __ASSEMBLY__
+#include <power/max8998_pmic.h>
+
+#define KEY_PWR_PMIC_NAME		"MAX8998_PMIC"
+#define KEY_PWR_STATUS_REG		MAX8998_REG_STATUS1
+#define KEY_PWR_STATUS_MASK		(1 << 7)
+#define KEY_PWR_INTERRUPT_REG		MAX8998_REG_IRQ1
+#define KEY_PWR_INTERRUPT_MASK		(1 << 7)
+
+#define KEY_VOL_UP_GPIO			exynos4_gpio_get(2, x2, 0)
+#define KEY_VOL_DOWN_GPIO		exynos4_gpio_get(2, x2, 1)
+#endif /* __ASSEMBLY__ */
+
+/* LCD console */
+#define LCD_BPP			LCD_COLOR16
+#define CONFIG_SYS_WHITE_ON_BLACK
+
 /*
  * LCD Settings
  */
Signature · 1 line
1.7.9.5
#149 lore raw

v6 cover Introduce Samsung misc file and LCD menu.

In reply to Przemyslaw Marczak
Quoted 47 lines · 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 (11):
s5p: gpio: change gpio coding method for s5p gpio.
trats2: Code cleanup.
samsung: common: Add file for common functions, draw_logo() cleanup.
common: lcd.c: fix data abort exception when try to access bmp header
lib: tizen: change Tizen logo with the new one.
video: exynos: fimd: add support for various display color modes
samsung: boards: update display configs with 16bpp mode.
samsung: misc: Add LCD download menu.
trats: add LCD download menu support
trats2: add LCD download menu support
universal: add LCD download menu support

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

applied to u-boot-samsung.

Thanks,
Minkyu Kang.