[RFC PATCH 04/13] soc: sunxi: sram: Add A733 system-control RESCAL support

Alastair D'Silva alastair at d-silva.org
Sun Nov 29 18:07:49 PST 2026


Register a syscon regmap for the Allwinner A733 system control block so
consumers such as the HDMI TOP PHY can access the RESCAL calibration
register.

Signed-off-by: Alastair D'Silva <alastair at d-silva.org>
---
 drivers/soc/sunxi/sunxi_sram.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/drivers/soc/sunxi/sunxi_sram.c b/drivers/soc/sunxi/sunxi_sram.c
index 2ccaeacf8c70..9651ed5c5c6c 100644
--- a/drivers/soc/sunxi/sunxi_sram.c
+++ b/drivers/soc/sunxi/sunxi_sram.c
@@ -328,6 +328,7 @@ EXPORT_SYMBOL(sunxi_sram_release);
 struct sunxi_sramc_variant {
 	int num_emac_clocks;
 	bool has_ldo_ctrl;
+	bool has_rescal_ctrl;
 	bool has_ths_offset;
 };
 
@@ -357,9 +358,15 @@ static const struct sunxi_sramc_variant sun55i_a523_sramc_variant = {
 	.num_emac_clocks = 2,
 };
 
+static const struct sunxi_sramc_variant sun60i_a733_sramc_variant = {
+	.num_emac_clocks = 2,
+	.has_rescal_ctrl = true,
+};
+
 #define SUNXI_SRAM_THS_OFFSET_REG	0x0
 #define SUNXI_SRAM_EMAC_CLOCK_REG	0x30
 #define SUNXI_SYS_LDO_CTRL_REG		0x150
+#define SUNXI_SYS_RESCAL_CTRL_REG	0x160
 
 static bool sunxi_sram_regmap_accessible_reg(struct device *dev,
 					     unsigned int reg)
@@ -373,6 +380,8 @@ static bool sunxi_sram_regmap_accessible_reg(struct device *dev,
 		return true;
 	if (reg == SUNXI_SYS_LDO_CTRL_REG && variant->has_ldo_ctrl)
 		return true;
+	if (reg == SUNXI_SYS_RESCAL_CTRL_REG && variant->has_rescal_ctrl)
+		return true;
 
 	return false;
 }
@@ -396,7 +405,7 @@ static const struct regmap_config sunxi_sram_regmap_config = {
 	.val_bits       = 32,
 	.reg_stride     = 4,
 	/* last defined register */
-	.max_register   = SUNXI_SYS_LDO_CTRL_REG,
+	.max_register   = SUNXI_SYS_RESCAL_CTRL_REG,
 	/* other devices have no business accessing other registers */
 	.readable_reg	= sunxi_sram_regmap_accessible_reg,
 	.writeable_reg	= sunxi_sram_regmap_accessible_reg,
@@ -424,7 +433,8 @@ static int __init sunxi_sram_probe(struct platform_device *pdev)
 	if (IS_ERR(base))
 		return PTR_ERR(base);
 
-	if (variant->num_emac_clocks || variant->has_ldo_ctrl) {
+	if (variant->num_emac_clocks || variant->has_ldo_ctrl ||
+	    variant->has_rescal_ctrl) {
 		regmap = devm_regmap_init_mmio(dev, base, &sunxi_sram_regmap_config);
 		if (IS_ERR(regmap))
 			return PTR_ERR(regmap);
@@ -486,6 +496,10 @@ static const struct of_device_id sunxi_sram_dt_match[] = {
 		.compatible = "allwinner,sun55i-a523-system-control",
 		.data = &sun55i_a523_sramc_variant,
 	},
+	{
+		.compatible = "allwinner,sun60i-a733-system-control",
+		.data = &sun60i_a733_sramc_variant,
+	},
 	{ },
 };
 MODULE_DEVICE_TABLE(of, sunxi_sram_dt_match);
-- 
2.53.0




More information about the linux-arm-kernel mailing list