Skip to contentSkip to conversation

Adopt pinctrl support for a few outstanding imx drivers

PATCH RESEND In review Shawn Guo 6 participants 23 messages May 7, 2012 – Jul 3, 2012

Subsystems (8)
lore
Share & tools
lore

Shawn Guo

author
#0 lore raw

cover Adopt pinctrl support for a few outstanding imx drivers

With patch 5b3aa5f (pinctrl: add pinctrl_provide_dummies interface for platforms to use) applied on pinctrl tree, and patch "ARM: imx: enable pinctrl dummy states" [1] being there, we are ready to adopt pinctrl API for imx drivers. So let's start from a few outstanding ones.

I would expect to ask Arnd and Olof to pull pinctrl tree into arm-soc as a dependency and then have series [1] and this patch set go through arm-soc tree to ease the merge process.

Resend to have subsystem lists Cc-ed.

Regards,
Shawn

[1] http://thread.gmane.org/gmane.linux.kernel.mmc/14180

Shawn Guo (5):
tty: serial: imx: adopt pinctrl support
net: fec: adopt pinctrl support
can: flexcan: adopt pinctrl support
i2c: imx: adopt pinctrl support
spi/imx: adopt pinctrl support

 drivers/i2c/busses/i2c-imx.c         |    8 ++++++++
 drivers/net/can/flexcan.c            |    6 ++++++
 drivers/net/ethernet/freescale/fec.c |    9 +++++++++
 drivers/spi/spi-imx.c                |    8 ++++++++
 drivers/tty/serial/imx.c             |    8 ++++++++
 5 files changed, 39 insertions(+), 0 deletions(-)
Signature · 1 line
1.7.5.4
author
#1 lore raw

PATCH RESEND 1/5 tty: serial: imx: adopt pinctrl support

---
 drivers/tty/serial/imx.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
drivers/tty/serial/imx.c +8 -0
index e7fecee..ec20673 100644
@@ -47,6 +47,7 @@
 #include <linux/slab.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
+#include <linux/pinctrl/consumer.h>
 
 #include <asm/io.h>
 #include <asm/irq.h>
@@ -1464,6 +1465,7 @@ static int serial_imx_probe(struct platform_device *pdev)
 	void __iomem *base;
 	int ret = 0;
 	struct resource *res;
+	struct pinctrl *pinctrl;
 
 	sport = kzalloc(sizeof(*sport), GFP_KERNEL);
 	if (!sport)
@@ -1503,6 +1505,12 @@ static int serial_imx_probe(struct platform_device *pdev)
 	sport->timer.function = imx_timeout;
 	sport->timer.data     = (unsigned long)sport;
 
+	pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
+	if (IS_ERR(pinctrl)) {
+		ret = PTR_ERR(pinctrl);
+		goto unmap;
+	}
+
 	sport->clk = clk_get(&pdev->dev, "uart");
 	if (IS_ERR(sport->clk)) {
 		ret = PTR_ERR(sport->clk);
Signature · 1 line
1.7.5.4
author
#3 lore raw

PATCH RESEND 2/5 net: fec: adopt pinctrl support

In reply to Shawn Guo
Cc netdev at vger.kernel.org
Cc David S. Miller <[email protected]>
---
 drivers/net/ethernet/freescale/fec.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
drivers/net/ethernet/freescale/fec.c +9 -0
index a12b3f5..500c106 100644
@@ -48,6 +48,7 @@
 #include <linux/of_device.h>
 #include <linux/of_gpio.h>
 #include <linux/of_net.h>
+#include <linux/pinctrl/consumer.h>
 
 #include <asm/cacheflush.h>
 
@@ -1542,6 +1543,7 @@ fec_probe(struct platform_device *pdev)
 	struct resource *r;
 	const struct of_device_id *of_id;
 	static int dev_id;
+	struct pinctrl *pinctrl;
 
 	of_id = of_match_device(fec_dt_ids, &pdev->dev);
 	if (of_id)
@@ -1609,6 +1611,12 @@ fec_probe(struct platform_device *pdev)
 		}
 	}
 
