From patchwork Mon Apr 23 12:41:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 10356939 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7E6B9601BE for ; Mon, 23 Apr 2018 12:44:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6D20128AA6 for ; Mon, 23 Apr 2018 12:44:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6094D28AAF; Mon, 23 Apr 2018 12:44:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 415D528AAE for ; Mon, 23 Apr 2018 12:44:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=YAVJJLMINu9ULKX45CTH0FG/bIljoSKbphO22YnymrA=; b=miUzxE0cuHRewuwFXIJqQnW9pn CWSGx3as0Y9ZKpGcnJNK933FyAWP2AF+IypW46utLWlglUIJUycktrIUCVl6U6hSgcNX/gs/GMLCL pS+jdIn3r4Lz1mkhYMxq5OKLsJ5Zz5paOfzIyQ4JRCxdoosIxI8EeB0YtbGwIzyq3l9ntXG7+duj5 vlauMexY9orOdYhJKnI3xIRTgBlXIVbPFkUU7nmJZfIGufKh433yidDMnhJQx6FYUUus35/zpOlFS EuH0R/L0gIMlEPZj/wUPofmzREsImknPd+DuSkLNOn5g9sJWuDn59HseqZTzjUfnBstj+cHi1isCC UTJ3PG9A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fAapT-0007Lw-IN; Mon, 23 Apr 2018 12:44:23 +0000 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fAanI-0006Dg-0E for linux-arm-kernel@lists.infradead.org; Mon, 23 Apr 2018 12:42:14 +0000 Received: by mail-wr0-x242.google.com with SMTP id s18-v6so40842287wrg.9 for ; Mon, 23 Apr 2018 05:41:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=EcqPYNHTIL96uRagP/nyIFajaBILMQX8z2TC4uZBJcY=; b=ZRSaQDOfHmTDweVL7ihV1AvVetTK19UIhXW/KP3EZsL3sVgksV9EPqmy/V+CrvkjLq 0Q3wo3jjQuM0fGsFcMhzjTw0Pnad33/Jv9aZ8U4t9B3P1XNiDHTx8Hf4G2VM0o/DQz91 0cfOcWIRcJG+AglpKsjE8sA6DAxiHtMQHszckk2F1xm5UkwqURNFYFbOmCtuCWw3+V+F JUM57yP2pBZwie9ffe6D9d7CK9Vhiup+eDc+EjOpOJrE67OIZnW+8PI4QgHPUlF/W2N6 UizaaddbTgIfnf72zIcouL8A7rrfs2Tdg4gamxs+OhKeTyKpbJBLzwlF77h5fGIAAySN vgDw== 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; bh=EcqPYNHTIL96uRagP/nyIFajaBILMQX8z2TC4uZBJcY=; b=eklyKc5loW12dcFcf7dkB/eMQUKwzDEacoxIwSvElXZQcwLELn/NOqK8jxS+q7WHj6 1pyGFPww7959J3tzAxvfYJwDOnml54cO4z5XGbbPssEUIqwH6d33TVO6DzzgmG4d6YAk 7R0so+PbYwGkkWPIlYWmmmOVyNyhb29iAyBNnvfRv9P18WFj6767P1ELBt/f7ag5mVlN lWFb9hD/FXwhWqvkIOyaE4WiKdi2i71e/8/+toHl7Y2LYnjvRTAZEudQ7kKq6SIrKeMp 4EZKM9M9nYeY+IkNzzfel1/zBVOrDLeOtQ1O8boZ2SehJiQhqigCynBJGLZntjNo9M0X HylQ== X-Gm-Message-State: ALQs6tC1dG9u0ljUHMwxiJvjZPVR8uPDMET79lgX7javVcBQX+Tc96HX UrJLaUpvh1e+dpuOqxmONYed/A== X-Google-Smtp-Source: AIpwx4/bfb1Ax1H9m3GPO8g+M888wgG2leplcKef1fMwQF342E6a/KlEZn0xzIuh/XE6x8h8M8EBBQ== X-Received: by 10.28.54.141 with SMTP id y13mr9969784wmh.126.1524487316263; Mon, 23 Apr 2018 05:41:56 -0700 (PDT) Received: from boomer.baylibre.local ([90.63.244.31]) by smtp.googlemail.com with ESMTPSA id e202sm8727927wma.43.2018.04.23.05.41.55 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Apr 2018 05:41:55 -0700 (PDT) From: Jerome Brunet To: Srinivas Kandagatla , Carlo Caione , Kevin Hilman Subject: [PATCH v2 3/3] nvmem: meson-efuse: add write support Date: Mon, 23 Apr 2018 14:41:49 +0200 Message-Id: <20180423124149.3077-4-jbrunet@baylibre.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180423124149.3077-1-jbrunet@baylibre.com> References: <20180423124149.3077-1-jbrunet@baylibre.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180423_054208_076300_5D08E2EB X-CRM114-Status: GOOD ( 12.86 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Jerome Brunet MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add write support to the meson-gx efuse driver. Beware, this efuse is one time programmable ! Reviewed-by: Kevin Hilman Signed-off-by: Jerome Brunet --- drivers/nvmem/meson-efuse.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/nvmem/meson-efuse.c b/drivers/nvmem/meson-efuse.c index 4623249dfd87..d769840d1e18 100644 --- a/drivers/nvmem/meson-efuse.c +++ b/drivers/nvmem/meson-efuse.c @@ -28,6 +28,13 @@ static int meson_efuse_read(void *context, unsigned int offset, bytes, 0, 0, 0); } +static int meson_efuse_write(void *context, unsigned int offset, + void *val, size_t bytes) +{ + return meson_sm_call_write((u8 *)val, bytes, SM_EFUSE_WRITE, offset, + bytes, 0, 0, 0); +} + static const struct of_device_id meson_efuse_match[] = { { .compatible = "amlogic,meson-gxbb-efuse", }, { /* sentinel */ }, @@ -52,8 +59,8 @@ static int meson_efuse_probe(struct platform_device *pdev) econfig->name = dev_name(dev); econfig->stride = 1; econfig->word_size = 1; - econfig->read_only = true; econfig->reg_read = meson_efuse_read; + econfig->reg_write = meson_efuse_write; econfig->size = size; nvmem = devm_nvmem_register(&pdev->dev, econfig);