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-2022 Linaro Ltd.
30 const struct ipa_resource_data *data) in ipa_resource_limits_valid() argument
39 group_count = data->rsrc_group_src_count; in ipa_resource_limits_valid()
43 /* Return an error if a non-zero resource limit is specified in ipa_resource_limits_valid()
46 for (i = 0; i < data->resource_src_count; i++) { in ipa_resource_limits_valid()
49 resource = &data->resource_src[i]; in ipa_resource_limits_valid()
51 if (resource->limits[j].min || resource->limits[j].max) in ipa_resource_limits_valid()
55 group_count = data->rsrc_group_dst_count; in ipa_resource_limits_valid()
59 for (i = 0; i < data->resource_dst_count; i++) { in ipa_resource_limits_valid()
62 resource = &data->resource_dst[i]; in ipa_resource_limits_valid()
64 if (resource->limits[j].min || resource->limits[j].max) in ipa_resource_limits_valid()
73 const struct reg *reg, in ipa_resource_config_common() argument
79 val = reg_encode(reg, X_MIN_LIM, xlimits->min); in ipa_resource_config_common()
80 val |= reg_encode(reg, X_MAX_LIM, xlimits->max); in ipa_resource_config_common()
82 val |= reg_encode(reg, Y_MIN_LIM, ylimits->min); in ipa_resource_config_common()
83 val |= reg_encode(reg, Y_MAX_LIM, ylimits->max); in ipa_resource_config_common()
86 iowrite32(val, ipa->reg_virt + reg_n_offset(reg, resource_type)); in ipa_resource_config_common()
90 const struct ipa_resource_data *data) in ipa_resource_config_src() argument
92 u32 group_count = data->rsrc_group_src_count; in ipa_resource_config_src()
95 const struct reg *reg; in ipa_resource_config_src() local
97 resource = &data->resource_src[resource_type]; in ipa_resource_config_src()
99 reg = ipa_reg(ipa, SRC_RSRC_GRP_01_RSRC_TYPE); in ipa_resource_config_src()
100 ylimits = group_count == 1 ? NULL : &resource->limits[1]; in ipa_resource_config_src()
101 ipa_resource_config_common(ipa, resource_type, reg, in ipa_resource_config_src()
102 &resource->limits[0], ylimits); in ipa_resource_config_src()
106 reg = ipa_reg(ipa, SRC_RSRC_GRP_23_RSRC_TYPE); in ipa_resource_config_src()
107 ylimits = group_count == 3 ? NULL : &resource->limits[3]; in ipa_resource_config_src()
108 ipa_resource_config_common(ipa, resource_type, reg, in ipa_resource_config_src()
109 &resource->limits[2], ylimits); in ipa_resource_config_src()
113 reg = ipa_reg(ipa, SRC_RSRC_GRP_45_RSRC_TYPE); in ipa_resource_config_src()
114 ylimits = group_count == 5 ? NULL : &resource->limits[5]; in ipa_resource_config_src()
115 ipa_resource_config_common(ipa, resource_type, reg, in ipa_resource_config_src()
116 &resource->limits[4], ylimits); in ipa_resource_config_src()
120 reg = ipa_reg(ipa, SRC_RSRC_GRP_67_RSRC_TYPE); in ipa_resource_config_src()
121 ylimits = group_count == 7 ? NULL : &resource->limits[7]; in ipa_resource_config_src()
122 ipa_resource_config_common(ipa, resource_type, reg, in ipa_resource_config_src()
123 &resource->limits[6], ylimits); in ipa_resource_config_src()
127 const struct ipa_resource_data *data) in ipa_resource_config_dst() argument
129 u32 group_count = data->rsrc_group_dst_count; in ipa_resource_config_dst()
132 const struct reg *reg; in ipa_resource_config_dst() local
134 resource = &data->resource_dst[resource_type]; in ipa_resource_config_dst()
136 reg = ipa_reg(ipa, DST_RSRC_GRP_01_RSRC_TYPE); in ipa_resource_config_dst()
137 ylimits = group_count == 1 ? NULL : &resource->limits[1]; in ipa_resource_config_dst()
138 ipa_resource_config_common(ipa, resource_type, reg, in ipa_resource_config_dst()
139 &resource->limits[0], ylimits); in ipa_resource_config_dst()
143 reg = ipa_reg(ipa, DST_RSRC_GRP_23_RSRC_TYPE); in ipa_resource_config_dst()
144 ylimits = group_count == 3 ? NULL : &resource->limits[3]; in ipa_resource_config_dst()
145 ipa_resource_config_common(ipa, resource_type, reg, in ipa_resource_config_dst()
146 &resource->limits[2], ylimits); in ipa_resource_config_dst()
150 reg = ipa_reg(ipa, DST_RSRC_GRP_45_RSRC_TYPE); in ipa_resource_config_dst()
151 ylimits = group_count == 5 ? NULL : &resource->limits[5]; in ipa_resource_config_dst()
152 ipa_resource_config_common(ipa, resource_type, reg, in ipa_resource_config_dst()
153 &resource->limits[4], ylimits); in ipa_resource_config_dst()
157 reg = ipa_reg(ipa, DST_RSRC_GRP_67_RSRC_TYPE); in ipa_resource_config_dst()
158 ylimits = group_count == 7 ? NULL : &resource->limits[7]; in ipa_resource_config_dst()
159 ipa_resource_config_common(ipa, resource_type, reg, in ipa_resource_config_dst()
160 &resource->limits[6], ylimits); in ipa_resource_config_dst()
164 int ipa_resource_config(struct ipa *ipa, const struct ipa_resource_data *data) in ipa_resource_config() argument
168 if (!ipa_resource_limits_valid(ipa, data)) in ipa_resource_config()
169 return -EINVAL; in ipa_resource_config()
171 for (i = 0; i < data->resource_src_count; i++) in ipa_resource_config()
172 ipa_resource_config_src(ipa, i, data); in ipa_resource_config()
174 for (i = 0; i < data->resource_dst_count; i++) in ipa_resource_config()
175 ipa_resource_config_dst(ipa, i, data); in ipa_resource_config()