Add Odroid HC4 to mainline kernel (#2319)
* Add Odroid HC4 to mainline kernel - remove legacy target - add reset / power off support - change HC4 from .wip -> .conf - adjust patches * Enable HC4 legacy kernel too. * Add groovy target for HC4 * Adjust targets
This commit is contained in:
parent
699194b129
commit
f2756e3b59
@ -2,7 +2,7 @@
|
||||
BOARD_NAME="Odroid HC4"
|
||||
BOARDFAMILY="meson-sm1"
|
||||
BOOTCONFIG="odroid-c4_defconfig"
|
||||
KERNEL_TARGET="legacy"
|
||||
KERNEL_TARGET="legacy,current,dev"
|
||||
FULL_DESKTOP="no"
|
||||
SERIALCON="ttyAML0"
|
||||
BOOT_FDT_FILE="amlogic/meson64_odroidhc4.dtb
|
||||
BOOT_FDT_FILE="amlogic/meson-sm1-odroid-hc4.dtb"
|
||||
@ -4072,6 +4072,7 @@ CONFIG_POWER_AVS=y
|
||||
CONFIG_QCOM_CPR=m
|
||||
CONFIG_ROCKCHIP_IODOMAIN=m
|
||||
CONFIG_POWER_RESET=y
|
||||
CONFIG_POWER_RESET_ODROID=y
|
||||
# CONFIG_POWER_RESET_AS3722 is not set
|
||||
CONFIG_POWER_RESET_BRCMSTB=y
|
||||
# CONFIG_POWER_RESET_GPIO is not set
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#
|
||||
# Automatically generated file; DO NOT EDIT.
|
||||
# Linux/arm64 5.9.1 Kernel Configuration
|
||||
# Linux/arm64 5.9.6 Kernel Configuration
|
||||
#
|
||||
CONFIG_CC_VERSION_TEXT="aarch64-none-linux-gnu-gcc (GNU Toolchain for the A-profile Architecture 9.2-2019.12 (arm-9.10)) 9.2.1 20191025"
|
||||
CONFIG_CC_IS_GCC=y
|
||||
@ -4072,6 +4072,7 @@ CONFIG_POWER_AVS=y
|
||||
CONFIG_QCOM_CPR=m
|
||||
CONFIG_ROCKCHIP_IODOMAIN=m
|
||||
CONFIG_POWER_RESET=y
|
||||
CONFIG_POWER_RESET_ODROID=y
|
||||
# CONFIG_POWER_RESET_AS3722 is not set
|
||||
CONFIG_POWER_RESET_BRCMSTB=y
|
||||
# CONFIG_POWER_RESET_GPIO is not set
|
||||
@ -8574,6 +8575,7 @@ CONFIG_NFSD_PNFS=y
|
||||
CONFIG_NFSD_BLOCKLAYOUT=y
|
||||
CONFIG_NFSD_SCSILAYOUT=y
|
||||
CONFIG_NFSD_FLEXFILELAYOUT=y
|
||||
# CONFIG_NFSD_V4_2_INTER_SSC is not set
|
||||
CONFIG_NFSD_V4_SECURITY_LABEL=y
|
||||
CONFIG_GRACE_PERIOD=m
|
||||
CONFIG_LOCKD=m
|
||||
@ -9377,6 +9379,7 @@ CONFIG_BITS_TEST=m
|
||||
CONFIG_TEST_MEMCAT_P=m
|
||||
CONFIG_TEST_STACKINIT=m
|
||||
# CONFIG_TEST_MEMINIT is not set
|
||||
CONFIG_TEST_FREE_PAGES=m
|
||||
CONFIG_MEMTEST=y
|
||||
# end of Kernel Testing and Coverage
|
||||
# end of Kernel hacking
|
||||
|
||||
@ -41,7 +41,7 @@ family_tweaks()
|
||||
|
||||
uboot_custom_postprocess()
|
||||
{
|
||||
if [[ $BOARD == odroidc4 && $BRANCH != legacy ]]; then
|
||||
if [[ $BOARD == odroid*c4 && $BRANCH != legacy ]]; then
|
||||
uboot_g12_postprocess $SRC/cache/sources/amlogic-boot-fip/odroid-c4 g12a
|
||||
fi
|
||||
}
|
||||
|
||||
@ -465,14 +465,18 @@ odroidn2 current focal cli beta yes
|
||||
|
||||
# Odroid C4
|
||||
|
||||
odroidc4 legacy focal cli stable yes
|
||||
odroidc4 legacy focal desktop stable yes
|
||||
odroidc4 current focal desktop stable yes
|
||||
odroidc4 current buster cli stable yes
|
||||
odroidc4 current buster desktop stable yes
|
||||
odroidc4 current bionic desktop stable yes
|
||||
odroidc4 current bullseye cli stable yes
|
||||
odroidc4 current focal cli stable yes
|
||||
odroidc4 current focal cli beta yes
|
||||
odroidc4 current groovy cli stable yes
|
||||
|
||||
# Odroid HC4
|
||||
odroidhc4 legacy focal cli stable yes
|
||||
odroidhc4 current buster cli stable yes
|
||||
odroidhc4 current focal cli stable yes
|
||||
odroidhc4 current groovy cli stable yes
|
||||
|
||||
# Odroid XU4
|
||||
|
||||
|
||||
@ -0,0 +1,36 @@
|
||||
From 102c1ce21859266e526879428c9d7c5946b7477c Mon Sep 17 00:00:00 2001
|
||||
From: Dongjin Kim <tobetter@gmail.com>
|
||||
Date: Fri, 24 Apr 2020 14:44:06 +0200
|
||||
Subject: [PATCH 10/75] arm64: dts: meson-sm1: add support for Hardkernel
|
||||
ODROID-C4
|
||||
|
||||
Add the board support for the Hardkernel Odroid-C4 single board computer.
|
||||
|
||||
The Odroid-C4 is the Odroid-C2 successor with same form factor, but using
|
||||
a modern Amlogic S905X3 (SM1) SoC and 4x USB3 ports.
|
||||
|
||||
Signed-off-by: Dongjin Kim <tobetter@gmail.com>
|
||||
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Tested-by: Christian Hewitt <christianshewitt@gmail.com>
|
||||
---
|
||||
arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts
|
||||
index cf5a98f0e47c..e1fe6138b6c0 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts
|
||||
@@ -286,6 +286,10 @@ external_phy: ethernet-phy@0 {
|
||||
reg = <0>;
|
||||
max-speed = <1000>;
|
||||
|
||||
+ reset-assert-us = <10000>;
|
||||
+ reset-deassert-us = <30000>;
|
||||
+ reset-gpios = <&gpio GPIOZ_15 (GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN)>;
|
||||
+
|
||||
interrupt-parent = <&gpio_intc>;
|
||||
/* MAC_INTR on GPIOZ_14 */
|
||||
interrupts = <26 IRQ_TYPE_LEVEL_LOW>;
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@ -0,0 +1,77 @@
|
||||
From 913a27622881566eeb70336f72f6d40e0598119b Mon Sep 17 00:00:00 2001
|
||||
From: Dongjin Kim <tobetter@gmail.com>
|
||||
Date: Thu, 10 Sep 2020 11:01:33 +0900
|
||||
Subject: [PATCH 68/75] ODROID-COMMON: gpu/drm: add new display resolution
|
||||
2560x1440
|
||||
|
||||
Signed-off-by: Joy Cho <joy.cho@hardkernel.com>
|
||||
Signed-off-by: Dongjin Kim <tobetter@gmail.com>
|
||||
---
|
||||
drivers/gpu/drm/meson/meson_vclk.c | 18 ++++++++++++++++++
|
||||
drivers/gpu/drm/meson/meson_venc.c | 5 +++--
|
||||
2 files changed, 21 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/drivers/gpu/drm/meson/meson_vclk.c b/drivers/gpu/drm/meson/meson_vclk.c
|
||||
index 0eb86943a358..e734d1be553d 100644
|
||||
--- a/drivers/gpu/drm/meson/meson_vclk.c
|
||||
+++ b/drivers/gpu/drm/meson/meson_vclk.c
|
||||
@@ -357,6 +357,8 @@ enum {
|
||||
MESON_VCLK_HDMI_594000,
|
||||
/* 2970 /1 /1 /1 /5 /1 => /1 /2 */
|
||||
MESON_VCLK_HDMI_594000_YUV420,
|
||||
+/* 4830 /2 /1 /2 /5 /1 => /1 /1 */
|
||||
+ MESON_VCLK_HDMI_241500,
|
||||
};
|
||||
|
||||
struct meson_vclk_params {
|
||||
@@ -467,6 +469,18 @@ struct meson_vclk_params {
|
||||
.vid_pll_div = VID_PLL_DIV_5,
|
||||
.vclk_div = 1,
|
||||
},
|
||||
+ [MESON_VCLK_HDMI_241500] = {
|
||||
+ .pll_freq = 4830000,
|
||||
+ .phy_freq = 2415000,
|
||||
+ .venc_freq = 241500,
|
||||
+ .vclk_freq = 241500,
|
||||
+ .pixel_freq = 241500,
|
||||
+ .pll_od1 = 2,
|
||||
+ .pll_od2 = 1,
|
||||
+ .pll_od3 = 2,
|
||||
+ .vid_pll_div = VID_PLL_DIV_5,
|
||||
+ .vclk_div = 1,
|
||||
+ },
|
||||
{ /* sentinel */ },
|
||||
};
|
||||
|
||||
@@ -873,6 +887,10 @@ static void meson_vclk_set(struct meson_drm *priv, unsigned int pll_base_freq,
|
||||
m = 0xf7;
|
||||
frac = vic_alternate_clock ? 0x8148 : 0x10000;
|
||||
break;
|
||||
+ case 4830000:
|
||||
+ m = 0xc9;
|
||||
+ frac = 0xd560;
|
||||
+ break;
|
||||
}
|
||||
|
||||
meson_hdmi_pll_set_params(priv, m, frac, od1, od2, od3);
|
||||
diff --git a/drivers/gpu/drm/meson/meson_venc.c b/drivers/gpu/drm/meson/meson_venc.c
|
||||
index f93c725b6f02..ebe4f2a92fe0 100644
|
||||
--- a/drivers/gpu/drm/meson/meson_venc.c
|
||||
+++ b/drivers/gpu/drm/meson/meson_venc.c
|
||||
@@ -866,10 +866,11 @@ meson_venc_hdmi_supported_mode(const struct drm_display_mode *mode)
|
||||
DRM_MODE_FLAG_PVSYNC | DRM_MODE_FLAG_NVSYNC))
|
||||
return MODE_BAD;
|
||||
|
||||
- if (mode->hdisplay < 640 || mode->hdisplay > 1920)
|
||||
+ /* support higher resolution than 1920x1080 */
|
||||
+ if (mode->hdisplay < 640 || mode->hdisplay > 2560)
|
||||
return MODE_BAD_HVALUE;
|
||||
|
||||
- if (mode->vdisplay < 480 || mode->vdisplay > 1200)
|
||||
+ if (mode->vdisplay < 480 || mode->vdisplay > 1600)
|
||||
return MODE_BAD_VVALUE;
|
||||
|
||||
return MODE_OK;
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@ -0,0 +1,88 @@
|
||||
Add Odroid HC4
|
||||
---
|
||||
arch/arm64/boot/dts/amlogic/Makefile | 2 +
|
||||
.../boot/dts/amlogic/meson-sm1-odroid-hc4.dts | 59 +++++++++++++++++++
|
||||
.../boot/dts/amlogic/meson64_odroidhc4.dts | 28 +++++++++
|
||||
3 files changed, 89 insertions(+)
|
||||
create mode 100644 arch/arm64/boot/dts/amlogic/meson-sm1-odroid-hc4.dts
|
||||
create mode 100644 arch/arm64/boot/dts/amlogic/meson64_odroidhc4.dts
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/Makefile b/arch/arm64/boot/dts/amlogic/Makefile
|
||||
index 134389a09ba5..059e5187d223 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/Makefile
|
||||
+++ b/arch/arm64/boot/dts/amlogic/Makefile
|
||||
@@ -47,5 +47,6 @@ dtb-$(CONFIG_ARCH_MESON) += meson-gxm-wetek-core2.dtb
|
||||
dtb-$(CONFIG_ARCH_MESON) += meson-sm1-sei610.dtb
|
||||
dtb-$(CONFIG_ARCH_MESON) += meson-sm1-khadas-vim3l.dtb
|
||||
dtb-$(CONFIG_ARCH_MESON) += meson-sm1-odroid-c4.dtb
|
||||
+dtb-$(CONFIG_ARCH_MESON) += meson-sm1-odroid-hc4.dtb
|
||||
dtb-$(CONFIG_ARCH_MESON) += meson-a1-ad401.dtb
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-hc4.dts b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-hc4.dts
|
||||
new file mode 100644
|
||||
index 000000000000..92987fece80e
|
||||
--- /dev/null
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-hc4.dts
|
||||
@@ -0,0 +1,59 @@
|
||||
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
|
||||
+/*
|
||||
+ * Copyright (c) 2020 Dongjin Kim <tobetter@gmail.com>
|
||||
+ */
|
||||
+
|
||||
+/dts-v1/;
|
||||
+
|
||||
+#include "meson-sm1-odroid-c4.dts"
|
||||
+
|
||||
+/ {
|
||||
+ model = "Hardkernel ODROID-HC4";
|
||||
+
|
||||
+ fan0: pwm-fan {
|
||||
+ compatible = "pwm-fan";
|
||||
+ #cooling-cells = <2>;
|
||||
+ cooling-min-state = <0>;
|
||||
+ cooling-max-state = <3>;
|
||||
+ cooling-levels = <0 120 170 220>;
|
||||
+ pwms = <&pwm_cd 1 40000 0>;
|
||||
+ fan-supply = <&vcc_5v>;
|
||||
+ interrupt-parent = <&gpio_intc>;
|
||||
+ interrupts = <84 IRQ_TYPE_EDGE_FALLING>;
|
||||
+ pulses-per-revolutions = <2>;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&cpu_thermal {
|
||||
+ cooling-maps {
|
||||
+ map {
|
||||
+ trip = <&cpu_passive>;
|
||||
+ cooling-device = <&fan0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&gpio {
|
||||
+ /delete-node/ usb-hub;
|
||||
+};
|
||||
+
|
||||
+&hub_5v {
|
||||
+ /delete-property/ gpio;
|
||||
+ /delete-property/ enable-active-high;
|
||||
+};
|
||||
+
|
||||
+&pcie {
|
||||
+ reset-gpios = <&gpio GPIOH_4 GPIO_ACTIVE_LOW>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&pwm_cd {
|
||||
+ status = "okay";
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&pwm_d_x6_pins>;
|
||||
+};
|
||||
+
|
||||
+&usb {
|
||||
+ phys = <&usb2_phy0>, <&usb2_phy1>;
|
||||
+ phy-names = "usb2-phy0", "usb2-phy1";
|
||||
+};
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@ -0,0 +1,232 @@
|
||||
From 8ccd5a823674a1c8542ebd84b09a78a1f0d5ad98 Mon Sep 17 00:00:00 2001
|
||||
From: ckkim <changkon12@gmail.com>
|
||||
Date: Tue, 6 Oct 2020 17:37:40 +0900
|
||||
Subject: [PATCH 73/75] ODROID-COMMON: power:reset: Add odroid support
|
||||
|
||||
Signed-off-by: ckkim <changkon12@gmail.com>
|
||||
Change-Id: I71955f76e5dbe0adb53a7cd62e747342c580209f
|
||||
---
|
||||
drivers/power/reset/Kconfig | 7 ++
|
||||
drivers/power/reset/Makefile | 1 +
|
||||
drivers/power/reset/odroid-reboot.c | 181 ++++++++++++++++++++++++++++
|
||||
3 files changed, 189 insertions(+)
|
||||
create mode 100644 drivers/power/reset/odroid-reboot.c
|
||||
|
||||
diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig
|
||||
index d55b3727e00e..e0807b456cb2 100644
|
||||
--- a/drivers/power/reset/Kconfig
|
||||
+++ b/drivers/power/reset/Kconfig
|
||||
@@ -9,6 +9,13 @@ menuconfig POWER_RESET
|
||||
|
||||
if POWER_RESET
|
||||
|
||||
+config POWER_RESET_ODROID
|
||||
+ bool "odroid reboot/power-off driver"
|
||||
+ depends on ARCH_MESON
|
||||
+ help
|
||||
+ This driver supports restart / power off board for amlogic
|
||||
+ g12a/g12b/sm1 SoCs
|
||||
+
|
||||
config POWER_RESET_AS3722
|
||||
bool "ams AS3722 power-off driver"
|
||||
depends on MFD_AS3722
|
||||
diff --git a/drivers/power/reset/Makefile b/drivers/power/reset/Makefile
|
||||
index c51eceba9ea3..c00146ac11d7 100644
|
||||
--- a/drivers/power/reset/Makefile
|
||||
+++ b/drivers/power/reset/Makefile
|
||||
@@ -1,4 +1,5 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
+obj-$(CONFIG_POWER_RESET_ODROID) += odroid-reboot.o
|
||||
obj-$(CONFIG_POWER_RESET_AS3722) += as3722-poweroff.o
|
||||
obj-$(CONFIG_POWER_RESET_AT91_POWEROFF) += at91-poweroff.o
|
||||
obj-$(CONFIG_POWER_RESET_AT91_RESET) += at91-reset.o
|
||||
diff --git a/drivers/power/reset/odroid-reboot.c b/drivers/power/reset/odroid-reboot.c
|
||||
new file mode 100644
|
||||
index 000000000000..68092141fbbb
|
||||
--- /dev/null
|
||||
+++ b/drivers/power/reset/odroid-reboot.c
|
||||
@@ -0,0 +1,181 @@
|
||||
+/*
|
||||
+ * drivers/power/reset/odroid-reboot.c
|
||||
+ *
|
||||
+ * Copyright (C) 2017 Amlogic, Inc. All rights reserved.
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or modify
|
||||
+ * it under the terms of the GNU General Public License as published by
|
||||
+ * the Free Software Foundation; either version 2 of the License, or
|
||||
+ * (at your option) any later version.
|
||||
+ *
|
||||
+ * This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
+ * more details.
|
||||
+ *
|
||||
+ */
|
||||
+
|
||||
+#include <linux/delay.h>
|
||||
+#include <linux/err.h>
|
||||
+#include <linux/init.h>
|
||||
+#include <linux/kernel.h>
|
||||
+#include <linux/io.h>
|
||||
+#include <linux/of.h>
|
||||
+#include <linux/platform_device.h>
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/reboot.h>
|
||||
+
|
||||
+#include <asm/system_misc.h>
|
||||
+
|
||||
+#include <asm/compiler.h>
|
||||
+#include <linux/kdebug.h>
|
||||
+#include <linux/arm-smccc.h>
|
||||
+
|
||||
+#include <linux/gpio.h>
|
||||
+#include <linux/of_gpio.h>
|
||||
+
|
||||
+int sd_vqsw;
|
||||
+int sd_vmmc;
|
||||
+int sd_vqen;
|
||||
+
|
||||
+static u32 psci_function_id_restart;
|
||||
+static u32 psci_function_id_poweroff;
|
||||
+
|
||||
+#define CHECK_RET(ret) { \
|
||||
+ if (ret) \
|
||||
+ pr_err("[%s] gpio op failed(%d) at line %d\n",\
|
||||
+ __func__, ret, __LINE__); \
|
||||
+}
|
||||
+
|
||||
+static noinline int __invoke_psci_fn_smc(u64 function_id, u64 arg0, u64 arg1,
|
||||
+ u64 arg2)
|
||||
+{
|
||||
+ struct arm_smccc_res res;
|
||||
+
|
||||
+ arm_smccc_smc((unsigned long)function_id,
|
||||
+ (unsigned long)arg0,
|
||||
+ (unsigned long)arg1,
|
||||
+ (unsigned long)arg2,
|
||||
+ 0, 0, 0, 0, &res);
|
||||
+ return res.a0;
|
||||
+}
|
||||
+
|
||||
+void odroid_card_reset(void)
|
||||
+{
|
||||
+ int ret = 0;
|
||||
+
|
||||
+ if ((sd_vqsw == 0) && (sd_vmmc == 0))
|
||||
+ return;
|
||||
+
|
||||
+ if (sd_vqen == 0) {
|
||||
+ gpio_free(sd_vqsw);
|
||||
+ gpio_free(sd_vmmc);
|
||||
+ ret = gpio_request_one(sd_vqsw,
|
||||
+ GPIOF_OUT_INIT_LOW, "REBOOT");
|
||||
+ CHECK_RET(ret);
|
||||
+ mdelay(10);
|
||||
+ ret = gpio_direction_output(sd_vqsw, 1);
|
||||
+ CHECK_RET(ret);
|
||||
+ ret = gpio_request_one(sd_vmmc,
|
||||
+ GPIOF_OUT_INIT_LOW, "REBOOT");
|
||||
+ CHECK_RET(ret);
|
||||
+ mdelay(10);
|
||||
+ ret = gpio_direction_output(sd_vqsw, 0);
|
||||
+ CHECK_RET(ret);
|
||||
+ ret = gpio_direction_output(sd_vmmc, 1);
|
||||
+ CHECK_RET(ret);
|
||||
+ mdelay(5);
|
||||
+ gpio_free(sd_vqsw);
|
||||
+ gpio_free(sd_vmmc);
|
||||
+ } else {
|
||||
+ gpio_free(sd_vqsw);
|
||||
+ gpio_free(sd_vqen);
|
||||
+ gpio_free(sd_vmmc);
|
||||
+
|
||||
+ ret = gpio_request_one(sd_vqsw,
|
||||
+ GPIOF_OUT_INIT_LOW, "REBOOT");
|
||||
+ CHECK_RET(ret);
|
||||
+ ret = gpio_request_one(sd_vqen,
|
||||
+ GPIOF_OUT_INIT_LOW, "REBOOT");
|
||||
+ CHECK_RET(ret);
|
||||
+ ret = gpio_request_one(sd_vmmc,
|
||||
+ GPIOF_OUT_INIT_LOW, "REBOOT");
|
||||
+ CHECK_RET(ret);
|
||||
+ mdelay(100);
|
||||
+ ret = gpio_direction_input(sd_vqen);
|
||||
+ CHECK_RET(ret);
|
||||
+ ret = gpio_direction_input(sd_vmmc);
|
||||
+ CHECK_RET(ret);
|
||||
+ ret = gpio_direction_input(sd_vqsw);
|
||||
+ CHECK_RET(ret);
|
||||
+ mdelay(5);
|
||||
+ gpio_free(sd_vqen);
|
||||
+ gpio_free(sd_vmmc);
|
||||
+ gpio_free(sd_vqsw);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static void do_odroid_restart(enum reboot_mode reboot_mode, const char *cmd)
|
||||
+{
|
||||
+ odroid_card_reset();
|
||||
+ __invoke_psci_fn_smc(psci_function_id_restart,
|
||||
+ 0, 0, 0);
|
||||
+}
|
||||
+
|
||||
+static void do_odroid_poweroff(void)
|
||||
+{
|
||||
+ odroid_card_reset();
|
||||
+
|
||||
+ __invoke_psci_fn_smc(0x82000042, 1, 0, 0);
|
||||
+ __invoke_psci_fn_smc(psci_function_id_poweroff,
|
||||
+ 0, 0, 0);
|
||||
+}
|
||||
+
|
||||
+static int odroid_restart_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct device_node *of_node;
|
||||
+ u32 id;
|
||||
+
|
||||
+ if (!of_property_read_u32(pdev->dev.of_node, "sys_reset", &id)) {
|
||||
+ psci_function_id_restart = id;
|
||||
+ arm_pm_restart = do_odroid_restart;
|
||||
+ }
|
||||
+
|
||||
+ if (!of_property_read_u32(pdev->dev.of_node, "sys_poweroff", &id)) {
|
||||
+ psci_function_id_poweroff = id;
|
||||
+ pm_power_off = do_odroid_poweroff;
|
||||
+ }
|
||||
+
|
||||
+ of_node = pdev->dev.of_node;
|
||||
+
|
||||
+ sd_vqsw = of_get_named_gpio(of_node, "sd-vqsw", 0);
|
||||
+ if (!gpio_is_valid(sd_vqsw)) sd_vqsw = 0;
|
||||
+
|
||||
+ sd_vmmc = of_get_named_gpio(of_node, "sd-vmmc", 0);
|
||||
+ if (!gpio_is_valid(sd_vmmc)) sd_vmmc = 0;
|
||||
+
|
||||
+ sd_vqen = of_get_named_gpio(of_node, "sd-vqen", 0);
|
||||
+ if (!gpio_is_valid(sd_vqen)) sd_vqen = 0;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct of_device_id of_odroid_restart_match[] = {
|
||||
+ { .compatible = "odroid,reboot", },
|
||||
+ {},
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(of, of_odroid_restart_match);
|
||||
+
|
||||
+static struct platform_driver odroid_restart_driver = {
|
||||
+ .probe = odroid_restart_probe,
|
||||
+ .driver = {
|
||||
+ .name = "odroid-restart",
|
||||
+ .of_match_table = of_match_ptr(of_odroid_restart_match),
|
||||
+ },
|
||||
+};
|
||||
+
|
||||
+static int __init odroid_restart_init(void)
|
||||
+{
|
||||
+ return platform_driver_register(&odroid_restart_driver);
|
||||
+}
|
||||
+device_initcall(odroid_restart_init);
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@ -0,0 +1,36 @@
|
||||
From 090381e6bb3063bf9d9c7a4d103d03505c655559 Mon Sep 17 00:00:00 2001
|
||||
From: ckkim <changkon12@gmail.com>
|
||||
Date: Tue, 6 Oct 2020 17:49:18 +0900
|
||||
Subject: [PATCH 74/75] ODROID-C4: arm64:dts: reboot / power off support for
|
||||
ODROID-C4
|
||||
|
||||
Signed-off-by: ckkim <changkon12@gmail.com>
|
||||
Change-Id: I22316a4ab896a0d8511d2cb2c34ac00360bb44d1
|
||||
---
|
||||
arch/arm64/boot/dts/amlogic/meson64_odroidc4.dts | 10 ++++++++++
|
||||
1 file changed, 10 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson64_odroidc4.dts b/arch/arm64/boot/dts/amlogic/meson64_odroidc4.dts
|
||||
index 761702fc2170..ff1296a94be2 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts
|
||||
@@ -9,6 +9,16 @@
|
||||
/ {
|
||||
compatible = "hardkernel,odroid-c4", "amlogic,sm1";
|
||||
model = "Hardkernel ODROID-C4";
|
||||
+
|
||||
+ odroid-reboot {
|
||||
+ compatible = "odroid,reboot";
|
||||
+ sys_reset = <0x84000009>;
|
||||
+ sys_poweroff = <0x84000008>;
|
||||
+
|
||||
+ sd-vqen = <&gpio_ao GPIOE_2 GPIO_ACTIVE_HIGH>;
|
||||
+ sd-vqsw = <&gpio_ao GPIOAO_6 GPIO_ACTIVE_HIGH>;
|
||||
+ sd-vmmc = <&gpio_ao GPIOAO_3 GPIO_ACTIVE_HIGH>;
|
||||
+ };
|
||||
|
||||
aliases {
|
||||
ethernet0 = ðmac;
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@ -0,0 +1,51 @@
|
||||
From 7ab821b3289f781553982e2cdc97d031e457bea0 Mon Sep 17 00:00:00 2001
|
||||
From: ckkim <changkon12@gmail.com>
|
||||
Date: Tue, 6 Oct 2020 18:37:25 +0900
|
||||
Subject: [PATCH 75/75] ODROID-N2: arm64:dts: reboot / power off support for
|
||||
ODROID-N2/N2Plus
|
||||
|
||||
Signed-off-by: ckkim <changkon12@gmail.com>
|
||||
Change-Id: I27adc0b9836823219d70a05375fa1327f830130d
|
||||
---
|
||||
arch/arm64/boot/dts/amlogic/meson64_odroidn2.dts | 9 +++++++++
|
||||
arch/arm64/boot/dts/amlogic/meson64_odroidn2_plus.dts | 4 ++++
|
||||
2 files changed, 13 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson64_odroidn2.dts b/arch/arm64/boot/dts/amlogic/meson64_odroidn2.dts
|
||||
index d7bbe52d92af..3f1a090be84c 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
|
||||
@@ -18,6 +18,15 @@
|
||||
compatible = "hardkernel,odroid-n2", "amlogic,s922x", "amlogic,g12b";
|
||||
model = "Hardkernel ODROID-N2";
|
||||
|
||||
+ reboot: odroid-reboot {
|
||||
+ compatible = "odroid,reboot";
|
||||
+ sys_reset = <0x84000009>;
|
||||
+ sys_poweroff = <0x84000008>;
|
||||
+
|
||||
+ sd-vqsw = <&gpio_ao GPIOAO_9 GPIO_ACTIVE_HIGH>;
|
||||
+ sd-vmmc = <&gpio_ao GPIOAO_8 GPIO_ACTIVE_HIGH>;
|
||||
+ };
|
||||
+
|
||||
aliases {
|
||||
ethernet0 = ðmac;
|
||||
i2c0 = &i2c2;
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson64_odroidn2_plus.dts b/arch/arm64/boot/dts/amlogic/meson64_odroidn2_plus.dts
|
||||
index 8dc68eee628d..1f3ed5f03c68 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2-plus.dts
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2-plus.dts
|
||||
@@ -12,6 +12,10 @@ / {
|
||||
model = "Hardkernel ODROID-N2Plus";
|
||||
};
|
||||
|
||||
+&reboot {
|
||||
+ sd-vqen = <&gpio_ao GPIOAO_3 GPIO_ACTIVE_HIGH>;
|
||||
+};
|
||||
+
|
||||
&vddcpu_a {
|
||||
regulator-min-microvolt = <680000>;
|
||||
regulator-max-microvolt = <1040000>;
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@ -0,0 +1,36 @@
|
||||
From 102c1ce21859266e526879428c9d7c5946b7477c Mon Sep 17 00:00:00 2001
|
||||
From: Dongjin Kim <tobetter@gmail.com>
|
||||
Date: Fri, 24 Apr 2020 14:44:06 +0200
|
||||
Subject: [PATCH 10/75] arm64: dts: meson-sm1: add support for Hardkernel
|
||||
ODROID-C4
|
||||
|
||||
Add the board support for the Hardkernel Odroid-C4 single board computer.
|
||||
|
||||
The Odroid-C4 is the Odroid-C2 successor with same form factor, but using
|
||||
a modern Amlogic S905X3 (SM1) SoC and 4x USB3 ports.
|
||||
|
||||
Signed-off-by: Dongjin Kim <tobetter@gmail.com>
|
||||
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Tested-by: Christian Hewitt <christianshewitt@gmail.com>
|
||||
---
|
||||
arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts
|
||||
index cf5a98f0e47c..e1fe6138b6c0 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts
|
||||
@@ -286,6 +286,10 @@ external_phy: ethernet-phy@0 {
|
||||
reg = <0>;
|
||||
max-speed = <1000>;
|
||||
|
||||
+ reset-assert-us = <10000>;
|
||||
+ reset-deassert-us = <30000>;
|
||||
+ reset-gpios = <&gpio GPIOZ_15 (GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN)>;
|
||||
+
|
||||
interrupt-parent = <&gpio_intc>;
|
||||
/* MAC_INTR on GPIOZ_14 */
|
||||
interrupts = <26 IRQ_TYPE_LEVEL_LOW>;
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@ -0,0 +1,77 @@
|
||||
From 913a27622881566eeb70336f72f6d40e0598119b Mon Sep 17 00:00:00 2001
|
||||
From: Dongjin Kim <tobetter@gmail.com>
|
||||
Date: Thu, 10 Sep 2020 11:01:33 +0900
|
||||
Subject: [PATCH 68/75] ODROID-COMMON: gpu/drm: add new display resolution
|
||||
2560x1440
|
||||
|
||||
Signed-off-by: Joy Cho <joy.cho@hardkernel.com>
|
||||
Signed-off-by: Dongjin Kim <tobetter@gmail.com>
|
||||
---
|
||||
drivers/gpu/drm/meson/meson_vclk.c | 18 ++++++++++++++++++
|
||||
drivers/gpu/drm/meson/meson_venc.c | 5 +++--
|
||||
2 files changed, 21 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/drivers/gpu/drm/meson/meson_vclk.c b/drivers/gpu/drm/meson/meson_vclk.c
|
||||
index 0eb86943a358..e734d1be553d 100644
|
||||
--- a/drivers/gpu/drm/meson/meson_vclk.c
|
||||
+++ b/drivers/gpu/drm/meson/meson_vclk.c
|
||||
@@ -357,6 +357,8 @@ enum {
|
||||
MESON_VCLK_HDMI_594000,
|
||||
/* 2970 /1 /1 /1 /5 /1 => /1 /2 */
|
||||
MESON_VCLK_HDMI_594000_YUV420,
|
||||
+/* 4830 /2 /1 /2 /5 /1 => /1 /1 */
|
||||
+ MESON_VCLK_HDMI_241500,
|
||||
};
|
||||
|
||||
struct meson_vclk_params {
|
||||
@@ -467,6 +469,18 @@ struct meson_vclk_params {
|
||||
.vid_pll_div = VID_PLL_DIV_5,
|
||||
.vclk_div = 1,
|
||||
},
|
||||
+ [MESON_VCLK_HDMI_241500] = {
|
||||
+ .pll_freq = 4830000,
|
||||
+ .phy_freq = 2415000,
|
||||
+ .venc_freq = 241500,
|
||||
+ .vclk_freq = 241500,
|
||||
+ .pixel_freq = 241500,
|
||||
+ .pll_od1 = 2,
|
||||
+ .pll_od2 = 1,
|
||||
+ .pll_od3 = 2,
|
||||
+ .vid_pll_div = VID_PLL_DIV_5,
|
||||
+ .vclk_div = 1,
|
||||
+ },
|
||||
{ /* sentinel */ },
|
||||
};
|
||||
|
||||
@@ -873,6 +887,10 @@ static void meson_vclk_set(struct meson_drm *priv, unsigned int pll_base_freq,
|
||||
m = 0xf7;
|
||||
frac = vic_alternate_clock ? 0x8148 : 0x10000;
|
||||
break;
|
||||
+ case 4830000:
|
||||
+ m = 0xc9;
|
||||
+ frac = 0xd560;
|
||||
+ break;
|
||||
}
|
||||
|
||||
meson_hdmi_pll_set_params(priv, m, frac, od1, od2, od3);
|
||||
diff --git a/drivers/gpu/drm/meson/meson_venc.c b/drivers/gpu/drm/meson/meson_venc.c
|
||||
index f93c725b6f02..ebe4f2a92fe0 100644
|
||||
--- a/drivers/gpu/drm/meson/meson_venc.c
|
||||
+++ b/drivers/gpu/drm/meson/meson_venc.c
|
||||
@@ -866,10 +866,11 @@ meson_venc_hdmi_supported_mode(const struct drm_display_mode *mode)
|
||||
DRM_MODE_FLAG_PVSYNC | DRM_MODE_FLAG_NVSYNC))
|
||||
return MODE_BAD;
|
||||
|
||||
- if (mode->hdisplay < 640 || mode->hdisplay > 1920)
|
||||
+ /* support higher resolution than 1920x1080 */
|
||||
+ if (mode->hdisplay < 640 || mode->hdisplay > 2560)
|
||||
return MODE_BAD_HVALUE;
|
||||
|
||||
- if (mode->vdisplay < 480 || mode->vdisplay > 1200)
|
||||
+ if (mode->vdisplay < 480 || mode->vdisplay > 1600)
|
||||
return MODE_BAD_VVALUE;
|
||||
|
||||
return MODE_OK;
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@ -0,0 +1,88 @@
|
||||
Add Odroid HC4
|
||||
---
|
||||
arch/arm64/boot/dts/amlogic/Makefile | 2 +
|
||||
.../boot/dts/amlogic/meson-sm1-odroid-hc4.dts | 59 +++++++++++++++++++
|
||||
.../boot/dts/amlogic/meson64_odroidhc4.dts | 28 +++++++++
|
||||
3 files changed, 89 insertions(+)
|
||||
create mode 100644 arch/arm64/boot/dts/amlogic/meson-sm1-odroid-hc4.dts
|
||||
create mode 100644 arch/arm64/boot/dts/amlogic/meson64_odroidhc4.dts
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/Makefile b/arch/arm64/boot/dts/amlogic/Makefile
|
||||
index 134389a09ba5..059e5187d223 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/Makefile
|
||||
+++ b/arch/arm64/boot/dts/amlogic/Makefile
|
||||
@@ -47,5 +47,6 @@ dtb-$(CONFIG_ARCH_MESON) += meson-gxm-wetek-core2.dtb
|
||||
dtb-$(CONFIG_ARCH_MESON) += meson-sm1-sei610.dtb
|
||||
dtb-$(CONFIG_ARCH_MESON) += meson-sm1-khadas-vim3l.dtb
|
||||
dtb-$(CONFIG_ARCH_MESON) += meson-sm1-odroid-c4.dtb
|
||||
+dtb-$(CONFIG_ARCH_MESON) += meson-sm1-odroid-hc4.dtb
|
||||
dtb-$(CONFIG_ARCH_MESON) += meson-a1-ad401.dtb
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-hc4.dts b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-hc4.dts
|
||||
new file mode 100644
|
||||
index 000000000000..92987fece80e
|
||||
--- /dev/null
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-hc4.dts
|
||||
@@ -0,0 +1,59 @@
|
||||
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
|
||||
+/*
|
||||
+ * Copyright (c) 2020 Dongjin Kim <tobetter@gmail.com>
|
||||
+ */
|
||||
+
|
||||
+/dts-v1/;
|
||||
+
|
||||
+#include "meson-sm1-odroid-c4.dts"
|
||||
+
|
||||
+/ {
|
||||
+ model = "Hardkernel ODROID-HC4";
|
||||
+
|
||||
+ fan0: pwm-fan {
|
||||
+ compatible = "pwm-fan";
|
||||
+ #cooling-cells = <2>;
|
||||
+ cooling-min-state = <0>;
|
||||
+ cooling-max-state = <3>;
|
||||
+ cooling-levels = <0 120 170 220>;
|
||||
+ pwms = <&pwm_cd 1 40000 0>;
|
||||
+ fan-supply = <&vcc_5v>;
|
||||
+ interrupt-parent = <&gpio_intc>;
|
||||
+ interrupts = <84 IRQ_TYPE_EDGE_FALLING>;
|
||||
+ pulses-per-revolutions = <2>;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&cpu_thermal {
|
||||
+ cooling-maps {
|
||||
+ map {
|
||||
+ trip = <&cpu_passive>;
|
||||
+ cooling-device = <&fan0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&gpio {
|
||||
+ /delete-node/ usb-hub;
|
||||
+};
|
||||
+
|
||||
+&hub_5v {
|
||||
+ /delete-property/ gpio;
|
||||
+ /delete-property/ enable-active-high;
|
||||
+};
|
||||
+
|
||||
+&pcie {
|
||||
+ reset-gpios = <&gpio GPIOH_4 GPIO_ACTIVE_LOW>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&pwm_cd {
|
||||
+ status = "okay";
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&pwm_d_x6_pins>;
|
||||
+};
|
||||
+
|
||||
+&usb {
|
||||
+ phys = <&usb2_phy0>, <&usb2_phy1>;
|
||||
+ phy-names = "usb2-phy0", "usb2-phy1";
|
||||
+};
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@ -0,0 +1,232 @@
|
||||
From 8ccd5a823674a1c8542ebd84b09a78a1f0d5ad98 Mon Sep 17 00:00:00 2001
|
||||
From: ckkim <changkon12@gmail.com>
|
||||
Date: Tue, 6 Oct 2020 17:37:40 +0900
|
||||
Subject: [PATCH 73/75] ODROID-COMMON: power:reset: Add odroid support
|
||||
|
||||
Signed-off-by: ckkim <changkon12@gmail.com>
|
||||
Change-Id: I71955f76e5dbe0adb53a7cd62e747342c580209f
|
||||
---
|
||||
drivers/power/reset/Kconfig | 7 ++
|
||||
drivers/power/reset/Makefile | 1 +
|
||||
drivers/power/reset/odroid-reboot.c | 181 ++++++++++++++++++++++++++++
|
||||
3 files changed, 189 insertions(+)
|
||||
create mode 100644 drivers/power/reset/odroid-reboot.c
|
||||
|
||||
diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig
|
||||
index d55b3727e00e..e0807b456cb2 100644
|
||||
--- a/drivers/power/reset/Kconfig
|
||||
+++ b/drivers/power/reset/Kconfig
|
||||
@@ -9,6 +9,13 @@ menuconfig POWER_RESET
|
||||
|
||||
if POWER_RESET
|
||||
|
||||
+config POWER_RESET_ODROID
|
||||
+ bool "odroid reboot/power-off driver"
|
||||
+ depends on ARCH_MESON
|
||||
+ help
|
||||
+ This driver supports restart / power off board for amlogic
|
||||
+ g12a/g12b/sm1 SoCs
|
||||
+
|
||||
config POWER_RESET_AS3722
|
||||
bool "ams AS3722 power-off driver"
|
||||
depends on MFD_AS3722
|
||||
diff --git a/drivers/power/reset/Makefile b/drivers/power/reset/Makefile
|
||||
index c51eceba9ea3..c00146ac11d7 100644
|
||||
--- a/drivers/power/reset/Makefile
|
||||
+++ b/drivers/power/reset/Makefile
|
||||
@@ -1,4 +1,5 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
+obj-$(CONFIG_POWER_RESET_ODROID) += odroid-reboot.o
|
||||
obj-$(CONFIG_POWER_RESET_AS3722) += as3722-poweroff.o
|
||||
obj-$(CONFIG_POWER_RESET_AT91_POWEROFF) += at91-poweroff.o
|
||||
obj-$(CONFIG_POWER_RESET_AT91_RESET) += at91-reset.o
|
||||
diff --git a/drivers/power/reset/odroid-reboot.c b/drivers/power/reset/odroid-reboot.c
|
||||
new file mode 100644
|
||||
index 000000000000..68092141fbbb
|
||||
--- /dev/null
|
||||
+++ b/drivers/power/reset/odroid-reboot.c
|
||||
@@ -0,0 +1,181 @@
|
||||
+/*
|
||||
+ * drivers/power/reset/odroid-reboot.c
|
||||
+ *
|
||||
+ * Copyright (C) 2017 Amlogic, Inc. All rights reserved.
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or modify
|
||||
+ * it under the terms of the GNU General Public License as published by
|
||||
+ * the Free Software Foundation; either version 2 of the License, or
|
||||
+ * (at your option) any later version.
|
||||
+ *
|
||||
+ * This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
+ * more details.
|
||||
+ *
|
||||
+ */
|
||||
+
|
||||
+#include <linux/delay.h>
|
||||
+#include <linux/err.h>
|
||||
+#include <linux/init.h>
|
||||
+#include <linux/kernel.h>
|
||||
+#include <linux/io.h>
|
||||
+#include <linux/of.h>
|
||||
+#include <linux/platform_device.h>
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/reboot.h>
|
||||
+
|
||||
+#include <asm/system_misc.h>
|
||||
+
|
||||
+#include <asm/compiler.h>
|
||||
+#include <linux/kdebug.h>
|
||||
+#include <linux/arm-smccc.h>
|
||||
+
|
||||
+#include <linux/gpio.h>
|
||||
+#include <linux/of_gpio.h>
|
||||
+
|
||||
+int sd_vqsw;
|
||||
+int sd_vmmc;
|
||||
+int sd_vqen;
|
||||
+
|
||||
+static u32 psci_function_id_restart;
|
||||
+static u32 psci_function_id_poweroff;
|
||||
+
|
||||
+#define CHECK_RET(ret) { \
|
||||
+ if (ret) \
|
||||
+ pr_err("[%s] gpio op failed(%d) at line %d\n",\
|
||||
+ __func__, ret, __LINE__); \
|
||||
+}
|
||||
+
|
||||
+static noinline int __invoke_psci_fn_smc(u64 function_id, u64 arg0, u64 arg1,
|
||||
+ u64 arg2)
|
||||
+{
|
||||
+ struct arm_smccc_res res;
|
||||
+
|
||||
+ arm_smccc_smc((unsigned long)function_id,
|
||||
+ (unsigned long)arg0,
|
||||
+ (unsigned long)arg1,
|
||||
+ (unsigned long)arg2,
|
||||
+ 0, 0, 0, 0, &res);
|
||||
+ return res.a0;
|
||||
+}
|
||||
+
|
||||
+void odroid_card_reset(void)
|
||||
+{
|
||||
+ int ret = 0;
|
||||
+
|
||||
+ if ((sd_vqsw == 0) && (sd_vmmc == 0))
|
||||
+ return;
|
||||
+
|
||||
+ if (sd_vqen == 0) {
|
||||
+ gpio_free(sd_vqsw);
|
||||
+ gpio_free(sd_vmmc);
|
||||
+ ret = gpio_request_one(sd_vqsw,
|
||||
+ GPIOF_OUT_INIT_LOW, "REBOOT");
|
||||
+ CHECK_RET(ret);
|
||||
+ mdelay(10);
|
||||
+ ret = gpio_direction_output(sd_vqsw, 1);
|
||||
+ CHECK_RET(ret);
|
||||
+ ret = gpio_request_one(sd_vmmc,
|
||||
+ GPIOF_OUT_INIT_LOW, "REBOOT");
|
||||
+ CHECK_RET(ret);
|
||||
+ mdelay(10);
|
||||
+ ret = gpio_direction_output(sd_vqsw, 0);
|
||||
+ CHECK_RET(ret);
|
||||
+ ret = gpio_direction_output(sd_vmmc, 1);
|
||||
+ CHECK_RET(ret);
|
||||
+ mdelay(5);
|
||||
+ gpio_free(sd_vqsw);
|
||||
+ gpio_free(sd_vmmc);
|
||||
+ } else {
|
||||
+ gpio_free(sd_vqsw);
|
||||
+ gpio_free(sd_vqen);
|
||||
+ gpio_free(sd_vmmc);
|
||||
+
|
||||
+ ret = gpio_request_one(sd_vqsw,
|
||||
+ GPIOF_OUT_INIT_LOW, "REBOOT");
|
||||
+ CHECK_RET(ret);
|
||||
+ ret = gpio_request_one(sd_vqen,
|
||||
+ GPIOF_OUT_INIT_LOW, "REBOOT");
|
||||
+ CHECK_RET(ret);
|
||||
+ ret = gpio_request_one(sd_vmmc,
|
||||
+ GPIOF_OUT_INIT_LOW, "REBOOT");
|
||||
+ CHECK_RET(ret);
|
||||
+ mdelay(100);
|
||||
+ ret = gpio_direction_input(sd_vqen);
|
||||
+ CHECK_RET(ret);
|
||||
+ ret = gpio_direction_input(sd_vmmc);
|
||||
+ CHECK_RET(ret);
|
||||
+ ret = gpio_direction_input(sd_vqsw);
|
||||
+ CHECK_RET(ret);
|
||||
+ mdelay(5);
|
||||
+ gpio_free(sd_vqen);
|
||||
+ gpio_free(sd_vmmc);
|
||||
+ gpio_free(sd_vqsw);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static void do_odroid_restart(enum reboot_mode reboot_mode, const char *cmd)
|
||||
+{
|
||||
+ odroid_card_reset();
|
||||
+ __invoke_psci_fn_smc(psci_function_id_restart,
|
||||
+ 0, 0, 0);
|
||||
+}
|
||||
+
|
||||
+static void do_odroid_poweroff(void)
|
||||
+{
|
||||
+ odroid_card_reset();
|
||||
+
|
||||
+ __invoke_psci_fn_smc(0x82000042, 1, 0, 0);
|
||||
+ __invoke_psci_fn_smc(psci_function_id_poweroff,
|
||||
+ 0, 0, 0);
|
||||
+}
|
||||
+
|
||||
+static int odroid_restart_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct device_node *of_node;
|
||||
+ u32 id;
|
||||
+
|
||||
+ if (!of_property_read_u32(pdev->dev.of_node, "sys_reset", &id)) {
|
||||
+ psci_function_id_restart = id;
|
||||
+ arm_pm_restart = do_odroid_restart;
|
||||
+ }
|
||||
+
|
||||
+ if (!of_property_read_u32(pdev->dev.of_node, "sys_poweroff", &id)) {
|
||||
+ psci_function_id_poweroff = id;
|
||||
+ pm_power_off = do_odroid_poweroff;
|
||||
+ }
|
||||
+
|
||||
+ of_node = pdev->dev.of_node;
|
||||
+
|
||||
+ sd_vqsw = of_get_named_gpio(of_node, "sd-vqsw", 0);
|
||||
+ if (!gpio_is_valid(sd_vqsw)) sd_vqsw = 0;
|
||||
+
|
||||
+ sd_vmmc = of_get_named_gpio(of_node, "sd-vmmc", 0);
|
||||
+ if (!gpio_is_valid(sd_vmmc)) sd_vmmc = 0;
|
||||
+
|
||||
+ sd_vqen = of_get_named_gpio(of_node, "sd-vqen", 0);
|
||||
+ if (!gpio_is_valid(sd_vqen)) sd_vqen = 0;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct of_device_id of_odroid_restart_match[] = {
|
||||
+ { .compatible = "odroid,reboot", },
|
||||
+ {},
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(of, of_odroid_restart_match);
|
||||
+
|
||||
+static struct platform_driver odroid_restart_driver = {
|
||||
+ .probe = odroid_restart_probe,
|
||||
+ .driver = {
|
||||
+ .name = "odroid-restart",
|
||||
+ .of_match_table = of_match_ptr(of_odroid_restart_match),
|
||||
+ },
|
||||
+};
|
||||
+
|
||||
+static int __init odroid_restart_init(void)
|
||||
+{
|
||||
+ return platform_driver_register(&odroid_restart_driver);
|
||||
+}
|
||||
+device_initcall(odroid_restart_init);
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@ -0,0 +1,36 @@
|
||||
From 090381e6bb3063bf9d9c7a4d103d03505c655559 Mon Sep 17 00:00:00 2001
|
||||
From: ckkim <changkon12@gmail.com>
|
||||
Date: Tue, 6 Oct 2020 17:49:18 +0900
|
||||
Subject: [PATCH 74/75] ODROID-C4: arm64:dts: reboot / power off support for
|
||||
ODROID-C4
|
||||
|
||||
Signed-off-by: ckkim <changkon12@gmail.com>
|
||||
Change-Id: I22316a4ab896a0d8511d2cb2c34ac00360bb44d1
|
||||
---
|
||||
arch/arm64/boot/dts/amlogic/meson64_odroidc4.dts | 10 ++++++++++
|
||||
1 file changed, 10 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson64_odroidc4.dts b/arch/arm64/boot/dts/amlogic/meson64_odroidc4.dts
|
||||
index 761702fc2170..ff1296a94be2 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts
|
||||
@@ -9,6 +9,16 @@
|
||||
/ {
|
||||
compatible = "hardkernel,odroid-c4", "amlogic,sm1";
|
||||
model = "Hardkernel ODROID-C4";
|
||||
+
|
||||
+ odroid-reboot {
|
||||
+ compatible = "odroid,reboot";
|
||||
+ sys_reset = <0x84000009>;
|
||||
+ sys_poweroff = <0x84000008>;
|
||||
+
|
||||
+ sd-vqen = <&gpio_ao GPIOE_2 GPIO_ACTIVE_HIGH>;
|
||||
+ sd-vqsw = <&gpio_ao GPIOAO_6 GPIO_ACTIVE_HIGH>;
|
||||
+ sd-vmmc = <&gpio_ao GPIOAO_3 GPIO_ACTIVE_HIGH>;
|
||||
+ };
|
||||
|
||||
aliases {
|
||||
ethernet0 = ðmac;
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@ -0,0 +1,51 @@
|
||||
From 7ab821b3289f781553982e2cdc97d031e457bea0 Mon Sep 17 00:00:00 2001
|
||||
From: ckkim <changkon12@gmail.com>
|
||||
Date: Tue, 6 Oct 2020 18:37:25 +0900
|
||||
Subject: [PATCH 75/75] ODROID-N2: arm64:dts: reboot / power off support for
|
||||
ODROID-N2/N2Plus
|
||||
|
||||
Signed-off-by: ckkim <changkon12@gmail.com>
|
||||
Change-Id: I27adc0b9836823219d70a05375fa1327f830130d
|
||||
---
|
||||
arch/arm64/boot/dts/amlogic/meson64_odroidn2.dts | 9 +++++++++
|
||||
arch/arm64/boot/dts/amlogic/meson64_odroidn2_plus.dts | 4 ++++
|
||||
2 files changed, 13 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson64_odroidn2.dts b/arch/arm64/boot/dts/amlogic/meson64_odroidn2.dts
|
||||
index d7bbe52d92af..3f1a090be84c 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
|
||||
@@ -18,6 +18,15 @@
|
||||
compatible = "hardkernel,odroid-n2", "amlogic,s922x", "amlogic,g12b";
|
||||
model = "Hardkernel ODROID-N2";
|
||||
|
||||
+ reboot: odroid-reboot {
|
||||
+ compatible = "odroid,reboot";
|
||||
+ sys_reset = <0x84000009>;
|
||||
+ sys_poweroff = <0x84000008>;
|
||||
+
|
||||
+ sd-vqsw = <&gpio_ao GPIOAO_9 GPIO_ACTIVE_HIGH>;
|
||||
+ sd-vmmc = <&gpio_ao GPIOAO_8 GPIO_ACTIVE_HIGH>;
|
||||
+ };
|
||||
+
|
||||
aliases {
|
||||
ethernet0 = ðmac;
|
||||
i2c0 = &i2c2;
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson64_odroidn2_plus.dts b/arch/arm64/boot/dts/amlogic/meson64_odroidn2_plus.dts
|
||||
index 8dc68eee628d..1f3ed5f03c68 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2-plus.dts
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2-plus.dts
|
||||
@@ -12,6 +12,10 @@ / {
|
||||
model = "Hardkernel ODROID-N2Plus";
|
||||
};
|
||||
|
||||
+&reboot {
|
||||
+ sd-vqen = <&gpio_ao GPIOAO_3 GPIO_ACTIVE_HIGH>;
|
||||
+};
|
||||
+
|
||||
&vddcpu_a {
|
||||
regulator-min-microvolt = <680000>;
|
||||
regulator-max-microvolt = <1040000>;
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@ -26,7 +26,7 @@ index 6022805d2032..6d0163f56b0d 100644
|
||||
|
||||
led-white {
|
||||
- label = "vim3:white:sys";
|
||||
- gpios = <&gpio_ao GPIOAO_4 GPIO_ACTIVE_LOW>;
|
||||
- gpios = <&gpio_ao GPIOAO_4 GPIO_ACTIVE_HIGH>;
|
||||
- linux,default-trigger = "heartbeat";
|
||||
+ label = "vim3:white:power";
|
||||
+ gpios = <&gpio_ao GPIOAO_4 GPIO_ACTIVE_HIGH>;
|
||||
@ -35,7 +35,7 @@ index 6022805d2032..6d0163f56b0d 100644
|
||||
|
||||
led-red {
|
||||
label = "vim3:red";
|
||||
- gpios = <&gpio_expander 5 GPIO_ACTIVE_LOW>;
|
||||
- gpios = <&gpio_expander 5 GPIO_ACTIVE_HIGH>;
|
||||
+ gpios = <&gpio_expander 5 GPIO_ACTIVE_HIGH>;
|
||||
};
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user