Skip to contentSkip to conversation

Misc qcom geni spi driver fixes

PATCH In review Stephen Boyd 3 participants 10 messages Feb 4, 2020 – Feb 11, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Misc qcom geni spi driver fixes

Here's a small collection of qcom geni spi driver fixes that simplify the code and aid debugging.

Stephen Boyd (3):
spi: spi-geni-qcom: Let firmware specify irq trigger flags
spi: spi-geni-qcom: Grow a dev pointer to simplify code
spi: spi-geni-qcom: Drop of.h include

 drivers/spi/spi-geni-qcom.c | 26 +++++++++++---------------
 1 file changed, 11 insertions(+), 15 deletions(-)
Signature · 1 line
Sent by a computer, using git, on the internet
#1 lore raw

PATCH 1/3 spi: spi-geni-qcom: Let firmware specify irq trigger flags

We don't need to force IRQF_TRIGGER_HIGH here as the DT or ACPI tables should take care of this for us. Just use 0 instead so that we use the flags from the firmware.

Cc Girish Mahadevan <[email protected]>
Cc Dilip Kota <[email protected]>
Cc Alok Chauhan <[email protected]>
Cc Douglas Anderson <[email protected]>
---
 drivers/spi/spi-geni-qcom.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/spi/spi-geni-qcom.c +1 -2
index 6f3d64a1a2b3..46e501fc87f3 100644
@@ -585,8 +585,7 @@ static int spi_geni_probe(struct platform_device *pdev)
 	if (ret)
 		goto spi_geni_probe_runtime_disable;
 
-	ret = request_irq(mas->irq, geni_spi_isr,
-			IRQF_TRIGGER_HIGH, "spi_geni", spi);
+	ret = request_irq(mas->irq, geni_spi_isr, 0, dev_name(&pdev->dev), spi);
 	if (ret)
 		goto spi_geni_probe_runtime_disable;
 
Signature · 1 line
Sent by a computer, using git, on the internet
Reviewed-by on v1 1/3
#2 lore raw

Re: [PATCH 1/3] spi: spi-geni-qcom: Let firmware specify irq trigger flags

Hi,

Quoted 5 lines · Stephen Boyd

We don't need to force IRQF_TRIGGER_HIGH here as the DT or ACPI tables should take care of this for us. Just use 0 instead so that we use the flags from the firmware.

Quoted 8 lines
Cc Girish Mahadevan <[email protected]>
Cc Dilip Kota <[email protected]>
Cc Alok Chauhan <[email protected]>
Cc Douglas Anderson <[email protected]>
---
 drivers/spi/spi-geni-qcom.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
maintainer
#3 lore raw

Applied "spi: spi-geni-qcom: Let firmware specify irq trigger flags" to the spi tree

In reply to Stephen Boyd

The patch

spi: spi-geni-qcom: Let firmware specify irq trigger flags

has been applied to the spi tree at

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-5.7

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark

Quoted 1 line

From ece9ef3b60cbc36237138af456b236d3d1d9b771 Mon Sep 17 00:00:00 2001

From: Stephen Boyd <[email protected]>
Date: Tue, 4 Feb 2020 11:12:04 -0800
Subject: [PATCH] spi: spi-geni-qcom: Let firmware specify irq trigger flags

We don't need to force IRQF_TRIGGER_HIGH here as the DT or ACPI tables should take care of this for us. Just use 0 instead so that we use the flags from the firmware.

---
 drivers/spi/spi-geni-qcom.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/spi/spi-geni-qcom.c +1 -2
index 6f3d64a1a2b3..46e501fc87f3 100644
@@ -585,8 +585,7 @@ static int spi_geni_probe(struct platform_device *pdev)
 	if (ret)
 		goto spi_geni_probe_runtime_disable;
 
-	ret = request_irq(mas->irq, geni_spi_isr,
-			IRQF_TRIGGER_HIGH, "spi_geni", spi);
+	ret = request_irq(mas->irq, geni_spi_isr, 0, dev_name(&pdev->dev), spi);
 	if (ret)
 		goto spi_geni_probe_runtime_disable;
 
Signature · 1 line
2.20.1
#4 lore raw

