[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200623025106.31273-17-afaerber@suse.de>
Date: Tue, 23 Jun 2020 04:50:53 +0200
From: Andreas Färber <afaerber@...e.de>
To: linux-realtek-soc@...ts.infradead.org
Cc: linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
James Tai [戴志峰]
<james.tai@...ltek.com>,
Stanley Chang [昌育德]
<stanley_chang@...ltek.com>, Edgar Lee <cylee12@...ltek.com>,
Andreas Färber <afaerber@...e.de>
Subject: [PATCH v2 16/29] soc: realtek: chip: Detect RTD1392
From: Stanley Chang <stanley_chang@...ltek.com>
Distinguish RTD1392 from RTD1395 via ISO_CHIP_INFO1 register.
Signed-off-by: Stanley Chang <stanley_chang@...ltek.com>
Signed-off-by: Andreas Färber <afaerber@...e.de>
---
TODO: Name the bit in ISO_CHIP_INFO1:bound_opts.
Note: We don't have any RTD1392 .dtsi/.dts yet.
v2: New
* Split out from Stanley's v1
drivers/soc/realtek/chip.c | 25 ++++++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)
diff --git a/drivers/soc/realtek/chip.c b/drivers/soc/realtek/chip.c
index 6b3d1f3d3816..9cee760bac35 100644
--- a/drivers/soc/realtek/chip.c
+++ b/drivers/soc/realtek/chip.c
@@ -107,10 +107,33 @@ static const char *rtd1295_name(struct device *dev, const struct dhc_soc *s)
return "RTD1295";
}
+static const char *rtd1395_name(struct device *dev, const struct dhc_soc *s)
+{
+ struct regmap *regmap;
+ unsigned int val;
+ int ret;
+
+ regmap = syscon_regmap_lookup_by_phandle(dev->of_node, "iso-syscon");
+ if (IS_ERR(regmap)) {
+ ret = PTR_ERR(regmap);
+ if (ret == -EPROBE_DEFER)
+ return ERR_PTR(ret);
+ dev_warn(dev, "Could not check iso (%d)\n", ret);
+ } else {
+ ret = regmap_read(regmap, REG_ISO_CHIP_INFO1, &val);
+ if (ret)
+ dev_warn(dev, "Could not read chip_info1 (%d)\n", ret);
+ else if (val & BIT(12))
+ return "RTD1392";
+ }
+
+ return "RTD1395";
+}
+
static const struct dhc_soc dhc_soc_families[] = {
{ 0x6329, "RTD1195", default_name, rtd1195_revisions, "Phoenix" },
{ 0x6421, "RTD1295", rtd1295_name, rtd1295_revisions, "Kylin" },
- { 0x6481, "RTD1395", default_name, rtd1395_revisions, "Hercules" },
+ { 0x6481, "RTD1395", rtd1395_name, rtd1395_revisions, "Hercules" },
{ 0x6525, "RTD1619", default_name, rtd1619_revisions, "Thor" },
{ 0x6570, "RTD1319", default_name, rtd1319_revisions, "Hank" },
};
--
2.26.2
Powered by blists - more mailing lists