device/pine64-pinebookpro: switch to mainline (MR 2021)

* Add u-boot build with a lot of patches that makes the display work in
  u-boot for boot selection
* Upgrade the rockchip kernel to 5.11 mainline with config for the
  rk3399 devices built-in
* Make the rockpro64 and pinebook pro use the newer kernel

[ci:skip-build]
This commit is contained in:
Martijn Braam 2020-08-28 15:50:27 +02:00
parent 86eff19e0b
commit 15d740b746
No known key found for this signature in database
GPG key ID: C4280ACB000B060F
20 changed files with 3043 additions and 1697 deletions

View file

@ -1,13 +1,13 @@
# Reference: <https://postmarketos.org/devicepkg>
pkgname=device-pine64-pinebookpro
pkgdesc="PINE64 Pinebook Pro"
pkgver=0.1
pkgrel=4
pkgver=1
pkgrel=0
url="https://postmarketos.org"
license="MIT"
arch="aarch64"
options="!check !archcheck"
depends="postmarketos-base linux-postmarketos-rockchip u-boot-rockpro64 mesa-dri-gallium alsa-ucm-conf"
depends="postmarketos-base linux-postmarketos-rockchip u-boot-pinebookpro mesa-dri-gallium alsa-ucm-conf"
makedepends="devicepkg-dev"
subpackages="$pkgname-nonfree-firmware:nonfree_firmware"
install="$pkgname.post-install"
@ -51,9 +51,9 @@ nonfree_firmware() {
mkdir "$subpkgdir"
}
sha512sums="3247ea65950e82311bf2a56273c7523849682fa3cc2dfc19e54c0154a626869181b22e9545bf952cf262e188d032f5342e5a679a63d0c02d6cb972ad0cd2206a deviceinfo
6b3695373d6df7b6ac9f59a8c492d2f5e1ef1c6192662224547b500b071bf00ee4335c57736ba787eec236a2e8bde3c559f3cfc3d1e6fe13a7386d7a0db3ff78 extlinux.conf
sha512sums="68a5ba3b3115fa3c0d202566326052118ade7e8e2f8b6804d09a15ed63ec33fa5098354fd79ad24ee166f901f1349f3f0e4af5efc3924c6424d63e6b31de7542 deviceinfo
cdcb1d36440c29d411691990c1170d9665b13b1c551b35825720d23b6ae40311ce91c3b2b7a089deaacd7a33c6febe4f81dc75d71dd4bed887291221d56dc1d2 extlinux.conf
d3988fe83c54228d743f4a8c190e9530404a436a7fbc0b004bf20d3986b502d864717d8cc9c76812e599266bf84cb08f9a86e1bfd220875799c5a022aea588ec 10-pinebookpro.hwdb
bcae155e24a151d3c098833680b83b6004a329962f115480d560ebe19257eab87286b8a4c194e456c067ca54fb53e59a5a16b022cea13c11135b0855145db563 mem_sleep.conf
846384cab3e9581a03007cf4f39f8538315e804d1573903dd223d22d5ca0b6f260e348467aead5124689288fb7d2ec22c1e9aba8e89683efdbd33ddfe10de852 rockchip,es8316-codec.conf
520157f8215bd33e89f530fc37db451cf672df697de8883c91635df4fc32c4788dde1dd313c7d8b229916579fa25e0d60c8baf4721dcd9f95550abaa6d98a536 HiFi"
558f08b56425e0ceeea8d4815eeb862a2b801ba1b26b4dc28f4d0ec991ed9dfef14113172a224191eb2de5d0b57a741e4c48f1307bda2a69595944bd58731be1 HiFi"

View file

@ -6,7 +6,7 @@ deviceinfo_name="PINE64 Pinebook Pro"
deviceinfo_manufacturer="PINE64"
deviceinfo_codename="pine64-pinebookpro"
deviceinfo_year="2019"
deviceinfo_dtb="rockchip/rk3399-pinebook-pro"
deviceinfo_dtb=""
deviceinfo_modules_initfs="panel_simple pwm_bl rockchipdrm dw_mipi_dsi drm_kms_helper gpu_sched rockchip_rga dw_wdt videobuf2_dma_sg analogix_dp drm_panel_orientation_quirks"
deviceinfo_arch="aarch64"
@ -17,6 +17,10 @@ deviceinfo_external_storage="true"
deviceinfo_screen_width="1920"
deviceinfo_screen_height="1080"
# Installer related
deviceinfo_dev_internal_storage="/dev/mmcblk2"
deviceinfo_dev_internal_storage_repartition="true"
# Bootloader related
deviceinfo_flash_method="none"
deviceinfo_sd_embed_firmware="u-boot/pine64-rockpro64/u-boot-rockchip.bin:32"

View file

@ -4,6 +4,6 @@ menu title boot prev kernel
label POSTMARKETOS
kernel /vmlinuz-postmarketos-rockchip
fdt /rk3399-pinebook-pro.dtb
fdt /dtbs-postmarketos-rockchip/rockchip/rk3399-pinebook-pro.dtb
initrd /initramfs-postmarketos-rockchip
append console=tty0 console=ttyS2,1500000n8 panic=10 coherent_pool=1M video=HDMI-A-1:1920x1080@60 video=eDP-1:1920x1080@60 loglevel=5 mem_sleep_default=s2idle PMOS_NO_OUTPUT_REDIRECT

View file

