@@ -37,6 +37,7 @@ struct freq_tbl {
struct reg_val {
u32 reg;
u32 value;
+ u32 mask;
};
struct bw_tbl {
@@ -359,10 +359,19 @@ static void venus_set_registers(struct venus_hfi_device *hdev)
const struct venus_resources *res = hdev->core->res;
const struct reg_val *tbl = res->reg_tbl;
unsigned int count = res->reg_tbl_size;
- unsigned int i;
+ unsigned int i, val;
+
+ for (i = 0; i < count; i++) {
+ val = tbl[i].value;
- for (i = 0; i < count; i++)
- writel(tbl[i].value, hdev->core->base + tbl[i].reg);
+ /* In some cases, we only want to update certain bits */
+ if (tbl[i].mask) {
+ val = readl(hdev->core->base + tbl[i].reg);
+ val = (val & ~tbl[i].mask) | (tbl[i].value & tbl[i].mask);
+ }
+
+ writel(val, hdev->core->base + tbl[i].reg);
+ }
}
static void venus_soft_int(struct venus_hfi_device *hdev)