From: Christophe Leroy <christophe.leroy@c-s.fr>
To: Mark Brown <broonie@kernel.org>
Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
linux-spi@vger.kernel.org
Subject: [PATCH v2 2/2] spi: fsl-spi: Allow dynamic allocation of CPM1 parameter RAM
Date: Fri, 3 Oct 2014 18:49:17 +0200 (CEST) [thread overview]
Message-ID: <20141003164917.397871AB276@localhost.localdomain> (raw)
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 "fsl,cpm1-spi-reloc" instead of "fsl,cpm1-spi" compatible is set in the
device tree, the parameter RAM for SPI is dynamically allocated
with cpm_muram_alloc().
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
---
Changes from v1 to v2: using OF compatible instead of compile time option
drivers/spi/spi-fsl-cpm.c | 3 +++
drivers/spi/spi-fsl-lib.c | 2 ++
include/linux/fsl_devices.h | 1 +
3 files changed, 6 insertions(+)
diff --git a/drivers/spi/spi-fsl-cpm.c b/drivers/spi/spi-fsl-cpm.c
index 0f3a912..048ca5f 100644
--- a/drivers/spi/spi-fsl-cpm.c
+++ b/drivers/spi/spi-fsl-cpm.c
@@ -261,6 +261,9 @@ static unsigned long fsl_spi_cpm_get_pram(struct mpc8xxx_spi *mspi)
if (mspi->flags & SPI_CPM2) {
pram_ofs = cpm_muram_alloc(SPI_PRAM_SIZE, 64);
out_be16(spi_base, pram_ofs);
+ } else if (mspi->flags & SPI_CPM1_RELOC) {
+ pram_ofs = cpm_muram_alloc(SPI_PRAM_SIZE, 32);
+ out_be16(spi_base, pram_ofs);
} else {
u16 rpbase = in_be16(spi_base);
diff --git a/drivers/spi/spi-fsl-lib.c b/drivers/spi/spi-fsl-lib.c
index c3f7802..e9db4c5 100644
--- a/drivers/spi/spi-fsl-lib.c
+++ b/drivers/spi/spi-fsl-lib.c
@@ -227,6 +227,8 @@ int of_mpc8xxx_spi_probe(struct platform_device *ofdev)
pdata->flags = SPI_CPM_MODE | SPI_CPM2;
else if (of_device_is_compatible(np, "fsl,cpm1-spi"))
pdata->flags = SPI_CPM_MODE | SPI_CPM1;
+ else if (of_device_is_compatible(np, "fsl,cpm1-spi-reloc"))
+ pdata->flags = SPI_CPM_MODE | SPI_CPM1 | SPI_CPM1_RELOC;
return 0;
}
diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h
index a82296a..417ad52 100644
--- a/include/linux/fsl_devices.h
+++ b/include/linux/fsl_devices.h
@@ -123,6 +123,7 @@ struct fsl_spi_platform_data {
#define SPI_CPM1 (1 << 2) /* SPI unit is in CPM1 block */
#define SPI_CPM2 (1 << 3) /* SPI unit is in CPM2 block */
#define SPI_QE (1 << 4) /* SPI unit is in QE block */
+#define SPI_CPM1_RELOC (1 << 5) /* SPI pram has to be relocated */
/* board specific information */
u16 max_chipselect;
void (*cs_control)(struct spi_device *spi, bool on);
--
2.1.0
next reply other threads:[~2014-10-03 16:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-03 16:49 Christophe Leroy [this message]
2014-10-03 19:51 ` [PATCH v2 2/2] spi: fsl-spi: Allow dynamic allocation of CPM1 parameter RAM Scott Wood
2014-10-04 10:07 ` christophe leroy
2014-10-07 0:24 ` Scott Wood
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20141003164917.397871AB276@localhost.localdomain \
--to=christophe.leroy@c-s.fr \
--cc=broonie@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).