Skip to content

Commit

Permalink
Merge pull request #199 from apritzel/h618
Browse files Browse the repository at this point in the history
fel: h616: support alternative die variant
  • Loading branch information
paulkocialkowski authored Oct 22, 2023
2 parents 0f037b2 + 05f58b5 commit c336885
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
12 changes: 10 additions & 2 deletions fel.c
Original file line number Diff line number Diff line change
Expand Up @@ -1101,6 +1101,14 @@ void aw_rmr_request(feldev_handle *dev, uint32_t entry_point, bool aarch64)
dev->soc_name);
return;
}
/* The H616 has two die variants with different RVBAR locations. */
uint32_t rvbar_reg = soc_info->rvbar_reg;
if (soc_info->rvbar_reg_alt) {
uint32_t ver_reg = fel_readl(dev, soc_info->ver_reg);

if (ver_reg & 0xff)
rvbar_reg = soc_info->rvbar_reg_alt;
}

uint32_t rmr_mode = (1 << 1) | (aarch64 ? 1 : 0); /* RR, AA64 flag */
uint32_t arm_code[] = {
Expand All @@ -1119,7 +1127,7 @@ void aw_rmr_request(feldev_handle *dev, uint32_t entry_point, bool aarch64)
htole32(0xe320f003), /* loop: wfi */
htole32(0xeafffffd), /* b <loop> */

htole32(soc_info->rvbar_reg),
htole32(rvbar_reg),
htole32(entry_point),
htole32(rmr_mode)
};
Expand All @@ -1128,7 +1136,7 @@ void aw_rmr_request(feldev_handle *dev, uint32_t entry_point, bool aarch64)
/* execute the thunk code (triggering a warm reset on the SoC) */
pr_info("Store entry point 0x%08X to RVBAR 0x%08X, "
"and request warm reset with RMR mode %u...",
entry_point, soc_info->rvbar_reg, rmr_mode);
entry_point, rvbar_reg, rmr_mode);
aw_fel_execute(dev, soc_info->scratch_addr);
pr_info(" done.\n");
}
Expand Down
2 changes: 2 additions & 0 deletions soc_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,8 @@ soc_info_t soc_info_table[] = {
.sid_offset = 0x200,
.sid_sections = generic_2k_sid_maps,
.rvbar_reg = 0x09010040,
.rvbar_reg_alt= 0x08100040,
.ver_reg = 0x03000024,
.watchdog = &wd_h6_compat,
},{
.soc_id = 0x1851, /* Allwinner R329 */
Expand Down
2 changes: 2 additions & 0 deletions soc_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ typedef struct {
uint32_t sid_offset; /* offset for SID_KEY[0-3], "root key" */
const sid_section *sid_sections; /* sid memory maps */
uint32_t rvbar_reg; /* MMIO address of RVBARADDR0_L register */
uint32_t rvbar_reg_alt;/* alternative MMIO address of RVBARADDR0_L register */
uint32_t ver_reg; /* MMIO address of "Version Register" */
const watchdog_info *watchdog; /* Used for reset */
bool sid_fix; /* Use SID workaround (read via register) */
/* Use I$ workaround (disable I$ before first write to prevent stale thunk */
Expand Down

0 comments on commit c336885

Please sign in to comment.