diff --git a/include/plat/imx8x/sci/svc/timer/sci_timer_api.h b/include/plat/imx8x/sci/svc/timer/sci_timer_api.h index ac28d3d1..522dd489 100755 --- a/include/plat/imx8x/sci/svc/timer/sci_timer_api.h +++ b/include/plat/imx8x/sci/svc/timer/sci_timer_api.h @@ -78,6 +78,8 @@ typedef uint32_t sc_timer_wdog_time_t; */ sc_err_t sc_timer_set_wdog_timeout(sc_ipc_t ipc, sc_timer_wdog_time_t timeout); +sc_err_t sc_timer_set_wdog_window(sc_ipc_t ipc, sc_timer_wdog_time_t window); + /*! * This function sets the watchdog pre-timeout in milliseconds. If not * set then the pre-timeout defaults to the max. Once locked this value diff --git a/src/cm/cm_main.c b/src/cm/cm_main.c index 5585d240..37710fd5 100644 --- a/src/cm/cm_main.c +++ b/src/cm/cm_main.c @@ -578,7 +578,15 @@ static int cmd_boot_bpak(void) boot_set_source(BOOT_SOURCE_CB); boot_configure_load_cb(bpak_boot_read_f, bpak_boot_result_f); - return boot(bpak_boot_cmd->uuid); + rc = boot_load(bpak_boot_cmd->uuid); + if (rc != PB_OK) + return rc; + + if (cfg->tops.disconnect) { + cfg->tops.disconnect(); + } + + return boot_jump(); } static int cmd_slc_read(void) @@ -756,6 +764,10 @@ static int pb_command_parse(void) pb_wire_init_result(&result, error_to_wire(rc)); cm_write(&result, sizeof(result)); + if (cfg->tops.disconnect) { + cfg->tops.disconnect(); + } + if (rc == PB_OK) { rc = boot_jump(); /* Should not return */ diff --git a/src/drivers/mmc/imx_usdhc.c b/src/drivers/mmc/imx_usdhc.c index 16d1b3b2..3790f83b 100644 --- a/src/drivers/mmc/imx_usdhc.c +++ b/src/drivers/mmc/imx_usdhc.c @@ -27,7 +27,6 @@ static int imx_usdhc_set_bus_clock(unsigned int clk_hz) { int div = 1; int pre_div = 1; - unsigned int actual_clk_hz; LOG_DBG("Trying to set bus clock to %u kHz", clk_hz / 1000); @@ -43,7 +42,6 @@ static int imx_usdhc_set_bus_clock(unsigned int clk_hz) while (input_clock_hz / div > clk_hz && div < 16) div++; - actual_clk_hz = input_clock_hz / (pre_div * div); pre_div >>= 1; div -= 1; uint16_t clk_reg = (pre_div << 8) | (div << 4); @@ -60,7 +58,7 @@ static int imx_usdhc_set_bus_clock(unsigned int clk_hz) mmio_setbits_32(usdhc->base + USDHC_VEND_SPEC, VENDSPEC_PER_CLKEN | VENDSPEC_CARD_CLKEN); pb_delay_us(100); - LOG_DBG("Actual bus rate = %d kHz", actual_clk_hz / 1000); + LOG_DBG("Actual bus rate = %d kHz", (input_clock_hz / (pre_div * div)) / 1000); return PB_OK; } @@ -273,9 +271,11 @@ static int imx_usdhc_send_cmd(uint16_t idx, uint32_t arg, uint16_t resp_type, mm static int imx_usdhc_set_bus_width(enum mmc_bus_width width) { +#if LOGLEVEL >= 3 const char *bus_widths[] = { "Invalid", "1-Bit", "4-Bit", "8-Bit", "4-Bit DDR", "8-Bit DDR", "8-Bit DDR + Strobe", }; +#endif LOG_DBG("Width = %s", bus_widths[width]); bus_ddr_enable = false; diff --git a/src/drivers/mmc/mmc_core.c b/src/drivers/mmc/mmc_core.c index 7bdaf367..0b213cd2 100644 --- a/src/drivers/mmc/mmc_core.c +++ b/src/drivers/mmc/mmc_core.c @@ -845,12 +845,14 @@ int mmc_write(unsigned int lba, size_t length, const uintptr_t buf) int mmc_part_switch(enum mmc_part part) { uint8_t value = 0; +#if LOGLEVEL >= 3 const char *part_names[] = { "User", "Boot0", "Boot1", "RPMB", }; +#endif switch (part) { case MMC_PART_BOOT0: diff --git a/src/drivers/usb/imx_ci_udc.c b/src/drivers/usb/imx_ci_udc.c index 1d6a7925..d5f5e3ff 100644 --- a/src/drivers/usb/imx_ci_udc.c +++ b/src/drivers/usb/imx_ci_udc.c @@ -571,6 +571,7 @@ static int imx_ci_udc_set_address(uint16_t addr) static int imx_ci_udc_stop(void) { + mmio_clrsetbits_32(imx_ci_udc_base + IMX_CI_UDC_CMD, CMD_RS, 0); imx_ci_udc_reset_queues(); imx_ci_udc_reset(); mmio_write_32(imx_ci_udc_base + IMX_CI_UDC_DEVICEADDR, 0); diff --git a/tools/pbstate/src/pbstate.c b/tools/pbstate/src/pbstate.c index 48df6a75..1fb64822 100644 --- a/tools/pbstate/src/pbstate.c +++ b/tools/pbstate/src/pbstate.c @@ -221,7 +221,6 @@ int pbstate_init(const char *p_device, const char *b_device, pbstate_printfunc_t int pbstate_is_system_active(pbstate_system_t system) { - int rc; int result = 0; int fd = open_and_load_state(false); @@ -242,17 +241,12 @@ int pbstate_is_system_active(pbstate_system_t system) break; } - rc = close_and_save_state(fd, false); - - if (rc < 0) - return rc; - + close_and_save_state(fd, false); return result; } int pbstate_is_system_verified(pbstate_system_t system) { - int rc; int result = 0; int fd = open_and_load_state(false); @@ -273,11 +267,7 @@ int pbstate_is_system_verified(pbstate_system_t system) break; } - rc = close_and_save_state(fd, false); - - if (rc < 0) - return rc; - + close_and_save_state(fd, false); return result; } @@ -293,13 +283,13 @@ int pbstate_get_remaining_boot_attempts(unsigned int *boot_attempts) (*boot_attempts) = state.remaining_boot_attempts; - return close_and_save_state(fd, false); + close_and_save_state(fd, false); + return 0; } int pbstate_force_rollback(void) { int rc; - int preserved_rc = 0; int fd = open_and_load_state(true); if (fd < 0) @@ -326,13 +316,9 @@ int pbstate_force_rollback(void) return 0; err_close_release_no_save_out: - preserved_rc = rc; - rc = close_and_save_state(fd, false); - - if (rc < 0) - return rc; + close_and_save_state(fd, false); - return preserved_rc; + return rc; } int pbstate_get_errors(uint32_t *error) @@ -344,7 +330,8 @@ int pbstate_get_errors(uint32_t *error) (*error) = state.error; - return close_and_save_state(fd, false); + close_and_save_state(fd, false); + return 0; } int pbstate_clear_error(uint32_t mask) @@ -362,7 +349,6 @@ int pbstate_clear_error(uint32_t mask) int pbstate_switch_system(pbstate_system_t system, uint32_t boot_attempts) { int rc; - int preserved_rc; int fd = open_and_load_state(true); if (fd < 0) @@ -408,20 +394,44 @@ int pbstate_switch_system(pbstate_system_t system, uint32_t boot_attempts) return close_and_save_state(fd, true); err_close_release_no_save_out: - preserved_rc = rc; + close_and_save_state(fd, false); + return rc; +} - rc = close_and_save_state(fd, false); +int pbstate_invalidate_system(pbstate_system_t system) +{ + int rc; + int fd = open_and_load_state(true); - if (rc < 0) - return rc; + if (fd < 0) + return fd; + + switch (system) { + case PBSTATE_SYSTEM_A: + state.enable &= ~PB_STATE_A_ENABLED; + state.verified &= ~PB_STATE_A_VERIFIED; + break; + case PBSTATE_SYSTEM_B: + state.enable &= ~PB_STATE_B_ENABLED; + state.verified &= ~PB_STATE_B_VERIFIED; + break; + default: + rc = -EINVAL; + goto err_close_release_no_save_out; + break; + } - return preserved_rc; + return close_and_save_state(fd, true); + +err_close_release_no_save_out: + close_and_save_state(fd, false); + + return rc; } int pbstate_set_system_verified(pbstate_system_t system) { int rc; - int preserved_rc; int fd = open_and_load_state(true); if (fd < 0) @@ -447,14 +457,9 @@ int pbstate_set_system_verified(pbstate_system_t system) return close_and_save_state(fd, true); err_close_release_no_save_out: - preserved_rc = rc; - - rc = close_and_save_state(fd, false); + close_and_save_state(fd, false); - if (rc < 0) - return rc; - - return preserved_rc; + return rc; } int pbstate_read_board_reg(unsigned int index, uint32_t *value) @@ -469,7 +474,9 @@ int pbstate_read_board_reg(unsigned int index, uint32_t *value) *value = state.board_regs[PB_STATE_NO_OF_BOARD_REGS - index - 1]; - return close_and_save_state(fd, false); + close_and_save_state(fd, false); + + return 0; } int pbstate_write_board_reg(unsigned int index, uint32_t value) diff --git a/tools/pbstate/src/pbstate.h b/tools/pbstate/src/pbstate.h index fdc38b12..26fe7fe3 100644 --- a/tools/pbstate/src/pbstate.h +++ b/tools/pbstate/src/pbstate.h @@ -99,6 +99,16 @@ int pbstate_clear_error(uint32_t mask); */ int pbstate_switch_system(pbstate_system_t system, uint32_t boot_attempts); +/** + * Invalidate and disable a system. This will clear the verified bit and + * enabled bit. + * + * @param[in] system System to invalidate + * + * @return 0 on success or -EINVAL on bad parameter + */ +int pbstate_invalidate_system(pbstate_system_t system); + /** * Set system verified bit * diff --git a/version.txt b/version.txt index ccbccc3d..276cbf9e 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -2.2.0 +2.3.0