struct sysmmu_drvdata *drvdata = dev_get_drvdata(list->sysmmu);
spin_lock(&drvdata->lock);
- if (!is_sysmmu_active(drvdata) ||
- !is_sysmmu_runtime_active(drvdata)) {
+ if (!is_runtime_active_or_enabled(drvdata) ||
+ !is_sysmmu_active(drvdata)) {
spin_unlock(&drvdata->lock);
dev_dbg(drvdata->sysmmu,
"Skip TLB invalidation %#zx@%#x\n",
drvdata->hold_rpm_on_boot = true;
if (of_property_read_bool(sysmmu->of_node, "sysmmu,no-rpm-control"))
- drvdata->no_rpm_control = true;
+ drvdata->no_rpm_control = SYSMMU_STATE_DISABLED;
if (IS_TLB_WAY_TYPE(drvdata)) {
ret = sysmmu_parse_tlb_way_dt(sysmmu, drvdata);
spin_lock_irqsave(&owner->lock, flags);
list_for_each_entry(list, &owner->sysmmu_list, node) {
drvdata = dev_get_drvdata(list->sysmmu);
- if (!drvdata->no_rpm_control)
+ spin_lock(&drvdata->lock);
+ if (!drvdata->no_rpm_control) {
+ spin_unlock(&drvdata->lock);
continue;
- if (enable)
+ }
+ if (enable) {
__sysmmu_enable_nocount(drvdata);
- else
+ drvdata->no_rpm_control = SYSMMU_STATE_ENABLED;
+ } else {
__sysmmu_disable_nocount(drvdata);
+ drvdata->no_rpm_control = SYSMMU_STATE_DISABLED;
+ }
+ spin_unlock(&drvdata->lock);
}
spin_unlock_irqrestore(&owner->lock, flags);
}
spin_lock_irqsave(&drvdata->lock, flags);
if (!is_sysmmu_active(drvdata) ||
- !is_sysmmu_runtime_active(drvdata)) {
+ !is_runtime_active_or_enabled(drvdata)) {
dev_info(drvdata->sysmmu,
"%s: SysMMU is not active\n", __func__);
spin_unlock_irqrestore(&drvdata->lock, flags);
};
};
+enum {
+ SYSMMU_USE_RUNTIME_ACTIVE = 0,
+ SYSMMU_STATE_DISABLED,
+ SYSMMU_STATE_ENABLED,
+};
+
/*
* This structure hold all data of a single SYSMMU controller, this includes
* hw resources like registers and clocks, pointers and list nodes to connect
return data->runtime_active > 0 && !data->no_rpm_control;
}
+static inline bool is_runtime_active_or_enabled(struct sysmmu_drvdata *data)
+{
+ return is_sysmmu_runtime_active(data) ||
+ data->no_rpm_control == SYSMMU_STATE_ENABLED;
+}
+
static inline bool set_sysmmu_active(struct sysmmu_drvdata *data)
{
/* return true if the System MMU was not active previously