All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 0/4] omap and sniper reboot mode fixes and cleanups
@ 2016-02-27 18:26 Paul Kocialkowski
  2016-02-27 18:26 ` [U-Boot] [PATCH 1/4] omap3: String-based reboot mode handling Paul Kocialkowski
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Paul Kocialkowski @ 2016-02-27 18:26 UTC (permalink / raw)
  To: u-boot

This series unifies the reboot mode interface between omap3 and omap4. It also
fixes the reboot to bootloader feature in fastboot.

It is to be applied on top of the previous series: Amazon Kindle Fire (first
generation) codename kc1 support series.

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

* [U-Boot] [PATCH 1/4] omap3: String-based reboot mode handling
  2016-02-27 18:26 [U-Boot] [PATCH 0/4] omap and sniper reboot mode fixes and cleanups Paul Kocialkowski
@ 2016-02-27 18:26 ` Paul Kocialkowski
  2016-03-15 11:52   ` Tom Rini
  2016-03-17  1:57   ` [U-Boot] [U-Boot,1/4] " Tom Rini
  2016-02-27 18:26 ` [U-Boot] [PATCH 2/4] omap3: Use a define for reboot reason offset Paul Kocialkowski
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 13+ messages in thread
From: Paul Kocialkowski @ 2016-02-27 18:26 UTC (permalink / raw)
  To: u-boot

This switches reboot mode handling to a string-based interface, that allows more
flexibility to set a common interface with the next generations of OMAP devices.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
---
 arch/arm/cpu/armv7/omap3/boot.c        | 14 ++++++++++----
 arch/arm/include/asm/arch-omap3/omap.h |  4 ++--
 board/lge/sniper/sniper.c              |  6 +++---
 3 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/arch/arm/cpu/armv7/omap3/boot.c b/arch/arm/cpu/armv7/omap3/boot.c
index 44d7c30..259c210 100644
--- a/arch/arm/cpu/armv7/omap3/boot.c
+++ b/arch/arm/cpu/armv7/omap3/boot.c
@@ -57,11 +57,14 @@ u32 omap_sys_boot_device(void)
 	return boot_devices[sys_boot];
 }
 
-char omap_reboot_mode(void)
+int omap_reboot_mode(char *mode, unsigned int length)
 {
 	u32 reboot_mode;
 	char c;
 
+	if (length < 2)
+		return -1;
+
 	reboot_mode = readl((u32 *)(OMAP34XX_SCRATCHPAD + 4));
 
 	c = (reboot_mode >> 24) & 0xff;
@@ -74,7 +77,10 @@ char omap_reboot_mode(void)
 
 	c = reboot_mode & 0xff;
 
-	return c;
+	mode[0] = c;
+	mode[1] = '\0';
+
+	return 0;
 }
 
 int omap_reboot_mode_clear(void)
@@ -84,11 +90,11 @@ int omap_reboot_mode_clear(void)
 	return 0;
 }
 
-int omap_reboot_mode_store(char c)
+int omap_reboot_mode_store(char *mode)
 {
 	u32 reboot_mode;
 
-	reboot_mode = 'B' << 24 | 'M' << 16 | c;
+	reboot_mode = 'B' << 24 | 'M' << 16 | mode[0];
 
 	writel(reboot_mode, (u32 *)(OMAP34XX_SCRATCHPAD + 4));
 
diff --git a/arch/arm/include/asm/arch-omap3/omap.h b/arch/arm/include/asm/arch-omap3/omap.h
index 2c94a81..4044b8d 100644
--- a/arch/arm/include/asm/arch-omap3/omap.h
+++ b/arch/arm/include/asm/arch-omap3/omap.h
@@ -260,9 +260,9 @@ struct omap_boot_parameters {
 	unsigned int boot_device_descriptor;
 };
 
-char omap_reboot_mode(void);
+int omap_reboot_mode(char *mode, unsigned int length);
 int omap_reboot_mode_clear(void);
-int omap_reboot_mode_store(char c);
+int omap_reboot_mode_store(char *mode);
 #endif
 
 #endif
diff --git a/board/lge/sniper/sniper.c b/board/lge/sniper/sniper.c
index f093f97..b2c8e97 100644
--- a/board/lge/sniper/sniper.c
+++ b/board/lge/sniper/sniper.c
@@ -109,7 +109,7 @@ int misc_init_r(void)
 
 	/* Reboot mode */
 
-	reboot_mode[0] = omap_reboot_mode();
+	omap_reboot_mode(reboot_mode, sizeof(reboot_mode));
 
 	if (keys[0])
 		reboot_mode[0] = 'r';
@@ -159,12 +159,12 @@ void get_board_serial(struct tag_serialnr *serialnr)
 
 void reset_misc(void)
 {
-	omap_reboot_mode_store('u');
+	omap_reboot_mode_store("u");
 }
 
 int fb_set_reboot_flag(void)
 {
-	return omap_reboot_mode_store('b');
+	return omap_reboot_mode_store("b");
 }
 
 #ifndef CONFIG_SPL_BUILD
-- 
2.6.4

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

* [U-Boot] [PATCH 2/4] omap3: Use a define for reboot reason offset
  2016-02-27 18:26 [U-Boot] [PATCH 0/4] omap and sniper reboot mode fixes and cleanups Paul Kocialkowski
  2016-02-27 18:26 ` [U-Boot] [PATCH 1/4] omap3: String-based reboot mode handling Paul Kocialkowski
