Project

General

Profile

Packaging Request #3304 » 0001-wip-uboot-pinebookpro-failing-build.patch

avalos, 2022-07-13 07:53 AM

View differences:

libre/uboot-pinebookpro/0001-PBP-Fix-panel-reset.patch
1
From 352cb7b28bf4a16330f148043e8d10b0141bbfcb Mon Sep 17 00:00:00 2001
2
From: Arnaud Patard <arnaud.patard@rtp-net.org>
3
Date: Wed, 8 Jul 2020 21:43:36 -0400
4
Subject: [PATCH 4/4] PBP: Fix panel reset
5

  
6
On warm reset, the pinebook pro panel is not working correctly.
7
The issue is not yet debugged so, for now, this hack seems to be
8
enough. It toggles the GPIO1_C6 gpio [ LCDVCC_EN signal in the
9
schematics ] used by the vcc3v3_panel regulator.
10

  
11
There's no gpio_request, since the gpio is already in use at this
12
stage, so it can only fail.
13

  
14
Origin: http://people.hupstream.com/~rtp/pbp/20200706/patches/hack-reset.patch
15
---
16
 board/pine64/pinebook-pro-rk3399/pinebook-pro-rk3399.c | 10 +++++++++-
17
 1 file changed, 9 insertions(+), 1 deletion(-)
18

  
19
diff --git a/board/pine64/pinebook-pro-rk3399/pinebook-pro-rk3399.c b/board/pine64/pinebook-pro-rk3399/pinebook-pro-rk3399.c
20
index 516292aaa59..ff9c916bcb7 100644
21
--- a/board/pine64/pinebook-pro-rk3399/pinebook-pro-rk3399.c
22
+++ b/board/pine64/pinebook-pro-rk3399/pinebook-pro-rk3399.c
23
@@ -7,13 +7,15 @@
24
 #include <common.h>
25
 #include <dm.h>
26
 #include <syscon.h>
27
+#include <linux/delay.h>
28
+#include <asm/gpio.h>
29
 #include <asm/io.h>
30
 #include <asm/arch-rockchip/clock.h>
31
 #include <asm/arch-rockchip/grf_rk3399.h>
32
+#include <asm/arch-rockchip/gpio.h>
33
 #include <asm/arch-rockchip/hardware.h>
34
 #include <asm/arch-rockchip/misc.h>
35
 #include <power/regulator.h>
36
-
37
 #define GRF_IO_VSEL_BT565_SHIFT 0
38
 #define PMUGRF_CON0_VSEL_SHIFT 8
39
 
40
@@ -59,6 +61,7 @@ int misc_init_r(void)
41
 	const u32 cpuid_length = 0x10;
42
 	u8 cpuid[cpuid_length];
43
 	int ret;
44
+	unsigned int gpio;
45
 
46
 	setup_iodomain();
47
 
48
@@ -70,6 +73,11 @@ int misc_init_r(void)
49
 	if (ret)
50
 		return ret;
51
 
52
+	gpio_lookup_name("B22", NULL, NULL, &gpio);
53
+	gpio_direction_output(gpio, 0);
54
+	udelay(500000);
55
+	gpio_direction_output(gpio, 1);
56
+
57
 	return ret;
58
 }
59
 #endif
60
-- 
61
2.25.4
62

  
63

  
libre/uboot-pinebookpro/0002-Correct-boot-order-to-be-USB-SD-eMMC.patch
1
From f97401137daa1cb75532c373bbcb5011f1e03585 Mon Sep 17 00:00:00 2001
2
From: Dan Johansen <strit@manjaro.org>
3
Date: Sun, 10 Oct 2021 20:19:02 +0200
4
Subject: [PATCH] Correct boot order to be USB -> SD -> eMMC
5

  
6
Signed-off-by: Dan Johansen <strit@manjaro.org>
7
---
8
 include/configs/rockchip-common.h | 2 +-
9
 1 file changed, 1 insertion(+), 1 deletion(-)
10

  
11
diff --git a/include/configs/rockchip-common.h b/include/configs/rockchip-common.h
12
index ba7061a287..5dc92373b2 100644
13
--- a/include/configs/rockchip-common.h
14
+++ b/include/configs/rockchip-common.h
15
@@ -55,9 +55,9 @@
16
 