PATCH 2/3 spi: spi-geni-qcom: Grow a dev pointer to simplify code

In reply to Stephen Boyd

Some lines are long here. Use a struct dev pointer to shorten lines and simplify code. The clk_get() call can fail because of EPROBE_DEFER problems too, so just remove the error print message because it isn't useful.

Cc Girish Mahadevan <[email protected]>
Cc Dilip Kota <[email protected]>
Cc Alok Chauhan <[email protected]>
Cc Douglas Anderson <[email protected]>
---
 drivers/spi/spi-geni-qcom.c | 24 +++++++++++-------------
 1 file changed, 11 insertions(+), 13 deletions(-)
drivers/spi/spi-geni-qcom.c +11 -13
index 46e501fc87f3..f0ca7f5ae714 100644
@@ -536,6 +536,7 @@ static int spi_geni_probe(struct platform_device *pdev)
 	struct spi_geni_master *mas;
 	void __iomem *base;
 	struct clk *clk;
+	struct device *dev = &pdev->dev;
 
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0)
@@ -545,28 +546,25 @@ static int spi_geni_probe(struct platform_device *pdev)
 	if (IS_ERR(base))
 		return PTR_ERR(base);
 
-	clk = devm_clk_get(&pdev->dev, "se");
-	if (IS_ERR(clk)) {
-		dev_err(&pdev->dev, "Err getting SE Core clk %ld\n",
-						PTR_ERR(clk));
+	clk = devm_clk_get(dev, "se");
+	if (IS_ERR(clk))
 		return PTR_ERR(clk);
-	}
 
-	spi = spi_alloc_master(&pdev->dev, sizeof(*mas));
+	spi = spi_alloc_master(dev, sizeof(*mas));
 	if (!spi)
 		return -ENOMEM;
 
 	platform_set_drvdata(pdev, spi);
 	mas = spi_master_get_devdata(spi);
 	mas->irq = irq;
-	mas->dev = &pdev->dev;
-	mas->se.dev = &pdev->dev;
-	mas->se.wrapper = dev_get_drvdata(pdev->dev.parent);
+	mas->dev = dev;
+	mas->se.dev = dev;
+	mas->se.wrapper = dev_get_drvdata(dev->parent);
 	mas->se.base = base;
 	mas->se.clk = clk;
 
 	spi->bus_num = -1;
-	spi->dev.of_node = pdev->dev.of_node;
+	spi->dev.of_node = dev->of_node;
 	spi->mode_bits = SPI_CPOL | SPI_CPHA | SPI_LOOP | SPI_CS_HIGH;
 	spi->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 32);
 	spi->num_chipselect = 4;
@@ -579,13 +577,13 @@ static int spi_geni_probe(struct platform_device *pdev)
 
 	init_completion(&mas->xfer_done);
 	spin_lock_init(&mas->lock);
-	pm_runtime_enable(&pdev->dev);
+	pm_runtime_enable(dev);
 
 	ret = spi_geni_init(mas);
 	if (ret)
 		goto spi_geni_probe_runtime_disable;
 
-	ret = request_irq(mas->irq, geni_spi_isr, 0, dev_name(&pdev->dev), spi);
+	ret = request_irq(mas->irq, geni_spi_isr, 0, dev_name(dev), spi);
 	if (ret)
 		goto spi_geni_probe_runtime_disable;
 
@@ -597,7 +595,7 @@ static int spi_geni_probe(struct platform_device *pdev)
 spi_geni_probe_free_irq:
 	free_irq(mas->irq, spi);
 spi_geni_probe_runtime_disable:
-	pm_runtime_disable(&pdev->dev);
+	pm_runtime_disable(dev);
 	spi_master_put(spi);
 	return ret;
 }
Signature · 1 line
Sent by a computer, using git, on the internet
Reviewed-by on v1 2/3
#5 lore raw

Re: [PATCH 2/3] spi: spi-geni-qcom: Grow a dev pointer to simplify code

Hi,

Quoted 28 lines · Stephen Boyd

Some lines are long here. Use a struct dev pointer to shorten lines and simplify code. The clk_get() call can fail because of EPROBE_DEFER problems too, so just remove the error print message because it isn't useful.

