diff mbox series

[RFC,3/4] memory: renesas-rpc-if: Add support for overriding IO fixed values

Message ID 20231108171149.258656-4-biju.das.jz@bp.renesas.com (mailing list archive)
State Under Review
Delegated to: Geert Uytterhoeven
Headers show
Series Add set_iofv() callback | expand

Commit Message

Biju Das Nov. 8, 2023, 5:11 p.m. UTC
Add support for overriding IO fixed values to control the pin state
based on the flash type.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/memory/renesas-rpc-if.c | 20 ++++++++++++++++++++
 include/memory/renesas-rpc-if.h |  1 +
 2 files changed, 21 insertions(+)

Comments

Krzysztof Kozlowski Nov. 21, 2023, 9:08 a.m. UTC | #1
On 08/11/2023 18:11, Biju Das wrote:
> Add support for overriding IO fixed values to control the pin state
> based on the flash type.
> 
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.c


> +
> +	regmap_update_bits(rpc->regmap, RPCIF_CMNCR, RPCIF_CMNCR_IOFV(3),
> +			   RPCIF_CMNCR_IO0FV(val & 0x3) |
> +			   RPCIF_CMNCR_IO2FV((val >> 4) & 0x3) |
> +			   RPCIF_CMNCR_IO3FV((val >> 6) & 0x3));
> +
> +	pm_runtime_put(dev);
> +
> +	return 0;
> +}
> +EXPORT_SYMBOL(rpcif_set_iofv);

EXPORT_SYMBOL+GPL

Best regards,
Krzysztof
diff mbox series

Patch

diff --git a/drivers/memory/renesas-rpc-if.c b/drivers/memory/renesas-rpc-if.c
index 9695b2d3ae59..17bc604cdfff 100644
--- a/drivers/memory/renesas-rpc-if.c
+++ b/drivers/memory/renesas-rpc-if.c
@@ -325,6 +325,26 @@  static void rpcif_rzg2l_timing_adjust_sdr(struct rpcif_priv *rpc)
 	regmap_write(rpc->regmap, RPCIF_PHYADD, 0x80000032);
 }
 
+int rpcif_set_iofv(struct device *dev, u32 val)
+{
+	struct rpcif_priv *rpc = dev_get_drvdata(dev);
+	int ret;
+
+	ret = pm_runtime_resume_and_get(dev);
+	if (ret)
+		return ret;
+
+	regmap_update_bits(rpc->regmap, RPCIF_CMNCR, RPCIF_CMNCR_IOFV(3),
+			   RPCIF_CMNCR_IO0FV(val & 0x3) |
+			   RPCIF_CMNCR_IO2FV((val >> 4) & 0x3) |
+			   RPCIF_CMNCR_IO3FV((val >> 6) & 0x3));
+
+	pm_runtime_put(dev);
+
+	return 0;
+}
+EXPORT_SYMBOL(rpcif_set_iofv);
+
 int rpcif_hw_init(struct device *dev, bool hyperflash)
 {
 	struct rpcif_priv *rpc = dev_get_drvdata(dev);
diff --git a/include/memory/renesas-rpc-if.h b/include/memory/renesas-rpc-if.h
index b8fa30fd6b50..124ca9c16a39 100644
--- a/include/memory/renesas-rpc-if.h
+++ b/include/memory/renesas-rpc-if.h
@@ -71,6 +71,7 @@  struct rpcif {
 
 int rpcif_sw_init(struct rpcif *rpc, struct device *dev);
 int rpcif_hw_init(struct device *dev, bool hyperflash);
+int rpcif_set_iofv(struct device *dev, u32 val);
 void rpcif_prepare(struct device *dev, const struct rpcif_op *op, u64 *offs,
 		   size_t *len);
 int rpcif_manual_xfer(struct device *dev);