17
 #ifdef CONFIG_ROCKCHIP_RK3399
18
 #define BOOT_TARGET_DEVICES(func) \
19
+	BOOT_TARGET_USB(func) \
20
 	BOOT_TARGET_MMC(func) \
21
 	BOOT_TARGET_NVME(func) \
22
-	BOOT_TARGET_USB(func) \
23
 	BOOT_TARGET_PXE(func) \
24
 	BOOT_TARGET_DHCP(func) \
25
 	BOOT_TARGET_SF(func)
26
-- 
27
2.33.0
28

  
libre/uboot-pinebookpro/0003-Turn-power-and-standby-LEDs-on-early.patch
1
From 354d4f9072b5c41e91d70d1569ba364603889868 Mon Sep 17 00:00:00 2001
2
From: Dragan Simic <dragan.simic@gmail.com>
3
Date: Fri, 22 Apr 2022 03:51:56 +0200
4
Subject: [PATCH] Turn power and standby LEDs on early
5

  
6
Temporary (and ugly) hack to turn the Pinebook Pro's RGB status
7
LED on as early as possible during boot.
8

  
9
Based on a patch created by dhivael <dhivael.git@eno.space>.
10
---
11
 arch/arm/mach-rockchip/rk3399/rk3399.c | 14 ++++++++++++++
12
 1 file changed, 14 insertions(+)
13

  
14
diff --git a/arch/arm/mach-rockchip/rk3399/rk3399.c b/arch/arm/mach-rockchip/rk3399/rk3399.c
15
index 01a05599cd..58b5cd1ce7 100644
16
--- a/arch/arm/mach-rockchip/rk3399/rk3399.c
17
+++ b/arch/arm/mach-rockchip/rk3399/rk3399.c
18
@@ -20,6 +20,7 @@
19
 #include <asm/arch-rockchip/hardware.h>
20
 #include <linux/bitops.h>
21
 #include <power/regulator.h>
22
+#include <dt-bindings/pinctrl/rockchip.h>
23
 
24
 DECLARE_GLOBAL_DATA_PTR;
25
 
26
@@ -157,6 +158,19 @@ void board_debug_uart_init(void)
27
 				  GPIO_PULL_NORMAL);
28
 	}
29
 
30
+	{
31
+		/*
32
+		 * Temporary (and ugly) hack to turn the Pinebook Pro's
33
+		 * RGB status LED on as early as possible during boot:
34
+		 * - Set GPIO0_A2/B3 to GPIO_ACTIVE_HIGH
35
+		 * - Set GPIO0_A2/B3 to OUTPUT
36
+		 */
37
+		int mask = (1UL << RK_PA2) | (1UL << RK_PB3);
38
+
39
+		setbits_le32(&gpio->swport_dr, mask);
40
+		setbits_le32(&gpio->swport_ddr, mask);
41
+	}
42
+
43
 	/* Enable early UART2 channel C on the RK3399 */
44
 	rk_clrsetreg(&grf->gpio4c_iomux,
45
 		     GRF_GPIO4C3_SEL_MASK,
46
-- 
47
2.33.1
48

  
libre/uboot-pinebookpro/0004-mmc-sdhci-allow-disabling-sdma-in-spl.patch
1
From: Peter Geis <pgwipeout@gmail.com>
2
To: Peng Fan <peng.fan@nxp.com>, Jaehoon Chung <jh80.chung@samsung.com>
3
Cc: Peter Geis <pgwipeout@gmail.com>, u-boot@lists.denx.de
4
Subject: [PATCH v1 02/11] mmc: sdhci: allow disabling sdma in spl
5
Date: Mon, 21 Feb 2022 20:31:21 -0500
6

  
7
Rockchip emmc devices have a similar issue to Rockchip dwmmc devices,
8
where performing dma to sram causes errors with suspend/resume.
9
Allow us to toggle sdma in spl for sdhci similar to adma support, so we
10
can ensure dma is not used when loading the sram code.
11

  
12
Signed-off-by: Peter Geis <pgwipeout@gmail.com>
13
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
14
---
15
 drivers/mmc/Kconfig | 7 +++++++
16
 drivers/mmc/sdhci.c | 6 +++---
17
 2 files changed, 10 insertions(+), 3 deletions(-)
18

  
19
diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig
20
index f04cc44e1973..1e4342285ce7 100644
21
--- a/drivers/mmc/Kconfig
22
+++ b/drivers/mmc/Kconfig
23
@@ -468,6 +468,13 @@ config MMC_SDHCI_SDMA
24
 	  This enables support for the SDMA (Single Operation DMA) defined
25
 	  in the SD Host Controller Standard Specification Version 1.00 .
26
 
27
+config SPL_MMC_SDHCI_SDMA
28
+	bool "Support SDHCI SDMA in SPL"
29
+	depends on MMC_SDHCI
30
+	help
31
+	  This enables support for the SDMA (Single Operation DMA) defined
32
+	  in the SD Host Controller Standard Specification Version 1.00 in SPL.
33
+
34
 config MMC_SDHCI_ADMA
35
 	bool "Support SDHCI ADMA2"
36
 	depends on MMC_SDHCI
37
diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
38
index 766e4a6b0c5e..6285e53d12a2 100644
39
--- a/drivers/mmc/sdhci.c
40
+++ b/drivers/mmc/sdhci.c
41
@@ -70,7 +70,7 @@ static void sdhci_transfer_pio(struct sdhci_host *host, struct mmc_data *data)
42
 	}
43
 }
44
 
45
-#if (defined(CONFIG_MMC_SDHCI_SDMA) || CONFIG_IS_ENABLED(MMC_SDHCI_ADMA))
46
+#if (CONFIG_IS_ENABLED(MMC_SDHCI_SDMA) || CONFIG_IS_ENABLED(MMC_SDHCI_ADMA))
47
 static void sdhci_prepare_dma(struct sdhci_host *host, struct mmc_data *data,
48
 			      int *is_aligned, int trans_bytes)
49
 {
50
@@ -177,7 +177,7 @@ static int sdhci_transfer_data(struct sdhci_host *host, struct mmc_data *data)
51
 		}
52
 	} while (!(stat & SDHCI_INT_DATA_END));
53
 
54
-#if (defined(CONFIG_MMC_SDHCI_SDMA) || CONFIG_IS_ENABLED(MMC_SDHCI_ADMA))
55
+#if (CONFIG_IS_ENABLED(MMC_SDHCI_SDMA) || CONFIG_IS_ENABLED(MMC_SDHCI_ADMA))
56
 	dma_unmap_single(host->start_addr, data->blocks * data->blocksize,
57
 			 mmc_get_dma_dir(data));
58
 #endif
