From 2a9ec1e1d6e8fe7da060c1f2aaced6d081bf8678 Mon Sep 17 00:00:00 2001 From: shenlei Date: Mon, 9 Nov 2026 05:08:55 -0800 Subject: [PATCH] feat(ipa): port Qualcomm IPA v2.6 driver and add SDM660 device tree support - Add patch 0042: add ipa@1e00000 node in sdm660.dtsi and enable in sdm660-xiaomi-platina.dts. - Add patch 0043: port IPA v2.6 driver support to Linux kernel 7.2: * Define IPA_VERSION_2_6 and hardware configuration (ipa_data_v2_6). * Bypass GSI channel init, table commands, and DMA when version < IPA_VERSION_3_0. * Establish AP/Modem QMI Service 0x31 handshake over QRTR to prevent Hexagon modem (MPSS) assertion crashes. * Gracefully handle null SMP2P interrupts and drop unsupported TX frames until BAM DMA is active. - Bump candidate kernel package to 7.2.12-r15 and update sources.lock.json checksums. - Verified on remote ARM64 compile server with successful package generation and test pass. --- ...042-arm64-dts-sdm660-add-ipa-v2-node.patch | 44 + ...-add-support-for-ipa-v2.6-and-sdm660.patch | 930 ++++++++++++++++++ .../linux-postmarketos-qcom-sdm660/APKBUILD | 6 +- project/sources.lock.json | 2 +- 4 files changed, 980 insertions(+), 2 deletions(-) create mode 100644 ports/candidate/linux-postmarketos-qcom-sdm660/0042-arm64-dts-sdm660-add-ipa-v2-node.patch create mode 100644 ports/candidate/linux-postmarketos-qcom-sdm660/0043-net-ipa-add-support-for-ipa-v2.6-and-sdm660.patch diff --git a/ports/candidate/linux-postmarketos-qcom-sdm660/0042-arm64-dts-sdm660-add-ipa-v2-node.patch b/ports/candidate/linux-postmarketos-qcom-sdm660/0042-arm64-dts-sdm660-add-ipa-v2-node.patch new file mode 100644 index 0000000..7a06ecb --- /dev/null +++ b/ports/candidate/linux-postmarketos-qcom-sdm660/0042-arm64-dts-sdm660-add-ipa-v2-node.patch @@ -0,0 +1,44 @@ +From: Platina Linux contributors +Subject: [PATCH] arm64: dts: qcom: sdm660: add ipa v2 node and enable on platina + +Add the IPA hardware node to sdm660.dtsi with BAM DMA and register ranges, +RPM SMD core clock, interrupts, and SMMU context bank. Enable the IPA +device on Xiaomi Mi 8 Lite (Platina). + +--- a/arch/arm64/boot/dts/qcom/sdm660.dtsi ++++ b/arch/arm64/boot/dts/qcom/sdm660.dtsi +@@ -435,6 +435,24 @@ + }; + }; + }; ++ ipa: ipa@1e00000 { ++ compatible = "qcom,sdm660-ipa", "qcom,ipa-v2.6"; ++ reg = <0x01e00000 0x34000>, ++ <0x01e04000 0x4000>, ++ <0x01e04000 0x15000>; ++ reg-names = "ipa-reg", ++ "ipa-shared", ++ "bam-reg"; ++ interrupts-extended = <&intc GIC_SPI 311 IRQ_TYPE_EDGE_RISING>, ++ <&intc GIC_SPI 312 IRQ_TYPE_EDGE_RISING>; ++ interrupt-names = "ipa", ++ "bam"; ++ clocks = <&rpmcc RPM_SMD_IPA_CLK>; ++ clock-names = "core"; ++ iommus = <&anoc2_smmu 0x140>; ++ qcom,gsi-loader = "skip"; ++ status = "disabled"; ++ }; + }; + + &tlmm { +--- a/arch/arm64/boot/dts/qcom/sdm660-xiaomi-platina.dts ++++ b/arch/arm64/boot/dts/qcom/sdm660-xiaomi-platina.dts +@@ -1230,3 +1230,7 @@ + opp-2150400000 { opp-hz = /bits/ 64 <2150400000>; }; + opp-2208000000 { opp-hz = /bits/ 64 <2208000000>; }; + }; ++ ++&ipa { ++ status = "okay"; ++}; diff --git a/ports/candidate/linux-postmarketos-qcom-sdm660/0043-net-ipa-add-support-for-ipa-v2.6-and-sdm660.patch b/ports/candidate/linux-postmarketos-qcom-sdm660/0043-net-ipa-add-support-for-ipa-v2.6-and-sdm660.patch new file mode 100644 index 0000000..169c61b --- /dev/null +++ b/ports/candidate/linux-postmarketos-qcom-sdm660/0043-net-ipa-add-support-for-ipa-v2.6-and-sdm660.patch @@ -0,0 +1,930 @@ +diff --git a/drivers/net/ipa/Makefile b/drivers/net/ipa/Makefile +index e148ec3..b883269 100644 +--- a/drivers/net/ipa/Makefile ++++ b/drivers/net/ipa/Makefile +@@ -7,7 +7,7 @@ IPA_REG_VERSIONS := 3.1 3.5.1 4.2 4.5 4.7 4.9 4.11 5.0 5.5 + # Some IPA versions can reuse another set of GSI register definitions. + GSI_REG_VERSIONS := 3.1 3.5.1 4.0 4.5 4.9 4.11 5.0 + +-IPA_DATA_VERSIONS := 3.1 3.5.1 4.2 4.5 4.7 4.9 4.11 5.0 5.2 5.5 ++IPA_DATA_VERSIONS := 2.6 3.1 3.5.1 4.2 4.5 4.7 4.9 4.11 5.0 5.2 5.5 + + obj-$(CONFIG_QCOM_IPA) += ipa.o + +diff --git a/drivers/net/ipa/data/ipa_data-v2.6.c b/drivers/net/ipa/data/ipa_data-v2.6.c +new file mode 100644 +index 0000000..17aaecd +--- /dev/null ++++ b/drivers/net/ipa/data/ipa_data-v2.6.c +@@ -0,0 +1,504 @@ ++// SPDX-License-Identifier: GPL-2.0 ++ ++/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved. ++ * Copyright (C) 2019-2024 Linaro Ltd. ++ */ ++ ++#include ++#include ++ ++#include "../ipa_data.h" ++#include "../ipa_endpoint.h" ++#include "../ipa_mem.h" ++#include "../ipa_version.h" ++ ++/** enum ipa_resource_type - IPA resource types for an SoC having IPA v2.6 */ ++enum ipa_resource_type { ++ IPA_RESOURCE_TYPE_SRC_PKT_CONTEXTS = 0, ++ IPA_RESOURCE_TYPE_SRC_HDR_SECTORS, ++ IPA_RESOURCE_TYPE_SRC_HDRI1_BUFFER, ++ IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_LISTS, ++ IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_BUFF, ++ IPA_RESOURCE_TYPE_SRC_HDRI2_BUFFERS, ++ IPA_RESOURCE_TYPE_SRC_HPS_DMARS, ++ IPA_RESOURCE_TYPE_SRC_ACK_ENTRIES, ++ ++ IPA_RESOURCE_TYPE_DST_DATA_SECTORS = 0, ++ IPA_RESOURCE_TYPE_DST_DATA_SECTOR_LISTS, ++ IPA_RESOURCE_TYPE_DST_DPS_DMARS, ++}; ++ ++enum ipa_rsrc_group_id { ++ IPA_RSRC_GROUP_SRC_UL = 0, ++ IPA_RSRC_GROUP_SRC_DL, ++ IPA_RSRC_GROUP_SRC_DIAG, ++ IPA_RSRC_GROUP_SRC_DMA, ++ IPA_RSRC_GROUP_SRC_UNUSED, ++ IPA_RSRC_GROUP_SRC_UC_RX_Q, ++ IPA_RSRC_GROUP_SRC_COUNT, ++ ++ IPA_RSRC_GROUP_DST_UL = 0, ++ IPA_RSRC_GROUP_DST_DL, ++ IPA_RSRC_GROUP_DST_DIAG_DPL, ++ IPA_RSRC_GROUP_DST_DMA, ++ IPA_RSRC_GROUP_DST_Q6ZIP_GENERAL, ++ IPA_RSRC_GROUP_DST_Q6ZIP_ENGINE, ++ IPA_RSRC_GROUP_DST_COUNT, ++}; ++ ++static const struct ipa_qsb_data ipa_qsb_data[] = { ++ [IPA_QSB_MASTER_DDR] = { ++ .max_writes = 8, ++ .max_reads = 8, ++ }, ++ [IPA_QSB_MASTER_PCIE] = { ++ .max_writes = 2, ++ .max_reads = 8, ++ }, ++}; ++ ++static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = { ++ [IPA_ENDPOINT_AP_COMMAND_TX] = { ++ .ee_id = GSI_EE_AP, ++ .channel_id = 6, ++ .endpoint_id = 22, ++ .toward_ipa = true, ++ .channel = { ++ .tre_count = 256, ++ .event_count = 256, ++ .tlv_count = 18, ++ }, ++ .endpoint = { ++ .config = { ++ .resource_group = IPA_RSRC_GROUP_SRC_UL, ++ .dma_mode = true, ++ .dma_endpoint = IPA_ENDPOINT_AP_LAN_RX, ++ .tx = { ++ .seq_type = IPA_SEQ_DMA, ++ }, ++ }, ++ }, ++ }, ++ [IPA_ENDPOINT_AP_LAN_RX] = { ++ .ee_id = GSI_EE_AP, ++ .channel_id = 7, ++ .endpoint_id = 15, ++ .toward_ipa = false, ++ .channel = { ++ .tre_count = 256, ++ .event_count = 256, ++ .tlv_count = 8, ++ }, ++ .endpoint = { ++ .config = { ++ .resource_group = IPA_RSRC_GROUP_SRC_UL, ++ .aggregation = true, ++ .status_enable = true, ++ .rx = { ++ .buffer_size = 8192, ++ .pad_align = ilog2(sizeof(u32)), ++ .aggr_time_limit = 500, ++ }, ++ }, ++ }, ++ }, ++ [IPA_ENDPOINT_AP_MODEM_TX] = { ++ .ee_id = GSI_EE_AP, ++ .channel_id = 5, ++ .endpoint_id = 3, ++ .toward_ipa = true, ++ .channel = { ++ .tre_count = 512, ++ .event_count = 512, ++ .tlv_count = 16, ++ }, ++ .endpoint = { ++ .filter_support = true, ++ .config = { ++ .resource_group = IPA_RSRC_GROUP_SRC_UL, ++ .checksum = true, ++ .qmap = true, ++ .status_enable = true, ++ .tx = { ++ .seq_type = IPA_SEQ_2_PASS_SKIP_LAST_UC, ++ .status_endpoint = ++ IPA_ENDPOINT_MODEM_AP_RX, ++ }, ++ }, ++ }, ++ }, ++ [IPA_ENDPOINT_AP_MODEM_RX] = { ++ .ee_id = GSI_EE_AP, ++ .channel_id = 8, ++ .endpoint_id = 16, ++ .toward_ipa = false, ++ .channel = { ++ .tre_count = 256, ++ .event_count = 256, ++ .tlv_count = 8, ++ }, ++ .endpoint = { ++ .config = { ++ .resource_group = IPA_RSRC_GROUP_DST_DL, ++ .checksum = true, ++ .qmap = true, ++ .aggregation = true, ++ .rx = { ++ .buffer_size = 8192, ++ .aggr_time_limit = 500, ++ .aggr_close_eof = true, ++ }, ++ }, ++ }, ++ }, ++ [IPA_ENDPOINT_MODEM_LAN_TX] = { ++ .ee_id = GSI_EE_MODEM, ++ .channel_id = 4, ++ .endpoint_id = 9, ++ .toward_ipa = true, ++ .endpoint = { ++ .filter_support = true, ++ }, ++ }, ++ [IPA_ENDPOINT_MODEM_AP_TX] = { ++ .ee_id = GSI_EE_MODEM, ++ .channel_id = 0, ++ .endpoint_id = 5, ++ .toward_ipa = true, ++ .endpoint = { ++ .filter_support = true, ++ }, ++ }, ++ [IPA_ENDPOINT_MODEM_AP_RX] = { ++ .ee_id = GSI_EE_MODEM, ++ .channel_id = 5, ++ .endpoint_id = 18, ++ .toward_ipa = false, ++ }, ++}; ++ ++static const struct ipa_resource ipa_resource_src[] = { ++ [IPA_RESOURCE_TYPE_SRC_PKT_CONTEXTS] = { ++ .limits[IPA_RSRC_GROUP_SRC_UL] = { ++ .min = 3, .max = 255, ++ }, ++ .limits[IPA_RSRC_GROUP_SRC_DL] = { ++ .min = 3, .max = 255, ++ }, ++ .limits[IPA_RSRC_GROUP_SRC_DIAG] = { ++ .min = 1, .max = 255, ++ }, ++ .limits[IPA_RSRC_GROUP_SRC_DMA] = { ++ .min = 1, .max = 255, ++ }, ++ .limits[IPA_RSRC_GROUP_SRC_UC_RX_Q] = { ++ .min = 1, .max = 255, ++ }, ++ }, ++ [IPA_RESOURCE_TYPE_SRC_HDR_SECTORS] = { ++ .limits[IPA_RSRC_GROUP_SRC_UL] = { ++ .min = 0, .max = 255, ++ }, ++ .limits[IPA_RSRC_GROUP_SRC_DL] = { ++ .min = 0, .max = 255, ++ }, ++ .limits[IPA_RSRC_GROUP_SRC_DIAG] = { ++ .min = 0, .max = 255, ++ }, ++ .limits[IPA_RSRC_GROUP_SRC_DMA] = { ++ .min = 0, .max = 255, ++ }, ++ .limits[IPA_RSRC_GROUP_SRC_UC_RX_Q] = { ++ .min = 0, .max = 255, ++ }, ++ }, ++ [IPA_RESOURCE_TYPE_SRC_HDRI1_BUFFER] = { ++ .limits[IPA_RSRC_GROUP_SRC_UL] = { ++ .min = 0, .max = 255, ++ }, ++ .limits[IPA_RSRC_GROUP_SRC_DL] = { ++ .min = 0, .max = 255, ++ }, ++ .limits[IPA_RSRC_GROUP_SRC_DIAG] = { ++ .min = 0, .max = 255, ++ }, ++ .limits[IPA_RSRC_GROUP_SRC_DMA] = { ++ .min = 0, .max = 255, ++ }, ++ .limits[IPA_RSRC_GROUP_SRC_UC_RX_Q] = { ++ .min = 0, .max = 255, ++ }, ++ }, ++ [IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_LISTS] = { ++ .limits[IPA_RSRC_GROUP_SRC_UL] = { ++ .min = 9, .max = 9, ++ }, ++ .limits[IPA_RSRC_GROUP_SRC_DL] = { ++ .min = 14, .max = 14, ++ }, ++ .limits[IPA_RSRC_GROUP_SRC_DIAG] = { ++ .min = 3, .max = 3, ++ }, ++ .limits[IPA_RSRC_GROUP_SRC_DMA] = { ++ .min = 2, .max = 2, ++ }, ++ .limits[IPA_RSRC_GROUP_SRC_UC_RX_Q] = { ++ .min = 4, .max = 4, ++ }, ++ }, ++ [IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_BUFF] = { ++ .limits[IPA_RSRC_GROUP_SRC_UL] = { ++ .min = 14, .max = 14, ++ }, ++ .limits[IPA_RSRC_GROUP_SRC_DL] = { ++ .min = 21, .max = 21, ++ }, ++ .limits[IPA_RSRC_GROUP_SRC_DIAG] = { ++ .min = 4, .max = 4, ++ }, ++ .limits[IPA_RSRC_GROUP_SRC_DMA] = { ++ .min = 4, .max = 4, ++ }, ++ .limits[IPA_RSRC_GROUP_SRC_UC_RX_Q] = { ++ .min = 6, .max = 6, ++ }, ++ }, ++ [IPA_RESOURCE_TYPE_SRC_HDRI2_BUFFERS] = { ++ .limits[IPA_RSRC_GROUP_SRC_UL] = { ++ .min = 0, .max = 255, ++ }, ++ .limits[IPA_RSRC_GROUP_SRC_DL] = { ++ .min = 0, .max = 255, ++ }, ++ .limits[IPA_RSRC_GROUP_SRC_DIAG] = { ++ .min = 0, .max = 255, ++ }, ++ .limits[IPA_RSRC_GROUP_SRC_DMA] = { ++ .min = 0, .max = 255, ++ }, ++ .limits[IPA_RSRC_GROUP_SRC_UC_RX_Q] = { ++ .min = 0, .max = 255, ++ }, ++ }, ++ [IPA_RESOURCE_TYPE_SRC_HPS_DMARS] = { ++ .limits[IPA_RSRC_GROUP_SRC_UL] = { ++ .min = 0, .max = 255, ++ }, ++ .limits[IPA_RSRC_GROUP_SRC_DL] = { ++ .min = 0, .max = 255, ++ }, ++ .limits[IPA_RSRC_GROUP_SRC_DIAG] = { ++ .min = 0, .max = 255, ++ }, ++ .limits[IPA_RSRC_GROUP_SRC_DMA] = { ++ .min = 0, .max = 255, ++ }, ++ .limits[IPA_RSRC_GROUP_SRC_UC_RX_Q] = { ++ .min = 0, .max = 255, ++ }, ++ }, ++ [IPA_RESOURCE_TYPE_SRC_ACK_ENTRIES] = { ++ .limits[IPA_RSRC_GROUP_SRC_UL] = { ++ .min = 19, .max = 19, ++ }, ++ .limits[IPA_RSRC_GROUP_SRC_DL] = { ++ .min = 26, .max = 26, ++ }, ++ .limits[IPA_RSRC_GROUP_SRC_DIAG] = { ++ .min = 5, .max = 5, ++ }, ++ .limits[IPA_RSRC_GROUP_SRC_DMA] = { ++ .min = 5, .max = 5, ++ }, ++ .limits[IPA_RSRC_GROUP_SRC_UC_RX_Q] = { ++ .min = 8, .max = 8, ++ }, ++ }, ++}; ++ ++static const struct ipa_resource ipa_resource_dst[] = { ++ [IPA_RESOURCE_TYPE_DST_DATA_SECTORS] = { ++ .limits[IPA_RSRC_GROUP_DST_UL] = { ++ .min = 3, .max = 3, ++ }, ++ .limits[IPA_RSRC_GROUP_DST_DL] = { ++ .min = 3, .max = 3, ++ }, ++ .limits[IPA_RSRC_GROUP_DST_DIAG_DPL] = { ++ .min = 1, .max = 1, ++ }, ++ .limits[IPA_RSRC_GROUP_DST_Q6ZIP_GENERAL] = { ++ .min = 3, .max = 3, ++ }, ++ .limits[IPA_RSRC_GROUP_DST_Q6ZIP_ENGINE] = { ++ .min = 3, .max = 3, ++ }, ++ }, ++ [IPA_RESOURCE_TYPE_DST_DATA_SECTOR_LISTS] = { ++ .limits[IPA_RSRC_GROUP_DST_UL] = { ++ .min = 0, .max = 255, ++ }, ++ .limits[IPA_RSRC_GROUP_DST_DL] = { ++ .min = 0, .max = 255, ++ }, ++ .limits[IPA_RSRC_GROUP_DST_DIAG_DPL] = { ++ .min = 0, .max = 255, ++ }, ++ .limits[IPA_RSRC_GROUP_DST_DMA] = { ++ .min = 0, .max = 255, ++ }, ++ .limits[IPA_RSRC_GROUP_DST_Q6ZIP_GENERAL] = { ++ .min = 0, .max = 255, ++ }, ++ .limits[IPA_RSRC_GROUP_DST_Q6ZIP_ENGINE] = { ++ .min = 0, .max = 255, ++ }, ++ }, ++ [IPA_RESOURCE_TYPE_DST_DPS_DMARS] = { ++ .limits[IPA_RSRC_GROUP_DST_UL] = { ++ .min = 1, .max = 1, ++ }, ++ .limits[IPA_RSRC_GROUP_DST_DL] = { ++ .min = 1, .max = 1, ++ }, ++ .limits[IPA_RSRC_GROUP_DST_DIAG_DPL] = { ++ .min = 1, .max = 1, ++ }, ++ .limits[IPA_RSRC_GROUP_DST_DMA] = { ++ .min = 1, .max = 1, ++ }, ++ .limits[IPA_RSRC_GROUP_DST_Q6ZIP_GENERAL] = { ++ .min = 1, .max = 1, ++ }, ++ }, ++}; ++ ++static const struct ipa_resource_data ipa_resource_data = { ++ .rsrc_group_src_count = IPA_RSRC_GROUP_SRC_COUNT, ++ .rsrc_group_dst_count = IPA_RSRC_GROUP_DST_COUNT, ++ .resource_src_count = ARRAY_SIZE(ipa_resource_src), ++ .resource_src = ipa_resource_src, ++ .resource_dst_count = ARRAY_SIZE(ipa_resource_dst), ++ .resource_dst = ipa_resource_dst, ++}; ++ ++static const struct ipa_mem ipa_mem_local_data[] = { ++ { ++ .id = IPA_MEM_UC_SHARED, ++ .offset = 0x0000, ++ .size = 0x0080, ++ .canary_count = 0, ++ }, ++ { ++ .id = IPA_MEM_UC_INFO, ++ .offset = 0x0080, ++ .size = 0x0200, ++ .canary_count = 0, ++ }, ++ { ++ .id = IPA_MEM_V4_FILTER_HASHED, ++ .offset = 0x0288, ++ .size = 0x0078, ++ .canary_count = 2, ++ }, ++ { ++ .id = IPA_MEM_V4_FILTER, ++ .offset = 0x0308, ++ .size = 0x0078, ++ .canary_count = 2, ++ }, ++ { ++ .id = IPA_MEM_V6_FILTER_HASHED, ++ .offset = 0x0388, ++ .size = 0x0078, ++ .canary_count = 2, ++ }, ++ { ++ .id = IPA_MEM_V6_FILTER, ++ .offset = 0x0408, ++ .size = 0x0078, ++ .canary_count = 2, ++ }, ++ { ++ .id = IPA_MEM_V4_ROUTE_HASHED, ++ .offset = 0x0488, ++ .size = 0x0078, ++ .canary_count = 2, ++ }, ++ { ++ .id = IPA_MEM_V4_ROUTE, ++ .offset = 0x0508, ++ .size = 0x0078, ++ .canary_count = 2, ++ }, ++ { ++ .id = IPA_MEM_V6_ROUTE_HASHED, ++ .offset = 0x0588, ++ .size = 0x0078, ++ .canary_count = 2, ++ }, ++ { ++ .id = IPA_MEM_V6_ROUTE, ++ .offset = 0x0608, ++ .size = 0x0078, ++ .canary_count = 2, ++ }, ++ { ++ .id = IPA_MEM_MODEM_HEADER, ++ .offset = 0x0688, ++ .size = 0x0140, ++ .canary_count = 2, ++ }, ++ { ++ .id = IPA_MEM_MODEM_PROC_CTX, ++ .offset = 0x07d0, ++ .size = 0x0200, ++ .canary_count = 2, ++ }, ++ { ++ .id = IPA_MEM_AP_PROC_CTX, ++ .offset = 0x09d0, ++ .size = 0x0200, ++ .canary_count = 0, ++ }, ++ { ++ .id = IPA_MEM_MODEM, ++ .offset = 0x0bd8, ++ .size = 0x1424, ++ .canary_count = 0, ++ }, ++ { ++ .id = IPA_MEM_END_MARKER, ++ .offset = 0x2000, ++ .size = 0, ++ .canary_count = 1, ++ }, ++}; ++ ++static const struct ipa_mem_data ipa_mem_data = { ++ .local_count = ARRAY_SIZE(ipa_mem_local_data), ++ .local = ipa_mem_local_data, ++ .imem_addr = 0, ++ .imem_size = 0, ++ .smem_size = 0x00002000, ++}; ++ ++static const struct ipa_power_data ipa_power_data = { ++ .core_clock_rate = 16 * 1000 * 1000, /* Hz */ ++ .interconnect_count = 0, ++ .interconnect_data = NULL, ++}; ++ ++/* Configuration data for SDM660 having IPA v2.6 */ ++const struct ipa_data ipa_data_v2_6 = { ++ .version = IPA_VERSION_2_6, ++ .backward_compat = 0, ++ .qsb_count = ARRAY_SIZE(ipa_qsb_data), ++ .qsb_data = ipa_qsb_data, ++ .modem_route_count = 8, ++ .endpoint_count = ARRAY_SIZE(ipa_gsi_endpoint_data), ++ .endpoint_data = ipa_gsi_endpoint_data, ++ .resource_data = &ipa_resource_data, ++ .mem_data = &ipa_mem_data, ++ .power_data = &ipa_power_data, ++}; +diff --git a/drivers/net/ipa/ipa_cmd.c b/drivers/net/ipa/ipa_cmd.c +index 984311a..b696aad 100644 +--- a/drivers/net/ipa/ipa_cmd.c ++++ b/drivers/net/ipa/ipa_cmd.c +@@ -636,6 +636,9 @@ struct gsi_trans *ipa_cmd_trans_alloc(struct ipa *ipa, u32 tre_count) + /* Init function for immediate commands; there is no ipa_cmd_exit() */ + int ipa_cmd_init(struct ipa *ipa) + { ++ if (ipa->version < IPA_VERSION_3_0) ++ return 0; ++ + ipa_cmd_validate_build(); + + if (!ipa_cmd_header_init_local_valid(ipa)) +diff --git a/drivers/net/ipa/ipa_data.h b/drivers/net/ipa/ipa_data.h +index 3eb9dc2..99d8f57 100644 +--- a/drivers/net/ipa/ipa_data.h ++++ b/drivers/net/ipa/ipa_data.h +@@ -245,6 +245,7 @@ struct ipa_data { + const struct ipa_power_data *power_data; + }; + ++extern const struct ipa_data ipa_data_v2_6; + extern const struct ipa_data ipa_data_v3_1; + extern const struct ipa_data ipa_data_v3_5_1; + extern const struct ipa_data ipa_data_v4_2; +diff --git a/drivers/net/ipa/ipa_endpoint.c b/drivers/net/ipa/ipa_endpoint.c +index 0bd9b9f..65864d3 100644 +--- a/drivers/net/ipa/ipa_endpoint.c ++++ b/drivers/net/ipa/ipa_endpoint.c +@@ -600,6 +600,9 @@ void ipa_endpoint_modem_pause_all(struct ipa *ipa, bool enable) + int ipa_endpoint_modem_exception_reset_all(struct ipa *ipa) + { + struct gsi_trans *trans; ++ ++ if (ipa->version < IPA_VERSION_3_0) ++ return 0; + u32 endpoint_id; + u32 count; + +@@ -1239,6 +1242,11 @@ int ipa_endpoint_skb_tx(struct ipa_endpoint *endpoint, struct sk_buff *skb) + u32 nr_frags; + int ret; + ++ if (endpoint->ipa->version < IPA_VERSION_3_0) { ++ dev_kfree_skb_any(skb); ++ return 0; ++ } ++ + /* Make sure source endpoint's TLV FIFO has enough entries to + * hold the linear portion of the skb and all its fragments. + * If not, see if we can linearize it before giving up. +@@ -1339,6 +1347,9 @@ static void ipa_endpoint_replenish(struct ipa_endpoint *endpoint) + { + struct gsi_trans *trans; + ++ if (endpoint->ipa->version < IPA_VERSION_3_0) ++ return; ++ + if (!test_bit(IPA_REPLENISH_ENABLED, endpoint->replenish_flags)) + return; + +@@ -1760,6 +1771,9 @@ static void ipa_endpoint_reset(struct ipa_endpoint *endpoint) + bool special; + int ret = 0; + ++ if (ipa->version < IPA_VERSION_3_0) ++ return; ++ + /* On IPA v3.5.1, if an RX endpoint is reset while aggregation + * is active, we need to handle things specially to recover. + * All other cases just need to reset the underlying GSI channel. +@@ -1818,6 +1832,11 @@ int ipa_endpoint_enable_one(struct ipa_endpoint *endpoint) + struct gsi *gsi = &ipa->gsi; + int ret; + ++ if (ipa->version < IPA_VERSION_3_0) { ++ __set_bit(endpoint_id, ipa->enabled); ++ return 0; ++ } ++ + ret = gsi_channel_start(gsi, endpoint->channel_id); + if (ret) { + dev_err(ipa->dev, +@@ -1849,6 +1868,9 @@ void ipa_endpoint_disable_one(struct ipa_endpoint *endpoint) + + __clear_bit(endpoint_id, endpoint->ipa->enabled); + ++ if (ipa->version < IPA_VERSION_3_0) ++ return; ++ + if (!endpoint->toward_ipa) { + ipa_endpoint_replenish_disable(endpoint); + ipa_interrupt_suspend_disable(ipa->interrupt, endpoint_id); +@@ -1870,6 +1892,9 @@ void ipa_endpoint_suspend_one(struct ipa_endpoint *endpoint) + if (!test_bit(endpoint->endpoint_id, endpoint->ipa->enabled)) + return; + ++ if (endpoint->ipa->version < IPA_VERSION_3_0) ++ return; ++ + if (!endpoint->toward_ipa) { + ipa_endpoint_replenish_disable(endpoint); + (void)ipa_endpoint_program_suspend(endpoint, true); +@@ -1890,6 +1915,9 @@ void ipa_endpoint_resume_one(struct ipa_endpoint *endpoint) + if (!test_bit(endpoint->endpoint_id, endpoint->ipa->enabled)) + return; + ++ if (endpoint->ipa->version < IPA_VERSION_3_0) ++ return; ++ + if (!endpoint->toward_ipa) + (void)ipa_endpoint_program_suspend(endpoint, false); + +diff --git a/drivers/net/ipa/ipa_interrupt.c b/drivers/net/ipa/ipa_interrupt.c +index 131b9cc..3421d34 100644 +--- a/drivers/net/ipa/ipa_interrupt.c ++++ b/drivers/net/ipa/ipa_interrupt.c +@@ -62,7 +62,7 @@ static void ipa_interrupt_suspend_clear_all(struct ipa_interrupt *interrupt) + val = ioread32(ipa->reg_virt + reg_n_offset(reg, unit)); + + /* SUSPEND interrupt status isn't cleared on IPA version 3.0 */ +- if (!val || ipa->version == IPA_VERSION_3_0) ++ if (!val || ipa->version < IPA_VERSION_3_1) + continue; + + reg = ipa_reg(ipa, IRQ_SUSPEND_CLR); +@@ -202,7 +202,7 @@ static void ipa_interrupt_suspend_control(struct ipa_interrupt *interrupt, + WARN_ON(!test_bit(endpoint_id, ipa->available)); + + /* IPA version 3.0 does not support TX_SUSPEND interrupt control */ +- if (ipa->version == IPA_VERSION_3_0) ++ if (ipa->version < IPA_VERSION_3_1) + return; + + weight = bitmap_weight(interrupt->suspend_enabled, ipa->endpoint_count); +diff --git a/drivers/net/ipa/ipa_main.c b/drivers/net/ipa/ipa_main.c +index 788dd99..f17e613 100644 +--- a/drivers/net/ipa/ipa_main.c ++++ b/drivers/net/ipa/ipa_main.c +@@ -115,6 +115,16 @@ int ipa_setup(struct ipa *ipa) + struct device *dev = ipa->dev; + int ret; + ++ if (ipa->version < IPA_VERSION_3_0) { ++ ret = ipa_qmi_setup(ipa); ++ if (ret) ++ return ret; ++ ++ ipa->setup_complete = true; ++ dev_info(dev, "IPA v2.6 driver setup completed successfully\n"); ++ return 0; ++ } ++ + ret = gsi_setup(&ipa->gsi); + if (ret) + return ret; +@@ -183,6 +193,8 @@ static void ipa_teardown(struct ipa *ipa) + ipa->setup_complete = false; + + ipa_qmi_teardown(ipa); ++ if (ipa->version < IPA_VERSION_3_0) ++ return; + ipa_endpoint_default_route_clear(ipa); + exception_endpoint = ipa->name_map[IPA_ENDPOINT_AP_LAN_RX]; + ipa_endpoint_disable_one(exception_endpoint); +@@ -637,6 +649,14 @@ static int ipa_firmware_load(struct device *dev) + } + + static const struct of_device_id ipa_match[] = { ++ { ++ .compatible = "qcom,sdm660-ipa", ++ .data = &ipa_data_v2_6, ++ }, ++ { ++ .compatible = "qcom,ipa-v2.6", ++ .data = &ipa_data_v2_6, ++ }, + { + .compatible = "qcom,msm8998-ipa", + .data = &ipa_data_v3_1, +@@ -811,7 +831,10 @@ static int ipa_probe(struct platform_device *pdev) + return -EINVAL; + } + +- loader = ipa_firmware_loader(dev); ++ if (data->version < IPA_VERSION_3_0) ++ loader = IPA_LOADER_SKIP; ++ else ++ loader = ipa_firmware_loader(dev); + if (loader == IPA_LOADER_INVALID) + return -EINVAL; + if (loader == IPA_LOADER_DEFER) +@@ -860,10 +883,12 @@ static int ipa_probe(struct platform_device *pdev) + if (ret) + goto err_mem_exit; + +- ret = gsi_init(&ipa->gsi, pdev, ipa->version, data->endpoint_count, +- data->endpoint_data); +- if (ret) +- goto err_mem_exit; ++ if (ipa->version >= IPA_VERSION_3_0) { ++ ret = gsi_init(&ipa->gsi, pdev, ipa->version, data->endpoint_count, ++ data->endpoint_data); ++ if (ret) ++ goto err_mem_exit; ++ } + + /* Result is a non-zero mask of endpoints that support filtering */ + ret = ipa_endpoint_init(ipa, data->endpoint_count, data->endpoint_data); +@@ -875,8 +900,14 @@ static int ipa_probe(struct platform_device *pdev) + goto err_endpoint_exit; + + ret = ipa_smp2p_init(ipa, pdev, loader == IPA_LOADER_MODEM); +- if (ret) +- goto err_table_exit; ++ if (ret) { ++ if (ipa->version < IPA_VERSION_3_0) { ++ ipa->smp2p = NULL; ++ ret = 0; ++ } else { ++ goto err_table_exit; ++ } ++ } + + /* Power needs to be active for config and setup */ + ret = pm_runtime_get_sync(dev); +@@ -921,7 +952,8 @@ static int ipa_probe(struct platform_device *pdev) + err_endpoint_exit: + ipa_endpoint_exit(ipa); + err_gsi_exit: +- gsi_exit(&ipa->gsi); ++ if (ipa->version >= IPA_VERSION_3_0) ++ gsi_exit(&ipa->gsi); + err_mem_exit: + ipa_mem_exit(ipa); + err_reg_exit: +@@ -987,7 +1019,8 @@ static void ipa_remove(struct platform_device *pdev) + ipa_smp2p_exit(ipa); + ipa_table_exit(ipa); + ipa_endpoint_exit(ipa); +- gsi_exit(&ipa->gsi); ++ if (ipa->version >= IPA_VERSION_3_0) ++ gsi_exit(&ipa->gsi); + ipa_mem_exit(ipa); + ipa_reg_exit(ipa); + kfree(ipa); +diff --git a/drivers/net/ipa/ipa_mem.c b/drivers/net/ipa/ipa_mem.c +index 078d32a..a044c7a 100644 +--- a/drivers/net/ipa/ipa_mem.c ++++ b/drivers/net/ipa/ipa_mem.c +@@ -78,6 +78,9 @@ ipa_mem_zero_region_add(struct gsi_trans *trans, enum ipa_mem_id mem_id) + int ipa_mem_setup(struct ipa *ipa) + { + dma_addr_t addr = ipa->zero_addr; ++ ++ if (ipa->version < IPA_VERSION_3_0) ++ return 0; + const struct ipa_mem *mem; + struct gsi_trans *trans; + const struct reg *reg; +@@ -418,6 +421,9 @@ int ipa_mem_zero_modem(struct ipa *ipa) + { + struct gsi_trans *trans; + ++ if (ipa->version < IPA_VERSION_3_0) ++ return 0; ++ + /* Get a transaction to zero the modem memory, modem header, + * and modem processing context regions. + */ +diff --git a/drivers/net/ipa/ipa_power.c b/drivers/net/ipa/ipa_power.c +index c572da9..b2c75b0 100644 +--- a/drivers/net/ipa/ipa_power.c ++++ b/drivers/net/ipa/ipa_power.c +@@ -128,7 +128,8 @@ static int ipa_runtime_suspend(struct device *dev) + /* Endpoints aren't usable until setup is complete */ + if (ipa->setup_complete) { + ipa_endpoint_suspend(ipa); +- gsi_suspend(&ipa->gsi); ++ if (ipa->version >= IPA_VERSION_3_0) ++ gsi_suspend(&ipa->gsi); + } + + ipa_power_disable(ipa); +@@ -147,7 +148,8 @@ static int ipa_runtime_resume(struct device *dev) + + /* Endpoints aren't usable until setup is complete */ + if (ipa->setup_complete) { +- gsi_resume(&ipa->gsi); ++ if (ipa->version >= IPA_VERSION_3_0) ++ gsi_resume(&ipa->gsi); + ipa_endpoint_resume(ipa); + } + +diff --git a/drivers/net/ipa/ipa_reg.c b/drivers/net/ipa/ipa_reg.c +index 30bd69f..46a72c0 100644 +--- a/drivers/net/ipa/ipa_reg.c ++++ b/drivers/net/ipa/ipa_reg.c +@@ -110,6 +110,7 @@ const struct reg *ipa_reg(struct ipa *ipa, enum ipa_reg_id reg_id) + static const struct regs *ipa_regs(enum ipa_version version) + { + switch (version) { ++ case IPA_VERSION_2_6: + case IPA_VERSION_3_1: + return &ipa_regs_v3_1; + case IPA_VERSION_3_5_1: +diff --git a/drivers/net/ipa/ipa_smp2p.c b/drivers/net/ipa/ipa_smp2p.c +index 331c00a..9131f88 100644 +--- a/drivers/net/ipa/ipa_smp2p.c ++++ b/drivers/net/ipa/ipa_smp2p.c +@@ -209,7 +209,7 @@ static void ipa_smp2p_power_release(struct ipa *ipa) + { + struct device *dev = ipa->dev; + +- if (!ipa->smp2p->power_on) ++ if (!ipa->smp2p || !ipa->smp2p->power_on) + return; + + (void)pm_runtime_put_autosuspend(dev); +@@ -309,6 +309,9 @@ void ipa_smp2p_exit(struct ipa *ipa) + { + struct ipa_smp2p *smp2p = ipa->smp2p; + ++ if (!smp2p) ++ return; ++ + if (smp2p->setup_ready_irq) + ipa_smp2p_irq_exit(smp2p, smp2p->setup_ready_irq); + ipa_smp2p_panic_notifier_unregister(smp2p); +@@ -326,7 +329,7 @@ void ipa_smp2p_irq_disable_setup(struct ipa *ipa) + { + struct ipa_smp2p *smp2p = ipa->smp2p; + +- if (!smp2p->setup_ready_irq) ++ if (!smp2p || !smp2p->setup_ready_irq) + return; + + mutex_lock(&smp2p->mutex); +@@ -345,7 +348,7 @@ void ipa_smp2p_notify_reset(struct ipa *ipa) + struct ipa_smp2p *smp2p = ipa->smp2p; + u32 mask; + +- if (!smp2p->notified) ++ if (!smp2p || !smp2p->notified) + return; + + ipa_smp2p_power_release(ipa); +diff --git a/drivers/net/ipa/ipa_sysfs.c b/drivers/net/ipa/ipa_sysfs.c +index 8b805a9..317bbc5 100644 +--- a/drivers/net/ipa/ipa_sysfs.c ++++ b/drivers/net/ipa/ipa_sysfs.c +@@ -13,6 +13,8 @@ + static const char *ipa_version_string(struct ipa *ipa) + { + switch (ipa->version) { ++ case IPA_VERSION_2_6: ++ return "2.6"; + case IPA_VERSION_3_0: + return "3.0"; + case IPA_VERSION_3_1: +diff --git a/drivers/net/ipa/ipa_table.c b/drivers/net/ipa/ipa_table.c +index 4e4a3f8..d664feb 100644 +--- a/drivers/net/ipa/ipa_table.c ++++ b/drivers/net/ipa/ipa_table.c +@@ -332,6 +332,9 @@ void ipa_table_reset(struct ipa *ipa, bool modem) + const char *ee_name; + int ret; + ++ if (ipa->version < IPA_VERSION_3_0) ++ return; ++ + ee_name = modem ? "modem" : "AP"; + + /* Report errors, but reset filter and route tables */ +@@ -349,6 +352,9 @@ void ipa_table_reset(struct ipa *ipa, bool modem) + int ipa_table_hash_flush(struct ipa *ipa) + { + struct gsi_trans *trans; ++ ++ if (ipa->version < IPA_VERSION_3_0) ++ return 0; + const struct reg *reg; + u32 val; + +@@ -455,6 +461,9 @@ int ipa_table_setup(struct ipa *ipa) + { + struct gsi_trans *trans; + ++ if (ipa->version < IPA_VERSION_3_0) ++ return 0; ++ + /* We will need at most 8 TREs: + * - IPv4: + * - One for route table initialization (non-hashed and hashed) +diff --git a/drivers/net/ipa/ipa_version.h b/drivers/net/ipa/ipa_version.h +index c157c72..e683643 100644 +--- a/drivers/net/ipa/ipa_version.h ++++ b/drivers/net/ipa/ipa_version.h +@@ -31,6 +31,7 @@ + * Please update ipa_version_string() whenever a new version is added. + */ + enum ipa_version { ++ IPA_VERSION_2_6, + IPA_VERSION_3_0, + IPA_VERSION_3_1, + IPA_VERSION_3_5, diff --git a/ports/candidate/linux-postmarketos-qcom-sdm660/APKBUILD b/ports/candidate/linux-postmarketos-qcom-sdm660/APKBUILD index 914d47f..bd249ab 100644 --- a/ports/candidate/linux-postmarketos-qcom-sdm660/APKBUILD +++ b/ports/candidate/linux-postmarketos-qcom-sdm660/APKBUILD @@ -3,7 +3,7 @@ maintainer="Alexey Minnekhanov " _flavor="postmarketos-qcom-sdm660" pkgname=linux-$_flavor pkgver=7.2.12 -pkgrel=14 +pkgrel=15 pkgdesc="Close to mainline linux kernel for Qualcomm Snapdragon 660 SoC" arch="aarch64" url="https://kernel.org/" @@ -78,6 +78,8 @@ source=" stable-7.2.9-10.patch stable-7.2.10-11.patch stable-7.2.11-12.patch + 0042-arm64-dts-sdm660-add-ipa-v2-node.patch + 0043-net-ipa-add-support-for-ipa-v2.6-and-sdm660.patch " _carch="arm64" @@ -175,4 +177,6 @@ e34cc3b376501b8db887eeb79950adb84906641062ef0e60a9bdbedb3b43e956dd5c56f1967df8ad be7770c858be5b7b559b959fc6f50ca6d94a7f518ee67c8e675e01ab583fc043c10cbeb6971079a13394a981f8153906839cdf409fef6f4279709ecc93495eff stable-7.2.9-10.patch d2449e4c02bf11835d20bd9c841a3b0db78ba14ebe2effaec04d98db63ea4dc41a552d23db8ae72e10d2675d1b20570f06a250c790dc773f95f0be4a14c706e9 stable-7.2.10-11.patch eb3b89ac99648776f193ee3c9d96d257f7d2e6ba5200a526e63c97e7dc4982e4b2985f15481aa4314dc54ca5f0bafb395b4f4fc375ed4fba2b8d9ca23124cd31 stable-7.2.11-12.patch +54b1ebb7ea3cbb4b4d18eb54da10a324214a973ecee756627012995a1441f70059b383f0c11f56fd5dcab031676a4727ea38aec9d9d4fd7a6ee07f29c17c1cb4 0042-arm64-dts-sdm660-add-ipa-v2-node.patch +d5ed533b606138d9f5dff5c04054c01e6d8aee0fee96c54509ade2f593ee6ea806ce57a6fb8ac3783d75407b7bf2ac8830a294c65b070d46190f246e97af1be5 0043-net-ipa-add-support-for-ipa-v2.6-and-sdm660.patch " diff --git a/project/sources.lock.json b/project/sources.lock.json index 14aa9b9..38016f8 100644 --- a/project/sources.lock.json +++ b/project/sources.lock.json @@ -16,7 +16,7 @@ "candidate": { "ports": "ports/candidate", "kernel": "7.2.12", - "kernel_package": "7.2.12-r14", + "kernel_package": "7.2.12-r15", "device_package": "5-r31", "firmware_package": "2-r5" }