From patchwork Fri Mar 16 15:01:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 131927 Delivered-To: patch@linaro.org Received: by 10.80.152.129 with SMTP id j1csp435504edb; Fri, 16 Mar 2018 08:01:30 -0700 (PDT) X-Google-Smtp-Source: AG47ELtDWlJKcffBuH8elKSm37I+ucilZZtePhS/MbuycVVXWsjPQB3YA4PGpMafPL0aaqCoBMqP X-Received: by 10.99.104.73 with SMTP id d70mr1696914pgc.107.1521212490234; Fri, 16 Mar 2018 08:01:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521212490; cv=none; d=google.com; s=arc-20160816; b=C6FBXuafN8Yr7LgW/H3PizKmFDyy78WCq3bXu7FRheWST2S3uEtqWYMq5/L573M9ZV 5YOqCXY3H8KW+tJxHstdlbf90C4HoCtXnVVMQbH8W/QjTgpXvEIwBZuNTBPdQe8tQFZK f1hUFNO84p93abvVR7u0DfCiWTOwnMB6fGkWraXL4J8tAQAXkXscNhtFZeLlHbF+hqxb wHO94VbrDaYwYiZzvoR+CUKXYOV42gmqZkpNuAiqDyH6tvbpweGQhzpS6c2zLhyuprPA uHF09ZnyUU84E3uILItwwlH+x745YxiXzx+n2UEyLCsCUPVMjMVxDYEOa3dhXsEs0OtD u4uQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=vNwlihSnHPgl1SOEaLLr2ih07fIp09PzebzXB0kOCI0=; b=eij9RInpypp7GeBOQzWusL/sRxe9h7Hd7+xe1psSnjkUyZyO4iwGYIvSzRkMf2gHC1 HqVYxgEy6N1PBTueasItX32q8qs9Q2bVeJnuxJ08j9ecEnuoJbIT3p74CBjszedQtrQR +1Ow0jJeMs8D0T5sqL4vDI1e4hp931wqEAXzvwrelpLib53GlGaG1b/1xEr7JrqZ25wX +3+1ro7o6DgjzIc3rVTe0bDHnidbPhK+N+8ktRtU1Zvs6gf6ZQKXa4lTfkxQkDERfjVL 2jmQMEFmCSNRbiMHpyPq/0AhBr7fVxf/Q1LASP3b42OQ9akx1Uq9OtgzoqMMJdvZTJG7 IQ/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=t7Aktx85; 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 t3si835643pgs.763.2018.03.16.08.01.28; Fri, 16 Mar 2018 08:01:29 -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; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=t7Aktx85; 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 S1753247AbeCPPBY (ORCPT + 28 others); Fri, 16 Mar 2018 11:01:24 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:36009 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752942AbeCPPBT (ORCPT ); Fri, 16 Mar 2018 11:01:19 -0400 Received: by mail-wr0-f194.google.com with SMTP id d10so12055972wrf.3 for ; Fri, 16 Mar 2018 08:01:19 -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=vNwlihSnHPgl1SOEaLLr2ih07fIp09PzebzXB0kOCI0=; b=t7Aktx85gKFV+I+A7r15Lb//joTwdLcgDz7vg85eTGI7WVEh3hPHoCjA1Z8F9Kvifx 0xft5CJvv0YFxDaYbB6kjXGcLSSHVDxwfJ/v3S0KJPDh0bUJ9DMoI47zfGceLmpy0x7K BN+w4x1XkOB1d6NgoRsR9PP+oQE4UykG7Fdj/k8QJqAxswdg2eRh/FM7eS5m89nutaIX MkEHtDPhNuYSJdAak6aYkDMjO2KrthTjaeULuLUMDh4rjE/bGUvwxirRLFI1+NyVP1nn SUMF1xkD7n37E1xIQrqV17HZDcyGxKa+wBHVs/JSAdsrpWplXWAVv2RyZW/hcXjBpQWa m4Bw== 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=vNwlihSnHPgl1SOEaLLr2ih07fIp09PzebzXB0kOCI0=; b=MbolmY9l1NoD4wMBPNbjPjU4stS1IUOWq3pTCY4cxXPglFl3A9I/4XIKLu2PCoe8jg i0908HEyZ04ZCLhU6pfie1r3ar7tSgLo3/RmB9czUFN6zYbx1L8YiI7Rv7BcNtlczWdg NJtJOcrM1sH0yiTuNldTTcpOeS3zx+t5KesWUpzwE+LrX19CO0DOvukPu934x1Oxm2hs 79odourukgAaY3CgmS5e8K2pyQXG0W1R0tTkv+OjUX9Ncn/B2grpesvuzunFFzGxpmVN MhttPkftZtJnc35XG5HpjRfn6zvDyZr1QN1zsTx6Z/UvGVpTsMVMrzYwsb3i45ALe5eG Ktag== X-Gm-Message-State: AElRT7EDminXj+yhyGcAlEQGmsabaggwyOixlmeWxegjAZAzhxNOVwDn N5hO4liLULig/o+PWc+krRiNIg== X-Received: by 10.223.136.78 with SMTP id e14mr1852924wre.80.1521212478857; Fri, 16 Mar 2018 08:01:18 -0700 (PDT) Received: from boomer.baylibre.local ([90.63.244.31]) by smtp.googlemail.com with ESMTPSA id f84sm2348834wmh.44.2018.03.16.08.01.17 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 16 Mar 2018 08:01:18 -0700 (PDT) From: Jerome Brunet To: Srinivas Kandagatla , Carlo Caione , Kevin Hilman Cc: Jerome Brunet , linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] nvmem: meson-efuse: add write support Date: Fri, 16 Mar 2018 16:01:13 +0100 Message-Id: <20180316150113.9779-3-jbrunet@baylibre.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180316150113.9779-1-jbrunet@baylibre.com> References: <20180316150113.9779-1-jbrunet@baylibre.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add write support to the meson-gx efuse driver. Beware, this efuse is one time programmable ! Signed-off-by: Jerome Brunet --- drivers/nvmem/meson-efuse.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) -- 2.14.3 diff --git a/drivers/nvmem/meson-efuse.c b/drivers/nvmem/meson-efuse.c index 7ad80b80b293..30da5e1abf84 100644 --- a/drivers/nvmem/meson-efuse.c +++ b/drivers/nvmem/meson-efuse.c @@ -35,6 +35,20 @@ static int meson_efuse_read(void *context, unsigned int offset, return 0; } +static int meson_efuse_write(void *context, unsigned int offset, + void *val, size_t bytes) +{ + u8 *buf = val; + int ret; + + ret = meson_sm_call_write(buf, bytes, SM_EFUSE_WRITE, offset, + bytes, 0, 0, 0); + if (ret < 0) + return ret; + + return 0; +} + static const struct of_device_id meson_efuse_match[] = { { .compatible = "amlogic,meson-gxbb-efuse", }, { /* sentinel */ }, @@ -59,8 +73,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 = nvmem_register(econfig);