Cc Girish Mahadevan <[email protected]>
Cc Dilip Kota <[email protected]>
Cc Alok Chauhan <[email protected]>
Cc Douglas Anderson <[email protected]>
---
 drivers/spi/spi-geni-qcom.c | 24 +++++++++++-------------
 1 file changed, 11 insertions(+), 13 deletions(-)
drivers/spi/spi-geni-qcom.c +1 -0
index 46e501fc87f3..f0ca7f5ae714 100644
@@ -536,6 +536,7 @@ static int spi_geni_probe(struct platform_device *pdev)
        struct spi_geni_master *mas;
        void __iomem *base;
        struct clk *clk;
+       struct device *dev = &pdev->dev;
 
        irq = platform_get_irq(pdev, 0);
        if (irq < 0)

drivers/spi/spi-geni-qcom.c static int spi_geni_probe(struct platform_device *pdev) · line 550

Quoted 9 lines
drivers/spi/spi-geni-qcom.c +2 -4
@@ -545,28 +546,25 @@ static int spi_geni_probe(struct platform_device *pdev)
        if (IS_ERR(base))
                return PTR_ERR(base);
 
-       clk = devm_clk_get(&pdev->dev, "se");
-       if (IS_ERR(clk)) {
-               dev_err(&pdev->dev, "Err getting SE Core clk %ld\n",
-                                               PTR_ERR(clk));
+       clk = devm_clk_get(dev, "se");
+       if (IS_ERR(clk))

There could be other errors besides -EPROBE_DEFER and devm_clk_get() won't have printed in all cases. ...but I agree that it seems highly unlikely we'd ever hit any of those but highly likely we _would_ print out a needless shout about -EPROBE_DEFER, so this is fine:

maintainer
#6 lore raw

Applied "spi: spi-geni-qcom: Grow a dev pointer to simplify code" to the spi tree

In reply to Stephen Boyd

The patch

spi: spi-geni-qcom: Grow a dev pointer to simplify code

has been applied to the spi tree at

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-5.7

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark

Quoted 1 line

From ea1e5b3354b1610ac16a780535fbdabfda9e6912 Mon Sep 17 00:00:00 2001

From: Stephen Boyd <[email protected]>
Date: Tue, 4 Feb 2020 11:12:05 -0800
Subject: [PATCH] spi: spi-geni-qcom: Grow a dev pointer to simplify code

Some lines are long here. Use a struct dev pointer to shorten lines and simplify code. The clk_get() call can fail because of EPROBE_DEFER problems too, so just remove the error print message because it isn't useful.

---
 drivers/spi/spi-geni-qcom.c | 24 +++++++++++-------------
 1 file changed, 11 insertions(+), 13 deletions(-)
drivers/spi/spi-geni-qcom.c +11 -13
index 46e501fc87f3..f0ca7f5ae714 100644
@@ -536,6 +536,7 @@ static int spi_geni_probe(struct platform_device *pdev)
 	struct spi_geni_master *mas;
 	void __iomem *base;
 	struct clk *clk;
+	struct device *dev = &pdev->dev;
 
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0)
@@ -545,28 +546,25 @@ static int spi_geni_probe(struct platform_device *pdev)
 	if (IS_ERR(base))
 		return PTR_ERR(base);
 
-	clk = devm_clk_get(&pdev->dev, "se");
-	if (IS_ERR(clk)) {
-		dev_err(&pdev->dev, "Err getting SE Core clk %ld\n",
-						PTR_ERR(clk));
+	clk = devm_clk_get(dev, "se");
+	if (IS_ERR(clk))
 		return PTR_ERR(clk);
-	}
 
-	spi = spi_alloc_master(&pdev->dev, sizeof(*mas));
+	spi = spi_alloc_master(dev, sizeof(*mas));
 	if (!spi)
 		return -ENOMEM;
 
 	platform_set_drvdata(pdev, spi);
 	mas = spi_master_get_devdata(spi);
 	mas->irq = irq;
-	mas->dev = &pdev->dev;
-	mas->se.dev = &pdev->dev;
-	mas->se.wrapper = dev_get_drvdata(pdev->dev.parent);
+	mas->dev = dev;
+	mas->se.dev = dev;
+	mas->se.wrapper = dev_get_drvdata(dev->parent);
 	mas->se.base = base;
 	mas->se.clk = clk;
 
 	spi->bus_num = -1;
