Skip to content

Commit

Permalink
Onecloud: fix some bugs (armbian#3873)
Browse files Browse the repository at this point in the history
* Refactor patches

* Fix bug: the USB closed to the HDMI doesn't work

* Fix bug: cpufreq doesn't work

* Fix bug: thermal_zone doesn't work

* More frequency governors

* Add bootscript

* Fix bug: add missing dependency
needed for gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf
  • Loading branch information
hzyitc authored Jun 11, 2022
1 parent 8595899 commit a863b5a
Show file tree
Hide file tree
Showing 16 changed files with 306 additions and 124 deletions.
44 changes: 44 additions & 0 deletions config/bootscripts/boot-onecloud.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# DO NOT EDIT THIS FILE
#
# Please edit /boot/armbianEnv.txt to set supported parameters
#

# We can't use `test -z` due to the bug: https://lists.denx.de/pipermail/u-boot/2005-August/011447.html
test -n "${bootdev}" && test -n "${rootdev}"
if test $? != 0; then
echo '=============================================================='
echo 'Please set "bootdev" and "rootdev" before calling this script.'
echo ''
echo 'Boot from usb:'
echo ' bootdev="usb 0"'
echo ' rootdev="/dev/sda2"'
echo ' usb start'
echo ' fatload ${bootdev} 0x20800000 boot.scr && autoscr 0x20800000'
echo ''
echo 'Boot from eMMC:'
echo ' bootdev="mmc 1"'
echo ' rootdev="/dev/mmcblk1p2"'
echo ' fatload ${bootdev} 0x20800000 boot.scr && autoscr 0x20800000'
echo '=============================================================='
exit 22
fi

echo "Try to boot from ${bootdev}"

fatload ${bootdev} 0x20800000 /armbianEnv.txt && env import -t 0x20800000 ${filesize}
test -n "${consoleargs}" || setenv consoleargs "console=ttyAML0,115200n8"

# Boot Arguments
setenv bootargs ""
setenv bootargs "${bootargs} root=${rootdev} rootwait rw"
setenv bootargs "${bootargs} ${consoleargs} no_console_suspend consoleblank=0"

# Booting
fatload ${bootdev} 0x20800000 /uImage || exit 1
fatload ${bootdev} 0x22000000 /uInitrd || exit 1
fatload ${bootdev} 0x21800000 /dtb/meson8b-onecloud.dtb || exit 1

bootm 0x20800000 0x22000000 0x21800000

# Recompile with:
# mkimage -C none -A arm -T script -d /boot/boot.cmd /boot/boot.scr
18 changes: 9 additions & 9 deletions config/kernel/linux-meson-current.config
Original file line number Diff line number Diff line change
Expand Up @@ -571,10 +571,10 @@ CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_SCHEDUTIL is not set
CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
CONFIG_CPU_FREQ_GOV_POWERSAVE=m
CONFIG_CPU_FREQ_GOV_USERSPACE=m
CONFIG_CPU_FREQ_GOV_POWERSAVE=y
CONFIG_CPU_FREQ_GOV_USERSPACE=y
CONFIG_CPU_FREQ_GOV_ONDEMAND=y
CONFIG_CPU_FREQ_GOV_CONSERVATIVE=m
CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
CONFIG_CPU_FREQ_GOV_SCHEDUTIL=y

#
Expand Down Expand Up @@ -4441,7 +4441,7 @@ CONFIG_AMLOGIC_THERMAL=y
# CONFIG_TI_SOC_THERMAL is not set
# end of Texas Instruments thermal drivers

# CONFIG_GENERIC_ADC_THERMAL is not set
CONFIG_GENERIC_ADC_THERMAL=y
CONFIG_KHADAS_MCU_FAN_THERMAL=m
CONFIG_WATCHDOG=y
CONFIG_WATCHDOG_CORE=y
Expand Down Expand Up @@ -7550,11 +7550,11 @@ CONFIG_PM_DEVFREQ=y
#
# DEVFREQ Governors
#
CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND=m
CONFIG_DEVFREQ_GOV_PERFORMANCE=m
CONFIG_DEVFREQ_GOV_POWERSAVE=m
CONFIG_DEVFREQ_GOV_USERSPACE=m
CONFIG_DEVFREQ_GOV_PASSIVE=m
CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND=y
CONFIG_DEVFREQ_GOV_PERFORMANCE=y
CONFIG_DEVFREQ_GOV_POWERSAVE=y
CONFIG_DEVFREQ_GOV_USERSPACE=y
CONFIG_DEVFREQ_GOV_PASSIVE=y

#
# DEVFREQ Drivers
Expand Down
16 changes: 8 additions & 8 deletions config/kernel/linux-meson-edge.config
Original file line number Diff line number Diff line change
Expand Up @@ -574,10 +574,10 @@ CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_SCHEDUTIL is not set
CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
CONFIG_CPU_FREQ_GOV_POWERSAVE=m
CONFIG_CPU_FREQ_GOV_USERSPACE=m
CONFIG_CPU_FREQ_GOV_POWERSAVE=y
CONFIG_CPU_FREQ_GOV_USERSPACE=y
CONFIG_CPU_FREQ_GOV_ONDEMAND=y
CONFIG_CPU_FREQ_GOV_CONSERVATIVE=m
CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
CONFIG_CPU_FREQ_GOV_SCHEDUTIL=y

#
Expand Down Expand Up @@ -4517,7 +4517,7 @@ CONFIG_AMLOGIC_THERMAL=y
# CONFIG_TI_SOC_THERMAL is not set
# end of Texas Instruments thermal drivers

# CONFIG_GENERIC_ADC_THERMAL is not set
CONFIG_GENERIC_ADC_THERMAL=y
CONFIG_KHADAS_MCU_FAN_THERMAL=m
CONFIG_WATCHDOG=y
CONFIG_WATCHDOG_CORE=y
Expand Down Expand Up @@ -7764,10 +7764,10 @@ CONFIG_PM_DEVFREQ=y
# DEVFREQ Governors
#
CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND=y
CONFIG_DEVFREQ_GOV_PERFORMANCE=m
CONFIG_DEVFREQ_GOV_POWERSAVE=m
CONFIG_DEVFREQ_GOV_USERSPACE=m
CONFIG_DEVFREQ_GOV_PASSIVE=m
CONFIG_DEVFREQ_GOV_PERFORMANCE=y
CONFIG_DEVFREQ_GOV_POWERSAVE=y
CONFIG_DEVFREQ_GOV_USERSPACE=y
CONFIG_DEVFREQ_GOV_PASSIVE=y

#
# DEVFREQ Drivers
Expand Down
18 changes: 9 additions & 9 deletions config/kernel/linux-meson-legacy.config
Original file line number Diff line number Diff line change
Expand Up @@ -557,10 +557,10 @@ CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_SCHEDUTIL is not set
CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
CONFIG_CPU_FREQ_GOV_POWERSAVE=m
CONFIG_CPU_FREQ_GOV_USERSPACE=m
CONFIG_CPU_FREQ_GOV_POWERSAVE=y
CONFIG_CPU_FREQ_GOV_USERSPACE=y
CONFIG_CPU_FREQ_GOV_ONDEMAND=y
CONFIG_CPU_FREQ_GOV_CONSERVATIVE=m
CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
CONFIG_CPU_FREQ_GOV_SCHEDUTIL=y

#
Expand Down Expand Up @@ -4284,7 +4284,7 @@ CONFIG_AMLOGIC_THERMAL=y
# CONFIG_TI_SOC_THERMAL is not set
# end of Texas Instruments thermal drivers

# CONFIG_GENERIC_ADC_THERMAL is not set
CONFIG_GENERIC_ADC_THERMAL=y
CONFIG_WATCHDOG=y
CONFIG_WATCHDOG_CORE=y
# CONFIG_WATCHDOG_NOWAYOUT is not set
Expand Down Expand Up @@ -7254,11 +7254,11 @@ CONFIG_PM_DEVFREQ=y
#
# DEVFREQ Governors
#
CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND=m
CONFIG_DEVFREQ_GOV_PERFORMANCE=m
CONFIG_DEVFREQ_GOV_POWERSAVE=m
CONFIG_DEVFREQ_GOV_USERSPACE=m
CONFIG_DEVFREQ_GOV_PASSIVE=m
CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND=y
CONFIG_DEVFREQ_GOV_PERFORMANCE=y
CONFIG_DEVFREQ_GOV_POWERSAVE=y
CONFIG_DEVFREQ_GOV_USERSPACE=y
CONFIG_DEVFREQ_GOV_PASSIVE=y

#
# DEVFREQ Drivers
Expand Down
14 changes: 13 additions & 1 deletion config/sources/families/include/meson_common.inc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ BOOTBRANCH='branch:odroidc-v2011.03'
BOOTDIR='u-boot-odroidc1'
UBOOT_COMPILER="arm-linux-gnueabihf-"
UBOOT_USE_GCC='< 4.9'
BOOTSCRIPT="boot-odroid-c1.ini:boot.ini"
SERIALCON="ttyAML0"
UBOOT_TARGET_MAP=';;sd_fuse/bl1.bin.hardkernel sd_fuse/u-boot.bin'
SRC_LOADADDR='LOADADDR=0x00208000'
Expand Down Expand Up @@ -41,6 +40,19 @@ case $BRANCH in
;;
esac

case $BOARD in
odroidc1)

