Skip to content

Commit

Permalink
Enable video backend engine
Browse files Browse the repository at this point in the history
  • Loading branch information
tiopex committed Dec 27, 2023
1 parent 51d98a3 commit 69e9adb
Show file tree
Hide file tree
Showing 11 changed files with 75 additions and 55 deletions.
9 changes: 9 additions & 0 deletions arch/arm/cpu/arm926ejs/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@
#include <command.h>
#include <cpu_func.h>
#include <irq_func.h>
#include <linux/delay.h>
#include <asm/cache.h>
#include <asm/system.h>
#include <asm/arch/lcdc.h>
#include <asm/io.h>

static void cache_flush(void);

Expand All @@ -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;
}

Expand Down
29 changes: 29 additions & 0 deletions arch/arm/dts/suniv-f1c100s.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
10 changes: 8 additions & 2 deletions arch/arm/lib/bootm.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,14 @@ static void announce_and_cleanup(int fake)
#endif

board_quiesce_devices();

printf("\nStarting kernel ...%s\n\n", fake ?
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_variant) {
printf("Console video: %s", console_video);
}
printf("\nStarting kernel ...%s", fake ?
"(fake run for tracing)" : "");
/*
* Call remove function of all devices with a removal flag set.
Expand Down
6 changes: 2 additions & 4 deletions common/splash.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 11 additions & 2 deletions configs/miyoo_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
5 changes: 3 additions & 2 deletions drivers/video/sunxi/lcdc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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;
Expand Down
46 changes: 3 additions & 43 deletions drivers/video/sunxi/sunxi_display.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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;
}

Expand Down
6 changes: 5 additions & 1 deletion include/configs/suniv.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,14 @@
#define CONFIG_SYS_DFU_DATA_BUF_SIZE (512*1024)

#ifdef CONFIG_VIDEO
#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 */
4 changes: 4 additions & 0 deletions include/env_default.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ const uchar default_environment[] = {
#ifdef CONFIG_SYS_SOC
"soc=" CONFIG_SYS_SOC "\0"
#endif
"splashfile=" "miyoo-splash.bmp" "\0"
"splashsource=" "mmc_fs" "\0"
"splashimage=" "0x80000000" "\0"
"silent=" "1" "\0"
#endif
#if defined(CONFIG_BOOTCOUNT_BOOTLIMIT) && (CONFIG_BOOTCOUNT_BOOTLIMIT > 0)
"bootlimit=" __stringify(CONFIG_BOOTCOUNT_BOOTLIMIT)"\0"
Expand Down
2 changes: 1 addition & 1 deletion tools/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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),)
Expand Down
Binary file added tools/logos/miyoo.bmp
Binary file not shown.

0 comments on commit 69e9adb

Please sign in to comment.