Re: [PATCH] spi/fsl_spi: fix CPM spi driver
Hi Grant, is this patch in your eyes ok to be scheduled for the next linux merge window or is something missing? Or should it go through the powerpc tree and not through your spi tree? Please let me know your opinion. Best regards Holger Brunck On 06/20/2011 06:31 PM, Holger Brunck wrote: This patch fixes the freescale spi driver for CPM. Without this patch SPI on CPM failed because cpm_muram_alloc_fixed tries to allocate muram in an preserved area. The error reported was: mpc8xxx_spi f0011a80.spi: can't allocate spi parameter ram mpc8xxx_spi: probe of f0011a80.spi failed with error -12 Now the driver uses of_iomap to get access to this area similar to i2c driver driver in the i2c-cpm.c which has a similar device tree node. This is tested on a MPC8247 with CPM2. Signed-off-by: Holger Brunck holger.bru...@keymile.com cc: Grant Likely grant.lik...@secretlab.ca cc: spi-devel-general@lists.sourceforge.net --- This was the same problem reported and discussed on ppc-dev for CPM1: http://lists.ozlabs.org/pipermail/linuxppc-dev/2010-September/085739.html drivers/spi/spi_fsl_spi.c | 28 +++- 1 files changed, 11 insertions(+), 17 deletions(-) diff --git a/drivers/spi/spi_fsl_spi.c b/drivers/spi/spi_fsl_spi.c index 7963c9b..ca57edf 100644 --- a/drivers/spi/spi_fsl_spi.c +++ b/drivers/spi/spi_fsl_spi.c @@ -684,7 +684,7 @@ static unsigned long fsl_spi_cpm_get_pram(struct mpc8xxx_spi *mspi) struct device_node *np = dev-of_node; const u32 *iprop; int size; - unsigned long spi_base_ofs; + void __iomem *spi_base; unsigned long pram_ofs = -ENOMEM; /* Can't use of_address_to_resource(), QE muram isn't at 0. */ @@ -702,33 +702,27 @@ static unsigned long fsl_spi_cpm_get_pram(struct mpc8xxx_spi *mspi) return pram_ofs; } - /* CPM1 and CPM2 pram must be at a fixed addr. */ - if (!iprop || size != sizeof(*iprop) * 4) - return -ENOMEM; - - spi_base_ofs = cpm_muram_alloc_fixed(iprop[2], 2); - if (IS_ERR_VALUE(spi_base_ofs)) - return -ENOMEM; + spi_base = of_iomap(np, 1); + if (spi_base == NULL) + return -EINVAL; if (mspi-flags SPI_CPM2) { pram_ofs = cpm_muram_alloc(SPI_PRAM_SIZE, 64); - if (!IS_ERR_VALUE(pram_ofs)) { - u16 __iomem *spi_base = cpm_muram_addr(spi_base_ofs); - - out_be16(spi_base, pram_ofs); - } + out_be16(spi_base, pram_ofs); } else { - struct spi_pram __iomem *pram = cpm_muram_addr(spi_base_ofs); + struct spi_pram __iomem *pram = spi_base; u16 rpbase = in_be16(pram-rpbase); /* Microcode relocation patch applied? */ if (rpbase) pram_ofs = rpbase; - else - return spi_base_ofs; + else { + pram_ofs = cpm_muram_alloc(SPI_PRAM_SIZE, 64); + out_be16(spi_base, pram_ofs); + } } - cpm_muram_free(spi_base_ofs); + iounmap(spi_base); return pram_ofs; } -- All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2d-c2 ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH] spi/fsl_spi: fix CPM spi driver
On Mon, Jun 20, 2011 at 06:31:57PM +0200, Holger Brunck wrote: This patch fixes the freescale spi driver for CPM. Without this patch SPI on CPM failed because cpm_muram_alloc_fixed tries to allocate muram in an preserved area. The error reported was: mpc8xxx_spi f0011a80.spi: can't allocate spi parameter ram mpc8xxx_spi: probe of f0011a80.spi failed with error -12 Now the driver uses of_iomap to get access to this area similar to i2c driver driver in the i2c-cpm.c which has a similar device tree node. This is tested on a MPC8247 with CPM2. Signed-off-by: Holger Brunck holger.bru...@keymile.com cc: Grant Likely grant.lik...@secretlab.ca cc: spi-devel-general@lists.sourceforge.net Applied, thanks. g. --- This was the same problem reported and discussed on ppc-dev for CPM1: http://lists.ozlabs.org/pipermail/linuxppc-dev/2010-September/085739.html drivers/spi/spi_fsl_spi.c | 28 +++- 1 files changed, 11 insertions(+), 17 deletions(-) diff --git a/drivers/spi/spi_fsl_spi.c b/drivers/spi/spi_fsl_spi.c index 7963c9b..ca57edf 100644 --- a/drivers/spi/spi_fsl_spi.c +++ b/drivers/spi/spi_fsl_spi.c @@ -684,7 +684,7 @@ static unsigned long fsl_spi_cpm_get_pram(struct mpc8xxx_spi *mspi) struct device_node *np = dev-of_node; const u32 *iprop; int size; - unsigned long spi_base_ofs; + void __iomem *spi_base; unsigned long pram_ofs = -ENOMEM; /* Can't use of_address_to_resource(), QE muram isn't at 0. */ @@ -702,33 +702,27 @@ static unsigned long fsl_spi_cpm_get_pram(struct mpc8xxx_spi *mspi) return pram_ofs; } - /* CPM1 and CPM2 pram must be at a fixed addr. */ - if (!iprop || size != sizeof(*iprop) * 4) - return -ENOMEM; - - spi_base_ofs = cpm_muram_alloc_fixed(iprop[2], 2); - if (IS_ERR_VALUE(spi_base_ofs)) - return -ENOMEM; + spi_base = of_iomap(np, 1); + if (spi_base == NULL) + return -EINVAL; if (mspi-flags SPI_CPM2) { pram_ofs = cpm_muram_alloc(SPI_PRAM_SIZE, 64); - if (!IS_ERR_VALUE(pram_ofs)) { - u16 __iomem *spi_base = cpm_muram_addr(spi_base_ofs); - - out_be16(spi_base, pram_ofs); - } + out_be16(spi_base, pram_ofs); } else { - struct spi_pram __iomem *pram = cpm_muram_addr(spi_base_ofs); + struct spi_pram __iomem *pram = spi_base; u16 rpbase = in_be16(pram-rpbase); /* Microcode relocation patch applied? */ if (rpbase) pram_ofs = rpbase; - else - return spi_base_ofs; + else { + pram_ofs = cpm_muram_alloc(SPI_PRAM_SIZE, 64); + out_be16(spi_base, pram_ofs); + } } - cpm_muram_free(spi_base_ofs); + iounmap(spi_base); return pram_ofs; } -- 1.7.1 -- All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2d-c2 ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH] spi/fsl_spi: fix CPM spi driver
On Tue, Jul 05, 2011 at 04:31:50PM +0200, Holger Brunck wrote: Hi Grant, is this patch in your eyes ok to be scheduled for the next linux merge window or is something missing? Or should it go through the powerpc tree and not through your spi tree? No, I just hadn't gotten to it yet. Sometimes I need to be pinged. I've merged it. g. Please let me know your opinion. Best regards Holger Brunck On 06/20/2011 06:31 PM, Holger Brunck wrote: This patch fixes the freescale spi driver for CPM. Without this patch SPI on CPM failed because cpm_muram_alloc_fixed tries to allocate muram in an preserved area. The error reported was: mpc8xxx_spi f0011a80.spi: can't allocate spi parameter ram mpc8xxx_spi: probe of f0011a80.spi failed with error -12 Now the driver uses of_iomap to get access to this area similar to i2c driver driver in the i2c-cpm.c which has a similar device tree node. This is tested on a MPC8247 with CPM2. Signed-off-by: Holger Brunck holger.bru...@keymile.com cc: Grant Likely grant.lik...@secretlab.ca cc: spi-devel-general@lists.sourceforge.net --- This was the same problem reported and discussed on ppc-dev for CPM1: http://lists.ozlabs.org/pipermail/linuxppc-dev/2010-September/085739.html drivers/spi/spi_fsl_spi.c | 28 +++- 1 files changed, 11 insertions(+), 17 deletions(-) diff --git a/drivers/spi/spi_fsl_spi.c b/drivers/spi/spi_fsl_spi.c index 7963c9b..ca57edf 100644 --- a/drivers/spi/spi_fsl_spi.c +++ b/drivers/spi/spi_fsl_spi.c @@ -684,7 +684,7 @@ static unsigned long fsl_spi_cpm_get_pram(struct mpc8xxx_spi *mspi) struct device_node *np = dev-of_node; const u32 *iprop; int size; - unsigned long spi_base_ofs; + void __iomem *spi_base; unsigned long pram_ofs = -ENOMEM; /* Can't use of_address_to_resource(), QE muram isn't at 0. */ @@ -702,33 +702,27 @@ static unsigned long fsl_spi_cpm_get_pram(struct mpc8xxx_spi *mspi) return pram_ofs; } - /* CPM1 and CPM2 pram must be at a fixed addr. */ - if (!iprop || size != sizeof(*iprop) * 4) - return -ENOMEM; - - spi_base_ofs = cpm_muram_alloc_fixed(iprop[2], 2); - if (IS_ERR_VALUE(spi_base_ofs)) - return -ENOMEM; + spi_base = of_iomap(np, 1); + if (spi_base == NULL) + return -EINVAL; if (mspi-flags SPI_CPM2) { pram_ofs = cpm_muram_alloc(SPI_PRAM_SIZE, 64); - if (!IS_ERR_VALUE(pram_ofs)) { - u16 __iomem *spi_base = cpm_muram_addr(spi_base_ofs); - - out_be16(spi_base, pram_ofs); - } + out_be16(spi_base, pram_ofs); } else { - struct spi_pram __iomem *pram = cpm_muram_addr(spi_base_ofs); + struct spi_pram __iomem *pram = spi_base; u16 rpbase = in_be16(pram-rpbase); /* Microcode relocation patch applied? */ if (rpbase) pram_ofs = rpbase; - else - return spi_base_ofs; + else { + pram_ofs = cpm_muram_alloc(SPI_PRAM_SIZE, 64); + out_be16(spi_base, pram_ofs); + } } - cpm_muram_free(spi_base_ofs); + iounmap(spi_base); return pram_ofs; } -- All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2d-c2 ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
[PATCH] spi/tegra: Use engineering names in DT compatible property
Engineering names are more stable than marketing names. Hence, use them for Device Tree compatible properties instead. Signed-off-by: Stephen Warren swar...@nvidia.com --- Grant, this is against devicetree/arm, and also makes sense for devicetree/test. .../devicetree/bindings/spi/spi_nvidia.txt |2 +- drivers/spi/spi_tegra.c|2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/spi/spi_nvidia.txt b/Documentation/devicetree/bindings/spi/spi_nvidia.txt index bde450b..6b9e518 100644 --- a/Documentation/devicetree/bindings/spi/spi_nvidia.txt +++ b/Documentation/devicetree/bindings/spi/spi_nvidia.txt @@ -1,5 +1,5 @@ NVIDIA Tegra 2 SPI device Required properties: -- compatible : should be nvidia,tegra250-spi. +- compatible : should be nvidia,tegra20-spi. - gpios : should specify GPIOs used for chipselect. diff --git a/drivers/spi/spi_tegra.c b/drivers/spi/spi_tegra.c index 1e7de98..b0e3586 100644 --- a/drivers/spi/spi_tegra.c +++ b/drivers/spi/spi_tegra.c @@ -598,7 +598,7 @@ MODULE_ALIAS(platform:spi_tegra); #ifdef CONFIG_OF static struct of_device_id spi_tegra_of_match_table[] __devinitdata = { - { .compatible = nvidia,tegra250-spi, }, + { .compatible = nvidia,tegra20-spi, }, {} }; MODULE_DEVICE_TABLE(of, spi_tegra_of_match_table); -- 1.7.0.4 -- All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2d-c2 ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general
Re: [PATCH] spi/tegra: Use engineering names in DT compatible property
On Tue, Jul 05, 2011 at 02:18:02PM -0600, Stephen Warren wrote: Engineering names are more stable than marketing names. Hence, use them for Device Tree compatible properties instead. Signed-off-by: Stephen Warren swar...@nvidia.com --- Grant, this is against devicetree/arm, and also makes sense for devicetree/test. Applied to spi/next, thanks. g. .../devicetree/bindings/spi/spi_nvidia.txt |2 +- drivers/spi/spi_tegra.c|2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/spi/spi_nvidia.txt b/Documentation/devicetree/bindings/spi/spi_nvidia.txt index bde450b..6b9e518 100644 --- a/Documentation/devicetree/bindings/spi/spi_nvidia.txt +++ b/Documentation/devicetree/bindings/spi/spi_nvidia.txt @@ -1,5 +1,5 @@ NVIDIA Tegra 2 SPI device Required properties: -- compatible : should be nvidia,tegra250-spi. +- compatible : should be nvidia,tegra20-spi. - gpios : should specify GPIOs used for chipselect. diff --git a/drivers/spi/spi_tegra.c b/drivers/spi/spi_tegra.c index 1e7de98..b0e3586 100644 --- a/drivers/spi/spi_tegra.c +++ b/drivers/spi/spi_tegra.c @@ -598,7 +598,7 @@ MODULE_ALIAS(platform:spi_tegra); #ifdef CONFIG_OF static struct of_device_id spi_tegra_of_match_table[] __devinitdata = { - { .compatible = nvidia,tegra250-spi, }, + { .compatible = nvidia,tegra20-spi, }, {} }; MODULE_DEVICE_TABLE(of, spi_tegra_of_match_table); -- 1.7.0.4 -- All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2d-c2 ___ spi-devel-general mailing list spi-devel-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spi-devel-general