We would like to know how to read the cause of reset on the AM335x within the kernel level drivers. (We can read it in uboot, but want to do it in the linux driver)
I am surprised that this is still not solved after 7+ years of no support in the driver.
By following other posts, I believe I have added the functions I need, but in the omap_wdt.c file, when it checks to see if the "read_reset_sources" function is present, it skips over it because I believe it is null, or possibly "pdata" is null.
I have added some pr_err lines for debugging, and I never get to the "OMAP Watchdog Reset Value" line:
omap_wdt.c
pr_err("OMAP Watchdog Entered Here Before Reset Checking\n");
if (pdata && pdata->read_reset_sources) {
u32 rs = pdata->read_reset_sources();
pr_err("OMAP Watchdog Reset Value: 0x%08X\n", rs);
if (rs & (1 << OMAP_MPU_WD_RST_SRC_ID_SHIFT))
wdev->wdog.bootstatus = WDIOF_CARDRESET;
}
In prm33xx.c, I have added the am33xx_prm_read_reset_sources function, and also created the prm_reset_src_map structure based on the AM335x TRM.
I then link the function into the prm_ll_data structure.
(I added the AM33XX... shift bits in the regbits header file)
prm33xx.c
/* AM335x Reset Map */
static struct prm_reset_src_map omap33xx_prm_reset_src_map[] = {
{ AM33XX_GLOBAL_COLD_RST_SHIFT, OMAP_GLOBAL_COLD_RST_SRC_ID_SHIFT },
{ AM33XX_GLOBAL_SW_RST_SHIFT, OMAP_GLOBAL_WARM_RST_SRC_ID_SHIFT },
{ AM33XX_MPU_WD_RST_SHIFT, OMAP_MPU_WD_RST_SRC_ID_SHIFT },
{ AM33XX_EXTERNAL_WARM_RST_SHIFT, OMAP_EXTWARM_RST_SRC_ID_SHIFT },
{ AM33XX_ICEPICK_RST_SHIFT, OMAP_ICEPICK_RST_SRC_ID_SHIFT },
{ -1, -1 },
};
...
/**
* am33xx_prm_read_reset_sources - return last SoC reset source
*
* Return a u32 representing the last reset sources of the SoC. The
* returned reset source bits are standardized across OMAP SoCs.
*/
static u32 am33xx_prm_read_reset_sources(void)
{
struct prm_reset_src_map *p;
u32 r = 0;
u32 v;
v = am33xx_prm_read_reg(AM33XX_PRM_DEVICE_MOD, AM33XX_PRM_RSTST_OFFSET);
p = omap33xx_prm_reset_src_map;
while (p->reg_shift >= 0 && p->std_shift >= 0) {
if (v & (1 << p->reg_shift))
r |= 1 << p->std_shift;
p++;
}
pr_err("powerdomain: Reset Source Register: 0x%08X\n", r);
return r;
}
...
static struct prm_ll_data am33xx_prm_ll_data = {
.read_reset_sources = am33xx_prm_read_reset_sources,
.assert_hardreset = am33xx_prm_assert_hardreset,
.deassert_hardreset = am33xx_prm_deassert_hardreset,
.is_hardreset_asserted = am33xx_prm_is_hardreset_asserted,
.reset_system = am33xx_prm_global_warm_sw_reset,
};
What else do I need to do so that omap_wdt recognizes that the driver does indeed support the read_reset_sources function?