hw_qspi_set_tCEM incorrect parameters handling

ID: COBALTSDK-978

Status: Open

First reported: 10.2.4.44

Fixed in: TBD

Description

The hw_qspi_set_tCEM() is called by psram_set_cs_active_max() in order to configure the QSPIC2 regarding the maximum time the CS can stay active when a PSRAM is used (tCEM). The tCEM, which is determined by PSRAM driver, is converted from time in usec to system clock cycles by psram_set_cs_active_max(), subsequently it converted again by hw_qspi_set_tCEM(). This double conversion ends up micconfiguring the delay

Workaround

Remove the conversion from usec to system clocks in the hw_qspi_set_tCEM() function

-__STATIC_FORCEINLINE void hw_qspi_set_tCEM(HW_QSPIC_ID id, uint16_t tcem_usec)
+__STATIC_FORCEINLINE void hw_qspi_set_tCEM(HW_QSPIC_ID id, uint16_t tcem_cc)
 {
-        uint32_t div = (uint32_t) hw_qspi_get_div(id);
-        uint32_t tcem_cc = ((tcem_usec * (hw_clk_get_sysclk_freq() / 1000000)) >> div);
-
         if (tcem_cc > 0x3FF) {
                 tcem_cc = 0x3FF;
         }