arm: mach-k3: support disabling a single firewall region

During boot some firewall regions could contain the R5's code which if
we change the firewalls settings will crash the core. To get around this
issue, define a new function which allows us to specify specific regions
we want unlocked.

Signed-off-by: Bryan Brattlof <bb@ti.com>
This commit is contained in:
Bryan Brattlof 2025-04-14 15:20:02 -05:00 committed by Tom Rini
parent 739ad58dbe
commit f393beedba
2 changed files with 26 additions and 0 deletions

View File

@ -35,6 +35,7 @@ enum k3_device_type {
void setup_k3_mpu_regions(void);
int early_console_init(void);
void disable_linefill_optimization(void);
int remove_fwl_region(struct fwl_data *fwl);
void remove_fwl_configs(struct fwl_data *fwl_data, size_t fwl_data_size);
int load_firmware(char *name_fw, char *name_loadaddr, u32 *loadaddr);
void k3_sysfw_print_ver(void);

View File

@ -253,6 +253,31 @@ void disable_linefill_optimization(void)
asm("mcr p15, 0, %0, c1, c0, 1" : : "r" (actlr));
}
int remove_fwl_region(struct fwl_data *fwl)
{
struct ti_sci_handle *sci = get_ti_sci_handle();
struct ti_sci_fwl_ops *ops = &sci->ops.fwl_ops;
struct ti_sci_msg_fwl_region region;
int ret;
region.fwl_id = fwl->fwl_id;
region.region = fwl->regions;
region.n_permission_regs = 3;
ops->get_fwl_region(sci, &region);
/* zero out the enable field of the firewall */
region.control = region.control & ~0xF;
pr_debug("Disabling firewall id: %d region: %d\n",
region.fwl_id, region.region);
ret = ops->set_fwl_region(sci, &region);
if (ret)
pr_err("Could not disable firewall\n");
return ret;
}
static void remove_fwl_regions(struct fwl_data fwl_data, size_t num_regions,
enum k3_firewall_region_type fwl_type)
{