Commit 3219953b authored by Alex Elder's avatar Alex Elder Committed by David S. Miller

net: ipa: support more than 6 resource groups

IPA versions 3.0 and 3.1 support up to 8 resource groups.  There is
some interest in supporting these older versions of the hardware, so
update the resource configuration code to program resource limits
for these groups if specified.
Signed-off-by: default avatarAlex Elder <elder@linaro.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4fd704b3
...@@ -46,8 +46,8 @@ ...@@ -46,8 +46,8 @@
* the IPA endpoint. * the IPA endpoint.
*/ */
/* The maximum value returned by ipa_resource_group_{src,dst}_count() */ /* The maximum possible number of source or destination resource groups */
#define IPA_RESOURCE_GROUP_MAX 5 #define IPA_RESOURCE_GROUP_MAX 8
/** enum ipa_qsb_master_id - array index for IPA QSB configuration data */ /** enum ipa_qsb_master_id - array index for IPA QSB configuration data */
enum ipa_qsb_master_id { enum ipa_qsb_master_id {
......
...@@ -353,12 +353,16 @@ enum ipa_pulse_gran { ...@@ -353,12 +353,16 @@ enum ipa_pulse_gran {
(0x00000404 + 0x0020 * (rt)) (0x00000404 + 0x0020 * (rt))
#define IPA_REG_SRC_RSRC_GRP_45_RSRC_TYPE_N_OFFSET(rt) \ #define IPA_REG_SRC_RSRC_GRP_45_RSRC_TYPE_N_OFFSET(rt) \
(0x00000408 + 0x0020 * (rt)) (0x00000408 + 0x0020 * (rt))
#define IPA_REG_SRC_RSRC_GRP_67_RSRC_TYPE_N_OFFSET(rt) \
(0x0000040c + 0x0020 * (rt))
#define IPA_REG_DST_RSRC_GRP_01_RSRC_TYPE_N_OFFSET(rt) \ #define IPA_REG_DST_RSRC_GRP_01_RSRC_TYPE_N_OFFSET(rt) \
(0x00000500 + 0x0020 * (rt)) (0x00000500 + 0x0020 * (rt))
#define IPA_REG_DST_RSRC_GRP_23_RSRC_TYPE_N_OFFSET(rt) \ #define IPA_REG_DST_RSRC_GRP_23_RSRC_TYPE_N_OFFSET(rt) \
(0x00000504 + 0x0020 * (rt)) (0x00000504 + 0x0020 * (rt))
#define IPA_REG_DST_RSRC_GRP_45_RSRC_TYPE_N_OFFSET(rt) \ #define IPA_REG_DST_RSRC_GRP_45_RSRC_TYPE_N_OFFSET(rt) \
(0x00000508 + 0x0020 * (rt)) (0x00000508 + 0x0020 * (rt))
#define IPA_REG_DST_RSRC_GRP_67_RSRC_TYPE_N_OFFSET(rt) \
(0x0000050c + 0x0020 * (rt))
/* The next four fields are used for all resource group registers */ /* The next four fields are used for all resource group registers */
#define X_MIN_LIM_FMASK GENMASK(5, 0) #define X_MIN_LIM_FMASK GENMASK(5, 0)
#define X_MAX_LIM_FMASK GENMASK(13, 8) #define X_MAX_LIM_FMASK GENMASK(13, 8)
......
...@@ -34,8 +34,8 @@ static bool ipa_resource_limits_valid(struct ipa *ipa, ...@@ -34,8 +34,8 @@ static bool ipa_resource_limits_valid(struct ipa *ipa,
u32 i; u32 i;
u32 j; u32 j;
/* We program at most 6 source or destination resource group limits */ /* We program at most 8 source or destination resource group limits */
BUILD_BUG_ON(IPA_RESOURCE_GROUP_MAX > 6); BUILD_BUG_ON(IPA_RESOURCE_GROUP_MAX > 8);
group_count = data->rsrc_group_src_count; group_count = data->rsrc_group_src_count;
if (!group_count || group_count > IPA_RESOURCE_GROUP_MAX) if (!group_count || group_count > IPA_RESOURCE_GROUP_MAX)
...@@ -113,6 +113,13 @@ static void ipa_resource_config_src(struct ipa *ipa, u32 resource_type, ...@@ -113,6 +113,13 @@ static void ipa_resource_config_src(struct ipa *ipa, u32 resource_type,
offset = IPA_REG_SRC_RSRC_GRP_45_RSRC_TYPE_N_OFFSET(resource_type); offset = IPA_REG_SRC_RSRC_GRP_45_RSRC_TYPE_N_OFFSET(resource_type);
ylimits = group_count == 5 ? NULL : &resource->limits[5]; ylimits = group_count == 5 ? NULL : &resource->limits[5];
ipa_resource_config_common(ipa, offset, &resource->limits[4], ylimits); ipa_resource_config_common(ipa, offset, &resource->limits[4], ylimits);
if (group_count < 7)
return;
offset = IPA_REG_SRC_RSRC_GRP_67_RSRC_TYPE_N_OFFSET(resource_type);
ylimits = group_count == 7 ? NULL : &resource->limits[7];
ipa_resource_config_common(ipa, offset, &resource->limits[6], ylimits);
} }
static void ipa_resource_config_dst(struct ipa *ipa, u32 resource_type, static void ipa_resource_config_dst(struct ipa *ipa, u32 resource_type,
...@@ -142,6 +149,13 @@ static void ipa_resource_config_dst(struct ipa *ipa, u32 resource_type, ...@@ -142,6 +149,13 @@ static void ipa_resource_config_dst(struct ipa *ipa, u32 resource_type,
offset = IPA_REG_DST_RSRC_GRP_45_RSRC_TYPE_N_OFFSET(resource_type); offset = IPA_REG_DST_RSRC_GRP_45_RSRC_TYPE_N_OFFSET(resource_type);
ylimits = group_count == 5 ? NULL : &resource->limits[5]; ylimits = group_count == 5 ? NULL : &resource->limits[5];
ipa_resource_config_common(ipa, offset, &resource->limits[4], ylimits); ipa_resource_config_common(ipa, offset, &resource->limits[4], ylimits);
if (group_count < 7)
return;
offset = IPA_REG_DST_RSRC_GRP_67_RSRC_TYPE_N_OFFSET(resource_type);
ylimits = group_count == 7 ? NULL : &resource->limits[7];
ipa_resource_config_common(ipa, offset, &resource->limits[6], ylimits);
} }
/* Configure resources */ /* Configure resources */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment