[PATCH 0/1] rk3399 pinebook-pro enable display
This enables display for pinebook-pro Jesper Schmitz Mouridsen (1): rk3399: pinebook-pro enable display arch/arm/dts/rk3399-pinebook-pro-u-boot.dtsi | 4 arch/arm/dts/rk3399.dtsi | 4 ++-- drivers/video/rockchip/rk_edp.c | 24 ++-- 3 files changed, 28 insertions(+), 4 deletions(-) -- 2.30.0
[PATCH 1/1] rk3399: pinebook-pro enable display
Signed-off-by: Jesper Schmitz Mouridsen --- arch/arm/dts/rk3399-pinebook-pro-u-boot.dtsi | 4 arch/arm/dts/rk3399.dtsi | 4 ++-- drivers/video/rockchip/rk_edp.c | 24 ++-- 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/arch/arm/dts/rk3399-pinebook-pro-u-boot.dtsi b/arch/arm/dts/rk3399-pinebook-pro-u-boot.dtsi index 1eafb40ce3..2d87bea933 100644 --- a/arch/arm/dts/rk3399-pinebook-pro-u-boot.dtsi +++ b/arch/arm/dts/rk3399-pinebook-pro-u-boot.dtsi @@ -16,6 +16,10 @@ }; }; + { + rockchip,panel = <_panel>; +}; + { u-boot,dm-pre-reloc; }; diff --git a/arch/arm/dts/rk3399.dtsi b/arch/arm/dts/rk3399.dtsi index 74f2c3d490..fad6cea8f9 100644 --- a/arch/arm/dts/rk3399.dtsi +++ b/arch/arm/dts/rk3399.dtsi @@ -1606,12 +1606,12 @@ vopl_out_mipi: endpoint@0 { reg = <0>; - remote-endpoint = <_in_vopl>; + remote-endpoint = <_in_vopl>; }; vopl_out_edp: endpoint@1 { reg = <1>; - remote-endpoint = <_in_vopl>; + remote-endpoint = <_in_vopl>; }; vopl_out_hdmi: endpoint@2 { diff --git a/drivers/video/rockchip/rk_edp.c b/drivers/video/rockchip/rk_edp.c index 0be60e169e..424093fa01 100644 --- a/drivers/video/rockchip/rk_edp.c +++ b/drivers/video/rockchip/rk_edp.c @@ -18,9 +18,15 @@ #include #include #include +#if defined(CONFIG_ROCKCHIP_RK3288) #include -#include #include +#endif +#if defined(CONFIG_ROCKCHIP_RK3399) +#include +#include +#endif +#include #include #define MAX_CR_LOOP 5 @@ -39,7 +45,12 @@ static const char * const pre_emph_names[] = { struct rk_edp_priv { struct rk3288_edp *regs; +#if defined(CONFIG_ROCKCHIP_RK3288) struct rk3288_grf *grf; +#endif +#if defined(CONFIG_ROCKCHIP_RK3399) + struct rk3399_grf_regs *grf; +#endif struct udevice *panel; struct link_train link_train; u8 train_set[4]; @@ -1043,6 +1054,7 @@ 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); +#if defined(CONFIG_ROCKCHIP_RK3288) ret = clk_get_by_index(dev, 1, ); if (ret >= 0) { ret = clk_set_rate(, 0); @@ -1052,6 +1064,7 @@ static int rk_edp_probe(struct udevice *dev) debug("%s: Failed to set EDP clock: ret=%d\n", __func__, ret); return ret; } +#endif ret = clk_get_by_index(uc_plat->src_dev, 0, ); if (ret >= 0) { @@ -1063,14 +1076,20 @@ static int rk_edp_probe(struct udevice *dev) __func__, uc_plat->src_dev->name, ret); return ret; } - +#if defined(CONFIG_ROCKCHIP_RK3288) /* grf_edp_ref_clk_sel: from internal 24MHz or 27MHz clock */ rk_setreg(>grf->soc_con12, 1 << 4); /* select epd signal from vop0 or vop1 */ rk_clrsetreg(>grf->soc_con6, (1 << 5), (vop_id == 1) ? (1 << 5) : (0 << 5)); +#endif +#if defined(CONFIG_ROCKCHIP_RK3399) + /* select epd signal from vop0 or vop1 */ + rk_clrsetreg(>grf->soc_con20, (1 << 5), + (vop_id == 1) ? (1 << 5) : (0 << 5)); +#endif rockchip_edp_wait_hpd(priv); rk_edp_init_refclk(regs); @@ -1091,6 +1110,7 @@ static const struct dm_display_ops dp_rockchip_ops = { static const struct udevice_id rockchip_dp_ids[] = { { .compatible = "rockchip,rk3288-edp" }, + { .compatible = "rockchip,rk3399-edp" }, { } }; -- 2.30.0
Re: [PATCH 5/8] image: Adjust the workings of fit_check_format()
On 17.02.2021 14.43, Tom Rini wrote: On Wed, Feb 17, 2021 at 02:30:56PM +0100, Jesper Schmitz Mouridsen wrote: Hi Can you avoid the use of ENODATA since it is not defined in FreeBSD's errno.h? I like that FreeBSD has EDOOFUS, but I don't see an obvious replacement for ENODATA, can you suggest something please? Thanks! Perhaps EBADMSG?
Re: [PATCH 5/8] image: Adjust the workings of fit_check_format()
Hi Can you avoid the use of ENODATA since it is not defined in FreeBSD's errno.h? Regards Jesper Schmitz Mouridsen On 16.02.2021 01.08, Simon Glass wrote: At present this function does not accept a size for the FIT. This means that it must be read from the FIT itself, introducing potential security risk. Update the function to include a size parameter, which can be invalid, in which case fit_check_format() calculates it. For now no callers pass the size, but this can be updated later. Also adjust the return value to an error code so that all the different types of problems can be distinguished by the user. Signed-off-by: Simon Glass Reported-by: Bruce Monroe Reported-by: Arie Haenel Reported-by: Julien Lenoir --- arch/arm/cpu/armv8/sec_firmware.c | 2 +- cmd/bootefi.c | 2 +- cmd/bootm.c| 6 ++-- cmd/disk.c | 2 +- cmd/fpga.c | 2 +- cmd/nand.c | 2 +- cmd/source.c | 2 +- cmd/ximg.c | 2 +- common/image-fdt.c | 2 +- common/image-fit.c | 46 +- common/splash_source.c | 6 ++-- common/update.c| 4 +-- drivers/fpga/socfpga_arria10.c | 6 ++-- drivers/net/fsl-mc/mc.c| 2 +- drivers/net/pfe_eth/pfe_firmware.c | 2 +- include/image.h| 21 +- tools/fit_common.c | 3 +- tools/fit_image.c | 2 +- tools/mkimage.h| 2 ++ 19 files changed, 66 insertions(+), 50 deletions(-) diff --git a/arch/arm/cpu/armv8/sec_firmware.c b/arch/arm/cpu/armv8/sec_firmware.c index c6c4fcc7e07..267894fbcb3 100644 --- a/arch/arm/cpu/armv8/sec_firmware.c +++ b/arch/arm/cpu/armv8/sec_firmware.c @@ -317,7 +317,7 @@ __weak bool sec_firmware_is_valid(const void *sec_firmware_img) return false; } - if (!fit_check_format(sec_firmware_img)) { + if (fit_check_format(sec_firmware_img, IMAGE_SIZE_INVAL)) { printf("SEC Firmware: Bad firmware image (bad FIT header)\n"); return false; } diff --git a/cmd/bootefi.c b/cmd/bootefi.c index 1583a96be14..271b385edea 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -73,7 +73,7 @@ void efi_set_bootdev(const char *dev, const char *devnr, const char *path, /* Remember only PE-COFF and FIT images */ if (efi_check_pe(buffer, buffer_size, NULL) != EFI_SUCCESS) { #ifdef CONFIG_FIT - if (!fit_check_format(buffer)) + if (fit_check_format(buffer, IMAGE_SIZE_INVAL)) return; /* * FIT images of type EFI_OS are started via command bootm. diff --git a/cmd/bootm.c b/cmd/bootm.c index 7732b97f635..81c6b939781 100644 --- a/cmd/bootm.c +++ b/cmd/bootm.c @@ -292,7 +292,7 @@ static int image_info(ulong addr) case IMAGE_FORMAT_FIT: puts(" FIT image found\n"); - if (!fit_check_format(hdr)) { + if (fit_check_format(hdr, IMAGE_SIZE_INVAL)) { puts("Bad FIT image format!\n"); unmap_sysmem(hdr); return 1; @@ -369,7 +369,7 @@ static int do_imls_nor(void) #endif #if defined(CONFIG_FIT) case IMAGE_FORMAT_FIT: - if (!fit_check_format(hdr)) + if (fit_check_format(hdr, IMAGE_SIZE_INVAL)) goto next_sector; printf("FIT Image at %08lX:\n", (ulong)hdr); @@ -449,7 +449,7 @@ static int nand_imls_fitimage(struct mtd_info *mtd, int nand_dev, loff_t off, return ret; } - if (!fit_check_format(imgdata)) { + if (fit_check_format(imgdata, IMAGE_SIZE_INVAL)) { free(imgdata); return 0; } diff --git a/cmd/disk.c b/cmd/disk.c index 0bc3808dfe2..2726115e855 100644 --- a/cmd/disk.c +++ b/cmd/disk.c @@ -114,7 +114,7 @@ int common_diskboot(struct cmd_tbl *cmdtp, const char *intf, int argc, /* This cannot be done earlier, * we need complete FIT image in RAM first */ if (genimg_get_format((void *) addr) == IMAGE_FORMAT_FIT) { - if (!fit_check_format(fit_hdr)) { + if (fit_check_format(fit_hdr, IMAGE_SIZE_INVAL)) { bootstage_error(BOOTSTAGE_ID_IDE_FIT_READ); puts("** Bad FIT image format\n"); return 1; diff --git a/cmd/fpga.c b/cmd/fpga.c index 8ae1c936fbb..51410a8e424 100644 --- a/cmd/fpga.c +++ b/cmd/fpga.c @@ -330,7 +330,7 @@ static int do_fpga_loadmk(struct cmd_tbl *cmdtp, int flag, int argc, return CMD_RET_FAILURE; } - if (!fit_check_format
[PATCH 1/1] Allow last block to be read
The last block is of size media->block_size --- lib/efi_loader/efi_disk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c index 1f6b817dea..f77f465d20 100644 --- a/lib/efi_loader/efi_disk.c +++ b/lib/efi_loader/efi_disk.c @@ -148,7 +148,7 @@ static efi_status_t EFIAPI efi_disk_read_blocks(struct efi_block_io *this, (uintptr_t)buffer & (this->media->io_align - 1)) return EFI_INVALID_PARAMETER; if (lba * this->media->block_size + buffer_size > - this->media->last_block * this->media->block_size) + this->media->last_block * this->media->block_size + this->media->block_size) return EFI_INVALID_PARAMETER; #ifdef CONFIG_EFI_LOADER_BOUNCE_BUFFER -- 2.30.0
[PATCH 0/1] Allow last block to be read
The last block could not be read by FreeBSD loader.efi (the gpt backup block) Jesper Schmitz Mouridsen (1): Allow last block to be read lib/efi_loader/efi_disk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.30.0
Wrong check for last block in lib/efi_loader/efi_disk.c?
Hi I was not able to read the last block of my sd card (the gpt backup block) without the following diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c index d0aad0252a..ea9d763072 100644 --- a/lib/efi_loader/efi_disk.c +++ b/lib/efi_loader/efi_disk.c @@ -147,7 +147,7 @@ static efi_status_t EFIAPI efi_disk_read_blocks(struct efi_block_io *this, (uintptr_t)buffer & (this->media->io_align - 1)) return EFI_INVALID_PARAMETER; if (lba * this->media->block_size + buffer_size > - this->media->last_block * this->media->block_size) + this->media->last_block * this->media->block_size + this->media->block_size) return EFI_INVALID_PARAMETER; Is my math wrong or is my patch correct? With the patch the my efiloader can read the gpt backup block correctly, Thanks /Jesper
0a2aaab0b678fd1778ff2fc59d0770fc82995532 breaks Pinebook Pro.
Hi list First post here. In my work to enable the display for pinebook-pro (for FreeBSD) I found that, by some bisecting and manual bisecting, 0a2aaab0b678fd1778ff2fc59d0770fc82995532, is a problem.. Check here for links to my patches https://github.com/jsm222/u-boot-pinebookpro/blob/main/README.md changing line https://gitlab.denx.de/u-boot/u-boot/-/commit/0a2aaab0b678fd1778ff2fc59d0770fc82995532#6711fbfbb165bce72c77b56e1778656b691578c5_1257_1256 to if (IS_ENABLED(CONFIG_SPL_SEPARATE_BSS)) is a fix for me. I'm new to u-boot so was 0a2aaab0b678fd1778ff2fc59d0770fc82995532 wrong or is a config wrong? Thanks. /Jesper Schmitz Mouridsen