BOOTSCRIPT="boot-odroid-c1.ini:boot.ini"

;;
onecloud)

BOOTSCRIPT="boot-onecloud.cmd:boot.cmd"

;;
esac

write_uboot_platform()
{
dd if=$1/bl1.bin.hardkernel of=$2 bs=1 count=442 conv=fsync > /dev/null 2>&1
Expand Down
1 change: 1 addition & 0 deletions config/templates/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ RUN apt-get update \
libssl-dev \
libusb-1.0-0-dev \
linux-base \
libmpc-dev \
locales \
lsb-release \
lzop \
Expand Down
2 changes: 1 addition & 1 deletion lib/general.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1381,7 +1381,7 @@ prepare_host()
dialog dirmngr dosfstools dwarves f2fs-tools fakeroot flex gawk \
gcc-arm-linux-gnueabi gcc-aarch64-linux-gnu gdisk gpg busybox \
imagemagick jq kmod libbison-dev libc6-dev-armhf-cross libcrypto++-dev \
libelf-dev libfdt-dev libfile-fcntllock-perl parallel \
libelf-dev libfdt-dev libfile-fcntllock-perl parallel libmpc-dev \
libfl-dev liblz4-tool libncurses-dev libpython2.7-dev libssl-dev \
libusb-1.0-0-dev linux-base locales lzop ncurses-base ncurses-term \
nfs-kernel-server ntpdate p7zip-full parted patchutils pigz pixz \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
Support Xunlei OneCloud
Add dts

---
arch/arm/boot/dts/Makefile | 1 +
arch/arm/boot/dts/meson8b-onecloud.dts | 366 +++++++++++++++++++++++++
2 files changed, 367 insertions(+)
arch/arm/boot/dts/meson8b-onecloud.dts | 369 +++++++++++++++++++++++++
2 files changed, 370 insertions(+)
create mode 100644 arch/arm/boot/dts/meson8b-onecloud.dts

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 7e8151681..e8d5ca39d 100644
index 863347b6b..0b50bfb6f 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -347,6 +347,7 @@ dtb-$(CONFIG_MACH_MESON8) += \
@@ -350,6 +350,7 @@ dtb-$(CONFIG_MACH_MESON8) += \
meson8b-ec100.dtb \
meson8b-mxq.dtb \
meson8b-odroidc1.dtb \
Expand All @@ -20,10 +20,10 @@ index 7e8151681..e8d5ca39d 100644
pxa168-aspenite.dtb \
diff --git a/arch/arm/boot/dts/meson8b-onecloud.dts b/arch/arm/boot/dts/meson8b-onecloud.dts
new file mode 100644
index 000000000..050b2e653
index 000000000..5661e5fe3
--- /dev/null
+++ b/arch/arm/boot/dts/meson8b-onecloud.dts
@@ -0,0 +1,366 @@
@@ -0,0 +1,369 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Author: hzyitc
Expand Down Expand Up @@ -157,23 +157,27 @@ index 000000000..050b2e653
+ // compatible = "regulator-fixed";
+
+ regulator-name = "VCC_CORE";
+ // In fact, it's 1.0V.
+ // But the kernel tries to tweak it and has lots of warning.
+ // regulator-min-microvolt = <1000000>;
+ // regulator-max-microvolt = <1000000>;
+ regulator-min-microvolt = <860000>;
+ regulator-max-microvolt = <1140000>;
+ regulator-min-microvolt = <1000000>;
+ regulator-max-microvolt = <1000000>;
+
+ vin-supply = <&p12v>;
+ };
+};
+
+&cpu0 {
+ cpu-supply = <&vcc_core>;
+ // The board only has fixed-regulator.
+ // But the OPP require a adjustable-regulator.
+ // When `cpu-supply` is not set, `cpufreq-dt` will
+ // ignore the voltage and just tweak frequency.
+ // cpu-supply = <&vcc_core>;
+};
+
+&mali {
+ mali-supply = <&vcc_core>;
+ // The board only has fixed-regulator.
+ // But the OPP require a adjustable-regulator.
+ // When `mali-supply` is not set, `lima` will
+ // ignore the voltage and just tweak frequency.
+ // mali-supply = <&vcc_core>;
+};
+
+&gpio {
Expand Down Expand Up @@ -373,7 +377,6 @@ index 000000000..050b2e653
+};
+
+&usb0 {
+ dr_mode = "otg";
+ status = "okay";
+};
+
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
USB: Disable ACA check

