linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/2] spi: fsl-spi: Allow dynamic allocation of CPM1 parameter RAM
@ 2014-10-03 12:56 Christophe Leroy
       [not found] ` <20141003125609.5BEA11AB276-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: Christophe Leroy @ 2014-10-03 12:56 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Mark Brown,
	Marcelo Tosatti, Vitaly Bordug
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-spi-u79uwXL29TY76Z2rM5mHXA, Joakim Tjernlund,
	scottwood-KZfg59tc24xl57MIdRCFDg

On CPM1, the SPI parameter RAM has a default location. In order to use SPI while
using SCC2 with features like QMC or Ethernet, it is necessary to relocate SPI
parameter RAM in a free location in the CPM dual port RAM. With this patch,
when CONFIG_CPM1_RELOCSPI is set, the parameter RAM for SPI is dynamically
allocated with cpm_muram_alloc().

Signed-off-by: Christophe Leroy <christophe.leroy-GgN8y9CXRhA@public.gmane.org>

---
 arch/powerpc/platforms/8xx/Kconfig | 11 +++++++++++
 drivers/spi/spi-fsl-cpm.c          |  5 +++++
 2 files changed, 16 insertions(+)

diff --git a/arch/powerpc/platforms/8xx/Kconfig b/arch/powerpc/platforms/8xx/Kconfig
index 7c1690b..3b76a3f 100644
--- a/arch/powerpc/platforms/8xx/Kconfig
+++ b/arch/powerpc/platforms/8xx/Kconfig
@@ -203,4 +203,15 @@ config UCODE_PATCH
 	default y
 	depends on !NO_UCODE_PATCH
 
+config CPM1_RELOCSPI
+	bool "Dynamic SPI relocation"
+	default n
+	help
+	  On recent MPC8xx (at least MPC866 and MPC885) SPI can be relocated
+	  without micropatch. This activates relocation to a dynamically
+	  allocated area in the CPM Dual port RAM.
+	  When combined with SPI relocation patch (for older MPC8xx) it avoids
+	  the "loss" of additional Dual port RAM space just above the patch,
+	  which might be needed for example when using the CPM QMC.
+
 endmenu
diff --git a/drivers/spi/spi-fsl-cpm.c b/drivers/spi/spi-fsl-cpm.c
index 0f3a912..f33820e 100644
--- a/drivers/spi/spi-fsl-cpm.c
+++ b/drivers/spi/spi-fsl-cpm.c
@@ -262,6 +262,10 @@ static unsigned long fsl_spi_cpm_get_pram(struct mpc8xxx_spi *mspi)
 		pram_ofs = cpm_muram_alloc(SPI_PRAM_SIZE, 64);
 		out_be16(spi_base, pram_ofs);
 	} else {
+#ifdef CONFIG_CPM1_RELOCSPI
+		pram_ofs = cpm_muram_alloc(SPI_PRAM_SIZE, 32);
+		out_be16(spi_base, pram_ofs);
+#else
 		u16 rpbase = in_be16(spi_base);
 
 		/* Microcode relocation patch applied | rpbase set by default */
@@ -271,6 +275,7 @@ static unsigned long fsl_spi_cpm_get_pram(struct mpc8xxx_spi *mspi)
 			pram_ofs = offsetof(cpm8xx_t, cp_dparam[PROFF_SPI]) -
 				   offsetof(cpm8xx_t, cp_dpmem[0]);
 		}
+#endif
 	}
 
 	iounmap(spi_base);
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-10-08 18:45 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-03 12:56 [PATCH 2/2] spi: fsl-spi: Allow dynamic allocation of CPM1 parameter RAM Christophe Leroy
     [not found] ` <20141003125609.5BEA11AB276-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2014-10-03 14:44   ` Mark Brown
     [not found]     ` <20141003144420.GC24441-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2014-10-03 20:15       ` christophe leroy
2014-10-03 20:24         ` Scott Wood
     [not found]           ` <1412367858.13320.432.camel-88ow+0ZRuxG2UiBs7uKeOtHuzzzSOjJt@public.gmane.org>
2014-10-04 10:15             ` christophe leroy
2014-10-07  0:19               ` Scott Wood
     [not found]                 ` <1412641184.13320.506.camel-88ow+0ZRuxG2UiBs7uKeOtHuzzzSOjJt@public.gmane.org>
2014-10-08 16:46                   ` leroy christophe
     [not found]                     ` <54356A53.3010700-GgN8y9CXRhA@public.gmane.org>
2014-10-08 18:45                       ` Scott Wood

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).