Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1603462ybh; Mon, 20 Jul 2020 02:34:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxVM1iLJQzFYV+a7Adbg9DrJTudHlz/J9AdOFqrXMCnJJzQN0rruj3fkgvfJCJ3u+JNoEwm X-Received: by 2002:a17:907:426c:: with SMTP id nx20mr19747435ejb.548.1595237640057; Mon, 20 Jul 2020 02:34:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595237640; cv=none; d=google.com; s=arc-20160816; b=x/6gxky6eC0Wk55caDJo8T7igAd5f7FJDqHp8ZDOT8eNqJp8B1H68zWRTwv1Yqch5u Fob0ju/TIDJg7w8T8Tm92fqBjZeJSyughp4gMBqZDJnWlrY26x5BtoI0ZPf3dNIxYKwd b54UoiPdsp60i2NNWIf1y18FiXiyYNuxlxz1/AEsIkNuHz+emFf1B0oqeEfnBrTUEswR HKecxqTpCAU+AiOsCAvysGBbGHQVCJulo6yYjqvQiIORtNAkrOJjczWKjQ1LCT55TEnj uPkREPmMPUz4/JKvZOqrA+0pVpis1eDHgyG85PppaJs3QsqQZHWHACd/lqww8PKJx4BM dx6A== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=1zb3+2EAQpbVRtFxcmapZb5qs9fbF12day9dwhvNN/c=; b=N8dyhnEHoYobpXuVjlBCI3GZNHgrFoNaZze8Bbc0yW4JdP8lsSHbeXDOeSxQwjkpj+ j/Xxspkxbol+m7Ufdqk55agmYveThQNCC2zEERM5u9hUko0nQ2xWFn4i0wYyGdHyc/nM +zFRDjSmaFMHVd5sQ2Mn6eO7AHAlIv8K2VY9ooF+kxNXbXPGSTZ6liQWI+r1Nr2If+xt 0HwpjEgK+3HadEmZ1H/jhNa8m8lV8H2vLwSNNbLS/jLKQkgIVe0z7c5YZUxsDkanZr7o 1P5oqNJNmmzLfywQfmyI9+qMNXjTyTynA8wl5NbXH4NTB+4AiorzxkvcNu5WMkUwjE/t Lh7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="oIjPLY/k"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m18si10393356edr.21.2020.07.20.02.33.36; Mon, 20 Jul 2020 02:34:00 -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; dkim=pass header.i=@linaro.org header.s=google header.b="oIjPLY/k"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728135AbgGTJbV (ORCPT + 99 others); Mon, 20 Jul 2020 05:31:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726520AbgGTJbU (ORCPT ); Mon, 20 Jul 2020 05:31:20 -0400 Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33B63C061794 for ; Mon, 20 Jul 2020 02:31:20 -0700 (PDT) Received: by mail-wm1-x344.google.com with SMTP id w3so24432204wmi.4 for ; Mon, 20 Jul 2020 02:31:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=1zb3+2EAQpbVRtFxcmapZb5qs9fbF12day9dwhvNN/c=; b=oIjPLY/kS3LJjo7l28j1ki5x5PJYrDcEV7IkNG/WQBdBuHUGYx9UoaFkwRUymrTBWk KIjibt3+bWs4StIaH0lADchgNl7/uxldHalN7L4huEMT5mer/UcQD3V/oT0hTlmYSwOB Us+yNQ+hAcMJVhcpm9ErKpE/Ld/NKigHakUyifvom+jElrdcECxOh8mDBV6YtPkIzJ5v KZiYVr+B+1W/A/twGmfIziXv+Nb94jbFCFFPboG8oi/Lbw7YUx8vCHytO5GQz7UA+7X6 EqDE8sc25Rfs9oIhYHHkp3I9cmK+OTWxaX3gy4gsx0gpncSsIK3vbEFjyByTrSIWRGBm SyTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=1zb3+2EAQpbVRtFxcmapZb5qs9fbF12day9dwhvNN/c=; b=Dq6RC6dZQVlLg9oecqt+DTS3Lz9Lv39PwSsfDXSVvyRCLi5E0LDipMVCdQlf3IebUT 31UN845lSrCDjFoa8B+3qc8gwegw48iaVriGnZkkb6ATsgBK8aMhGMeLlT5YTtBsdSxD PMQzFygase7cAnTUrczdOM5VrQ9nwZj32/NK6xdehyEwcsSUBakdkB1yaY64i2DSzg9K h1x41CxIhZ4YD/bUDcjZSQFjWkXyGP+iJAV0Qge9yaSAU5bc6pVMqZWb0wW4k+YzHjAd GxOxQSkG6UKTFawmJuYrzz8I0+w0ebC4sL/W62kbvXT30zuLS79xBh/B/1riLde1MGx7 nYXQ== X-Gm-Message-State: AOAM531YemJ/5RkRWkvpWq6m6KA0rSva8Y+v3tFHzfuZjW1BdKJZJOUw QPWlsvdpqe1ESy2w3TNSGIu00w== X-Received: by 2002:a05:600c:2317:: with SMTP id 23mr21499232wmo.72.1595237478823; Mon, 20 Jul 2020 02:31:18 -0700 (PDT) Received: from [192.168.86.34] (cpc89974-aztw32-2-0-cust43.18-1.cable.virginm.net. [86.30.250.44]) by smtp.googlemail.com with ESMTPSA id n125sm33058276wme.30.2020.07.20.02.31.17 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Jul 2020 02:31:18 -0700 (PDT) Subject: Re: [PATCH v2 18/29] nvmem: Add Realtek DHC eFuse driver To: =?UTF-8?Q?Andreas_F=c3=a4rber?= , linux-realtek-soc@lists.infradead.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, =?UTF-8?B?SmFtZXMgVGFpIFvmiLTlv5fls7Bd?= , =?UTF-8?B?U3RhbmxleSBDaGFuZyBb5piM6IKy5b63XQ==?= , Edgar Lee References: <20200623025106.31273-1-afaerber@suse.de> <20200623025106.31273-19-afaerber@suse.de> From: Srinivas Kandagatla Message-ID: Date: Mon, 20 Jul 2020 10:31:17 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20200623025106.31273-19-afaerber@suse.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 23/06/2020 03:50, Andreas Färber wrote: > Implement enough of a read-only nvmem driver to easily read efuse cells. > > Cc: Cheng-Yu Lee > Signed-off-by: Andreas Färber If you are expecting this to be applied, then please resend this patch splitting the MAINTAINER File changes separately! --srini > --- > v2: New > > MAINTAINERS | 1 + > drivers/nvmem/Kconfig | 9 ++++ > drivers/nvmem/Makefile | 2 + > drivers/nvmem/rtk-dhc-efuse.c | 86 +++++++++++++++++++++++++++++++++++ > 4 files changed, 98 insertions(+) > create mode 100644 drivers/nvmem/rtk-dhc-efuse.c > > diff --git a/MAINTAINERS b/MAINTAINERS > index 1d0d6ab20451..02117fbf0e57 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -2312,6 +2312,7 @@ F: Documentation/devicetree/bindings/soc/realtek/ > F: arch/arm/boot/dts/rtd* > F: arch/arm/mach-realtek/ > F: arch/arm64/boot/dts/realtek/ > +F: drivers/nvmem/rtk-dhc-efuse.c > F: drivers/soc/realtek/ > > ARM/RENESAS ARM64 ARCHITECTURE > diff --git a/drivers/nvmem/Kconfig b/drivers/nvmem/Kconfig > index d7b7f6d688e7..75cf43b16cf9 100644 > --- a/drivers/nvmem/Kconfig > +++ b/drivers/nvmem/Kconfig > @@ -129,6 +129,15 @@ config NVMEM_SPMI_SDAM > Qualcomm Technologies, Inc. PMICs. It provides the clients > an interface to read/write to the SDAM module's shared memory. > > +config REALTEK_DHC_EFUSE > + tristate "Realtek DHC eFuse Support" > + depends on ARCH_REALTEK || COMPILE_TEST > + depends on HAS_IOMEM > + help > + Say y here to enable read-only access to the Realtek Digital Home > + This driver can also be built as a module. If so, the module > + will be called nvmem-rtk-dhc-efuse. > + > config ROCKCHIP_EFUSE > tristate "Rockchip eFuse Support" > depends on ARCH_ROCKCHIP || COMPILE_TEST > diff --git a/drivers/nvmem/Makefile b/drivers/nvmem/Makefile > index a7c377218341..67cefdfa44e6 100644 > --- a/drivers/nvmem/Makefile > +++ b/drivers/nvmem/Makefile > @@ -33,6 +33,8 @@ obj-$(CONFIG_ROCKCHIP_EFUSE) += nvmem_rockchip_efuse.o > nvmem_rockchip_efuse-y := rockchip-efuse.o > obj-$(CONFIG_ROCKCHIP_OTP) += nvmem-rockchip-otp.o > nvmem-rockchip-otp-y := rockchip-otp.o > +obj-$(CONFIG_REALTEK_DHC_EFUSE) += nvmem-rtk-dhc-efuse.o > +nvmem-rtk-dhc-efuse-y := rtk-dhc-efuse.o > obj-$(CONFIG_NVMEM_SUNXI_SID) += nvmem_sunxi_sid.o > nvmem_stm32_romem-y := stm32-romem.o > obj-$(CONFIG_NVMEM_STM32_ROMEM) += nvmem_stm32_romem.o > diff --git a/drivers/nvmem/rtk-dhc-efuse.c b/drivers/nvmem/rtk-dhc-efuse.c > new file mode 100644 > index 000000000000..4672db2c2619 > --- /dev/null > +++ b/drivers/nvmem/rtk-dhc-efuse.c > @@ -0,0 +1,86 @@ > +// SPDX-License-Identifier: GPL-2.0-or-later > +/* > + * Realtek Digital Home Center eFuse > + * > + * Copyright (c) 2020 Andreas Färber > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +struct dhc_efuse { > + struct device *dev; > + void __iomem *base; > + struct nvmem_device *nvmem; > +}; > + > +static int dhc_efuse_reg_read(void *priv, unsigned int offset, void *val, > + size_t bytes) > +{ > + struct dhc_efuse *efuse = priv; > + u8 *buf = val; > + > + while (bytes--) > + *buf++ = readb_relaxed(efuse->base + offset++); > + > + return 0; > +} > + > +static int dhc_efuse_probe(struct platform_device *pdev) > +{ > + struct dhc_efuse *efuse; > + struct nvmem_config config = {}; > + struct resource *res; > + > + efuse = devm_kzalloc(&pdev->dev, sizeof(*efuse), GFP_KERNEL); > + if (!efuse) > + return -ENOMEM; > + > + efuse->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res); > + if (IS_ERR(efuse->base)) > + return PTR_ERR(efuse->base); > + > + efuse->dev = &pdev->dev; > + > + config.dev = &pdev->dev; > + config.name = "dhc-efuse"; > + config.owner = THIS_MODULE; > + config.type = NVMEM_TYPE_OTP; > + config.read_only = true, > + config.word_size = 4; > + config.stride = 1; > + config.size = resource_size(res); > + config.reg_read = dhc_efuse_reg_read; > + config.priv = efuse; > + > + efuse->nvmem = devm_nvmem_register(&pdev->dev, &config); > + if (IS_ERR(efuse->nvmem)) { > + dev_err(&pdev->dev, "failed to register nvmem (%ld)\n", > + PTR_ERR(efuse->nvmem)); > + return PTR_ERR(efuse->nvmem); > + } > + > + return 0; > +} > + > +static const struct of_device_id dhc_efuse_dt_ids[] = { > + { .compatible = "realtek,rtd1195-efuse" }, > + { } > +}; > + > +static struct platform_driver dhc_efuse_driver = { > + .probe = dhc_efuse_probe, > + .driver = { > + .name = "rtk-dhc-efuse", > + .of_match_table = dhc_efuse_dt_ids, > + }, > +}; > +module_platform_driver(dhc_efuse_driver); > + > +MODULE_DESCRIPTION("Realtek DHC eFuse driver"); > +MODULE_LICENSE("GPL"); >