Skip to contentSkip to conversation

Documentation: DT: qcom_hidma: bump HW revision for the bugfixed HW

PATCH Superseded Sinan Kaya 3 participants 7 messages Nov 6, 2017 – Nov 8, 2017

Subsystems (4)

v1 of 8 Superseded Latest is v8 →

lore
Share & tools
lore

Sinan Kaya

author
#0 lore raw

PATCH 1/3 Documentation: DT: qcom_hidma: bump HW revision for the bugfixed HW

A new version of the HIDMA IP has been released with bug fixes. Bumping the hardware version to differentiate from others.

---
 Documentation/devicetree/bindings/dma/qcom_hidma_mgmt.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/dma/qcom_hidma_mgmt.txt +2 -2
index 55492c2..5d93d6d 100644
@@ -47,8 +47,8 @@ When the OS is not in control of the management interface (i.e. it's a guest),
 the channel nodes appear on their own, not under a management node.
 
 Required properties:
-- compatible: must contain "qcom,hidma-1.0" for initial HW or "qcom,hidma-1.1"
-for MSI capable HW.
+- compatible: must contain "qcom,hidma-1.0" for initial HW or
+  "qcom,hidma-1.1"/"qcom,hidma-1.2" for MSI capable HW.
 - reg: Addresses for the transfer and event channel
 - interrupts: Should contain the event interrupt
 - desc-count: Number of asynchronous requests this channel can handle
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH 2/3 dmaengine: qcom_hidma: add support for the new revision

Add support for probing the newer HW.

---
 drivers/dma/qcom/hidma.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/dma/qcom/hidma.c +6 -0
index e366985..29d6aaa 100644
@@ -749,9 +749,13 @@ static bool hidma_msi_capable(struct device *dev)
 			return false;
 
 		ret = strcmp(of_compat, "qcom,hidma-1.1");
+		if (ret)
+			ret = strcmp(of_compat, "qcom,hidma-1.2");
 	} else {
 #ifdef CONFIG_ACPI
 		ret = strcmp(acpi_device_hid(adev), "QCOM8062");
+		if (ret)
+			ret = strcmp(acpi_device_hid(adev), "QCOM8063");
 #endif
 	}
 	return ret == 0;
@@ -954,6 +958,7 @@ static int hidma_remove(struct platform_device *pdev)
 static const struct acpi_device_id hidma_acpi_ids[] = {
 	{"QCOM8061"},
 	{"QCOM8062"},
+	{"QCOM8063"},
 	{},
 };
 MODULE_DEVICE_TABLE(acpi, hidma_acpi_ids);
@@ -962,6 +967,7 @@ static int hidma_remove(struct platform_device *pdev)
 static const struct of_device_id hidma_match[] = {
 	{.compatible = "qcom,hidma-1.0",},
 	{.compatible = "qcom,hidma-1.1",},
+	{.compatible = "qcom,hidma-1.2",},
 	{},
 };
 MODULE_DEVICE_TABLE(of, hidma_match);
Signature · 1 line
1.9.1
#2 lore raw

Re: [PATCH 2/3] dmaengine: qcom_hidma: add support for the new revision

Quoted 12 lines · Sinan Kaya

Add support for probing the newer HW.

---
 drivers/dma/qcom/hidma.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/dma/qcom/hidma.c +0 -0
index e366985..29d6aaa 100644

drivers/dma/qcom/hidma.c static bool hidma_msi_capable(struct device *dev) · line 758

Quoted 10 lines
drivers/dma/qcom/hidma.c +4 -0
@@ -749,9 +749,13 @@ static bool hidma_msi_capable(struct device *dev)
 			return false;
 
 		ret = strcmp(of_compat, "qcom,hidma-1.1");
+		if (ret)
+			ret = strcmp(of_compat, "qcom,hidma-1.2");
 	} else {
 #ifdef CONFIG_ACPI
 		ret = strcmp(acpi_device_hid(adev), "QCOM8062");
+		if (ret)
+			ret = strcmp(acpi_device_hid(adev), "QCOM8063");

This string-juggling looks to have already hit the point at which it doesn't scale well - it would be a lot nicer to make use of of_device_get_match_data() and the ACPI equivalent to abstract the version-specific data appropriately.

Robin.

Quoted 20 lines
drivers/dma/qcom/hidma.c +2 -0
 #endif
 	}
 	return ret == 0;
@@ -954,6 +958,7 @@ static int hidma_remove(struct platform_device *pdev)
 static const struct acpi_device_id hidma_acpi_ids[] = {
 	{"QCOM8061"},
 	{"QCOM8062"},
+	{"QCOM8063"},
 	{},
 };
 MODULE_DEVICE_TABLE(acpi, hidma_acpi_ids);
@@ -962,6 +967,7 @@ static int hidma_remove(struct platform_device *pdev)
 static const struct of_device_id hidma_match[] = {
 	{.compatible = "qcom,hidma-1.0",},
 	{.compatible = "qcom,hidma-1.1",},
+	{.compatible = "qcom,hidma-1.2",},
 	{},
 };
 MODULE_DEVICE_TABLE(of, hidma_match);
