mirror of
https://github.com/armbian/build
synced 2025-09-24 19:47:06 +07:00
Revert Meson64 / odroid fancontrol (#5617)
* Revert "packages: bsp: odroid: fanctrl: `maintenance`" This reverts commit94f7bfff89. * Revert "Improve Meson64 Support: `ODROID`" This reverts commit40530ee344.
This commit is contained in:
@@ -7,5 +7,3 @@ KERNEL_TARGET="current,edge"
|
||||
FULL_DESKTOP="yes"
|
||||
SERIALCON="ttyAML0"
|
||||
BOOT_LOGO="desktop"
|
||||
BOOTBRANCH_BOARD="tag:v2023.07.02"
|
||||
BOOTPATCHDIR="v2023.07.02"
|
||||
|
||||
@@ -6,10 +6,11 @@ KERNEL_TARGET="current,edge"
|
||||
FULL_DESKTOP="yes"
|
||||
FORCE_BOOTSCRIPT_UPDATE="yes"
|
||||
BOOT_LOGO="desktop"
|
||||
BOOTCONFIG="odroid-n2_defconfig"
|
||||
BOOTBRANCH_BOARD="tag:v2023.07.02"
|
||||
BOOTPATCHDIR="v2023.07.02"
|
||||
PACKAGE_LIST_BOARD="mtd-utils whiptail"
|
||||
BOOTCONFIG="odroid-n2_defconfig" # For mainline uboot
|
||||
|
||||
# Newer u-boot for the N2/N2+, less patches: a single boot order patch
|
||||
BOOTBRANCH_BOARD="tag:v2022.10"
|
||||
BOOTPATCHDIR="v2022.10"
|
||||
|
||||
# Enable writing u-boot to SPI on the N2(+) for current and edge
|
||||
# @TODO: replace this with an overlay, after meson64 overlay revamp
|
||||
@@ -32,27 +33,3 @@ GOVERNOR=performance # some people recommend performance to avoid random hangs a
|
||||
# So there is a hack at and around config/bootscripts/boot-meson64.cmd L90
|
||||
# If needed (eg for extlinux) you can specify the N2/N2+/ DTB in BOOT_FDT_FILE, example for the N2+:
|
||||
# BOOT_FDT_FILE="amlogic/meson-g12b-odroid-n2-plus.dtb"
|
||||
|
||||
function pre_customize_image__initialize_odroidn2_fanctrl_service() {
|
||||
if [[ -f "$SRC/packages/bsp/odroid/fanctrl" ]]; then
|
||||
mkdir -p $SDCARD/usr/bin/
|
||||
display_alert "$BOARD" "Installing ODROID Fan Control" "info"
|
||||
install -m 755 $SRC/packages/bsp/odroid/fanctrl $SDCARD/usr/bin/
|
||||
fi
|
||||
mkdir -p ${SDCARD}/etc/systemd/system/
|
||||
cat <<- 'EOD' > "${SDCARD}/etc/systemd/system/fanctrl.service"
|
||||
[Unit]
|
||||
Description=ODROID Fan Control
|
||||
ConditionPathExists=/usr/bin/fanctrl
|
||||
After=rc-local.service armbian-hardware-optimize.service
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/fanctrl run &>/dev/null
|
||||
Type=oneshot
|
||||
RemainAfterExit=yes
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOD
|
||||
chroot_sdcard systemctl enable fanctrl.service
|
||||
}
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
# Amlogic S922X hexa core 2GB/4GB RAM SoC 1.8-2.4Ghz eMMC GBE USB3 SPI RTC
|
||||
BOARD_NAME="Odroid N2L"
|
||||
BOARDFAMILY="meson-g12b"
|
||||
BOARD_MAINTAINER=""
|
||||
KERNEL_TARGET="current,edge"
|
||||
FULL_DESKTOP="yes"
|
||||
FORCE_BOOTSCRIPT_UPDATE="yes"
|
||||
BOOT_LOGO="desktop"
|
||||
BOOTCONFIG="odroid-n2l_defconfig"
|
||||
BOOTBRANCH_BOARD="tag:v2023.07.02"
|
||||
BOOTPATCHDIR="v2023.07.02"
|
||||
PACKAGE_LIST_BOARD="whiptail"
|
||||
|
||||
# MAX might be different for N2/N2+/N2L, for now use N2+'s
|
||||
# @TODO: remove? cpufreq is not used anymore, instead DT should be patched
|
||||
CPUMIN=1000000
|
||||
CPUMAX=2400000
|
||||
GOVERNOR=performance # some people recommend performance to avoid random hangs after 24+ hours running.
|
||||
|
||||
# U-boot has detection code for the ODROID boards.
|
||||
# https://github.com/u-boot/u-boot/blob/v2021.04/board/amlogic/odroid-n2/odroid-n2.c#L35-L106
|
||||
# Unfortunately it uses n2_plus instead of n2-plus as the Kernel expects it.
|
||||
# So there is a hack at and around config/bootscripts/boot-meson64.cmd L90
|
||||
# If needed (eg for extlinux) you can specify the N2/N2+/ DTB in BOOT_FDT_FILE, example for the N2+:
|
||||
# BOOT_FDT_FILE="amlogic/meson-g12b-odroid-n2l.dtb"
|
||||
|
||||
function pre_customize_image__initialize_odroidn2_fanctrl_service() {
|
||||
if [[ -f "$SRC/packages/bsp/odroid/fanctrl" ]]; then
|
||||
mkdir -p $SDCARD/usr/bin/
|
||||
display_alert "$BOARD" "Installing ODROID Fan Control" "info"
|
||||
install -m 755 $SRC/packages/bsp/odroid/fanctrl $SDCARD/usr/bin/
|
||||
fi
|
||||
mkdir -p ${SDCARD}/etc/systemd/system/
|
||||
cat <<- 'EOD' > "${SDCARD}/etc/systemd/system/fanctrl.service"
|
||||
[Unit]
|
||||
Description=ODROID Fan Control
|
||||
ConditionPathExists=/usr/bin/fanctrl
|
||||
After=rc-local.service armbian-hardware-optimize.service
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/fanctrl run &>/dev/null
|
||||
Type=oneshot
|
||||
RemainAfterExit=yes
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOD
|
||||
chroot_sdcard systemctl enable fanctrl.service
|
||||
}
|
||||
@@ -1,152 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Description: Odroid N2L / N2Plus Fan Control
|
||||
|
||||
if [[ "$USER" == "root" ]]; then
|
||||
:;
|
||||
else
|
||||
if [[ `command -v sudo` ]]; then
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
sudo "$0" "$@"
|
||||
exit
|
||||
fi
|
||||
else
|
||||
echo "Please run this as root or with sudo privileges."
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
POINT="55000"
|
||||
FINDME=`command -v fanctrl`
|
||||
|
||||
# Functions
|
||||
warning (){
|
||||
WARNING_MSG="Argument is not supported."
|
||||
echo -e "$WARNING_MSG"
|
||||
exit 0
|
||||
}
|
||||
|
||||
service (){
|
||||
# A service runs that tests the fan, so lets double tap the trip point and check that it hasn't changed
|
||||
if [[ -f "/sys/devices/virtual/thermal/thermal_zone0/trip_point_3_temp" ]]; then
|
||||
CURRENT=`cat /sys/devices/virtual/thermal/thermal_zone0/trip_point_3_temp`
|
||||
echo "$POINT" | tee /sys/devices/virtual/thermal/thermal_zone0/trip_point_3_temp
|
||||
sleep 5.5 # delay double tapping the trip point
|
||||
if [[ "$CURRENT" == "$POINT" ]]; then
|
||||
:;
|
||||
else
|
||||
echo "$POINT" | tee /sys/devices/virtual/thermal/thermal_zone0/trip_point_3_temp
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
trip_point (){
|
||||
if [[ -f "/sys/devices/virtual/thermal/thermal_zone0/trip_point_3_temp" ]]; then
|
||||
echo "$POINT" | tee /sys/devices/virtual/thermal/thermal_zone0/trip_point_3_temp
|
||||
else
|
||||
echo -e "You are missing trip_point_3_temp?"
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
65(){ # 65°C
|
||||
sed -i "s/^POINT=.*/POINT="'"65000"'"/" $FINDME
|
||||
sleep .25
|
||||
fanctrl run
|
||||
}
|
||||
|
||||
55(){ # 55°C
|
||||
sed -i "s/^POINT=.*/POINT="'"55000"'"/" $FINDME
|
||||
sleep .25
|
||||
fanctrl run
|
||||
}
|
||||
|
||||
45(){ # 45°C
|
||||
sed -i "s/^POINT=.*/POINT="'"45000"'"/" $FINDME
|
||||
sleep .25
|
||||
fanctrl run
|
||||
}
|
||||
|
||||
35(){ # 35°C
|
||||
sed -i "s/^POINT=.*/POINT="'"35000"'"/" $FINDME
|
||||
sleep .25
|
||||
fanctrl run
|
||||
}
|
||||
|
||||
25(){ # 25°C
|
||||
sed -i "s/^POINT=.*/POINT="'"25000"'"/" $FINDME
|
||||
sleep .25
|
||||
fanctrl run
|
||||
}
|
||||
|
||||
run (){ # run script
|
||||
trip_point
|
||||
}
|
||||
|
||||
menu (){
|
||||
while [ 1 ]
|
||||
do
|
||||
CHOICE=$(
|
||||
export NEWT_COLORS='root=,black roottext=lightgray,black title=black,lightgray'
|
||||
whiptail --backtitle "Current Trip Point: $POINT" --title "Fan Control" --menu "" --nocancel 0 0 0 \
|
||||
"6)" "65°C" \
|
||||
"5)" "55°C" \
|
||||
"4)" "45°C" \
|
||||
"3)" "35°C" \
|
||||
"2)" "25°C" \
|
||||
"E)" "Exit .." 3>&2 2>&1 1>&3
|
||||
)
|
||||
case $CHOICE in
|
||||
"6)")
|
||||
clear -x
|
||||
fanctrl 65
|
||||
export NEWT_COLORS='root=,black'
|
||||
whiptail --msgbox " Trip point set to 65°C" 0 0
|
||||
;;
|
||||
"5)")
|
||||
clear -x
|
||||
fanctrl 55
|
||||
export NEWT_COLORS='root=,black'
|
||||
whiptail --msgbox " Trip point set to 55°C" 0 0
|
||||
;;
|
||||
"4)")
|
||||
clear -x
|
||||
fanctrl 45
|
||||
export NEWT_COLORS='root=,black'
|
||||
whiptail --msgbox " Trip point set to 45°C" 0 0
|
||||
;;
|
||||
"3)")
|
||||
clear -x
|
||||
fanctrl 35
|
||||
export NEWT_COLORS='root=,black'
|
||||
whiptail --msgbox " Trip point set to 35°C" 0 0
|
||||
;;
|
||||
"2)")
|
||||
clear -x
|
||||
fanctrl 25
|
||||
export NEWT_COLORS='root=,black'
|
||||
whiptail --msgbox " Trip point set to 25°C" 0 0
|
||||
;;
|
||||
"E)")
|
||||
clear -x
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
>&2 echo -e "Arguments: 65 55 45 35 25 menu run"
|
||||
exit 1
|
||||
fi
|
||||
case $1 in
|
||||
65|55|45|35|25|menu|run|service)
|
||||
;;
|
||||
*)
|
||||
echo -e "Arguments: 65 55 45 35 25 menu run" >&2
|
||||
exit 1
|
||||
esac
|
||||
|
||||
FANCTRL=`echo $1`
|
||||
$FANCTRL
|
||||
|
||||
exit 0
|
||||
21
patch/kernel/archive/meson64-6.1/board-odroidc4-reset.patch
Normal file
21
patch/kernel/archive/meson64-6.1/board-odroidc4-reset.patch
Normal file
@@ -0,0 +1,21 @@
|
||||
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 8c30ce636..ee8aa390e 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts
|
||||
@@ -11,6 +11,16 @@ / {
|
||||
compatible = "hardkernel,odroid-c4", "amlogic,sm1";
|
||||
model = "Hardkernel ODROID-C4";
|
||||
|
||||
+ meson64-reboot {
|
||||
+ compatible = "meson64,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>;
|
||||
+ };
|
||||
+
|
||||
leds {
|
||||
compatible = "gpio-leds";
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Ricardo Pardini <ricardo@pardini.net>
|
||||
Date: Sun, 26 Jun 2022 03:47:06 +0200
|
||||
Subject: ODROID-HC4: add DT attributes to enable fan1_input
|
||||
|
||||
- from vendor kernel modified DT
|
||||
- this allows userspace fancontrol/pwmconfig to work
|
||||
---
|
||||
arch/arm64/boot/dts/amlogic/meson-sm1-odroid-hc4.dts | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-hc4.dts b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-hc4.dts
|
||||
index e3486f60645a..89ef6f07603c 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-hc4.dts
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-hc4.dts
|
||||
@@ -23,6 +23,10 @@ fan0: pwm-fan {
|
||||
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>;
|
||||
};
|
||||
|
||||
leds {
|
||||
--
|
||||
Armbian
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Stefan Agner <stefan@agner.ch>
|
||||
Date: Mon, 11 Jan 2021 11:38:54 +0100
|
||||
Subject: arm64: dts: meson: g12b: add GPIO fan support
|
||||
|
||||
Add simple GPIO fan node to support a fan on GPIO J8. Unfortunately the
|
||||
pad used to control the fan does not support real PWM, hence the RPM
|
||||
cannot be modulated.
|
||||
|
||||
Signed-off-by: Stefan Agner <stefan@agner.ch>
|
||||
Tested-by: Ricardo Pardini <ricardo@pardini.net>
|
||||
---
|
||||
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi | 9 +++++++++
|
||||
1 file changed, 9 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi
|
||||
index fd3fa82e4c33..1365f2767855 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi
|
||||
@@ -39,6 +39,15 @@ emmc_pwrseq: emmc-pwrseq {
|
||||
reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
|
||||
+ /* 5V 80x80x10.8mm cooling fan from Hardkernel shop... */
|
||||
+ fan0: gpio-fan {
|
||||
+ #cooling-cells = <2>;
|
||||
+ compatible = "gpio-fan";
|
||||
+ gpio-fan,speed-map = <0 0 1600 1>;
|
||||
+ gpios = <&gpio_ao GPIOAO_10 GPIO_ACTIVE_HIGH>;
|
||||
+ status = "okay";
|
||||
+ };
|
||||
+
|
||||
leds {
|
||||
compatible = "gpio-leds";
|
||||
|
||||
--
|
||||
Armbian
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Stefan Agner <stefan@agner.ch>
|
||||
Date: Mon, 11 Jan 2021 15:53:55 +0100
|
||||
Subject: arm64: dts: meson: g12b: odroid-n2: add fan as cooling device
|
||||
|
||||
Add the GPIO fan as a cooling device for the CPU thermal zone. Since we
|
||||
have only full fan speed available with this, set the tripping point to
|
||||
30 degrees Celsius.
|
||||
|
||||
Signed-off-by: Stefan Agner <stefan@agner.ch>
|
||||
---
|
||||
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi | 38 ++++++++++
|
||||
1 file changed, 38 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi
|
||||
index 1365f2767855..33323f119406 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi
|
||||
@@ -377,6 +377,44 @@ &clkc_audio {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
+&cpu_thermal {
|
||||
+ trips {
|
||||
+ cpu_warm: cpu_warm {
|
||||
+ hysteresis = <5000>;
|
||||
+ temperature = <30000>;
|
||||
+ type = "active";
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ cooling-maps {
|
||||
+ map0 {
|
||||
+ cooling-device =
|
||||
+ <&fan0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
|
||||
+ trip = <&cpu_warm>;
|
||||
+ };
|
||||
+ map1 {
|
||||
+ trip = <&cpu_passive>;
|
||||
+ cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
|
||||
+ <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
|
||||
+ <&cpu100 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
|
||||
+ <&cpu101 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
|
||||
+ <&cpu102 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
|
||||
+ <&cpu103 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
|
||||
+ <&fan0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
|
||||
+ };
|
||||
+ map2 {
|
||||
+ trip = <&cpu_hot>;
|
||||
+ cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
|
||||
+ <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
|
||||
+ <&cpu100 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
|
||||
+ <&cpu101 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
|
||||
+ <&cpu102 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
|
||||
+ <&cpu103 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
|
||||
+ <&fan0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
&cpu0 {
|
||||
cpu-supply = <&vddcpu_b>;
|
||||
operating-points-v2 = <&cpu_opp_table_0>;
|
||||
--
|
||||
Armbian
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Igor Pecovnik <igor.pecovnik@gmail.com>
|
||||
Date: Wed, 10 Feb 2021 18:07:08 +0100
|
||||
Subject: Add missing CPU opp values for clocking g12b / N2+ higher
|
||||
|
||||
Signed-off-by: Igor Pecovnik <igor.pecovnik@gmail.com>
|
||||
---
|
||||
arch/arm64/boot/dts/amlogic/meson-g12b-a311d.dtsi | 16 ++++++++++
|
||||
1 file changed, 16 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-a311d.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12b-a311d.dtsi
|
||||
index 8e9ad1e51d66..adc4cca55d7d 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-g12b-a311d.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-a311d.dtsi
|
||||
@@ -45,6 +45,14 @@ opp-1800000000 {
|
||||
opp-hz = /bits/ 64 <1800000000>;
|
||||
opp-microvolt = <1001000>;
|
||||
};
|
||||
+ opp-1908000000 {
|
||||
+ opp-hz = /bits/ 64 <1908000000>;
|
||||
+ opp-microvolt = <1030000>;
|
||||
+ };
|
||||
+ opp-2016000000 {
|
||||
+ opp-hz = /bits/ 64 <2016000000>;
|
||||
+ opp-microvolt = <1040000>;
|
||||
+ };
|
||||
};
|
||||
|
||||
cpub_opp_table_1: opp-table-1 {
|
||||
@@ -105,5 +113,13 @@ opp-2208000000 {
|
||||
opp-hz = /bits/ 64 <2208000000>;
|
||||
opp-microvolt = <1011000>;
|
||||
};
|
||||
+ opp-2304000000 {
|
||||
+ opp-hz = /bits/ 64 <2304000000>;
|
||||
+ opp-microvolt = <1030000>;
|
||||
+ };
|
||||
+ opp-2400000000 {
|
||||
+ opp-hz = /bits/ 64 <2400000000>;
|
||||
+ opp-microvolt = <1040000>;
|
||||
+ };
|
||||
};
|
||||
};
|
||||
--
|
||||
Armbian
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,74 +0,0 @@
|
||||
From 74f8960bcf84e9f8fa796b3b38a9594d888d56c6 Mon Sep 17 00:00:00 2001
|
||||
From: Patrick Yavitz <pyavitz@xxxxx.com>
|
||||
Date: Sat, 19 Aug 2023 22:14:31 -0400
|
||||
Subject: [PATCH] arch: arm64: dts: amlogic: overclock: meson-g12b-sm1-opp-table
|
||||
|
||||
Signed-off-by: Patrick Yavitz <pyavitz@xxxxx.com>
|
||||
---
|
||||
.../arm64/boot/dts/amlogic/meson-g12b-a311d.dtsi | 16 ++++++++++++++++
|
||||
arch/arm64/boot/dts/amlogic/meson-sm1.dtsi | 16 ++++++++++++++++
|
||||
2 files changed, 32 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-a311d.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12b-a311d.dtsi
|
||||
index 8e9ad1e51d66..adc4cca55d7d 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-g12b-a311d.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-a311d.dtsi
|
||||
@@ -45,6 +45,14 @@ opp-1800000000 {
|
||||
opp-hz = /bits/ 64 <1800000000>;
|
||||
opp-microvolt = <1001000>;
|
||||
};
|
||||
+ opp-1908000000 {
|
||||
+ opp-hz = /bits/ 64 <1908000000>;
|
||||
+ opp-microvolt = <1030000>;
|
||||
+ };
|
||||
+ opp-2016000000 {
|
||||
+ opp-hz = /bits/ 64 <2016000000>;
|
||||
+ opp-microvolt = <1040000>;
|
||||
+ };
|
||||
};
|
||||
|
||||
cpub_opp_table_1: opp-table-1 {
|
||||
@@ -105,5 +113,13 @@ opp-2208000000 {
|
||||
opp-hz = /bits/ 64 <2208000000>;
|
||||
opp-microvolt = <1011000>;
|
||||
};
|
||||
+ opp-2304000000 {
|
||||
+ opp-hz = /bits/ 64 <2304000000>;
|
||||
+ opp-microvolt = <1030000>;
|
||||
+ };
|
||||
+ opp-2400000000 {
|
||||
+ opp-hz = /bits/ 64 <2400000000>;
|
||||
+ opp-microvolt = <1040000>;
|
||||
+ };
|
||||
};
|
||||
};
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi b/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi
|
||||
index 394a7cce8000..7ed0c9b56cb1 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi
|
||||
@@ -135,6 +135,22 @@ opp-1908000000 {
|
||||
opp-hz = /bits/ 64 <1908000000>;
|
||||
opp-microvolt = <950000>;
|
||||
};
|
||||
+
|
||||
+ opp-2016000000 {
|
||||
+ opp-hz = /bits/ 64 <2016000000>;
|
||||
+ opp-microvolt = <1000000>;
|
||||
+ };
|
||||
+
|
||||
+ opp-2100000000 {
|
||||
+ opp-hz = /bits/ 64 <2100000000>;
|
||||
+ opp-microvolt = <1022000>;
|
||||
+ };
|
||||
+
|
||||
+ opp-2200000000 {
|
||||
+ opp-hz = /bits/ 64 <2200000000>;
|
||||
+ opp-microvolt = <1030000>;
|
||||
+ turbo-mode;
|
||||
+ };
|
||||
};
|
||||
};
|
||||
|
||||
--
|
||||
2.39.2
|
||||
|
||||
@@ -1,335 +0,0 @@
|
||||
From fd791cc533cd31706826a640ca2012b9fda32f91 Mon Sep 17 00:00:00 2001
|
||||
From: Patrick Yavitz <pyavitz@xxxxx.com>
|
||||
Date: Tue, 25 Jul 2023 12:58:44 -0400
|
||||
Subject: [PATCH] amlogic gpio memory device driver
|
||||
|
||||
Provides users with root-free access to the GPIO registers
|
||||
on Meson g12 platform. Calling mmap(/dev/gpiomem) will map the
|
||||
GPIO register page to the user's pointer. This drvier can allow
|
||||
to access gpio memory area in user account.
|
||||
|
||||
Signed-off-by: Patrick Yavitz <pyavitz@xxxxx.com>
|
||||
---
|
||||
drivers/char/Kconfig | 9 ++
|
||||
drivers/char/Makefile | 2 +
|
||||
drivers/char/aml-gpiomem.c | 280 +++++++++++++++++++++++++++++++++++++
|
||||
3 files changed, 291 insertions(+)
|
||||
create mode 100644 drivers/char/aml-gpiomem.c
|
||||
|
||||
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
|
||||
index 0f378d29dab0..7125a7b47f73 100644
|
||||
--- a/drivers/char/Kconfig
|
||||
+++ b/drivers/char/Kconfig
|
||||
@@ -459,4 +459,13 @@ config RANDOM_TRUST_BOOTLOADER
|
||||
believe its RNG facilities may be faulty. This may also be configured
|
||||
at boot time with "random.trust_bootloader=on/off".
|
||||
|
||||
+config AMLOGIC_GPIOMEM
|
||||
+ tristate "/dev/gpiomem rootless GPIO access via mmap() on the Amlogic"
|
||||
+ default m
|
||||
+ help
|
||||
+ Provides users with root-free access to the GPIO registers
|
||||
+ on Meson g12 platform. Calling mmap(/dev/gpiomem) will map the GPIO
|
||||
+ register page to the user's pointer. This drvier can allow to access
|
||||
+ gpio memory area in user account.
|
||||
+
|
||||
endmenu
|
||||
diff --git a/drivers/char/Makefile b/drivers/char/Makefile
|
||||
index 1b35d1724565..d223ef86c152 100644
|
||||
--- a/drivers/char/Makefile
|
||||
+++ b/drivers/char/Makefile
|
||||
@@ -45,3 +45,5 @@ obj-$(CONFIG_PS3_FLASH) += ps3flash.o
|
||||
obj-$(CONFIG_XILLYBUS_CLASS) += xillybus/
|
||||
obj-$(CONFIG_POWERNV_OP_PANEL) += powernv-op-panel.o
|
||||
obj-$(CONFIG_ADI) += adi.o
|
||||
+
|
||||
+obj-$(CONFIG_AMLOGIC_GPIOMEM) += aml-gpiomem.o
|
||||
diff --git a/drivers/char/aml-gpiomem.c b/drivers/char/aml-gpiomem.c
|
||||
new file mode 100644
|
||||
index 000000000000..b0d1df7ec1e4
|
||||
--- /dev/null
|
||||
+++ b/drivers/char/aml-gpiomem.c
|
||||
@@ -0,0 +1,280 @@
|
||||
+/*
|
||||
+ * linux/drivers/char/aml-gpiomem.c
|
||||
+ *
|
||||
+ * GPIO memory device driver
|
||||
+ *
|
||||
+ * Creates a chardev /dev/gpiomem which will provide user access to
|
||||
+ * the Meson g12 GPIO registers when it is mmap()'d.
|
||||
+ * No longer need root for user GPIO access, but without relaxing permissions
|
||||
+ * on /dev/mem.
|
||||
+ *
|
||||
+ * Copyright (c) 2017 Hardkernel Co., Ltd.
|
||||
+ *
|
||||
+ * This driver is based on bcm2835-gpiomem.c in Raspberrypi's linux kernel 4.4:
|
||||
+ * Written by Luke Wren <luke@raspberrypi.org>
|
||||
+ * Copyright (c) 2015, Raspberry Pi (Trading) Ltd.
|
||||
+ *
|
||||
+ * Redistribution and use in source and binary forms, with or without
|
||||
+ * modification, are permitted provided that the following conditions
|
||||
+ * are met:
|
||||
+ * 1. Redistributions of source code must retain the above copyright
|
||||
+ * notice, this list of conditions, and the following disclaimer,
|
||||
+ * without modification.
|
||||
+ * 2. Redistributions in binary form must reproduce the above copyright
|
||||
+ * notice, this list of conditions and the following disclaimer in the
|
||||
+ * documentation and/or other materials provided with the distribution.
|
||||
+ * 3. The names of the above-listed copyright holders may not be used
|
||||
+ * to endorse or promote products derived from this software without
|
||||
+ * specific prior written permission.
|
||||
+ *
|
||||
+ * ALTERNATIVELY, this software may be distributed under the terms of the
|
||||
+ * GNU General Public License ("GPL") version 2, as published by the Free
|
||||
+ * Software Foundation.
|
||||
+ *
|
||||
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
+ */
|
||||
+
|
||||
+#include <linux/kernel.h>
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/of.h>
|
||||
+#include <linux/platform_device.h>
|
||||
+#include <linux/mm.h>
|
||||
+#include <linux/slab.h>
|
||||
+#include <linux/cdev.h>
|
||||
+#include <linux/pagemap.h>
|
||||
+#include <linux/io.h>
|
||||
+#include <linux/of.h>
|
||||
+#include <asm/io.h>
|
||||
+
|
||||
+#define DEVICE_NAME "aml-gpiomem"
|
||||
+#define DRIVER_NAME "gpiomem-aml"
|
||||
+#define DEVICE_MINOR 0
|
||||
+
|
||||
+struct regs_phys {
|
||||
+ unsigned long start;
|
||||
+ unsigned long end;
|
||||
+};
|
||||
+
|
||||
+struct aml_gpiomem_instance {
|
||||
+ struct regs_phys gpio_regs_phys[32];
|
||||
+ int gpio_area_count;
|
||||
+ struct device *dev;
|
||||
+};
|
||||
+
|
||||
+static struct cdev aml_gpiomem_cdev;
|
||||
+static dev_t aml_gpiomem_devid;
|
||||
+static struct class *aml_gpiomem_class;
|
||||
+static struct device *aml_gpiomem_dev;
|
||||
+static struct aml_gpiomem_instance *inst;
|
||||
+
|
||||
+static int aml_gpiomem_open(struct inode *inode, struct file *file)
|
||||
+{
|
||||
+ int dev = iminor(inode);
|
||||
+ int ret = 0;
|
||||
+
|
||||
+ dev_info(inst->dev, "gpiomem device opened.");
|
||||
+
|
||||
+ if (dev != DEVICE_MINOR) {
|
||||
+ dev_err(inst->dev, "Unknown minor device: %d", dev);
|
||||
+ ret = -ENXIO;
|
||||
+ }
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static int aml_gpiomem_release(struct inode *inode, struct file *file)
|
||||
+{
|
||||
+ int dev = iminor(inode);
|
||||
+ int ret = 0;
|
||||
+
|
||||
+ if (dev != DEVICE_MINOR) {
|
||||
+ dev_err(inst->dev, "Unknown minor device %d", dev);
|
||||
+ ret = -ENXIO;
|
||||
+ }
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static const struct vm_operations_struct aml_gpiomem_vm_ops = {
|
||||
+#ifdef CONFIG_HAVE_IOREMAP_PROT
|
||||
+ .access = generic_access_phys
|
||||
+#endif
|
||||
+};
|
||||
+
|
||||
+static int aml_gpiomem_mmap(struct file *file, struct vm_area_struct *vma)
|
||||
+{
|
||||
+ int gpio_area = 0;
|
||||
+ unsigned long start = vma->vm_pgoff << PAGE_SHIFT;
|
||||
+ unsigned long end = start + vma->vm_end - vma->vm_start;
|
||||
+
|
||||
+ while (gpio_area < inst->gpio_area_count) {
|
||||
+ if ((inst->gpio_regs_phys[gpio_area].start >= start) &&
|
||||
+ (inst->gpio_regs_phys[gpio_area].end <= end))
|
||||
+ goto found;
|
||||
+ gpio_area++;
|
||||
+ }
|
||||
+
|
||||
+ return -EACCES;
|
||||
+
|
||||
+found:
|
||||
+ vma->vm_page_prot = phys_mem_access_prot(file, vma->vm_pgoff,
|
||||
+ vma->vm_end - vma->vm_start,
|
||||
+ vma->vm_page_prot);
|
||||
+
|
||||
+ vma->vm_ops = &aml_gpiomem_vm_ops;
|
||||
+
|
||||
+ if (remap_pfn_range(vma, vma->vm_start,
|
||||
+ vma->vm_pgoff,
|
||||
+ vma->vm_end - vma->vm_start,
|
||||
+ vma->vm_page_prot)) {
|
||||
+ return -EAGAIN;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct file_operations
|
||||
+aml_gpiomem_fops = {
|
||||
+ .owner = THIS_MODULE,
|
||||
+ .open = aml_gpiomem_open,
|
||||
+ .release = aml_gpiomem_release,
|
||||
+ .mmap = aml_gpiomem_mmap,
|
||||
+};
|
||||
+
|
||||
+static int aml_gpiomem_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ int err = 0;
|
||||
+ struct device *dev = &pdev->dev;
|
||||
+ struct device_node *np = dev->of_node;
|
||||
+ struct resource *res = NULL;
|
||||
+ int i = 0;
|
||||
+
|
||||
+ /* Allocate buffers and instance data */
|
||||
+ inst = kzalloc(sizeof(struct aml_gpiomem_instance), GFP_KERNEL);
|
||||
+
|
||||
+ if (!inst) {
|
||||
+ err = -ENOMEM;
|
||||
+ goto failed_inst_alloc;
|
||||
+ }
|
||||
+
|
||||
+ inst->dev = dev;
|
||||
+ inst->gpio_area_count = of_property_count_elems_of_size(np, "reg",
|
||||
+ sizeof(u32)) / 4;
|
||||
+
|
||||
+ if (inst->gpio_area_count > 32 || inst->gpio_area_count <= 0) {
|
||||
+ dev_err(inst->dev, "failed to get gpio register area.");
|
||||
+ err = -EINVAL;
|
||||
+ goto failed_inst_alloc;
|
||||
+ }
|
||||
+
|
||||
+ dev_info(inst->dev, "Initialised: GPIO register area is %d",
|
||||
+ inst->gpio_area_count);
|
||||
+
|
||||
+ for (i = 0; i < inst->gpio_area_count; ++i) {
|
||||
+ res = platform_get_resource(pdev, IORESOURCE_MEM, i);
|
||||
+ if (res) {
|
||||
+ inst->gpio_regs_phys[i].start = res->start;
|
||||
+ inst->gpio_regs_phys[i].end = res->end;
|
||||
+ } else {
|
||||
+ dev_err(inst->dev, "failed to get IO resource area %d", i);
|
||||
+ err = -ENOENT;
|
||||
+ goto failed_get_resource;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /* Create character device entries */
|
||||
+ err = alloc_chrdev_region(&aml_gpiomem_devid,
|
||||
+ DEVICE_MINOR, 1, DEVICE_NAME);
|
||||
+ if (err != 0) {
|
||||
+ dev_err(inst->dev, "unable to allocate device number");
|
||||
+ goto failed_alloc_chrdev;
|
||||
+ }
|
||||
+ cdev_init(&aml_gpiomem_cdev, &aml_gpiomem_fops);
|
||||
+ aml_gpiomem_cdev.owner = THIS_MODULE;
|
||||
+ err = cdev_add(&aml_gpiomem_cdev, aml_gpiomem_devid, 1);
|
||||
+ if (err != 0) {
|
||||
+ dev_err(inst->dev, "unable to register device");
|
||||
+ goto failed_cdev_add;
|
||||
+ }
|
||||
+
|
||||
+ /* Create sysfs entries */
|
||||
+ aml_gpiomem_class = class_create(THIS_MODULE, DEVICE_NAME);
|
||||
+ err = IS_ERR(aml_gpiomem_class);
|
||||
+ if (err)
|
||||
+ goto failed_class_create;
|
||||
+
|
||||
+ aml_gpiomem_dev = device_create(aml_gpiomem_class, NULL,
|
||||
+ aml_gpiomem_devid, NULL,
|
||||
+ "gpiomem");
|
||||
+ err = IS_ERR(aml_gpiomem_dev);
|
||||
+ if (err)
|
||||
+ goto failed_device_create;
|
||||
+
|
||||
+ for (i = 0; i < inst->gpio_area_count; ++i) {
|
||||
+ dev_info(inst->dev,
|
||||
+ "Initialised: Registers at start:0x%08lx end:0x%08lx size:0x%08lx",
|
||||
+ inst->gpio_regs_phys[i].start,
|
||||
+ inst->gpio_regs_phys[i].end,
|
||||
+ inst->gpio_regs_phys[i].end - inst->gpio_regs_phys[i].start);
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+
|
||||
+failed_device_create:
|
||||
+ class_destroy(aml_gpiomem_class);
|
||||
+failed_class_create:
|
||||
+ cdev_del(&aml_gpiomem_cdev);
|
||||
+failed_cdev_add:
|
||||
+ unregister_chrdev_region(aml_gpiomem_devid, 1);
|
||||
+failed_alloc_chrdev:
|
||||
+failed_get_resource:
|
||||
+ kfree(inst);
|
||||
+failed_inst_alloc:
|
||||
+ dev_err(inst->dev, "could not load aml_gpiomem");
|
||||
+ return err;
|
||||
+}
|
||||
+
|
||||
+static int aml_gpiomem_remove(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct device *dev = inst->dev;
|
||||
+
|
||||
+ kfree(inst);
|
||||
+ device_destroy(aml_gpiomem_class, aml_gpiomem_devid);
|
||||
+ class_destroy(aml_gpiomem_class);
|
||||
+ cdev_del(&aml_gpiomem_cdev);
|
||||
+ unregister_chrdev_region(aml_gpiomem_devid, 1);
|
||||
+
|
||||
+ dev_info(dev, "GPIO mem driver removed - OK");
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct of_device_id aml_gpiomem_of_match[] = {
|
||||
+ {.compatible = "amlogic, gpiomem",},
|
||||
+ { },
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(of, aml_gpiomem_of_match);
|
||||
+
|
||||
+static struct platform_driver aml_gpiomem_driver = {
|
||||
+ .driver = {
|
||||
+ .name = DRIVER_NAME,
|
||||
+ .owner = THIS_MODULE,
|
||||
+ .of_match_table = aml_gpiomem_of_match,
|
||||
+ },
|
||||
+ .probe = aml_gpiomem_probe,
|
||||
+ .remove = aml_gpiomem_remove,
|
||||
+};
|
||||
+
|
||||
+module_platform_driver(aml_gpiomem_driver);
|
||||
+
|
||||
+MODULE_ALIAS("platform:gpiomem-aml");
|
||||
+MODULE_DESCRIPTION("AMLogic gpiomem driver for accessing GPIO from userspace");
|
||||
+MODULE_AUTHOR("Brian Kim <brian.kim@hardkernel.com>");
|
||||
+MODULE_LICENSE("GPL");
|
||||
--
|
||||
2.39.2
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Igor Pecovnik <igor.pecovnik@gmail.com>
|
||||
Date: Tue, 4 Aug 2020 22:51:56 +0200
|
||||
Subject: Add higher clocks for SM1 family
|
||||
|
||||
Signed-off-by: Igor Pecovnik <igor.pecovnik@gmail.com>
|
||||
---
|
||||
arch/arm64/boot/dts/amlogic/meson-sm1.dtsi | 10 ++++++++++
|
||||
1 file changed, 10 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi b/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi
|
||||
index 80737731af3f..ba52da32cd73 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi
|
||||
@@ -134,6 +134,16 @@ opp-1908000000 {
|
||||
opp-hz = /bits/ 64 <1908000000>;
|
||||
opp-microvolt = <950000>;
|
||||
};
|
||||
+
|
||||
+ opp-2016000000 {
|
||||
+ opp-hz = /bits/ 64 <2016000000>;
|
||||
+ opp-microvolt = <1000000>;
|
||||
+ };
|
||||
+
|
||||
+ opp-2100000000 {
|
||||
+ opp-hz = /bits/ 64 <2100000000>;
|
||||
+ opp-microvolt = <1022000>;
|
||||
+ };
|
||||
};
|
||||
};
|
||||
|
||||
--
|
||||
Armbian
|
||||
|
||||
@@ -1,274 +0,0 @@
|
||||
From 18b0cbe1bb6273449ccddd8c6e7e94c631a53aaa Mon Sep 17 00:00:00 2001
|
||||
From: Patrick Yavitz <pyavitz@xxxxx.com>
|
||||
Date: Wed, 26 Jul 2023 03:34:37 -0400
|
||||
Subject: [PATCH] meson64 reboot power off driver
|
||||
|
||||
Driver supports restart / power off for amlogic g12a, g12b and
|
||||
sm1 SoCs.
|
||||
|
||||
Signed-off-by: Patrick Yavitz <pyavitz@xxxxx.com>
|
||||
---
|
||||
arch/arm64/include/asm/system_misc.h | 2 +
|
||||
arch/arm64/kernel/process.c | 7 +-
|
||||
drivers/power/reset/Kconfig | 7 ++
|
||||
drivers/power/reset/Makefile | 1 +
|
||||
drivers/power/reset/meson64-reboot.c | 181 +++++++++++++++++++++++++++
|
||||
5 files changed, 197 insertions(+), 1 deletion(-)
|
||||
create mode 100644 drivers/power/reset/meson64-reboot.c
|
||||
|
||||
diff --git a/arch/arm64/include/asm/system_misc.h b/arch/arm64/include/asm/system_misc.h
|
||||
index c34344256762..311bc7c5f580 100644
|
||||
--- a/arch/arm64/include/asm/system_misc.h
|
||||
+++ b/arch/arm64/include/asm/system_misc.h
|
||||
@@ -32,6 +32,8 @@ void hook_debug_fault_code(int nr, int (*fn)(unsigned long, unsigned long,
|
||||
struct mm_struct;
|
||||
extern void __show_regs(struct pt_regs *);
|
||||
|
||||
+extern void (*arm_pm_restart)(enum reboot_mode reboot_mode, const char *cmd);
|
||||
+
|
||||
#endif /* __ASSEMBLY__ */
|
||||
|
||||
#endif /* __ASM_SYSTEM_MISC_H */
|
||||
diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
|
||||
index 044a7d7f1f6a..c796edbdb096 100644
|
||||
--- a/arch/arm64/kernel/process.c
|
||||
+++ b/arch/arm64/kernel/process.c
|
||||
@@ -68,6 +68,8 @@ EXPORT_SYMBOL(__stack_chk_guard);
|
||||
void (*pm_power_off)(void);
|
||||
EXPORT_SYMBOL_GPL(pm_power_off);
|
||||
|
||||
+void (*arm_pm_restart)(enum reboot_mode reboot_mode, const char *cmd);
|
||||
+
|
||||
#ifdef CONFIG_HOTPLUG_CPU
|
||||
void arch_cpu_idle_dead(void)
|
||||
{
|
||||
@@ -137,7 +139,10 @@ void machine_restart(char *cmd)
|
||||
efi_reboot(reboot_mode, NULL);
|
||||
|
||||
/* Now call the architecture specific reboot code. */
|
||||
- do_kernel_restart(cmd);
|
||||
+ if (arm_pm_restart)
|
||||
+ arm_pm_restart(reboot_mode, cmd);
|
||||
+ else
|
||||
+ do_kernel_restart(cmd);
|
||||
|
||||
/*
|
||||
* Whoops - the architecture was unable to reboot.
|
||||
diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig
|
||||
index a8c46ba5878f..3c4b64d555a1 100644
|
||||
--- a/drivers/power/reset/Kconfig
|
||||
+++ b/drivers/power/reset/Kconfig
|
||||
@@ -9,6 +9,13 @@ menuconfig POWER_RESET
|
||||
|
||||
if POWER_RESET
|
||||
|
||||
+config POWER_RESET_MESON64
|
||||
+ bool "Meson64 reboot/power-off driver"
|
||||
+ depends on ARCH_MESON
|
||||
+ help
|
||||
+ The driver supports restart / power off for amlogic
|
||||
+ g12a, g12b and 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 0a39424fc558..7e692bca4187 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_MESON64) += meson64-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/meson64-reboot.c b/drivers/power/reset/meson64-reboot.c
|
||||
new file mode 100644
|
||||
index 000000000000..d5e2c2633c68
|
||||
--- /dev/null
|
||||
+++ b/drivers/power/reset/meson64-reboot.c
|
||||
@@ -0,0 +1,181 @@
|
||||
+/*
|
||||
+ * drivers/power/reset/meson64-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 meson64_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_meson64_restart(enum reboot_mode reboot_mode, const char *cmd)
|
||||
+{
|
||||
+ meson64_card_reset();
|
||||
+ __invoke_psci_fn_smc(psci_function_id_restart,
|
||||
+ 0, 0, 0);
|
||||
+}
|
||||
+
|
||||
+static void do_meson64_poweroff(void)
|
||||
+{
|
||||
+ meson64_card_reset();
|
||||
+
|
||||
+ __invoke_psci_fn_smc(0x82000042, 1, 0, 0);
|
||||
+ __invoke_psci_fn_smc(psci_function_id_poweroff,
|
||||
+ 0, 0, 0);
|
||||
+}
|
||||
+
|
||||
+static int meson64_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_meson64_restart;
|
||||
+ }
|
||||
+
|
||||
+ if (!of_property_read_u32(pdev->dev.of_node, "sys_poweroff", &id)) {
|
||||
+ psci_function_id_poweroff = id;
|
||||
+ pm_power_off = do_meson64_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_meson64_restart_match[] = {
|
||||
+ { .compatible = "meson64,reboot", },
|
||||
+ {},
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(of, of_meson64_restart_match);
|
||||
+
|
||||
+static struct platform_driver meson64_restart_driver = {
|
||||
+ .probe = meson64_restart_probe,
|
||||
+ .driver = {
|
||||
+ .name = "meson64-restart",
|
||||
+ .of_match_table = of_match_ptr(of_meson64_restart_match),
|
||||
+ },
|
||||
+};
|
||||
+
|
||||
+static int __init meson64_restart_init(void)
|
||||
+{
|
||||
+ return platform_driver_register(&meson64_restart_driver);
|
||||
+}
|
||||
+device_initcall(meson64_restart_init);
|
||||
--
|
||||
2.39.2
|
||||
|
||||
35
patch/kernel/archive/meson64-6.4/board-odroidc4-reset.patch
Normal file
35
patch/kernel/archive/meson64-6.4/board-odroidc4-reset.patch
Normal file
@@ -0,0 +1,35 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Ash Hughes <spirit.returned@gmail.com>
|
||||
Date: Sat, 18 Feb 2023 07:46:38 -0300
|
||||
Subject: adapted meson64-reboot driver, fix reboot on odroid C4 when using
|
||||
UHS-II SD cards
|
||||
|
||||
bring back fixed version of `odroid-reboot` driver (Fix reboot on odroid C4 when using UHS-II SD cards)
|
||||
---
|
||||
arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts | 10 ++++++++++
|
||||
1 file changed, 10 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 d04768a66bfe..e0b7aca25d21 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts
|
||||
@@ -11,6 +11,16 @@ / {
|
||||
compatible = "hardkernel,odroid-c4", "amlogic,sm1";
|
||||
model = "Hardkernel ODROID-C4";
|
||||
|
||||
+ meson64-reboot {
|
||||
+ compatible = "meson64,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>;
|
||||
+ };
|
||||
+
|
||||
leds {
|
||||
compatible = "gpio-leds";
|
||||
|
||||
--
|
||||
Armbian
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Ricardo Pardini <ricardo@pardini.net>
|
||||
Date: Sun, 26 Jun 2022 03:47:06 +0200
|
||||
Subject: ODROID-HC4: add DT attributes to enable fan1_input
|
||||
|
||||
- from vendor kernel modified DT
|
||||
- this allows userspace fancontrol/pwmconfig to work
|
||||
---
|
||||
arch/arm64/boot/dts/amlogic/meson-sm1-odroid-hc4.dts | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-hc4.dts b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-hc4.dts
|
||||
index 74088e7280fe..9b3d3e7930d1 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-hc4.dts
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-hc4.dts
|
||||
@@ -23,6 +23,10 @@ fan0: pwm-fan {
|
||||
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>;
|
||||
};
|
||||
|
||||
leds {
|
||||
--
|
||||
Armbian
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Igor Pecovnik <igor.pecovnik@gmail.com>
|
||||
Date: Wed, 10 Feb 2021 18:07:08 +0100
|
||||
Subject: Add missing CPU opp values for clocking g12b / N2+ higher
|
||||
|
||||
Signed-off-by: Igor Pecovnik <igor.pecovnik@gmail.com>
|
||||
---
|
||||
arch/arm64/boot/dts/amlogic/meson-g12b-a311d.dtsi | 16 ++++++++++
|
||||
1 file changed, 16 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-a311d.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12b-a311d.dtsi
|
||||
index 8e9ad1e51d66..adc4cca55d7d 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-g12b-a311d.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-a311d.dtsi
|
||||
@@ -45,6 +45,14 @@ opp-1800000000 {
|
||||
opp-hz = /bits/ 64 <1800000000>;
|
||||
opp-microvolt = <1001000>;
|
||||
};
|
||||
+ opp-1908000000 {
|
||||
+ opp-hz = /bits/ 64 <1908000000>;
|
||||
+ opp-microvolt = <1030000>;
|
||||
+ };
|
||||
+ opp-2016000000 {
|
||||
+ opp-hz = /bits/ 64 <2016000000>;
|
||||
+ opp-microvolt = <1040000>;
|
||||
+ };
|
||||
};
|
||||
|
||||
cpub_opp_table_1: opp-table-1 {
|
||||
@@ -105,5 +113,13 @@ opp-2208000000 {
|
||||
opp-hz = /bits/ 64 <2208000000>;
|
||||
opp-microvolt = <1011000>;
|
||||
};
|
||||
+ opp-2304000000 {
|
||||
+ opp-hz = /bits/ 64 <2304000000>;
|
||||
+ opp-microvolt = <1030000>;
|
||||
+ };
|
||||
+ opp-2400000000 {
|
||||
+ opp-hz = /bits/ 64 <2400000000>;
|
||||
+ opp-microvolt = <1040000>;
|
||||
+ };
|
||||
};
|
||||
};
|
||||
--
|
||||
Armbian
|
||||
|
||||
@@ -1,293 +0,0 @@
|
||||
From 5a5e47ceedaeb69b1bf580f553d8f5eb23e60072 Mon Sep 17 00:00:00 2001
|
||||
From: Patrick Yavitz <pyavitz@xxxxx.com>
|
||||
Date: Sat, 19 Aug 2023 17:00:22 -0400
|
||||
Subject: [PATCH] arch: arm64: dts: amlogic: meson-g12b-sm1-odroid
|
||||
|
||||
Add meson64-reboot driver to all boards
|
||||
Add uart_A uart_AO_B uart_B uart_C where appropriate
|
||||
|
||||
Signed-off-by: Patrick Yavitz <pyavitz@xxxxx.com>
|
||||
---
|
||||
.../dts/amlogic/meson-g12b-odroid-n2-plus.dts | 8 +++-
|
||||
.../boot/dts/amlogic/meson-g12b-odroid-n2.dts | 7 ++++
|
||||
.../dts/amlogic/meson-g12b-odroid-n2l.dts | 9 ++++-
|
||||
.../boot/dts/amlogic/meson-g12b-odroid.dtsi | 37 +++++++++++++++++-
|
||||
.../boot/dts/amlogic/meson-sm1-odroid-c4.dts | 16 ++++++++
|
||||
.../boot/dts/amlogic/meson-sm1-odroid-hc4.dts | 23 +++++++++++
|
||||
.../boot/dts/amlogic/meson-sm1-odroid.dtsi | 38 +++++++++++++++++++
|
||||
7 files changed, 135 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2-plus.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2-plus.dts
|
||||
index ce1198ad34e4..72cd79119def 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
|
||||
@@ -15,6 +15,13 @@ / {
|
||||
model = "Hardkernel ODROID-N2Plus";
|
||||
};
|
||||
|
||||
+&gpu_opp_table {
|
||||
+ opp-999999984 {
|
||||
+ opp-hz = /bits/ 64 <999999984>;
|
||||
+ opp-microvolt = <800000>;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
&vddcpu_a {
|
||||
regulator-min-microvolt = <680000>;
|
||||
regulator-max-microvolt = <1040000>;
|
||||
@@ -28,4 +35,3 @@ &vddcpu_b {
|
||||
|
||||
pwms = <&pwm_AO_cd 1 1500 0>;
|
||||
};
|
||||
-
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
|
||||
index a198a91259ec..b77b2c425d9e 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
|
||||
@@ -13,3 +13,10 @@ / {
|
||||
compatible = "hardkernel,odroid-n2", "amlogic,s922x", "amlogic,g12b";
|
||||
model = "Hardkernel ODROID-N2";
|
||||
};
|
||||
+
|
||||
+&gpu_opp_table {
|
||||
+ opp-999999984 {
|
||||
+ opp-hz = /bits/ 64 <999999984>;
|
||||
+ opp-microvolt = <800000>;
|
||||
+ };
|
||||
+};
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2l.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2l.dts
|
||||
index 70919f40d597..037aa4fe0de0 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2l.dts
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2l.dts
|
||||
@@ -13,6 +13,10 @@ / {
|
||||
compatible = "hardkernel,odroid-n2l", "amlogic,s922x", "amlogic,g12b";
|
||||
model = "Hardkernel ODROID-N2L";
|
||||
|
||||
+ aliases {
|
||||
+ /delete-property/ rtc0;
|
||||
+ };
|
||||
+
|
||||
sound {
|
||||
compatible = "amlogic,axg-sound-card";
|
||||
model = "ODROID-N2L";
|
||||
@@ -46,7 +50,6 @@ sound {
|
||||
assigned-clock-rates = <294912000>,
|
||||
<270950400>,
|
||||
<393216000>;
|
||||
- status = "okay";
|
||||
|
||||
dai-link-0 {
|
||||
sound-dai = <&frddr_a>;
|
||||
@@ -102,6 +105,10 @@ ð_phy {
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
+&i2c3 {
|
||||
+ /delete-node/ rtc@51;
|
||||
+};
|
||||
+
|
||||
&vddcpu_a {
|
||||
regulator-min-microvolt = <680000>;
|
||||
regulator-max-microvolt = <1040000>;
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid.dtsi
|
||||
index 9e12a34b2840..b549852d3d40 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid.dtsi
|
||||
@@ -12,6 +12,9 @@
|
||||
/ {
|
||||
aliases {
|
||||
serial0 = &uart_AO;
|
||||
+ serial1 = &uart_A;
|
||||
+ serial2 = &uart_B;
|
||||
+ serial3 = &uart_C;
|
||||
ethernet0 = ðmac;
|
||||
rtc1 = &vrtc;
|
||||
};
|
||||
@@ -20,6 +23,16 @@ chosen {
|
||||
stdout-path = "serial0:115200n8";
|
||||
};
|
||||
|
||||
+ reboot: meson64-reboot {
|
||||
+ compatible = "meson64,reboot";
|
||||
+ sys_reset = <0x84000009>;
|
||||
+ sys_poweroff = <0x84000008>;
|
||||
+
|
||||
+ sd-vmmc = <&gpio_ao GPIOAO_8 GPIO_ACTIVE_HIGH>;
|
||||
+ sd-vqen = <&gpio_ao GPIOAO_3 GPIO_ACTIVE_HIGH>;
|
||||
+ sd-vqsw = <&gpio_ao GPIOAO_9 GPIO_ACTIVE_HIGH>;
|
||||
+ };
|
||||
+
|
||||
memory@0 {
|
||||
device_type = "memory";
|
||||
reg = <0x0 0x0 0x0 0x40000000>;
|
||||
@@ -354,7 +367,11 @@ &sd_emmc_b {
|
||||
|
||||
bus-width = <4>;
|
||||
cap-sd-highspeed;
|
||||
- max-frequency = <50000000>;
|
||||
+ max-frequency = <200000000>;
|
||||
+ sd-uhs-sdr12;
|
||||
+ sd-uhs-sdr25;
|
||||
+ sd-uhs-sdr50;
|
||||
+ sd-uhs-sdr104;
|
||||
disable-wp;
|
||||
|
||||
cd-gpios = <&gpio GPIOC_6 GPIO_ACTIVE_LOW>;
|
||||
@@ -430,12 +447,30 @@ &toddr_c {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
+&uart_A {
|
||||
+ status = "disabled";
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&uart_a_pins>;
|
||||
+};
|
||||
+
|
||||
&uart_AO {
|
||||
status = "okay";
|
||||
pinctrl-0 = <&uart_ao_a_pins>;
|
||||
pinctrl-names = "default";
|
||||
};
|
||||
|
||||
+&uart_B {
|
||||
+ status = "disabled";
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&uart_b_pins>;
|
||||
+};
|
||||
+
|
||||
+&uart_C {
|
||||
+ status = "disabled";
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&uart_c_pins>;
|
||||
+};
|
||||
+
|
||||
&usb {
|
||||
status = "okay";
|
||||
};
|
||||
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 d04768a66bfe..b51498ce93b3 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts
|
||||
@@ -56,3 +56,19 @@ hub_3_0: hub@2 {
|
||||
&ir {
|
||||
linux,rc-map-name = "rc-odroid";
|
||||
};
|
||||
+
|
||||
+&external_phy {
|
||||
+ /delete-property/ interrupts;
|
||||
+ /delete-property/ interrupts-parent;
|
||||
+};
|
||||
+
|
||||
+&gpu_opp_table {
|
||||
+ opp-999999984 {
|
||||
+ opp-hz = /bits/ 64 <999999984>;
|
||||
+ opp-microvolt = <800000>;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&vddcpu {
|
||||
+ regulator-max-microvolt = <1030000>;
|
||||
+};
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-hc4.dts b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-hc4.dts
|
||||
index 74088e7280fe..9c5701a1fc49 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-hc4.dts
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-hc4.dts
|
||||
@@ -142,3 +142,26 @@ &usb {
|
||||
phys = <&usb2_phy0>, <&usb2_phy1>;
|
||||
phy-names = "usb2-phy0", "usb2-phy1";
|
||||
};
|
||||
+
|
||||
+&external_phy {
|
||||
+ /delete-property/ interrupts;
|
||||
+ /delete-property/ interrupts-parent;
|
||||
+};
|
||||
+
|
||||
+&fan0 {
|
||||
+ fan-supply = <&vcc_5v>;
|
||||
+ interrupt-parent = <&gpio_intc>;
|
||||
+ interrupts = <84 IRQ_TYPE_EDGE_FALLING>;
|
||||
+ pulses-per-revolutions = <2>;
|
||||
+};
|
||||
+
|
||||
+&gpu_opp_table {
|
||||
+ opp-999999984 {
|
||||
+ opp-hz = /bits/ 64 <999999984>;
|
||||
+ opp-microvolt = <800000>;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&vddcpu {
|
||||
+ regulator-max-microvolt = <1030000>;
|
||||
+};
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid.dtsi b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid.dtsi
|
||||
index 2fce44939f45..aa6bdb84817a 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid.dtsi
|
||||
@@ -11,6 +11,10 @@
|
||||
/ {
|
||||
aliases {
|
||||
serial0 = &uart_AO;
|
||||
+ serial1 = &uart_A;
|
||||
+ serial2 = &uart_B;
|
||||
+ serial3 = &uart_C;
|
||||
+ serial4 = &uart_AO_B;
|
||||
ethernet0 = ðmac;
|
||||
};
|
||||
|
||||
@@ -18,6 +22,16 @@ chosen {
|
||||
stdout-path = "serial0:115200n8";
|
||||
};
|
||||
|
||||
+ reboot: meson64-reboot {
|
||||
+ compatible = "meson64,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>;
|
||||
+ };
|
||||
+
|
||||
memory@0 {
|
||||
device_type = "memory";
|
||||
reg = <0x0 0x0 0x0 0x40000000>;
|
||||
@@ -450,12 +464,36 @@ &tohdmitx {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
+&uart_A {
|
||||
+ status = "disabled";
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&uart_a_pins>;
|
||||
+};
|
||||
+
|
||||
&uart_AO {
|
||||
status = "okay";
|
||||
pinctrl-0 = <&uart_ao_a_pins>;
|
||||
pinctrl-names = "default";
|
||||
};
|
||||
|
||||
+&uart_AO_B {
|
||||
+ status = "disabled";
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&uart_ao_b_8_9_pins>;
|
||||
+};
|
||||
+
|
||||
+&uart_B {
|
||||
+ status = "disabled";
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&uart_b_pins>;
|
||||
+};
|
||||
+
|
||||
+&uart_C {
|
||||
+ status = "disabled";
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&uart_c_pins>;
|
||||
+};
|
||||
+
|
||||
&usb {
|
||||
status = "okay";
|
||||
vbus-supply = <&usb_pwr_en>;
|
||||
--
|
||||
2.39.2
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
From 20bb14e45154217cac1026b7be57f7d367684ab8 Mon Sep 17 00:00:00 2001
|
||||
From: Patrick Yavitz <pyavitz@xxxxx.com>
|
||||
Date: Tue, 25 Jul 2023 13:36:40 -0400
|
||||
Subject: [PATCH] arch: arm64: dts: amlogic: overclock: meson-g12b-sm1-opp-table
|
||||
|
||||
Signed-off-by: Patrick Yavitz <pyavitz@xxxxx.com>
|
||||
---
|
||||
.../arm64/boot/dts/amlogic/meson-g12b-a311d.dtsi | 16 ++++++++++++++++
|
||||
arch/arm64/boot/dts/amlogic/meson-sm1.dtsi | 16 ++++++++++++++++
|
||||
2 files changed, 32 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-a311d.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12b-a311d.dtsi
|
||||
index 8e9ad1e51d66..adc4cca55d7d 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-g12b-a311d.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-a311d.dtsi
|
||||
@@ -45,6 +45,14 @@ opp-1800000000 {
|
||||
opp-hz = /bits/ 64 <1800000000>;
|
||||
opp-microvolt = <1001000>;
|
||||
};
|
||||
+ opp-1908000000 {
|
||||
+ opp-hz = /bits/ 64 <1908000000>;
|
||||
+ opp-microvolt = <1030000>;
|
||||
+ };
|
||||
+ opp-2016000000 {
|
||||
+ opp-hz = /bits/ 64 <2016000000>;
|
||||
+ opp-microvolt = <1040000>;
|
||||
+ };
|
||||
};
|
||||
|
||||
cpub_opp_table_1: opp-table-1 {
|
||||
@@ -105,5 +113,13 @@ opp-2208000000 {
|
||||
opp-hz = /bits/ 64 <2208000000>;
|
||||
opp-microvolt = <1011000>;
|
||||
};
|
||||
+ opp-2304000000 {
|
||||
+ opp-hz = /bits/ 64 <2304000000>;
|
||||
+ opp-microvolt = <1030000>;
|
||||
+ };
|
||||
+ opp-2400000000 {
|
||||
+ opp-hz = /bits/ 64 <2400000000>;
|
||||
+ opp-microvolt = <1040000>;
|
||||
+ };
|
||||
};
|
||||
};
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi b/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi
|
||||
index 617d322af0df..cc18923c2af5 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi
|
||||
@@ -135,6 +135,22 @@ opp-1908000000 {
|
||||
opp-hz = /bits/ 64 <1908000000>;
|
||||
opp-microvolt = <950000>;
|
||||
};
|
||||
+
|
||||
+ opp-2016000000 {
|
||||
+ opp-hz = /bits/ 64 <2016000000>;
|
||||
+ opp-microvolt = <1000000>;
|
||||
+ };
|
||||
+
|
||||
+ opp-2100000000 {
|
||||
+ opp-hz = /bits/ 64 <2100000000>;
|
||||
+ opp-microvolt = <1022000>;
|
||||
+ };
|
||||
+
|
||||
+ opp-2200000000 {
|
||||
+ opp-hz = /bits/ 64 <2200000000>;
|
||||
+ opp-microvolt = <1030000>;
|
||||
+ turbo-mode;
|
||||
+ };
|
||||
};
|
||||
};
|
||||
|
||||
--
|
||||
2.39.2
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Igor Pecovnik <igor.pecovnik@gmail.com>
|
||||
Date: Tue, 4 Aug 2020 22:51:56 +0200
|
||||
Subject: Add higher clocks for SM1 family
|
||||
|
||||
Signed-off-by: Igor Pecovnik <igor.pecovnik@gmail.com>
|
||||
---
|
||||
arch/arm64/boot/dts/amlogic/meson-sm1.dtsi | 10 ++++++++++
|
||||
1 file changed, 10 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi b/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi
|
||||
index 617d322af0df..2ca0daa86b1b 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi
|
||||
@@ -135,6 +135,16 @@ opp-1908000000 {
|
||||
opp-hz = /bits/ 64 <1908000000>;
|
||||
opp-microvolt = <950000>;
|
||||
};
|
||||
+
|
||||
+ opp-2016000000 {
|
||||
+ opp-hz = /bits/ 64 <2016000000>;
|
||||
+ opp-microvolt = <1000000>;
|
||||
+ };
|
||||
+
|
||||
+ opp-2100000000 {
|
||||
+ opp-hz = /bits/ 64 <2100000000>;
|
||||
+ opp-microvolt = <1022000>;
|
||||
+ };
|
||||
};
|
||||
};
|
||||
|
||||
--
|
||||
Armbian
|
||||
|
||||
@@ -1,274 +0,0 @@
|
||||
From 7730fee7ed2eb1cc1b5d588c62618532a75b39ce Mon Sep 17 00:00:00 2001
|
||||
From: Patrick Yavitz <pyavitz@xxxxx.com>
|
||||
Date: Wed, 26 Jul 2023 03:39:48 -0400
|
||||
Subject: [PATCH] meson64 reboot power off driver
|
||||
|
||||
Driver supports restart / power off for amlogic g12a, g12b and
|
||||
sm1 SoCs.
|
||||
|
||||
Signed-off-by: Patrick Yavitz <pyavitz@xxxxx.com>
|
||||
---
|
||||
arch/arm64/include/asm/system_misc.h | 2 +
|
||||
arch/arm64/kernel/process.c | 7 +-
|
||||
drivers/power/reset/Kconfig | 7 ++
|
||||
drivers/power/reset/Makefile | 1 +
|
||||
drivers/power/reset/meson64-reboot.c | 181 +++++++++++++++++++++++++++
|
||||
5 files changed, 197 insertions(+), 1 deletion(-)
|
||||
create mode 100644 drivers/power/reset/meson64-reboot.c
|
||||
|
||||
diff --git a/arch/arm64/include/asm/system_misc.h b/arch/arm64/include/asm/system_misc.h
|
||||
index c34344256762..311bc7c5f580 100644
|
||||
--- a/arch/arm64/include/asm/system_misc.h
|
||||
+++ b/arch/arm64/include/asm/system_misc.h
|
||||
@@ -32,6 +32,8 @@ void hook_debug_fault_code(int nr, int (*fn)(unsigned long, unsigned long,
|
||||
struct mm_struct;
|
||||
extern void __show_regs(struct pt_regs *);
|
||||
|
||||
+extern void (*arm_pm_restart)(enum reboot_mode reboot_mode, const char *cmd);
|
||||
+
|
||||
#endif /* __ASSEMBLY__ */
|
||||
|
||||
#endif /* __ASM_SYSTEM_MISC_H */
|
||||
diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
|
||||
index 0fcc4eb1a7ab..78d66392fb8a 100644
|
||||
--- a/arch/arm64/kernel/process.c
|
||||
+++ b/arch/arm64/kernel/process.c
|
||||
@@ -68,6 +68,8 @@ EXPORT_SYMBOL(__stack_chk_guard);
|
||||
void (*pm_power_off)(void);
|
||||
EXPORT_SYMBOL_GPL(pm_power_off);
|
||||
|
||||
+void (*arm_pm_restart)(enum reboot_mode reboot_mode, const char *cmd);
|
||||
+
|
||||
#ifdef CONFIG_HOTPLUG_CPU
|
||||
void __noreturn arch_cpu_idle_dead(void)
|
||||
{
|
||||
@@ -137,7 +139,10 @@ void machine_restart(char *cmd)
|
||||
efi_reboot(reboot_mode, NULL);
|
||||
|
||||
/* Now call the architecture specific reboot code. */
|
||||
- do_kernel_restart(cmd);
|
||||
+ if (arm_pm_restart)
|
||||
+ arm_pm_restart(reboot_mode, cmd);
|
||||
+ else
|
||||
+ do_kernel_restart(cmd);
|
||||
|
||||
/*
|
||||
* Whoops - the architecture was unable to reboot.
|
||||
diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig
|
||||
index 8c87eeda0fec..bd654b885c2f 100644
|
||||
--- a/drivers/power/reset/Kconfig
|
||||
+++ b/drivers/power/reset/Kconfig
|
||||
@@ -9,6 +9,13 @@ menuconfig POWER_RESET
|
||||
|
||||
if POWER_RESET
|
||||
|
||||
+config POWER_RESET_MESON64
|
||||
+ bool "Meson64 reboot/power-off driver"
|
||||
+ depends on ARCH_MESON
|
||||
+ help
|
||||
+ The driver supports restart / power off for amlogic
|
||||
+ g12a, g12b and 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 d763e6735ee3..93dd2025dcf3 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_MESON64) += meson64-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/meson64-reboot.c b/drivers/power/reset/meson64-reboot.c
|
||||
new file mode 100644
|
||||
index 000000000000..d5e2c2633c68
|
||||
--- /dev/null
|
||||
+++ b/drivers/power/reset/meson64-reboot.c
|
||||
@@ -0,0 +1,181 @@
|
||||
+/*
|
||||
+ * drivers/power/reset/meson64-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 meson64_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_meson64_restart(enum reboot_mode reboot_mode, const char *cmd)
|
||||
+{
|
||||
+ meson64_card_reset();
|
||||
+ __invoke_psci_fn_smc(psci_function_id_restart,
|
||||
+ 0, 0, 0);
|
||||
+}
|
||||
+
|
||||
+static void do_meson64_poweroff(void)
|
||||
+{
|
||||
+ meson64_card_reset();
|
||||
+
|
||||
+ __invoke_psci_fn_smc(0x82000042, 1, 0, 0);
|
||||
+ __invoke_psci_fn_smc(psci_function_id_poweroff,
|
||||
+ 0, 0, 0);
|
||||
+}
|
||||
+
|
||||
+static int meson64_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_meson64_restart;
|
||||
+ }
|
||||
+
|
||||
+ if (!of_property_read_u32(pdev->dev.of_node, "sys_poweroff", &id)) {
|
||||
+ psci_function_id_poweroff = id;
|
||||
+ pm_power_off = do_meson64_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_meson64_restart_match[] = {
|
||||
+ { .compatible = "meson64,reboot", },
|
||||
+ {},
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(of, of_meson64_restart_match);
|
||||
+
|
||||
+static struct platform_driver meson64_restart_driver = {
|
||||
+ .probe = meson64_restart_probe,
|
||||
+ .driver = {
|
||||
+ .name = "meson64-restart",
|
||||
+ .of_match_table = of_match_ptr(of_meson64_restart_match),
|
||||
+ },
|
||||
+};
|
||||
+
|
||||
+static int __init meson64_restart_init(void)
|
||||
+{
|
||||
+ return platform_driver_register(&meson64_restart_driver);
|
||||
+}
|
||||
+device_initcall(meson64_restart_init);
|
||||
--
|
||||
2.39.2
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
From b55ab13244c8c175447fb1becdd25690e011b6c3 Mon Sep 17 00:00:00 2001
|
||||
From: Patrick Yavitz <pyavitz@xxxxx.com>
|
||||
Date: Fri, 28 Jul 2023 13:32:12 -0400
|
||||
Subject: [PATCH] HACK: mmc-meson-gx limit to 24MHz
|
||||
|
||||
Signed-off-by: Patrick Yavitz <pyavitz@xxxxx.com>
|
||||
---
|
||||
drivers/mmc/meson_gx_mmc.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/drivers/mmc/meson_gx_mmc.c b/drivers/mmc/meson_gx_mmc.c
|
||||
index fcf4f03d1e..6ded4b619b 100644
|
||||
--- a/drivers/mmc/meson_gx_mmc.c
|
||||
+++ b/drivers/mmc/meson_gx_mmc.c
|
||||
@@ -279,7 +279,7 @@ static int meson_mmc_probe(struct udevice *dev)
|
||||
cfg->host_caps = MMC_MODE_8BIT | MMC_MODE_4BIT |
|
||||
MMC_MODE_HS_52MHz | MMC_MODE_HS;
|
||||
cfg->f_min = DIV_ROUND_UP(SD_EMMC_CLKSRC_24M, CLK_MAX_DIV);
|
||||
- cfg->f_max = 100000000; /* 100 MHz */
|
||||
+ cfg->f_max = SD_EMMC_CLKSRC_24M;
|
||||
cfg->b_max = 511; /* max 512 - 1 blocks */
|
||||
cfg->name = dev->name;
|
||||
|
||||
--
|
||||
2.39.2
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
From fac66d6454780cb12c5c1ae3fd526c4dd58c2659 Mon Sep 17 00:00:00 2001
|
||||
From: Patrick Yavitz <pyavitz@xxxxx.com>
|
||||
Date: Fri, 28 Jul 2023 13:33:45 -0400
|
||||
Subject: [PATCH] meson64 boot target usb
|
||||
|
||||
Signed-off-by: Patrick Yavitz <pyavitz@xxxxx.com>
|
||||
---
|
||||
include/configs/meson64.h | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/include/configs/meson64.h b/include/configs/meson64.h
|
||||
index 9244601284..0692fa1716 100644
|
||||
--- a/include/configs/meson64.h
|
||||
+++ b/include/configs/meson64.h
|
||||
@@ -71,10 +71,10 @@
|
||||
#ifndef BOOT_TARGET_DEVICES
|
||||
#define BOOT_TARGET_DEVICES(func) \
|
||||
func(ROMUSB, romusb, na) \
|
||||
+ BOOT_TARGET_DEVICES_USB(func) \
|
||||
func(MMC, mmc, 0) \
|
||||
func(MMC, mmc, 1) \
|
||||
func(MMC, mmc, 2) \
|
||||
- BOOT_TARGET_DEVICES_USB(func) \
|
||||
BOOT_TARGET_NVME(func) \
|
||||
BOOT_TARGET_SCSI(func) \
|
||||
func(PXE, pxe, na) \
|
||||
--
|
||||
2.39.2
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
From b55ab13244c8c175447fb1becdd25690e011b6c3 Mon Sep 17 00:00:00 2001
|
||||
From: Patrick Yavitz <pyavitz@xxxxx.com>
|
||||
Date: Fri, 28 Jul 2023 13:32:12 -0400
|
||||
Subject: [PATCH] HACK: mmc-meson-gx limit to 24MHz
|
||||
|
||||
Signed-off-by: Patrick Yavitz <pyavitz@xxxxx.com>
|
||||
---
|
||||
drivers/mmc/meson_gx_mmc.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/drivers/mmc/meson_gx_mmc.c b/drivers/mmc/meson_gx_mmc.c
|
||||
index fcf4f03d1e..6ded4b619b 100644
|
||||
--- a/drivers/mmc/meson_gx_mmc.c
|
||||
+++ b/drivers/mmc/meson_gx_mmc.c
|
||||
@@ -279,7 +279,7 @@ static int meson_mmc_probe(struct udevice *dev)
|
||||
cfg->host_caps = MMC_MODE_8BIT | MMC_MODE_4BIT |
|
||||
MMC_MODE_HS_52MHz | MMC_MODE_HS;
|
||||
cfg->f_min = DIV_ROUND_UP(SD_EMMC_CLKSRC_24M, CLK_MAX_DIV);
|
||||
- cfg->f_max = 100000000; /* 100 MHz */
|
||||
+ cfg->f_max = SD_EMMC_CLKSRC_24M;
|
||||
cfg->b_max = 511; /* max 512 - 1 blocks */
|
||||
cfg->name = dev->name;
|
||||
|
||||
--
|
||||
2.39.2
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
From fac66d6454780cb12c5c1ae3fd526c4dd58c2659 Mon Sep 17 00:00:00 2001
|
||||
From: Patrick Yavitz <pyavitz@xxxxx.com>
|
||||
Date: Fri, 28 Jul 2023 13:33:45 -0400
|
||||
Subject: [PATCH] meson64 boot target usb
|
||||
|
||||
Signed-off-by: Patrick Yavitz <pyavitz@xxxxx.com>
|
||||
---
|
||||
include/configs/meson64.h | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/include/configs/meson64.h b/include/configs/meson64.h
|
||||
index 9244601284..0692fa1716 100644
|
||||
--- a/include/configs/meson64.h
|
||||
+++ b/include/configs/meson64.h
|
||||
@@ -71,10 +71,10 @@
|
||||
#ifndef BOOT_TARGET_DEVICES
|
||||
#define BOOT_TARGET_DEVICES(func) \
|
||||
func(ROMUSB, romusb, na) \
|
||||
+ BOOT_TARGET_DEVICES_USB(func) \
|
||||
func(MMC, mmc, 0) \
|
||||
func(MMC, mmc, 1) \
|
||||
func(MMC, mmc, 2) \
|
||||
- BOOT_TARGET_DEVICES_USB(func) \
|
||||
BOOT_TARGET_NVME(func) \
|
||||
BOOT_TARGET_SCSI(func) \
|
||||
func(PXE, pxe, na) \
|
||||
--
|
||||
2.39.2
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
From b55ab13244c8c175447fb1becdd25690e011b6c3 Mon Sep 17 00:00:00 2001
|
||||
From: Patrick Yavitz <pyavitz@xxxxx.com>
|
||||
Date: Fri, 28 Jul 2023 13:32:12 -0400
|
||||
Subject: [PATCH] HACK: mmc-meson-gx limit to 24MHz
|
||||
|
||||
Signed-off-by: Patrick Yavitz <pyavitz@xxxxx.com>
|
||||
---
|
||||
drivers/mmc/meson_gx_mmc.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/drivers/mmc/meson_gx_mmc.c b/drivers/mmc/meson_gx_mmc.c
|
||||
index fcf4f03d1e..6ded4b619b 100644
|
||||
--- a/drivers/mmc/meson_gx_mmc.c
|
||||
+++ b/drivers/mmc/meson_gx_mmc.c
|
||||
@@ -279,7 +279,7 @@ static int meson_mmc_probe(struct udevice *dev)
|
||||
cfg->host_caps = MMC_MODE_8BIT | MMC_MODE_4BIT |
|
||||
MMC_MODE_HS_52MHz | MMC_MODE_HS;
|
||||
cfg->f_min = DIV_ROUND_UP(SD_EMMC_CLKSRC_24M, CLK_MAX_DIV);
|
||||
- cfg->f_max = 100000000; /* 100 MHz */
|
||||
+ cfg->f_max = SD_EMMC_CLKSRC_24M;
|
||||
cfg->b_max = 511; /* max 512 - 1 blocks */
|
||||
cfg->name = dev->name;
|
||||
|
||||
--
|
||||
2.39.2
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
From fac66d6454780cb12c5c1ae3fd526c4dd58c2659 Mon Sep 17 00:00:00 2001
|
||||
From: Patrick Yavitz <pyavitz@xxxxx.com>
|
||||
Date: Fri, 28 Jul 2023 13:33:45 -0400
|
||||
Subject: [PATCH] meson64 boot target usb
|
||||
|
||||
Signed-off-by: Patrick Yavitz <pyavitz@xxxxx.com>
|
||||
---
|
||||
include/configs/meson64.h | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/include/configs/meson64.h b/include/configs/meson64.h
|
||||
index 9244601284..0692fa1716 100644
|
||||
--- a/include/configs/meson64.h
|
||||
+++ b/include/configs/meson64.h
|
||||
@@ -71,10 +71,10 @@
|
||||
#ifndef BOOT_TARGET_DEVICES
|
||||
#define BOOT_TARGET_DEVICES(func) \
|
||||
func(ROMUSB, romusb, na) \
|
||||
+ BOOT_TARGET_DEVICES_USB(func) \
|
||||
func(MMC, mmc, 0) \
|
||||
func(MMC, mmc, 1) \
|
||||
func(MMC, mmc, 2) \
|
||||
- BOOT_TARGET_DEVICES_USB(func) \
|
||||
BOOT_TARGET_NVME(func) \
|
||||
BOOT_TARGET_SCSI(func) \
|
||||
func(PXE, pxe, na) \
|
||||
--
|
||||
2.39.2
|
||||
|
||||
Reference in New Issue
Block a user