lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200623025106.31273-7-afaerber@suse.de>
Date:   Tue, 23 Jun 2020 04:50:43 +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 06/29] soc: realtek: chip: Detect RTD1296

Detection logic from downstream drivers/soc/realtek/rtd129x/rtk_chip.c.

Acked-by: James Tai <james.tai@...ltek.com>
Signed-off-by: Andreas Färber <afaerber@...e.de>
---
 TODO: Name the bit in ISO_CHIP_INFO1:bound_opts.
 
 v1 -> v2:
 * Instead of direct iso register access use the new syscon regmap
 
 drivers/soc/realtek/chip.c | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/drivers/soc/realtek/chip.c b/drivers/soc/realtek/chip.c
index c4650d512c91..103f564aad7f 100644
--- a/drivers/soc/realtek/chip.c
+++ b/drivers/soc/realtek/chip.c
@@ -23,6 +23,8 @@
 
 #define SB2_CHIP_INFO_REVISE_ID		GENMASK(31, 16)
 
+#define REG_ISO_CHIP_INFO1	0x028
+
 struct dhc_soc_revision {
 	const char *name;
 	u16 chip_rev;
@@ -57,9 +59,32 @@ static const char *default_name(struct device *dev, const struct dhc_soc *s)
 	return s->family;
 }
 
+static const char *rtd1295_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(11))
+			return "RTD1296";
+	}
+
+	return "RTD1295";
+}
+
 static const struct dhc_soc dhc_soc_families[] = {
 	{ 0x6329, "RTD1195", default_name, rtd1195_revisions, "Phoenix" },
-	{ 0x6421, "RTD1295", default_name, rtd1295_revisions, "Kylin" },
+	{ 0x6421, "RTD1295", rtd1295_name, rtd1295_revisions, "Kylin" },
 };
 
 static const struct dhc_soc *dhc_soc_by_chip_id(u16 chip_id)
-- 
2.26.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