Skip to contentSkip to conversation

spi-imx: some updates

PATCH In review Uwe Kleine-König 4 participants 12 messages Dec 8, 2009 – Dec 9, 2009

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

cover spi-imx: some updates

Hello,

this series depends on "spi: drain MXC SPI transfer buffer when probing device" which is currently in -mm and also included in my spi-imx branch (see below). IMHO at least my first patch should go into .33 as it fixes an oops.

I'll post the patches for review as a reply to this mail.

Best regards
Uwe

The following changes since commit 6035ccd8e9e40bb654fbfdef325902ab531679a5:
Linus Torvalds (1):

        Merge branch 'for-2.6.33' of git://git.kernel.dk/linux-2.6-block

are available in the git repository at:

git://git.pengutronix.de/git/ukl/linux-2.6.git spi-imx

Daniel Mack (1):
spi: drain MXC SPI transfer buffer when probing device

Sascha Hauer (1):
spi-imx: Add mx25 support

Uwe Kleine-K?nig (4):
spi-imx: use platform_driver_probe as probe lives in .init.text
spi-imx: correct check for platform_get_irq failing
spi-imx: use positive logic to distinguish cpu variants
spi-imx: don't access struct device directly but use dev_get_platdata

 drivers/spi/spi_imx.c |   23 +++++++++++++++--------
 1 files changed, 15 insertions(+), 8 deletions(-)
Signature · 2 lines
Pengutronix e.K.                              | Uwe Kleine-K?nig            |
Industrial Linux Solutions                    | http://www.pengutronix.de/  |
#1 lore raw

PATCH 1/5 spi-imx: use platform_driver_probe as probe lives in .init.text

Using platform_driver_register with a probe function defined using __init is wrong.

This fixes an oops after:

cd /sys/bus/platform/drivers/spi_imx
echo -n spi_imx.0 > unbind
echo -n spi_imx.0 > bind

Cc David Brownell <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Sascha Hauer <[email protected]>
---
 drivers/spi/spi_imx.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
drivers/spi/spi_imx.c +1 -2
index 1b17f44..c83ca05 100644
@@ -666,13 +666,12 @@ static struct platform_driver spi_imx_driver = {
 		   .name = DRIVER_NAME,
 		   .owner = THIS_MODULE,
 		   },
-	.probe = spi_imx_probe,
 	.remove = __exit_p(spi_imx_remove),
 };
 
 static int __init spi_imx_init(void)
 {
-	return platform_driver_register(&spi_imx_driver);
+	return platform_driver_probe(&spi_imx_driver, spi_imx_probe);
 }
 
 static void __exit spi_imx_exit(void)
Signature · 1 line
1.6.5.2
#2 lore raw

PATCH 2/5 spi-imx: correct check for platform_get_irq failing

platform_get_irq returns -ENXIO if there is no entry. So don't check return value being nonzero but greater or equal to zero.

Cc David Brownell <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Sascha Hauer <[email protected]>
---
 drivers/spi/spi_imx.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/spi/spi_imx.c +1 -1
index c83ca05..d8d9a35 100644
@@ -554,7 +554,7 @@ static int __init spi_imx_probe(struct platform_device *pdev)
 	}
 
 	spi_imx->irq = platform_get_irq(pdev, 0);
