All of lore.kernel.org
 help / color / mirror / Atom feed
From: Biju Das <biju.das.jz@bp.renesas.com>
To: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Cc: Biju Das <biju.das.jz@bp.renesas.com>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@bp.renesas.com>,
	linux-renesas-soc@vger.kernel.org
Subject: [PATCH] memory: renesas-rpc-if: Fix IO state based on flash type
Date: Wed, 30 Aug 2023 15:58:35 +0100	[thread overview]
Message-ID: <20230830145835.296690-1-biju.das.jz@bp.renesas.com> (raw)

Currently, RZ/G2L-alike SoCs use 2 different SPI serial flash memories
 1) AT25QL128A  embedded in RZ/{G2UL,Five} SMARC EVKs
 2) MT25QU512AB embedded in RZ/{G2L,G2LC,V2L} SMARC EVKs

As per section 8.14 on the AT25QL128A hardware manual,
IO1..IO3 must be set to Hi-Z state for this flash for fast read quad IO.
Snippet from HW manual section 8.14:
The upper nibble of the Mode(M7-4) controls the length of the next FAST
Read Quad IO instruction through the inclusion or exclusion of the first
byte instruction code. The lower nibble bits of the Mode(M3-0) are don't
care. However, the IO pins must be high-impedance before the falling edge
of the first data out clock.

As per the Figure 20: QUAD INPUT/OUTPUT FAST READ on MT25QU512AB mentions
IO1..IO2 to be in Hi-Z state and IO3 in '1' state

Add a variable io3_fv to struct rpcif_priv and check the child
node compatible value to detect micron flash and set IO1..IO3 states
based on flash type.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/memory/renesas-rpc-if.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/memory/renesas-rpc-if.c b/drivers/memory/renesas-rpc-if.c
index 9695b2d3ae59..68f2bb3f8e61 100644
--- a/drivers/memory/renesas-rpc-if.c
+++ b/drivers/memory/renesas-rpc-if.c
@@ -189,6 +189,7 @@ struct rpcif_priv {
 	u32 enable;		/* DRENR or SMENR */
 	u32 dummy;		/* DRDMCR or SMDMCR */
 	u32 ddr;		/* DRDRENR or SMDRENR */
+	u32 io3_fv;
 };
 
 static const struct rpcif_info rpcif_info_r8a7796 = {
@@ -367,7 +368,8 @@ int rpcif_hw_init(struct device *dev, bool hyperflash)
 		regmap_update_bits(rpc->regmap, RPCIF_CMNCR,
 				   RPCIF_CMNCR_MOIIO(3) | RPCIF_CMNCR_IOFV(3) |
 				   RPCIF_CMNCR_BSZ(3),
-				   RPCIF_CMNCR_MOIIO(1) | RPCIF_CMNCR_IOFV(2) |
+				   RPCIF_CMNCR_MOIIO(1) | RPCIF_CMNCR_IO0FV(2) |
+				   RPCIF_CMNCR_IO2FV(3) | rpc->io3_fv |
 				   RPCIF_CMNCR_BSZ(hyperflash ? 1 : 0));
 	else
 		regmap_update_bits(rpc->regmap, RPCIF_CMNCR,
@@ -774,6 +776,12 @@ static int rpcif_probe(struct platform_device *pdev)
 		return ret;
 	}
 
+	if (rpc->info->type == RPCIF_RZ_G2L &&
+	    of_device_is_compatible(flash, "micron,mt25qu512a"))
+		rpc->io3_fv = RPCIF_CMNCR_IO3FV(1);
+	else
+		rpc->io3_fv = RPCIF_CMNCR_IO3FV(3);
+
 	return 0;
 }
 
-- 
2.25.1


             reply	other threads:[~2023-08-30 18:47 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-30 14:58 Biju Das [this message]
2023-08-30 15:08 ` [PATCH] memory: renesas-rpc-if: Fix IO state based on flash type Geert Uytterhoeven
2023-08-30 15:08   ` Geert Uytterhoeven
2023-08-30 15:18   ` Biju Das
2023-08-30 15:18     ` Biju Das
2023-09-14  8:08     ` Krzysztof Kozlowski
2023-09-14  8:08       ` Krzysztof Kozlowski
2023-09-14  8:34       ` Geert Uytterhoeven
2023-09-14  8:34         ` Geert Uytterhoeven
2023-09-14  8:59         ` Miquel Raynal
2023-09-14  8:59           ` Miquel Raynal
2023-09-14  9:04           ` Geert Uytterhoeven
2023-09-14  9:04             ` Geert Uytterhoeven
2023-09-14  9:12             ` Miquel Raynal
2023-09-14  9:12               ` Miquel Raynal
2023-09-14  9:23               ` Geert Uytterhoeven
2023-09-14  9:23                 ` Geert Uytterhoeven
2023-09-14  9:37                 ` Biju Das
2023-09-14  9:37                   ` Biju Das
2023-09-14  9:55                   ` Geert Uytterhoeven
2023-09-14  9:55                     ` Geert Uytterhoeven
2023-09-14 11:27                     ` Michael Walle
2023-09-14 11:27                       ` Michael Walle
2023-09-14 12:17                       ` Biju Das
2023-09-14 12:17                         ` Biju Das
2023-09-14 12:31                         ` Michael Walle
2023-09-14 12:31                           ` Michael Walle
2023-09-14 12:59                           ` Biju Das
2023-09-14 12:59                             ` Biju Das
2023-09-14 13:17                             ` Michael Walle
2023-09-14 13:17                               ` Michael Walle
2023-09-14 13:32                               ` Michael Walle
2023-09-14 13:32                                 ` Michael Walle
2023-11-08 10:57                                 ` Biju Das
2023-11-08 10:57                                   ` Biju Das

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=20230830145835.296690-1-biju.das.jz@bp.renesas.com \
    --to=biju.das.jz@bp.renesas.com \
    --cc=geert+renesas@glider.be \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.