author
#3 lore raw

Re: [PATCH 2/3] dmaengine: qcom_hidma: add support for the new revision

Quoted 8 lines · Robin Murphy

drivers/dma/qcom/hidma.c static bool hidma_msi_capable(struct device *dev) · line 758

Quoted 4 lines

#ifdef CONFIG_ACPI

drivers/dma/qcom/hidma.c +2 -0
 		ret = strcmp(acpi_device_hid(adev), "QCOM8062");
+		if (ret)
+			ret = strcmp(acpi_device_hid(adev), "QCOM8063");

This string-juggling looks to have already hit the point at which it doesn't scale well - it would be a lot nicer to make use of of_device_get_match_data() and the ACPI equivalent to abstract the version-specific data appropriately.

Sure, let me do some research.

Signature · 3 lines
Sinan Kaya
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.
author
#4 lore raw

Re: [PATCH 2/3] dmaengine: qcom_hidma: add support for the new revision

Quoted 10 lines · Sinan Kaya
Quoted 8 lines · Robin Murphy

drivers/dma/qcom/hidma.c static bool hidma_msi_capable(struct device *dev) · line 758

Quoted 4 lines

#ifdef CONFIG_ACPI

drivers/dma/qcom/hidma.c +2 -0
 		ret = strcmp(acpi_device_hid(adev), "QCOM8062");
+		if (ret)
+			ret = strcmp(acpi_device_hid(adev), "QCOM8063");

This string-juggling looks to have already hit the point at which it doesn't scale well - it would be a lot nicer to make use of of_device_get_match_data() and the ACPI equivalent to abstract the version-specific data appropriately.

Quoted 2 lines

Sure, let me do some research.

I just wanted to double check here.

This is what I can do:
1. Maintain different match tables for different driver capabilities.
2. Instead of doing open-coded strcmp, I can do match against different tables using acpi_match_device/of_match_device.

Hope this works for you.

Signature · 3 lines
Sinan Kaya
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.
#5 lore raw

Re: [PATCH 2/3] dmaengine: qcom_hidma: add support for the new revision

Quoted 14 lines · Sinan Kaya
Quoted 10 lines · Sinan Kaya
Quoted 8 lines · Robin Murphy

drivers/dma/qcom/hidma.c static bool hidma_msi_capable(struct device *dev) · line 758

Quoted 4 lines

#ifdef CONFIG_ACPI

drivers/dma/qcom/hidma.c +2 -0
 		ret = strcmp(acpi_device_hid(adev), "QCOM8062");
+		if (ret)
+			ret = strcmp(acpi_device_hid(adev), "QCOM8063");

This string-juggling looks to have already hit the point at which it doesn't scale well - it would be a lot nicer to make use of of_device_get_match_data() and the ACPI equivalent to abstract the version-specific data appropriately.

Quoted 2 lines

Sure, let me do some research.

Quoted 8 lines

I just wanted to double check here.

This is what I can do:
1. Maintain different match tables for different driver capabilities.
2. Instead of doing open-coded strcmp, I can do match against different tables using acpi_match_device/of_match_device.

Hope this works for you.

Sounds better to me. You should have common match where capabilities are same.

Signature · 1 line
~Vinod
author
#6 lore raw

PATCH 3/3 dmaengine: qcom_hidma: add identity register support

In reply to Sinan Kaya

The location for destination event channel register has been relocated from offset 0x28 to 0x40. Update the code accordingly.

---
 drivers/dma/qcom/hidma.c | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)
drivers/dma/qcom/hidma.c +25 -1
index 29d6aaa..50640c9 100644
@@ -761,6 +761,27 @@ static bool hidma_msi_capable(struct device *dev)
 	return ret == 0;
 }
 
+static bool hidma_identity_capable(struct device *dev)
+{
+	struct acpi_device *adev = ACPI_COMPANION(dev);
+	const char *of_compat;
+	int ret = -EINVAL;
+
+	if (!adev || acpi_disabled) {
+		ret = device_property_read_string(dev, "compatible",
+						  &of_compat);
+		if (ret)
+			return false;
+
+		ret = strcmp(of_compat, "qcom,hidma-1.2");
+	} else {
+#ifdef CONFIG_ACPI
+		ret = strcmp(acpi_device_hid(adev), "QCOM8063");
+#endif
+	}
+	return ret == 0;
+}
+
 static int hidma_probe(struct platform_device *pdev)
 {
 	struct hidma_dev *dmadev;
@@ -852,7 +873,10 @@ static int hidma_probe(struct platform_device *pdev)
 	if (!dmadev->nr_descriptors)
 		dmadev->nr_descriptors = HIDMA_NR_DEFAULT_DESC;
 
-	dmadev->chidx = readl(dmadev->dev_trca + 0x28);
+	if (hidma_identity_capable(&pdev->dev))
+		dmadev->chidx = readl(dmadev->dev_trca + 0x40);
+	else
+		dmadev->chidx = readl(dmadev->dev_trca + 0x28);
 
 	/* Set DMA mask to 64 bits. */
 	rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
Signature · 1 line
1.9.1