summaryrefslogtreecommitdiff
path: root/board/rockchip
diff options
context:
space:
mode:
authorAndy Yan <andy.yan@rock-chips.com>2019-11-14 11:21:15 +0800
committerKever Yang <kever.yang@rock-chips.com>2019-11-17 17:22:53 +0800
commit9e3de722e4967100306cb5e074e3984a03539ee9 (patch)
tree8ac3572895fc05aa4df9b888d440fe43ba7b7f4b /board/rockchip
parent22dcd281506912a3605f1a797a99cd29bf4e1976 (diff)
board: rockchip: Add rk3308 evb support
Add support for rk3308 evaluation board. Signed-off-by: Andy Yan <andy.yan@rock-chips.com> Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Diffstat (limited to 'board/rockchip')
-rw-r--r--board/rockchip/evb_rk3308/Kconfig15
-rw-r--r--board/rockchip/evb_rk3308/MAINTAINERS6
-rw-r--r--board/rockchip/evb_rk3308/Makefile7
-rw-r--r--board/rockchip/evb_rk3308/evb_rk3308.c44
4 files changed, 72 insertions, 0 deletions
diff --git a/board/rockchip/evb_rk3308/Kconfig b/board/rockchip/evb_rk3308/Kconfig
new file mode 100644
index 0000000000..0074429cb6
--- /dev/null
+++ b/board/rockchip/evb_rk3308/Kconfig
@@ -0,0 +1,15 @@
+if TARGET_EVB_RK3308
+
+config SYS_BOARD
+ default "evb_rk3308"
+
+config SYS_VENDOR
+ default "rockchip"
+
+config SYS_CONFIG_NAME
+ default "evb_rk3308"
+
+config BOARD_SPECIFIC_OPTIONS # dummy
+ def_bool y
+
+endif
diff --git a/board/rockchip/evb_rk3308/MAINTAINERS b/board/rockchip/evb_rk3308/MAINTAINERS
new file mode 100644
index 0000000000..0af119ae0a
--- /dev/null
+++ b/board/rockchip/evb_rk3308/MAINTAINERS
@@ -0,0 +1,6 @@
+EVB-RK3308
+M: Andy Yan <andy.yan@rock-chips.com>
+S: Maintained
+F: board/rockchip/evb_rk3308
+F: include/configs/evb_rk3308.h
+F: configs/evb-rk3308_defconfig
diff --git a/board/rockchip/evb_rk3308/Makefile b/board/rockchip/evb_rk3308/Makefile
new file mode 100644
index 0000000000..05de5560f1
--- /dev/null
+++ b/board/rockchip/evb_rk3308/Makefile
@@ -0,0 +1,7 @@
+#
+# (C) Copyright 2018 Rockchip Electronics Co., Ltd
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+obj-y += evb_rk3308.o
diff --git a/board/rockchip/evb_rk3308/evb_rk3308.c b/board/rockchip/evb_rk3308/evb_rk3308.c
new file mode 100644
index 0000000000..180f1fe4f0
--- /dev/null
+++ b/board/rockchip/evb_rk3308/evb_rk3308.c
@@ -0,0 +1,44 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2018 Rockchip Electronics Co., Ltd
+ */
+
+#include <common.h>
+#include <adc.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#define KEY_DOWN_MIN_VAL 0
+#define KEY_DOWN_MAX_VAL 30
+
+/*
+ * Two board variants whith adc channel 3 is for board id
+ * v10: 1024, v11: 512
+ * v10: adc channel 0 for dnl key
+ * v11: adc channel 1 for dnl key
+ */
+int rockchip_dnl_key_pressed(void)
+{
+ unsigned int key_val, id_val;
+ int key_ch;
+
+ if (adc_channel_single_shot("saradc", 3, &id_val)) {
+ printf("%s read board id failed\n", __func__);
+ return false;
+ }
+
+ if (abs(id_val - 1024) <= 30)
+ key_ch = 0;
+ else
+ key_ch = 1;
+
+ if (adc_channel_single_shot("saradc", key_ch, &key_val)) {
+ printf("%s read adc key val failed\n", __func__);
+ return false;
+ }
+
+ if (key_val >= KEY_DOWN_MIN_VAL && key_val <= KEY_DOWN_MAX_VAL)
+ return true;
+ else
+ return false;
+}