Merge pull request #2199 from fewtarius/dev

Switch to upstream HK u-boot for OGU.
This commit is contained in:
fewtarius 2023-10-15 12:08:57 -04:00 committed by GitHub
commit 9cdbb59d98
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 311 additions and 2 deletions

View file

@ -4,14 +4,15 @@
# Copyright (C) 2022-present Fewtarius
PKG_NAME="u-boot"
PKG_VERSION="95c5b7a80e"
PKG_VERSION="9235942"
PKG_LICENSE="GPL"
PKG_SITE="https://www.denx.de/wiki/U-Boot"
PKG_URL="https://github.com/JustEnoughLinuxOS/hardkernel-uboot/archive/${PKG_VERSION}.tar.gz"
PKG_URL="https://github.com/hardkernel/u-boot.git"
PKG_DEPENDS_TARGET="toolchain gcc-linaro-aarch64-elf:host gcc-linaro-arm-eabi:host"
PKG_LONGDESC="Das U-Boot is a cross-platform bootloader for embedded systems."
PKG_TOOLCHAIN="manual"
PKG_PATCH_DIRS+="${DEVICE}*"
PKG_GIT_CLONE_BRANCH="odroidgoU-v2015.01"
make_target() {
. ${PROJECT_DIR}/${PROJECT}/devices/${DEVICE}/options

View file

@ -0,0 +1,45 @@
diff --git a/board/hardkernel/odroidgou/odroidgou.c b/board/hardkernel/odroidgou/odroidgou.c
index d08f0aac00..a9c6a13279 100755
--- a/board/hardkernel/odroidgou/odroidgou.c
+++ b/board/hardkernel/odroidgou/odroidgou.c
@@ -311,8 +311,29 @@ int board_late_init(void)
gou_bmp_display(DISP_LOGO);
#endif
- setenv("variant", "gou");
- board_set_dtbfile("meson64_odroid%s.dtb");
+#define IS_RANGE(x, min, max) ((x) > (min) && (x) < (max))
+
+ int adc = get_adc_value(2);
+ int family = get_cpu_id().family_id;
+ int package = get_cpu_id().package_id;
+ printf("ADC:%d\n", adc);
+ printf("FAMILY:%d\n",family);
+ printf("PACKAGE:%d\n",package);
+
+ /* Unfortunately while the ADC is available, both devices ADC values
+ are within the tolerance range of each other (IS_RANGE(adc, 510, 550)
+ therefor we need to use an alternative. The S922X SoC is 0x40 (64),
+ and the A311D SoC is 0x10 (16). */
+
+ if (package == 64) {
+ setenv("variant", "gou");
+ setenv("fdtfile", "meson-g12b-odroid-go-ultra.dtb");
+ } else {
+ setenv("variant", "max3");
+ setenv("fdtfile", "meson-g12b-powkiddy-rgb10-max-3.dtb");
+ }
+
+ // board_set_dtbfile("meson64_odroid%s.dtb");
if (board_check_recovery() < 0) {
gou_bmp_display(DISP_SYS_ERR);
@@ -327,6 +348,8 @@ int board_late_init(void)
}
switch (get_bootmode()) {
case BOOTMODE_RECOVERY :
+ setenv("variant", "gou");
+ board_set_dtbfile("meson64_odroid%s.dtb");
gou_bmp_display(DISP_RECOVERY);
mdelay(2000);
break;

View file

@ -0,0 +1,13 @@
diff --git a/arch/arm/cpu/armv8/g12b/firmware/scp_task/user_task.c b/arch/arm/cpu/armv8/g12b/firmware/scp_task/user_task.c
index 1bad144eea..d9d3a6ac0a 100644
--- a/arch/arm/cpu/armv8/g12b/firmware/scp_task/user_task.c
+++ b/arch/arm/cpu/armv8/g12b/firmware/scp_task/user_task.c
@@ -103,7 +103,7 @@ void secure_task(void)
(void *)response, state);
} else if (command == COMMAND_SUSPEND_ENTER) {
state = *(pcommand+1);
- enter_suspend(state);
+ //enter_suspend(state);
*pcommand = 0;
*response = RESPONSE_SUSPEND_LEAVE;
presume = (struct resume_param *)(response+1);

View file

@ -0,0 +1,197 @@
From 3e239031788947f44e40f1987e33c03851fe541d Mon Sep 17 00:00:00 2001
From: "Mauro (mdrjr) Ribeiro" <mauro.ribeiro@hardkernel.com>
Date: Tue, 5 Sep 2023 15:03:17 -0300
Subject: [PATCH] ODROID-GOU: modify lcd logic to accomodate kernel 6.x drivers
Change-Id: I7b6827e2996a4d1f4b0a1c95997bdfbf1693f3bf
---
board/hardkernel/odroidgou/display.c | 10 +++++++
board/hardkernel/odroidgou/display.h | 2 +-
board/hardkernel/odroidgou/odroid_pmic.c | 10 ++++++-
board/hardkernel/odroidgou/odroidgou.c | 11 ++++----
board/hardkernel/odroidgou/recovery.c | 34 +++++++++++-------------
board/hardkernel/odroidgou/recovery.h | 1 +
6 files changed, 42 insertions(+), 26 deletions(-)
diff --git a/board/hardkernel/odroidgou/display.c b/board/hardkernel/odroidgou/display.c
index 859cfc766de..6f73ec11263 100755
--- a/board/hardkernel/odroidgou/display.c
+++ b/board/hardkernel/odroidgou/display.c
@@ -14,6 +14,9 @@
#include <vsprintf.h>
#include <linux/kernel.h>
#include <version.h>
+#ifdef CONFIG_AML_LCD
+#include <amlogic/aml_lcd.h>
+#endif
#include <../odroid-common/odroid-common.h>
#include "display.h"
@@ -30,6 +33,13 @@ static int boot_partition(void)
return -1;
}
+void gou_init_lcd(void)
+{
+ lcd_probe();
+ gou_display_env_init();
+ gou_bmp_display(DISP_LOGO);
+}
+
int gou_display_env_init(void)
{
char str[64];
diff --git a/board/hardkernel/odroidgou/display.h b/board/hardkernel/odroidgou/display.h
index 1fb25c45211..05aeaab0e6d 100755
--- a/board/hardkernel/odroidgou/display.h
+++ b/board/hardkernel/odroidgou/display.h
@@ -32,6 +32,6 @@ enum disp_index_e {
extern int gou_display_env_init(void);
extern int gou_bmp_display(unsigned idx);
-
+extern void gou_init_lcd(void);
#endif
diff --git a/board/hardkernel/odroidgou/odroid_pmic.c b/board/hardkernel/odroidgou/odroid_pmic.c
index b39b7c566b9..5f243ce7ec9 100755
--- a/board/hardkernel/odroidgou/odroid_pmic.c
+++ b/board/hardkernel/odroidgou/odroid_pmic.c
@@ -199,6 +199,11 @@ int board_check_power(void)
printf("PWRON source : %d\n",pwron_src);
if ((pwron_src != PWRON_KEY) && (bootmode == BOOTMODE_NORMAL)) {
+ if((pwron_src == PWRON_USB) && (get_battery_cap() > 0))
+ return 0;
+ else
+ gou_init_lcd();
+
/* RK817 BOOST, OTG_POWER(USB A-type VBUS) disable */
rk817_i2c_write(RK817_POWER_EN3, 0xf0);
printf("battery charge state\n");
@@ -219,12 +224,15 @@ int board_check_power(void)
charger_led_bilnk(0);
if ( offset < DISP_BATT_3)
gou_bmp_display(offset+1);
- else gou_bmp_display(offset);
+ else
+ gou_bmp_display(offset);
+
mdelay(750);
charger_led_bilnk(0);
if(check_charge_exit_key())
break;
+
if(!is_charging())
run_command("poweroff", 0);
}
diff --git a/board/hardkernel/odroidgou/odroidgou.c b/board/hardkernel/odroidgou/odroidgou.c
index d08f0aac000..4e7c7ef0d0b 100755
--- a/board/hardkernel/odroidgou/odroidgou.c
+++ b/board/hardkernel/odroidgou/odroidgou.c
@@ -302,14 +302,13 @@ int board_late_init(void)
#endif
vpp_init();
+ check_hotkey();
+
+ if((get_bootmode() != BOOTMODE_NORMAL) || (board_check_power() < 0)) {
#ifdef CONFIG_AML_LCD
- lcd_probe();
-#endif
- /* boot logo display - 1080p60hz */
-#ifdef CONFIG_AML_LCD
- gou_display_env_init();
- gou_bmp_display(DISP_LOGO);
+ gou_init_lcd();
#endif
+ }
setenv("variant", "gou");
board_set_dtbfile("meson64_odroid%s.dtb");
diff --git a/board/hardkernel/odroidgou/recovery.c b/board/hardkernel/odroidgou/recovery.c
index a9d72663aae..cbd5c8c68df 100755
--- a/board/hardkernel/odroidgou/recovery.c
+++ b/board/hardkernel/odroidgou/recovery.c
@@ -30,7 +30,7 @@ int boot_device(void)
return -1;
}
-int check_hotkey(void)
+void check_hotkey(void)
{
int left1,left2,right1,right2;
int boot_mode = 0;
@@ -61,7 +61,19 @@ int check_hotkey(void)
boot_mode = BOOTMODE_NORMAL;
printf("bootmode : Nomal boot. \n");
}
- return boot_mode;
+
+ switch (boot_mode) {
+ case BOOTMODE_RECOVERY :
+ setenv("bootmode", "recovery");
+ break;
+ case BOOTMODE_TEST :
+ setenv("bootmode", "test");
+ break;
+ case BOOTMODE_NORMAL :
+ default :
+ setenv("bootmode", "normal");
+ break;
+ }
}
@@ -78,7 +90,7 @@ int board_check_recovery(void)
goto recovery;
}
}
- boot_mode = check_hotkey();
+ boot_mode = get_bootmode();
if (boot_mode != BOOTMODE_NORMAL) {
if (board_check_odroidbios(dev) == 0) {
@@ -89,20 +101,6 @@ int board_check_recovery(void)
run_command("mmc dev 0", 0);
} else return -1;
}
-
- switch (boot_mode) {
- case BOOTMODE_RECOVERY :
- setenv("bootmode", "recovery");
- break;
- case BOOTMODE_TEST :
- setenv("bootmode", "test");
- break;
- case BOOTMODE_NORMAL :
- default :
- setenv("bootmode", "normal");
- break;
- }
-
recovery:
return 0;
}
@@ -116,7 +114,7 @@ int get_bootmode(void)
else if (!strcmp("test", pmode)) ret = BOOTMODE_TEST;
else if (!strcmp("recovery", pmode)) ret = BOOTMODE_RECOVERY;
else ret = BOOTMODE_NORMAL;
-
+
return ret;
}
diff --git a/board/hardkernel/odroidgou/recovery.h b/board/hardkernel/odroidgou/recovery.h
index 3fa0933c412..15d961d8efb 100755
--- a/board/hardkernel/odroidgou/recovery.h
+++ b/board/hardkernel/odroidgou/recovery.h
@@ -30,6 +30,7 @@
int board_check_recovery(void);
int get_bootmode(void);
+void check_hotkey(void);
#endif