@ 2016-02-27 18:26 ` Paul Kocialkowski
  2016-03-15 11:52   ` Tom Rini
  2016-03-17  1:57   ` [U-Boot] [U-Boot, " Tom Rini
  2016-02-27 18:26 ` [U-Boot] [PATCH 3/4] sniper: Get rid of reset_misc Paul Kocialkowski
  2016-02-27 18:26 ` [U-Boot] [PATCH 4/4] sniper: Clear reboot mode garbage on cold reset Paul Kocialkowski
  3 siblings, 2 replies; 13+ messages in thread
From: Paul Kocialkowski @ 2016-02-27 18:26 UTC (permalink / raw)
  To: u-boot

This introduces a define for the offset to the reboot reason, rather than
hardcoding it.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
---
 arch/arm/cpu/armv7/omap3/boot.c        | 8 +++++---
 arch/arm/include/asm/arch-omap3/omap.h | 2 ++
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/arch/arm/cpu/armv7/omap3/boot.c b/arch/arm/cpu/armv7/omap3/boot.c
index 259c210..64b242b 100644
--- a/arch/arm/cpu/armv7/omap3/boot.c
+++ b/arch/arm/cpu/armv7/omap3/boot.c
@@ -65,7 +65,8 @@ int omap_reboot_mode(char *mode, unsigned int length)
 	if (length < 2)
 		return -1;
 
-	reboot_mode = readl((u32 *)(OMAP34XX_SCRATCHPAD + 4));
+	reboot_mode = readl((u32 *)(OMAP34XX_SCRATCHPAD +
+		OMAP_REBOOT_REASON_OFFSET));
 
 	c = (reboot_mode >> 24) & 0xff;
 	if (c != 'B')
@@ -85,7 +86,7 @@ int omap_reboot_mode(char *mode, unsigned int length)
 
 int omap_reboot_mode_clear(void)
 {
-	writel(0, (u32 *)(OMAP34XX_SCRATCHPAD + 4));
+	writel(0, (u32 *)(OMAP34XX_SCRATCHPAD + OMAP_REBOOT_REASON_OFFSET));
 
 	return 0;
 }
@@ -96,7 +97,8 @@ int omap_reboot_mode_store(char *mode)
 
 	reboot_mode = 'B' << 24 | 'M' << 16 | mode[0];
 
-	writel(reboot_mode, (u32 *)(OMAP34XX_SCRATCHPAD + 4));
+	writel(reboot_mode, (u32 *)(OMAP34XX_SCRATCHPAD +
+		OMAP_REBOOT_REASON_OFFSET));
 
 	return 0;
 }
diff --git a/arch/arm/include/asm/arch-omap3/omap.h b/arch/arm/include/asm/arch-omap3/omap.h
index 4044b8d..bc0e02a 100644
--- a/arch/arm/include/asm/arch-omap3/omap.h
+++ b/arch/arm/include/asm/arch-omap3/omap.h
@@ -249,6 +249,8 @@ struct gpio {
 /* ABB tranxdone mask */
 #define OMAP_ABB_MPU_TXDONE_MASK	(0x1 << 26)
 
+#define OMAP_REBOOT_REASON_OFFSET	0x04
+
 /* Boot parameters */
 #ifndef __ASSEMBLY__
 struct omap_boot_parameters {
-- 
2.6.4

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

* [U-Boot] [PATCH 3/4] sniper: Get rid of reset_misc
  2016-02-27 18:26 [U-Boot] [PATCH 0/4] omap and sniper reboot mode fixes and cleanups Paul Kocialkowski
  2016-02-27 18:26 ` [U-Boot] [PATCH 1/4] omap3: String-based reboot mode handling Paul Kocialkowski
  2016-02-27 18:26 ` [U-Boot] [PATCH 2/4] omap3: Use a define for reboot reason offset Paul Kocialkowski
@ 2016-02-27 18:26 ` Paul Kocialkowski
  2016-03-15 11:52   ` Tom Rini
  2016-03-17  1:57   ` [U-Boot] [U-Boot,3/4] " Tom Rini
  2016-02-27 18:26 ` [U-Boot] [PATCH 4/4] sniper: Clear reboot mode garbage on cold reset Paul Kocialkowski
  3 siblings, 2 replies; 13+ messages in thread
From: Paul Kocialkowski @ 2016-02-27 18:26 UTC (permalink / raw)
  To: u-boot

There is no need to set the reboot mode to a particular value prior to reboot,
since valid values will have been caught and cleared earlier.

In addition, this breaks the reboot-bootloader fastboot call, by overriding the
required value for fastboot.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
---
 board/lge/sniper/sniper.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/board/lge/sniper/sniper.c b/board/lge/sniper/sniper.c
index b2c8e97..6726866 100644
--- a/board/lge/sniper/sniper.c
+++ b/board/lge/sniper/sniper.c
@@ -157,11 +157,6 @@ void get_board_serial(struct tag_serialnr *serialnr)
 	omap_die_id_get_board_serial(serialnr);
 }
 
-void reset_misc(void)
-{
-	omap_reboot_mode_store("u");
-}
-
 int fb_set_reboot_flag(void)
 {
 	return omap_reboot_mode_store("b");
-- 
2.6.4

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

* [U-Boot] [PATCH 4/4] sniper: Clear reboot mode garbage on cold reset
  2016-02-27 18:26 [U-Boot] [PATCH 0/4] omap and sniper reboot mode fixes and cleanups Paul Kocialkowski
                   ` (2 preceding siblings ...)
  2016-02-27 18:26 ` [U-Boot] [PATCH 3/4] sniper: Get rid of reset_misc Paul Kocialkowski
@ 2016-02-27 18:26 ` Paul Kocialkowski
  2016-03-15 11:52   ` Tom Rini
  2016-03-17  1:57   ` [U-Boot] [U-Boot, " Tom Rini
  3 siblings, 2 replies; 13+ messages in thread
From: Paul Kocialkowski @ 2016-02-27 18:26 UTC (permalink / raw)
  To: u-boot

Reboot mode garbage is found on cold reset and might be seen as valid on the
next warm reset, thus it has to be cleared on cold reset.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
---
 board/lge/sniper/sniper.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/board/lge/sniper/sniper.c b/board/lge/sniper/sniper.c
index 6726866..29a7045 100644
--- a/board/lge/sniper/sniper.c
+++ b/board/lge/sniper/sniper.c
@@ -122,6 +122,9 @@ int misc_init_r(void)
 
 		omap_reboot_mode_clear();
 	} else {
+		/* Reboot mode garbage may still be valid, so clear it. */
+		omap_reboot_mode_clear();
+
 		/*
 		 * When not rebooting, valid power on reasons are either the
 		 * power button, charger plug or USB plug.
-- 
2.6.4

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

* [U-Boot] [PATCH 1/4] omap3: String-based reboot mode handling
  2016-02-27 18:26 ` [U-Boot] [PATCH 1/4] omap3: String-based reboot mode handling Paul Kocialkowski
@ 2016-03-15 11:52   ` Tom Rini
  2016-03-17  1:57   ` [U-Boot] [U-Boot,1/4] " Tom Rini
  1 sibling, 0 replies; 13+ messages in thread
From: Tom Rini @ 2016-03-15 11:52 UTC (permalink / raw)
  To: u-boot

On Sat, Feb 27, 2016 at 07:26:41PM +0100, Paul Kocialkowski wrote:

> This switches reboot mode handling to a string-based interface, that allows more
> flexibility to set a common interface with the next generations of OMAP devices.
> 
> Signed-off-by: Paul Kocialkowski <contact@paulk.fr>

Reviewed-by: Tom Rini <trini@konsulko.com>

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160315/2ba951ab/attachment.sig>

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

* [U-Boot] [PATCH 2/4] omap3: Use a define for reboot reason offset
  2016-02-27 18:26 ` [U-Boot] [PATCH 2/4] omap3: Use a define for reboot reason offset Paul Kocialkowski
@ 2016-03-15 11:52   ` Tom Rini
  2016-03-17  1:57   ` [U-Boot] [U-Boot, " Tom Rini
  1 sibling, 0 replies; 13+ messages in thread
From: Tom Rini @ 2016-03-15 11:52 UTC (permalink / raw)
  To: u-boot

On Sat, Feb 27, 2016 at 07:26:42PM +0100, Paul Kocialkowski wrote:

> This introduces a define for the offset to the reboot reason, rather than
> hardcoding it.
> 
> Signed-off-by: Paul Kocialkowski <contact@paulk.fr>

Reviewed-by: Tom Rini <trini@konsulko.com>

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160315/83695aaa/attachment.sig>

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

* [U-Boot] [PATCH 3/4] sniper: Get rid of reset_misc
  2016-02-27 18:26 ` [U-Boot] [PATCH 3/4] sniper: Get rid of reset_misc Paul Kocialkowski
@ 2016-03-15 11:52   ` Tom Rini
  2016-03-17  1:57   ` [U-Boot] [U-Boot,3/4] " Tom Rini
  1 sibling, 0 replies; 13+ messages in thread
From: Tom Rini @ 2016-03-15 11:52 UTC (permalink / raw)
  To: u-boot

On Sat, Feb 27, 2016 at 07:26:43PM +0100, Paul Kocialkowski wrote:

> There is no need to set the reboot mode to a particular value prior to reboot,
> since valid values will have been caught and cleared earlier.
> 
> In addition, this breaks the reboot-bootloader fastboot call, by overriding the
> required value for fastboot.
> 
> Signed-off-by: Paul Kocialkowski <contact@paulk.fr>

Reviewed-by: Tom Rini <trini@konsulko.com>

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160315/c3814430/attachment.sig>

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

* [U-Boot] [PATCH 4/4] sniper: Clear reboot mode garbage on cold reset
  2016-02-27 18:26 ` [U-Boot] [PATCH 4/4] sniper: Clear reboot mode garbage on cold reset Paul Kocialkowski
@ 2016-03-15 11:52   ` Tom Rini
  2016-03-17  1:57   ` [U-Boot] [U-Boot, " Tom Rini
  1 sibling, 0 replies; 13+ messages in thread
From: Tom Rini @ 2016-03-15 11:52 UTC (permalink / raw)
  To: u-boot

On Sat, Feb 27, 2016 at 07:26:44PM +0100, Paul Kocialkowski wrote:

> Reboot mode garbage is found on cold reset and might be seen as valid on the
> next warm reset, thus it has to be cleared on cold reset.
> 
> Signed-off-by: Paul Kocialkowski <contact@paulk.fr>

Reviewed-by: Tom Rini <trini@konsulko.com>

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160315/dbf33c78/attachment.sig>

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

* [U-Boot] [U-Boot,1/4] omap3: String-based reboot mode handling
  2016-02-27 18:26 ` [U-Boot] [PATCH 1/4] omap3: String-based reboot mode handling Paul Kocialkowski
  2016-03-15 11:52   ` Tom Rini
@ 2016-03-17  1:57   ` Tom Rini
  1 sibling, 0 replies; 13+ messages in thread
From: Tom Rini @ 2016-03-17  1:57 UTC (permalink / raw)
  To: u-boot

On Sat, Feb 27, 2016 at 07:26:41PM +0100, Paul Kocialkowski wrote:

> This switches reboot mode handling to a string-based interface, that allows more
> flexibility to set a common interface with the next generations of OMAP devices.
> 
> Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
> Reviewed-by: Tom Rini <trini@konsulko.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160316/303081f2/attachment.sig>

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

* [U-Boot] [U-Boot, 2/4] omap3: Use a define for reboot reason offset
  2016-02-27 18:26 ` [U-Boot] [PATCH 2/4] omap3: Use a define for reboot reason offset Paul Kocialkowski
  2016-03-15 11:52   ` Tom Rini
@ 2016-03-17  1:57   ` Tom Rini
  1 sibling, 0 replies; 13+ messages in thread
From: Tom Rini @ 2016-03-17  1:57 UTC (permalink / raw)
  To: u-boot

On Sat, Feb 27, 2016 at 07:26:42PM +0100, Paul Kocialkowski wrote:

> This introduces a define for the offset to the reboot reason, rather than
> hardcoding it.
> 
> Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
> Reviewed-by: Tom Rini <trini@konsulko.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160316/ad93556d/attachment.sig>

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

* [U-Boot] [U-Boot,3/4] sniper: Get rid of reset_misc
  2016-02-27 18:26 ` [U-Boot] [PATCH 3/4] sniper: Get rid of reset_misc Paul Kocialkowski
  2016-03-15 11:52   ` Tom Rini
@ 2016-03-17  1:57   ` Tom Rini
  1 sibling, 0 replies; 13+ messages in thread
From: Tom Rini @ 2016-03-17  1:57 UTC (permalink / raw)
  To: u-boot

On Sat, Feb 27, 2016 at 07:26:43PM +0100, Paul Kocialkowski wrote:

> There is no need to set the reboot mode to a particular value prior to reboot,
> since valid values will have been caught and cleared earlier.
> 
> In addition, this breaks the reboot-bootloader fastboot call, by overriding the
> required value for fastboot.
> 
> Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
> Reviewed-by: Tom Rini <trini@konsulko.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160316/58a2ed0d/attachment.sig>

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

* [U-Boot] [U-Boot, 4/4] sniper: Clear reboot mode garbage on cold reset
  2016-02-27 18:26 ` [U-Boot] [PATCH 4/4] sniper: Clear reboot mode garbage on cold reset Paul Kocialkowski
  2016-03-15 11:52   ` Tom Rini
@ 2016-03-17  1:57   ` Tom Rini
  1 sibling, 0 replies; 13+ messages in thread
From: Tom Rini @ 2016-03-17  1:57 UTC (permalink / raw)
  To: u-boot

On Sat, Feb 27, 2016 at 07:26:44PM +0100, Paul Kocialkowski wrote:

> Reboot mode garbage is found on cold reset and might be seen as valid on the
> next warm reset, thus it has to be cleared on cold reset.
> 
> Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
> Reviewed-by: Tom Rini <trini@konsulko.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160316/87323041/attachment.sig>

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

end of thread, other threads:[~2016-03-17  1:57 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-27 18:26 [U-Boot] [PATCH 0/4] omap and sniper reboot mode fixes and cleanups Paul Kocialkowski
2016-02-27 18:26 ` [U-Boot] [PATCH 1/4] omap3: String-based reboot mode handling Paul Kocialkowski
2016-03-15 11:52   ` Tom Rini
2016-03-17  1:57   ` [U-Boot] [U-Boot,1/4] " Tom Rini
2016-02-27 18:26 ` [U-Boot] [PATCH 2/4] omap3: Use a define for reboot reason offset Paul Kocialkowski
2016-03-15 11:52   ` Tom Rini
2016-03-17  1:57   ` [U-Boot] [U-Boot, " Tom Rini
2016-02-27 18:26 ` [U-Boot] [PATCH 3/4] sniper: Get rid of reset_misc Paul Kocialkowski
2016-03-15 11:52   ` Tom Rini
2016-03-17  1:57   ` [U-Boot] [U-Boot,3/4] " Tom Rini
2016-02-27 18:26 ` [U-Boot] [PATCH 4/4] sniper: Clear reboot mode garbage on cold reset Paul Kocialkowski
2016-03-15 11:52   ` Tom Rini
2016-03-17  1:57   ` [U-Boot] [U-Boot, " Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.