-	spi->dev.of_node = pdev->dev.of_node;
+	spi->dev.of_node = dev->of_node;
 	spi->mode_bits = SPI_CPOL | SPI_CPHA | SPI_LOOP | SPI_CS_HIGH;
 	spi->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 32);
 	spi->num_chipselect = 4;
@@ -579,13 +577,13 @@ static int spi_geni_probe(struct platform_device *pdev)
 
 	init_completion(&mas->xfer_done);
 	spin_lock_init(&mas->lock);
-	pm_runtime_enable(&pdev->dev);
+	pm_runtime_enable(dev);
 
 	ret = spi_geni_init(mas);
 	if (ret)
 		goto spi_geni_probe_runtime_disable;
 
-	ret = request_irq(mas->irq, geni_spi_isr, 0, dev_name(&pdev->dev), spi);
+	ret = request_irq(mas->irq, geni_spi_isr, 0, dev_name(dev), spi);
 	if (ret)
 		goto spi_geni_probe_runtime_disable;
 
@@ -597,7 +595,7 @@ static int spi_geni_probe(struct platform_device *pdev)
 spi_geni_probe_free_irq:
 	free_irq(mas->irq, spi);
 spi_geni_probe_runtime_disable:
-	pm_runtime_disable(&pdev->dev);
+	pm_runtime_disable(dev);
 	spi_master_put(spi);
 	return ret;
 }
Signature · 1 line
2.20.1
#7 lore raw

PATCH 3/3 spi: spi-geni-qcom: Drop of.h include

In reply to Stephen Boyd

This driver doesn't call any DT functions like of_get_property(). Remove the of.h include as it isn't used.

Cc Girish Mahadevan <[email protected]>
Cc Dilip Kota <[email protected]>
Cc Alok Chauhan <[email protected]>
Cc Douglas Anderson <[email protected]>
---
 drivers/spi/spi-geni-qcom.c | 1 -
 1 file changed, 1 deletion(-)
drivers/spi/spi-geni-qcom.c +0 -1
index f0ca7f5ae714..c3972424af71 100644
@@ -6,7 +6,6 @@
 #include <linux/io.h>
 #include <linux/log2.h>
 #include <linux/module.h>
-#include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
 #include <linux/qcom-geni-se.h>
Signature · 1 line
Sent by a computer, using git, on the internet
Reviewed-by on v1 3/3
#8 lore raw

Re: [PATCH 3/3] spi: spi-geni-qcom: Drop of.h include

Hi,

Quoted 4 lines · Stephen Boyd

This driver doesn't call any DT functions like of_get_property(). Remove the of.h include as it isn't used.

Quoted 8 lines
Cc Girish Mahadevan <[email protected]>
Cc Dilip Kota <[email protected]>
Cc Alok Chauhan <[email protected]>
Cc Douglas Anderson <[email protected]>
---
 drivers/spi/spi-geni-qcom.c | 1 -
 1 file changed, 1 deletion(-)
maintainer
#9 lore raw

Applied "spi: spi-geni-qcom: Drop of.h include" to the spi tree

In reply to Stephen Boyd

The patch

spi: spi-geni-qcom: Drop of.h include

has been applied to the spi tree at

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-5.7

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark

Quoted 1 line

From 875014cb79ea4251e8800994640be1a8012b4133 Mon Sep 17 00:00:00 2001

From: Stephen Boyd <[email protected]>
Date: Tue, 4 Feb 2020 11:12:06 -0800
Subject: [PATCH] spi: spi-geni-qcom: Drop of.h include

This driver doesn't call any DT functions like of_get_property(). Remove the of.h include as it isn't used.

---
 drivers/spi/spi-geni-qcom.c | 1 -
 1 file changed, 1 deletion(-)
drivers/spi/spi-geni-qcom.c +0 -1
index f0ca7f5ae714..c3972424af71 100644
@@ -6,7 +6,6 @@
 #include <linux/io.h>
 #include <linux/log2.h>
 #include <linux/module.h>
-#include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
 #include <linux/qcom-geni-se.h>
Signature · 1 line
2.20.1