Commit 47f71d6e authored by Alex Elder's avatar Alex Elder Committed by David S. Miller

net: ipa: identify resource groups

Define a new ipa_resource_group_id enumerated type, whose members
have numeric values that match the resource group number used when
programming the hardware.  Each platform supports a different number
of source and destination resource groups, so define the type
separately for each platform in its configuration data file.

Use these new symbolic values when specifying the resource group an
endpoint is associated with.  And use them to index the limits
arrays for source and destination resources, making it clearer how
these values are used.
Signed-off-by: default avatarAlex Elder <elder@linaro.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a749c6c0
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
/* Copyright (C) 2019-2020 Linaro Ltd. */ /* Copyright (C) 2019-2021 Linaro Ltd. */
#include <linux/log2.h> #include <linux/log2.h>
...@@ -9,6 +9,15 @@ ...@@ -9,6 +9,15 @@
#include "ipa_endpoint.h" #include "ipa_endpoint.h"
#include "ipa_mem.h" #include "ipa_mem.h"
/* Resource groups used for the SC7180 SoC */
enum ipa_rsrc_group_id {
/* Source resource group identifiers */
IPA_RSRC_GROUP_SRC_UL_DL = 0,
/* Destination resource group identifiers */
IPA_RSRC_GROUP_DST_UL_DL_DPL = 0,
};
/* QSB configuration for the SC7180 SoC. */ /* QSB configuration for the SC7180 SoC. */
static const struct ipa_qsb_data ipa_qsb_data[] = { static const struct ipa_qsb_data ipa_qsb_data[] = {
[IPA_QSB_MASTER_DDR] = { [IPA_QSB_MASTER_DDR] = {
...@@ -32,7 +41,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = { ...@@ -32,7 +41,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = {
}, },
.endpoint = { .endpoint = {
.config = { .config = {
.resource_group = 0, .resource_group = IPA_RSRC_GROUP_SRC_UL_DL,
.dma_mode = true, .dma_mode = true,
.dma_endpoint = IPA_ENDPOINT_AP_LAN_RX, .dma_endpoint = IPA_ENDPOINT_AP_LAN_RX,
.tx = { .tx = {
...@@ -53,7 +62,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = { ...@@ -53,7 +62,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = {
}, },
.endpoint = { .endpoint = {
.config = { .config = {
.resource_group = 0, .resource_group = IPA_RSRC_GROUP_DST_UL_DL_DPL,
.aggregation = true, .aggregation = true,
.status_enable = true, .status_enable = true,
.rx = { .rx = {
...@@ -75,7 +84,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = { ...@@ -75,7 +84,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = {
.endpoint = { .endpoint = {
.filter_support = true, .filter_support = true,
.config = { .config = {
.resource_group = 0, .resource_group = IPA_RSRC_GROUP_SRC_UL_DL,
.checksum = true, .checksum = true,
.qmap = true, .qmap = true,
.status_enable = true, .status_enable = true,
...@@ -100,7 +109,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = { ...@@ -100,7 +109,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = {
}, },
.endpoint = { .endpoint = {
.config = { .config = {
.resource_group = 0, .resource_group = IPA_RSRC_GROUP_DST_UL_DL_DPL,
.checksum = true, .checksum = true,
.qmap = true, .qmap = true,
.aggregation = true, .aggregation = true,
...@@ -139,58 +148,57 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = { ...@@ -139,58 +148,57 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = {
}, },
}; };
/* For the SC7180, resource groups are allocated this way: /* Source resource configuration data for the SC7180 SoC */
* group 0: UL_DL
*/
static const struct ipa_resource_src ipa_resource_src[] = { static const struct ipa_resource_src ipa_resource_src[] = {
{ {
.type = IPA_RESOURCE_TYPE_SRC_PKT_CONTEXTS, .type = IPA_RESOURCE_TYPE_SRC_PKT_CONTEXTS,
.limits[0] = { .limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
.min = 3, .min = 3,
.max = 63, .max = 63,
}, },
}, },
{ {
.type = IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_LISTS, .type = IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_LISTS,
.limits[0] = { .limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
.min = 3, .min = 3,
.max = 3, .max = 3,
}, },
}, },
{ {
.type = IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_BUFF, .type = IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_BUFF,
.limits[0] = { .limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
.min = 10, .min = 10,
.max = 10, .max = 10,
}, },
}, },
{ {
.type = IPA_RESOURCE_TYPE_SRC_HPS_DMARS, .type = IPA_RESOURCE_TYPE_SRC_HPS_DMARS,
.limits[0] = { .limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
.min = 1, .min = 1,
.max = 1, .max = 1,
}, },
}, },
{ {
.type = IPA_RESOURCE_TYPE_SRC_ACK_ENTRIES, .type = IPA_RESOURCE_TYPE_SRC_ACK_ENTRIES,
.limits[0] = { .limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
.min = 5, .min = 5,
.max = 5, .max = 5,
}, },
}, },
}; };
/* Destination resource configuration data for the SC7180 SoC */
static const struct ipa_resource_dst ipa_resource_dst[] = { static const struct ipa_resource_dst ipa_resource_dst[] = {
{ {
.type = IPA_RESOURCE_TYPE_DST_DATA_SECTORS, .type = IPA_RESOURCE_TYPE_DST_DATA_SECTORS,
.limits[0] = { .limits[IPA_RSRC_GROUP_DST_UL_DL_DPL] = {
.min = 3, .min = 3,
.max = 3, .max = 3,
}, },
}, },
{ {
.type = IPA_RESOURCE_TYPE_DST_DPS_DMARS, .type = IPA_RESOURCE_TYPE_DST_DPS_DMARS,
.limits[0] = { .limits[IPA_RSRC_GROUP_DST_UL_DL_DPL] = {
.min = 1, .min = 1,
.max = 63, .max = 63,
}, },
......
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved. /* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
* Copyright (C) 2019-2020 Linaro Ltd. * Copyright (C) 2019-2021 Linaro Ltd.
*/ */
#include <linux/log2.h> #include <linux/log2.h>
...@@ -11,6 +11,20 @@ ...@@ -11,6 +11,20 @@
#include "ipa_endpoint.h" #include "ipa_endpoint.h"
#include "ipa_mem.h" #include "ipa_mem.h"
/* Resource groups used for the SDM845 SoC */
enum ipa_rsrc_group_id {
/* Source resource group identifiers */
IPA_RSRC_GROUP_SRC_LWA_DL = 0,
IPA_RSRC_GROUP_SRC_UL_DL,
IPA_RSRC_GROUP_SRC_MHI_DMA,
IPA_RSRC_GROUP_SRC_UC_RX_Q,
/* Destination resource group identifiers */
IPA_RSRC_GROUP_DST_LWA_DL = 0,
IPA_RSRC_GROUP_DST_UL_DL_DPL,
IPA_RSRC_GROUP_DST_UNUSED_2,
};
/* QSB configuration for the SDM845 SoC. */ /* QSB configuration for the SDM845 SoC. */
static const struct ipa_qsb_data ipa_qsb_data[] = { static const struct ipa_qsb_data ipa_qsb_data[] = {
[IPA_QSB_MASTER_DDR] = { [IPA_QSB_MASTER_DDR] = {
...@@ -37,7 +51,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = { ...@@ -37,7 +51,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = {
}, },
.endpoint = { .endpoint = {
.config = { .config = {
.resource_group = 1, .resource_group = IPA_RSRC_GROUP_SRC_UL_DL,
.dma_mode = true, .dma_mode = true,
.dma_endpoint = IPA_ENDPOINT_AP_LAN_RX, .dma_endpoint = IPA_ENDPOINT_AP_LAN_RX,
.tx = { .tx = {
...@@ -58,7 +72,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = { ...@@ -58,7 +72,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = {
}, },
.endpoint = { .endpoint = {
.config = { .config = {
.resource_group = 1, .resource_group = IPA_RSRC_GROUP_DST_UL_DL_DPL,
.aggregation = true, .aggregation = true,
.status_enable = true, .status_enable = true,
.rx = { .rx = {
...@@ -80,7 +94,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = { ...@@ -80,7 +94,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = {
.endpoint = { .endpoint = {
.filter_support = true, .filter_support = true,
.config = { .config = {
.resource_group = 1, .resource_group = IPA_RSRC_GROUP_SRC_UL_DL,
.checksum = true, .checksum = true,
.qmap = true, .qmap = true,
.status_enable = true, .status_enable = true,
...@@ -104,7 +118,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = { ...@@ -104,7 +118,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = {
}, },
.endpoint = { .endpoint = {
.config = { .config = {
.resource_group = 1, .resource_group = IPA_RSRC_GROUP_DST_UL_DL_DPL,
.checksum = true, .checksum = true,
.qmap = true, .qmap = true,
.aggregation = true, .aggregation = true,
...@@ -152,72 +166,70 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = { ...@@ -152,72 +166,70 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = {
}, },
}; };
/* For the SDM845, resource groups are allocated this way: /* Source resource configuration data for the SDM845 SoC */
* group 0: LWA_DL
* group 1: UL_DL
*/
static const struct ipa_resource_src ipa_resource_src[] = { static const struct ipa_resource_src ipa_resource_src[] = {
{ {
.type = IPA_RESOURCE_TYPE_SRC_PKT_CONTEXTS, .type = IPA_RESOURCE_TYPE_SRC_PKT_CONTEXTS,
.limits[0] = { .limits[IPA_RSRC_GROUP_SRC_LWA_DL] = {
.min = 1, .min = 1,
.max = 255, .max = 255,
}, },
.limits[1] = { .limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
.min = 1, .min = 1,
.max = 255, .max = 255,
}, },
}, },
{ {
.type = IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_LISTS, .type = IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_LISTS,
.limits[0] = { .limits[IPA_RSRC_GROUP_SRC_LWA_DL] = {
.min = 10, .min = 10,
.max = 10, .max = 10,
}, },
.limits[1] = { .limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
.min = 10, .min = 10,
.max = 10, .max = 10,
}, },
}, },
{ {
.type = IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_BUFF, .type = IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_BUFF,
.limits[0] = { .limits[IPA_RSRC_GROUP_SRC_LWA_DL] = {
.min = 12, .min = 12,
.max = 12, .max = 12,
}, },
.limits[1] = { .limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
.min = 14, .min = 14,
.max = 14, .max = 14,
}, },
}, },
{ {
.type = IPA_RESOURCE_TYPE_SRC_HPS_DMARS, .type = IPA_RESOURCE_TYPE_SRC_HPS_DMARS,
.limits[0] = { .limits[IPA_RSRC_GROUP_SRC_LWA_DL] = {
.min = 0, .min = 0,
.max = 63, .max = 63,
}, },
.limits[1] = { .limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
.min = 0, .min = 0,
.max = 63, .max = 63,
}, },
}, },
{ {
.type = IPA_RESOURCE_TYPE_SRC_ACK_ENTRIES, .type = IPA_RESOURCE_TYPE_SRC_ACK_ENTRIES,
.limits[0] = { .limits[IPA_RSRC_GROUP_SRC_LWA_DL] = {
.min = 14, .min = 14,
.max = 14, .max = 14,
}, },
.limits[1] = { .limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
.min = 20, .min = 20,
.max = 20, .max = 20,
}, },
}, },
}; };
/* Destination resource configuration data for the SDM845 SoC */
static const struct ipa_resource_dst ipa_resource_dst[] = { static const struct ipa_resource_dst ipa_resource_dst[] = {
{ {
.type = IPA_RESOURCE_TYPE_DST_DATA_SECTORS, .type = IPA_RESOURCE_TYPE_DST_DATA_SECTORS,
.limits[0] = { .limits[IPA_RSRC_GROUP_DST_LWA_DL] = {
.min = 4, .min = 4,
.max = 4, .max = 4,
}, },
...@@ -228,11 +240,11 @@ static const struct ipa_resource_dst ipa_resource_dst[] = { ...@@ -228,11 +240,11 @@ static const struct ipa_resource_dst ipa_resource_dst[] = {
}, },
{ {
.type = IPA_RESOURCE_TYPE_DST_DPS_DMARS, .type = IPA_RESOURCE_TYPE_DST_DPS_DMARS,
.limits[0] = { .limits[IPA_RSRC_GROUP_DST_LWA_DL] = {
.min = 2, .min = 2,
.max = 63, .max = 63,
}, },
.limits[1] = { .limits[IPA_RSRC_GROUP_DST_UL_DL_DPL] = {
.min = 1, .min = 1,
.max = 63, .max = 63,
}, },
......
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