From patchwork Tue Jun 23 02:50:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 11619687 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 81D0760D for ; Tue, 23 Jun 2020 03:59:52 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5AD8820771 for ; Tue, 23 Jun 2020 03:59:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="D1oHaUug" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5AD8820771 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=FJs8i6kMSM0dSEh/QnBgId9YEGGrtoJRgDyap7HsBxU=; b=D1oHaUuguN9CP7e/h9w4zdbcS bIDhWxB7PCFkFyVNlfh8GUA6FYoLCjIlqc/lxSs1nwd4mBhU4TJ2sQtQSQI+yNED3HQib2qVsjnc8 uUXNGyeLFnddRCaIgo1u+NSuYcTX+4IEKf5bIYwlvqSltW4Q3/+aX+eYzui5s8Lw/4tQkXfq+q9Kn 9OW/+pTaTDm+6P0EEYEqggYq2SrwOPjo/dkItW7Mf+7wiD43fil8GRcDH2KZCYyTA56j5sJzPzCdY vAUrmF0PSx01hNtkrFSt+5Kuxc1jRyiDREpOagaTiNvGzpx1sGb6oK1XH3exfUWU0enRsu9c1KfW6 lPUNmI+zA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnZ8Q-0006SO-O2; Tue, 23 Jun 2020 02:58:06 +0000 Received: from mx2.suse.de ([195.135.220.15]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnZ3D-0002Q3-6p; Tue, 23 Jun 2020 02:52:43 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 99FBDB198; Tue, 23 Jun 2020 02:51:36 +0000 (UTC) From: =?utf-8?q?Andreas_F=C3=A4rber?= To: linux-realtek-soc@lists.infradead.org Subject: [PATCH v2 16/29] soc: realtek: chip: Detect RTD1392 Date: Tue, 23 Jun 2020 04:50:53 +0200 Message-Id: <20200623025106.31273-17-afaerber@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200623025106.31273-1-afaerber@suse.de> References: <20200623025106.31273-1-afaerber@suse.de> MIME-Version: 1.0 X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [195.135.220.15 listed in list.dnswl.org] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?b?SmFtZXMgVGFpIFvmiLTlv5fls7Bd?= , Edgar Lee , linux-kernel@vger.kernel.org, =?utf-8?b?U3RhbmxleSBDaGFuZyBb5piM6IKy5b63XQ==?= , =?utf-8?q?Andreas_F=C3=A4rber?= , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Stanley Chang Distinguish RTD1392 from RTD1395 via ISO_CHIP_INFO1 register. Signed-off-by: Stanley Chang Signed-off-by: Andreas Färber Reviewed-by: Stanley Chang --- 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" }, };