Skip to content

Commit c26a594

Browse files
authored
Merge pull request #49 from jonasblixt/v2.3.0-work
V2.3.0 work
2 parents e36f7de + d1c3329 commit c26a594

File tree

8 files changed

+75
-41
lines changed

8 files changed

+75
-41
lines changed

include/plat/imx8x/sci/svc/timer/sci_timer_api.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ typedef uint32_t sc_timer_wdog_time_t;
7878
*/
7979
sc_err_t sc_timer_set_wdog_timeout(sc_ipc_t ipc, sc_timer_wdog_time_t timeout);
8080

81+
sc_err_t sc_timer_set_wdog_window(sc_ipc_t ipc, sc_timer_wdog_time_t window);
82+
8183
/*!
8284
* This function sets the watchdog pre-timeout in milliseconds. If not
8385
* set then the pre-timeout defaults to the max. Once locked this value

src/cm/cm_main.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,15 @@ static int cmd_boot_bpak(void)
578578
boot_set_source(BOOT_SOURCE_CB);
579579
boot_configure_load_cb(bpak_boot_read_f, bpak_boot_result_f);
580580

581-
return boot(bpak_boot_cmd->uuid);
581+
rc = boot_load(bpak_boot_cmd->uuid);
582+
if (rc != PB_OK)
583+
return rc;
584+
585+
if (cfg->tops.disconnect) {
586+
cfg->tops.disconnect();
587+
}
588+
589+
return boot_jump();
582590
}
583591

584592
static int cmd_slc_read(void)
@@ -756,6 +764,10 @@ static int pb_command_parse(void)
756764
pb_wire_init_result(&result, error_to_wire(rc));
757765
cm_write(&result, sizeof(result));
758766

767+
if (cfg->tops.disconnect) {
768+
cfg->tops.disconnect();
769+
}
770+
759771
if (rc == PB_OK) {
760772
rc = boot_jump();
761773
/* Should not return */

src/drivers/mmc/imx_usdhc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ static int imx_usdhc_set_bus_clock(unsigned int clk_hz)
2727
{
2828
int div = 1;
2929
int pre_div = 1;
30-
unsigned int actual_clk_hz;
3130

3231
LOG_DBG("Trying to set bus clock to %u kHz", clk_hz / 1000);
3332

@@ -43,7 +42,6 @@ static int imx_usdhc_set_bus_clock(unsigned int clk_hz)
4342
while (input_clock_hz / div > clk_hz && div < 16)
4443
div++;
4544

46-
actual_clk_hz = input_clock_hz / (pre_div * div);
4745
pre_div >>= 1;
4846
div -= 1;
4947
uint16_t clk_reg = (pre_div << 8) | (div << 4);
@@ -60,7 +58,7 @@ static int imx_usdhc_set_bus_clock(unsigned int clk_hz)
6058
mmio_setbits_32(usdhc->base + USDHC_VEND_SPEC, VENDSPEC_PER_CLKEN | VENDSPEC_CARD_CLKEN);
6159

6260
pb_delay_us(100);
63-
LOG_DBG("Actual bus rate = %d kHz", actual_clk_hz / 1000);
61+
LOG_DBG("Actual bus rate = %d kHz", (input_clock_hz / (pre_div * div)) / 1000);
6462
return PB_OK;
6563
}
6664

