Hello,
While reading some code on source.codeaurora.org, I stumbled upon a bug in directory plat/imx/imx8m in ARM Trusted Firmware. This looks simple enough to fix and I wanted to open a Pull Request on https://github.com/ARM-software/arm-trusted-firmware but the relevant code is not there. How should I contribute code to this project?
The bug I wanted to fix is the following. In https://source.codeaurora.org/external/imx/imx-atf/tree/plat/imx/imx8m/include/imx8m_csu.h?h=android... several macros are defined to configure the CSU:
#define CSU_HPx(i, val, lk) \
{CSU_HP, .idx = (i), .hp = (val), .lock =(lk), }
#define CSU_SA(i, val, lk) \
{CSU_SA, .idx = (i), .sa = (val), .lock = (lk), }
#define CSU_HPCTRL(i, val, lk) \
{CSU_HPCONTROL, .idx = (i), .hpctrl = (val), .lock = (lk), }
These macros fill bits of structure imx_csu_cfg, which is parsed in function imx_csu_init in https://source.codeaurora.org/external/imx/imx-atf/tree/plat/imx/imx8m/imx8m_csu.c?h=android-10.0.0_... :
switch (csu->type) {
/* ... */
case CSU_SA:
val = mmio_read_32(CSU_SA_REG(csu->idx));
if (val & CSU_SA_LOCK(csu->idx))
break;
mmio_clrsetbits_32(CSU_SA_REG(csu->idx), CSU_SA_CFG(0x1, csu->idx),
CSU_SA_CFG(csu->hp | (csu->lock << 0x1), csu->idx));
// ^^--- HERE
break;
case CSU_HPCONTROL:
val = mmio_read_32(CSU_HPCONTROL_REG(csu->idx));
if (val & CSU_HPCONTROL_LOCK(csu->idx))
break;
mmio_clrsetbits_32(CSU_HPCONTROL_REG(csu->idx), CSU_HPCONTROL_CFG(0x1, csu->idx),
CSU_HPCONTROL_CFG(csu->hp | (csu->lock << 0x1), csu->idx));
// ^^--- HERE
break;
default:
break;
}
Instead of using bits csu->sa for CSU_SA and csu->hpctrl for CSU_HPCONTROL, imx_csu_init re-used bit hp which is not defined in the macro definitions.
It would be very useful if https://source.codeaurora.org/external/imx/imx-atf/?h=android-10.0.0_2.6.0 indicates how to report such issues or send fixes.