Skip to contentSkip to conversation

Add pinctrl support to omap2-mcspi

PATCH Superseded Matt Porter 4 participants 9 messages Sep 17, 2012 – Sep 18, 2012

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

v2 cover Add pinctrl support to omap2-mcspi

Changes since v1:
- warns that pins are not configured by the driver rather than exiting
- dummy states are only enabled for OMAP platforms where DT is not populated

This series enables pinctrl support for McSPI. Platforms that boot only from DT and rely on pinctrl to set pinmuxes appropriately require this for omap2-mcspi operation.

It has been tested on AM335x BeagleBone with an Adafruit SPI LCD attached and regression tested on Beagleboard xM booting in the !DT case, using board-omap3evm.c.

The series applies on top of Tony's dt-devel branch.

Matt Porter (2):
spi: omap2-mcspi: add pinctrl support
ARM: OMAP2+: Enable pinctrl dummy states

 arch/arm/mach-omap2/devices.c |    5 +++++
 drivers/spi/spi-omap2-mcspi.c |    8 ++++++++
 2 files changed, 13 insertions(+)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH v2 1/2 spi: omap2-mcspi: add pinctrl support

Adds pinctrl support to support OMAP platforms that boot from DT and rely on pinctrl support to set pinmuxes.

---
 drivers/spi/spi-omap2-mcspi.c |    8 ++++++++
 1 file changed, 8 insertions(+)
drivers/spi/spi-omap2-mcspi.c +8 -0
index b2fb141..9502566 100644
@@ -38,6 +38,8 @@
 #include <linux/pm_runtime.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
+#include <linux/pinctrl/consumer.h>
+#include <linux/err.h>
 
 #include <linux/spi/spi.h>
 
@@ -1124,6 +1126,7 @@ static int __devinit omap2_mcspi_probe(struct platform_device *pdev)
 	static int		bus_num = 1;
 	struct device_node	*node = pdev->dev.of_node;
 	const struct of_device_id *match;
