diff mbox series

[05/05] db820c: stop autoboot when vol- pressed

Message ID 1515148154-30138-5-git-send-email-jorge.ramirez-ortiz@linaro.org
State Accepted
Commit 100fb0bd9989d1722c75d83baaf08d5285e7a62c
Headers show
Series [01/05] env: enable accessing the environment in an EXT4 partition | expand

Commit Message

Jorge Ramirez-Ortiz Jan. 5, 2018, 10:29 a.m. UTC
Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
---
 arch/arm/dts/dragonboard820c-uboot.dtsi          | 19 ++++++++++++
 board/qualcomm/dragonboard820c/dragonboard820c.c | 37 +++++++++++++++++++++++-
 include/configs/dragonboard820c.h                |  2 ++
 3 files changed, 57 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/dragonboard820c-uboot.dtsi

Comments

Peter Robinson Jan. 9, 2018, 2:52 a.m. UTC | #1
On Fri, Jan 5, 2018 at 10:29 AM, Jorge Ramirez-Ortiz
<jorge.ramirez-ortiz@linaro.org> wrote:
> Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
> ---
>  arch/arm/dts/dragonboard820c-uboot.dtsi          | 19 ++++++++++++
>  board/qualcomm/dragonboard820c/dragonboard820c.c | 37 +++++++++++++++++++++++-
>  include/configs/dragonboard820c.h                |  2 ++
>  3 files changed, 57 insertions(+), 1 deletion(-)
>  create mode 100644 arch/arm/dts/dragonboard820c-uboot.dtsi
>
> diff --git a/arch/arm/dts/dragonboard820c-uboot.dtsi b/arch/arm/dts/dragonboard820c-uboot.dtsi
> new file mode 100644
> index 0000000..167e72c
> --- /dev/null
> +++ b/arch/arm/dts/dragonboard820c-uboot.dtsi
> @@ -0,0 +1,19 @@
> +/*
> + * U-Boot addition to handle Dragonboard 820c pins
> + *
> + * (C) Copyright 2017 Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
> + *
> + * SPDX-License-Identifier:    GPL-2.0+
> + */
> +
> +&pm8994_pon {
> +       key_vol_down {
> +               gpios = <&pm8994_pon 1 0>;
> +               label = "key_vol_down";
> +       };
> +
> +       key_power {
> +               gpios = <&pm8994_pon 0 0>;
> +               label = "key_power";
> +       };
> +};
> diff --git a/board/qualcomm/dragonboard820c/dragonboard820c.c b/board/qualcomm/dragonboard820c/dragonboard820c.c
> index 8f40ba4..d4a20d2 100644
> --- a/board/qualcomm/dragonboard820c/dragonboard820c.c
> +++ b/board/qualcomm/dragonboard820c/dragonboard820c.c
> @@ -1,7 +1,7 @@
>  /*
>   * Board init file for Dragonboard 820C
>   *
> - * (C) Copyright 2017 Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@gmail.com>
> + * (C) Copyright 2017 Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>

For some reason this bit here causes issue for me either via patch or
"git am" so maybe just merge it with the original commit, no idea why
but not bothered either way more just FYI.

>   * SPDX-License-Identifier:    GPL-2.0+
>   */
> @@ -14,6 +14,7 @@
>  #include <asm/io.h>
>  #include <linux/bitops.h>
>  #include <asm/psci.h>
> +#include <asm/gpio.h>
>
>  DECLARE_GLOBAL_DATA_PTR;
>
> @@ -126,3 +127,37 @@ void reset_cpu(ulong addr)
>  {
>         psci_system_reset();
>  }
> +
> +/* Check for vol- button - if pressed - stop autoboot */
> +int misc_init_r(void)
> +{
> +       struct udevice *pon;
> +       struct gpio_desc resin;
> +       int node, ret;
> +
> +       ret = uclass_get_device_by_name(UCLASS_GPIO, "pm8994_pon@800", &pon);
> +       if (ret < 0) {
> +               printf("Failed to find PMIC pon node. Check device tree\n");
> +               return 0;
> +       }
> +
> +       node = fdt_subnode_offset(gd->fdt_blob, dev_of_offset(pon),
> +                                 "key_vol_down");
> +       if (node < 0) {
> +               printf("Failed to find key_vol_down node. Check device tree\n");
> +               return 0;
> +       }
> +
> +       if (gpio_request_by_name_nodev(offset_to_ofnode(node), "gpios", 0,
> +                                      &resin, 0)) {
> +               printf("Failed to request key_vol_down button.\n");
> +               return 0;
> +       }
> +
> +       if (dm_gpio_get_value(&resin)) {
> +               env_set("bootdelay", "-1");
> +               printf("Power button pressed - dropping to console.\n");
> +       }
> +
> +       return 0;
> +}
> diff --git a/include/configs/dragonboard820c.h b/include/configs/dragonboard820c.h
> index 76bcaf8..e0c3c0c 100644
> --- a/include/configs/dragonboard820c.h
> +++ b/include/configs/dragonboard820c.h
> @@ -12,6 +12,8 @@
>  #include <linux/sizes.h>
>  #include <asm/arch/sysmap-apq8096.h>
>
> +#define CONFIG_MISC_INIT_R /* To stop autoboot */
> +
>  /* Physical Memory Map */
>  #define CONFIG_NR_DRAM_BANKS           2
>
> --
> 2.7.4
>
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://lists.denx.de/listinfo/u-boot
Jorge Ramirez-Ortiz Jan. 9, 2018, 8:07 a.m. UTC | #2
On 01/09/2018 03:52 AM, Peter Robinson wrote:
>> +++ b/board/qualcomm/dragonboard820c/dragonboard820c.c
>> @@ -1,7 +1,7 @@
>>   /*
>>    * Board init file for Dragonboard 820C
>>    *
>> - * (C) Copyright 2017 Jorge Ramirez-Ortiz<jorge.ramirez-ortiz@gmail.com>
>> + * (C) Copyright 2017 Jorge Ramirez-Ortiz<jorge.ramirez-ortiz@linaro.org>
> For some reason this bit here causes issue for me either via patch or
> "git am" so maybe just merge it with the original commit, no idea why
> but not bothered either way more just FYI.
>
um I did fix this whitespace issue IIRC.
I reapplied the series on the latest master branch and it was ok for me 
(git am ...)

I am going to resend the three patchesets again from my gmail account - 
sorry everyone- since I will be leaving Linaro at the end of the week 
and my linaro email will no longer be active to receive the review comments.

will retest everything again.

please give me a few hours or so and thanks for checking Peter!
diff mbox series

Patch

diff --git a/arch/arm/dts/dragonboard820c-uboot.dtsi b/arch/arm/dts/dragonboard820c-uboot.dtsi
new file mode 100644
index 0000000..167e72c
--- /dev/null
+++ b/arch/arm/dts/dragonboard820c-uboot.dtsi
@@ -0,0 +1,19 @@ 
+/*
+ * U-Boot addition to handle Dragonboard 820c pins
+ *
+ * (C) Copyright 2017 Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+&pm8994_pon {
+	key_vol_down {
+		gpios = <&pm8994_pon 1 0>;
+		label = "key_vol_down";
+	};
+
+	key_power {
+		gpios = <&pm8994_pon 0 0>;
+		label = "key_power";
+	};
+};
diff --git a/board/qualcomm/dragonboard820c/dragonboard820c.c b/board/qualcomm/dragonboard820c/dragonboard820c.c
index 8f40ba4..d4a20d2 100644
--- a/board/qualcomm/dragonboard820c/dragonboard820c.c
+++ b/board/qualcomm/dragonboard820c/dragonboard820c.c
@@ -1,7 +1,7 @@ 
 /*
  * Board init file for Dragonboard 820C
  *
- * (C) Copyright 2017 Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@gmail.com>	
+ * (C) Copyright 2017 Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
  *
  * SPDX-License-Identifier:	GPL-2.0+
  */