@@ -273,9 +271,11 @@ static int imx_usdhc_send_cmd(uint16_t idx, uint32_t arg, uint16_t resp_type, mm
273271

274272
static int imx_usdhc_set_bus_width(enum mmc_bus_width width)
275273
{
274+
#if LOGLEVEL >= 3
276275
const char *bus_widths[] = {
277276
"Invalid", "1-Bit", "4-Bit", "8-Bit", "4-Bit DDR", "8-Bit DDR", "8-Bit DDR + Strobe",
278277
};
278+
#endif
279279

280280
LOG_DBG("Width = %s", bus_widths[width]);
281281
bus_ddr_enable = false;

src/drivers/mmc/mmc_core.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -845,12 +845,14 @@ int mmc_write(unsigned int lba, size_t length, const uintptr_t buf)
845845
int mmc_part_switch(enum mmc_part part)
846846
{
847847
uint8_t value = 0;
848+
#if LOGLEVEL >= 3
848849
const char *part_names[] = {
849850
"User",
850851
"Boot0",
851852
"Boot1",
852853
"RPMB",
853854
};
855+
#endif
854856

855857
switch (part) {
856858
case MMC_PART_BOOT0:

src/drivers/usb/imx_ci_udc.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,7 @@ static int imx_ci_udc_set_address(uint16_t addr)
571571

572572
static int imx_ci_udc_stop(void)
573573
{
574+
mmio_clrsetbits_32(imx_ci_udc_base + IMX_CI_UDC_CMD, CMD_RS, 0);
574575
imx_ci_udc_reset_queues();
575576
imx_ci_udc_reset();
576577
mmio_write_32(imx_ci_udc_base + IMX_CI_UDC_DEVICEADDR, 0);

tools/pbstate/src/pbstate.c

Lines changed: 43 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,6 @@ int pbstate_init(const char *p_device, const char *b_device, pbstate_printfunc_t
221221

222222
int pbstate_is_system_active(pbstate_system_t system)
223223
{
224-
int rc;
225224
int result = 0;
226225
int fd = open_and_load_state(false);
227226

@@ -242,17 +241,12 @@ int pbstate_is_system_active(pbstate_system_t system)
242241
break;
243242
}
244243

245-
rc = close_and_save_state(fd, false);
246-
247-
if (rc < 0)
248-
return rc;
249-
244+
close_and_save_state(fd, false);
250245
return result;
251246
}
252247

253248
int pbstate_is_system_verified(pbstate_system_t system)
254249
{
255-
int rc;
256250
int result = 0;
257251
int fd = open_and_load_state(false);
258252

@@ -273,11 +267,7 @@ int pbstate_is_system_verified(pbstate_system_t system)
273267
break;
274268
}
275269

276-
rc = close_and_save_state(fd, false);
277-
278-
if (rc < 0)
279-
return rc;
280-
270+
close_and_save_state(fd, false);
281271
return result;
282272
}
283273

@@ -293,13 +283,13 @@ int pbstate_get_remaining_boot_attempts(unsigned int *boot_attempts)
293283

294284
(*boot_attempts) = state.remaining_boot_attempts;
295285

296-
return close_and_save_state(fd, false);
286+
close_and_save_state(fd, false);
287+
return 0;
297288
}
298289

299290
int pbstate_force_rollback(void)
300291
{
301292
int rc;
302-
int preserved_rc = 0;
303293
int fd = open_and_load_state(true);
304294

305295
if (fd < 0)
@@ -326,13 +316,9 @@ int pbstate_force_rollback(void)
326316
return 0;
327317

328318
err_close_release_no_save_out:
329-
preserved_rc = rc;
330-
rc = close_and_save_state(fd, false);
331-
332-
if (rc < 0)
333-
return rc;
319+
close_and_save_state(fd, false);
334320

335-
return preserved_rc;
321+
return rc;
336322
}
337323

338324
int pbstate_get_errors(uint32_t *error)
@@ -344,7 +330,8 @@ int pbstate_get_errors(uint32_t *error)
344330

345331
(*error) = state.error;
346332

347-
return close_and_save_state(fd, false);
333+
close_and_save_state(fd, false);
334+
return 0;
348335
}
349336

350337
int pbstate_clear_error(uint32_t mask)
@@ -362,7 +349,6 @@ int pbstate_clear_error(uint32_t mask)
362349
int pbstate_switch_system(pbstate_system_t system, uint32_t boot_attempts)
363350
{
364351
int rc;
365-
int preserved_rc;
366352
int fd = open_and_load_state(true);
367353

368354
if (fd < 0)
@@ -408,20 +394,44 @@ int pbstate_switch_system(pbstate_system_t system, uint32_t boot_attempts)
408394
return close_and_save_state(fd, true);
409395

410396
err_close_release_no_save_out:
411-
preserved_rc = rc;
397+
close_and_save_state(fd, false);
398+
return rc;
399+
}
412400

413-
rc = close_and_save_state(fd, false);
401+
int pbstate_invalidate_system(pbstate_system_t system)
402+
{
403+
int rc;
404+
int fd = open_and_load_state(true);
414405

415-
if (rc < 0)
416-
return rc;
406+
if (fd < 0)
407+
return fd;
408+
409+
switch (system) {
410+
case PBSTATE_SYSTEM_A:
411+
state.enable &= ~PB_STATE_A_ENABLED;
412+
state.verified &= ~PB_STATE_A_VERIFIED;
413+
break;
414+
case PBSTATE_SYSTEM_B:
415+
state.enable &= ~PB_STATE_B_ENABLED;
416+
state.verified &= ~PB_STATE_B_VERIFIED;
417+
break;
418+
default:
419+
rc = -EINVAL;
420+
goto err_close_release_no_save_out;
421+
break;
422+
}
417423

418-
return preserved_rc;
424+
return close_and_save_state(fd, true);
425+
426+
err_close_release_no_save_out:
427+
close_and_save_state(fd, false);
428+
429+
return rc;
419430
}
420431

421432
int pbstate_set_system_verified(pbstate_system_t system)
422433
{
423434
int rc;
424-
int preserved_rc;
425435
int fd = open_and_load_state(true);
426436

427437
if (fd < 0)
@@ -447,14 +457,9 @@ int pbstate_set_system_verified(pbstate_system_t system)
447457
return close_and_save_state(fd, true);
448458

449459
err_close_release_no_save_out:
450-
preserved_rc = rc;
451-
452-
rc = close_and_save_state(fd, false);
460+
close_and_save_state(fd, false);
453461

454-
if (rc < 0)
455-
return rc;
456-
457-
return preserved_rc;
462+
return rc;
458463
}
459464

460465
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)
469474

470475
*value = state.board_regs[PB_STATE_NO_OF_BOARD_REGS - index - 1];
471476

472-
return close_and_save_state(fd, false);
477+
close_and_save_state(fd, false);
478+
479+
return 0;
473480
}
474481

475482
int pbstate_write_board_reg(unsigned int index, uint32_t value)

tools/pbstate/src/pbstate.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,16 @@ int pbstate_clear_error(uint32_t mask);
9999
*/
100100
int pbstate_switch_system(pbstate_system_t system, uint32_t boot_attempts);
101101

102+
/**
103+
* Invalidate and disable a system. This will clear the verified bit and
104+
* enabled bit.
105+
*
106+
* @param[in] system System to invalidate
107+
*
108+
* @return 0 on success or -EINVAL on bad parameter
109+
*/
110+
int pbstate_invalidate_system(pbstate_system_t system);
111+
102112
/**
103113
* Set system verified bit
104114
*

version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.2.0
1+
2.3.0

0 commit comments

Comments
 (0)