Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3250396ybt; Mon, 22 Jun 2020 19:56:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx3M91tSgW43bbcVyPbVY1pSZplTBa6NKfQkUpa5cI6Tks9Qfs9O6K+Rq6Xap0XAUamlTeZ X-Received: by 2002:a17:906:f185:: with SMTP id gs5mr17813338ejb.223.1592880983950; Mon, 22 Jun 2020 19:56:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592880983; cv=none; d=google.com; s=arc-20160816; b=J7NfR9MMfY9DmC1G1TB4lyJPHWhkKVuOFmOB1QanrwGwChbEkzg6SnYhv4TT6Fnr7Y JfQnoW4uLmjSQJyBa0gIL+4fpO1kqYdhStvZDKKk+L7drq3UVKqd7QbvUGzMXMjnMDEs e4BXF2iWq/e9FeH9HUX5f695qXmI9iaGfEYcCV4RvJQvR5GLClO4Nxfg+mAMNJW2tqBj LDLROrcHa2DzanjEH4prdX0+T2Ie1cj2xFWnM8OiCx5a8ec4P7Vl6bUxi1XRm3rSHmwp DPgjp6sSfx0ZPtGv1b0mdfFj162m65bUbf3lK6qe7mgKbgXGktl0euJO1moVdfW8/edY 3bsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=RW/QSx9T9mfwKfwJwkz1f/t/1lTcilPtFrKWaCqnRds=; b=ISvku3XJFRNtmE1HZflNDQ/CKnDHfcZJ8Aeqbt8jGv6KZXOLzgfV6PBeEJCP5X8qtO EjgPWRB7r2GazdP6iCVX8Js2jYn0KjMgr1VFsse8JJ12ysD46VJknCwFs9Z8W1tUraR2 ciYETFWQ0uVsumlLTDCI2BstWkIJGSswnbza82v1EHLpS55WDv5LU5+K5emJAXjyRCP1 +WfhjVG8RmvMkW/BOXY0+3OuGcFYS078yUzcGkUImmleRPXEHjMXbihhJBw1GA0IG45U op6j+Sbk+EhXeXfe9UNFVn6jEVycmldJPYGqqlNC5ef+y2ddM1WsAq4Z6X13/aVlU5Cd leZQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k8si1772402ejc.257.2020.06.22.19.56.01; Mon, 22 Jun 2020 19:56:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732103AbgFWCv7 (ORCPT + 99 others); Mon, 22 Jun 2020 22:51:59 -0400 Received: from mx2.suse.de ([195.135.220.15]:33028 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731913AbgFWCvi (ORCPT ); Mon, 22 Jun 2020 22:51:38 -0400 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=20F=C3=A4rber?= To: linux-realtek-soc@lists.infradead.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, =?UTF-8?q?James=20Tai=20=5B=E6=88=B4=E5=BF=97=E5=B3=B0=5D?= , =?UTF-8?q?Stanley=20Chang=20=5B=E6=98=8C=E8=82=B2=E5=BE=B7=5D?= , Edgar Lee , =?UTF-8?q?Andreas=20F=C3=A4rber?= 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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Stanley Chang Distinguish RTD1392 from RTD1395 via ISO_CHIP_INFO1 register. Signed-off-by: Stanley Chang Signed-off-by: Andreas Färber --- 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