In V1.3, USB0 fails in this check.
But it can work normally.
So just disable this check.

---
drivers/phy/amlogic/phy-meson8b-usb2.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/phy/amlogic/phy-meson8b-usb2.c b/drivers/phy/amlogic/phy-meson8b-usb2.c
index 03c061dd5..9a49a2d92 100644
--- a/drivers/phy/amlogic/phy-meson8b-usb2.c
+++ b/drivers/phy/amlogic/phy-meson8b-usb2.c
@@ -195,12 +195,12 @@ static int phy_meson8b_usb2_power_on(struct phy *phy)
udelay(ACA_ENABLE_COMPLETE_TIME);

regmap_read(priv->regmap, REG_ADP_BC, &reg);
- if (reg & REG_ADP_BC_ACA_PIN_FLOAT) {
+ /*if (reg & REG_ADP_BC_ACA_PIN_FLOAT) {
dev_warn(&phy->dev, "USB ID detect failed!\n");
clk_disable_unprepare(priv->clk_usb);
clk_disable_unprepare(priv->clk_usb_general);
return -EINVAL;
- }
+ }*/
}
}

--
2.25.1

Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
Generate uImage instand of zImage

---
scripts/package/builddeb | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index 3b80bd3f6..79bb8de6d 100755
index 91a502bb9..196889f1d 100755
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -285,6 +285,12 @@ if [ "$ARCH" != "um" ]; then
create_package "$dtb_packagename" "$dtb_dir"
@@ -218,6 +218,13 @@ if [ "$ARCH" != "um" ]; then
create_package linux-libc-dev debian/linux-libc-dev
fi

+sed -e "s/exit 0//g" -i $tmpdir/DEBIAN/postinst
Expand All @@ -12,6 +18,10 @@ index 3b80bd3f6..79bb8de6d 100755
+rm -f /boot/zImage
+exit 0
+EOT
+
create_package "$packagename" "$tmpdir"

if [ -n "$BUILD_DEBUG" ] ; then
--
2.25.1

Loading

0 comments on commit a863b5a

Please sign in to comment.