Skip to contentSkip to conversation

sniper: Include explicit serial baudrate on bootargs

PATCH New Paul Kocialkowski 2 participants 14 messages Mar 29, 2016 – Apr 2, 2016 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/7 sniper: Include explicit serial baudrate on bootargs

This makes the baudrate for the kernel command line explicit.

---
 include/configs/sniper.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/configs/sniper.h +1 -1
index 171a8c4..cb25c0a 100644
@@ -252,7 +252,7 @@
 	"recovery_mmc_part=4\0" \
 	"fdtfile=omap3-sniper.dtb\0" \
 	"bootfile=/boot/extlinux/extlinux.conf\0" \
-	"bootargs=console=ttyO2 vram=5M,0x9FA00000 omapfb.vram=0:5M\0"
+	"bootargs=console=ttyO2,115200 vram=5M,0x9FA00000 omapfb.vram=0:5M\0"
 
 /*
  * ATAGs
Signature · 1 line
2.7.4
#1 lore raw

PATCH v2 2/7 kc1: Include explicit serial baudrate on bootargs

This makes the baudrate for the kernel command line explicit.

---
 include/configs/kc1.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/configs/kc1.h +1 -1
index c2ac148..444a0f3 100644
@@ -233,7 +233,7 @@
 	"boot_mmc_dev=0\0" \
 	"kernel_mmc_part=7\0" \
 	"recovery_mmc_part=5\0" \
-	"bootargs=mem=512M console=ttyO2\0"
+	"bootargs=console=ttyO2,115200 mem=512M\0"
 
 /*
  * ATAGs
Signature · 1 line
2.7.4
#2 lore raw

PATCH v2 2/7 kc1: Include explicit serial baudrate on bootargs

Quoted 3 lines · Paul Kocialkowski

This makes the baudrate for the kernel command line explicit.

Applied to u-boot/master, thanks!

Signature · 8 lines
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/20160401/54cc33ba/attachment.sig>
#3 lore raw

PATCH v2 3/7 kc1: Select libfdt to allow running devicetree-based kernels

In reply to Paul Kocialkowski

Selecting CONFIG_OF_LIBFDT allows running recent mainline kernels.

---
 configs/kc1_defconfig | 1 +
 1 file changed, 1 insertion(+)
configs/kc1_defconfig +1 -0
index 1e5c918..4de0b34 100644
@@ -12,3 +12,4 @@ CONFIG_CMD_GPIO=y
 CONFIG_SYS_NS16550=y
 CONFIG_USB=y
 CONFIG_USB_MUSB_GADGET=y
+CONFIG_OF_LIBFDT=y
Signature · 1 line
2.7.4
#4 lore raw

PATCH v2 3/7 kc1: Select libfdt to allow running devicetree-based kernels

Quoted 3 lines · Paul Kocialkowski

Selecting CONFIG_OF_LIBFDT allows running recent mainline kernels.

Applied to u-boot/master, thanks!

Signature · 8 lines
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/20160401/67e7f9da/attachment.sig>
#5 lore raw

PATCH v2 4/7 kc1: Add some sysboot and devicetree-related environment variables

In reply to Paul Kocialkowski

This adds some environment variables for sysboot and devicetree.

---
 include/configs/kc1.h | 2 ++
 1 file changed, 2 insertions(+)
include/configs/kc1.h +2 -0
index 444a0f3..4803acb 100644
@@ -233,6 +233,8 @@
 	"boot_mmc_dev=0\0" \
 	"kernel_mmc_part=7\0" \
 	"recovery_mmc_part=5\0" \
+	"fdtfile=omap4-kc1.dtb\0" \
+	"bootfile=/boot/extlinux/extlinux.conf\0" \
 	"bootargs=console=ttyO2,115200 mem=512M\0"
 
 /*
Signature · 1 line
2.7.4
#6 lore raw

PATCH v2 4/7 kc1: Add some sysboot and devicetree-related environment variables

Quoted 3 lines · Paul Kocialkowski

This adds some environment variables for sysboot and devicetree.

Applied to u-boot/master, thanks!

Signature · 8 lines
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/20160401/adca9508/attachment.sig>
#7 lore raw

PATCH v2 5/7 sniper: Proper reboot mode and boot reason validation

In reply to Paul Kocialkowski

With the previous implementation, rebooting without registering a recognized reboot mode (despite registering the magic) would end up with U-Boot checking for a valid power-on reason, which might result in the device turning off (e.g. with no USB cable attached and no buttons pressed).

This was designed to catch reboots that are actually intended to be power-off, something that old Android kernels do, instead of properly turning the device off using the TWL4030.

However, since this approach is not viable (breaks reboot in most cases), the validity of the reboot mode magic is checked to detect a reboot and the 'o' char is recognized to indicate that power-off is required. Still, that might be overridden by the detection of usual power-on reasons, on purpose.

---
 board/lge/sniper/sniper.c | 33 +++++++++++++++++++++++----------
 1 file changed, 23 insertions(+), 10 deletions(-)
board/lge/sniper/sniper.c +23 -10
index 29a7045..0662449 100644
@@ -94,6 +94,7 @@ int misc_init_r(void)
 	char reboot_mode[2] = { 0 };
 	unsigned char keys[3];
 	unsigned char data = 0;
+	int rc;
 
 	/* Power button reset init */
 
