uboot spl (lichee zero)

reset:
	b	save_boot_params
    bl	cpu_init_cp15
    bl	cpu_init_crit
    bl	_main
        /*
        * Set up initial C runtime environment and call board_init_f(0).
        */
        #if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_STACK)
            ldr	sp, =(CONFIG_SPL_STACK)
        #else
            ldr	sp, =(CONFIG_SYS_INIT_SP_ADDR)
        #endif
        bl	board_init_f
            spl_init();
            preloader_console_init();
            sunxi_board_init();
                sunxi_dram_init();//初始化DDR
                    struct dram_para para = {
                        .read_delays = 0x00007878,	/* dram_tpr12 */
                        .write_delays = 0x6a440000,	/* dram_tpr11 */
                        .dual_rank = 0,
                        .bus_width = 32,
                        .row_bits = 15,
                        .bank_bits = 3,
                        .page_size = 4096,
                    };
                    mctl_sys_init(&para);
        ldr	pc, =board_init_r	/* this is auto-relocated! */
            memset(&spl_image, '\0', sizeof(spl_image));
            board_boot_order(spl_boot_list);
                spl_boot_list[0] = spl_boot_device();//根据配置获得启动介质
                    	boot_source = readb(SPL_ADDR + 0x28);
                        switch (boot_source) {
                        case SUNXI_BOOTED_FROM_MMC0:
                            return BOOT_DEVICE_MMC1;
                        case SUNXI_BOOTED_FROM_NAND:
                            return BOOT_DEVICE_NAND;
                        case SUNXI_BOOTED_FROM_MMC2:
                            return BOOT_DEVICE_MMC2;
                        case SUNXI_BOOTED_FROM_SPI:
                            return BOOT_DEVICE_SPI;
                        }
            boot_from_devices(&spl_image, spl_boot_list,ARRAY_SIZE(spl_boot_list))
                	for (i = 0; i < count && spl_boot_list[i] != BOOT_DEVICE_NONE; i++) {
		                struct spl_image_loader *loader;

		                loader = spl_ll_find_loader(spl_boot_list[i]);
                        if (loader && !spl_load_image(spl_image, loader))
                        return 0;
	                }
            switch (spl_image.os) {
                case IH_OS_U_BOOT:
                    debug("Jumping to U-Boot\n");
                    break;
                #ifdef CONFIG_SPL_OS_BOOT//直接启动linux内核
                case IH_OS_LINUX:
                    debug("Jumping to Linux\n");
                    spl_board_prepare_for_linux();
                    jump_to_image_linux(&spl_image,(void *)CONFIG_SYS_SPL_ARGS_ADDR);

                #endif
                default:
                    debug("Unsupported OS image.. Jumping nevertheless..\n");
            }
            spl_board_prepare_for_boot();
            jump_to_image_no_args(&spl_image);

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值