From: Raju Rangoju <Raju.Rangoju@amd.com>
To: <broonie@kernel.org>, <linux-spi@vger.kernel.org>
Cc: <linux-kernel@vger.kernel.org>, <sanju.mehta@amd.com>,
<krishnamoorthi.m@amd.com>, <akshata.mukundshetty@amd.com>,
<Raju.Rangoju@amd.com>
Subject: [PATCH 8/9] spi: spi_amd: Set controller address mode
Date: Wed, 18 Sep 2024 16:20:36 +0530 [thread overview]
Message-ID: <20240918105037.406003-9-Raju.Rangoju@amd.com> (raw)
In-Reply-To: <20240918105037.406003-1-Raju.Rangoju@amd.com>
Add changes to set the controller address mode before initiating commands.
The AMD SPI0 controller(AMDI0062) supports both 24-bit and 32-bit address
modes, while the HID2 SPI controller(AMDI0063) supports only the 24-bit
address mode. So this change is applicable only for SPI0 controller.
Co-developed-by: Krishnamoorthi M <krishnamoorthi.m@amd.com>
Signed-off-by: Krishnamoorthi M <krishnamoorthi.m@amd.com>
Co-developed-by: Akshata MukundShetty <akshata.mukundshetty@amd.com>
Signed-off-by: Akshata MukundShetty <akshata.mukundshetty@amd.com>
Signed-off-by: Raju Rangoju <Raju.Rangoju@amd.com>
---
drivers/spi/spi-amd.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/drivers/spi/spi-amd.c b/drivers/spi/spi-amd.c
index f146366a67e7..50dfdf2ab6ee 100644
--- a/drivers/spi/spi-amd.c
+++ b/drivers/spi/spi-amd.c
@@ -34,6 +34,7 @@
#define AMD_SPI_TX_COUNT_REG 0x48
#define AMD_SPI_RX_COUNT_REG 0x4B
#define AMD_SPI_STATUS_REG 0x4C
+#define AMD_SPI_ADDR32CTRL_REG 0x50
#define AMD_SPI_FIFO_SIZE 70
#define AMD_SPI_MEM_SIZE 200
@@ -548,6 +549,17 @@ static void amd_spi_mem_data_in(struct amd_spi *amd_spi,
nbytes + i - left_data);
}
+static void amd_set_spi_addr_mode(struct amd_spi *amd_spi,
+ const struct spi_mem_op *op)
+{
+ u32 val = amd_spi_readreg32(amd_spi, AMD_SPI_ADDR32CTRL_REG);
+
+ if (amd_is_spi_read_cmd_4b(op->cmd.opcode))
+ amd_spi_writereg32(amd_spi, AMD_SPI_ADDR32CTRL_REG, val | BIT(0));
+ else
+ amd_spi_writereg32(amd_spi, AMD_SPI_ADDR32CTRL_REG, val & ~BIT(0));
+}
+
static int amd_spi_exec_mem_op(struct spi_mem *mem,
const struct spi_mem_op *op)
{
@@ -560,6 +572,9 @@ static int amd_spi_exec_mem_op(struct spi_mem *mem,
if (ret)
return ret;
+ if (amd_spi->version == AMD_SPI_V2)
+ amd_set_spi_addr_mode(amd_spi, op);
+
switch (op->data.dir) {
case SPI_MEM_DATA_IN:
amd_spi_mem_data_in(amd_spi, op);
--
2.34.1
next prev parent reply other threads:[~2024-09-18 11:00 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-18 10:50 [PATCH 0/9] spi: spi_amd: Performance Optimization Patch Series Raju Rangoju
2024-09-18 10:50 ` [PATCH 1/9] spi: spi_amd: Sort headers alphabetically Raju Rangoju
2024-09-18 10:50 ` [PATCH 2/9] spi: spi_amd: Enable dual and quad I/O modes Raju Rangoju
2024-09-19 8:43 ` Mark Brown
2024-09-24 15:23 ` Rangoju, Raju
2024-09-18 10:50 ` [PATCH 3/9] spi: spi_amd: Replace ioread/iowrite calls Raju Rangoju
2024-09-18 10:50 ` [PATCH 4/9] spi: spi_amd: Updates to set tx/rx count functions Raju Rangoju
2024-09-18 10:50 ` [PATCH 5/9] spi: spi_amd: Optimize IO operations Raju Rangoju
2024-09-18 10:50 ` [PATCH 6/9] spi: spi_amd: Add support for HID2 SPI controller Raju Rangoju
2024-09-18 10:50 ` [PATCH 7/9] spi: spi_amd: Enhance SPI-MEM support functions Raju Rangoju
2024-09-19 8:51 ` Mark Brown
2024-09-24 15:25 ` Rangoju, Raju
2024-09-18 10:50 ` Raju Rangoju [this message]
2024-09-18 10:50 ` [PATCH 9/9] spi: spi_amd: Add HIDDMA basic read support Raju Rangoju
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=20240918105037.406003-9-Raju.Rangoju@amd.com \
--to=raju.rangoju@amd.com \
--cc=akshata.mukundshetty@amd.com \
--cc=broonie@kernel.org \
--cc=krishnamoorthi.m@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=sanju.mehta@amd.com \
/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