+	pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
+	if (IS_ERR(pinctrl)) {
+		ret = PTR_ERR(pinctrl);
+		goto failed_pin;
+	}
+
 	fep->clk = clk_get(&pdev->dev, NULL);
 	if (IS_ERR(fep->clk)) {
 		ret = PTR_ERR(fep->clk);
@@ -1639,6 +1647,7 @@ failed_mii_init:
 failed_init:
 	clk_disable_unprepare(fep->clk);
 	clk_put(fep->clk);
+failed_pin:
 failed_clk:
 	for (i = 0; i < FEC_IRQ_NUM; i++) {
 		irq = platform_get_irq(pdev, i);
Signature · 1 line
1.7.5.4
author
#6 lore raw

PATCH RESEND 3/5 can: flexcan: adopt pinctrl support

In reply to Shawn Guo
Cc linux-can at vger.kernel.org
Cc Marc Kleine-Budde <[email protected]>
---
 drivers/net/can/flexcan.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
drivers/net/can/flexcan.c +6 -0
index 1efb083..38c0690 100644
@@ -35,6 +35,7 @@
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/platform_device.h>
+#include <linux/pinctrl/consumer.h>
 
 #define DRV_NAME			"flexcan"
 
@@ -927,11 +928,16 @@ static int __devinit flexcan_probe(struct platform_device *pdev)
 	struct flexcan_priv *priv;
 	struct resource *mem;
 	struct clk *clk = NULL;
+	struct pinctrl *pinctrl;
 	void __iomem *base;
 	resource_size_t mem_size;
 	int err, irq;
 	u32 clock_freq = 0;
 
+	pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
+	if (IS_ERR(pinctrl))
+		return PTR_ERR(pinctrl);
+
 	if (pdev->dev.of_node) {
 		const u32 *clock_freq_p;
 
Signature · 1 line
1.7.5.4
#7 lore raw

Re: [PATCH RESEND 3/5] can: flexcan: adopt pinctrl support

Hello,

Quoted 4 lines · Shawn Guo
Cc linux-can at vger.kernel.org
Cc Marc Kleine-Budde <[email protected]>

---

It doesn't compile yet against net-next/master, which is based on v3.4-rc4:

/home/frogger/pengutronix/socketcan/linux/drivers/net/can/flexcan.c: In function 'flexcan_probe':
/home/frogger/pengutronix/socketcan/linux/drivers/net/can/flexcan.c:937:
error: implicit declaration of function 'devm_pinctrl_get_select_default' /home/frogger/pengutronix/socketcan/linux/drivers/net/can/flexcan.c:937:
warning: assignment makes pointer from integer without a cast

Which tree does this series depend on? If this should go over the linux-can tree, I have to ask David first to merge this.

regards,
Marc

Signature · 12 lines
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120507/0a7929ce/attachment-0001.sig>
author
#8 lore raw

Re: [PATCH RESEND 3/5] can: flexcan: adopt pinctrl support

Quoted 9 lines · Marc Kleine-Budde

It doesn't compile yet against net-next/master, which is based on v3.4-rc4:

/home/frogger/pengutronix/socketcan/linux/drivers/net/can/flexcan.c: In function 'flexcan_probe':
/home/frogger/pengutronix/socketcan/linux/drivers/net/can/flexcan.c:937:
error: implicit declaration of function 'devm_pinctrl_get_select_default' /home/frogger/pengutronix/socketcan/linux/drivers/net/can/flexcan.c:937:
warning: assignment makes pointer from integer without a cast

Quoted 3 lines

Which tree does this series depend on? If this should go over the linux-can tree, I have to ask David first to merge this.

Thanks for the response, Marc. The patch depends on pinctrl tree and a couple of other patches that will go through arm-soc tree, so I would like to ask for your ack to have the patch go over arm-soc tree.

Regards,
Shawn

maintainer Acked-by
#9 lore raw

Re: [PATCH RESEND 3/5] can: flexcan: adopt pinctrl support

Quoted 10 lines · Shawn Guo
Quoted 9 lines · Marc Kleine-Budde

It doesn't compile yet against net-next/master, which is based on v3.4-rc4:

/home/frogger/pengutronix/socketcan/linux/drivers/net/can/flexcan.c: In function 'flexcan_probe':
/home/frogger/pengutronix/socketcan/linux/drivers/net/can/flexcan.c:937:
error: implicit declaration of function 'devm_pinctrl_get_select_default' /home/frogger/pengutronix/socketcan/linux/drivers/net/can/flexcan.c:937:
warning: assignment makes pointer from integer without a cast

Quoted 6 lines
Quoted 3 lines

Which tree does this series depend on? If this should go over the linux-can tree, I have to ask David first to merge this.

Thanks for the response, Marc. The patch depends on pinctrl tree and a couple of other patches that will go through arm-soc tree, so I would like to ask for your ack to have the patch go over arm-soc tree.

Fine with me. David, is this okay? Shawn, better wait for David's okay.

regards, Marc

Signature · 12 lines
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120507/e673a848/attachment.sig>
#11 lore raw

PATCH RESEND 3/5 can: flexcan: adopt pinctrl support

In reply to Shawn Guo
Quoted 25 lines · Shawn Guo
Cc linux-can at vger.kernel.org
Cc Marc Kleine-Budde <[email protected]>
---
 drivers/net/can/flexcan.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
drivers/net/can/flexcan.c +2 -0
index 1efb083..38c0690 100644
@@ -35,6 +35,7 @@
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/platform_device.h>
+#include <linux/pinctrl/consumer.h>
 
 #define DRV_NAME			"flexcan"
 
@@ -927,11 +928,16 @@ static int __devinit flexcan_probe(struct platform_device *pdev)
 	struct flexcan_priv *priv;
 	struct resource *mem;
 	struct clk *clk = NULL;
+	struct pinctrl *pinctrl;
 	void __iomem *base;

drivers/net/can/flexcan.c static int __devinit flexcan_probe(struct platform_device *pdev) · line 942

Quoted 10 lines
drivers/net/can/flexcan.c +4 -0
 	resource_size_t mem_size;
 	int err, irq;
 	u32 clock_freq = 0;
 
+	pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
+	if (IS_ERR(pinctrl))
+		return PTR_ERR(pinctrl);
+
 	if (pdev->dev.of_node) {
 		const u32 *clock_freq_p;

I'm on mx28 and trying to load the flexcan driver via DT, but devm_pinctrl_get_select_default fails with -19.

What am I doing wrong? Will this fail with the same error on non DT platforms?

Marc

Signature · 12 lines
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120702/bf197aab/attachment.sig>
author
#12 lore raw

PATCH RESEND 3/5 can: flexcan: adopt pinctrl support

Quoted 10 lines · Marc Kleine-Budde

drivers/net/can/flexcan.c static int __devinit flexcan_probe(struct platform_device *pdev) · line 942

Quoted 6 lines
drivers/net/can/flexcan.c +4 -0
+	pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
+	if (IS_ERR(pinctrl))
+		return PTR_ERR(pinctrl);
+
 	if (pdev->dev.of_node) {
 		const u32 *clock_freq_p;

I'm on mx28 and trying to load the flexcan driver via DT, but devm_pinctrl_get_select_default fails with -19.

You need to have pinctrl state setup in dts, some like:

http://article.gmane.org/gmane.linux.ports.arm.kernel/174148

Quoted 3 lines

What am I doing wrong? Will this fail with the same error on non DT platforms?

No, it will not, because a dummy pinctrl state is provided by calling pinctrl_provide_dummies() in mx28_soc_init().

Signature · 2 lines
Regards,
Shawn
#13 lore raw

PATCH RESEND 3/5 can: flexcan: adopt pinctrl support

Quoted 11 lines · Shawn Guo
Quoted 10 lines · Marc Kleine-Budde

drivers/net/can/flexcan.c static int __devinit flexcan_probe(struct platform_device *pdev) · line 942

Quoted 6 lines
drivers/net/can/flexcan.c +4 -0
+	pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
+	if (IS_ERR(pinctrl))
+		return PTR_ERR(pinctrl);
+
 	if (pdev->dev.of_node) {
 		const u32 *clock_freq_p;

I'm on mx28 and trying to load the flexcan driver via DT, but devm_pinctrl_get_select_default fails with -19.

Quoted 3 lines

You need to have pinctrl state setup in dts, some like:

http://article.gmane.org/gmane.linux.ports.arm.kernel/174148

Works like charm.

tnx, Marc

Signature · 12 lines
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120703/003854e2/attachment.sig>
author
#14 lore raw

PATCH RESEND 4/5 i2c: imx: adopt pinctrl support

In reply to Shawn Guo
Cc linux-i2c at vger.kernel.org
Cc Wolfram Sang <[email protected]>
---
 drivers/i2c/busses/i2c-imx.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
drivers/i2c/busses/i2c-imx.c +8 -0
index dfb84b7..56bce9a 100644
@@ -51,6 +51,7 @@
 #include <linux/of.h>
 #include <linux/of_device.h>
 #include <linux/of_i2c.h>
+#include <linux/pinctrl/consumer.h>
 
 #include <mach/irqs.h>
 #include <mach/hardware.h>
@@ -470,6 +471,7 @@ static int __init i2c_imx_probe(struct platform_device *pdev)
 	struct imx_i2c_struct *i2c_imx;
 	struct resource *res;
 	struct imxi2c_platform_data *pdata = pdev->dev.platform_data;
+	struct pinctrl *pinctrl;
 	void __iomem *base;
 	resource_size_t res_size;
 	int irq, bitrate;
@@ -520,6 +522,12 @@ static int __init i2c_imx_probe(struct platform_device *pdev)
 	i2c_imx->base			= base;
 	i2c_imx->res			= res;
 
+	pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
+	if (IS_ERR(pinctrl)) {
+		ret = PTR_ERR(pinctrl);
+		goto fail3;
+	}
+
 	/* Get I2C clock */
 	i2c_imx->clk = clk_get(&pdev->dev, "i2c_clk");
 	if (IS_ERR(i2c_imx->clk)) {
Signature · 1 line
1.7.5.4
author
#16 lore raw

PATCH RESEND 5/5 spi/imx: adopt pinctrl support

In reply to Shawn Guo
Cc spi-devel-general at lists.sourceforge.net
Cc Grant Likely <[email protected]>
---
 drivers/spi/spi-imx.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
drivers/spi/spi-imx.c +8 -0
index 570f220..69c9a66 100644
@@ -37,6 +37,7 @@
 #include <linux/of.h>
 #include <linux/of_device.h>
 #include <linux/of_gpio.h>
+#include <linux/pinctrl/consumer.h>
 
 #include <mach/spi.h>
 
@@ -758,6 +759,7 @@ static int __devinit spi_imx_probe(struct platform_device *pdev)
 	struct spi_master *master;
 	struct spi_imx_data *spi_imx;
 	struct resource *res;
+	struct pinctrl *pinctrl;
 	int i, ret, num_cs;
 
 	if (!np && !mxc_platform_info) {
@@ -845,6 +847,12 @@ static int __devinit spi_imx_probe(struct platform_device *pdev)
 		goto out_iounmap;
 	}
 
+	pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
+	if (IS_ERR(pinctrl)) {
+		ret = PTR_ERR(pinctrl);
+		goto out_free_irq;
+	}
+
 	spi_imx->clk = clk_get(&pdev->dev, NULL);
 	if (IS_ERR(spi_imx->clk)) {
 		dev_err(&pdev->dev, "unable to get clock\n");
Signature · 1 line
1.7.5.4
#18 lore raw

PATCH RESEND 5/5 spi/imx: adopt pinctrl support

Quoted 8 lines · Dong Aisheng
Quoted 6 lines · Shawn Guo
Cc spi-devel-general at lists.sourceforge.net
Cc Grant Likely <[email protected]>
---
 drivers/spi/spi-imx.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

Can I assume all the patches in this series will be merged via the same branch?

g.

#19 lore raw

PATCH RESEND 5/5 spi/imx: adopt pinctrl support

Quoted 3 lines · Grant Likely

Can I assume all the patches in this series will be merged via the same branch?

Yes, we will have them all go via arm-soc.

Signature · 2 lines
Regards,
Shawn
#20 lore raw
In reply to Shawn Guo
Quoted 9 lines · Shawn Guo

With patch 5b3aa5f (pinctrl: add pinctrl_provide_dummies interface for platforms to use) applied on pinctrl tree, and patch "ARM: imx: enable pinctrl dummy states" [1] being there, we are ready to adopt pinctrl API for imx drivers. So let's start from a few outstanding ones.

I would expect to ask Arnd and Olof to pull pinctrl tree into arm-soc as a dependency and then have series [1] and this patch set go through arm-soc tree to ease the merge process.

Shouldn't we add the pinctrl states in dts file at the same time with this patch series or using another separate patch to add them before this series to avoid breaking the exist mx6q platforms?

Quoted 9 lines

Resend to have subsystem lists Cc-ed.

Regards,
Shawn

[1] http://thread.gmane.org/gmane.linux.kernel.mmc/14180

Shawn Guo (5):
tty: serial: imx: adopt pinctrl support

...

Quoted 2 lines

net: fec: adopt pinctrl support
can: flexcan: adopt pinctrl support

This two also depends on another patch you sent. [PATCH RESEND 1/9] ARM: mxs: enable pinctrl dummy states
http://www.spinics.net/lists/arm-kernel/msg173341.html

Maybe you can put this two in the mxs convert series to avoid breaking mxs platforms.
[PATCH 0/9] Enable pinctrl support for mach-mxs
http://www.spinics.net/lists/arm-kernel/msg173312.html

Regards
Dong Aisheng

Quoted 19 lines

i2c: imx: adopt pinctrl support
spi/imx: adopt pinctrl support

 drivers/i2c/busses/i2c-imx.c         |    8 ++++++++
 drivers/net/can/flexcan.c            |    6 ++++++
 drivers/net/ethernet/freescale/fec.c |    9 +++++++++
 drivers/spi/spi-imx.c                |    8 ++++++++
 drivers/tty/serial/imx.c             |    8 ++++++++
 5 files changed, 39 insertions(+), 0 deletions(-)
Signature · 7 lines
1.7.5.4


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
author
#21 lore raw
Quoted 4 lines · Dong Aisheng

Shouldn't we add the pinctrl states in dts file at the same time with this patch series or using another separate patch to add them before this series to avoid breaking the exist mx6q platforms?

Ah, I just noticed that your patch "ARM: imx: enable pinctrl dummy states" did not cover imx6q. I think we should do the same for imx6q, so that we can separate dts update from the driver change. When all imx6q boards' dts files get updated to have pins defined for the devices, we can then remove dummy state for imx6q. Doing so will ease the pinctrl migration for those imx6q boards.

Will update your patch on my branch to have dummy state enabled for imx6q.

Quoted 11 lines
Quoted 2 lines

net: fec: adopt pinctrl support
can: flexcan: adopt pinctrl support

This two also depends on another patch you sent. [PATCH RESEND 1/9] ARM: mxs: enable pinctrl dummy states
http://www.spinics.net/lists/arm-kernel/msg173341.html

Maybe you can put this two in the mxs convert series to avoid breaking mxs platforms.
[PATCH 0/9] Enable pinctrl support for mach-mxs
http://www.spinics.net/lists/arm-kernel/msg173312.html

Right. I'm going to merge these two series into one since there are device drives shared between imx and mxs.

Signature · 2 lines
Regards,
Shawn
#22 lore raw
Quoted 7 lines · Shawn Guo
Quoted 4 lines · Dong Aisheng

Shouldn't we add the pinctrl states in dts file at the same time with this patch series or using another separate patch to add them before this series to avoid breaking the exist mx6q platforms?

Ah, I just noticed that your patch "ARM: imx: enable pinctrl dummy states" did not cover imx6q. I think we should do the same for imx6q,

Yes, doing that was to force people to add pinctrl states in dts file rather than using dummy state since mx6 supports pinctrl driver.

Quoted 5 lines

so that we can separate dts update from the driver change. When all imx6q boards' dts files get updated to have pins defined for the devices, we can then remove dummy state for imx6q. Doing so will ease the pinctrl migration for those imx6q boards.

Well, considering we have several mx6 boards, i think i can also be fine with this way to ease the mx6q pinctrl migration.

Quoted 3 lines

Will update your patch on my branch to have dummy state enabled for imx6q.

Then go ahead.

Regards
Dong Aisheng