[U-Boot] [PATCH v2 1/7] sniper: Include explicit serial baudrate on bootargs

This makes the baudrate for the kernel command line explicit.
Signed-off-by: Paul Kocialkowski contact@paulk.fr --- include/configs/sniper.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/configs/sniper.h b/include/configs/sniper.h index 171a8c4..cb25c0a 100644 --- a/include/configs/sniper.h +++ b/include/configs/sniper.h @@ -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

This makes the baudrate for the kernel command line explicit.
Signed-off-by: Paul Kocialkowski contact@paulk.fr --- include/configs/kc1.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/configs/kc1.h b/include/configs/kc1.h index c2ac148..444a0f3 100644 --- a/include/configs/kc1.h +++ b/include/configs/kc1.h @@ -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

On Tue, Mar 29, 2016 at 02:16:22PM +0200, Paul Kocialkowski wrote:
This makes the baudrate for the kernel command line explicit.
Signed-off-by: Paul Kocialkowski contact@paulk.fr
Applied to u-boot/master, thanks!

Selecting CONFIG_OF_LIBFDT allows running recent mainline kernels.
Signed-off-by: Paul Kocialkowski contact@paulk.fr --- configs/kc1_defconfig | 1 + 1 file changed, 1 insertion(+)
diff --git a/configs/kc1_defconfig b/configs/kc1_defconfig index 1e5c918..4de0b34 100644 --- a/configs/kc1_defconfig +++ b/configs/kc1_defconfig @@ -12,3 +12,4 @@ CONFIG_CMD_GPIO=y CONFIG_SYS_NS16550=y CONFIG_USB=y CONFIG_USB_MUSB_GADGET=y +CONFIG_OF_LIBFDT=y

On Tue, Mar 29, 2016 at 02:16:23PM +0200, Paul Kocialkowski wrote:
Selecting CONFIG_OF_LIBFDT allows running recent mainline kernels.
Signed-off-by: Paul Kocialkowski contact@paulk.fr
Applied to u-boot/master, thanks!

This adds some environment variables for sysboot and devicetree.
Signed-off-by: Paul Kocialkowski contact@paulk.fr --- include/configs/kc1.h | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/include/configs/kc1.h b/include/configs/kc1.h index 444a0f3..4803acb 100644 --- a/include/configs/kc1.h +++ b/include/configs/kc1.h @@ -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"
/*

On Tue, Mar 29, 2016 at 02:16:24PM +0200, Paul Kocialkowski wrote:
This adds some environment variables for sysboot and devicetree.
Signed-off-by: Paul Kocialkowski contact@paulk.fr
Applied to u-boot/master, thanks!

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.
Signed-off-by: Paul Kocialkowski contact@paulk.fr --- board/lge/sniper/sniper.c | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-)
diff --git a/board/lge/sniper/sniper.c b/board/lge/sniper/sniper.c index 29a7045..0662449 100644 --- a/board/lge/sniper/sniper.c +++ b/board/lge/sniper/sniper.c @@ -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");

On Tue, Mar 29, 2016 at 02:16:25PM +0200, Paul Kocialkowski wrote:
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.
Signed-off-by: Paul Kocialkowski contact@paulk.fr
Applied to u-boot/master, thanks!

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.
Signed-off-by: Paul Kocialkowski contact@paulk.fr --- board/amazon/kc1/kc1.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-)
diff --git a/board/amazon/kc1/kc1.c b/board/amazon/kc1/kc1.c index ca63af8..469a83e 100644 --- a/board/amazon/kc1/kc1.c +++ b/board/amazon/kc1/kc1.c @@ -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();

On Tue, Mar 29, 2016 at 02:16:26PM +0200, Paul Kocialkowski wrote:
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.
Signed-off-by: Paul Kocialkowski contact@paulk.fr
Applied to u-boot/master, thanks!

This moves the sniper board from the lge to lg, in order to match the devicetree vendor prefix already defined in the kernel.
Signed-off-by: Paul Kocialkowski contact@paulk.fr --- 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%)
diff --git a/arch/arm/cpu/armv7/omap3/Kconfig b/arch/arm/cpu/armv7/omap3/Kconfig index c6168e9..85d6436 100644 --- a/arch/arm/cpu/armv7/omap3/Kconfig +++ b/arch/arm/cpu/armv7/omap3/Kconfig @@ -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 diff --git a/board/lge/sniper/Kconfig b/board/lg/sniper/Kconfig similarity index 88% rename from board/lge/sniper/Kconfig rename to board/lg/sniper/Kconfig index f7a682e..3f18d21 100644 --- a/board/lge/sniper/Kconfig +++ b/board/lg/sniper/Kconfig @@ -4,7 +4,7 @@ config SYS_BOARD default "sniper"
config SYS_VENDOR - default "lge" + default "lg"
config SYS_CONFIG_NAME default "sniper" diff --git a/board/lge/sniper/MAINTAINERS b/board/lg/sniper/MAINTAINERS similarity index 85% rename from board/lge/sniper/MAINTAINERS rename to board/lg/sniper/MAINTAINERS index 0e7baa5..7226b09 100644 --- a/board/lge/sniper/MAINTAINERS +++ b/board/lg/sniper/MAINTAINERS @@ -1,6 +1,6 @@ SNIPER BOARD M: Paul Kocialkowski contact@paulk.fr S: Maintained -F: board/lge/sniper/ +F: board/lg/sniper/ F: include/configs/sniper.h F: configs/sniper_defconfig diff --git a/board/lge/sniper/Makefile b/board/lg/sniper/Makefile similarity index 100% rename from board/lge/sniper/Makefile rename to board/lg/sniper/Makefile diff --git a/board/lge/sniper/sniper.c b/board/lg/sniper/sniper.c similarity index 100% rename from board/lge/sniper/sniper.c rename to board/lg/sniper/sniper.c diff --git a/board/lge/sniper/sniper.h b/board/lg/sniper/sniper.h similarity index 100% rename from board/lge/sniper/sniper.h rename to board/lg/sniper/sniper.h

On Tue, Mar 29, 2016 at 02:16:27PM +0200, Paul Kocialkowski wrote:
This moves the sniper board from the lge to lg, in order to match the devicetree vendor prefix already defined in the kernel.
Signed-off-by: Paul Kocialkowski contact@paulk.fr
Applied to u-boot/master, thanks!

On Tue, Mar 29, 2016 at 02:16:21PM +0200, Paul Kocialkowski wrote:
This makes the baudrate for the kernel command line explicit.
Signed-off-by: Paul Kocialkowski contact@paulk.fr
Applied to u-boot/master, thanks!
participants (2)
-
Paul Kocialkowski
-
Tom Rini