From patchwork Mon Mar 1 16:25:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Poulain X-Patchwork-Id: 388641 Delivered-To: patch@linaro.org Received: by 2002:a02:290e:0:0:0:0:0 with SMTP id p14csp3484234jap; Mon, 1 Mar 2021 08:18:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJw6Cv4lUBm0gAcdDSQjCSEZHc0p2X3YqO4SI/NkAthqCozal3wgUZxJYHD6BfODXs1r8OZt X-Received: by 2002:a05:6402:1118:: with SMTP id u24mr17325105edv.386.1614615523220; Mon, 01 Mar 2021 08:18:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614615523; cv=none; d=google.com; s=arc-20160816; b=ePlEUc/7AhcPdq4QAjtKuYq5pXxQgZI9dKSBpm6igF7LKJ/wcmIleuUZY43sDMlKFS 3iZnqk90jhCpeB5q/JJOLl6q0p0e1WJhYA7eM6p1KyyqA/OptGfNKWoKCvvHY6J+45we 5y1r1jaI1m8N6FRd64033pdCUdTCkmGXh1isHUfWg0UAf2HHQucOIuvnm9zxeIrErbm+ BuJ1IBemXQh3aADIpQ5KjTMXMIZOraK27Cr5P0xM0cdmsqo8keRzZ/LjYrcFelpA0pF9 +Z6nRybSXMB4yyYUXkgnyL4Kw3C+tGX04lvxqChgwq8T2q3Tj2DCIce8HYlgJup+YZBm /FCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=KS1kq5BuDgV8Wc46EkUvtnfUv9ANjYiniYKfO7WViLw=; b=tF0EbYDMQg782oJPbo47+1Mv+lLFBffAFmBr/0Zl01ns3nHYYNbHdw1fKyzXfV15Rb +F5f51bKUhIibrLjGS/nFYsEOFyfi72jciiLxTSun9+HW0nlLBjfRA+PoJC0PoLZ2WW/ fq80N5k5/FcDUklV2CGetGMeQbh6ngA0q8cL5IBVIhSAuOWROHF1jVh6ZXDg+CkxUU5Q xRIuiv0LnbcsymE6r+Pni8iu1J59yaTGe7hWFgZLxMyNY6J52DTIq2Dr0bGea+utgJSK iWte+7/gI2bV7NWg4sX8VcSckAydCFWSww7o+L3pLFtWAaJhXNtmlblqhSEnD5yF/D/+ qUtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dkoq2PHU; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z21si12194404edx.208.2021.03.01.08.18.43; Mon, 01 Mar 2021 08:18:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dkoq2PHU; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237707AbhCAQS3 (ORCPT + 16 others); Mon, 1 Mar 2021 11:18:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237693AbhCAQRq (ORCPT ); Mon, 1 Mar 2021 11:17:46 -0500 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 511E7C061788 for ; Mon, 1 Mar 2021 08:17:01 -0800 (PST) Received: by mail-wr1-x42d.google.com with SMTP id v15so16778980wrx.4 for ; Mon, 01 Mar 2021 08:17:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=KS1kq5BuDgV8Wc46EkUvtnfUv9ANjYiniYKfO7WViLw=; b=dkoq2PHUQCwQ+BbYuNhiw8oRtMRCC9upZdkuD4YRCYLqkzwWM+Epo3GUX7MGe1wNAE VQKjOhHAvZ7HeVunsWflUMe9XYdTO84I/4xpGKuMxTw8kZdHyJ842gai5czYtRwf+VJ7 T4gcK3FPj/DrJ1ok2RcV/l8VrUTLKGET6ecH902iyb4WoVVEXy7zl7h4tp9VBXcEGZGV PxOot7x1shIUF70VFbtk6bbRxb9XFOh2aFOvsoa64ivoSCUKqgkNrZGaaW1dd9OSHyUv OQqip94KGsrqdomAitk4xEmGMSVkc2LXhsWF4DgodSs9dSE63aKIzIas/fo00fMbHNBR ubqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=KS1kq5BuDgV8Wc46EkUvtnfUv9ANjYiniYKfO7WViLw=; b=HZVwKneIcPCH1IIWEC7zH6WZifOq7UdozxidrVX91l+xap+sHX0eG3rFpgdqntv2TF XO07kaLz5Vb1FtjYTOzCO5vFXJtVtURO40+C/AmRqu45uxk7vBDsO1YxVmVgboYhqHZw lgFlFaATnb1TAIRU4UjYUNtiSdaYI/sh34UPgH+g5xq3CCav5fQP67vjpqV/oJCaOoZg 7rU5g1Y3QGMif1qc1MTFSSFRp64+FOj89Ym66rdmZmTmQ0Y3gdc9jXanRh4J+siGhCsA 9KHEf4dGxV6gsDD+7EdCI3pavPPgaFV4PPTtKJSJW60E8chtaK77xBeg5Hnv/f8XQkUk V0mA== X-Gm-Message-State: AOAM530PSd5eNxgn+7vZSTX8X7JE2PbN2IKI8p3EfqK3AYZrxjWcQy2z Ro5o4PMAcvDRo/CapbjdjGoy3Q== X-Received: by 2002:a05:6000:c9:: with SMTP id q9mr18459818wrx.338.1614615420016; Mon, 01 Mar 2021 08:17:00 -0800 (PST) Received: from localhost.localdomain ([2a01:e0a:82c:5f0:5a20:c00c:6ec3:cc84]) by smtp.gmail.com with ESMTPSA id w6sm3919789wrl.49.2021.03.01.08.16.58 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Mar 2021 08:16:59 -0800 (PST) From: Loic Poulain To: manivannan.sadhasivam@linaro.org, hemantk@codeaurora.org Cc: linux-arm-msm@vger.kernel.org, Loic Poulain Subject: [PATCH 2/6] mhi: pci_generic: Introduce quectel EM1XXGR-L support Date: Mon, 1 Mar 2021 17:25:07 +0100 Message-Id: <1614615911-18794-2-git-send-email-loic.poulain@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1614615911-18794-1-git-send-email-loic.poulain@linaro.org> References: <1614615911-18794-1-git-send-email-loic.poulain@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Add support for EM1XXGR-L modems, this modem series is based on SDX24 qcom chip. The modem is mainly based on MBIM protocol for both the data and control path. The drivers for these channels (mhi-net-mbim and mhi_uci) are not yet part of the kernel but will be integrated by different series. Signed-off-by: Loic Poulain --- drivers/bus/mhi/pci_generic.c | 73 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) -- 2.7.4 Reviewed-by: Manivannan Sadhasivam diff --git a/drivers/bus/mhi/pci_generic.c b/drivers/bus/mhi/pci_generic.c index c58bf96..00a0410 100644 --- a/drivers/bus/mhi/pci_generic.c +++ b/drivers/bus/mhi/pci_generic.c @@ -114,6 +114,36 @@ struct mhi_pci_dev_info { .doorbell_mode_switch = true, \ } +#define MHI_CHANNEL_CONFIG_UL_SBL(ch_num, ch_name, el_count, ev_ring) \ + { \ + .num = ch_num, \ + .name = ch_name, \ + .num_elements = el_count, \ + .event_ring = ev_ring, \ + .dir = DMA_TO_DEVICE, \ + .ee_mask = BIT(MHI_EE_SBL), \ + .pollcfg = 0, \ + .doorbell = MHI_DB_BRST_DISABLE, \ + .lpm_notify = false, \ + .offload_channel = false, \ + .doorbell_mode_switch = false, \ + } \ + +#define MHI_CHANNEL_CONFIG_DL_SBL(ch_num, ch_name, el_count, ev_ring) \ + { \ + .num = ch_num, \ + .name = ch_name, \ + .num_elements = el_count, \ + .event_ring = ev_ring, \ + .dir = DMA_FROM_DEVICE, \ + .ee_mask = BIT(MHI_EE_SBL), \ + .pollcfg = 0, \ + .doorbell = MHI_DB_BRST_DISABLE, \ + .lpm_notify = false, \ + .offload_channel = false, \ + .doorbell_mode_switch = false, \ + } + #define MHI_EVENT_CONFIG_DATA(ev_ring, el_count) \ { \ .num_elements = el_count, \ @@ -182,9 +212,52 @@ static const struct mhi_pci_dev_info mhi_qcom_sdx55_info = { .dma_data_width = 32 }; +static const struct mhi_channel_config mhi_quectel_em1xx_channels[] = { + MHI_CHANNEL_CONFIG_UL(0, "NMEA", 32, 0), + MHI_CHANNEL_CONFIG_DL(1, "NMEA", 32, 0), + MHI_CHANNEL_CONFIG_UL_SBL(2, "SAHARA", 32, 0), + MHI_CHANNEL_CONFIG_DL_SBL(3, "SAHARA", 32, 0), + MHI_CHANNEL_CONFIG_UL(4, "DIAG", 32, 1), + MHI_CHANNEL_CONFIG_DL(5, "DIAG", 32, 1), + MHI_CHANNEL_CONFIG_UL(12, "MBIM", 32, 0), + MHI_CHANNEL_CONFIG_DL(13, "MBIM", 32, 0), + MHI_CHANNEL_CONFIG_UL(32, "DUN", 32, 0), + MHI_CHANNEL_CONFIG_DL(33, "DUN", 32, 0), + MHI_CHANNEL_CONFIG_HW_UL(100, "IP_HW0_MBIM", 128, 2), + MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0_MBIM", 128, 3), +}; + +static struct mhi_event_config mhi_quectel_em1xx_events[] = { + MHI_EVENT_CONFIG_CTRL(0, 128), + MHI_EVENT_CONFIG_DATA(1, 128), + MHI_EVENT_CONFIG_HW_DATA(2, 1024, 100), + MHI_EVENT_CONFIG_HW_DATA(3, 1024, 101) +}; + +static struct mhi_controller_config modem_quectel_em1xx_config = { + .max_channels = 128, + .timeout_ms = 8000, + .num_channels = ARRAY_SIZE(mhi_quectel_em1xx_channels), + .ch_cfg = mhi_quectel_em1xx_channels, + .num_events = ARRAY_SIZE(mhi_quectel_em1xx_events), + .event_cfg = mhi_quectel_em1xx_events, +}; + +static const struct mhi_pci_dev_info mhi_quectel_em1xx_info = { + .name = "quectel-em1xx", + .edl = "qcom/prog_firehose_sdx24.mbn", + .config = &modem_quectel_em1xx_config, + .bar_num = MHI_PCI_DEFAULT_BAR_NUM, + .dma_data_width = 32 +}; + static const struct pci_device_id mhi_pci_id_table[] = { { PCI_DEVICE(PCI_VENDOR_ID_QCOM, 0x0306), .driver_data = (kernel_ulong_t) &mhi_qcom_sdx55_info }, + { PCI_DEVICE(0x1eac, 0x1001), /* EM120R-GL (sdx24) */ + .driver_data = (kernel_ulong_t) &mhi_quectel_em1xx_info }, + { PCI_DEVICE(0x1eac, 0x1002), /* EM160R-GL (sdx24) */ + .driver_data = (kernel_ulong_t) &mhi_quectel_em1xx_info }, { } }; MODULE_DEVICE_TABLE(pci, mhi_pci_id_table);