From patchwork Fri Apr 12 14:08:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Dahl X-Patchwork-Id: 13627810 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CCFE4C4345F for ; Fri, 12 Apr 2024 14:08:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=TLEyRqbrxyEdSrnWslpA9hVafwc2yoeP5FlylYxfUiA=; b=HZrOTBiTn+9HLU S0y2S7PTSJqQHTB9EEuy22whkVpKtSYmGWlKQSyv3RSobvPqsDxmJLz3ySWLsH7TOa8ut/SzL1kHJ LPEl7IUMIQM8t5iJOKfzfAMBPmg0g8o9FC7UkPPSHydP6IExSVtFQfKHaTieEE4xhDE2Wmhp0buR0 9RHSUx2POPOEEGgQxM43gKUulRgelIgi4oP+oMCv6OiAvJAsxWNB3QgQcC+Z3vcDiZrtBlAUHoI9P 2/NRujxWygrWPinZTt3Ju9cHuTyTMKfyoyqr7fsJnXyNfJgM/1r6mYrKo1ujYiXlokkYS06gcR6tR jZnpvg8ngcw+8247SaBw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rvHZq-0000000HUGK-44WG; Fri, 12 Apr 2024 14:08:27 +0000 Received: from mail.thorsis.com ([2003:a:e28:26e4::10]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rvHZl-0000000HUBi-1368 for linux-arm-kernel@lists.infradead.org; Fri, 12 Apr 2024 14:08:23 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id E3B9C148CE13; Fri, 12 Apr 2024 16:08:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thorsis.com; s=dkim; t=1712930894; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=sBl9oAOfMtgLk5aj+/DBmqnWaUXUF14bw/24EPbqnmA=; b=SPW1M2jbnU6MXKb15lSvyKvVIN3FnC7iukYQaJ+nL5+BosGJV2W/kIB5iUEgeoO/buenw1 3iP7i2kNOXbKY4srZXprxOIwIAibd2/F/TK9UU2MEejaNa/SCTROP4WyUIGgdvFcAZ/VE2 6Fm/HSlWoRi0n0wbKJKFKISb+uKMisKtZPaTxQVrMBzegDGhNlfDUN05rnoebRIQGCjBcN JAH9dgJcBmxIJ6uBCrWt0mptj915VvQ+C81e1sI256vx52+VxPEaAvAfDyb1iUdfQ4PCVy 70/Q/V/47qw04WSk7wHWy43Kp2viH40X7duL4IbAs7QmR8PlKTxelcjb9dcssA== From: Alexander Dahl To: Claudiu Beznea Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH 1/1] nvmem: microchip-otpc: Add support for SAM9X60 Date: Fri, 12 Apr 2024 16:08:02 +0200 Message-Id: <20240412140802.1571935-2-ada@thorsis.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240412140802.1571935-1-ada@thorsis.com> References: <20240412140802.1571935-1-ada@thorsis.com> MIME-Version: 1.0 X-Last-TLS-Session-Version: TLSv1.3 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240412_070821_532336_5E0146DE X-CRM114-Status: GOOD ( 12.23 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --- .../dts/microchip/at91-sam9x60_curiosity.dts | 4 ++++ arch/arm/boot/dts/microchip/sam9x60.dtsi | 7 +++++++ drivers/nvmem/microchip-otpc.c | 16 +++++++++++++--- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/arch/arm/boot/dts/microchip/at91-sam9x60_curiosity.dts b/arch/arm/boot/dts/microchip/at91-sam9x60_curiosity.dts index c6fbdd29019f..754ce8134f73 100644 --- a/arch/arm/boot/dts/microchip/at91-sam9x60_curiosity.dts +++ b/arch/arm/boot/dts/microchip/at91-sam9x60_curiosity.dts @@ -254,6 +254,10 @@ ethernet-phy@0 { }; }; +&otpc { + status = "okay"; +}; + &pinctrl { adc { pinctrl_adc_default: adc-default { diff --git a/arch/arm/boot/dts/microchip/sam9x60.dtsi b/arch/arm/boot/dts/microchip/sam9x60.dtsi index 291540e5d81e..010c45f533fe 100644 --- a/arch/arm/boot/dts/microchip/sam9x60.dtsi +++ b/arch/arm/boot/dts/microchip/sam9x60.dtsi @@ -156,6 +156,13 @@ sdmmc1: sdio-host@90000000 { status = "disabled"; }; + otpc: efuse@eff00000 { + compatible = "microchip,sam9x60-otpc", "syscon"; + reg = <0xeff00000 0xec>; + #address-cells = <1>; + #size-cells = <1>; + }; + apb { compatible = "simple-bus"; #address-cells = <1>; diff --git a/drivers/nvmem/microchip-otpc.c b/drivers/nvmem/microchip-otpc.c index 7cf81738a3e0..af9ab1158a2b 100644 --- a/drivers/nvmem/microchip-otpc.c +++ b/drivers/nvmem/microchip-otpc.c @@ -8,6 +8,7 @@ */ #include +#include #include #include #include @@ -248,29 +249,38 @@ static int mchp_otpc_probe(struct platform_device *pdev) int ret; otpc = devm_kzalloc(&pdev->dev, sizeof(*otpc), GFP_KERNEL); - if (!otpc) + if (!otpc) { + dev_err(&pdev->dev, "devm_kzalloc() error\n"); return -ENOMEM; + } otpc->base = devm_platform_ioremap_resource(pdev, 0); - if (IS_ERR(otpc->base)) + if (IS_ERR(otpc->base)) { + dev_err(&pdev->dev, "devm_platform_ioremap_resource() error\n"); return PTR_ERR(otpc->base); + } otpc->dev = &pdev->dev; ret = mchp_otpc_init_packets_list(otpc, &size); - if (ret) + if (ret) { + dev_err(&pdev->dev, "mchp_otpc_init_packets_list() error (%d)\n", ret); return ret; + } mchp_nvmem_config.dev = otpc->dev; mchp_nvmem_config.add_legacy_fixed_of_cells = true; mchp_nvmem_config.size = size; mchp_nvmem_config.priv = otpc; nvmem = devm_nvmem_register(&pdev->dev, &mchp_nvmem_config); + if (!nvmem) + dev_err(&pdev->dev, "devm_nvmem_register() error\n"); return PTR_ERR_OR_ZERO(nvmem); } static const struct of_device_id __maybe_unused mchp_otpc_ids[] = { { .compatible = "microchip,sama7g5-otpc", }, + { .compatible = "microchip,sam9x60-otpc", }, { }, }; MODULE_DEVICE_TABLE(of, mchp_otpc_ids);