Lines Matching +full:reg +full:- +full:data

1 // SPDX-License-Identifier: GPL-2.0
3 /* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
4 * Copyright (C) 2018-2024 Linaro Ltd.
29 const struct ipa_resource_data *data) in ipa_resource_limits_valid() argument
38 group_count = data->rsrc_group_src_count; in ipa_resource_limits_valid()
42 /* Return an error if a non-zero resource limit is specified in ipa_resource_limits_valid()
45 for (i = 0; i < data->resource_src_count; i++) { in ipa_resource_limits_valid()
48 resource = &data->resource_src[i]; in ipa_resource_limits_valid()
50 if (resource->limits[j].min || resource->limits[j].max) in ipa_resource_limits_valid()
54 group_count = data->rsrc_group_dst_count; in ipa_resource_limits_valid()
58 for (i = 0; i < data->resource_dst_count; i++) { in ipa_resource_limits_valid()
61 resource = &data->resource_dst[i]; in ipa_resource_limits_valid()
63 if (resource->limits[j].min || resource->limits[j].max) in ipa_resource_limits_valid()
72 const struct reg *reg, in ipa_resource_config_common() argument
78 val = reg_encode(reg, X_MIN_LIM, xlimits->min); in ipa_resource_config_common()
79 val |= reg_encode(reg, X_MAX_LIM, xlimits->max); in ipa_resource_config_common()
81 val |= reg_encode(reg, Y_MIN_LIM, ylimits->min); in ipa_resource_config_common()
82 val |= reg_encode(reg, Y_MAX_LIM, ylimits->max); in ipa_resource_config_common()
85 iowrite32(val, ipa->reg_virt + reg_n_offset(reg, resource_type)); in ipa_resource_config_common()
89 const struct ipa_resource_data *data) in ipa_resource_config_src() argument
91 u32 group_count = data->rsrc_group_src_count; in ipa_resource_config_src()
94 const struct reg *reg; in ipa_resource_config_src() local
96 resource = &data->resource_src[resource_type]; in ipa_resource_config_src()
98 reg = ipa_reg(ipa, SRC_RSRC_GRP_01_RSRC_TYPE); in ipa_resource_config_src()
99 ylimits = group_count == 1 ? NULL : &resource->limits[1]; in ipa_resource_config_src()
100 ipa_resource_config_common(ipa, resource_type, reg, in ipa_resource_config_src()
101 &resource->limits[0], ylimits); in ipa_resource_config_src()
105 reg = ipa_reg(ipa, SRC_RSRC_GRP_23_RSRC_TYPE); in ipa_resource_config_src()
106 ylimits = group_count == 3 ? NULL : &resource->limits[3]; in ipa_resource_config_src()
107 ipa_resource_config_common(ipa, resource_type, reg, in ipa_resource_config_src()
108 &resource->limits[2], ylimits); in ipa_resource_config_src()
112 reg = ipa_reg(ipa, SRC_RSRC_GRP_45_RSRC_TYPE); in ipa_resource_config_src()
113 ylimits = group_count == 5 ? NULL : &resource->limits[5]; in ipa_resource_config_src()
114 ipa_resource_config_common(ipa, resource_type, reg, in ipa_resource_config_src()
115 &resource->limits[4], ylimits); in ipa_resource_config_src()
119 reg = ipa_reg(ipa, SRC_RSRC_GRP_67_RSRC_TYPE); in ipa_resource_config_src()
120 ylimits = group_count == 7 ? NULL : &resource->limits[7]; in ipa_resource_config_src()
121 ipa_resource_config_common(ipa, resource_type, reg, in ipa_resource_config_src()
122 &resource->limits[6], ylimits); in ipa_resource_config_src()
126 const struct ipa_resource_data *data) in ipa_resource_config_dst() argument
128 u32 group_count = data->rsrc_group_dst_count; in ipa_resource_config_dst()
131 const struct reg *reg; in ipa_resource_config_dst() local
133 resource = &data->resource_dst[resource_type]; in ipa_resource_config_dst()
135 reg = ipa_reg(ipa, DST_RSRC_GRP_01_RSRC_TYPE); in ipa_resource_config_dst()
136 ylimits = group_count == 1 ? NULL : &resource->limits[1]; in ipa_resource_config_dst()
137 ipa_resource_config_common(ipa, resource_type, reg, in ipa_resource_config_dst()
138 &resource->limits[0], ylimits); in ipa_resource_config_dst()
142 reg = ipa_reg(ipa, DST_RSRC_GRP_23_RSRC_TYPE); in ipa_resource_config_dst()
143 ylimits = group_count == 3 ? NULL : &resource->limits[3]; in ipa_resource_config_dst()
144 ipa_resource_config_common(ipa, resource_type, reg, in ipa_resource_config_dst()
145 &resource->limits[2], ylimits); in ipa_resource_config_dst()
149 reg = ipa_reg(ipa, DST_RSRC_GRP_45_RSRC_TYPE); in ipa_resource_config_dst()
150 ylimits = group_count == 5 ? NULL : &resource->limits[5]; in ipa_resource_config_dst()
151 ipa_resource_config_common(ipa, resource_type, reg, in ipa_resource_config_dst()
152 &resource->limits[4], ylimits); in ipa_resource_config_dst()
156 reg = ipa_reg(ipa, DST_RSRC_GRP_67_RSRC_TYPE); in ipa_resource_config_dst()
157 ylimits = group_count == 7 ? NULL : &resource->limits[7]; in ipa_resource_config_dst()
158 ipa_resource_config_common(ipa, resource_type, reg, in ipa_resource_config_dst()
159 &resource->limits[6], ylimits); in ipa_resource_config_dst()
163 int ipa_resource_config(struct ipa *ipa, const struct ipa_resource_data *data) in ipa_resource_config() argument
167 if (!ipa_resource_limits_valid(ipa, data)) in ipa_resource_config()
168 return -EINVAL; in ipa_resource_config()
170 for (i = 0; i < data->resource_src_count; i++) in ipa_resource_config()
171 ipa_resource_config_src(ipa, i, data); in ipa_resource_config()
173 for (i = 0; i < data->resource_dst_count; i++) in ipa_resource_config()
174 ipa_resource_config_dst(ipa, i, data); in ipa_resource_config()