u-boot: update to hardkernel-6e4e886

This adds support for setting max_freq and maxcpus bootargs
Also adds a patch for missing CEC wake-up code
This commit is contained in:
Jonas Karlman 2016-09-19 21:52:29 +02:00
parent ef0f30ad8b
commit 824e5d18aa
6 changed files with 353 additions and 1470 deletions

View File

@ -25,7 +25,7 @@ if [ "$UBOOT_VERSION" = "imx6-cuboxi" ]; then
PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz"
[ -n "$UBOOT_CONFIG_V2" ] && PKG_DEPENDS_TARGET="toolchain u-boot-v2"
elif [ "$UBOOT_VERSION" = "hardkernel" ]; then
PKG_VERSION="61f29bb"
PKG_VERSION="6e4e886"
PKG_SITE="https://github.com/hardkernel/u-boot"
PKG_URL="https://github.com/hardkernel/u-boot/archive/$PKG_VERSION.tar.gz"
PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET gcc-linaro-aarch64-elf:host gcc-linaro-arm-eabi:host"

View File

@ -136,13 +136,42 @@ setenv hdmi_cec "1"
#------------------------------------------------------------------------------------------------------
setenv audio_dac "0"
#------------------------------------------------------------------------------------------------------
#
# CPU Frequency / Cores control
#
# WARNING!!! WARNING!!! WARNING!!!
# Before changing anything here please read the wiki entry:
# http://odroid.com/dokuwiki/doku.php?id=en:c2_set_cpu_freq
#
# MAX CPU's
# setenv maxcpus "1"
# setenv maxcpus "2"
# setenv maxcpus "3"
# setenv maxcpus "4"
#
# MAX Frequency
# setenv max_freq "2016" # 2.016GHz
# setenv max_freq "1944" # 1.944GHz
# setenv max_freq "1944" # 1.944GHz
# setenv max_freq "1920" # 1.920GHz
# setenv max_freq "1896" # 1.896GHz
# setenv max_freq "1752" # 1.752GHz
# setenv max_freq "1680" # 1.680GHz
# setenv max_freq "1656" # 1.656GHz
# setenv max_freq "1536" # 1.536GHz
#
#------------------------------------------------------------------------------------------------------
setenv maxcpus "4"
setenv max_freq "1536"
#------------------------------------------------------------------------------------------------------
#
# Odroid C1 specific
#
#------------------------------------------------------------------------------------------------------
setenv odroidp1 "no_console_suspend hdmimode=${video_output} m_bpp=${video_bpp} vout=${video_mode}"
setenv odroidp2 "${disableuhs} consoleblank=0"
setenv odroidp2 "${disableuhs} consoleblank=0 max_freq=${max_freq} maxcpus=${maxcpus}"
setenv odroid "${odroidp1} ${odroidp2}"
#------------------------------------------------------------------------------------------------------

View File