+	struct pinctrl *pinctrl;
 
 	master = spi_alloc_master(&pdev->dev, sizeof *mcspi);
 	if (master == NULL) {
@@ -1219,6 +1222,11 @@ static int __devinit omap2_mcspi_probe(struct platform_device *pdev)
 	if (status < 0)
 		goto dma_chnl_free;
 
+	pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
+	if (IS_ERR(pinctrl))
+		dev_warn(&pdev->dev,
+			"pins are not configured from the driver\n");
+
 	pm_runtime_use_autosuspend(&pdev->dev);
 	pm_runtime_set_autosuspend_delay(&pdev->dev, SPI_AUTOSUSPEND_TIMEOUT);
 	pm_runtime_enable(&pdev->dev);
Signature · 1 line
1.7.9.5
maintainer Acked-by on v2 1/2
#2 lore raw

Re: [PATCH v2 1/2] spi: omap2-mcspi: add pinctrl support

Quoted 4 lines · Matt Porter

Adds pinctrl support to support OMAP platforms that boot from DT and rely on pinctrl support to set pinmuxes.

Quoted 40 lines
---
 drivers/spi/spi-omap2-mcspi.c |    8 ++++++++
 1 file changed, 8 insertions(+)
drivers/spi/spi-omap2-mcspi.c +8 -0
index b2fb141..9502566 100644
@@ -38,6 +38,8 @@
 #include <linux/pm_runtime.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
+#include <linux/pinctrl/consumer.h>
+#include <linux/err.h>
 
 #include <linux/spi/spi.h>
 
@@ -1124,6 +1126,7 @@ static int __devinit omap2_mcspi_probe(struct platform_device *pdev)
 	static int		bus_num = 1;
 	struct device_node	*node = pdev->dev.of_node;
 	const struct of_device_id *match;
+	struct pinctrl *pinctrl;
 
 	master = spi_alloc_master(&pdev->dev, sizeof *mcspi);
 	if (master == NULL) {
@@ -1219,6 +1222,11 @@ static int __devinit omap2_mcspi_probe(struct platform_device *pdev)
 	if (status < 0)
 		goto dma_chnl_free;
 
+	pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
+	if (IS_ERR(pinctrl))
+		dev_warn(&pdev->dev,
+			"pins are not configured from the driver\n");
+
 	pm_runtime_use_autosuspend(&pdev->dev);
 	pm_runtime_set_autosuspend_delay(&pdev->dev, SPI_AUTOSUSPEND_TIMEOUT);
 	pm_runtime_enable(&pdev->dev);
Signature · 1 line
1.7.9.5
Acked-by on v2 1/2
#3 lore raw

Re: [PATCH v2 1/2] spi: omap2-mcspi: add pinctrl support

In reply to Matt Porter
Quoted 5 lines · Matt Porter

Adds pinctrl support to support OMAP platforms that boot from DT and rely on pinctrl support to set pinmuxes.

---

looks good to me.
you may want to repost with Mark in cc to review.

Quoted 36 lines
 drivers/spi/spi-omap2-mcspi.c |    8 ++++++++
 1 file changed, 8 insertions(+)
drivers/spi/spi-omap2-mcspi.c +8 -0
index b2fb141..9502566 100644
@@ -38,6 +38,8 @@
 #include <linux/pm_runtime.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
+#include <linux/pinctrl/consumer.h>
+#include <linux/err.h>
 
 #include <linux/spi/spi.h>
 
@@ -1124,6 +1126,7 @@ static int __devinit omap2_mcspi_probe(struct platform_device *pdev)
 	static int		bus_num = 1;
 	struct device_node	*node = pdev->dev.of_node;
 	const struct of_device_id *match;
+	struct pinctrl *pinctrl;
 
 	master = spi_alloc_master(&pdev->dev, sizeof *mcspi);
 	if (master == NULL) {
@@ -1219,6 +1222,11 @@ static int __devinit omap2_mcspi_probe(struct platform_device *pdev)
 	if (status < 0)
 		goto dma_chnl_free;
 
+	pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
+	if (IS_ERR(pinctrl))
+		dev_warn(&pdev->dev,
+			"pins are not configured from the driver\n");
+
 	pm_runtime_use_autosuspend(&pdev->dev);
 	pm_runtime_set_autosuspend_delay(&pdev->dev, SPI_AUTOSUSPEND_TIMEOUT);
 	pm_runtime_enable(&pdev->dev);
#4 lore raw

Re: [PATCH v2 1/2] spi: omap2-mcspi: add pinctrl support

Quoted 9 lines · Shubhrajyoti
Quoted 5 lines · Matt Porter

Adds pinctrl support to support OMAP platforms that boot from DT and rely on pinctrl support to set pinmuxes.

---

looks good to me.
you may want to repost with Mark in cc to review.

Thanks...reposted this part with Mark cced.

-Matt

Quoted 41 lines
Quoted 26 lines
 drivers/spi/spi-omap2-mcspi.c |    8 ++++++++
 1 file changed, 8 insertions(+)
drivers/spi/spi-omap2-mcspi.c +3 -0
index b2fb141..9502566 100644
@@ -38,6 +38,8 @@
 #include <linux/pm_runtime.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
+#include <linux/pinctrl/consumer.h>
+#include <linux/err.h>
 
 #include <linux/spi/spi.h>
 
@@ -1124,6 +1126,7 @@ static int __devinit omap2_mcspi_probe(struct platform_device *pdev)
 	static int		bus_num = 1;
 	struct device_node	*node = pdev->dev.of_node;
 	const struct of_device_id *match;
+	struct pinctrl *pinctrl;
 
 	master = spi_alloc_master(&pdev->dev, sizeof *mcspi);
 	if (master == NULL) {
@@ -1219,6 +1222,11 @@ static int __devinit omap2_mcspi_probe(struct platform_device *pdev)
 	if (status < 0)

drivers/spi/spi-omap2-mcspi.c static int __devinit omap2_mcspi_probe(struct platform_device *pdev) · line 1232

Quoted 10 lines
drivers/spi/spi-omap2-mcspi.c +5 -0
 		goto dma_chnl_free;
 
+	pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
+	if (IS_ERR(pinctrl))
+		dev_warn(&pdev->dev,
+			"pins are not configured from the driver\n");
+
 	pm_runtime_use_autosuspend(&pdev->dev);
 	pm_runtime_set_autosuspend_delay(&pdev->dev, SPI_AUTOSUSPEND_TIMEOUT);
 	pm_runtime_enable(&pdev->dev);

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#5 lore raw

PATCH v2 2/2 ARM: OMAP2+: Enable pinctrl dummy states

In reply to Matt Porter

Enable pinctrl dummy states for all OMAP platforms that don't populate DT. This allows drivers to be converted to pinctrl and not generate new warnings on platforms that do not provide pinctrl data. These platforms already have pinmuxes configured before the drivers probe.

---
 arch/arm/mach-omap2/devices.c |    5 +++++
 1 file changed, 5 insertions(+)
arch/arm/mach-omap2/devices.c +5 -0
index 1efa984..6ef4010 100644
@@ -17,6 +17,7 @@
 #include <linux/err.h>
 #include <linux/slab.h>
 #include <linux/of.h>
+#include <linux/pinctrl/machine.h>
 #include <linux/platform_data/omap4-keypad.h>
 
 #include <asm/mach-types.h>
@@ -628,6 +629,10 @@ static inline void omap_init_vout(void) {}
 
 static int __init omap2_init_devices(void)
 {
+	/* Enable dummy states for those platforms without pinctrl support */
+	if (!of_have_populated_dt())
+		pinctrl_provide_dummies();
+
 	/*
 	 * please keep these calls, and their implementations above,
 	 * in alphabetical order so they're easier to sort through.
Signature · 1 line
1.7.9.5
maintainer
#6 lore raw

Re: [PATCH v2 2/2] ARM: OMAP2+: Enable pinctrl dummy states

Quoted 5 lines · Matt Porter

Enable pinctrl dummy states for all OMAP platforms that don't populate DT. This allows drivers to be converted to pinctrl and not generate new warnings on platforms that do not provide pinctrl data. These platforms already have pinmuxes configured before the drivers probe.

Thanks this should do the trick until we've converted to use DT. I'll queue this for the upcoming merge window.

Regards,

Tony

Quoted 31 lines
---
 arch/arm/mach-omap2/devices.c |    5 +++++
 1 file changed, 5 insertions(+)
arch/arm/mach-omap2/devices.c +5 -0
index 1efa984..6ef4010 100644
@@ -17,6 +17,7 @@
 #include <linux/err.h>
 #include <linux/slab.h>
 #include <linux/of.h>
+#include <linux/pinctrl/machine.h>
 #include <linux/platform_data/omap4-keypad.h>
 
 #include <asm/mach-types.h>
@@ -628,6 +629,10 @@ static inline void omap_init_vout(void) {}
 
 static int __init omap2_init_devices(void)
 {
+	/* Enable dummy states for those platforms without pinctrl support */
+	if (!of_have_populated_dt())
+		pinctrl_provide_dummies();
+
 	/*
 	 * please keep these calls, and their implementations above,
 	 * in alphabetical order so they're easier to sort through.
Signature · 1 line
1.7.9.5
Acked-by on v2 2/2
#7 lore raw

Re: [PATCH v2 2/2] ARM: OMAP2+: Enable pinctrl dummy states

In reply to Matt Porter
Quoted 7 lines · Matt Porter

Enable pinctrl dummy states for all OMAP platforms that don't populate DT. This allows drivers to be converted to pinctrl and not generate new warnings on platforms that do not provide pinctrl data. These platforms already have pinmuxes configured before the drivers probe.

Looks like a good idea, so FWIW:

Yours,
Linus Walleij

#8 lore raw
In reply to Matt Porter
Quoted 10 lines · Matt Porter

Changes since v1:
- warns that pins are not configured by the driver rather than exiting
- dummy states are only enabled for OMAP platforms where DT is not populated

This series enables pinctrl support for McSPI. Platforms that boot only from DT and rely on pinctrl to set pinmuxes appropriately require this for omap2-mcspi operation.

Quoted 5 lines

It has been tested on AM335x BeagleBone with an Adafruit SPI LCD attached and regression tested on Beagleboard xM booting in the !DT case, using board-omap3evm.c.

The series applies on top of Tony's dt-devel branch.

*sigh*, that's devel-dt of course.