From e4e104dec0ddd756946c77d6c9fefbe6172fe346 Mon Sep 17 00:00:00 2001 From: tiopex Date: Wed, 27 Dec 2023 12:14:10 +0100 Subject: [PATCH] Enable video backend engine --- arch/arm/cpu/arm926ejs/cpu.c | 9 ++++++ arch/arm/dts/suniv-f1c100s.dtsi | 29 ++++++++++++++++++ arch/arm/lib/bootm.c | 12 ++++++-- common/splash.c | 6 ++-- configs/miyoo_defconfig | 13 ++++++-- drivers/video/sunxi/lcdc.c | 5 +-- drivers/video/sunxi/sunxi_display.c | 46 ++-------------------------- include/configs/suniv.h | 6 +++- include/env_default.h | 6 ++++ scripts/config_whitelist.txt | 1 + tools/Makefile | 2 +- tools/logos/miyoo.bmp | Bin 0 -> 20278 bytes 12 files changed, 80 insertions(+), 55 deletions(-) create mode 100644 tools/logos/miyoo.bmp diff --git a/arch/arm/cpu/arm926ejs/cpu.c b/arch/arm/cpu/arm926ejs/cpu.c index 93d7a02ed..4df2794aa 100755 --- a/arch/arm/cpu/arm926ejs/cpu.c +++ b/arch/arm/cpu/arm926ejs/cpu.c @@ -16,8 +16,11 @@ #include #include #include +#include #include #include +#include +#include static void cache_flush(void); @@ -41,6 +44,12 @@ int cleanup_before_linux (void) /* flush I/D-cache */ cache_flush(); + /* turn off video backend */ + mdelay(50); + struct sunxi_lcdc_reg * const lcdc = + (struct sunxi_lcdc_reg *)SUNXI_LCD0_BASE; + writel(0, &lcdc->tcon0_cpu_intf); + return 0; } diff --git a/arch/arm/dts/suniv-f1c100s.dtsi b/arch/arm/dts/suniv-f1c100s.dtsi index 8091191d6..22139e388 100755 --- a/arch/arm/dts/suniv-f1c100s.dtsi +++ b/arch/arm/dts/suniv-f1c100s.dtsi @@ -107,6 +107,35 @@ interrupt-controller; #interrupt-cells = <3>; #gpio-cells = <3>; + pa: pa { + gpio-controller; + #gpio-cells = <2>; + }; + + pb: pb { + gpio-controller; + #gpio-cells = <2>; + }; + + pc: pc { + gpio-controller; + #gpio-cells = <2>; + }; + + pd: pd { + gpio-controller; + #gpio-cells = <2>; + }; + + pe: pe { + gpio-controller; + #gpio-cells = <2>; + }; + + pf: pf { + gpio-controller; + #gpio-cells = <2>; + }; spi0_pins_a: spi0-pins-pc { pins = "PC0", "PC1", "PC2", "PC3"; diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c index 2df98d3e0..bdcb97863 100755 --- a/arch/arm/lib/bootm.c +++ b/arch/arm/lib/bootm.c @@ -111,8 +111,16 @@ static void announce_and_cleanup(int fake) #endif board_quiesce_devices(); - - printf("\nStarting kernel ...%s\n\n", fake ? +#ifdef CONFIG_MIYOO + char *console_variant = env_get("CONSOLE_VARIANT"); + if (console_variant) + printf("Console variant: %s\n", console_variant); + char *console_video = env_get("CONSOLE_VIDEO"); + if (console_video) { + printf("Console video: %s", console_video); + } +#endif + printf("\nStarting kernel ...%s", fake ? "(fake run for tracing)" : ""); /* * Call remove function of all devices with a removal flag set. diff --git a/common/splash.c b/common/splash.c index 2b9313e03..65cd46778 100755 --- a/common/splash.c +++ b/common/splash.c @@ -82,11 +82,9 @@ 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_source_load(default_splash_locations, + ARRAY_SIZE(default_splash_locations)); - return splash_video_logo_load(); } #ifdef CONFIG_SPLASH_SCREEN_ALIGN diff --git a/configs/miyoo_defconfig b/configs/miyoo_defconfig index c90e94f74..8f2f5a419 100644 --- a/configs/miyoo_defconfig +++ b/configs/miyoo_defconfig @@ -2,22 +2,29 @@ CONFIG_ARM=y CONFIG_ARCH_SUNXI=y CONFIG_SYS_TEXT_BASE=0x81700000 CONFIG_SPL=y +CONFIG_IDENT_STRING=" Miyoo CFW 2.0" CONFIG_MACH_SUNIV=y CONFIG_DRAM_CLK=174 CONFIG_DRAM_ZQ=0 CONFIG_MMC_SUNXI_SLOT_EXTRA=1 -CONFIG_VIDEO_LCD_MODE="x:480,y:272,depth:18,pclk_khz:9000,le:39,ri:8,up:2,lo:4,hs:4,vs:10,sync:3,vmode:0" +CONFIG_VIDEO_LCD_MODE="x:320,y:240,depth:18,pclk_khz:9000,le:39,ri:8,up:2,lo:4,hs:4,vs:10,sync:3,vmode:0" CONFIG_SPL_SPI_SUNXI=y CONFIG_BOOTDELAY=0 CONFIG_USE_BOOTARGS=y CONFIG_BOOTARGS="console=tty0 console=ttyS1,115200 panic=5 rootwait quiet lpj=1015808 root=/dev/mmcblk0p2 ro" -CONFIG_BOOTCOMMAND="setenv lcd_bl_pin 134; run distro_bootcmd;" +CONFIG_BOOTCOMMAND="env export -t 0x81000000; fatwrite mmc 0:1 0x81000000 uEnv.txt ${filesize}; run distro_bootcmd;" +CONFIG_DISABLE_CONSOLE=y +CONFIG_SILENT_CONSOLE=y +# CONFIG_DISPLAY_CPUINFO is not set +# CONFIG_DISPLAY_BOARDINFO is not set CONFIG_CMD_DFU=y CONFIG_CMD_MTD=y CONFIG_CMD_USB_MASS_STORAGE=y +CONFIG_CMD_BMP=y CONFIG_CMD_MTDPARTS=y CONFIG_DEFAULT_DEVICE_TREE="suniv-f1c100s-generic" # CONFIG_ENV_IS_IN_FAT is not set +CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y # CONFIG_NET is not set CONFIG_DFU_TIMEOUT=y CONFIG_DFU_MMC=y @@ -36,3 +43,5 @@ CONFIG_DM_SPI=y CONFIG_USB_MUSB_GADGET=y CONFIG_USB_GADGET_VBUS_DRAW=250 CONFIG_USB_GADGET_DOWNLOAD=y +# CONFIG_VIDEO_SW_CURSOR is not set +# CONFIG_VIDEO_DT_SIMPLEFB is not set diff --git a/drivers/video/sunxi/lcdc.c b/drivers/video/sunxi/lcdc.c index 73033c3b8..1d273b843 100755 --- a/drivers/video/sunxi/lcdc.c +++ b/drivers/video/sunxi/lcdc.c @@ -46,6 +46,7 @@ void lcdc_init(struct sunxi_lcdc_reg * const lcdc) void lcdc_enable(struct sunxi_lcdc_reg * const lcdc, int depth) { setbits_le32(&lcdc->ctrl, SUNXI_LCDC_CTRL_TCON_ENABLE); + setbits_le32(&lcdc->tcon0_cpu_intf, (1 << 28)); #ifdef CONFIG_VIDEO_LCD_IF_LVDS setbits_le32(&lcdc->tcon0_lvds_intf, SUNXI_LCDC_TCON0_LVDS_INTF_ENABLE); setbits_le32(&lcdc->lvds_ana0, SUNXI_LCDC_LVDS_ANA0); @@ -84,7 +85,7 @@ void lcdc_tcon0_mode_set(struct sunxi_lcdc_reg * const lcdc, clk_delay = lcdc_get_clk_delay(mode, 0); writel(SUNXI_LCDC_TCON0_CTRL_ENABLE | - SUNXI_LCDC_TCON0_CTRL_CLK_DELAY(clk_delay), &lcdc->tcon0_ctrl); + SUNXI_LCDC_TCON0_CTRL_CLK_DELAY(clk_delay) | (1 << 24), &lcdc->tcon0_ctrl); writel(SUNXI_LCDC_TCON0_DCLK_ENABLE | SUNXI_LCDC_TCON0_DCLK_DIV(clk_div), &lcdc->tcon0_dclk); @@ -107,7 +108,7 @@ void lcdc_tcon0_mode_set(struct sunxi_lcdc_reg * const lcdc, SUNXI_LCDC_Y(mode->vsync_len.typ), &lcdc->tcon0_timing_sync); writel(0, &lcdc->tcon0_hv_intf); - writel(0, &lcdc->tcon0_cpu_intf); + writel((4 << 29) | (1 << 26), &lcdc->tcon0_cpu_intf); #endif #ifdef CONFIG_VIDEO_LCD_IF_LVDS val = (depth == 18) ? 1 : 0; diff --git a/drivers/video/sunxi/sunxi_display.c b/drivers/video/sunxi/sunxi_display.c index 1b10eb445..285cb89f6 100755 --- a/drivers/video/sunxi/sunxi_display.c +++ b/drivers/video/sunxi/sunxi_display.c @@ -464,9 +464,6 @@ static void lcd_init(void) //Read device panel version miyoo_ver = readID(); - // write detected panel to SD to uEnv.txt file - run_command("env export -t 0x81000000", 0); - run_command("fatwrite mmc 0:1 0x81000000 uEnv.txt ${filesize}", 0); switch (miyoo_ver) { case 1: @@ -1744,6 +1741,7 @@ static void sunxi_lcdc_panel_enable(void) if (reset_pin >= 0) gpio_direction_output(reset_pin, 1); /* De-assert reset */ + sunxi_gpio_set_cfgpin(SUNXI_GPE(6), SUNXI_GPIO_OUTPUT); } static void sunxi_lcdc_backlight_enable(void) @@ -2128,6 +2126,8 @@ static void sunxi_mode_set(const struct ctfb_res_modes *mode, i2c_reg_write(0x5c, 0x04, 0x42); /* Turn on the LCD */ i2c_set_bus_num(orig_i2c_bus); } + sunxi_lcdc_gpio_config(); + lcd_init(); sunxi_composer_mode_set(mode, address); sunxi_lcdc_tcon0_mode_set(mode, false); sunxi_composer_enable(); @@ -2500,46 +2500,6 @@ void *video_hw_init(void) graphic_device->winSizeX = mode->xres - 2 * overscan_x; graphic_device->winSizeY = mode->yres - 2 * overscan_y; graphic_device->plnSizeX = mode->xres * graphic_device->gdfBytesPP; - - sunxi_lcdc_gpio_config(); - lcd_init(); - - uint16_t bug=3; - bmp_logo = run_command("load mmc 0:1 0x80000000 miyoo-boot.bmp", 0); - if (bmp_logo == 0) { - load_bmp_logo(); - } - - while (bug--) { - uint16_t x, y; - if (bmp_logo == 0) - cnt = image_size; - else - cnt = 0; - if (miyoo_ver != 3) - lcd_wr_cmd(writeScreenReg); - for (y=0; y<240; y++) { - for (x=0; x<320; x++) { - if (bmp_logo == 0) { - cnt--; - lcd_wr_dat(p[cnt - 2 * (cnt % width) + width + data_offset - 1]); - if (cnt == 0) - cnt = image_size; - } else { - lcd_wr_dat(p[cnt++]); - } - } - } - } - console_variant = env_get("DETECTED_VERSION"); - if (console_variant && miyoo_ver <= 4) { // panel ver 5 and 6 have different row/col registers - lcd_set_font(&t_8x12_full); - lcd_print("Detected device: "); - lcd_print(console_variant); - } - - if (miyoo_ver != 3) - lcd_wr_cmd(writeScreenReg); return graphic_device; } diff --git a/include/configs/suniv.h b/include/configs/suniv.h index e7cbaf9ed..d77f7f8f3 100755 --- a/include/configs/suniv.h +++ b/include/configs/suniv.h @@ -15,10 +15,14 @@ #define CONFIG_SYS_DFU_DATA_BUF_SIZE (512*1024) #ifdef CONFIG_VIDEO +#define CONFIG_MIYOO +#define CONFIG_VIDEO_LOGO #define CONFIG_BMP_16BPP #define CONFIG_BMP_24BPP #define CONFIG_BMP_32BPP -#undef CONFIG_VIDEO_LOGO +#define CONFIG_VIDEO_BMP_LOGO +#define CONFIG_SPLASH_SCREEN +#define CONFIG_SPLASH_SOURCE #endif #endif /* __CONFIG_H */ diff --git a/include/env_default.h b/include/env_default.h index a657927e0..93b64fc33 100755 --- a/include/env_default.h +++ b/include/env_default.h @@ -104,6 +104,12 @@ const uchar default_environment[] = { #ifdef CONFIG_SYS_SOC "soc=" CONFIG_SYS_SOC "\0" #endif +#ifdef CONFIG_MIYOO + "splashfile=" "miyoo-splash.bmp" "\0" + "splashsource=" "mmc_fs" "\0" + "splashimage=" "0x80000000" "\0" + "silent=" "1" "\0" +#endif #endif #if defined(CONFIG_BOOTCOUNT_BOOTLIMIT) && (CONFIG_BOOTCOUNT_BOOTLIMIT > 0) "bootlimit=" __stringify(CONFIG_BOOTCOUNT_BOOTLIMIT)"\0" diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt index 916768f36..dfb2ff905 100755 --- a/scripts/config_whitelist.txt +++ b/scripts/config_whitelist.txt @@ -1083,6 +1083,7 @@ CONFIG_MIU_1BIT_INTERLEAVED CONFIG_MIU_2BIT_21_7_INTERLEAVED CONFIG_MIU_2BIT_INTERLEAVED CONFIG_MIU_LINEAR +CONFIG_MIYOO CONFIG_MK_edb9301 CONFIG_MK_edb9315a CONFIG_MMCBOOTCOMMAND diff --git a/tools/Makefile b/tools/Makefile index 879c3fd4a..85e5e5dbb 100755 --- a/tools/Makefile +++ b/tools/Makefile @@ -246,7 +246,7 @@ LOGO-$(CONFIG_VIDEO_LOGO) += $(LOGO_DATA_H) # Generic logo ifeq ($(LOGO_BMP),) -LOGO_BMP= $(srctree)/$(src)/logos/denx.bmp +LOGO_BMP= $(srctree)/$(src)/logos/miyoo.bmp # Use board logo and fallback to vendor ifneq ($(wildcard $(srctree)/$(src)/logos/$(BOARD).bmp),) diff --git a/tools/logos/miyoo.bmp b/tools/logos/miyoo.bmp new file mode 100644 index 0000000000000000000000000000000000000000..7b9312fc4573d14d88337bd8fbd773a36753a5c9 GIT binary patch literal 20278 zcmeHOO>7j&6@GTGVb`7^81Re@He=SXV3xMQGyWT6kL{Ksltej@8#i(#mvD&`p{#_o zi4qbeK{-TRB5~vvZV|U|3RiLow{Yah9p(GJ*HzPF_ONl!n3dASR`;vd)vsQC@2`5S z-TmRpk4$alh}k7je?|W}`j8#N747?G|EPKglMk}?iB&2U(39x1cIxz`ot>EheIA{X zme4nBetzB-78dO4(lxu*Y+1YA2LF5LKS2L6`cKe*ivBb7Us!v4$2L2=*4az#=FOXS z>((v1efzfExpT+v-o0!0?%lKd_wQrw1N4XJe?otZ{sjGR=zmB5C;Gq8|Be11^tb5m z(BIoHzxs_mc<{i!#Qn=(|JEKpd}v?&{*U&nKRmME{rNBU=+Ps4{P?jwdGf@bK7DG> zo;|bY&!5|i7ccDP%a``*)hm1b`nA1z^Tyu3eQWRDy|ef4-$QoUN(4#-N(4#-N(4#- zN(4#-N(4#-N(4#-N(4#-N(8!J;xwRd$)NBpot?8}yakHaen0+>B$G5iA^LE$A=ow04RWvZB3 zI~`4_U+}*L*mo|mOW#dST(CfguiN&}o}F3UwmtktxPMKFMK+A z$`&r3fI%k`gPKF1+Z?pMI)BoxOkO@54a-$Z1O|)%a!7BBKgvf!&wEE=%`C64&LWs| zt=d>yTRxLx6ed%&T}YWGLCGBwXF=Q`fz0A3_US z3%paM>`f5MB#`aw9EqsWh(@DP`i{oBbTa1gE-Rgm6AKbj2Sy%~a0oj?;syv`E{fN4 z;;QD#i|6=*n~nT7l}#*qlRDV#sKiEsV#PtR^(MfGtJ+?VGOOgtL%M9ASNJNu@b@RT zAOGN_B`8*A5>L!&x-kRzEX+(zpVwpFq^VF?9L2p88%wr}V~%#v0h{qy3SPF)fT7*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