From patchwork Thu Jul 16 14:18:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11667659 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 A6ED313B1 for ; Thu, 16 Jul 2020 14:21:56 +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 7D85020787 for ; Thu, 16 Jul 2020 14:21:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Cv4N3uXd"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="BUJOV4iY" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7D85020787 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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=AHNEKna5gUwsGyw6LLYugPM8ktioLHCQcPXb6TCYmHE=; b=Cv4N3uXditL8xBFrKQt4ua0FQ ZUcFj3V6LyPpHk+Udj2jQomuJP0ZYpyC7eVVacq/SNCuF87CcoaX6KxcudY20pYMdgMSc/ngYJ4D7 53mTaeFtZfmW0poqGqUqdqqLycWOBDnDvouLPHjcwEnMxs98GZzCCgndNSNBfAdgsLiYnN5CE4Ijc H7tUf3ByUz/q32o7v19ybZWbeF3Tqly8VyZ8jP4SQtK3637OYucS0tv87tLTrqvi9SZscql+NxcIx ZUxE0A27PrZpxWa+tSW6wd4aqXgwQHaux89K6NRZiIW+9oC8Snn0MQ4+GI5pGeiWd1NPtWMHgE0jm 0rxOsdEcA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jw4k9-0004GP-M8; Thu, 16 Jul 2020 14:20:13 +0000 Received: from mail-ej1-x641.google.com ([2a00:1450:4864:20::641]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jw4jH-0003x5-Be for linux-arm-kernel@lists.infradead.org; Thu, 16 Jul 2020 14:19:20 +0000 Received: by mail-ej1-x641.google.com with SMTP id br7so6739502ejb.5 for ; Thu, 16 Jul 2020 07:19:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qRvl4Cg342hduyQ87yrRPUpPC9ZQkFYCJmOo+8OGXrg=; b=BUJOV4iY+mmu4QTHeMLd66xownrZFgCNSV0T33X8eEuaIfkHtuNDzbP5MODjumKhtz iuRxSGzHM+g/evz0AvHiRp+7R+vbjJQOI95MJOEoxaPQaQY6TmIEcxQ7NNd6jbM+CEn1 ro8ZgORmpPNewu2cXOJblWHfQ2B8sqDR//YhpFhLXm2JRnP3FYH/S64Ldp3JxEkfuBnY B1MmJfdQjsC5MpOgwIRLIiwOisSq8QQIMGBlXG6p1cmyGg6Sm4tT5WP+g0/W9NBQocqx fpgUDyiCu89Tahgjz8dw2OsqHpEval/L8S35pHTh3HQ8FE96My1ygMQY6TV9USL6xFws AP3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qRvl4Cg342hduyQ87yrRPUpPC9ZQkFYCJmOo+8OGXrg=; b=lLaCuETfVHITRcvmkzlBS2pdXxOII/x3Yge6g88cxn2cb5cRSxX5H6wsf4vhSWkury pNQWXb9YVI6Mkd+ubrStZ59MLn6T4M8SdjXQUKtngTk+jjlloRp74EOZn3E5/3qTJjD3 aKJC51oaK/IdVdS/I8u67T6npXJ+ujcNviKuOzk7M/PiJDsdLs2W3mwRgvd5fiUxeRB5 JnUujDLy1QbCGZlI2tX6A199II2h60/VYzOe0GKuoCR0Zg9MID3Zi+/SPXZAzXluwfdN FhuxXfmNEOW7oizgB3PAR5B8Z7y8X+JuWafy84O8nF2vQpkySPkNJyxHhKB5ENLxzviD KjUQ== X-Gm-Message-State: AOAM532Qjgh43EF8fRFU+RZXZ1MebKNkS++NqNiiZa1ZcbPCh0gHGXcH WdkhbIYa0k9tMH3YpWkcoRI= X-Google-Smtp-Source: ABdhPJyumddGVxVVMPvNRyPqIgX7LqNR8HU5saWv82oSzzEAk+aKg429HNLC+7XNKFs7YeccPxvrgw== X-Received: by 2002:a17:906:d286:: with SMTP id ay6mr3967155ejb.400.1594909158460; Thu, 16 Jul 2020 07:19:18 -0700 (PDT) Received: from localhost ([62.96.65.119]) by smtp.gmail.com with ESMTPSA id z11sm5177398ejx.17.2020.07.16.07.19.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jul 2020 07:19:17 -0700 (PDT) From: Thierry Reding To: Thierry Reding Subject: [PATCH 7/9] soc/tegra: fuse: Add Tegra234 support Date: Thu, 16 Jul 2020 16:18:54 +0200 Message-Id: <20200716141856.544718-8-thierry.reding@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200716141856.544718-1-thierry.reding@gmail.com> References: <20200716141856.544718-1-thierry.reding@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200716_101919_476818_0422EA22 X-CRM114-Status: GOOD ( 15.96 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:641 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [thierry.reding[at]gmail.com] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 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: linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Jon Hunter Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Thierry Reding Add support for FUSE block found on the Tegra234 SoC, which is largely similar to the IP found on previous generations. Signed-off-by: Thierry Reding Reviewed-by: Jon Hunter --- drivers/soc/tegra/fuse/fuse-tegra.c | 6 +++++- drivers/soc/tegra/fuse/fuse-tegra30.c | 30 ++++++++++++++++++++++++++ drivers/soc/tegra/fuse/fuse.h | 10 ++++++++- drivers/soc/tegra/fuse/tegra-apbmisc.c | 1 + include/soc/tegra/fuse.h | 1 + 5 files changed, 46 insertions(+), 2 deletions(-) diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c index 7e6b6ee59120..94b60a692b51 100644 --- a/drivers/soc/tegra/fuse/fuse-tegra.c +++ b/drivers/soc/tegra/fuse/fuse-tegra.c @@ -49,6 +49,9 @@ static struct tegra_fuse *fuse = &(struct tegra_fuse) { }; static const struct of_device_id tegra_fuse_match[] = { +#ifdef CONFIG_ARCH_TEGRA_234_SOC + { .compatible = "nvidia,tegra234-efuse", .data = &tegra234_fuse_soc }, +#endif #ifdef CONFIG_ARCH_TEGRA_194_SOC { .compatible = "nvidia,tegra194-efuse", .data = &tegra194_fuse_soc }, #endif @@ -326,7 +329,8 @@ const struct attribute_group tegra_soc_attr_group = { .attrs = tegra_soc_attr, }; -#ifdef CONFIG_ARCH_TEGRA_194_SOC +#if IS_ENABLED(CONFIG_ARCH_TEGRA_194_SOC) || \ + IS_ENABLED(CONFIG_ARCH_TEGRA_234_SOC) static ssize_t platform_show(struct device *dev, struct device_attribute *attr, char *buf) { diff --git a/drivers/soc/tegra/fuse/fuse-tegra30.c b/drivers/soc/tegra/fuse/fuse-tegra30.c index 85accef41fa1..9ea7f0168457 100644 --- a/drivers/soc/tegra/fuse/fuse-tegra30.c +++ b/drivers/soc/tegra/fuse/fuse-tegra30.c @@ -356,3 +356,33 @@ const struct tegra_fuse_soc tegra194_fuse_soc = { .soc_attr_group = &tegra194_soc_attr_group, }; #endif + +#if defined(CONFIG_ARCH_TEGRA_234_SOC) +static const struct nvmem_cell_lookup tegra234_fuse_lookups[] = { + { + .nvmem_name = "fuse", + .cell_name = "xusb-pad-calibration", + .dev_id = "3520000.padctl", + .con_id = "calibration", + }, { + .nvmem_name = "fuse", + .cell_name = "xusb-pad-calibration-ext", + .dev_id = "3520000.padctl", + .con_id = "calibration-ext", + }, +}; + +static const struct tegra_fuse_info tegra234_fuse_info = { + .read = tegra30_fuse_read, + .size = 0x300, + .spare = 0x280, +}; + +const struct tegra_fuse_soc tegra234_fuse_soc = { + .init = tegra30_fuse_init, + .info = &tegra234_fuse_info, + .lookups = tegra234_fuse_lookups, + .num_lookups = ARRAY_SIZE(tegra234_fuse_lookups), + .soc_attr_group = &tegra194_soc_attr_group, +}; +#endif diff --git a/drivers/soc/tegra/fuse/fuse.h b/drivers/soc/tegra/fuse/fuse.h index 9d4fc315a007..e057a58e2060 100644 --- a/drivers/soc/tegra/fuse/fuse.h +++ b/drivers/soc/tegra/fuse/fuse.h @@ -115,9 +115,17 @@ extern const struct tegra_fuse_soc tegra210_fuse_soc; extern const struct tegra_fuse_soc tegra186_fuse_soc; #endif +#if IS_ENABLED(CONFIG_ARCH_TEGRA_194_SOC) || \ + IS_ENABLED(CONFIG_ARCH_TEGRA_234_SOC) +extern const struct attribute_group tegra194_soc_attr_group; +#endif + #ifdef CONFIG_ARCH_TEGRA_194_SOC extern const struct tegra_fuse_soc tegra194_fuse_soc; -extern const struct attribute_group tegra194_soc_attr_group; +#endif + +#ifdef CONFIG_ARCH_TEGRA_234_SOC +extern const struct tegra_fuse_soc tegra234_fuse_soc; #endif #endif diff --git a/drivers/soc/tegra/fuse/tegra-apbmisc.c b/drivers/soc/tegra/fuse/tegra-apbmisc.c index be6b7fc169ca..6aeac5ea2d70 100644 --- a/drivers/soc/tegra/fuse/tegra-apbmisc.c +++ b/drivers/soc/tegra/fuse/tegra-apbmisc.c @@ -56,6 +56,7 @@ bool tegra_is_silicon(void) { switch (tegra_get_chip_id()) { case TEGRA194: + case TEGRA234: if (tegra_get_platform() == 0) return true; diff --git a/include/soc/tegra/fuse.h b/include/soc/tegra/fuse.h index a9db917a1d06..c702bd2911bc 100644 --- a/include/soc/tegra/fuse.h +++ b/include/soc/tegra/fuse.h @@ -14,6 +14,7 @@ #define TEGRA210 0x21 #define TEGRA186 0x18 #define TEGRA194 0x19 +#define TEGRA234 0x23 #define TEGRA_FUSE_SKU_CALIB_0 0xf0 #define TEGRA30_FUSE_SATA_CALIB 0x124