@@ -14,6 +14,7 @@ 
 #include <asm/io.h>
 #include <linux/bitops.h>
 #include <asm/psci.h>
+#include <asm/gpio.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -126,3 +127,37 @@  void reset_cpu(ulong addr)
 {
 	psci_system_reset();
 }
+
+/* Check for vol- button - if pressed - stop autoboot */
+int misc_init_r(void)
+{
+	struct udevice *pon;
+	struct gpio_desc resin;
+	int node, ret;
+
+	ret = uclass_get_device_by_name(UCLASS_GPIO, "pm8994_pon@800", &pon);
+	if (ret < 0) {
+		printf("Failed to find PMIC pon node. Check device tree\n");
+		return 0;
+	}
+
+	node = fdt_subnode_offset(gd->fdt_blob, dev_of_offset(pon),
+				  "key_vol_down");
+	if (node < 0) {
+		printf("Failed to find key_vol_down node. Check device tree\n");
+		return 0;
+	}
+
+	if (gpio_request_by_name_nodev(offset_to_ofnode(node), "gpios", 0,
+				       &resin, 0)) {
+		printf("Failed to request key_vol_down button.\n");
+		return 0;
+	}
+
+	if (dm_gpio_get_value(&resin)) {
+		env_set("bootdelay", "-1");
+		printf("Power button pressed - dropping to console.\n");
+	}
+
+	return 0;
+}
diff --git a/include/configs/dragonboard820c.h b/include/configs/dragonboard820c.h
index 76bcaf8..e0c3c0c 100644
--- a/include/configs/dragonboard820c.h
+++ b/include/configs/dragonboard820c.h
@@ -12,6 +12,8 @@ 
 #include <linux/sizes.h>
 #include <asm/arch/sysmap-apq8096.h>
 
+#define CONFIG_MISC_INIT_R /* To stop autoboot */
+
 /* Physical Memory Map */
 #define CONFIG_NR_DRAM_BANKS		2