@@ -109,22 +110,14 @@ int misc_init_r(void)
 
 	/* Reboot mode */
 
-	omap_reboot_mode(reboot_mode, sizeof(reboot_mode));
+	rc = omap_reboot_mode(reboot_mode, sizeof(reboot_mode));
 
 	if (keys[0])
 		reboot_mode[0] = 'r';
 	else if (keys[1])
 		reboot_mode[0] = 'b';
 
-	if (reboot_mode[0] > 0 && isascii(reboot_mode[0])) {
-		if (!getenv("reboot-mode"))
-			setenv("reboot-mode", (char *)reboot_mode);
-
-		omap_reboot_mode_clear();
-	} else {
-		/* Reboot mode garbage may still be valid, so clear it. */
-		omap_reboot_mode_clear();
-
+	if (rc < 0 || reboot_mode[0] == 'o') {
 		/*
 		 * When not rebooting, valid power on reasons are either the
 		 * power button, charger plug or USB plug.
@@ -138,6 +131,13 @@ int misc_init_r(void)
 			twl4030_power_off();
 	}
 
+	if (reboot_mode[0] > 0 && isascii(reboot_mode[0])) {
+		if (!getenv("reboot-mode"))
+			setenv("reboot-mode", (char *)reboot_mode);
+	}
+
+	omap_reboot_mode_clear();
+
 	/* Serial number */
 
 	omap_die_id_serial();
@@ -160,6 +160,19 @@ void get_board_serial(struct tag_serialnr *serialnr)
 	omap_die_id_get_board_serial(serialnr);
 }
 
+void reset_misc(void)
+{
+	char reboot_mode[2] = { 0 };
+
+	/*
+	 * Valid resets must contain the reboot mode magic, but we must not
+	 * override it when set previously (e.g. reboot to bootloader).
+	 */
+
+	omap_reboot_mode(reboot_mode, sizeof(reboot_mode));
+	omap_reboot_mode_store(reboot_mode);
+}
+
 int fb_set_reboot_flag(void)
 {
 	return omap_reboot_mode_store("b");
Signature · 1 line
2.7.4
#8 lore raw

PATCH v2 5/7 sniper: Proper reboot mode and boot reason validation

Quoted 9 lines · Paul Kocialkowski

With the previous implementation, rebooting without registering a recognized reboot mode (despite registering the magic) would end up with U-Boot checking for a valid power-on reason, which might result in the device turning off (e.g. with no USB cable attached and no buttons pressed).

This was designed to catch reboots that are actually intended to be power-off, something that old Android kernels do, instead of properly turning the device off using the TWL4030.

Quoted 6 lines

However, since this approach is not viable (breaks reboot in most cases), the validity of the reboot mode magic is checked to detect a reboot and the 'o' char is recognized to indicate that power-off is required. Still, that might be overridden by the detection of usual power-on reasons, on purpose.

Applied to u-boot/master, thanks!

Signature · 8 lines
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/20160401/c48b4363/attachment.sig>
#9 lore raw

PATCH v2 6/7 kc1: Proper reboot mode and boot reason validation

In reply to Paul Kocialkowski

With the previous implementation, rebooting without registering a recognized reboot mode would end up with U-Boot checking for a valid power-on reason, which might result in the device turning off (e.g. with no USB cable attached and no buttons pressed).

Since this approach is not viable (breaks reboot in most cases), the validity of the reboot reason is checked (in turn, by checking that a warm reset happened, as there is no magic) to detect a reboot and the 'o' char is recognized to indicate that power-off is required. Still, that might be overridden by the detection of usual power-on reasons, on purpose.

---
 board/amazon/kc1/kc1.c | 23 ++++++++++-------------
 1 file changed, 10 insertions(+), 13 deletions(-)
board/amazon/kc1/kc1.c +10 -13
index ca63af8..469a83e 100644
@@ -88,10 +88,11 @@ int misc_init_r(void)
 	char reboot_mode[2] = { 0 };
 	u32 data = 0;
 	u32 value;
+	int rc;
 
 	/* Reboot mode */
 
-	omap_reboot_mode(reboot_mode, sizeof(reboot_mode));
+	rc = omap_reboot_mode(reboot_mode, sizeof(reboot_mode));
 
 	/* USB ID pin pull-up indicates factory (fastboot) cable detection. */
 	gpio_request(KC1_GPIO_USB_ID, "USB_ID");
@@ -101,18 +102,7 @@ int misc_init_r(void)
 	if (value)
 		reboot_mode[0] = 'b';
 
-	if (reboot_mode[0] > 0 && isascii(reboot_mode[0])) {
-		if (reboot_mode[0] == 'o')
-			twl6030_power_off();
-
-		if (!getenv("reboot-mode"))
-			setenv("reboot-mode", (char *)reboot_mode);
-
-		omap_reboot_mode_clear();
-	} else {
-		/* Reboot mode garbage may still be valid, so clear it. */
-		omap_reboot_mode_clear();
-
+	if (rc < 0 || reboot_mode[0] == 'o') {
 		/*
 		 * When not rebooting, valid power on reasons are either the
 		 * power button, charger plug or USB plug.
@@ -126,6 +116,13 @@ int misc_init_r(void)
 			twl6030_power_off();
 	}
 
+	if (reboot_mode[0] > 0 && isascii(reboot_mode[0])) {
+		if (!getenv("reboot-mode"))
+			setenv("reboot-mode", (char *)reboot_mode);
+	}
+
+	omap_reboot_mode_clear();
+
 	/* Serial number */
 
 	omap_die_id_serial();
Signature · 1 line
2.7.4
#10 lore raw

PATCH v2 6/7 kc1: Proper reboot mode and boot reason validation

Quoted 5 lines · Paul Kocialkowski

With the previous implementation, rebooting without registering a recognized reboot mode would end up with U-Boot checking for a valid power-on reason, which might result in the device turning off (e.g. with no USB cable attached and no buttons pressed).

Quoted 7 lines

Since this approach is not viable (breaks reboot in most cases), the validity of the reboot reason is checked (in turn, by checking that a warm reset happened, as there is no magic) to detect a reboot and the 'o' char is recognized to indicate that power-off is required. Still, that might be overridden by the detection of usual power-on reasons, on purpose.

Applied to u-boot/master, thanks!

Signature · 8 lines
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/20160401/ff371092/attachment.sig>
#11 lore raw

PATCH v2 7/7 sniper: Change vendor name from lge to lg, matching devicetree vendor prefix

In reply to Paul Kocialkowski

This moves the sniper board from the lge to lg, in order to match the devicetree vendor prefix already defined in the kernel.

---
 arch/arm/cpu/armv7/omap3/Kconfig     | 2 +-
 board/{lge => lg}/sniper/Kconfig     | 2 +-
 board/{lge => lg}/sniper/MAINTAINERS | 2 +-
 board/{lge => lg}/sniper/Makefile    | 0
 board/{lge => lg}/sniper/sniper.c    | 0
 board/{lge => lg}/sniper/sniper.h    | 0
 6 files changed, 3 insertions(+), 3 deletions(-)
 rename board/{lge => lg}/sniper/Kconfig (88%)
 rename board/{lge => lg}/sniper/MAINTAINERS (85%)
 rename board/{lge => lg}/sniper/Makefile (100%)
 rename board/{lge => lg}/sniper/sniper.c (100%)
 rename board/{lge => lg}/sniper/sniper.h (100%)
arch/arm/cpu/armv7/omap3/Kconfig +1 -1
index c6168e9..85d6436 100644
@@ -141,6 +141,6 @@ source "board/nokia/rx51/Kconfig"
 source "board/technexion/tao3530/Kconfig"
 source "board/technexion/twister/Kconfig"
 source "board/quipos/cairo/Kconfig"
-source "board/lge/sniper/Kconfig"
+source "board/lg/sniper/Kconfig"
 
 endif
board/lg/sniper/Kconfig renamed from board/lge/sniper/Kconfig +1 -1
similarity index 88%
rename from board/lge/sniper/Kconfig
rename to board/lg/sniper/Kconfig
index f7a682e..3f18d21 100644
@@ -4,7 +4,7 @@ config SYS_BOARD
 	default "sniper"
 
 config SYS_VENDOR
-	default "lge"
+	default "lg"
 
 config SYS_CONFIG_NAME
 	default "sniper"
board/lg/sniper/MAINTAINERS renamed from board/lge/sniper/MAINTAINERS +1 -1
similarity index 85%
rename from board/lge/sniper/MAINTAINERS
rename to board/lg/sniper/MAINTAINERS
index 0e7baa5..7226b09 100644
@@ -1,6 +1,6 @@
 SNIPER BOARD
 M:	Paul Kocialkowski <[email protected]>
 S:	Maintained
-F:	board/lge/sniper/
+F:	board/lg/sniper/
 F:	include/configs/sniper.h
 F:	configs/sniper_defconfig
board/lg/sniper/Makefile renamed from board/lge/sniper/Makefile +0 -0
similarity index 100%
rename from board/lge/sniper/Makefile
rename to board/lg/sniper/Makefile
board/lg/sniper/sniper.c renamed from board/lge/sniper/sniper.c +0 -0
similarity index 100%
rename from board/lge/sniper/sniper.c
rename to board/lg/sniper/sniper.c
board/lg/sniper/sniper.h renamed from board/lge/sniper/sniper.h +0 -0
similarity index 100%
rename from board/lge/sniper/sniper.h
rename to board/lg/sniper/sniper.h
Signature · 1 line
2.7.4
#12 lore raw

PATCH v2 7/7 sniper: Change vendor name from lge to lg, matching devicetree vendor prefix

Quoted 4 lines · Paul Kocialkowski

This moves the sniper board from the lge to lg, in order to match the devicetree vendor prefix already defined in the kernel.

Applied to u-boot/master, thanks!

Signature · 8 lines
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/20160401/3c6a0b71/attachment.sig>
#13 lore raw

PATCH v2 1/7 sniper: Include explicit serial baudrate on bootargs

In reply to Paul Kocialkowski
Quoted 3 lines · Paul Kocialkowski

This makes the baudrate for the kernel command line explicit.

Applied to u-boot/master, thanks!

Signature · 8 lines
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/20160401/8a0e43ef/attachment.sig>