The process and transplantation of uboot-lcd of 7862

When booting up, first perform board-level initialization (U-boot/arch/arm/lib/board.c), and now run board_init_f() in flash, divide a part of Mermory to run U-BOOT, and use it outside the designated range Memory cannot be operated during U-boot. At the same time, space is reserved for malloc() arena, U-Boot code, data & bss, VFD display, LCDdisplay, TLB table, PRam, logBuffer, etc.

Next go to board_init_r() in RAM, establish chip selection, initialize serial port, initialize NAND, MMC, flash, and then go to do_cboot (NULL, 0, 1, NULL); // enter the startup function, and then call

  • board_boot_mode_regist(boot_mode_array)
  • Then go to boot_mode_array to select the mode, boot into the normal mode: uis7862s_1h10_normal_mode();
  • vlx_nand_boot
  • drv_lcd_init performs a normal initialization on lcd
  •  lcd_init calls lcd_ctrl_init to complete the initialization of the lcd, on the other hand through lcd_clear() to complete the backcolor and frontcolor of the control output, and decompress the LOGO and put it into the Buffer
  •  lcd_ctrl_init initialize lcd
    • sprdfb_probe provides the entry of LCD specific driver
    • sprd_panel_probe polls the read_id value of each screen in the form of an array, that is, reads the id value in the MIPI screen register, and returns 0 if the read is successful, that is, finds the screen driver, then initializes it, and continues polling if it is not found. Until it finds or finally fails to find a driver that will set a default loading screen.
  • lcd_splash(LOGO_PART) 刷logo
  • set_backlight(backlight_set) bright backlight

uboot porting:

  • First, go to the bsp/bootloader/u-boot/drivers/video/sprd/lcd/ directory to copy a previously transplanted lcd screen driver: lcd_xxx_video.c.
    • Modify the init_data[] initialization command in lcd_xxx_video.c 
    • Modify the lcd driver name panel_driver xxx_mipi_driver
    • Modify the value of proch value and resolution
    • 修改 pixel_clk=(width+hfp +hbp +hsync )*(height +vfp +vbp +vsync )*fps,                      phy_freq= (pixe_lclk * 24 * 1.2)/lane_num
    • Modify the read_id function, if it is the correct read id, it will return 0, indicating that the screen is found
    • Modify the parameter .lcd_name = "lcd_xxx_mipi_fhd", so that the kernel can find the dtsi driver of the screen
  • Add LCD macro, bsp/bootloader/u-boot/include/configs/uis7862s_1h10.h, add #define CONFIG_LCD_xxx_MIPI_FHD
  • bsp/bootloader/u-boot/drivers/video/sprd/lcd/Makefile Add lcd_xxx_video.c compilation rules to Makefile: obj-$(CONFIG_LCD_xxx_MIPI_FHD) += lcd_xxx_video.o
  • bsp/bootloader/u-boot/drivers/video/sprd/lcd/panel_cfg.h, new driver id:
    extern struct panel_driver xxx_mipi_driver;
    
    #ifdef CONFIG_LCD_xxx_MIPI_FHD
        {
            .lcd_id = 0x1111,//这个id通过lcd_id_to_kernel 传给kernel
            .drv = &xxx_mipi_driver,
        }

Kernel porting is relatively simple

  • Copy the previous dtsi screen driver in the arch/arm64/boot/dts/sprd/lcd/ directory

  • Modify the name lcd_xxx_mipi_fhd, modify the proch, resolution, pixel_clk, phy_freq, and initialization commands of uboot to the current dtsi file

  • The dtsi of this driver is like a .h file, and the file name is added to the dtsi file of the changed platform.

After the transplantation is completed, check to see if the screen lights up. If the screen does not light up, check:

  • Check whether the read_id read in the log is correct.

  • Check whether the initialization command init_data is written correctly.

  • Check whether the proch value, phy_freq, and pixel_clk are correct.

Proch value:

  • HFP: Horizontal Back Porch: The pixel clock cycle to be inserted when each row or column of pixel data starts outputting.

  • HBP: Horizontal Leading Edge: The pixel clock between the end of each row or column of pixels and the LCD row clock output pulse.

  • HSYNC: line (horizontal) synchronization pulse width

  • VFP: vertical leading edge: the number of invalid lines before the end of the data output of this frame and the beginning of the next vertical synchronization cycle.

  • VBP: Vertical Back Porch: Number of invalid lines at the beginning of the frame after the vertical sync period.

  • VSYNC: vertical sync pulse width

Guess you like

Origin blog.csdn.net/weixin_42432281/article/details/114537268