59
@@ -836,7 +836,7 @@ int sdhci_setup_cfg(struct mmc_config *cfg, struct sdhci_host *host,
60
 #endif
61
 	debug("%s, caps: 0x%x\n", __func__, caps);
62
 
63
-#ifdef CONFIG_MMC_SDHCI_SDMA
64
+#if CONFIG_IS_ENABLED(MMC_SDHCI_SDMA)
65
 	if ((caps & SDHCI_CAN_DO_SDMA)) {
66
 		host->flags |= USE_SDMA;
67
 	} else {
libre/uboot-pinebookpro/0005-arm-dts-Work-around-daughterboard-issues.patch
1
From 30cd68f2fc79b37bf0e416d026bfa06b0de921b8 Mon Sep 17 00:00:00 2001
2
From: Dragan Simic <dragan.simic@gmail.com>
3
Date: Mon, 16 May 2022 03:46:44 +0200
4
Subject: [PATCH] arm: dts: Work around daughterboard issues
5

  
6
MicroSD card slot in the Pinebook Pro is located on a separate
7
daughterboard that's connected to the mainboard using a rather
8
long flat cable.  The resulting signal degradation causes many
9
perfectly fine microSD cards not to work in the Pinebook Pro,
10
which is a common source of frustration among the owners.
11

  
12
Changing the mode and lowering the speed reportedly fixes this
13
issue and makes many microSD cards work as expected.
14

  
15
Tested-by: JR Gonzalez <jrg@scientiam.org>
16
---
17
 arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts | 2 +-
18
 1 file changed, 1 insertion(+), 1 deletion(-)
19

  
20
diff --git a/arch/arm/dts/rk3399-pinebook-pro.dts b/arch/arm/dts/rk3399-pinebook-pro.dts
21
index c2f021a1a18f..5894cb6bd0a8 100644
22
--- a/arch/arm/dts/rk3399-pinebook-pro.dts
23
+++ b/arch/arm/dts/rk3399-pinebook-pro.dts
24
@@ -945,7 +945,7 @@ &sdmmc {
25
 	disable-wp;
26
 	pinctrl-names = "default";
27
 	pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_bus4>;
28
-	sd-uhs-sdr104;
29
+	sd-uhs-sdr50;
30
 	vmmc-supply = <&vcc3v0_sd>;
31
 	vqmmc-supply = <&vcc_sdio>;
32
 	status = "okay";
33
-- 
34
2.33.1
35

  
libre/uboot-pinebookpro/PKGBUILD
1
# U-Boot: Pinebook Pro based on PKGBUILD for Rock64
2
# Maintainer: Sven Kiljan <sven dot archlinuxarm dash pbp at kiljan dot org>
3
# Contributor: Dan Johansen <strit@manjaro.org>
4
# Contributor: Kevin Mihelich 
5
# Contributor: Adam <adam900710@gmail.com>
6
# Contributor: Dragan Simic <dsimic@buserror.io>
7

  
8
pkgname=uboot-pinebookpro
9
pkgver=2022.04
10
pkgrel=3
11
_tfaver=2.6
12
pkgdesc="U-Boot for Pine64 Pinebook Pro"
13
arch=('armv7h')
14
url='http://www.denx.de/wiki/U-Boot/WebHome'
15
license=('GPL')
16
makedepends=('git' 'arm-none-eabi-gcc' 'dtc' 'bc')
17
provides=('uboot')
18
conflicts=('uboot')
19
replaces=('uboot-pinebookpro-bsp')
20
install=${pkgname}.install
21
source=("ftp://ftp.denx.de/pub/u-boot/u-boot-${pkgver/rc/-rc}.tar.bz2"
22
        "https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/snapshot/trusted-firmware-a-${_tfaver}.tar.gz"
23
        "0001-PBP-Fix-panel-reset.patch"
24
        "0002-Correct-boot-order-to-be-USB-SD-eMMC.patch"
25
        "0003-Turn-power-and-standby-LEDs-on-early.patch"
26
        "0004-mmc-sdhci-allow-disabling-sdma-in-spl.patch"       # From list: https://patchwork.ozlabs.org/project/uboot/patch/20220222013131.3114990-3-pgwipeout@gmail.com/
27
        "0005-arm-dts-Work-around-daughterboard-issues.patch")   # Will be upstreamed by the author
28
sha256sums=('68e065413926778e276ec3abd28bb32fa82abaa4a6898d570c1f48fbdb08bcd0'
29
            '4e59f02ccb042d5d18c89c849701b96e6cf4b788709564405354b5d313d173f7'
30
            'c3ea09a18b766a3ce0728234b097b29e2ed610c7f04b138b7fba42e118a7ae33'
31
            '017d33aac55f8a5ed22170c97b4792ba755a4dad04f6c0cdd85119bbc81e87b3'
32
            'e82b207c56f41c0cc7b85f9057936816ea2ed58533e2dd2f6d665e28c415be60'
33
            '7014c3f1ada93536787a4ce30b484dfe651c339391bd46869c61933825a0edcc'
34
            'ff082f1bfc8666ca372d5e43924c47e60df637f5d2722b47a19b30a1306e8c74')
35

  
36
export CROSS_COMPILE=arm-none-eabi-
37

  
38
prepare() {
39
  cd u-boot-${pkgver/rc/-rc}
40

  
41
  patch -N -p1 -i "${srcdir}/0001-PBP-Fix-panel-reset.patch"                         # Panel reset fix
42
  patch -N -p1 -i "${srcdir}/0002-Correct-boot-order-to-be-USB-SD-eMMC.patch"        # Boot from USB first
43
  patch -N -p1 -i "${srcdir}/0003-Turn-power-and-standby-LEDs-on-early.patch"        # Orange status LED
44
  patch -N -p1 -i "${srcdir}/0004-mmc-sdhci-allow-disabling-sdma-in-spl.patch"       # RK3399 suspend/resume
45
  patch -N -p1 -i "${srcdir}/0005-arm-dts-Work-around-daughterboard-issues.patch"    # MicroSD issues
46
}
47

  
48
build() {
49
  # Avoid build warnings by editing a .config option in place instead of
50
  # appending an option to .config, if an option is already present
51
  update_config() {
52
    if ! grep -q "^$1=$2$" .config; then
53
      if grep -q "^# $1 is not set$" .config; then
54
        sed -i -e "s/^# $1 is not set$/$1=$2/g" .config
55
      elif grep -q "^$1=" .config; then
56
        sed -i -e "s/^$1=.*/$1=$2/g" .config
57
      else
58
        echo "$1=$2" >> .config
59
      fi
60
    fi
61
  }
62

  
63
  unset CFLAGS CXXFLAGS CPPFLAGS LDFLAGS
64

  
65
  cd trusted-firmware-a-${_tfaver}
66

  
67
  echo -e "\nBuilding TF-A for Pine64 Pinebook Pro...\n"
68
  make PLAT=rk3399
69
  cp build/rk3399/release/bl31/bl31.elf ../u-boot-${pkgver/rc/-rc}/
70

  
71
  cd ../u-boot-${pkgver/rc/-rc}
72

  
73
  echo -e "\nBuilding U-Boot for Pine64 Pinebook Pro...\n"
74
  make pinebook-pro-rk3399_defconfig
75

  
76
  update_config 'CONFIG_IDENT_STRING' '" Parabola"'
77
  update_config 'CONFIG_SPL_MMC_SDHCI_SDMA' 'n'
78

  
79
  make EXTRAVERSION=-${pkgrel}
80
}
81

  
82
package() {
83
  cd u-boot-${pkgver/rc/-rc}
84

  
85
  mkdir -p "${pkgdir}/boot/extlinux"
86
  install -D -m 0644 idbloader.img u-boot.itb -t "${pkgdir}/boot"
87
}
libre/uboot-pinebookpro/uboot-pinebookpro.install
1
notice_uboot() {
2
  echo "New version of U-Boot firmware can be flashed to your microSD card (mmcblk1)"
3
  echo "or eMMC module (mmcblk2).  You can do that by running:"
4
  echo "# dd if=/boot/idbloader.img of=/dev/mmcblkX seek=64 conv=notrunc,fsync"
5
  echo "# dd if=/boot/u-boot.itb of=/dev/mmcblkX seek=16384 conv=notrunc,fsync"
6
}
7

  
8
create_config() {
9
  mkdir -p /boot/extlinux
10
  echo "timeout 1
11
DEFAULT linux-libre-64
12
LABEL Parabola
13
KERNEL /boot/vmlinuz-linux-libre-64
14
FDTDIR /boot/dtbs/linux-libre-64
15
APPEND initrd=/initramfs-linux-libre-64.img console=ttyS2,1500000 root=LABEL=PARABOLA rw rootwait audit=0 splash plymouth.ignore-serial-consoles" \
16
    > /boot/extlinux/extlinux.conf
17
}
18

  
19
post_install() {
20
  notice_uboot
21
  if [ -f /boot/extlinux/extlinux.conf.pacsave ]; then
22
    mv /boot/extlinux/extlinux.conf.pacsave /boot/extlinux/extlinux.conf
23
  fi
24
  if [ -f /boot/extlinux/extlinux.conf ]; then
25
    echo "Keeping old extlinux.conf file..."
26
  else
27
    create_config
28
  fi
29
}
30

  
31
post_upgrade() {
32
  notice_uboot
33
  if [ -f /boot/extlinux/extlinux.conf.pacsave ]; then
34
    mv /boot/extlinux/extlinux.conf.pacsave /boot/extlinux/extlinux.conf
35
  fi
36
  if [ -f /boot/extlinux/extlinux.conf ]; then
37
    echo "Keeping old extlinux.conf file..."
38
  else
39
    create_config
40
  fi
41
}
0
- 
(4-4/5)