mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] mfd: rk808: Add support for rk806 on i2c bus
@ 2026-11-18 14:50 Alexander Shiyan
  0 siblings, 0 replies; only message in thread
From: Alexander Shiyan @ 2026-11-18 14:50 UTC (permalink / raw)
  To: barebox; +Cc: Alexander Shiyan

Some boards connects the rk806 PMIC on an i2c bus.
Lets add support for these boards.
---
barebox 2026.10.0-00870-g99874936478b-dirty #214 Wed Nov 18 17:35:19 MSK 2026

Board: Diasom DS-RK3588-SMARC-EVB
rockchip-dmc memory-controller.of: Detected memory size: 0x400000000
netconsole: registered as netconsole-1
fan53555-regulator rk86020: FAN53555 Option[10] Rev[1] Detected!
rk808 rk8060: chip id: 0x8060
...

Signed-off-by: Alexander Shiyan <eagle.alexander923@gmail.com>
---
 drivers/mfd/rk808.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c
index aa01485143..f96c8c1d1c 100644
--- a/drivers/mfd/rk808.c
+++ b/drivers/mfd/rk808.c
@@ -42,6 +42,12 @@ static const struct regmap_config rk805_regmap_config = {
 	.max_register = RK805_OFF_SOURCE_REG,
 };
 
+static const struct regmap_config rk806_regmap_config = {
+	.reg_bits = 8,
+	.val_bits = 8,
+	.max_register = RK806_BUCK_RSERVE_REG5,
+};
+
 static const struct regmap_config rk808_regmap_config = {
 	.reg_bits = 8,
 	.val_bits = 8,
@@ -234,6 +240,10 @@ static void rk808_poweroff(struct poweroff_handler *handler,
 		reg = RK805_DEV_CTRL_REG;
 		bit = DEV_OFF;
 		break;
+	case RK806_ID:
+		reg = RK806_SYS_CFG3;
+		bit = DEV_OFF;
+		break;
 	case RK808_ID:
 		reg = RK808_DEVCTRL_REG,
 		bit = DEV_OFF_RST;
@@ -368,6 +378,9 @@ static int rk808_probe(struct device *dev)
 	    of_device_is_compatible(np, "rockchip,rk809")) {
 		pmic_id_msb = RK817_ID_MSB;
 		pmic_id_lsb = RK817_ID_LSB;
+	} else if (of_device_is_compatible(np, "rockchip,rk806")) {
+		pmic_id_msb = RK806_CHIP_NAME;
+		pmic_id_lsb = RK806_CHIP_VER;
 	} else {
 		pmic_id_msb = RK808_ID_MSB;
 		pmic_id_lsb = RK808_ID_LSB;
@@ -377,14 +390,14 @@ static int rk808_probe(struct device *dev)
 	msb = i2c_smbus_read_byte_data(client, pmic_id_msb);
 	if (msb < 0) {
 		dev_err(dev, "failed to read the chip id at 0x%x\n",
-			RK808_ID_MSB);
+			pmic_id_msb);
 		return msb;
 	}
 
 	lsb = i2c_smbus_read_byte_data(client, pmic_id_lsb);
 	if (lsb < 0) {
 		dev_err(dev, "failed to read the chip id at 0x%x\n",
-			RK808_ID_LSB);
+			pmic_id_lsb);
 		return lsb;
 	}
 
@@ -395,6 +408,9 @@ static int rk808_probe(struct device *dev)
 	case RK805_ID:
 		regmap_cfg = &rk805_regmap_config;
 		break;
+	case RK806_ID:
+		regmap_cfg = &rk806_regmap_config;
+		break;
 	case RK808_ID:
 		regmap_cfg = &rk808_regmap_config;
 		break;
@@ -490,6 +506,7 @@ static int rk808_probe_spi(struct device *dev)
 
 static const struct of_device_id rk808_of_match[] = {
 	{ .compatible = "rockchip,rk805" },
+	{ .compatible = "rockchip,rk806" },
 	{ .compatible = "rockchip,rk808" },
 	{ .compatible = "rockchip,rk809" },
 	{ .compatible = "rockchip,rk817" },
-- 
2.56.1




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-18 14:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-18 14:50 [PATCH] mfd: rk808: Add support for rk806 on i2c bus Alexander Shiyan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox