CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
orangepi-xunlong

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: orangepi-xunlong/orangepi-build
Path: blob/next/external/patch/atf/atf-rk3399/fix-reset-in-v2.2.patch
Views: 3960
1
From f4707a3c40bfc752a24c427263f7cbe8d7adfcd6 Mon Sep 17 00:00:00 2001
2
From: Vasily Khoruzhick <[email protected]>
3
Date: Fri, 15 Nov 2019 08:25:02 -0800
4
Subject: [PATCH] plat/rockchip: initialize reset and poweroff GPIOs with known
5
invalid value
6
7
And return NULL if we didn't get them in bl aux params otherwise reset and poweroff
8
will be broken on platforms that do not have reset and poweroff GPIOs.
9
10
Fixes: c1185ffde17c ("plat/rockchip: Switch to use new common BL aux parameter library")
11
Signed-off-by: Vasily Khoruzhick <[email protected]>
12
---
13
plat/rockchip/common/params_setup.c | 11 +++++++++--
14
1 file changed, 9 insertions(+), 2 deletions(-)
15
16
diff --git a/plat/rockchip/common/params_setup.c b/plat/rockchip/common/params_setup.c
17
index 8c2e5e911b..b2fd2011e4 100644
18
--- a/plat/rockchip/common/params_setup.c
19
+++ b/plat/rockchip/common/params_setup.c
20
@@ -6,6 +6,7 @@
21
22
#include <assert.h>
23
#include <errno.h>
24
+#include <limits.h>
25
#include <string.h>
26
27
#include <lib/bl_aux_params/bl_aux_params.h>
28
@@ -21,8 +22,8 @@
29
#include <plat_params.h>
30
#include <plat_private.h>
31
32
-static struct bl_aux_gpio_info rst_gpio;
33
-static struct bl_aux_gpio_info poweroff_gpio;
34
+static struct bl_aux_gpio_info rst_gpio = { .index = UINT_MAX } ;
35
+static struct bl_aux_gpio_info poweroff_gpio = { .index = UINT_MAX };
36
static struct bl_aux_gpio_info suspend_gpio[10];
37
uint32_t suspend_gpio_cnt;
38
static struct bl_aux_rk_apio_info suspend_apio;
39
@@ -174,11 +175,17 @@ uint32_t rockchip_get_uart_clock(void)
40
41
struct bl_aux_gpio_info *plat_get_rockchip_gpio_reset(void)
42
{
43
+ if (rst_gpio.index == UINT_MAX)
44
+ return NULL;
45
+
46
return &rst_gpio;
47
}
48
49
struct bl_aux_gpio_info *plat_get_rockchip_gpio_poweroff(void)
50
{
51
+ if (poweroff_gpio.index == UINT_MAX)
52
+ return NULL;
53
+
54
return &poweroff_gpio;
55
}
56
57
58