From patchwork Mon Feb 28 22:53:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 12763860 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3ADFCC4167D for ; Mon, 28 Feb 2022 22:58:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231657AbiB1W7d (ORCPT ); Mon, 28 Feb 2022 17:59:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231569AbiB1W7b (ORCPT ); Mon, 28 Feb 2022 17:59:31 -0500 Received: from mo4-p01-ob.smtp.rzone.de (mo4-p01-ob.smtp.rzone.de [85.215.255.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB10DA41B2; Mon, 28 Feb 2022 14:58:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1646088947; s=strato-dkim-0002; d=gerhold.net; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=6QtiDtoRb+0unR4ATY8ygChkhFlrPo5rBKJ8ZschNIs=; b=p5DfGdrYhWDRnNfYEDTPR3zctNZ76/M3aAAAsYbcTjXvo1vB+qWuQEeTHvSls2DZ9Z aYEhSY6Z38UtvrEGm0YNGvsdvgg0i78obnvQ5LCCOKS5/wWzpOa4lL/rjo1zgE5UC8Y3 qBJNMqYbGHlfdKJEOCN64HodvKezN0zwcabTOiGMr9bBOBzucMsHlHzJAG3YvoWALE9m 9sf93jUbDI0Xu4uqrHROZlL0jnph+g8lW0bBy133qhRg1/ErpSgtbt+1UhpcIpANZh5Y wZ03NRAk8V/mttcT9wSjR1LcoZch7AdmeaVhxIACcMfJe2b067+fziyE82R6UE4Ox/Ms l9+Q== Authentication-Results: strato.com; dkim=none X-RZG-AUTH: ":P3gBZUipdd93FF5ZZvYFPugejmSTVR2nRPhVORvLd4SsytBXQ7UOGqRde+a0fyL/oVo=" X-RZG-CLASS-ID: mo00 Received: from droid.. by smtp.strato.de (RZmta 47.40.1 AUTH) with ESMTPSA id kdc58dy1SMtlWqF (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Mon, 28 Feb 2022 23:55:47 +0100 (CET) From: Stephan Gerhold To: Bjorn Andersson Cc: Andy Gross , linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, Mathieu Poirier , linux-remoteproc@vger.kernel.org, phone-devel@vger.kernel.org, Aleksander Morgado , Stephan Gerhold Subject: [PATCH v2 1/2] remoteproc: qcom_q6v5_mss: Create platform device for BAM-DMUX Date: Mon, 28 Feb 2022 23:53:59 +0100 Message-Id: <20220228225400.146555-2-stephan@gerhold.net> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220228225400.146555-1-stephan@gerhold.net> References: <20220228225400.146555-1-stephan@gerhold.net> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org The modem remoteproc on older Qualcomm SoCs (e.g. MSM8916 and MSM8974) implements the BAM-DMUX protocol to allow access to the network data channels of the modem. The hardware/firmware resources required to implement the BAM-DMUX driver are described in an extra node in the device tree (with the compatible "qcom,bam-dmux"). This node logically belongs below the modem remoteproc, so that both control interfaces (rpmsg_wwan_ctrl) and network interfaces (bam_dmux) have a common parent. Unlike other child devices of the modem remoteproc, the bam-dmux device currently does not follow the state of the remoteproc (i.e. it is not added/removed when the remoteproc is started/stopped). However, this is an implementation detail of the bam_dmux driver in Linux that might change in the future. To be flexible for future changes, create a standard platform device specifically only for "qcom,bam-dmux", rather than populating all child nodes. This is also more consistent with the way the other child nodes are handled in the driver. Note: of_platform_device_create() and of_node_put() have NULL-checks internally, so there is no need to check if the "qcom,bam-dmux" node actually exists in the device tree. Signed-off-by: Stephan Gerhold --- Changes in v2: - Avoid using of_platform_populate() and create platform device specifically only for "qcom,bam-dmux". --- drivers/remoteproc/qcom_q6v5_mss.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/remoteproc/qcom_q6v5_mss.c b/drivers/remoteproc/qcom_q6v5_mss.c index a2c231a17b2b..b2e57981de2c 100644 --- a/drivers/remoteproc/qcom_q6v5_mss.c +++ b/drivers/remoteproc/qcom_q6v5_mss.c @@ -218,6 +218,7 @@ struct q6v5 { struct qcom_rproc_subdev smd_subdev; struct qcom_rproc_ssr ssr_subdev; struct qcom_sysmon *sysmon; + struct platform_device *bam_dmux; bool need_mem_protection; bool has_alt_reset; bool has_mba_logs; @@ -1847,6 +1848,7 @@ static int q6v5_alloc_memory_region(struct q6v5 *qproc) static int q6v5_probe(struct platform_device *pdev) { const struct rproc_hexagon_res *desc; + struct device_node *node; struct q6v5 *qproc; struct rproc *rproc; const char *mba_image; @@ -1990,6 +1992,10 @@ static int q6v5_probe(struct platform_device *pdev) if (ret) goto remove_sysmon_subdev; + node = of_get_compatible_child(pdev->dev.of_node, "qcom,bam-dmux"); + qproc->bam_dmux = of_platform_device_create(node, NULL, &pdev->dev); + of_node_put(node); + return 0; remove_sysmon_subdev: @@ -2011,6 +2017,8 @@ static int q6v5_remove(struct platform_device *pdev) struct q6v5 *qproc = platform_get_drvdata(pdev); struct rproc *rproc = qproc->rproc; + if (qproc->bam_dmux) + of_platform_device_destroy(&qproc->bam_dmux->dev, NULL); rproc_del(rproc); qcom_q6v5_deinit(&qproc->q6v5); From patchwork Mon Feb 28 22:54:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 12763859 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 906D3C43219 for ; Mon, 28 Feb 2022 22:58:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231654AbiB1W7d (ORCPT ); Mon, 28 Feb 2022 17:59:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229895AbiB1W7b (ORCPT ); Mon, 28 Feb 2022 17:59:31 -0500 X-Greylist: delayed 179 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Mon, 28 Feb 2022 14:58:50 PST Received: from mo4-p02-ob.smtp.rzone.de (mo4-p02-ob.smtp.rzone.de [85.215.255.80]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8EE419D07D; Mon, 28 Feb 2022 14:58:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1646088948; s=strato-dkim-0002; d=gerhold.net; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=dqH8VpKpHp6Ppb3BmpkraxlbOG5eMMt8r+ipCo9yp6E=; b=MkHeIQiJesf3XeP1Cey8nnMxMbEQs1y+L9AVlrFHRCKKnlyNl37NmqdpimGrj0Jq5v 9g1S4GQ4vX8g0EROqv9hScmXX/LkpEn6WuNEKNRVeamVpkUk8UTGOtRHxHeoTeMFvd2R 7SnAcNwWPjR7vjoUVI33OU7AqF/xZbcirEUeOkmgdoT2ah+1D7a4Rwdzm7dcqCTX5xf9 /lMQGZnHDvpv+nUNTg17W6v8mvHLJns0ZILnu0oZAUsCPyiBs1e07OVHijXVEO5gLWrO 1j8OJ92OMkyA9+VnJn+PKJ70jLv/5TVW9j0//u/5nGLN5yzgPAWwMQ9MrsFQgXWSghjY NoGg== Authentication-Results: strato.com; dkim=none X-RZG-AUTH: ":P3gBZUipdd93FF5ZZvYFPugejmSTVR2nRPhVORvLd4SsytBXQ7UOGqRde+a0fyL/oVo=" X-RZG-CLASS-ID: mo00 Received: from droid.. by smtp.strato.de (RZmta 47.40.1 AUTH) with ESMTPSA id kdc58dy1SMtlWqG (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Mon, 28 Feb 2022 23:55:47 +0100 (CET) From: Stephan Gerhold To: Bjorn Andersson Cc: Andy Gross , linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, Mathieu Poirier , linux-remoteproc@vger.kernel.org, phone-devel@vger.kernel.org, Aleksander Morgado , Stephan Gerhold Subject: [PATCH v2 2/2] arm64: dts: qcom: msm8916: Add BAM-DMUX for WWAN network interfaces Date: Mon, 28 Feb 2022 23:54:00 +0100 Message-Id: <20220228225400.146555-3-stephan@gerhold.net> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220228225400.146555-1-stephan@gerhold.net> References: <20220228225400.146555-1-stephan@gerhold.net> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org The BAM Data Multiplexer provides access to the network data channels of modems integrated into many older Qualcomm SoCs, including MSM8916. Add the nodes for the BAM DMA engine and BAM-DMUX to enable using WWAN on smartphones/tablets based on MSM8916. This should work out of the box with open-source WWAN userspace such as ModemManager. The nodes are disabled by default to avoid loading unnecessary drivers on devices that cannot use BAM-DMUX (e.g. DragonBoard 410c). However, strictly speaking the nodes could be enabled by default since both the bam_dma and bam_dmux driver will simply do nothing if the modem does not announce any BAM-DMUX channels. Signed-off-by: Stephan Gerhold --- Changes in v2: None. --- arch/arm64/boot/dts/qcom/msm8916.dtsi | 30 +++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/msm8916.dtsi b/arch/arm64/boot/dts/qcom/msm8916.dtsi index 0a0be43529f6..26b321d2dca1 100644 --- a/arch/arm64/boot/dts/qcom/msm8916.dtsi +++ b/arch/arm64/boot/dts/qcom/msm8916.dtsi @@ -1314,6 +1314,20 @@ spmi_bus: spmi@200f000 { #interrupt-cells = <4>; }; + bam_dmux_dma: dma-controller@4044000 { + compatible = "qcom,bam-v1.7.0"; + reg = <0x04044000 0x19000>; + interrupts = ; + #dma-cells = <1>; + qcom,ee = <0>; + + num-channels = <6>; + qcom,num-ees = <1>; + qcom,powered-remotely; + + status = "disabled"; + }; + mpss: remoteproc@4080000 { compatible = "qcom,msm8916-mss-pil", "qcom,q6v5-pil"; reg = <0x04080000 0x100>, @@ -1357,6 +1371,22 @@ mpss { memory-region = <&mpss_mem>; }; + bam_dmux: bam-dmux { + compatible = "qcom,bam-dmux"; + + interrupt-parent = <&hexagon_smsm>; + interrupts = <1 IRQ_TYPE_EDGE_BOTH>, <11 IRQ_TYPE_EDGE_BOTH>; + interrupt-names = "pc", "pc-ack"; + + qcom,smem-states = <&apps_smsm 1>, <&apps_smsm 11>; + qcom,smem-state-names = "pc", "pc-ack"; + + dmas = <&bam_dmux_dma 4>, <&bam_dmux_dma 5>; + dma-names = "tx", "rx"; + + status = "disabled"; + }; + smd-edge { interrupts = ;