@ -0,0 +1,97 @@
From dee146cbbb8428b073fba85390577590fc365d86 Mon Sep 17 00:00:00 2001
From: Joy Cho <joy.cho@hardkernel.com>
Date: Wed, 31 Aug 2016 16:27:48 +0900
Subject: [PATCH] ODROID-C2: Add setup routine to set max. cpu frequency of
dvfs table
- set "max_freq" in boot.ini
- in MHz unit
ex) setenv max_freq "1656"
Change-Id: I352c9540d0c34d3ec0ba0f470dae9d4e0786c001
---
drivers/amlogic/mailbox/scpi_protocol.c | 53 +++++++++++++++++++++++++++++++++
1 file changed, 53 insertions(+)
diff --git a/drivers/amlogic/mailbox/scpi_protocol.c b/drivers/amlogic/mailbox/scpi_protocol.c
index ec787d2..f3aa3e0 100644
--- a/drivers/amlogic/mailbox/scpi_protocol.c
+++ b/drivers/amlogic/mailbox/scpi_protocol.c
@@ -129,6 +129,12 @@ static int high_priority_cmds[] = {
SCPI_CMD_SENSOR_CFG_BOUNDS,
};
+#if defined(CONFIG_ARCH_MESON64_ODROIDC2)
+#define DVFS_COUNT_MAX 13
+#define DVFS_COUNT_1536 6
+static unsigned long max_freq_dvfs;
+#endif
+
static struct scpi_opp *scpi_opps[MAX_DVFS_DOMAINS];
static int scpi_linux_errmap[SCPI_ERR_MAX] = {
@@ -267,6 +273,9 @@ struct scpi_opp *scpi_dvfs_get_opps(u8 domain)
struct scpi_opp *opps;
size_t opps_sz;
int count, ret;
+#if defined(CONFIG_ARCH_MESON64_ODROIDC2)
+ int i, max_index;
+#endif
if (domain >= MAX_DVFS_DOMAINS)
return ERR_PTR(-EINVAL);
@@ -285,6 +294,27 @@ struct scpi_opp *scpi_dvfs_get_opps(u8 domain)
return ERR_PTR(-ENOMEM);
count = DVFS_OPP_COUNT(buf.header);
+
+#if defined(CONFIG_ARCH_MESON64_ODROIDC2)
+ max_index = 0;
+ if (max_freq_dvfs) {
+ for (i = 0; i < count; i++) {
+ if (buf.opp[i].freq_hz == max_freq_dvfs)
+ break;
+ else
+ max_index++;
+ }
+ count = max_index + 1;
+ }
+ /* if no param "max_freq_dvfs or wrong "max_freq_dvfs"
+ * from boot.ini, consider stable max value */
+ if ((max_freq_dvfs == 0) || (count > DVFS_COUNT_MAX))
+ count = DVFS_COUNT_1536; /* default max : 1.536GHz */
+
+ pr_info("dvfs [%s] - new count %d, max_freq %ld\n", __func__,
+ count, max_freq_dvfs);
+#endif
+
opps_sz = count * sizeof(*(opps->opp));
opps->count = count;
@@ -416,3 +446,26 @@ int scpi_get_sensor_value(u16 sensor, u32 *val)
return ret;
}
EXPORT_SYMBOL_GPL(scpi_get_sensor_value);
+
+#if defined(CONFIG_ARCH_MESON64_ODROIDC2)
+static int __init get_max_freq(char *str)
+{
+ int ret;
+
+ if (NULL == str) {
+ /* consider default set */
+ max_freq_dvfs = 1536000000;
+ return -EINVAL;
+ }
+
+ ret = kstrtoul(str, 0, &max_freq_dvfs);
+
+ /* in unit Hz */
+ max_freq_dvfs *= 1000000;
+
+ pr_info("dvfs [%s] - max_freq : %ld\n", __func__, max_freq_dvfs);
+
+ return 0;
+}
+__setup("max_freq=", get_max_freq);
+#endif

View File

