Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable video backend engine #28

Merged
merged 1 commit into from
Dec 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
12 changes: 10 additions & 2 deletions arch/arm/lib/bootm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
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"
Apaczer marked this conversation as resolved.
Show resolved Hide resolved
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_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 */
6 changes: 6 additions & 0 deletions include/env_default.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
tiopex marked this conversation as resolved.
Show resolved Hide resolved
"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"
Expand Down
1 change: 1 addition & 0 deletions scripts/config_whitelist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
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.