Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3250616ybt; Mon, 22 Jun 2020 19:56:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzAmwace+E++hSyAJcc+d6saJWFgB0K5fftRmD3MdUJoSU1B0om9g1RGZrJMuJWZhU1N1c6 X-Received: by 2002:a17:906:784c:: with SMTP id p12mr18286733ejm.123.1592881010483; Mon, 22 Jun 2020 19:56:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592881010; cv=none; d=google.com; s=arc-20160816; b=cFe4fWSw7wjUhbPiFuArhvmAENN1syWE1YLOPu4jNUg8b5s2wf3fUe5ACCV6dI4Tnh h99Y7oyAJD3sDvcdBf8OMkgFoGXL/PaYZ5tsD+qWWqu6NOacRYrPMNK4XeF8VxD+S/OT 7DdDp/GmBGTj1D92XnFnWRmLJpgYiCJqUhUUWj6FhP1Xs+cnRC1ZH+T4hQJw7mX4gwf7 rgJ6MRZbeewUS40YZY2N9994kG8yJOY6yXJEcKcNBK+mt+awa0sYD67icz25L9ik8edY +eBo9RSV5ByT7M6A2Aj7wCl1MLMetzWtHbzyPTM38X+I2ctR1kb4JJsBH0HcQ4rszVoj O2MQ== 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=XjoQt9KeaNOKeOGyn5mDs6ZUmit8RnYXn4whQDlDBaM=; b=M0oKG7hAXmhOBPHV2JEZUyNjCA2PI9Gq2ZsmLORGVGWjtBc2+222k0D3H79H3mjLYl t1bo41BOa9Ly75E5DgIBSdkjGvU9XMzsttIgvu4W9QUCFjNw17Yt55FW/T++l6jKHj0G xdsnbzmmZK0fNYLaO8zpk6z/ZMx5Ze6cNAYKAhrDfXWssvNwrngXpWdBMtd+6lAsuGdC gsm9bI9Ge9vGam1OivP/6WVTRni1Ya56TGhqA71l+amOf4DVTnLIbsox/A7bNbho5/4f qQ58BejvqcjPSjd7hls3R4ttU091PVP94ZVjijG8zQfcucnbxWpp41ErYykTIibvZRXm cFVw== 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 m3si405257edv.382.2020.06.22.19.56.28; Mon, 22 Jun 2020 19:56:50 -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 S1732467AbgFWCxm (ORCPT + 99 others); Mon, 22 Jun 2020 22:53:42 -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 S1731863AbgFWCvd (ORCPT ); Mon, 22 Jun 2020 22:51:33 -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 3925CAE84; Tue, 23 Jun 2020 02:51:32 +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 06/29] soc: realtek: chip: Detect RTD1296 Date: Tue, 23 Jun 2020 04:50:43 +0200 Message-Id: <20200623025106.31273-7-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 Detection logic from downstream drivers/soc/realtek/rtd129x/rtk_chip.c. Acked-by: James Tai Signed-off-by: Andreas Färber --- 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