View file

@ -0,0 +1,53 @@
diff --git a/Makefile b/Makefile
index 71a7cc3c73..d171e590c6 100644
--- a/Makefile
+++ b/Makefile
@@ -246,8 +246,6 @@ ifeq ($(HOSTARCH),$(ARCH))
CROSS_COMPILE ?=
endif
-export CROSS_COMPILE=aarch64-none-elf-
-
KCONFIG_CONFIG ?= .config
export KCONFIG_CONFIG
diff --git a/arch/arm/cpu/armv8/g12b/firmware/scp_task/Makefile b/arch/arm/cpu/armv8/g12b/firmware/scp_task/Makefile
index 82f31b88bb..7b227f6b8a 100644
--- a/arch/arm/cpu/armv8/g12b/firmware/scp_task/Makefile
+++ b/arch/arm/cpu/armv8/g12b/firmware/scp_task/Makefile
@@ -6,7 +6,7 @@ include $(buildtree)/include/autoconf.mk
include $(buildtree)/.config
# Select ARMv7-m bare-metal toolchain
-CROSS_COMPILE=arm-none-eabi-
+CROSS_COMPILE=arm-eabi-
ASM=$(CROSS_COMPILE)as
CC=$(CROSS_COMPILE)gcc
CPP=$(CROSS_COMPILE)cpp
diff --git a/common/cmd_source.c b/common/cmd_source.c
index 3917cea8c4..919672f60f 100644
--- a/common/cmd_source.c
+++ b/common/cmd_source.c
@@ -29,11 +29,11 @@
#include <linux/ctype.h>
static
-int check_odroid_script(ulong addr, char *product)
+int check_odroid_script(ulong addr)
{
char *buf;
char magic[32];
- int size = snprintf(magic, sizeof(magic), "%s-uboot-config\n", product);
+ int size = snprintf(magic, sizeof(magic), "jelos-uboot-config\n");
buf = map_sysmem(addr, 0);
if (strncasecmp(magic, buf, size))
@@ -154,7 +154,7 @@ source (ulong addr, const char *fit_uname)
#endif
default:
#if defined(CONFIG_ODROID_COMMON)
- size = check_odroid_script(addr, CONFIG_DEVICE_PRODUCT);
+ size = check_odroid_script(addr);
if (size > 0) {
data = (u32*)(addr + size);
len = simple_strtoul(getenv("filesize"), NULL, 16) - size;