关于RK3506 的MCU软复位后跑不起问题

官方SDK在系统不断电软复位时mcu起不来,原因是在配置入口地址前没有去写MCU和总线复位。这里修改一下MCU启动时序。

  1. 先通过 PMU 将 mcu_rst_dis_cfg 置 0(assert PMU 侧复位,系统级复位,高优先级)
  2. 再通过 CRU SOFTRST_CON5 bit10 assert 复位 (CRU逻辑复位,总线复位。)
  3. 配置入口地址(sip_smc_mcu_config
  4. 开时钟
  5. 配置 stcalib
  6. 先释放 CRU 复位(SOFTRST_CON5 bit10=0)
  7. 最后通过 PMU 将 mcu_rst_dis_cfg 置 1(release PMU 侧复位,MCU 开始运行)

下面是uboot(arch/arm/mach-rockchip/rk3506/rk3506.c)改动点:

复制代码
int fit_standalone_release(char *id, uintptr_t entry_point)
{
	/*
	 * MCU reset is controlled by two independent sources that must both
	 * be asserted before reconfiguring the entry address:
	 *
	 * 1. PMU_INT_MASK_CON[2] mcu_rst_dis_cfg (0xFF90000C):
	 *    0 = assert MCU reset, 1 = release MCU reset
	 *    On soft-reboot this bit is still 1 (release), so we must
	 *    explicitly drive it to 0 first.
	 *
	 * 2. CRU SOFTRST_CON5[10] hresetn_m0 (0xFF9A0A14):
	 *    1 = assert reset, 0 = release reset (standard RW with write-mask)
	 *
	 * Sequence: assert both resets → configure entry → enable clocks →
	 *           release CRU reset → release PMU reset (MCU starts here).
	 */

	/* Assert PMU MCU reset (mcu_rst_dis_cfg=0, write-mask bit2=1) */
	writel(0x00040000, PMU_BASE + PMU_INT_MASK_CON);

	/* Assert CRU bus M0 reset (hresetn_m0=1, write-mask bit10=1) */
	writel(0x04000400, CRU_BASE + CRU_SOFTRST_CON5);
	udelay(10);

	/* Configure MCU address map: map 0 to entry_point via ATF */
	sip_smc_mcu_config(ROCKCHIP_SIP_CONFIG_BUSMCU_0_ID,
		ROCKCHIP_SIP_CONFIG_MCU_CODE_START_ADDR,
		entry_point);

	/* Enable bus M0 clocks: swclktck_m0 (bit11=0) and hclk_m0 (bit10=0) */
	writel(0x0c000000, CRU_BASE + CRU_GATE_CON5);
	writel(0xe0000000, CRU_BASE + CRU_GATE_CON6);

	/* Set M0 system time calibration (GRF_SOC_CON36 grf_con_m0_stalib) */
	writel(0xbcd3d80, 0xff288090);

	/* Release CRU bus M0 reset (hresetn_m0=0, write-mask bit10=1) */
	writel(0x04000000, CRU_BASE + CRU_SOFTRST_CON5);
	udelay(10);

	/*
	 * Release PMU MCU reset and unmask MCU global interrupt
	 * (mcu_rst_dis_cfg=1, glb_int_mask_mcu=0, write-mask bits 2:1=1)
	 * MCU begins execution from entry_point after this write.
	 */
	writel(0x00060004, PMU_BASE + PMU_INT_MASK_CON);

	return 0;
}
相关推荐
2401_869769591 小时前
linux 权限 指令与权限(重启之后)
linux
码农客栈1 小时前
Linux CAN 驱动
linux·驱动开发
小李不想当小白1 小时前
DMA直接存储器存取(STM32标准库学习笔记)
笔记·stm32·单片机·嵌入式硬件·学习·分享
朝发如雪2 小时前
快速掌握单片机基础(6)(数据处理与传送指令)(跳转与分支指令)(栈操作与混合编程)(程序状态寄存器操作指令)(内存映射)
单片机·arm
blue_ice .2 小时前
Verilog DDS 数字信号发生器:DAC 输出模拟波形与 ADC 回采观测
开发语言·单片机·嵌入式硬件·fpga开发
深圳市恒锐丰科技杨生2 小时前
EG4318 / EG4319 / EG4320 铅酸电池三段式充电副边管理芯片|屹晶 EGmicro
嵌入式硬件·硬件工程
深圳市恒锐丰科技杨生2 小时前
EG1253 电流模式 PWM 控制器|屹晶 EGmicro
嵌入式硬件·硬件工程
远翔调光芯片^138287988722 小时前
ECP5702能芯科技PD取电芯片在市场上的优势有哪些?
开发语言·人工智能·单片机·嵌入式硬件·智能家居
GeW2 小时前
红帽RHCE从挂科边缘到一次过,我做对了什么
linux
时空自由民.3 小时前
WSL解决USB 串口连接问题与linux串口权限问题
linux·单片机