-	if (!spi_imx->irq) {
+	if (spi_imx->irq < 0) {
 		ret = -EINVAL;
 		goto out_iounmap;
 	}
Signature · 1 line
1.6.5.2
#3 lore raw

PATCH 3/5 spi-imx: use positive logic to distinguish cpu variants

This is much safer when support for new variants is added.

Cc David Brownell <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Sascha Hauer <[email protected]>
---
 drivers/spi/spi_imx.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/spi/spi_imx.c +1 -1
index d8d9a35..0ccbd1c 100644
@@ -593,7 +593,7 @@ static int __init spi_imx_probe(struct platform_device *pdev)
 	clk_enable(spi_imx->clk);
 	spi_imx->spi_clk = clk_get_rate(spi_imx->clk);
 
-	if (!cpu_is_mx31() || !cpu_is_mx35())
+	if (cpu_is_mx1() || cpu_is_mx21() || cpu_is_mx27())
 		writel(1, spi_imx->base + MXC_RESET);
 
 	/* drain receive buffer */
Signature · 1 line
1.6.5.2
#4 lore raw

PATCH 4/5 spi-imx: Add mx25 support

From: Sascha Hauer <[email protected]>

---
 drivers/spi/spi_imx.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/spi/spi_imx.c +4 -4
index 0ccbd1c..59b3a30 100644
@@ -208,7 +208,7 @@ static int mx31_config(struct spi_imx_data *spi_imx,
 
 	if (cpu_is_mx31())
 		reg |= (config->bpw - 1) << MX31_CSPICTRL_BC_SHIFT;
-	else if (cpu_is_mx35()) {
+	else if (cpu_is_mx25() || cpu_is_mx35()) {
 		reg |= (config->bpw - 1) << MX35_CSPICTRL_BL_SHIFT;
 		reg |= MX31_CSPICTRL_SSCTL;
 	}
@@ -222,7 +222,7 @@ static int mx31_config(struct spi_imx_data *spi_imx,
 	if (config->cs < 0) {
 		if (cpu_is_mx31())
 			reg |= (config->cs + 32) << MX31_CSPICTRL_CS_SHIFT;
-		else if (cpu_is_mx35())
+		else if (cpu_is_mx25() || cpu_is_mx35())
 			reg |= (config->cs + 32) << MX35_CSPICTRL_CS_SHIFT;
 	}
 
@@ -565,7 +565,7 @@ static int __init spi_imx_probe(struct platform_device *pdev)
 		goto out_iounmap;
 	}
 
-	if (cpu_is_mx31() || cpu_is_mx35()) {
+	if (cpu_is_mx25() || cpu_is_mx31() || cpu_is_mx35()) {
 		spi_imx->intctrl = mx31_intctrl;
 		spi_imx->config = mx31_config;
 		spi_imx->trigger = mx31_trigger;
@@ -597,7 +597,7 @@ static int __init spi_imx_probe(struct platform_device *pdev)
 		writel(1, spi_imx->base + MXC_RESET);
 
 	/* drain receive buffer */
-	if (cpu_is_mx31() || cpu_is_mx35())
+	if (cpu_is_mx25() || cpu_is_mx31() || cpu_is_mx35())
 		while (readl(spi_imx->base + MX3_CSPISTAT) & MX3_CSPISTAT_RR)
 			readl(spi_imx->base + MXC_CSPIRXDATA);
 
Signature · 1 line
1.6.5.2
#5 lore raw

PATCH 5/5 spi-imx: don't access struct device directly but use dev_get_platdata

Also there is no casting needed to assign a void pointer.

Cc David Brownell <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Sascha Hauer <[email protected]>
---
 drivers/spi/spi_imx.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/spi/spi_imx.c +1 -1
index 59b3a30..ea6d701 100644
@@ -492,7 +492,7 @@ static int __init spi_imx_probe(struct platform_device *pdev)
 	struct resource *res;
 	int i, ret;
 
-	mxc_platform_info = (struct spi_imx_master *)pdev->dev.platform_data;
+	mxc_platform_info = dev_get_platdata(&pdev->dev);
 	if (!mxc_platform_info) {
 		dev_err(&pdev->dev, "can't get the platform data\n");
 		return -EINVAL;
Signature · 1 line
1.6.5.2
#6 lore raw
In reply to Uwe Kleine-König
Quoted 4 lines · On Tue, 8 Dec 2009 22:12:58 +0100 Uwe Kleine-K__nig…

this series depends on "spi: drain MXC SPI transfer buffer when probing device" which is currently in -mm and also included in my spi-imx branch (see below). IMHO at least my first patch should go into .33 as it fixes an oops.

I queued all five for 2.6.33.

Once I've merged up the current -mm patch queue:

atmel_spi-fix-dma-addr-calculation-for-len-buffer_size.patch spi-controller-driver-for-designware-spi-core.patch
#
spi-add-pci-interface-driver-for-designware-spi-core.patch spi-add-pci-interface-driver-for-designware-spi-core-fix.patch spi-controller-driver-for-designware-spi-core-fix.patch
#
spidev-add-proper-section-markers.patch spidev-use-declare_bitmap-instead-of-declaring-the-array.patch spidev-use-declare_bitmap-instead-of-declaring-the-array-checkpatch-fixes.patch spi-drain-mxc-spi-transfer-buffer-when-probing-device.patch spi_s3c24xx-add-fiq-pseudo-dma-support.patch spi-superh-msiof-spi-master-driver.patch spi-superh-msiof-spi-master-driver-update.patch spi-nuc900-add-arm-driver-support-for-nuc900.patch spi-fix-spidev-compilation-failure-when-verbose-is-defined.patch
# spi-imx-use-platform_driver_probe-as-probe-lives-in-inittext.patch spi-imx-correct-check-for-platform_get_irq-failing.patch spi-imx-use-positive-logic-to-distinguish-cpu-variants.patch spi-imx-add-mx25-support.patch spi-imx-dont-access-struct-device-directly-but-use-dev_get_platdata.patch

I shall stop sending SPI patches to Linus. I'll send any which I accumulate to Grant instead.

#7 lore raw

2009/12/8 Andrew Morton <[email protected]>:

Quoted 9 lines
Quoted 4 lines · On Tue, 8 Dec 2009 22:12:58 +0100 Uwe Kleine-K__nig…

this series depends on "spi: drain MXC SPI transfer buffer when probing device" which is currently in -mm and also included in my spi-imx branch (see below). ?IMHO at least my first patch should go into .33 as it fixes an oops.

I queued all five for 2.6.33.

I had also picked up "drain MXC SPI transfer..." into my next-spi tree earlier today. After a few days I'll send Linus a pull request. I just need to make sure that Ben's tree gets pulled first because I've got other stuff in there depending on it.

Quoted 1 line

Once I've merged up the current -mm patch queue:

[... list of patches snipped ...]

Quoted 2 lines

I shall stop sending SPI patches to Linus. ?I'll send any which I accumulate to Grant instead.

I'm new to the job, so I'm being cautions about which things I'm pick up. However, I'll happily merge anything that Andrew says is okay. Andrew, when in the merge window do you typically send out patch queues?

g.

Signature · 2 lines
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
#8 lore raw
Quoted 2 lines · On Tue, 8 Dec 2009 17:25:59 -0700 Grant Likely <[email protected]>…

I'm new to the job, so I'm being cautions about which things I'm pick up. However, I'll happily merge anything that Andrew says is okay.

oop. If I'm going to send a patch to a subsystem maintainer I'll usually give it less attention than the ones I plan to merge myself.

Oh well, at least this way people will get their patches merged easily ;)

Quoted 2 lines

Andrew, when in the merge window do you typically send out patch queues?

Late. I stage the -mm patches after linux-next so I spend most of the merge window waiting for people to get their stuff into mainline.

Often there are stragglers who I need to route around. It's usually not a significant problem though.

#9 lore raw
Quoted 10 lines · Andrew Morton
Quoted 2 lines · On Tue, 8 Dec 2009 17:25:59 -0700 Grant Likely <[email protected]>…

I'm new to the job, so I'm being cautions about which things I'm pick up. ?However, I'll happily merge anything that Andrew says is okay.

oop. ?If I'm going to send a patch to a subsystem maintainer I'll usually give it less attention than the ones I plan to merge myself.

Oh well, at least this way people will get their patches merged easily ;)

Hmmm... maybe I'll be more selective then.

I've also got JH to set up a patchwork page for SPI so that I won't drop anything on the floor. I could certainly use some help with triaging & acking the stuff in there. Anyone want to volunteer?

Quoted 5 lines
Quoted 2 lines

Andrew, when in the merge window do you typically send out patch queues?

Late. ?I stage the -mm patches after linux-next so I spend most of the merge window waiting for people to get their stuff into mainline.

Okay, thanks.

Quoted 2 lines

Often there are stragglers who I need to route around. ?It's usually not a significant problem though.

g.

Signature · 2 lines
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
#10 lore raw
In reply to Grant Likely
Quoted 17 lines · Grant Likely

2009/12/8 Andrew Morton <[email protected]>:

Quoted 9 lines
Quoted 4 lines · On Tue, 8 Dec 2009 22:12:58 +0100 Uwe Kleine-K__nig…

this series depends on "spi: drain MXC SPI transfer buffer when probing device" which is currently in -mm and also included in my spi-imx branch (see below).  IMHO at least my first patch should go into .33 as it fixes an oops.

I queued all five for 2.6.33.

I had also picked up "drain MXC SPI transfer..." into my next-spi tree earlier today.  After a few days I'll send Linus a pull request.  I just need to make sure that Ben's tree gets pulled first because I've got other stuff in there depending on it.

Quoted 1 line

Once I've merged up the current -mm patch queue:

Quoted 9 lines

[... list of patches snipped ...]

Quoted 2 lines

I shall stop sending SPI patches to Linus.  I'll send any which I accumulate to Grant instead.

I'm new to the job, so I'm being cautions about which things I'm pick up.  However, I'll happily merge anything that Andrew says is okay. Andrew, when in the merge window do you typically send out patch queues?

Grant, may I know of your tree, if it's public?
thanks

#11 lore raw
Quoted 8 lines · jassi brar
Quoted 5 lines · Grant Likely

I'm new to the job, so I'm being cautions about which things I'm pick up. ?However, I'll happily merge anything that Andrew says is okay. Andrew, when in the merge window do you typically send out patch queues?

Grant, may I know of your tree, if it's public?

It's the next-spi branch of:

git://git.secretlab.ca/git/linux-2.6.git

g.

Signature · 2 lines
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.