From patchwork Sun Nov 3 01:36:36 2019 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: 178368 Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp2570143ill; Sat, 2 Nov 2019 18:37:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqzy7b3/iiyfNsSbk+hJDN4R0R4I72dBUog/iJQs09+SsLMq9z0hU0CwWdyGt4TyD1YX1oIg X-Received: by 2002:a17:906:4d92:: with SMTP id s18mr17774892eju.121.1572745037518; Sat, 02 Nov 2019 18:37:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572745037; cv=none; d=google.com; s=arc-20160816; b=ThYe8IUPop4jXUlmaOHlDJSBtWHiY9wHT4h56pMcgXw2/7Ckg3kP84AM23dJ6x+vNB OI0yr5jYDq6PWGsqwu+hI7Ku6GGNAApriOhBvdQm4BvVXL/ymd4asBc4k8QptE/KYxkt 5HlOXqKzjOuiicBiLqlP44GPz4QQ4j7CRcnEmdcQ9RGQHmpn5G6c1nKhcO7ovu68Vk/Q dKBcDm9StEonKCBXjJcqiv1+zNfRL8UNy/YDnNQtDy++yfcnlHEQIVBJ+//aQUoT4I6I q1odUAMQqfb08txEmLNQFEXRdKy7tEeavwyul5LuF4lzTWzlh5AGRKRWgEVi6vu4XeOO jhag== 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=aTk+SwhZBf80G9JQ3rloR8En30K3uuZ3N3dN+5RlvaY=; b=aZT/Eq13aAdFQrSg1Owt7xAP09LYTajIK52zGBIDplGmQ1yQFPTlgmkJt1AgxWzfU+ RhjqqF/acDCsHQiXSrJ0CuDygTEb0CdAIYmurGvp8ZWYGhhpS6rohQio90MzIJmEQ1mz BVbhXth6+M6SFaHuHpD/4AJ9xUKAh7BkK+gBi/rb+HhDYwKmSnMGbAdnaXazh7jkch/7 415IMbLTVf3kIjw74letfxiDiaPQ6/Rvsj5UXWyrgdZaXS6bPTdAS/oxBblLoRO7AjpJ 6Le3nwesHe7ovG3LHNW2Znrw0zvrOIlXt3w/uofdj5wzQy6ZmMQuAb1JjGUZKGpzh9HC ui6g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g40si4077120edb.369.2019.11.02.18.37.17; Sat, 02 Nov 2019 18:37:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727515AbfKCBg5 (ORCPT + 26 others); Sat, 2 Nov 2019 21:36:57 -0400 Received: from mx2.suse.de ([195.135.220.15]:59420 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727350AbfKCBg4 (ORCPT ); Sat, 2 Nov 2019 21:36:56 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 7D1C0AF55; Sun, 3 Nov 2019 01:36:53 +0000 (UTC) From: =?utf-8?q?Andreas_F=C3=A4rber?= To: linux-realtek-soc@lists.infradead.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, =?utf-8?q?Andreas_F=C3=A4rber?= Subject: [RFC 02/11] soc: Add Realtek chip info driver for RTD1195 and RTD1295 Date: Sun, 3 Nov 2019 02:36:36 +0100 Message-Id: <20191103013645.9856-3-afaerber@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20191103013645.9856-1-afaerber@suse.de> References: <20191103013645.9856-1-afaerber@suse.de> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a soc bus driver to print chip model and revision details. Revisions from downstream drivers/soc/realtek/rtd{119x,129x}/rtk_chip.c. Signed-off-by: Andreas Färber --- Naming: What to call the family vs. soc_id? drivers/soc/Kconfig | 1 + drivers/soc/Makefile | 1 + drivers/soc/realtek/Kconfig | 13 ++++ drivers/soc/realtek/Makefile | 2 + drivers/soc/realtek/chip.c | 164 +++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 181 insertions(+) create mode 100644 drivers/soc/realtek/Kconfig create mode 100644 drivers/soc/realtek/Makefile create mode 100644 drivers/soc/realtek/chip.c -- 2.16.4 diff --git a/drivers/soc/Kconfig b/drivers/soc/Kconfig index 833e04a7835c..06ae9d97321c 100644 --- a/drivers/soc/Kconfig +++ b/drivers/soc/Kconfig @@ -11,6 +11,7 @@ source "drivers/soc/imx/Kconfig" source "drivers/soc/ixp4xx/Kconfig" source "drivers/soc/mediatek/Kconfig" source "drivers/soc/qcom/Kconfig" +source "drivers/soc/realtek/Kconfig" source "drivers/soc/renesas/Kconfig" source "drivers/soc/rockchip/Kconfig" source "drivers/soc/samsung/Kconfig" diff --git a/drivers/soc/Makefile b/drivers/soc/Makefile index 2ec355003524..1d55d838a342 100644 --- a/drivers/soc/Makefile +++ b/drivers/soc/Makefile @@ -17,6 +17,7 @@ obj-$(CONFIG_SOC_XWAY) += lantiq/ obj-y += mediatek/ obj-y += amlogic/ obj-y += qcom/ +obj-y += realtek/ obj-y += renesas/ obj-$(CONFIG_ARCH_ROCKCHIP) += rockchip/ obj-$(CONFIG_SOC_SAMSUNG) += samsung/ diff --git a/drivers/soc/realtek/Kconfig b/drivers/soc/realtek/Kconfig new file mode 100644 index 000000000000..be75c1889c61 --- /dev/null +++ b/drivers/soc/realtek/Kconfig @@ -0,0 +1,13 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +if ARCH_REALTEK || COMPILE_TEST + +config REALTEK_SOC + tristate "Realtek chip info" + default ARCH_REALTEK + select SOC_BUS + help + Say 'y' here to enable support for SoC info on Realtek RTD1195 and + RTD1295 SoC families. + If unsure, say 'n'. + +endif diff --git a/drivers/soc/realtek/Makefile b/drivers/soc/realtek/Makefile new file mode 100644 index 000000000000..49900273905b --- /dev/null +++ b/drivers/soc/realtek/Makefile @@ -0,0 +1,2 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +obj-$(CONFIG_REALTEK_SOC) += chip.o diff --git a/drivers/soc/realtek/chip.c b/drivers/soc/realtek/chip.c new file mode 100644 index 000000000000..9d13422e9936 --- /dev/null +++ b/drivers/soc/realtek/chip.c @@ -0,0 +1,164 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Realtek System-on-Chip info + * + * Copyright (c) 2017-2019 Andreas Färber + */ + +#include +#include +#include +#include +#include +#include +#include + +#define REG_CHIP_ID 0x0 +#define REG_CHIP_REV 0x4 + +struct rtd_soc_revision { + const char *name; + u32 chip_rev; +}; + +static const struct rtd_soc_revision rtd1195_revisions[] = { + { "A", 0x00000000 }, + { "B", 0x00010000 }, + { "C", 0x00020000 }, + { "D", 0x00030000 }, + { } +}; + +static const struct rtd_soc_revision rtd1295_revisions[] = { + { "A00", 0x00000000 }, + { "A01", 0x00010000 }, + { "B00", 0x00020000 }, + { "B01", 0x00030000 }, + { } +}; + +struct rtd_soc { + u32 chip_id; + const char *family; + const char *(*get_name)(struct device *dev, const struct rtd_soc *s); + const struct rtd_soc_revision *revisions; + const char *codename; +}; + +static const char *default_name(struct device *dev, const struct rtd_soc *s) +{ + return s->family; +} + +static const struct rtd_soc rtd_soc_families[] = { + { 0x00006329, "RTD1195", default_name, rtd1195_revisions, "Phoenix" }, + { 0x00006421, "RTD1295", default_name, rtd1295_revisions, "Kylin" }, +}; + +static const struct rtd_soc *rtd_soc_by_chip_id(u32 chip_id) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(rtd_soc_families); i++) { + const struct rtd_soc *family = &rtd_soc_families[i]; + + if (family->chip_id == chip_id) + return family; + } + return NULL; +} + +static const char *rtd_soc_rev(const struct rtd_soc *family, u32 chip_rev) +{ + if (family) { + const struct rtd_soc_revision *rev = family->revisions; + + while (rev && rev->name) { + if (rev->chip_rev == chip_rev) + return rev->name; + rev++; + } + } + return "unknown"; +} + +static int rtd_soc_probe(struct platform_device *pdev) +{ + const struct rtd_soc *s; + struct soc_device_attribute *soc_dev_attr; + struct soc_device *soc_dev; + struct device_node *node; + void __iomem *base; + u32 chip_id, chip_rev; + + base = of_iomap(pdev->dev.of_node, 0); + if (!base) + return -ENODEV; + + soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL); + if (!soc_dev_attr) + return -ENOMEM; + + chip_id = readl_relaxed(base + REG_CHIP_ID); + chip_rev = readl_relaxed(base + REG_CHIP_REV); + + node = of_find_node_by_path("/"); + of_property_read_string(node, "model", &soc_dev_attr->machine); + of_node_put(node); + + s = rtd_soc_by_chip_id(chip_id); + + soc_dev_attr->family = kasprintf(GFP_KERNEL, "Realtek %s", + (s && s->codename) ? s->codename : + ((s && s->family) ? s->family : "Digital Home Center")); + + if (likely(s && s->get_name)) + soc_dev_attr->soc_id = s->get_name(&pdev->dev, s); + else + soc_dev_attr->soc_id = "unknown"; + + soc_dev_attr->revision = rtd_soc_rev(s, chip_rev); + + soc_dev = soc_device_register(soc_dev_attr); + if (IS_ERR(soc_dev)) { + kfree(soc_dev_attr->family); + kfree(soc_dev_attr); + return PTR_ERR(soc_dev); + } + + platform_set_drvdata(pdev, soc_dev); + + dev_info(soc_device_to_device(soc_dev), + "%s %s (0x%08x) rev %s (0x%08x) detected\n", + soc_dev_attr->family, soc_dev_attr->soc_id, chip_id, + soc_dev_attr->revision, chip_rev); + + return 0; +} + +static int rtd_soc_remove(struct platform_device *pdev) +{ + struct soc_device *soc_dev = platform_get_drvdata(pdev); + + soc_device_unregister(soc_dev); + + return 0; +} + +static const struct of_device_id rtd_soc_dt_ids[] = { + { .compatible = "realtek,rtd1195-chip" }, + { } +}; + +static struct platform_driver rtd_soc_driver = { + .probe = rtd_soc_probe, + .remove = rtd_soc_remove, + .driver = { + .name = "rtd1195-soc", + .of_match_table = rtd_soc_dt_ids, + }, +}; +module_platform_driver(rtd_soc_driver); + +MODULE_DESCRIPTION("Realtek SoC identification"); +MODULE_LICENSE("GPL"); From patchwork Sun Nov 3 01:36:37 2019 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: 178372 Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp2570302ill; Sat, 2 Nov 2019 18:37:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqxtZ4HkrJP6BFVufrjdUcHgDvXuLdOM7Y1FBASPakXeVEpWknYlY2ZRwtGWbbkWM9a+Fx5J X-Received: by 2002:aa7:d755:: with SMTP id a21mr21510352eds.98.1572745051606; Sat, 02 Nov 2019 18:37:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572745051; cv=none; d=google.com; s=arc-20160816; b=FMe+Srz/He5EqMJmty14xHxVDPBY9zT1lBuoa7IDqLLwyQ3BAZW7M03XndXmtcunFz 7JV2Q/U4syCduKxIuwOE6ZLmz79WzRdgxbcNd+M+Lygc18dJpUM/6c60l4+9h7qx9V2+ xQaqmof642ccLiZ3P6qH4Qivwc33nANLUTA1zIG7D4P7fjcGK8YJZm0qgKfOkruSnIPV 0nqL9ApPHu9ShLr6xV6psTUfU7JZwfJeXNSAyhObrsajn8GRuAzrpwAN8kjIVhcQHk8r PAFqr4qg5EbxLm/6bY6nrxWFNbZHyVsKfrXwzVKbFLis8tZlJL6hh18Ic+WDtHK4W33R lMRg== 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=/9KQ1ZFzbwjZdQsE9MYRDnz2RlO/eesXg/CtHDJwGPU=; b=EJ6gTEJTecqMd0d35ji+uhR8eESImfC8CKSHDu5Wn91xKRRw+COwJpaAmv5Og3YX+K hHHPMaFcK9bBQcCDxg4G+5Ua/l1KBKLvipKbc4ONxyJg2OgrZEc0/JIeLZihlnG0XI7M czdXWK3BbMz4cmRR8GPDnEgoHitVfXgJoQcEs64dvR+mJffYAzgOKaEINFydqcr7xiBZ aAlMpiKhbb/6zL7QgHA1FXrx0kAPZZBPGkiBLyGhrlL8ovZACKMazICOfVFksKJJlkuC BP+cdJLpLuhk7CnAmyFdUgCSRPQjyWEKSHexKtiyeBC/FtelqeODhoAyxjmvbe7K79uG +T9g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id oz10si2664188ejb.163.2019.11.02.18.37.31; Sat, 02 Nov 2019 18:37:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727458AbfKCBgz (ORCPT + 26 others); Sat, 2 Nov 2019 21:36:55 -0400 Received: from mx2.suse.de ([195.135.220.15]:59430 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727360AbfKCBgz (ORCPT ); Sat, 2 Nov 2019 21:36:55 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id E1C8FAF6B; Sun, 3 Nov 2019 01:36:53 +0000 (UTC) From: =?utf-8?q?Andreas_F=C3=A4rber?= To: linux-realtek-soc@lists.infradead.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, =?utf-8?q?Andreas_F=C3=A4rber?= , Rob Herring , Mark Rutland , devicetree@vger.kernel.org Subject: [RFC 03/11] arm64: dts: realtek: rtd129x: Add chip info node Date: Sun, 3 Nov 2019 02:36:37 +0100 Message-Id: <20191103013645.9856-4-afaerber@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20191103013645.9856-1-afaerber@suse.de> References: <20191103013645.9856-1-afaerber@suse.de> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a DT node for chip identification. Signed-off-by: Andreas Färber --- arch/arm64/boot/dts/realtek/rtd129x.dtsi | 5 +++++ 1 file changed, 5 insertions(+) -- 2.16.4 diff --git a/arch/arm64/boot/dts/realtek/rtd129x.dtsi b/arch/arm64/boot/dts/realtek/rtd129x.dtsi index 4433114476f5..15a7c249155d 100644 --- a/arch/arm64/boot/dts/realtek/rtd129x.dtsi +++ b/arch/arm64/boot/dts/realtek/rtd129x.dtsi @@ -84,6 +84,11 @@ status = "disabled"; }; + chip-info@9801a200 { + compatible = "realtek,rtd1195-chip"; + reg = <0x9801a200 0x8>; + }; + uart1: serial@9801b200 { compatible = "snps,dw-apb-uart"; reg = <0x9801b200 0x100>; From patchwork Sun Nov 3 01:36:38 2019 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: 178373 Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp2570306ill; Sat, 2 Nov 2019 18:37:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqzOcmzqH7iwV7SqYSwEOG/2GVPpz3D9c469U860f8kFPiyTjdZZKL/h+tXG1rXwdAR6Y8Gc X-Received: by 2002:a17:906:c45:: with SMTP id t5mr12885567ejf.296.1572745051980; Sat, 02 Nov 2019 18:37:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572745051; cv=none; d=google.com; s=arc-20160816; b=gT8jIg08KmnGzkuihGEQoQiOtJVFUMnArk9n+VNvMtCbeeyxUBHlNxA71tW0DFdX1x yuRJgFHiWkggv3za7SWwvVI6BY3RtcV1IB923BOUySTyi/j4tb6YCiYAV7fmCX4/B3mb 4ecaxAcWnCd+hSQwIvjV5incb1ElvIVJpx+qHWRqO72kSITl9+HG2e9ke2VXr9Y4/xWB HM6Bqc4OZolZAPalnE8qsOCIiJgGhuOWX99iBNTJZm+ohc5ooJt9JrV46eq5nmrvMrGA behqxbR4mJKtIzsedbwvisi3xN0/F/vAz8b+VW4mj/kKNGiFJrUtHb/urgFTuLMS93dn MkQw== 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=1vHscYvcVHZhC1RUsxNWfbPtePZR//+iNBNXBtNIF5A=; b=LsrG9Rk0HQun2LyBovILfsYCyHc3/2y0PvOp1CiErSLHlh9gbgdcFytu4Ayr3IPIEi bbZ8b+FPIURtBvynSclOfjWlrVHYvXfa2ohvrLpY/WcNuSS0tISOvQB+NZu3f9BYf1m4 RKNbkF+DJsTDSNoYyiDvBt5MG3YOe1h8VXhJIOzvW0qta+KppG3tq7mkDi10birJI3u7 Q0/ROgqQrIE1ryhGRyBnQPLjPurkR8AWq2Ecu+LQaCFeSbJTAYN8UftmtOuX5wukFgDi 3w4GvahpJJoGFH/h1bVWR6GPVCWDd3pXWemY9BLRXYCuY55NdcHmVMApEXUiVSU0+iR6 H8lQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id oz10si2664188ejb.163.2019.11.02.18.37.31; Sat, 02 Nov 2019 18:37:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727695AbfKCBh3 (ORCPT + 26 others); Sat, 2 Nov 2019 21:37:29 -0400 Received: from mx2.suse.de ([195.135.220.15]:59446 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727398AbfKCBg4 (ORCPT ); Sat, 2 Nov 2019 21:36:56 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 5C9D5AF92; Sun, 3 Nov 2019 01:36:54 +0000 (UTC) From: =?utf-8?q?Andreas_F=C3=A4rber?= To: linux-realtek-soc@lists.infradead.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, =?utf-8?q?Andreas_F=C3=A4rber?= , Rob Herring , Mark Rutland , devicetree@vger.kernel.org Subject: [RFC 04/11] ARM: dts: rtd1195: Add chip info node Date: Sun, 3 Nov 2019 02:36:38 +0100 Message-Id: <20191103013645.9856-5-afaerber@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20191103013645.9856-1-afaerber@suse.de> References: <20191103013645.9856-1-afaerber@suse.de> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a DT node for chip identification. Signed-off-by: Andreas Färber --- arch/arm/boot/dts/rtd1195.dtsi | 5 +++++ 1 file changed, 5 insertions(+) -- 2.16.4 diff --git a/arch/arm/boot/dts/rtd1195.dtsi b/arch/arm/boot/dts/rtd1195.dtsi index 9e088f669bd7..dd4f3ee6be43 100644 --- a/arch/arm/boot/dts/rtd1195.dtsi +++ b/arch/arm/boot/dts/rtd1195.dtsi @@ -133,6 +133,11 @@ status = "disabled"; }; + chip-info@1801a200 { + compatible = "realtek,rtd1195-chip"; + reg = <0x1801a200 0x8>; + }; + uart1: serial@1801b200 { compatible = "snps,dw-apb-uart"; reg = <0x1801b200 0x100>; From patchwork Sun Nov 3 01:36:39 2019 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: 178365 Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp2570006ill; Sat, 2 Nov 2019 18:37:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqz6su5QVXnfZImv+sJVB/8LxOM7zYSKVzB7dusAQtTmXddDIxPX0WDWym8bXy3i3L24DFGt X-Received: by 2002:a05:6402:205c:: with SMTP id bc28mr4288282edb.124.1572745022346; Sat, 02 Nov 2019 18:37:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572745022; cv=none; d=google.com; s=arc-20160816; b=Q/RcsRNuM6YGlm4/WGJn5IVuw4SCWy3xeffxKEHgvw8a93Df1d+8qa+5SPk0xX9yCX B0GgDYpiB3hkAA8uR2dVc2FtO+WrwMpOYtPlQOzTwhbebWlFVOEr8Rr1KvKvAa1EQiaq 0MUdQy0ogWTQcJeCvY2DV3N9PDBu9oOcl6gCJGcT3FG33H0+OLJcDvvmWXH42+wgsq9H nSyk+H34jx3xmEoh8jEdWWGcL4VwpvlvEVAlXjm/muxULSGHUg1MCqUQqIiVb4KMrsAw xNORYjwsIoq/rw2H6vFcOctBw8PkPYSUIIYl+YfmtFrCO+B4+KppaoE7Gsx2+3Da8LLD Jh/Q== 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=xGh0S4VoKiNzS4Myr8kiF35v4pIvY4Dz1So/upIIZ28=; b=ptZbj6UFl8D2rZHsFJB5STneRVx4tZDacfo6yCMPJcrmoM4ZKUSFLk1OhK3GCfEXbh GLogQAgdpvlSpP6gORZmkEtR4n54bbJnSK4RuE5989aYChuGiEhPVkiuAjJHNUw83hDI lmbDv5dk4PmcuRJZeYwwdGhR4PsgLX2itnssmc6OtRKBHA4vj5zpXXjcaZwN/JsnKqVg g2+7ZQbzl3SxUdeWQU0wQK2LBMaiD9thjvJ9lxksJ0yT2XoXUrjZ4+xXn2edhphvdcdC JHrc9D2gitTXSfhe9U8BO/BNK1gScP8Q/HeiYhRBunhToJHst+6wFHqrRXTSQzNMIX23 jVUw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r20si3906087edm.17.2019.11.02.18.37.02; Sat, 02 Nov 2019 18:37:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727536AbfKCBg5 (ORCPT + 26 others); Sat, 2 Nov 2019 21:36:57 -0400 Received: from mx2.suse.de ([195.135.220.15]:59452 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727346AbfKCBg4 (ORCPT ); Sat, 2 Nov 2019 21:36:56 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id BE909AFA8; Sun, 3 Nov 2019 01:36:54 +0000 (UTC) From: =?utf-8?q?Andreas_F=C3=A4rber?= To: linux-realtek-soc@lists.infradead.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, =?utf-8?q?Andreas_F=C3=A4rber?= , Rob Herring , Mark Rutland , devicetree@vger.kernel.org Subject: [RFC 05/11] dt-bindings: soc: realtek: rtd1195-chip: Extend reg property Date: Sun, 3 Nov 2019 02:36:39 +0100 Message-Id: <20191103013645.9856-6-afaerber@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20191103013645.9856-1-afaerber@suse.de> References: <20191103013645.9856-1-afaerber@suse.de> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Allow to optionally specify a second register to identify the chip. Whether needed and which register to specify depends on the family; RTD1295 family will want the CHIP_INFO1 register. Signed-off-by: Andreas Färber --- A SoC specific binding would defeat the purpose of the generic Linux driver; is it possible to check the root node's compatible in an if: expression to prohibit using more than one reg on "realtek,rtd1195"? .../devicetree/bindings/soc/realtek/realtek,rtd1195-chip.yaml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) -- 2.16.4 diff --git a/Documentation/devicetree/bindings/soc/realtek/realtek,rtd1195-chip.yaml b/Documentation/devicetree/bindings/soc/realtek/realtek,rtd1195-chip.yaml index 565ad2419553..e431cf559b66 100644 --- a/Documentation/devicetree/bindings/soc/realtek/realtek,rtd1195-chip.yaml +++ b/Documentation/devicetree/bindings/soc/realtek/realtek,rtd1195-chip.yaml @@ -11,13 +11,15 @@ maintainers: description: | The Realtek SoCs have some registers to identify the chip and revision. + To identify the exact model within a family, further registers are needed. properties: compatible: const: "realtek,rtd1195-chip" reg: - maxItems: 1 + minItems: 1 + maxItems: 2 required: - compatible @@ -29,4 +31,10 @@ examples: compatible = "realtek,rtd1195-chip"; reg = <0x1801a200 0x8>; }; + - | + chip-info@9801a200 { + compatible = "realtek,rtd1195-chip"; + reg = <0x9801a200 0x8>, + <0x98007028 0x4>; + }; ... From patchwork Sun Nov 3 01:36:40 2019 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: 178364 Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp2570003ill; Sat, 2 Nov 2019 18:37:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqxUJJdo+Nz8jrU52BgpRb3iwn7IczQ3AGp2kj/UeW87mMZNyujGxGuYQPSGfLY1ZaLstpH2 X-Received: by 2002:a17:906:5911:: with SMTP id h17mr17622929ejq.194.1572745021960; Sat, 02 Nov 2019 18:37:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572745021; cv=none; d=google.com; s=arc-20160816; b=iFjQWbYpGciZvyIIIyPNkFh7GyLdbL4j3ZLFrykan+8CrQgrCKtPB0atNPUAGv/RUH o5GuJ14d/6ArjjPzd0Sq4shrEJCLhnZSzzJDJb2bnYw8VRyfqzNIm/TiZ4zhV72n4FeO reSbkvx7RUWLGFAA5lhy9v6CLwnQ0w8HYzU9AUo3eiHqGclCMy09XWA6M44BTtILEqGx R5tHsZD48ZGzuhGlEN7L+XPtEA1WScHtX+dtfCvVuAeyY2fVhjf/pQAJzVfzOCuUMYXA Bei6HNzuxGb1f1QfcL4J20NaJtLnmCynzkRBU4IshHah7e9bQbvlTroDpsuqlPljwzz+ UpYA== 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=D/OMlUN3Zp7DKugQUr5dcg3+TzXNjIP8g7bq8TZhGJA=; b=0VIhsxmYSeIhsjQdnJ6wUlniPhdXgLHEMWWbM/c/FWORF5/bc2bVIVVrhKy/99+98c S65SDURT+8PLfmB9wGr9VYfG3WbsmmfKl6OoQ49vn9So2Z1NrKpcYS1WaCOnuvNJ0+94 IMLef6BtNLj8c/fYJfBU+osDEs8jyv869gCQwXV7ljE01rR98de/UpSCWpZI/H/Xlt+4 Q5vmpUpJ3j0Dzs+czFZAk38nIXAHLU6xTlxBJv8n9InOxHzBAwYw4C62Huviu6uf3pGc q2om0r5gzHmIw4Pevp5d5eX9zGMIBSQjFMhU7e4hJ5wMCkl39w6LqVVY7lAgkgRw7LV+ hwGQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r20si3906087edm.17.2019.11.02.18.37.01; Sat, 02 Nov 2019 18:37:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727492AbfKCBg4 (ORCPT + 26 others); Sat, 2 Nov 2019 21:36:56 -0400 Received: from mx2.suse.de ([195.135.220.15]:59462 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727431AbfKCBg4 (ORCPT ); Sat, 2 Nov 2019 21:36:56 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 20627AFD4; Sun, 3 Nov 2019 01:36:55 +0000 (UTC) From: =?utf-8?q?Andreas_F=C3=A4rber?= To: linux-realtek-soc@lists.infradead.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, =?utf-8?q?Andreas_F=C3=A4rber?= Subject: [RFC 06/11] soc: realtek: chip: Detect RTD1296 Date: Sun, 3 Nov 2019 02:36:40 +0100 Message-Id: <20191103013645.9856-7-afaerber@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20191103013645.9856-1-afaerber@suse.de> References: <20191103013645.9856-1-afaerber@suse.de> MIME-Version: 1.0 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. Signed-off-by: Andreas Färber --- drivers/soc/realtek/chip.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) -- 2.16.4 diff --git a/drivers/soc/realtek/chip.c b/drivers/soc/realtek/chip.c index 9d13422e9936..ba653c097644 100644 --- a/drivers/soc/realtek/chip.c +++ b/drivers/soc/realtek/chip.c @@ -50,9 +50,25 @@ static const char *default_name(struct device *dev, const struct rtd_soc *s) return s->family; } +static const char *rtd1295_name(struct device *dev, const struct rtd_soc *s) +{ + void __iomem *base; + + base = of_iomap(dev->of_node, 1); + if (base) { + u32 chipinfo1 = readl_relaxed(base); + iounmap(base); + if (chipinfo1 & BIT(11)) { + return "RTD1296"; + } + } + + return "RTD1295"; +} + static const struct rtd_soc rtd_soc_families[] = { { 0x00006329, "RTD1195", default_name, rtd1195_revisions, "Phoenix" }, - { 0x00006421, "RTD1295", default_name, rtd1295_revisions, "Kylin" }, + { 0x00006421, "RTD1295", rtd1295_name, rtd1295_revisions, "Kylin" }, }; static const struct rtd_soc *rtd_soc_by_chip_id(u32 chip_id) From patchwork Sun Nov 3 01:36:42 2019 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: 178370 Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp2570160ill; Sat, 2 Nov 2019 18:37:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqxegg7jPBsm7wppwwTbgX5x0xDluQv7AwEM0484tb+NSztE2gNia8HIDNdfodSq/VZRPrJG X-Received: by 2002:a17:906:a388:: with SMTP id k8mr14969620ejz.223.1572745038978; Sat, 02 Nov 2019 18:37:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572745038; cv=none; d=google.com; s=arc-20160816; b=MHcGME1LVB9+nw/Oq81w2I41jiK9xE1Vj4eyds3y4mJ96Xn6UCMsZplnK9bj2GdASQ 3YeFXfFqO0fxKPJjAUdFdVJEITsvmpemh24+f3bZUatf/56//dqEbARBqVizZ3fC9c1s 7QJezbxM+lgyt8OdtI/wZkleHfOxC4CxNZezOcAiSJyXUUIvZBSTMgr4HnB3jlWYh5d/ J2A+yxHSkUBXthezCtk85evfG9NVr+6iTs3EtwJ2cG1k+DcL8RCu6ikZfGLHJ4PJNz9a ZpyacnwoMilQ+BhSePbRfdmFI/2xYDNVJRyZZ32HqXJw/xH5yzvIc5qclafrqmXyy0dy FCwA== 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=hebEcbLdVmWtmpFjnwsonjwqNBHHlQ+uyd8BnGrSd98=; b=K2TlNFUfUIZQTqWETuCEMpYee6hk+qqaFhHKk9DU2ngJARAFxPjAdH4ghDmbOjkvie YpuYXz1ZozCyII+uDRnuG6T2dSJhdKzq4QEKtfBSPKJhezPgclzN5K9mh61BTzmjrPE6 GiYV9zkYoD5j75qsexIfPY9k+QqH5XqFIhtn5/Bv7HdVEEfcsXK990SqaaYj9bPAb1VI SHIo1iBBW7kq8T5vCYQsB8KW7ssvDulzihyhqlUnuA83LDMzHyRvByXL5osi0G+cA+Y4 MuqwHEJr8WHpZQEmlhXEx1MM/nszM5C1xWUqmXawATukACRtozSImI4rA9M0G2yJHXIV J1vg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g40si4077120edb.369.2019.11.02.18.37.18; Sat, 02 Nov 2019 18:37:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727644AbfKCBhR (ORCPT + 26 others); Sat, 2 Nov 2019 21:37:17 -0400 Received: from mx2.suse.de ([195.135.220.15]:59478 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727476AbfKCBg5 (ORCPT ); Sat, 2 Nov 2019 21:36:57 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id ED297B248; Sun, 3 Nov 2019 01:36:55 +0000 (UTC) From: =?utf-8?q?Andreas_F=C3=A4rber?= To: linux-realtek-soc@lists.infradead.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, =?utf-8?q?Andreas_F=C3=A4rber?= Subject: [RFC 08/11] soc: realtek: chip: Detect RTD1293 Date: Sun, 3 Nov 2019 02:36:42 +0100 Message-Id: <20191103013645.9856-9-afaerber@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20191103013645.9856-1-afaerber@suse.de> References: <20191103013645.9856-1-afaerber@suse.de> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Logic self-determined by comparing DS418j and DS418 registers. Signed-off-by: Andreas Färber --- drivers/soc/realtek/chip.c | 2 ++ 1 file changed, 2 insertions(+) -- 2.16.4 diff --git a/drivers/soc/realtek/chip.c b/drivers/soc/realtek/chip.c index ba653c097644..f4b26fb048c7 100644 --- a/drivers/soc/realtek/chip.c +++ b/drivers/soc/realtek/chip.c @@ -59,6 +59,8 @@ static const char *rtd1295_name(struct device *dev, const struct rtd_soc *s) u32 chipinfo1 = readl_relaxed(base); iounmap(base); if (chipinfo1 & BIT(11)) { + if (chipinfo1 & BIT(4)) + return "RTD1293"; return "RTD1296"; } } From patchwork Sun Nov 3 01:36:44 2019 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: 178366 Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp2570013ill; Sat, 2 Nov 2019 18:37:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqzN35qbPhhYuD3tYAv5DsPZJgwKQ66gDFIDaBHJNXVpzZs7DhUfTeaTXxpLn/yTaJCZeZGD X-Received: by 2002:a17:906:6848:: with SMTP id a8mr17371672ejs.306.1572745022794; Sat, 02 Nov 2019 18:37:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572745022; cv=none; d=google.com; s=arc-20160816; b=J7xzZrvEUMI9noqOvzlgaBfbmhwUCIQcrSzuXBQotm5d9/EBpfIt5OfcB7TCJ8bzCa KD932EUB5bibQrfhlCeKlffRGvlpNUF7znFAU6WOPRzMt5/7CS/X+3/3x9UYi281j5DL F0ueG6r0Tn/m/gnZHkKBqjZDc8O5owzYRZzg0gc1FA3KNBSocNedMnlpNPJq1C/LUV3+ E4mPWbmjyfPsrl8uuSNat7vLqhJXtNK62M0jtlTMRH9EC4W5ed7pqBxurhZDgyWok0WL CDS8XRvy0ThZJZJYkTb+LO4LXkpGkQ9UwgH+Y+D+wP+5fBPmwW3vExLQYRchLLChe2Xp eVPQ== 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=cwOUaWgd7TpSTnTd3rxmdJ1Q75D1ndZ8693Ae811Xaw=; b=eqP1GKa04Y8Abg8g6N9w44JrT4mSSd1KVYJmND2dtOzOIL5bgIbsCUj+KmwW7nuQR3 gmLmL1O8Mg5+3lKCD52S97adFit/3gmVwCwqteOgI2nkT6uZgt8xvTFcXl6diHOJC5wo IWIeTQ6wvvrVLRhNxadckw6J4vZXROMODffrJkc5Osu0FJlYEq2vZ0KuFxi5N7gAiTXS xxreD6nILHe1FKlUeSIbO2VtU6xc8fqJcXPEpoVyg0S0RYHKDax07VOsDEP7wvSLms/4 vU8T71y6A1clYP1M9rHzFG5RrB2uTCgKQnbA3WUQ3Le+YN/+eKpCKFjsshuerCrt7tBI wTmQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r20si3906087edm.17.2019.11.02.18.37.02; Sat, 02 Nov 2019 18:37:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727556AbfKCBg6 (ORCPT + 26 others); Sat, 2 Nov 2019 21:36:58 -0400 Received: from mx2.suse.de ([195.135.220.15]:59452 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727503AbfKCBg5 (ORCPT ); Sat, 2 Nov 2019 21:36:57 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id B597CB30C; Sun, 3 Nov 2019 01:36:56 +0000 (UTC) From: =?utf-8?q?Andreas_F=C3=A4rber?= To: linux-realtek-soc@lists.infradead.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, =?utf-8?q?Andreas_F=C3=A4rber?= Subject: [RFC 10/11] soc: realtek: chip: Detect RTD1294 Date: Sun, 3 Nov 2019 02:36:44 +0100 Message-Id: <20191103013645.9856-11-afaerber@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20191103013645.9856-1-afaerber@suse.de> References: <20191103013645.9856-1-afaerber@suse.de> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Detection logic from downstream include/soc/realtek/rtd129x_cpu.h. Signed-off-by: Andreas Färber --- drivers/soc/realtek/chip.c | 8 ++++++++ 1 file changed, 8 insertions(+) -- 2.16.4 diff --git a/drivers/soc/realtek/chip.c b/drivers/soc/realtek/chip.c index f4b26fb048c7..e13339a4ca2e 100644 --- a/drivers/soc/realtek/chip.c +++ b/drivers/soc/realtek/chip.c @@ -54,6 +54,14 @@ static const char *rtd1295_name(struct device *dev, const struct rtd_soc *s) { void __iomem *base; + base = of_iomap(dev->of_node, 2); + if (base) { + u32 efuse = readl_relaxed(base); + iounmap(base); + if ((efuse & 0x3) == 0x1) + return "RTD1294"; + } + base = of_iomap(dev->of_node, 1); if (base) { u32 chipinfo1 = readl_relaxed(base); From patchwork Sun Nov 3 01:36:45 2019 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: 178367 Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp2570019ill; Sat, 2 Nov 2019 18:37:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqwwHfkqCUAop3daaKKVf896uQzrRJitD5URrAsOPGl64JU2xNJn/36MwEnv31jkGcvQrIVr X-Received: by 2002:a17:906:6004:: with SMTP id o4mr17317944ejj.107.1572745023172; Sat, 02 Nov 2019 18:37:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572745023; cv=none; d=google.com; s=arc-20160816; b=e35CGRbebYqUuxH65lFbWX0KuEUBeqLUP1DvmMs2sGjSf+sTuGWcyG/vB559FCLFKU rSBZ6gXwVF8cSX/Wfpr8eSA/ADhH1jHCvA2SCqP117enhhg2iAaPUDJpuug3wBWvuulq odniyaFC7TIOJ9JpQGdZNZGoYMgj/O5ObnWASIbiPRgONzarQhg4iuGwYUdbgG6auhAE S1U/WV4igdEEnTpJjvAs3u7/rHtrJyKMM4rH1UqPm524BWulNTPEz+shlGzFJpH4JWN3 1rRpUa6AIpEirSfWGzxW1LXnOVgr/jRd8XwYIS0sgzt7JRcUTXtTG+Wb5HcYv0Ffvzqg AUSA== 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=s7rcHtP3NiLKxltLYvdjXsY1Kh1zDUfY2e/3wi3OHoQ=; b=Qb9QobC+PlgKwRV7XZwv2drQN8yqQbFz4FkwzNg764PIp83yXqaHoWrnA/VU4QS1tE vJxjeF5pAV6FgZ8y3lEe5Q5qjjbOlZNFH+WOzOkM+9elA8VKWbwllKyTu51CDb5EVQCc j533pbKvN8IAiMWcKEJcq076ke4y8LkXhdi4oNDVdVebq1XUTqhG/lK+3CYiSe8yDoSK 63rGvgLKXU9LwqXcwSTNmMG+JwBjdQs+VUVlh0N3xYHpVTiRL5NYlan5Zei0BnSdo5Jg x38oPUMkx4yfrLISeOCisEvLsxYjUFZUElvfssZS09Ma0FOuQdikNEJNP/wSQCf3ybus BGZw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r20si3906087edm.17.2019.11.02.18.37.03; Sat, 02 Nov 2019 18:37:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727585AbfKCBhB (ORCPT + 26 others); Sat, 2 Nov 2019 21:37:01 -0400 Received: from mx2.suse.de ([195.135.220.15]:59468 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727523AbfKCBg6 (ORCPT ); Sat, 2 Nov 2019 21:36:58 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 31BCFB30D; Sun, 3 Nov 2019 01:36:57 +0000 (UTC) From: =?utf-8?q?Andreas_F=C3=A4rber?= To: linux-realtek-soc@lists.infradead.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, =?utf-8?q?Andreas_F=C3=A4rber?= , Rob Herring , Mark Rutland , devicetree@vger.kernel.org Subject: [RFC 11/11] arm64: dts: realtek: rtd129x: Extend chip-info reg with efuse Date: Sun, 3 Nov 2019 02:36:45 +0100 Message-Id: <20191103013645.9856-12-afaerber@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20191103013645.9856-1-afaerber@suse.de> References: <20191103013645.9856-1-afaerber@suse.de> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This register is needed to detect RTD1294. Signed-off-by: Andreas Färber --- arch/arm64/boot/dts/realtek/rtd129x.dtsi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.16.4 diff --git a/arch/arm64/boot/dts/realtek/rtd129x.dtsi b/arch/arm64/boot/dts/realtek/rtd129x.dtsi index fea7c1ed7d08..670efa86f661 100644 --- a/arch/arm64/boot/dts/realtek/rtd129x.dtsi +++ b/arch/arm64/boot/dts/realtek/rtd129x.dtsi @@ -87,7 +87,8 @@ chip-info@9801a200 { compatible = "realtek,rtd1195-chip"; reg = <0x9801a200 0x8>, - <0x98007028 0x4>; + <0x98007028 0x4>, + <0x980171d8 0x4>; }; uart1: serial@9801b200 {