@ -29,17 +29,18 @@ SectionDevice."Speaker" {
cset "name='Speaker Switch' off"
]
Value {
PlaybackPriority 200
PlaybackChannels "2"
PlaybackPCM "hw:${CardId},0"
PlaybackVolume "DAC Playback Volume"
PlaybackSwitch "Speaker Switch"
PlaybackChannels 2
PlaybackPriority 300
PlaybackPCM "hw:${CardId},0"
}
ConflictingDevice [
"Headphone"
"Headphones"
]
}
SectionDevice."Headphone" {
Comment "Headphones"
SectionDevice."Headphones" {
Comment "Headset"
EnableSequence [
cset "name='Headphone Playback Volume' 50%"
cset "name='Headphone Mixer Volume' 100%"
@ -48,13 +49,13 @@ SectionDevice."Headphone" {
DisableSequence [
]
Value {
PlaybackPriority 100
PlaybackChannels "2"
PlaybackPCM "hw:${CardId},0"
PlaybackVolume "DAC Playback Volume"
PlaybackChannels 2
PlaybackPriority 500
PlaybackPCM "hw:${CardId},0"
JackControl "Headphones Jack"
}
ConflictingDevice [
"Speaker"
]
}
}

View file

@ -1,7 +1,7 @@
# Reference: <https://postmarketos.org/devicepkg>
pkgname=device-pine64-rockpro64
pkgver=0.1
pkgrel=3
pkgver=1
pkgrel=0
pkgdesc="PINE64 RockPro64"
url="https://postmarketos.org"
license="MIT"
@ -30,5 +30,5 @@ nonfree_firmware() {
mkdir "$subpkgdir"
}
sha512sums="9959812f0a0044f6c6a304e635051fc002bb46f0398cbea00e1ad10cbb2d5c6fa418f8979ef9ccbc403e43d59ada7a84c523de34b9273227a91593c8fc8901f9 deviceinfo
bd974f4f2b27b868bd63d0134c3e4c062a786be781d2585f42326cfb135211cb038be8d769ec178b94cfe860290d2e502e5eb88ff077ea04b808980237cf624c extlinux.conf"
sha512sums="7b99d22ed605d692a527e7d780d02c865e733294997695cad238c0aeb627ef5da5eb6287229c9223e9f87b241f729cf5631f827145e7fd3e5f816129ae7d1491 deviceinfo
0e6656ca7057b388fc91156611d2f207c3c324d6a66ce411c36b3aa94ae3483c3ac8d74f35740d500a5af2c2953ccd4fffccd319ffe5258d08a462d9ec776ec4 extlinux.conf"

View file

@ -6,7 +6,7 @@ deviceinfo_name="PINE64 RockPro64"
deviceinfo_manufacturer="PINE64"
deviceinfo_codename="pine64-rockpro64"
deviceinfo_year="2017"
deviceinfo_dtb="rockchip/rk3399-rockpro64"
deviceinfo_dtb=""
deviceinfo_modules_initfs=""
deviceinfo_arch="aarch64"

View file

@ -4,6 +4,6 @@ menu title boot prev kernel
label POSTMARKETOS
kernel /vmlinuz-postmarketos-rockchip
fdt /rk3399-rockpro64.dtb
fdt /dtbs-postmarketos-rockchip/rockchip/rk3399-rockpro64.dtb
initrd /initramfs-postmarketos-rockchip
append console=tty0 console=ttyS2,1500000n8 panic=10 coherent_pool=1M video=HDMI-A-1:1920x1080@60 video=eDP-1:1920x1080@60 loglevel=5 PMOS_NO_OUTPUT_REDIRECT

View file

@ -1,25 +1,47 @@
# Maintainer: Martijn Braam <martijn@brixit.nl>
# This is seperate from linux-edge so we can control the release cycle better.
# If this kernel is updated and fails to boot it's quite hard to recover the
# rk3399 devices due to the boot order. This kernel also has a kconfig that has
# more modules built-in that are required for successfully booting on these
# devices.
# It's important that CONFIG_ROCKCHIP_CDN_DP is _disabled_ because it causes
# boot failure
pkgname=linux-postmarketos-rockchip
pkgver=5.6.0_git20200402
pkgver=5.11.2
pkgrel=0
pkgdesc="Kernel fork with Pinebook Pro and Rockpro64 patches"
pkgdesc="Mainline kernel for rockchip devices"
arch="aarch64"
_carch="arm64"
_flavor="postmarketos-rockchip"
_flavor="${pkgname#linux-}"
url="https://kernel.org"
license="GPL-2.0-only"
options="!strip !check !tracedeps pmb:cross-native"
makedepends="devicepkg-dev perl sed installkernel bash gmp-dev bc linux-headers elfutils-dev openssl-dev file bison flex rsync"
options="!strip !check !tracedeps pmb:cross-native pmb:kconfigcheck-anbox"
makedepends="
bison
devicepkg-dev
findutils
flex
installkernel
openssl-dev
perl
rsync
xz
"
# Source
_commit="93293259039d6fc3a725961d42b4f11bfc3f5127"
_config="config-$_flavor.$arch"
case $pkgver in
*.*.*) _kernver=${pkgver%.0};;
*.*) _kernver=$pkgver;;
esac
source="
https://gitlab.manjaro.org/tsys/linux-pinebook-pro/-/archive/$_commit/linux-pinebook-pro-$_commit.tar.gz
config-postmarketos-rockchip.aarch64
https://cdn.kernel.org/pub/linux/kernel/v${_kernver%%.*}.x/linux-$_kernver.tar.xz
$_config
"
builddir="$srcdir/linux-pinebook-pro-$_commit"
builddir="$srcdir/linux-$_kernver"
prepare() {
default_prepare
@ -30,8 +52,7 @@ prepare() {
build() {
unset LDFLAGS
make ARCH="$_carch" CC="${CC:-gcc}" \
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-$_flavor" \
CFLAGS_MODULE=-fno-pic
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-$_flavor"
}
package() {
@ -39,9 +60,11 @@ package() {
make -j1 modules_install dtbs_install \
ARCH="$_carch" \
INSTALL_MOD_STRIP=1 \
INSTALL_MOD_PATH="$pkgdir" \
INSTALL_DTBS_PATH="$pkgdir/usr/share/dtb"
INSTALL_DTBS_PATH="$pkgdir/boot/dtbs-$_flavor"
}
sha512sums="d386cb5c562cb6ae150b34d30724a2bcf9bcee0d7ae7ae70b34853a420e6125ad7ead5b554c9861d134ad69f59ac6615072a28950fc823d31d3cdf02745da087 linux-pinebook-pro-93293259039d6fc3a725961d42b4f11bfc3f5127.tar.gz
54d759e3bc0dd13a5dd47eb72e6c7d6c2e777ac6194089ceb93c987d2fe4ad1e439a3b47dd3177d5cd2937bc49dac9dedb55d40a8af1d5304354416ab0e304b1 config-postmarketos-rockchip.aarch64"
sha512sums="16090ec6dea7a8c417ca7483b296902c9b55b423482ad8a881dffcaae76411806bc9502373efd6a51b0acefec3a44c19c5a7d42c5b76c1321183a4798a5959d3 linux-5.11.2.tar.xz
b399eaaa7121b93468432e9f0a6d544199caa7c85b835c084fa24af7627d3e148a4f0e88eb703c3902f18e2df8202bf4a1e6d058a5901d4819b3673ef407266a config-postmarketos-rockchip.aarch64"

View file

@ -0,0 +1,43 @@
diff --git a/arch/arm/dts/rk3399-pinebook-pro-u-boot.dtsi b/arch/arm/dts/rk3399-pinebook-pro-u-boot.dtsi
index 1a2e24d3ef..296321d697 100644
--- a/arch/arm/dts/rk3399-pinebook-pro-u-boot.dtsi
+++ b/arch/arm/dts/rk3399-pinebook-pro-u-boot.dtsi
@@ -24,6 +24,10 @@
u-boot,dm-pre-reloc;
};
+&rng {
+ status = "okay";
+};
+
&sdhci {
max-frequency = <25000000>;
u-boot,dm-pre-reloc;
diff --git a/arch/arm/dts/rk3399-rockpro64-u-boot.dtsi b/arch/arm/dts/rk3399-rockpro64-u-boot.dtsi
index bac09df4a3..cb8991aa25 100644
--- a/arch/arm/dts/rk3399-rockpro64-u-boot.dtsi
+++ b/arch/arm/dts/rk3399-rockpro64-u-boot.dtsi
@@ -19,6 +19,10 @@
};
};
+&rng {
+ status = "okay";
+};
+
&spi1 {
spi_flash: flash@0 {
u-boot,dm-pre-reloc;
diff --git a/configs/pinebook-pro-rk3399_defconfig b/configs/pinebook-pro-rk3399_defconfig
index 0c129b9aeb..21eecf477c 100644
--- a/configs/pinebook-pro-rk3399_defconfig
+++ b/configs/pinebook-pro-rk3399_defconfig
@@ -54,6 +54,8 @@ CONFIG_DM_PMIC_FAN53555=y
CONFIG_PMIC_RK8XX=y
CONFIG_REGULATOR_PWM=y
CONFIG_REGULATOR_RK8XX=y
+CONFIG_DM_RNG=y
+CONFIG_RNG_ROCKCHIP=y
CONFIG_PWM_ROCKCHIP=y
CONFIG_RAM_RK3399_LPDDR4=y
CONFIG_DM_RESET=y

View file

@ -0,0 +1,37 @@
diff --git a/configs/pinebook-pro-rk3399_defconfig b/configs/pinebook-pro-rk3399_defconfig
index 21eecf477c..733463556a 100644
--- a/configs/pinebook-pro-rk3399_defconfig
+++ b/configs/pinebook-pro-rk3399_defconfig
@@ -61,6 +61,8 @@ CONFIG_RAM_RK3399_LPDDR4=y
CONFIG_DM_RESET=y
CONFIG_BAUDRATE=1500000
CONFIG_DEBUG_UART_SHIFT=2
+CONFIG_USE_PREBOOT=y
+CONFIG_PREBOOT="usb start"
CONFIG_ROCKCHIP_SPI=y
CONFIG_SYSRESET=y
CONFIG_USB=y
@@ -68,8 +70,11 @@ CONFIG_USB_XHCI_HCD=y
CONFIG_USB_XHCI_DWC3=y
CONFIG_USB_EHCI_HCD=y
CONFIG_USB_EHCI_GENERIC=y
+CONFIG_USB_OHCI_HCD=y
+CONFIG_USB_OHCI_GENERIC=y
CONFIG_USB_DWC3=y
CONFIG_ROCKCHIP_USB2_PHY=y
+CONFIG_DM_KEYBOARD=y
CONFIG_USB_KEYBOARD=y
CONFIG_USB_HOST_ETHER=y
CONFIG_USB_ETHER_ASIX=y
diff --git a/include/configs/pinebook-pro-rk3399.h b/include/configs/pinebook-pro-rk3399.h
index 4bc8802d11..d910830582 100644
--- a/include/configs/pinebook-pro-rk3399.h
+++ b/include/configs/pinebook-pro-rk3399.h
@@ -25,4 +25,7 @@
#define SDRAM_BANK_SIZE (2UL << 30)
+#define CONFIG_USB_OHCI_NEW
+#define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS 2
+
#endif

View file

@ -0,0 +1,646 @@
From 5ae3afa4547eb82b92d93553ff07892eb8ff1665 Mon Sep 17 00:00:00 2001
From: Arnaud Patard <arnaud.patard@rtp-net.org>
Date: Fri, 11 Sep 2020 16:26:11 -0400
Subject: [PATCH 01/11] drivers/video/rockchip/rk_vop.c: Use endpoint
compatible string to find VOP mode
The current code is using an hard coded enum and the of node reg value of
endpoint to find out if the endpoint is mipi/hdmi/lvds/edp/dp. The order
is different between rk3288, rk3399 vop little, rk3399 vop big.
A possible solution would be to make sure that the rk3288.dtsi and
rk3399.dtsi files have "expected" reg value or an other solution is
to find the kind of endpoint by comparing the endpoint compatible value.
This patch is implementing the more flexible second solution.
Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org>
Origin: http://people.hupstream.com/~rtp/pbp/20200911/dts_vop_mode.patch
---
.../include/asm/arch-rockchip/vop_rk3288.h | 15 +----------
drivers/video/rockchip/rk_vop.c | 25 +++++++++++++++++--
2 files changed, 24 insertions(+), 16 deletions(-)
diff --git a/arch/arm/include/asm/arch-rockchip/vop_rk3288.h b/arch/arm/include/asm/arch-rockchip/vop_rk3288.h
index 872a158b71..bf19e05997 100644
--- a/arch/arm/include/asm/arch-rockchip/vop_rk3288.h
+++ b/arch/arm/include/asm/arch-rockchip/vop_rk3288.h
@@ -85,26 +85,13 @@ enum {
LB_RGB_1280X8 = 0x5
};
-#if defined(CONFIG_ROCKCHIP_RK3399)
enum vop_modes {
VOP_MODE_EDP = 0,
VOP_MODE_MIPI,
VOP_MODE_HDMI,
- VOP_MODE_MIPI1,
- VOP_MODE_DP,
- VOP_MODE_NONE,
-};
-#else
-enum vop_modes {
- VOP_MODE_EDP = 0,
- VOP_MODE_HDMI,
VOP_MODE_LVDS,
- VOP_MODE_MIPI,
- VOP_MODE_NONE,
- VOP_MODE_AUTO_DETECT,
- VOP_MODE_UNKNOWN,
+ VOP_MODE_DP,
};
-#endif
/* VOP_VERSION_INFO */
#define M_FPGA_VERSION (0xffff << 16)
diff --git a/drivers/video/rockchip/rk_vop.c b/drivers/video/rockchip/rk_vop.c
index 9032eb430e..6cd4ccc97a 100644
--- a/drivers/video/rockchip/rk_vop.c
+++ b/drivers/video/rockchip/rk_vop.c
@@ -235,12 +235,11 @@ static int rk_display_init(struct udevice *dev, ulong fbbase, ofnode ep_node)
struct clk clk;
enum video_log2_bpp l2bpp;
ofnode remote;
+ const char *compat;
debug("%s(%s, %lu, %s)\n", __func__,
dev_read_name(dev), fbbase, ofnode_get_name(ep_node));
- vop_id = ofnode_read_s32_default(ep_node, "reg", -1);
- debug("vop_id=%d\n", vop_id);
ret = ofnode_read_u32(ep_node, "remote-endpoint", &remote_phandle);
if (ret)
return ret;
@@ -282,6 +281,28 @@ static int rk_display_init(struct udevice *dev, ulong fbbase, ofnode ep_node)
if (disp)
break;
};
+ compat = ofnode_get_property(remote, "compatible", NULL);
+ if (!compat) {
+ debug("%s(%s): Failed to find compatible property\n",
+ __func__, dev_read_name(dev));
+ return -EINVAL;
+ }
+ if (strstr(compat, "edp")) {
+ vop_id = VOP_MODE_EDP;
+ } else if (strstr(compat, "mipi")) {
+ vop_id = VOP_MODE_MIPI;
+ } else if (strstr(compat, "hdmi")) {
+ vop_id = VOP_MODE_HDMI;
+ } else if (strstr(compat, "cdn-dp")) {
+ vop_id = VOP_MODE_DP;
+ } else if (strstr(compat, "lvds")) {
+ vop_id = VOP_MODE_LVDS;
+ } else {
+ debug("%s(%s): Failed to find vop mode for %s\n",
+ __func__, dev_read_name(dev), compat);
+ return -EINVAL;
+ }
+ debug("vop_id=%d\n", vop_id);
disp_uc_plat = dev_get_uclass_platdata(disp);
debug("Found device '%s', disp_uc_priv=%p\n", disp->name, disp_uc_plat);
--
2.25.4
From 382c53d4970c609a9f787422fbcd5f804ee00c3f Mon Sep 17 00:00:00 2001
From: Arnaud Patard <arnaud.patard@rtp-net.org>
Date: Fri, 11 Sep 2020 16:26:11 -0400
Subject: [PATCH 02/11] drivers/video/rockchip/rk_edp.c: Add rk3399 support
According to linux commit "drm/rockchip: analogix_dp: add rk3399 eDP
support" (82872e42bb1501dd9e60ca430f4bae45a469aa64), rk3288 and rk3399
eDP IPs are nearly the same, the difference is in the grf register
(SOC_CON6 versus SOC_CON20). So, change the code to use the right
register on each IP.
The clocks don't seem to be the same, the eDP clock is not at index 1
on rk3399, so don't try changing the clock at index 1 to rate 0 on
rk3399.
Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org>
Origin: http://people.hupstream.com/~rtp/pbp/20200911/rk_edp_rk3399.patch
---
.../include/asm/arch-rockchip/edp_rk3288.h | 5 +-
drivers/video/rockchip/rk_edp.c | 85 ++++++++++++++-----
2 files changed, 68 insertions(+), 22 deletions(-)
diff --git a/arch/arm/include/asm/arch-rockchip/edp_rk3288.h b/arch/arm/include/asm/arch-rockchip/edp_rk3288.h
index 105a335dab..c861f0eab1 100644
--- a/arch/arm/include/asm/arch-rockchip/edp_rk3288.h
+++ b/arch/arm/include/asm/arch-rockchip/edp_rk3288.h
@@ -232,8 +232,9 @@ check_member(rk3288_edp, pll_reg_5, 0xa00);
#define PD_CH0 (0x1 << 0)
/* pll_reg_1 */
-#define REF_CLK_24M (0x1 << 1)
-#define REF_CLK_27M (0x0 << 1)
+#define REF_CLK_24M (0x1 << 0)
+#define REF_CLK_27M (0x0 << 0)
+#define REF_CLK_MASK (0x1 << 0)
/* line_map */
#define LANE3_MAP_LOGIC_LANE_0 (0x0 << 6)
diff --git a/drivers/video/rockchip/rk_edp.c b/drivers/video/rockchip/rk_edp.c
index 000bd48140..1b2f5f706d 100644
--- a/drivers/video/rockchip/rk_edp.c
+++ b/drivers/video/rockchip/rk_edp.c
@@ -17,11 +17,10 @@
#include <asm/gpio.h>
#include <asm/io.h>
#include <asm/arch-rockchip/clock.h>
+#include <asm/arch-rockchip/hardware.h>
#include <asm/arch-rockchip/edp_rk3288.h>
#include <asm/arch-rockchip/grf_rk3288.h>
-#include <asm/arch-rockchip/hardware.h>
-#include <dt-bindings/clock/rk3288-cru.h>
-#include <linux/delay.h>
+#include <asm/arch-rockchip/grf_rk3399.h>
#define MAX_CR_LOOP 5
#define MAX_EQ_LOOP 5
@@ -37,18 +36,42 @@ static const char * const pre_emph_names[] = {
#define DP_VOLTAGE_MAX DP_TRAIN_VOLTAGE_SWING_1200
#define DP_PRE_EMPHASIS_MAX DP_TRAIN_PRE_EMPHASIS_9_5
+#define RK3288_GRF_SOC_CON6 0x025c
+#define RK3288_GRF_SOC_CON12 0x0274
+#define RK3399_GRF_SOC_CON20 0x6250
+#define RK3399_GRF_SOC_CON25 0x6264
+
+enum rockchip_dp_types {
+ RK3288_DP = 0,
+ RK3399_EDP
+};
+
+struct rockchip_dp_data {
+ unsigned long reg_vop_big_little;
+ unsigned long reg_vop_big_little_sel;
+ unsigned long reg_ref_clk_sel;
+ unsigned long ref_clk_sel_bit;
+ enum rockchip_dp_types chip_type;
+};
+
struct rk_edp_priv {
struct rk3288_edp *regs;
- struct rk3288_grf *grf;
+ void *grf;
struct udevice *panel;
struct link_train link_train;
u8 train_set[4];
};
-static void rk_edp_init_refclk(struct rk3288_edp *regs)
+static void rk_edp_init_refclk(struct rk3288_edp *regs, enum rockchip_dp_types chip_type)
{
writel(SEL_24M, &regs->analog_ctl_2);
- writel(REF_CLK_24M, &regs->pll_reg_1);
+ u32 reg;
+
+ reg = REF_CLK_24M;
+ if (chip_type == RK3288_DP)
+ reg ^= REF_CLK_MASK;
+ writel(reg, &regs->pll_reg_1);
+
writel(LDO_OUTPUT_V_SEL_145 | KVCO_DEFALUT | CHG_PUMP_CUR_SEL_5US |
V2L_CUR_SEL_1MA, &regs->pll_reg_2);
@@ -1023,6 +1046,8 @@ static int rk_edp_probe(struct udevice *dev)
struct display_plat *uc_plat = dev_get_uclass_platdata(dev);
struct rk_edp_priv *priv = dev_get_priv(dev);
struct rk3288_edp *regs = priv->regs;
+ struct rockchip_dp_data *edp_data = (struct rockchip_dp_data *)dev_get_driver_data(dev);
+
struct clk clk;
int ret;
@@ -1037,16 +1062,17 @@ static int rk_edp_probe(struct udevice *dev)
int vop_id = uc_plat->source_id;
debug("%s, uc_plat=%p, vop_id=%u\n", __func__, uc_plat, vop_id);
- ret = clk_get_by_index(dev, 1, &clk);
- if (ret >= 0) {
- ret = clk_set_rate(&clk, 0);
- clk_free(&clk);
- }
- if (ret) {
- debug("%s: Failed to set EDP clock: ret=%d\n", __func__, ret);
- return ret;
+ if (edp_data->chip_type == RK3288_DP) {
+ ret = clk_get_by_index(dev, 1, &clk);
+ if (ret >= 0) {
+ ret = clk_set_rate(&clk, 0);
+ clk_free(&clk);
+ }
+ if (ret) {
+ debug("%s: Failed to set EDP clock: ret=%d\n", __func__, ret);
+ return ret;
+ }
}
-
ret = clk_get_by_index(uc_plat->src_dev, 0, &clk);
if (ret >= 0) {
ret = clk_set_rate(&clk, 192000000);
@@ -1059,15 +1085,17 @@ static int rk_edp_probe(struct udevice *dev)
}
/* grf_edp_ref_clk_sel: from internal 24MHz or 27MHz clock */
- rk_setreg(&priv->grf->soc_con12, 1 << 4);
+ rk_setreg(priv->grf + edp_data->reg_ref_clk_sel,
+ edp_data->ref_clk_sel_bit);
/* select epd signal from vop0 or vop1 */
- rk_clrsetreg(&priv->grf->soc_con6, (1 << 5),
- (vop_id == 1) ? (1 << 5) : (0 << 5));
+ rk_clrsetreg(priv->grf + edp_data->reg_vop_big_little,
+ edp_data->reg_vop_big_little_sel,
+ (vop_id == 1) ? edp_data->reg_vop_big_little_sel : 0);
rockchip_edp_wait_hpd(priv);
- rk_edp_init_refclk(regs);
+ rk_edp_init_refclk(regs, edp_data->chip_type);
rk_edp_init_interrupt(regs);
rk_edp_enable_sw_function(regs);
ret = rk_edp_init_analog_func(regs);
@@ -1083,8 +1111,25 @@ static const struct dm_display_ops dp_rockchip_ops = {
.enable = rk_edp_enable,
};
+static const struct rockchip_dp_data rk3399_edp = {
+ .reg_vop_big_little = RK3399_GRF_SOC_CON20,
+ .reg_vop_big_little_sel = BIT(5),
+ .reg_ref_clk_sel = RK3399_GRF_SOC_CON25,
+ .ref_clk_sel_bit = BIT(11),
+ .chip_type = RK3399_EDP,
+};
+
+static const struct rockchip_dp_data rk3288_dp = {
+ .reg_vop_big_little = RK3288_GRF_SOC_CON6,
+ .reg_vop_big_little_sel = BIT(5),
+ .reg_ref_clk_sel = RK3288_GRF_SOC_CON12,
+ .ref_clk_sel_bit = BIT(4),
+ .chip_type = RK3288_DP,
+};
+
static const struct udevice_id rockchip_dp_ids[] = {
- { .compatible = "rockchip,rk3288-edp" },
+ { .compatible = "rockchip,rk3288-edp", .data = (ulong)&rk3288_dp },
+ { .compatible = "rockchip,rk3399-edp", .data = (ulong)&rk3399_edp },
{ }
};
--
2.25.4
From b5776e11f8e7c79ff61bc2b93be9b6253db939f1 Mon Sep 17 00:00:00 2001
From: Arnaud Patard <arnaud.patard@rtp-net.org>
Date: Fri, 11 Sep 2020 16:26:12 -0400
Subject: [PATCH 03/11] drivers/video/rockchip/rk_edp.c: Change interrupt
polarity configuration
The linux code is setting polarity configuration to 3 but
uboot code is setting it to 1. Change the configuration to match the
linux configuration
Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org>
Origin: http://people.hupstream.com/~rtp/pbp/20200911/rk_edp_vs_linux.patch
---
drivers/video/rockchip/rk_edp.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/video/rockchip/rk_edp.c b/drivers/video/rockchip/rk_edp.c
index 1b2f5f706d..13fa78aced 100644
--- a/drivers/video/rockchip/rk_edp.c
+++ b/drivers/video/rockchip/rk_edp.c
@@ -100,10 +100,13 @@ static void rk_edp_init_refclk(struct rk3288_edp *regs, enum rockchip_dp_types c
&regs->dp_reserv2);
}
+#define INT_POL1 (0x1 << 1)
+#define INT_POL0 (0x1 << 0)
+
static void rk_edp_init_interrupt(struct rk3288_edp *regs)
{
/* Set interrupt pin assertion polarity as high */
- writel(INT_POL, &regs->int_ctl);
+ writel(INT_POL0 | INT_POL1, &regs->int_ctl);
/* Clear pending registers */
writel(0xff, &regs->common_int_sta_1);
--
2.25.4
From c1f23be1f6e1aa94e6b22e0a403ec061ca311f42 Mon Sep 17 00:00:00 2001
From: Arnaud Patard <arnaud.patard@rtp-net.org>
Date: Fri, 11 Sep 2020 16:26:12 -0400
Subject: [PATCH 04/11] drivers/video/rockchip/rk_edp.c: Change clock rate
The current code is setting the clock rate to 192000000, but
due to the current device-tree configuration and linux code,
it should rather be 100000000.
Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org>
Origin: http://people.hupstream.com/~rtp/pbp/20200911/rk_vop_clk_rate.patch
---
drivers/video/rockchip/rk_edp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/video/rockchip/rk_edp.c b/drivers/video/rockchip/rk_edp.c
index 13fa78aced..c2dc79faac 100644
--- a/drivers/video/rockchip/rk_edp.c
+++ b/drivers/video/rockchip/rk_edp.c
@@ -1078,7 +1078,7 @@ static int rk_edp_probe(struct udevice *dev)
}
ret = clk_get_by_index(uc_plat->src_dev, 0, &clk);
if (ret >= 0) {
- ret = clk_set_rate(&clk, 192000000);
+ ret = clk_set_rate(&clk, 100000000);
clk_free(&clk);
}
if (ret < 0) {
--
2.25.4
From 8ecab272ff922477da225f1856cb4bc492d41fb2 Mon Sep 17 00:00:00 2001
From: Arnaud Patard <arnaud.patard@rtp-net.org>
Date: Fri, 11 Sep 2020 16:26:12 -0400
Subject: [PATCH 05/11] drivers/video/rockchip/rk_vop.c: Reserve efi fb memory
When booting with EFI and graphics, the memory used for framebuffer
has to be reserved, otherwise it may leads to kernel memory
overwrite.
Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org>
Origin: http://people.hupstream.com/~rtp/pbp/20200911/rk_vop_reserve_fb_memory.patch
---
drivers/video/rockchip/rk_vop.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/video/rockchip/rk_vop.c b/drivers/video/rockchip/rk_vop.c
index 6cd4ccc97a..98d33a3cec 100644
--- a/drivers/video/rockchip/rk_vop.c
+++ b/drivers/video/rockchip/rk_vop.c
@@ -20,6 +20,8 @@
#include <asm/arch-rockchip/vop_rk3288.h>
#include <dm/device-internal.h>
#include <dm/uclass-internal.h>
+#include <efi.h>
+#include <efi_loader.h>
#include <linux/bitops.h>
#include <linux/err.h>
#include <power/regulator.h>
@@ -394,6 +396,13 @@ int rk_vop_probe(struct udevice *dev)
if (!(gd->flags & GD_FLG_RELOC))
return 0;
+ plat->base = gd->bd->bi_dram[0].start + gd->bd->bi_dram[0].size - plat->size;
+
+#if defined(CONFIG_EFI_LOADER)
+ debug("Adding to EFI map %d @ %lx\n", plat->size, plat->base);
+ efi_add_memory_map(plat->base, plat->size, EFI_RESERVED_MEMORY_TYPE);
+#endif
+
priv->regs = (struct rk3288_vop *)dev_read_addr(dev);
/*
--
2.25.4
From 68098155f59cf102add0817d65a3570513500092 Mon Sep 17 00:00:00 2001
From: Arnaud Patard <arnaud.patard@rtp-net.org>
Date: Fri, 11 Sep 2020 16:26:12 -0400
Subject: [PATCH 06/11] rk3399-pinebook-pro-u-boot.dtsi: Enable edp
- uboot rockchip edp code is looking for a rockchip,panel property
for the edp dts node, so add it.
Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org>
Origin: http://people.hupstream.com/~rtp/pbp/20200911/update_pinebook_pro_uboot_dtsi.patch
---
arch/arm/dts/rk3399-pinebook-pro-u-boot.dtsi | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/arm/dts/rk3399-pinebook-pro-u-boot.dtsi b/arch/arm/dts/rk3399-pinebook-pro-u-boot.dtsi
index 1a2e24d3ef..f0b58909a4 100644
--- a/arch/arm/dts/rk3399-pinebook-pro-u-boot.dtsi
+++ b/arch/arm/dts/rk3399-pinebook-pro-u-boot.dtsi
@@ -41,3 +41,7 @@
&vdd_log {
regulator-init-microvolt = <950000>;
};
+
+&edp {
+ rockchip,panel = <&edp_panel>;
+};
--
2.25.4
From cc514ca0d224b80713b0a653094f498c520bd1b3 Mon Sep 17 00:00:00 2001
From: Arnaud Patard <arnaud.patard@rtp-net.org>
Date: Fri, 11 Sep 2020 16:26:13 -0400
Subject: [PATCH 07/11] configs/pinebook-pro-rk3399_defconfig: enable
SYS_USB_EVENT_POLL_VIA_INT_QUEUE
The default configuration will use SYS_USB_EVENT_POLL for handling the
usb keyboard and it makes the system really slow (eg slow keypress,
loading kernel/initrd from grub-efi is taking ages).
Using CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE seems to be improving
things a lot, so use it.
Tested-by: Samuel Dionne-Riel <samuel@dionne-riel.com>
Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org>
Origin: http://people.hupstream.com/~rtp/pbp/20200911/pbp_defconfig_usb_poll.patch
---
configs/pinebook-pro-rk3399_defconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/configs/pinebook-pro-rk3399_defconfig b/configs/pinebook-pro-rk3399_defconfig
index 0c129b9aeb..fa53bef6b9 100644
--- a/configs/pinebook-pro-rk3399_defconfig
+++ b/configs/pinebook-pro-rk3399_defconfig
@@ -69,6 +69,7 @@ CONFIG_USB_EHCI_GENERIC=y
CONFIG_USB_DWC3=y
CONFIG_ROCKCHIP_USB2_PHY=y
CONFIG_USB_KEYBOARD=y
+CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE=y
CONFIG_USB_HOST_ETHER=y
CONFIG_USB_ETHER_ASIX=y
CONFIG_USB_ETHER_RTL8152=y
--
2.25.4
From f3cae111f1daf8ef6a085cc435d37f741141675a Mon Sep 17 00:00:00 2001
From: Arnaud Patard <arnaud.patard@rtp-net.org>
Date: Fri, 11 Sep 2020 16:26:13 -0400
Subject: [PATCH 08/11] drivers/pwm/rk_pwm.c: Fix default polarity
In the code, the default polarity is set to positive/positive,
which is neither normal polarity or inverted polarity. It's
only the hardware default. This leads to booting linux with
wrong polarity setting.
Update the code to use PWM_DUTY_POSTIVE | PWM_INACTIVE_NEGATIVE
by default instead.
Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org>
Origin: http://people.hupstream.com/~rtp/pbp/20200911/pwm-fix-default-polarity.patch
---
drivers/pwm/rk_pwm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pwm/rk_pwm.c b/drivers/pwm/rk_pwm.c
index 911da1d426..c743feb920 100644
--- a/drivers/pwm/rk_pwm.c
+++ b/drivers/pwm/rk_pwm.c
@@ -146,7 +146,7 @@ static int rk_pwm_probe(struct udevice *dev)
priv->data = (struct rockchip_pwm_data *)dev_get_driver_data(dev);
if (priv->data->supports_polarity)
- priv->conf_polarity = PWM_DUTY_POSTIVE | PWM_INACTIVE_POSTIVE;
+ priv->conf_polarity = PWM_DUTY_POSTIVE | PWM_INACTIVE_NEGATIVE;
return 0;
}
--
2.25.4
From 60046c90d749e29348ee140583b0646e63c838be Mon Sep 17 00:00:00 2001
From: Arnaud Patard <arnaud.patard@rtp-net.org>
Date: Fri, 11 Sep 2020 16:26:13 -0400
Subject: [PATCH 09/11] [HACK NOTFORMERGE] PBP: Fix panel reset
On warm reset, the pinebook pro panel is not working correctly.
The issue is not yet debugged so, for now, this hack seems to be
enough. It toggles the GPIO1_C6 gpio [ LCDVCC_EN signal in the
schematics ] used by the vcc3v3_panel regulator.
There's no gpio_request, since the gpio is already in use at this
stage, so it can only fail.
Origin: http://people.hupstream.com/~rtp/pbp/20200911/hack-reset.patch
---
board/pine64/pinebook-pro-rk3399/pinebook-pro-rk3399.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/board/pine64/pinebook-pro-rk3399/pinebook-pro-rk3399.c b/board/pine64/pinebook-pro-rk3399/pinebook-pro-rk3399.c
index 516292aaa5..6b8376d6cd 100644
--- a/board/pine64/pinebook-pro-rk3399/pinebook-pro-rk3399.c
+++ b/board/pine64/pinebook-pro-rk3399/pinebook-pro-rk3399.c
@@ -7,9 +7,12 @@
#include <common.h>
#include <dm.h>
#include <syscon.h>
+#include <linux/delay.h>
+#include <asm/gpio.h>
#include <asm/io.h>
#include <asm/arch-rockchip/clock.h>
#include <asm/arch-rockchip/grf_rk3399.h>
+#include <asm/arch-rockchip/gpio.h>
#include <asm/arch-rockchip/hardware.h>
#include <asm/arch-rockchip/misc.h>
#include <power/regulator.h>
@@ -59,6 +62,7 @@ int misc_init_r(void)
const u32 cpuid_length = 0x10;
u8 cpuid[cpuid_length];
int ret;
+ unsigned int gpio;
setup_iodomain();
@@ -70,6 +74,11 @@ int misc_init_r(void)
if (ret)
return ret;
+ gpio_lookup_name("B22", NULL, NULL, &gpio);
+ gpio_direction_output(gpio, 0);
+ mdelay(500);
+ gpio_direction_output(gpio, 1);
+
return ret;
}
#endif
--
2.25.4
From 5e8bdb80f959e8fab2821191ec7f2868871a9798 Mon Sep 17 00:00:00 2001
From: Arnaud Patard <arnaud.patard@rtp-net.org>
Date: Fri, 11 Sep 2020 16:26:13 -0400
Subject: [PATCH 10/11] SPL malloc() before relocation used 0x22d0 bytes (8 KB)
>>TPL: board_init_r() spl_init Trying to boot from BOOTROM Returning to boot
ROM... spl_early_init pmic@1b: ret=-6 i2c@ff3c0000: ret=-6 dm_scan_fdt()
failed: -6 dm_extended_scan_dt() failed: -6 dm_init_and_scan() returned error
-6 spl_early_init() failed: -6 ### ERROR ### Please RESET the board ###
Origin: http://people.hupstream.com/~rtp/pbp/20200911/pmic-dm-reloc.patch
---
arch/arm/dts/rk3399-pinebook-pro-u-boot.dtsi | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/dts/rk3399-pinebook-pro-u-boot.dtsi b/arch/arm/dts/rk3399-pinebook-pro-u-boot.dtsi
index f0b58909a4..0f8879c4ca 100644
--- a/arch/arm/dts/rk3399-pinebook-pro-u-boot.dtsi
+++ b/arch/arm/dts/rk3399-pinebook-pro-u-boot.dtsi
@@ -20,9 +20,9 @@
u-boot,dm-pre-reloc;
};
-&rk808 {
+/*&rk808 {
u-boot,dm-pre-reloc;
-};
+};*/
&sdhci {
max-frequency = <25000000>;
--
2.25.4
From 771c6108e693223e82d2672a18a81d8468c2d0f4 Mon Sep 17 00:00:00 2001
From: Arnaud Patard <arnaud.patard@rtp-net.org>
Date: Fri, 11 Sep 2020 16:26:14 -0400
Subject: [PATCH 11/11] (patch file disable_cdp_dp.patch)
Origin: http://people.hupstream.com/~rtp/pbp/20200911/disable_cdp_dp.patch
---
arch/arm/dts/rk3399-pinebook-pro.dts | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/dts/rk3399-pinebook-pro.dts b/arch/arm/dts/rk3399-pinebook-pro.dts
index 294d21bf45..4e2dd14084 100644
--- a/arch/arm/dts/rk3399-pinebook-pro.dts
+++ b/arch/arm/dts/rk3399-pinebook-pro.dts
@@ -372,9 +372,9 @@
};
};
-&cdn_dp {
+/*&cdn_dp {
status = "okay";
-};
+};*/
&cpu_b0 {
cpu-supply = <&vdd_cpu_b>;
--
2.25.4

View file

@ -0,0 +1,54 @@
From 61eb4a33dfbffbf19ab5aca62533d20b0e4cba43 Mon Sep 17 00:00:00 2001
From: dhivael <dhivael.git@eno.space>
Date: Sat, 11 Jan 2020 15:04:46 +0100
Subject: [PATCH] rk3399: light pinebook power and standby leds during early
boot
this is a hack, but it works for now.
Origin: https://git.eno.space/pbp-uboot.git/commit/?id=1a01021c9361c4e017cb5b032300f5555c393710
---
arch/arm/mach-rockchip/rk3399/rk3399.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-rockchip/rk3399/rk3399.c b/arch/arm/mach-rockchip/rk3399/rk3399.c
index 4fda93b1527..952ac881711 100644
--- a/arch/arm/mach-rockchip/rk3399/rk3399.c
+++ b/arch/arm/mach-rockchip/rk3399/rk3399.c
@@ -19,6 +19,8 @@
#include <asm/arch-rockchip/hardware.h>
#include <linux/bitops.h>
#include <power/regulator.h>
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/pinctrl/rockchip.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -119,8 +121,8 @@ void board_debug_uart_init(void)
struct rk3399_grf_regs * const grf = (void *)GRF_BASE;
#ifdef CONFIG_TARGET_CHROMEBOOK_BOB
struct rk3399_pmugrf_regs * const pmugrf = (void *)PMUGRF_BASE;
- struct rockchip_gpio_regs * const gpio = (void *)GPIO0_BASE;
#endif
+ struct rockchip_gpio_regs * const gpio = (void *)GPIO0_BASE;
#if defined(CONFIG_DEBUG_UART_BASE) && (CONFIG_DEBUG_UART_BASE == 0xff180000)
/* Enable early UART0 on the RK3399 */
@@ -153,6 +155,14 @@ void board_debug_uart_init(void)
spl_gpio_set_pull(&pmugrf->gpio0_p, GPIO(BANK_B, 4), GPIO_PULL_NORMAL);
#endif /* CONFIG_TARGET_CHROMEBOOK_BOB */
+ {
+ // set GPIO0_A2/B3 to GPIO_ACTIVE_HIGH
+ // set GPIO0_A2/B3 to OUTPUT
+ int mask = (1UL << RK_PA2)/* | (1UL << RK_PB3) green LED */;
+ setbits_le32(&gpio->swport_dr, mask);
+ setbits_le32(&gpio->swport_ddr, mask);
+ }
+
/* Enable early UART2 channel C on the RK3399 */
rk_clrsetreg(&grf->gpio4c_iomux,
GRF_GPIO4C3_SEL_MASK,
--
2.25.4

View file

@ -0,0 +1,53 @@
From f091aa06bfd4f7f9066dabe7a7caf268cd9c6683 Mon Sep 17 00:00:00 2001
From: dhivael <dhivael.git@eno.space>
Date: Thu, 6 Feb 2020 22:34:34 +0100
Subject: [PATCH] support SPI flash boot
SPI uboot images can be built with
tools/mkimage -n rk3399 -T rkspi -d tpl/u-boot-tpl-dtb.bin:spl/u-boot-spl-dtb.bin spl.bin
cat <(dd if=spl.bin bs=512K conv=sync) u-boot.itb >spiflash.bin
and written to spi flash with uboot sf commands, any hardware flasher
available, rkdeveloptool, or possibly other methods.
Origin: https://git.eno.space/pbp-uboot.git/commit/?id=3d3dbebfe8726cf2ae51ed44dc49bbc497d62ac5
---
arch/arm/dts/rk3399-pinebook-pro-u-boot.dtsi | 2 +-
configs/pinebook-pro-rk3399_defconfig | 10 ++++++++++
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/arch/arm/dts/rk3399-pinebook-pro-u-boot.dtsi b/arch/arm/dts/rk3399-pinebook-pro-u-boot.dtsi
index f3d85e1dba1..a40b71fa204 100644
--- a/arch/arm/dts/rk3399-pinebook-pro-u-boot.dtsi
+++ b/arch/arm/dts/rk3399-pinebook-pro-u-boot.dtsi
@@ -12,7 +12,7 @@
};
chosen {
- u-boot,spl-boot-order = "same-as-spl", &sdhci, &sdmmc;
+ u-boot,spl-boot-order = "same-as-spl", &spiflash, &sdhci, &sdmmc;
};
};
diff --git a/configs/pinebook-pro-rk3399_defconfig b/configs/pinebook-pro-rk3399_defconfig
index 733463556a2..dbbd43ed9f3 100644
--- a/configs/pinebook-pro-rk3399_defconfig
+++ b/configs/pinebook-pro-rk3399_defconfig
@@ -85,3 +85,13 @@ CONFIG_VIDEO_ROCKCHIP=y
CONFIG_DISPLAY_ROCKCHIP_EDP=y
CONFIG_SPL_TINY_MEMSET=y
CONFIG_ERRNO_STR=y
+
+# SPI boot Support
+CONFIG_MTD=y
+CONFIG_DM_MTD=y
+CONFIG_SPI_FLASH_SFDP_SUPPORT=y
+CONFIG_SPL_DM_SPI=y
+CONFIG_SPL_SPI_FLASH_TINY=n
+CONFIG_SPL_SPI_FLASH_SFDP_SUPPORT=y
+CONFIG_SPL_SPI_LOAD=y
+CONFIG_SYS_SPI_U_BOOT_OFFS=0x80000
--
2.25.4

View file

@ -0,0 +1,640 @@
From 375503f9a98878297ee05ba12c3be14afa795812 Mon Sep 17 00:00:00 2001
From: Da Xue <da@libre.computer>
Date: Fri, 8 May 2020 16:35:27 -0400
Subject: [PATCH] splash: fix CONFIG_SPLASH_SOURCE and enable backup logo load
Origin: https://github.com/libre-computer-project/libretech-u-boot/commit/8ddf2cded4efad8b5596b0b15a507aa3fb00f6d0
---
common/splash.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/common/splash.c b/common/splash.c
index 2b9313e03f1..cca81bff8ed 100644
--- a/common/splash.c
+++ b/common/splash.c
@@ -82,11 +82,12 @@ static inline int splash_video_logo_load(void) { return -ENOSYS; }
__weak int splash_screen_prepare(void)
{
- if (CONFIG_IS_ENABLED(SPLASH_SOURCE))
- return splash_source_load(default_splash_locations,
- ARRAY_SIZE(default_splash_locations));
-
- return splash_video_logo_load();
+ return
+#ifdef CONFIG_SPLASH_SOURCE
+ splash_source_load(default_splash_locations,
+ ARRAY_SIZE(default_splash_locations)) &&
+#endif
+ splash_video_logo_load();
}
#ifdef CONFIG_SPLASH_SCREEN_ALIGN
--
2.25.4
From 02328c238f24591e135bd7bae7ac5ca3f8bb59fa Mon Sep 17 00:00:00 2001
From: Da Xue <da@libre.computer>
Date: Tue, 7 Jul 2020 04:47:48 -0400
Subject: [PATCH] hack: bmp: compressed logo
Origin: https://github.com/libre-computer-project/libretech-u-boot/commit/9f849b044b60cf9a05618ef7da13db3961120304
---
tools/Makefile | 6 +++++-
tools/bmp_logo.c | 29 +++++++++++++++++++++++++----
2 files changed, 30 insertions(+), 5 deletions(-)
diff --git a/tools/Makefile b/tools/Makefile
index 879c3fd4a74..199378d8cea 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -256,7 +256,6 @@ ifneq ($(wildcard $(srctree)/$(src)/logos/$(VENDOR).bmp),)
LOGO_BMP= $(srctree)/$(src)/logos/$(VENDOR).bmp
endif
endif
-
endif # !LOGO_BMP
#
@@ -279,8 +278,13 @@ $(LOGO_H): $(obj)/bmp_logo $(LOGO_BMP)
$(obj)/bmp_logo --gen-info $(LOGO_BMP) > $@
ifeq ($(CONFIG_DM_VIDEO),y)
+ifneq ($(wildcard $(LOGO_BMP).gz),)
+$(LOGO_DATA_H): $(obj)/bmp_logo $(LOGO_BMP)
+ $(obj)/bmp_logo --gen-bmp-gz $(LOGO_BMP) $(LOGO_BMP).gz > $@
+else
$(LOGO_DATA_H): $(obj)/bmp_logo $(LOGO_BMP)
$(obj)/bmp_logo --gen-bmp $(LOGO_BMP) > $@
+endif
else
$(LOGO_DATA_H): $(obj)/bmp_logo $(LOGO_BMP)
$(obj)/bmp_logo --gen-data $(LOGO_BMP) > $@
diff --git a/tools/bmp_logo.c b/tools/bmp_logo.c
index 74fcadca63e..d8727c227fd 100644
--- a/tools/bmp_logo.c
+++ b/tools/bmp_logo.c
@@ -3,7 +3,8 @@
enum {
MODE_GEN_INFO,
MODE_GEN_DATA,
- MODE_GEN_BMP
+ MODE_GEN_BMP,
+ MODE_GEN_BMP_GZ
};
typedef struct bitmap_s { /* bitmap description */
@@ -17,7 +18,7 @@ typedef struct bitmap_s { /* bitmap description */
void usage(const char *prog)
{
- fprintf(stderr, "Usage: %s [--gen-info|--gen-data|--gen-bmp] file\n",
+ fprintf(stderr, "Usage: %s [--gen-info|--gen-data|--gen-bmp|--gen-bmp-gz] file\n",
prog);
}
@@ -76,7 +77,7 @@ int main (int argc, char *argv[])
{
int mode, i, x;
int size;
- FILE *fp;
+ FILE *fp, *gzfp;
bitmap_t bmp;
bitmap_t *b = &bmp;
uint16_t data_offset, n_colors, hdr_size;
@@ -92,6 +93,8 @@ int main (int argc, char *argv[])
mode = MODE_GEN_DATA;
else if (!strcmp(argv[1], "--gen-bmp"))
mode = MODE_GEN_BMP;
+ else if (!strcmp(argv[1], "--gen-bmp-gz"))
+ mode = MODE_GEN_BMP_GZ;
else {
usage(argv[0]);
exit(EXIT_FAILURE);
@@ -102,9 +105,17 @@ int main (int argc, char *argv[])
perror(argv[2]);
exit (EXIT_FAILURE);
}
-
+
if (fgetc (fp) != 'B' || fgetc (fp) != 'M')
error ("Input file is not a bitmap", fp);
+
+ if (mode == MODE_GEN_BMP_GZ){
+ gzfp = fopen(argv[3], "rb");
+ if (!gzfp) {
+ perror(argv[3]);
+ exit (EXIT_FAILURE);
+ }
+ }
/*
* read width and height of the image, and the number of colors used;
@@ -182,6 +193,11 @@ int main (int argc, char *argv[])
fseek(fp, 0L, SEEK_END);
size = ftell(fp);
fseek(fp, 0L, SEEK_SET);
+ } else if (mode == MODE_GEN_BMP_GZ) {
+ /* copy full bmp file */
+ fseek(gzfp, 0L, SEEK_END);
+ size = ftell(gzfp);
+ fseek(gzfp, 0L, SEEK_SET);
} else {
fseek(fp, (long)data_offset, SEEK_SET);
}
@@ -200,6 +216,10 @@ int main (int argc, char *argv[])
/* write full bmp */
for (i = 0; i < size; i++)
b->data[i] = (uint8_t)fgetc(fp);
+ } else if (mode == MODE_GEN_BMP_GZ) {
+ /* write full bmp */
+ for (i = 0; i < size; i++)
+ b->data[i] = (uint8_t)fgetc(gzfp);
} else {
for (i = (b->height - 1) * b->width; i >= 0; i -= b->width) {
for (x = 0; x < b->width; x++) {
@@ -224,5 +244,6 @@ int main (int argc, char *argv[])
out:
fclose(fp);
+ if (mode == MODE_GEN_BMP_GZ) fclose(gzfp);
return 0;
}
--
2.25.4
From 1cc7a56f46f8b8195ece2d8f647cfed45505a457 Mon Sep 17 00:00:00 2001
From: Samuel Dionne-Riel <samuel@dionne-riel.com>
Date: Tue, 7 Jul 2020 00:59:45 -0400
Subject: [PATCH] bootmenu: Replace reverse for truetype console
The truetype console doesn't support many ANSI escape sequences, among
those the reverse sequence is *broken*. It reverses the text, but does
not change the background color.
This, instead, uses characters to show which option is currently active.
---
cmd/bootmenu.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/cmd/bootmenu.c b/cmd/bootmenu.c
index 18efe25751f..7b7db74c8e2 100644
--- a/cmd/bootmenu.c
+++ b/cmd/bootmenu.c
@@ -61,23 +61,24 @@ static char *bootmenu_getoption(unsigned short int n)
static void bootmenu_print_entry(void *data)
{
struct bootmenu_entry *entry = data;
- int reverse = (entry->menu->active == entry->num);
+ int active = (entry->menu->active == entry->num);
/*
* Move cursor to line where the entry will be drown (entry->num)
* First 3 lines contain bootmenu header + 1 empty line
*/
printf(ANSI_CURSOR_POSITION, entry->num + 4, 1);
+ puts(ANSI_CLEAR_LINE);
- puts(" ");
-
- if (reverse)
- puts(ANSI_COLOR_REVERSE);
+ if (active)
+ puts(" => [");
+ else
+ puts(" ");
puts(entry->title);
- if (reverse)
- puts(ANSI_COLOR_RESET);
+ if (active)
+ puts("]");
}
static void bootmenu_autoboot_loop(struct bootmenu_data *menu,
--
2.25.4
From c904267ca621815876eba5c21b967306a30c4cce Mon Sep 17 00:00:00 2001
From: Samuel Dionne-Riel <samuel@dionne-riel.com>
Date: Tue, 7 Jul 2020 05:04:53 -0400
Subject: [PATCH] vidconsole-uclass: Implement ANSI_CURSOR_COLUMN
---
drivers/video/vidconsole-uclass.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c
index 9b761547212..3e8895017a1 100644
--- a/drivers/video/vidconsole-uclass.c
+++ b/drivers/video/vidconsole-uclass.c
@@ -306,6 +306,18 @@ static void vidconsole_escape_char(struct udevice *dev, char ch)
set_cursor_position(priv, row, col);
break;
}
+ case 'G': {
+ int row, col;
+ get_cursor_position(priv, &row, &col);
+ char *s = priv->escape_buf;
+ s++; /* [ */
+ s = parsenum(s, &col);
+ col = col-1;
+ if (col < 0)
+ col = 0;
+ set_cursor_position(priv, row, col);
+ break;
+ }
case 'H':
case 'f': {
int row, col;
--
2.25.4
From 6676c66c0108f4a2db1d17ce8c742189df7fb7eb Mon Sep 17 00:00:00 2001
From: Samuel Dionne-Riel <samuel@dionne-riel.com>
Date: Tue, 7 Jul 2020 22:17:36 -0400
Subject: [PATCH] autoboot: Make all prompts configurable
This is a multi-purpose commit. Though it is hard to split into distinct
changes.
1. Allows the non-keyed prompt to be configured
This is self-explanatory. This allows better customization for the
integrator. Though, more to the point, this reduces the confusion that
comes from the option name and description. Now it is used for all
auto-boot prompts, not only for the keyed prompt.
2. Redraws using ANSI escapes
This is required for (1), as we can't backspace over the arbitrary
amount of characters to redraw the countdown.
This is done through resetting the column to 1 and clearing the line for
maximum compatibility. Tested against serial, default dm_video and the
truetype console.
---
cmd/Kconfig | 4 ++--
common/autoboot.c | 15 ++++++++++-----
2 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/cmd/Kconfig b/cmd/Kconfig
index 192b3b262f1..f5d6781473a 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -86,8 +86,8 @@ config AUTOBOOT_KEYED
config AUTOBOOT_PROMPT
string "Autoboot stop prompt"
- depends on AUTOBOOT_KEYED
- default "Autoboot in %d seconds\\n"
+ default "Autoboot in %d seconds\\n" if AUTOBOOT_KEYED
+ default "Hit any key to stop autoboot: %2d \\n"
help
This string is displayed before the boot delay selected by
CONFIG_BOOTDELAY starts. If it is not defined there is no
diff --git a/common/autoboot.c b/common/autoboot.c
index 6d78716a266..a3b2fb0c16f 100644
--- a/common/autoboot.c
+++ b/common/autoboot.c
@@ -5,6 +5,7 @@
*/
#include <common.h>
+#include <ansi.h>
#include <autoboot.h>
#include <bootretry.h>
#include <cli.h>
@@ -251,14 +252,16 @@ static int abortboot_single_key(int bootdelay)
int abort = 0;
unsigned long ts;
- printf("Hit any key to stop autoboot: %2d ", bootdelay);
+ printf(CONFIG_AUTOBOOT_PROMPT, bootdelay);
/*
* Check if key already pressed
*/
if (tstc()) { /* we got a key press */
- (void) getc(); /* consume input */
- puts("\b\b\b 0");
+ (void) getc(); /* consume input */
+ puts(ANSI_CLEAR_LINE);
+ printf(ANSI_CURSOR_COLUMN, 1);
+ printf(CONFIG_AUTOBOOT_PROMPT, 0);
abort = 1; /* don't auto boot */
}
@@ -272,7 +275,7 @@ static int abortboot_single_key(int bootdelay)
abort = 1; /* don't auto boot */
bootdelay = 0; /* no more delay */
- key = getc(); /* consume input */
+ key = getc(); /* consume input */
if (IS_ENABLED(CONFIG_USE_AUTOBOOT_MENUKEY))
menukey = key;
break;
@@ -280,7 +283,9 @@ static int abortboot_single_key(int bootdelay)
udelay(10000);
} while (!abort && get_timer(ts) < 1000);
- printf("\b\b\b%2d ", bootdelay);
+ puts(ANSI_CLEAR_LINE);
+ printf(ANSI_CURSOR_COLUMN, 1);
+ printf(CONFIG_AUTOBOOT_PROMPT, bootdelay);
}
putc('\n');
--
2.25.4
From 0a4a4fca5af332e93d9b44032fe8afd7686387f4 Mon Sep 17 00:00:00 2001
From: Da Xue <da@libre.computer>
Date: Tue, 7 Jul 2020 22:23:48 -0400
Subject: [PATCH] autoboot: correct config naming, only allow escape key to
menu
Origin: https://github.com/libre-computer-project/libretech-u-boot/commit/e8dc057670e9ff0e8ecfea4fd549ce8cc2516378
---
common/autoboot.c | 51 ++++++++++++++++++++++++++++++++---------------
1 file changed, 35 insertions(+), 16 deletions(-)
diff --git a/common/autoboot.c b/common/autoboot.c
index a3b2fb0c16f..82eb7ba3440 100644
--- a/common/autoboot.c
+++ b/common/autoboot.c
@@ -44,8 +44,12 @@ static int menukey;
#define AUTOBOOT_STOP_STR_SHA256 ""
#endif
-#ifdef CONFIG_USE_AUTOBOOT_MENUKEY
-#define AUTOBOOT_MENUKEY CONFIG_USE_AUTOBOOT_MENUKEY
+#ifdef CONFIG_AUTOBOOT_USE_MENUKEY
+#ifdef CONFIG_AUTOBOOT_MENUKEY
+#define AUTOBOOT_MENUKEY CONFIG_AUTOBOOT_MENUKEY
+#else
+#define AUTOBOOT_MENUKEY 0
+#endif
#else
#define AUTOBOOT_MENUKEY 0
#endif
@@ -258,11 +262,22 @@ static int abortboot_single_key(int bootdelay)
* Check if key already pressed
*/
if (tstc()) { /* we got a key press */
- (void) getc(); /* consume input */
- puts(ANSI_CLEAR_LINE);
- printf(ANSI_CURSOR_COLUMN, 1);
- printf(CONFIG_AUTOBOOT_PROMPT, 0);
- abort = 1; /* don't auto boot */
+ if (IS_ENABLED(CONFIG_AUTOBOOT_USE_MENUKEY)){
+ menukey = getc();
+ puts(ANSI_CLEAR_LINE);
+ printf(ANSI_CURSOR_COLUMN, 1);
+ printf(CONFIG_AUTOBOOT_PROMPT, 0);
+ if (menukey == AUTOBOOT_MENUKEY) {
+ abort = 1;
+ bootdelay = 0;
+ }
+ } else {
+ (void) getc(); /* consume input */
+ puts(ANSI_CLEAR_LINE);
+ printf(ANSI_CURSOR_COLUMN, 1);
+ printf(CONFIG_AUTOBOOT_PROMPT, 0);
+ abort = 1; /* don't auto boot */
+ }
}
while ((bootdelay > 0) && (!abort)) {
@@ -271,13 +286,18 @@ static int abortboot_single_key(int bootdelay)
ts = get_timer(0);
do {
if (tstc()) { /* we got a key press */
- int key;
-
- abort = 1; /* don't auto boot */
- bootdelay = 0; /* no more delay */
- key = getc(); /* consume input */
- if (IS_ENABLED(CONFIG_USE_AUTOBOOT_MENUKEY))
- menukey = key;
+
+ if (IS_ENABLED(CONFIG_AUTOBOOT_USE_MENUKEY)){
+ menukey = getc();
+ if (menukey == AUTOBOOT_MENUKEY){
+ abort = 1;
+ bootdelay = 0;
+ }
+ } else {
+ abort = 1; /* don't auto boot */
+ bootdelay = 0; /* no more delay */
+ menukey = getc(); /* consume input */
+ }
break;
}
udelay(10000);
@@ -383,8 +403,7 @@ void autoboot_command(const char *s)
disable_ctrlc(prev); /* restore Ctrl-C checking */
}
- if (IS_ENABLED(CONFIG_USE_AUTOBOOT_MENUKEY) &&
- menukey == AUTOBOOT_MENUKEY) {
+ if (IS_ENABLED(CONFIG_AUTOBOOT_USE_MENUKEY)) {
s = env_get("menucmd");
if (s)
run_command_list(s, -1, 0);
--
2.25.4
From c2832bcbc0ae86b2fe85abc68dd98a406ee0deeb Mon Sep 17 00:00:00 2001
From: Samuel Dionne-Riel <samuel@dionne-riel.com>
Date: Wed, 8 Jul 2020 01:26:30 -0400
Subject: [PATCH] Define a very-opinionated boot sequence
---
configs/pinebook-pro-rk3399_defconfig | 25 +++++++++++++++++++++++++
include/configs/pinebook-pro-rk3399.h | 17 +++++++++++++++++
2 files changed, 42 insertions(+)
diff --git a/configs/pinebook-pro-rk3399_defconfig b/configs/pinebook-pro-rk3399_defconfig
index dbbd43ed9f3..4acccdfb0f7 100644
--- a/configs/pinebook-pro-rk3399_defconfig
+++ b/configs/pinebook-pro-rk3399_defconfig
@@ -95,3 +95,28 @@ CONFIG_SPL_SPI_FLASH_TINY=n
CONFIG_SPL_SPI_FLASH_SFDP_SUPPORT=y
CONFIG_SPL_SPI_LOAD=y
CONFIG_SYS_SPI_U_BOOT_OFFS=0x80000
+
+# Boot menu required for the menu (duh)
+CONFIG_CMD_BOOTMENU=y
+
+# Truetype console configuration
+CONFIG_CONSOLE_TRUETYPE=y
+CONFIG_CONSOLE_TRUETYPE_NIMBUS=y
+CONFIG_CONSOLE_TRUETYPE_SIZE=26
+
+# Boot menu and default boot configuration
+
+# Gives *some* time for the user to act.
+# Though an already-knowledgeable user will know they can use the key before
+# the message is shown.
+# Conversely, CTRL+C can cancel the default boot, showing the menu as expected
+# In reality, this gives us MUCH MORE slop in the time window than 1 second.
+CONFIG_BOOTDELAY=1
+# This would be escape, but the USB drivers don't really play well and
+# escape doesn't work from the keyboard.
+CONFIG_AUTOBOOT_MENUKEY=27
+# So we'll fake that using CTRL+C is what we want...
+# It's only a side-effect.
+CONFIG_AUTOBOOT_PROMPT="Press CTRL+C for the boot menu."
+# And this ends up causing the menu to be used on CTRL+C (or escape)
+CONFIG_AUTOBOOT_USE_MENUKEY=y
diff --git a/include/configs/pinebook-pro-rk3399.h b/include/configs/pinebook-pro-rk3399.h
index d9108305824..5b1234ac7ad 100644
--- a/include/configs/pinebook-pro-rk3399.h
+++ b/include/configs/pinebook-pro-rk3399.h
@@ -7,7 +7,24 @@
#ifndef __PINEBOOK_PRO_RK3399_H
#define __PINEBOOK_PRO_RK3399_H
+// This sets up additional environment variables for our opinionated setup.
+// (See rk3399_common.h, it should be apended to ROCKCHIP_DEVICE_SETTINGS here
+// but it makes patches harder to apply...)
+#define OPINIONATED_ENV \
+ "setup_leds=led green:power on; led red:standby on\0" \
+ "bootcmd=run setup_leds; run distro_bootcmd\0" \
+ "bootmenu_delay=-1\0" \
+ "bootmenu_0=Default U-Boot boot=run distro_bootcmd; echo \"Boot failed.\"; sleep 5; $menucmd -1\0" \
+ "bootmenu_1=Boot from eMMC=run bootcmd_mmc0; echo \"eMMC Boot failed.\"; sleep 5; $menucmd -1\0" \
+ "bootmenu_2=Boot from SD=run bootcmd_mmc1; echo \"SD Boot failed.\"; sleep 5; $menucmd -1\0" \
+ "bootmenu_3=Boot from USB=run bootcmd_usb0; echo \"USB Boot failed.\"; sleep 5; $menucmd -1\0" \
+ "bootmenu_4=Boot PXE=run bootcmd_pxe; echo \"PXE Boot failed.\"; sleep 5; $menucmd -1\0" \
+ "bootmenu_5=Boot DHCP=run bootcmd_dhcp; echo \"DHCP Boot failed.\"; sleep 5; $menucmd -1\0" \
+ "bootmenu_6=Reboot=reset\0" \
+ "menucmd=bootmenu\0"
+
#define ROCKCHIP_DEVICE_SETTINGS \
+ OPINIONATED_ENV \
"stdin=serial,usbkbd\0" \
"stdout=serial,vidconsole\0" \
"stderr=serial,vidconsole\0"
--
2.25.4
From 7fad5fa92dc905a11cf53549a4fc52940571e204 Mon Sep 17 00:00:00 2001
From: Samuel Dionne-Riel <samuel@dionne-riel.com>
Date: Wed, 8 Jul 2020 01:26:55 -0400
Subject: [PATCH] Configure boot splash logo
This assumes LOGO_BMP is set by the derivation as a make flag.
---
configs/pinebook-pro-rk3399_defconfig | 3 +++
include/configs/pinebook-pro-rk3399.h | 16 ++++++++++++++++
2 files changed, 19 insertions(+)
diff --git a/configs/pinebook-pro-rk3399_defconfig b/configs/pinebook-pro-rk3399_defconfig
index 4acccdfb0f7..8dc5bc95cd9 100644
--- a/configs/pinebook-pro-rk3399_defconfig
+++ b/configs/pinebook-pro-rk3399_defconfig
@@ -99,6 +99,9 @@ CONFIG_SYS_SPI_U_BOOT_OFFS=0x80000
# Boot menu required for the menu (duh)
CONFIG_CMD_BOOTMENU=y
+# Required for the splash (see include/configs/pinebook-pro-rk3399.h)
+CONFIG_CMD_BMP=y
+
# Truetype console configuration
CONFIG_CONSOLE_TRUETYPE=y
CONFIG_CONSOLE_TRUETYPE_NIMBUS=y
diff --git a/include/configs/pinebook-pro-rk3399.h b/include/configs/pinebook-pro-rk3399.h
index 5b1234ac7ad..2c276476ca8 100644
--- a/include/configs/pinebook-pro-rk3399.h
+++ b/include/configs/pinebook-pro-rk3399.h
@@ -7,10 +7,26 @@
#ifndef __PINEBOOK_PRO_RK3399_H
#define __PINEBOOK_PRO_RK3399_H
+// The following bunch of defines is for the splash
+#define CONFIG_SPLASHIMAGE_GUARD
+#define CONFIG_SPLASH_SCREEN
+#define CONFIG_SPLASH_SCREEN_ALIGN
+#define CONFIG_SPLASH_SOURCE
+#define CONFIG_SYS_VIDEO_LOGO_MAX_SIZE (1920*1080*4)
+#define CONFIG_VIDEO_BMP_GZIP
+#define CONFIG_VIDEO_BMP_LOGO
+#define CONFIG_VIDEO_BMP_RLE8
+#define CONFIG_VIDEO_LOGO
+#define SPLASH_ENV \
+ "splashimage=0x08080000\0" \
+ "splashpos=m,m\0" \
+ "splashsource=mmc_fs\0"
+
// This sets up additional environment variables for our opinionated setup.
// (See rk3399_common.h, it should be apended to ROCKCHIP_DEVICE_SETTINGS here
// but it makes patches harder to apply...)
#define OPINIONATED_ENV \
+ SPLASH_ENV \
"setup_leds=led green:power on; led red:standby on\0" \
"bootcmd=run setup_leds; run distro_bootcmd\0" \
"bootmenu_delay=-1\0" \
--
2.25.4
From 025775cd6469ed0a5a818d2708cc82a43755abb9 Mon Sep 17 00:00:00 2001
From: Samuel Dionne-Riel <samuel@dionne-riel.com>
Date: Thu, 9 Jul 2020 02:50:29 -0400
Subject: [PATCH] [WIP] cli: Clear ctrl+c before running a command
This fixes an issue where:
With an environment like so:
bootmenu_0=Default U-Boot boot=run distro_bootcmd; $menucmd -1
* Running bootmenu
* Running the option
* Cancelling using CTRL-C
Would show the menu as expected, but running *any* command
post-cancellation would spuriously exit in unexplainable ways.
---
common/cli.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/common/cli.c b/common/cli.c
index 6635ab2bcf8..f49a0689cc7 100644
--- a/common/cli.c
+++ b/common/cli.c
@@ -45,6 +45,9 @@ int run_command(const char *cmd, int flag)
if (flag & CMD_FLAG_ENV)
hush_flags |= FLAG_CONT_ON_NEWLINE;
+
+ clear_ctrlc(); /* forget any previous Control C */
+
return parse_string_outer(cmd, hush_flags);
#endif
}
@@ -65,6 +68,9 @@ int run_command_repeatable(const char *cmd, int flag)
* parse_string_outer() returns 1 for failure, so clean up
* its result.
*/
+
+ clear_ctrlc(); /* forget any previous Control C */
+
if (parse_string_outer(cmd,
FLAG_PARSE_SEMICOLON | FLAG_EXIT_FROM_LOOP))
return -1;
@@ -105,6 +111,9 @@ int run_command_list(const char *cmd, int len, int flag)
buff[len] = '\0';
}
#ifdef CONFIG_HUSH_PARSER
+
+ clear_ctrlc(); /* forget any previous Control C */
+
rcode = parse_string_outer(buff, FLAG_PARSE_SEMICOLON);
#else
/*
--
2.25.4

View file

@ -0,0 +1,29 @@
From dd52b971005271d615e63f4f946a0ee9331925bc Mon Sep 17 00:00:00 2001
From: dhivael <dhivael.git@eno.space>
Date: Sat, 11 Jan 2020 15:04:04 +0100
Subject: [PATCH 3/5] rockchip: move mmc1 before mmc0 in default boot order
on pinebooks mmc1 is the external card, which should take boot priority
over the internal emmc even if the emmc is bootable.
---
include/configs/rockchip-common.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/configs/rockchip-common.h b/include/configs/rockchip-common.h
index 0b9e24d1db4..6610f95b7b9 100644
--- a/include/configs/rockchip-common.h
+++ b/include/configs/rockchip-common.h
@@ -17,8 +17,8 @@
/* First try to boot from SD (index 0), then eMMC (index 1) */
#if CONFIG_IS_ENABLED(CMD_MMC)
#define BOOT_TARGET_MMC(func) \
- func(MMC, mmc, 0) \
- func(MMC, mmc, 1)
+ func(MMC, mmc, 1) \
+ func(MMC, mmc, 0)
#else
#define BOOT_TARGET_MMC(func)
#endif
--
2.25.3

View file

@ -0,0 +1,55 @@
From 4b11a4444983c997addc5c581da1ec287f27fa47 Mon Sep 17 00:00:00 2001
From: dhivael <dhivael.git@eno.space>
Date: Sat, 11 Jan 2020 15:04:04 +0100
Subject: [PATCH 4/5] rockchip: move usb0 after mmc1 in default boot order
now that we support booting from USB we should prefer USB boot over eMMC
boot. we still try to boot from SD cards first.
---
include/configs/rockchip-common.h | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/include/configs/rockchip-common.h b/include/configs/rockchip-common.h
index 6610f95b7b9..d743ebe83e6 100644
--- a/include/configs/rockchip-common.h
+++ b/include/configs/rockchip-common.h
@@ -16,11 +16,10 @@
/* First try to boot from SD (index 0), then eMMC (index 1) */
#if CONFIG_IS_ENABLED(CMD_MMC)
- #define BOOT_TARGET_MMC(func) \
- func(MMC, mmc, 1) \
- func(MMC, mmc, 0)
+ #define BOOT_TARGET_MMC(func, idx) \
+ func(MMC, mmc, idx)
#else
- #define BOOT_TARGET_MMC(func)
+ #define BOOT_TARGET_MMC(func, idx)
#endif
#if CONFIG_IS_ENABLED(CMD_NVME)
@@ -55,16 +54,18 @@
#ifdef CONFIG_ROCKCHIP_RK3399
#define BOOT_TARGET_DEVICES(func) \
- BOOT_TARGET_MMC(func) \
- BOOT_TARGET_NVME(func) \
+ BOOT_TARGET_MMC(func, 1) \
BOOT_TARGET_USB(func) \
+ BOOT_TARGET_NVME(func) \
+ BOOT_TARGET_MMC(func, 0) \
BOOT_TARGET_PXE(func) \
BOOT_TARGET_DHCP(func) \
BOOT_TARGET_SF(func)
#else
#define BOOT_TARGET_DEVICES(func) \
- BOOT_TARGET_MMC(func) \
+ BOOT_TARGET_MMC(func, 1) \
BOOT_TARGET_USB(func) \
+ BOOT_TARGET_MMC(func, 0) \
BOOT_TARGET_PXE(func) \
BOOT_TARGET_DHCP(func)
#endif
--
2.25.3

View file

@ -0,0 +1,28 @@
From 9482bb0eea3ad397b06ef195f9c2f09de94e74cb Mon Sep 17 00:00:00 2001
From: Tian Yuanhao <tianyuanhao@aliyun.com>
Date: Mon, 6 Jul 2020 16:46:33 +0800
Subject: [PATCH] rk3399: boot from compressed Image
Add kernel_comp_addr_r and kernel_comp_size to rk3399_common.h, so that
people can use compressed Image (e.g. Image.gz) in extlinux.conf.
Signed-off-by: Tian Yuanhao <tianyuanhao@aliyun.com>
---
include/configs/rk3399_common.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/include/configs/rk3399_common.h b/include/configs/rk3399_common.h
index f0ae6e67a7..6a275818d0 100644
--- a/include/configs/rk3399_common.h
+++ b/include/configs/rk3399_common.h
@@ -53,7 +53,9 @@
"pxefile_addr_r=0x00600000\0" \
"fdt_addr_r=0x01f00000\0" \
"kernel_addr_r=0x02080000\0" \
- "ramdisk_addr_r=0x06000000\0"
+ "kernel_comp_addr_r=0x06000000\0" \
+ "kernel_comp_size=0x02000000\0" \
+ "ramdisk_addr_r=0x08000000\0"
#ifndef ROCKCHIP_DEVICE_SETTINGS
#define ROCKCHIP_DEVICE_SETTINGS

View file

@ -0,0 +1,70 @@
# Seperate u-boot package for the pine64-pinebookpro because this includes
# a driver for the display and supports efi loading operating systems
pkgname=u-boot-pinebookpro
pkgver=2020.07
pkgrel=0
pkgdesc="u-boot bootloader for the rk3399"
url="https://gitlab.denx.de/u-boot/u-boot"
arch="aarch64"
license="GPL-2.0-or-later OFL-1.1 BSD-2-Clause BSD-3-Clause eCos-2.0 IBM-pibs
ISC LGPL-2.0-only LGPL-2.1-only X11"
makedepends="$depends_dev bc dtc python3-dev swig bison flex openssl-dev arm-trusted-firmware-rk3399 uboot-tools"
options="!check"
source="
ftp://ftp.denx.de/pub/u-boot/u-boot-${pkgver//_/-}.tar.bz2
0001-enable-rockchip-rng.patch
0002-enable-usb-keyboard.patch
0003-display-support.patch
0004-rk3399-light-pinebook-power-and-standby-leds.patch
0005-support-SPI-flash-boot.patch
0006-implement-boot-menu.patch
0007-rockchip-boot-order.patch
0008-rockchip-boot-order-add-usb.patch
0009-rk3399-support-compressed-kernel.patch
pine64.bmp
"
builddir="$srcdir"/u-boot-${pkgver//_/-}
build() {
touch include/config.h
LC_ALL=C date +'#define U_BOOT_DATE "%b %d %C%y"' > include/timestamp_autogenerated.h
LC_ALL=C date +'#define U_BOOT_TIME "%T"' >> include/timestamp_autogenerated.h
export BL31="/usr/share/arm-trusted-firmware-rk3399/bl31.elf"
export BUILD_DIR="$builddir"/build
mkdir -p "$BUILD_DIR"
make O="$BUILD_DIR" HOSTCC=gcc ARCH=arm LOGO_BMP=$srcdir/pine64.bmp pinebook-pro-rk3399_defconfig
make O="$BUILD_DIR" HOSTCC=gcc ARCH=arm LOGO_BMP=$srcdir/pine64.bmp all
mkimage -n rk3399 -T rkspi -d build/tpl/u-boot-tpl-dtb.bin:build/spl/u-boot-spl-dtb.bin spl.bin
dd if=spl.bin bs=512K conv=sync of=u-boot.spiflash.bin
cat u-boot.spiflash.bin build/u-boot.itb > build/u-boot.spiflash.bin
# Make the image the exact size of the spi flash so flashrom does what it's supposed to
truncate -s 16777216 build/u-boot.spiflash.bin
truncate -s 50MB bootable.img
dd if=build/idbloader.img of=bootable.img bs=512 seek=64 conv=notrunc
dd if=build/u-boot.itb of=bootable.img bs=512 seek=16384 conv=notrunc
}
package() {
install -D -m644 build/u-boot-rockchip.bin \
"$pkgdir"/usr/share/u-boot/pine64-rockpro64/u-boot-rockchip.bin
install -D -m644 build/u-boot.spiflash.bin \
"$pkgdir"/usr/share/u-boot/pine64-rockpro64/u-boot.spiflash.bin
install -D -m644 bootable.img \
"$pkgdir"/usr/share/u-boot/pine64-rockpro64/bootable.img
}
sha512sums="df91264fe8a42e676c3f2aa09d644c6a3035cc8169bf52a8ab95efe7e542cfc758a0ef150949b0d9f03c7dec7d95f8d20a2efe2dbb60c2ef1a61c8063770478d u-boot-2020.07.tar.bz2
058408fdf8921bcde5f9ca9ea03fdad6d87dd94f09bd6768792d72af43e64e801dfd8cb3f16e83be14153d9c38b3e3e23fe949778d9347ff72bada996bd82cfe 0001-enable-rockchip-rng.patch
8e454e486a7c9fe486a1bdbececf8c6b163b90b7b57a3822afb2a30f42ba9552439360d08a6ecc19a2ebe807c6c15961a73e0fe47dce9d2a7f86ce4742cb2510 0002-enable-usb-keyboard.patch
7292dab0af5b0127663eac7966499fc5af87c544485168b5269cdf16a226cd8a215b76a4745cf19afb751ea6fea680e26b86adfdaab54e3ec7fc8fd8bec85c6b 0003-display-support.patch
5188c54bb1efe18471b3e0ff8113b0d46d6ecad2be222416c7fb89021e76f2816771793d3efaba561602064a8079cf0da66e25228e132d44a0f6b14658f93ffb 0004-rk3399-light-pinebook-power-and-standby-leds.patch
ee51dca25a5a00011186c7f750e20ed08061a5a64a67bd81ca6d96cefdb139a15078d48c2c5b6ecb09b4ab5d778e11f3b62ff3daa74ffc7d73963b15e4eee215 0005-support-SPI-flash-boot.patch
8d989d200639204c8f7fb2620209bd1e096e8c5ea04085f68486b71490deb60e89e2d54704508bfe22c006b0d331dcc0c5cbfac6c0e02328a01b0f0b611d6b58 0006-implement-boot-menu.patch
3a91ae0f499ca668ac95cc24c3b2794b0884acfcba2a76493cb2329b8e00d84eb1bbfdcdb2475064cc5b0fb0b52df849afc59b6399de44699db9dfda4d0c5f3c 0007-rockchip-boot-order.patch
b655dfd83c12925d5e90f317c97d8bca9f047df337202627bfe40e0ebaba79d8adc429575a04f5af531bcc2626521b517ea7b9026dbdffb54ba97316d1674cf9 0008-rockchip-boot-order-add-usb.patch
cc03b87e42ce0ade1d3ddd9eebc76304451c01c4ee2ea2f52aa572ab8a30d84960df4d47f14315d96943467793fccee2052f53ace9fbac059e30c86c749d7ccc 0009-rk3399-support-compressed-kernel.patch
e317f8527dbb3b8a40a45d20da6c42f8cfd98b968060d6b4f1fa5453736441d36d1048bdc4359af47c2129fa86b6d43b3e263ef282f5c7b2e54f702d8b6bd8b1 pine64.bmp"

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB