Skip to contentSkip to conversation

Enable BAM-DMUX/WWAN on Qualcomm MSM8916

PATCH Superseded Stephan Gerhold 2 participants 5 messages Nov 29, 2021 – Dec 1, 2021

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Enable BAM-DMUX/WWAN on Qualcomm MSM8916

This series enables using mobile Internet/WWAN on devices based on Qualcomm MSM8916. The network driver for that was applied earlier today to net-next. [1]

The device tree node of BAM-DMUX does not have any own memory resources. It just bundles resources from other hardware blocks. It could be added to the device tree root node, but it logically belongs below the modem remote processor.

To allow adding it there, the qcom_q6v5_mss driver is modified slightly to populate additional devices from the device tree. Finally, the necessary nodes are added to the MSM8916 device tree.

[1]: https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=688e075748645b43cf4d55e8fd279f5249699b7a

Stephan Gerhold (2):
remoteproc: qcom_q6v5_mss: Populate additional devices from DT
arm64: dts: qcom: msm8916: Add BAM-DMUX for WWAN network interfaces

 arch/arm64/boot/dts/qcom/msm8916.dtsi | 30 +++++++++++++++++++++++++++
 drivers/remoteproc/qcom_q6v5_mss.c    |  7 +++++++
 2 files changed, 37 insertions(+)
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/2 remoteproc: qcom_q6v5_mss: Populate additional devices from DT

Some devices without own memory resources could be placed anywhere in the device tree but they logically belong to the modem remote processor. Make it possible to probe them when defined under the mpss device tree node by calling of_platform_populate().

This can be used for BAM-DMUX for example, which provides the WWAN network interfaces on some older Qualcomm SoCs such as MSM8916 or MSM8974.

---
 drivers/remoteproc/qcom_q6v5_mss.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/remoteproc/qcom_q6v5_mss.c +7 -0
index 43ea8455546c..69f3d1ebf1f1 100644
@@ -1989,8 +1989,14 @@ static int q6v5_probe(struct platform_device *pdev)
 	if (ret)
 		goto remove_sysmon_subdev;
 
+	ret = of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev);
+	if (ret)
+		goto remove_rproc;
+
 	return 0;
 
+remove_rproc:
+	rproc_del(rproc);
 remove_sysmon_subdev:
 	qcom_remove_sysmon_subdev(qproc->sysmon);
 remove_subdevs:
@@ -2010,6 +2016,7 @@ static int q6v5_remove(struct platform_device *pdev)
 	struct q6v5 *qproc = platform_get_drvdata(pdev);
 	struct rproc *rproc = qproc->rproc;
 
+	of_platform_depopulate(&pdev->dev);
 	rproc_del(rproc);
 
 	qcom_q6v5_deinit(&qproc->q6v5);
Signature · 1 line
2.34.1
#2 lore raw

Re: [PATCH 1/2] remoteproc: qcom_q6v5_mss: Populate additional devices from DT

Quoted 5 lines · Stephan Gerhold

Some devices without own memory resources could be placed anywhere in the device tree but they logically belong to the modem remote processor. Make it possible to probe them when defined under the mpss device tree node by calling of_platform_populate().

This seems reasonable, but other "child devices" of the remoteproc follows the state of the remoteproc instance. So I'm worried that this will create an inconsistency in that assumption.

Quoted 3 lines

This can be used for BAM-DMUX for example, which provides the WWAN network interfaces on some older Qualcomm SoCs such as MSM8916 or MSM8974.

Is there a technical reason for placing the BAM-DMUX within the modem remoteproc node? Can we simply move it to / ?

Regards,
Bjorn

Quoted 35 lines
---
 drivers/remoteproc/qcom_q6v5_mss.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/remoteproc/qcom_q6v5_mss.c +7 -0
index 43ea8455546c..69f3d1ebf1f1 100644
@@ -1989,8 +1989,14 @@ static int q6v5_probe(struct platform_device *pdev)
 	if (ret)
 		goto remove_sysmon_subdev;
 
+	ret = of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev);
+	if (ret)
+		goto remove_rproc;
+
 	return 0;
 
+remove_rproc:
+	rproc_del(rproc);
 remove_sysmon_subdev:
 	qcom_remove_sysmon_subdev(qproc->sysmon);
 remove_subdevs:
@@ -2010,6 +2016,7 @@ static int q6v5_remove(struct platform_device *pdev)
 	struct q6v5 *qproc = platform_get_drvdata(pdev);
 	struct rproc *rproc = qproc->rproc;
 
+	of_platform_depopulate(&pdev->dev);
 	rproc_del(rproc);
 
 	qcom_q6v5_deinit(&qproc->q6v5);
Signature · 1 line
2.34.1
#3 lore raw

Re: [PATCH 1/2] remoteproc: qcom_q6v5_mss: Populate additional devices from DT

Quoted 8 lines · Bjorn Andersson
Quoted 5 lines · Stephan Gerhold

Some devices without own memory resources could be placed anywhere in the device tree but they logically belong to the modem remote processor. Make it possible to probe them when defined under the mpss device tree node by calling of_platform_populate().

Quoted 4 lines

This seems reasonable, but other "child devices" of the remoteproc follows the state of the remoteproc instance. So I'm worried that this will create an inconsistency in that assumption.

On Linux there are two devices managed by qcom_q6v5_mss, the platform device used by the driver and the actual remoteproc instance that has the state. The devices that follow the state are children of the remoteproc instance. I'm creating BAM-DMUX below the platform device.

This is just not represented in the device tree very well since both platform device and remoteproc instance share the same device tree node. However, all the state managed nodes are manually managed and do not have a compatible so it should not cause problems.

Quoted 7 lines
Quoted 3 lines

This can be used for BAM-DMUX for example, which provides the WWAN network interfaces on some older Qualcomm SoCs such as MSM8916 or MSM8974.

Is there a technical reason for placing the BAM-DMUX within the modem remoteproc node? Can we simply move it to / ?

I had it at / originally and at the moment it would still work there. I moved it below the remoteproc when the whole "WWAN subsystem" discussion came up. The goal is to have a common parent device for all the ports of a WWAN modem.

The way it works is that you give the WWAN subsystem a (parent) device that represents the modem itself, and then it groups all WWAN ports below that. The control ports (rpmsg_wwan_ctrl driver) are currently already created below the modem platform device.

The bam-dmux driver does not integrate with the WWAN subsystem yet because of some unrelated open problems, but in the future I will likely need a reference to the modem platform device there as well.

There are other approaches of course (e.g. a phandle to the modem remoteproc node), but I still think it logically fits best somewhere below the modem node. If the modem remoteproc is status = "disabled", it does not make sense to load bam-dmux either etc.

Thanks,
Stephan

Quoted 35 lines
Quoted 35 lines
---
 drivers/remoteproc/qcom_q6v5_mss.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/remoteproc/qcom_q6v5_mss.c +7 -0
index 43ea8455546c..69f3d1ebf1f1 100644
@@ -1989,8 +1989,14 @@ static int q6v5_probe(struct platform_device *pdev)
 	if (ret)
 		goto remove_sysmon_subdev;
 
+	ret = of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev);
+	if (ret)
+		goto remove_rproc;
+
 	return 0;
 
+remove_rproc:
+	rproc_del(rproc);
 remove_sysmon_subdev:
 	qcom_remove_sysmon_subdev(qproc->sysmon);
 remove_subdevs:
@@ -2010,6 +2016,7 @@ static int q6v5_remove(struct platform_device *pdev)
 	struct q6v5 *qproc = platform_get_drvdata(pdev);
 	struct rproc *rproc = qproc->rproc;
 
+	of_platform_depopulate(&pdev->dev);
 	rproc_del(rproc);
 
 	qcom_q6v5_deinit(&qproc->q6v5);
Signature · 1 line
2.34.1
#4 lore raw

PATCH 2/2 arm64: dts: qcom: msm8916: Add BAM-DMUX for WWAN network interfaces

In reply to Stephan Gerhold

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.

---
 arch/arm64/boot/dts/qcom/msm8916.dtsi | 30 +++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
arch/arm64/boot/dts/qcom/msm8916.dtsi +30 -0
index c1c42f26b61e..56b6974c01fc 100644
@@ -1309,6 +1309,20 @@ spmi_bus: spmi@200f000 {
 			#interrupt-cells = <4>;
 		};
 
+		bam_dmux_dma: dma-controller@4044000 {
+			compatible = "qcom,bam-v1.7.0";
+			reg = <0x04044000 0x19000>;
+			interrupts = <GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>;
+			#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>,
@@ -1352,6 +1366,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 = <GIC_SPI 25 IRQ_TYPE_EDGE_RISING>;
 
Signature · 1 line
2.34.1