From patchwork Sun Apr 24 19:28:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 66542 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp696867qge; Sun, 24 Apr 2016 12:30:46 -0700 (PDT) X-Received: by 10.66.122.100 with SMTP id lr4mr41919346pab.99.1461526246577; Sun, 24 Apr 2016 12:30:46 -0700 (PDT) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id y134si1668943pfb.59.2016.04.24.12.30.46 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 24 Apr 2016 12:30:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1auPj2-0005Yg-9T; Sun, 24 Apr 2016 19:29:48 +0000 Received: from merlin.infradead.org ([2001:4978:20e::2]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1auPiL-00054S-43 for linux-arm-kernel@bombadil.infradead.org; Sun, 24 Apr 2016 19:29:05 +0000 Received: from mail-wm0-x233.google.com ([2a00:1450:400c:c09::233]) by merlin.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1auPiI-00089H-Sg for linux-arm-kernel@lists.infradead.org; Sun, 24 Apr 2016 19:29:04 +0000 Received: by mail-wm0-x233.google.com with SMTP id u206so97598927wme.1 for ; Sun, 24 Apr 2016 12:28:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=STAxlbLy1490vz0NWSq0SpV+Ex+88xNT29bN7sUyMXI=; b=AoXucvtMbPIDaNwIgqqcGBI+hkyLwjlrrYPBxVXbBS9MMVrXnWwaHE8cKf3c/cewpf +sNSXnZ3qYE1sDcXLSVP18rpcCKkAZzf10aVvGuTrSFLsshTqfjLGvniMp3ztdPX3VSa jGzkQh/EIpFVgv+mNhDoxLrkmwhhtDXXiz7Kw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=STAxlbLy1490vz0NWSq0SpV+Ex+88xNT29bN7sUyMXI=; b=eychViDluK7zEmEkUzx9o0vmCfmnL/hFYXhlBeYJPGWIFgBbv+VNsFPrB4NsbO4GEO Dm4sI3YQxekziqi5KYZw8Hm22VKKOQFQHLwRfEhO3Y02sBPNKjRDh9rDMEw1Okm1c4zr v3qm8wkOh4VeVFmeDQ80PoJuiNPu3XPzJGe2b9+jOra7DQnHiEZgP5aaR6IUWKITm9EE SQIfcz8gANP6iFlqtOQ4IKaOTHVhf64TdaSzuPs24zVeMd+jLYnvCfKz9qxRynVyMZZ9 FEoVNC54EhrVA0bvRgJyeM1CYLY8T+09pl2NEHWnxaJrvOwuFboQbCEmXRWirX5CbU3H NVhA== X-Gm-Message-State: AOPr4FUxKYSo0L5oCUB3Xq8CS8urd6A6hilKhWHgRPvILQlR18tCntM02bcKBGhXc2WjYmUV X-Received: by 10.28.170.194 with SMTP id t185mr8322476wme.91.1461526119251; Sun, 24 Apr 2016 12:28:39 -0700 (PDT) Received: from localhost.localdomain (host-92-17-247-99.as13285.net. [92.17.247.99]) by smtp.gmail.com with ESMTPSA id q127sm15007708wmd.13.2016.04.24.12.28.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 24 Apr 2016 12:28:38 -0700 (PDT) From: Srinivas Kandagatla To: Greg Kroah-Hartman Subject: [PATCH 05/12] nvmem: vif610-ocotp: remove nvmem regmap dependency Date: Sun, 24 Apr 2016 20:28:09 +0100 Message-Id: <1461526096-29584-6-git-send-email-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1461526096-29584-1-git-send-email-srinivas.kandagatla@linaro.org> References: <1461526096-29584-1-git-send-email-srinivas.kandagatla@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160424_152903_179582_85AD2D61 X-CRM114-Status: GOOD ( 17.46 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.4.1 on merlin.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2a00:1450:400c:c09:0:0:0:233 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: andrew@lunn.ch, Heiko Stuebner , Wolfram Sang , Joachim Eastwood , linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, Chen-Yu Tsai , Mark Brown , Srinivas Kandagatla , linux-i2c@vger.kernel.org, Matthias Brugger , linux-mediatek@lists.infradead.org, Maxime Ripard , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org This patch moves to nvmem support in the driver to use callback instead of regmap. Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/vf610-ocotp.c | 44 ++++++++++---------------------------------- 1 file changed, 10 insertions(+), 34 deletions(-) -- 2.5.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel diff --git a/drivers/nvmem/vf610-ocotp.c b/drivers/nvmem/vf610-ocotp.c index 8641319..72e4faa 100644 --- a/drivers/nvmem/vf610-ocotp.c +++ b/drivers/nvmem/vf610-ocotp.c @@ -25,7 +25,6 @@ #include #include #include -#include #include /* OCOTP Register Offsets */ @@ -152,23 +151,16 @@ static int vf610_get_fuse_address(int base_addr_offset) return -EINVAL; } -static int vf610_ocotp_write(void *context, const void *data, size_t count) -{ - return 0; -} - -static int vf610_ocotp_read(void *context, - const void *off, size_t reg_size, - void *val, size_t val_size) +static int vf610_ocotp_read(void *context, unsigned int offset, + void *val, size_t bytes) { struct vf610_ocotp *ocotp = context; void __iomem *base = ocotp->base; - unsigned int offset = *(u32 *)off; u32 reg, *buf = val; int fuse_addr; int ret; - while (val_size > 0) { + while (bytes > 0) { fuse_addr = vf610_get_fuse_address(offset); if (fuse_addr > 0) { writel(ocotp->timing, base + OCOTP_TIMING); @@ -205,29 +197,19 @@ static int vf610_ocotp_read(void *context, } buf++; - val_size--; - offset += reg_size; + bytes -= 4; + offset += 4; } return 0; } -static struct regmap_bus vf610_ocotp_bus = { - .read = vf610_ocotp_read, - .write = vf610_ocotp_write, - .reg_format_endian_default = REGMAP_ENDIAN_NATIVE, - .val_format_endian_default = REGMAP_ENDIAN_NATIVE, -}; - -static struct regmap_config ocotp_regmap_config = { - .reg_bits = 32, - .val_bits = 32, - .reg_stride = 4, -}; - static struct nvmem_config ocotp_config = { .name = "ocotp", .owner = THIS_MODULE, + .stride = 4, + .word_size = 4, + .reg_read = vf610_ocotp_read, }; static const struct of_device_id ocotp_of_match[] = { @@ -247,7 +229,6 @@ static int vf610_ocotp_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct resource *res; - struct regmap *regmap; struct vf610_ocotp *ocotp_dev; ocotp_dev = devm_kzalloc(&pdev->dev, @@ -267,13 +248,8 @@ static int vf610_ocotp_probe(struct platform_device *pdev) return PTR_ERR(ocotp_dev->clk); } - ocotp_regmap_config.max_register = resource_size(res); - regmap = devm_regmap_init(dev, - &vf610_ocotp_bus, ocotp_dev, &ocotp_regmap_config); - if (IS_ERR(regmap)) { - dev_err(dev, "regmap init failed\n"); - return PTR_ERR(regmap); - } + ocotp_config.size = resource_size(res); + ocotp_config.priv = ocotp_dev; ocotp_config.dev = dev; ocotp_dev->nvmem = nvmem_register(&ocotp_config);