@ -0,0 +1,225 @@
From c2ebdfc8d2a03f583410db24bb8086044e9c72bb Mon Sep 17 00:00:00 2001
From: Jonas Karlman <jonas@kwiboo.se>
Date: Wed, 7 Sep 2016 20:55:24 +0200
Subject: [PATCH] Update CEC wakeup code
This also removes the forced cec config
---
.../cpu/armv8/gxb/firmware/scp_task/hdmi_cec_arc.c | 102 ++++++++++++---------
arch/arm/cpu/armv8/gxb/firmware/scp_task/suspend.c | 2 -
2 files changed, 58 insertions(+), 46 deletions(-)
diff --git a/arch/arm/cpu/armv8/gxb/firmware/scp_task/hdmi_cec_arc.c b/arch/arm/cpu/armv8/gxb/firmware/scp_task/hdmi_cec_arc.c
index 969777f..7d397ca 100644
--- a/arch/arm/cpu/armv8/gxb/firmware/scp_task/hdmi_cec_arc.c
+++ b/arch/arm/cpu/armv8/gxb/firmware/scp_task/hdmi_cec_arc.c
@@ -41,7 +41,7 @@ static void *cec_memcpy(void *memto, const void *memfrom, unsigned int size)
}
static void waiting_aocec_free(void) {
- unsigned int cnt = 0;
+ unsigned long cnt = 0;
while (readl(P_AO_CEC_RW_REG) & (1<<23))
{
if (8192 <= cnt++)
@@ -146,8 +146,6 @@ void remote_cec_hw_reset(void)
static int cec_triggle_tx(unsigned char *msg, unsigned char len)
{
unsigned int i, cnt = 0;
- cec_dbg_print("cec_triggle_tx len:0x", len);
- cec_dbg_prints("\n");
cec_dbg_prints(" T:");
for (i = 0; i < len; i++) {
@@ -168,6 +166,7 @@ static int cec_triggle_tx(unsigned char *msg, unsigned char len)
cec_dbg_prints("\n");
}
+ _udelay(150);
return 0;
}
@@ -180,7 +179,7 @@ static int cec_triggle_tx(unsigned char *msg, unsigned char len)
#define DEVICE_PURE_CEC_SWITCH 6
#define DEVICE_VIDEO_PROCESSOR 7
-static unsigned char log_addr_to_devtype(unsigned int addr)
+static unsigned char log_addr_to_devtype(unsigned char addr)
{
static unsigned char addr_map[] = {
DEVICE_TV,
@@ -211,7 +210,7 @@ static void cec_report_physical_address(void)
msg[0] = ((cec_msg.log_addr & 0xf) << 4) | CEC_BROADCAST_ADDR;
msg[1] = CEC_OC_REPORT_PHYSICAL_ADDRESS;
msg[2] = (cec_msg.phy_addr >> 8) & 0xff;
- msg[3] = cec_msg.phy_addr & 0xff;
+ msg[3] = (cec_msg.phy_addr >> 0) & 0xff;
msg[4] = log_addr_to_devtype(cec_msg.log_addr);
cec_triggle_tx(msg, 5);
@@ -245,18 +244,44 @@ static void cec_feature_abort(unsigned char reason, unsigned char initiator)
cec_triggle_tx(msg, 4);
}
-static void cec_set_stream_path(void)
+static void cec_menu_status(unsigned char menu_status, unsigned char initiator)
+{
+ unsigned char msg[3];
+ cec_dbg_print("cec_menu_status menu_status:0x", menu_status);
+ cec_dbg_printx(", initiator:0x", initiator, 4);
+ cec_dbg_prints("\n");
+
+ msg[0] = ((cec_msg.log_addr & 0xf) << 4) | (initiator & 0xf);
+ msg[1] = CEC_OC_MENU_STATUS;
+ msg[2] = menu_status;
+
+ cec_triggle_tx(msg, 3);
+}
+
+static void cec_set_stream_path(unsigned char initiator)
{
- unsigned char phy_addr_ab = (cec_msg.phy_addr >> 8) & 0xff;
- unsigned char phy_addr_cd = cec_msg.phy_addr & 0xff;
- cec_dbg_prints("cec_set_stream_path\n");
-
- if ((hdmi_cec_func_config >> AUTO_POWER_ON_MASK) & 0x1) {
- if ((hdmi_cec_func_config >> STREAMPATH_POWER_ON_MASK) & 0x1) {
- if ((phy_addr_ab == cec_msg.msg[2]) &&
- (phy_addr_cd == cec_msg.msg[3])) {
- cec_msg.cec_power = 0x1;
- }
+ unsigned int phy_addr = (cec_msg.msg[2] << 8) | cec_msg.msg[3];
+ cec_dbg_printx("cec_set_stream_path initiator:0x", initiator, 4);
+ cec_dbg_printx(", phy_addr:0x", phy_addr, 16);
+ cec_dbg_prints("\n");
+
+ if ((hdmi_cec_func_config >> STREAMPATH_POWER_ON_MASK) & 0x1) {
+ if (cec_msg.phy_addr == phy_addr && initiator == CEC_TV_ADDR) {
+ cec_msg.cec_power = 0x1;
+ }
+ }
+}
+
+static void cec_routing_change(unsigned char initiator)
+{
+ unsigned int phy_addr = (cec_msg.msg[4] << 8) | cec_msg.msg[5];
+ cec_dbg_printx("cec_routing_change initiator:0x", initiator, 4);
+ cec_dbg_printx(", phy_addr:0x", phy_addr, 16);
+ cec_dbg_prints("\n");
+
+ if ((hdmi_cec_func_config >> STREAMPATH_POWER_ON_MASK) & 0x1) {
+ if (cec_msg.phy_addr == phy_addr && initiator == CEC_TV_ADDR) {
+ cec_msg.cec_power = 0x1;
}
}
}
@@ -266,10 +291,14 @@ static void cec_user_control_pressed(void)
cec_dbg_print("cec_user_control_pressed operation:0x", cec_msg.msg[2]);
cec_dbg_prints("\n");
- if ((hdmi_cec_func_config >> AUTO_POWER_ON_MASK) & 0x1) {
+ if ((hdmi_cec_func_config >> ONE_TOUCH_STANDBY_MASK) & 0x1) {
if ((0x40 == cec_msg.msg[2]) || // Power
(0x6b == cec_msg.msg[2]) || // Power Toggle Function
(0x6d == cec_msg.msg[2]) || // Power On Function
+ (0x0a == cec_msg.msg[2]) || // Setup Menu
+ (0x0b == cec_msg.msg[2]) || // Contents Menu
+ (0x10 == cec_msg.msg[2]) || // Media Top Menu
+ (0x11 == cec_msg.msg[2]) || // Media Context-sensitive Menu
(0x09 == cec_msg.msg[2])) { // Root Menu
cec_msg.cec_power = 0x1;
}
@@ -290,20 +319,6 @@ static void cec_device_vendor_id(void)
cec_triggle_tx(msg, 5);
}
-static void cec_menu_status(unsigned char menu_status, unsigned char initiator)
-{
- unsigned char msg[3];
- cec_dbg_print("cec_menu_status menu_status:0x", menu_status);
- cec_dbg_printx(", initiator:0x", initiator, 4);
- cec_dbg_prints("\n");
-
- msg[0] = ((cec_msg.log_addr & 0xf) << 4) | (initiator & 0xf);
- msg[1] = CEC_OC_MENU_STATUS;
- msg[2] = menu_status;
-
- cec_triggle_tx(msg, 3);
-}
-
static void cec_deck_status(unsigned char initiator)
{
unsigned char msg[3];
@@ -349,7 +364,7 @@ static unsigned int cec_handle_message(void)
unsigned char initiator = (cec_msg.msg[0] >> 4) & 0xf;
unsigned char destination = cec_msg.msg[0] & 0xf;
unsigned char opcode = (cec_msg.msg_len > 1) ? cec_msg.msg[1] : CEC_OC_POLLING_MESSAGE;
- unsigned char directly_addressed = (destination != 0xf && destination == cec_msg.log_addr);
+ unsigned char directly_addressed = (destination != CEC_BROADCAST_ADDR && destination == cec_msg.log_addr);
cec_dbg_printx("cec_handle_message initiator:0x", initiator, 4);
cec_dbg_printx(", destination:0x", destination, 4);
@@ -380,7 +395,10 @@ static unsigned int cec_handle_message(void)
cec_set_osd_name(initiator);
break;
case CEC_OC_SET_STREAM_PATH:
- cec_set_stream_path();
+ cec_set_stream_path(initiator);
+ break;
+ case CEC_OC_ROUTING_CHANGE:
+ cec_routing_change(initiator);
break;
case CEC_OC_GIVE_DEVICE_POWER_STATUS:
if (directly_addressed)
@@ -494,16 +512,7 @@ unsigned int cec_handler(void)
void cec_node_init(void)
{
unsigned int phy_addr = readl(P_AO_DEBUG_REG1) & 0xffff;
- unsigned int log_addr = readl(P_AO_DEBUG_REG3) & 0xf;
- if (!log_addr)
- log_addr = 0xf;
-
- cec_dbg_printx("AO_DEBUG_REG0:0x", readl(P_AO_DEBUG_REG0), 32);
- cec_dbg_printx(", AO_DEBUG_REG1:0x", readl(P_AO_DEBUG_REG1), 32);
- cec_dbg_prints("\n");
- cec_dbg_printx("AO_DEBUG_REG2:0x", readl(P_AO_DEBUG_REG2), 32);
- cec_dbg_printx(", AO_DEBUG_REG3:0x", readl(P_AO_DEBUG_REG3), 32);
- cec_dbg_prints("\n");
+ unsigned char log_addr = readl(P_AO_DEBUG_REG3) & 0xf;
cec_dbg_print("cec_node_init cec_config:0x", hdmi_cec_func_config);
cec_dbg_printx(", log_addr:0x", log_addr, 4);
@@ -515,6 +524,12 @@ void cec_node_init(void)
cec_msg.log_addr = log_addr;
cec_msg.phy_addr = phy_addr;
+ if (!cec_msg.log_addr || !cec_msg.phy_addr) {
+ cec_dbg_prints("WARNING: log/phy_addr is not set, disabling cec wakeup\n");
+ hdmi_cec_func_config = hdmi_cec_func_config & ~(0x1 << CEC_FUNC_MASK);
+ return;
+ }
+
cec_wr_reg(CEC_LOGICAL_ADDR0, 0);
cec_hw_buf_clear();
cec_wr_reg(CEC_LOGICAL_ADDR0, log_addr);
@@ -523,7 +538,6 @@ void cec_node_init(void)
_udelay(100);
cec_report_physical_address();
- _udelay(150);
cec_device_vendor_id();
cec_set_osd_name(CEC_TV_ADDR);
}
diff --git a/arch/arm/cpu/armv8/gxb/firmware/scp_task/suspend.c b/arch/arm/cpu/armv8/gxb/firmware/scp_task/suspend.c
index 8a414da..b16910c 100644
--- a/arch/arm/cpu/armv8/gxb/firmware/scp_task/suspend.c
+++ b/arch/arm/cpu/armv8/gxb/firmware/scp_task/suspend.c
@@ -73,8 +73,6 @@ void enter_suspend(unsigned int suspend_from)
// FIXME : (1) BLUE LED GPIOAO_13 (2) Current issue 12*mA -> 7*mA
#ifdef CONFIG_CEC_WAKEUP
hdmi_cec_func_config = readl(P_AO_DEBUG_REG0) & 0xff;
- if (!hdmi_cec_func_config)
- hdmi_cec_func_config = 0x2f; // Force cec config until kernel is "fixed"
wait_uart_empty();
uart_puts("CEC cfg:0x");
uart_put_hex(hdmi_cec_func_config, 8);