]> www.infradead.org Git - linux-platform-drivers-x86.git/commitdiff
net: ipa: identify resource groups
authorAlex Elder <elder@linaro.org>
Fri, 26 Mar 2021 15:11:13 +0000 (10:11 -0500)
committerDavid S. Miller <davem@davemloft.net>
Fri, 26 Mar 2021 22:02:38 +0000 (15:02 -0700)
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: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ipa/ipa_data-sc7180.c
drivers/net/ipa/ipa_data-sdm845.c

index 621ad15c9e67d890d7a232beee47656133fb1e2b..e9b741832a1d7eab17fe12e28d3bf1b706f23063 100644 (file)
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 
-/* Copyright (C) 2019-2020 Linaro Ltd. */
+/* Copyright (C) 2019-2021 Linaro Ltd. */
 
 #include <linux/log2.h>
 
@@ -9,6 +9,15 @@
 #include "ipa_endpoint.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. */
 static const struct ipa_qsb_data ipa_qsb_data[] = {
        [IPA_QSB_MASTER_DDR] = {
@@ -32,7 +41,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = {
                },
                .endpoint = {
                        .config = {
-                               .resource_group = 0,
+                               .resource_group = IPA_RSRC_GROUP_SRC_UL_DL,
                                .dma_mode       = true,
                                .dma_endpoint   = IPA_ENDPOINT_AP_LAN_RX,
                                .tx = {
@@ -53,7 +62,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = {
                },
                .endpoint = {
                        .config = {
-                               .resource_group = 0,
+                               .resource_group = IPA_RSRC_GROUP_DST_UL_DL_DPL,
                                .aggregation    = true,
                                .status_enable  = true,
                                .rx = {
@@ -75,7 +84,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = {
                .endpoint = {
                        .filter_support = true,
                        .config = {
-                               .resource_group = 0,
+                               .resource_group = IPA_RSRC_GROUP_SRC_UL_DL,
                                .checksum       = true,
                                .qmap           = true,
                                .status_enable  = true,
@@ -100,7 +109,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = {
                },
                .endpoint = {
                        .config = {
-                               .resource_group = 0,
+                               .resource_group = IPA_RSRC_GROUP_DST_UL_DL_DPL,
                                .checksum       = true,
                                .qmap           = true,
                                .aggregation    = true,
@@ -139,58 +148,57 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = {
        },
 };
 
-/* For the SC7180, resource groups are allocated this way:
- *   group 0:  UL_DL
- */
+/* Source resource configuration data for the SC7180 SoC */
 static const struct ipa_resource_src ipa_resource_src[] = {
        {
                .type = IPA_RESOURCE_TYPE_SRC_PKT_CONTEXTS,
-               .limits[0] = {
+               .limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
                        .min = 3,
                        .max = 63,
                },
        },
        {
                .type = IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_LISTS,
-               .limits[0] = {
+               .limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
                        .min = 3,
                        .max = 3,
                },
        },
        {
                .type = IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_BUFF,
-               .limits[0] = {
+               .limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
                        .min = 10,
                        .max = 10,
                },
        },
        {
                .type = IPA_RESOURCE_TYPE_SRC_HPS_DMARS,
-               .limits[0] = {
+               .limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
                        .min = 1,
                        .max = 1,
                },
        },
        {
                .type = IPA_RESOURCE_TYPE_SRC_ACK_ENTRIES,
-               .limits[0] = {
+               .limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
                        .min = 5,
                        .max = 5,
                },
        },
 };
 
+/* Destination resource configuration data for the SC7180 SoC */
 static const struct ipa_resource_dst ipa_resource_dst[] = {
        {
                .type = IPA_RESOURCE_TYPE_DST_DATA_SECTORS,
-               .limits[0] = {
+               .limits[IPA_RSRC_GROUP_DST_UL_DL_DPL] = {
                        .min = 3,
                        .max = 3,
                },
        },
        {
                .type = IPA_RESOURCE_TYPE_DST_DPS_DMARS,
-               .limits[0] = {
+               .limits[IPA_RSRC_GROUP_DST_UL_DL_DPL] = {
                        .min = 1,
                        .max = 63,
                },
index 6b5173f4744448364326a49bf3a3a6da7596bd75..b6ea6295e75983ddd0fc047b7fd4f7d818fae823 100644 (file)
@@ -1,7 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 
 /* 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 "ipa_endpoint.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. */
 static const struct ipa_qsb_data ipa_qsb_data[] = {
        [IPA_QSB_MASTER_DDR] = {
@@ -37,7 +51,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = {
                },
                .endpoint = {
                        .config = {
-                               .resource_group = 1,
+                               .resource_group = IPA_RSRC_GROUP_SRC_UL_DL,
                                .dma_mode       = true,
                                .dma_endpoint   = IPA_ENDPOINT_AP_LAN_RX,
                                .tx = {
@@ -58,7 +72,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = {
                },
                .endpoint = {
                        .config = {
-                               .resource_group = 1,
+                               .resource_group = IPA_RSRC_GROUP_DST_UL_DL_DPL,
                                .aggregation    = true,
                                .status_enable  = true,
                                .rx = {
@@ -80,7 +94,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = {
                .endpoint = {
                        .filter_support = true,
                        .config = {
-                               .resource_group = 1,
+                               .resource_group = IPA_RSRC_GROUP_SRC_UL_DL,
                                .checksum       = true,
                                .qmap           = true,
                                .status_enable  = true,
@@ -104,7 +118,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = {
                },
                .endpoint = {
                        .config = {
-                               .resource_group = 1,
+                               .resource_group = IPA_RSRC_GROUP_DST_UL_DL_DPL,
                                .checksum       = true,
                                .qmap           = true,
                                .aggregation    = true,
@@ -152,72 +166,70 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = {
        },
 };
 
-/* For the SDM845, resource groups are allocated this way:
- *   group 0:  LWA_DL
- *   group 1:  UL_DL
- */
+/* Source resource configuration data for the SDM845 SoC */
 static const struct ipa_resource_src ipa_resource_src[] = {
        {
                .type = IPA_RESOURCE_TYPE_SRC_PKT_CONTEXTS,
-               .limits[0] = {
+               .limits[IPA_RSRC_GROUP_SRC_LWA_DL] = {
                        .min = 1,
                        .max = 255,
                },
-               .limits[1] = {
+               .limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
                        .min = 1,
                        .max = 255,
                },
        },
        {
                .type = IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_LISTS,
-               .limits[0] = {
+               .limits[IPA_RSRC_GROUP_SRC_LWA_DL] = {
                        .min = 10,
                        .max = 10,
                },
-               .limits[1] = {
+               .limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
                        .min = 10,
                        .max = 10,
                },
        },
        {
                .type = IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_BUFF,
-               .limits[0] = {
+               .limits[IPA_RSRC_GROUP_SRC_LWA_DL] = {
                        .min = 12,
                        .max = 12,
                },
-               .limits[1] = {
+               .limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
                        .min = 14,
                        .max = 14,
                },
        },
        {
                .type = IPA_RESOURCE_TYPE_SRC_HPS_DMARS,
-               .limits[0] = {
+               .limits[IPA_RSRC_GROUP_SRC_LWA_DL] = {
                        .min = 0,
                        .max = 63,
                },
-               .limits[1] = {
+               .limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
                        .min = 0,
                        .max = 63,
                },
        },
        {
                .type = IPA_RESOURCE_TYPE_SRC_ACK_ENTRIES,
-               .limits[0] = {
+               .limits[IPA_RSRC_GROUP_SRC_LWA_DL] = {
                        .min = 14,
                        .max = 14,
                },
-               .limits[1] = {
+               .limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
                        .min = 20,
                        .max = 20,
                },
        },
 };
 
+/* Destination resource configuration data for the SDM845 SoC */
 static const struct ipa_resource_dst ipa_resource_dst[] = {
        {
                .type = IPA_RESOURCE_TYPE_DST_DATA_SECTORS,
-               .limits[0] = {
+               .limits[IPA_RSRC_GROUP_DST_LWA_DL] = {
                        .min = 4,
                        .max = 4,
                },
@@ -228,11 +240,11 @@ static const struct ipa_resource_dst ipa_resource_dst[] = {
        },
        {
                .type = IPA_RESOURCE_TYPE_DST_DPS_DMARS,
-               .limits[0] = {
+               .limits[IPA_RSRC_GROUP_DST_LWA_DL] = {
                        .min = 2,
                        .max = 63,
                },
-               .limits[1] = {
+               .limits[IPA_RSRC_GROUP_DST_UL_DL_DPL] = {
                        .min = 1,
                        .max = 63,
                },