From patchwork Wed Jan 4 16:18:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 89874 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp8560582qgi; Wed, 4 Jan 2017 08:18:47 -0800 (PST) X-Received: by 10.99.108.8 with SMTP id h8mr123489315pgc.93.1483546727112; Wed, 04 Jan 2017 08:18:47 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j68si72843930pfj.291.2017.01.04.08.18.46; Wed, 04 Jan 2017 08:18:47 -0800 (PST) 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=@linaro.org; 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; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S968635AbdADQSd (ORCPT + 25 others); Wed, 4 Jan 2017 11:18:33 -0500 Received: from mail-wm0-f49.google.com ([74.125.82.49]:37023 "EHLO mail-wm0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966003AbdADQSa (ORCPT ); Wed, 4 Jan 2017 11:18:30 -0500 Received: by mail-wm0-f49.google.com with SMTP id t79so460599718wmt.0 for ; Wed, 04 Jan 2017 08:18:29 -0800 (PST) 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=3smoOZXCAH1WyXI1KRjPadz7mbGtMFs4pUHcoWMf+BU=; b=dJnVLvbYym4PpV8TojPEVy80DF4MeA9s4F4ZyVAPQZwkVez9yJzagy+NAXUbYdJlVR /Bmvb8Fo+UrUP2Lz/AwL5mUIq+ZW9DumaamOxejUNZ5MidP64CZhW5CizxbxYkKgRCQY BjvAweS6smnrfiVFYPDwxGiPpRKiGI5f7YCxo= 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=3smoOZXCAH1WyXI1KRjPadz7mbGtMFs4pUHcoWMf+BU=; b=ZRmhaWVZq2mhSUZCZmOM63BUaWhdybPRoJydpdH44kgW5hH5x8S+lj1z2IRfFfGl3m tbPPX6XcjGgtyys769a054wAJGAVtU5h5Bflup40xJHF60GQVJoVTab67gxXNa68ASY3 pCtf8WLj5wRbNe0hfM6R8/mAtsJo3bJNPrqF98BGn4KTHp6KhZPJhW5u39P6Kom/sQOC J195RQl8as3DC/VGCmfI5GPOfo+hS0ZITW0I1sRgA+QRRTGbzqXww8k6b2Zzk7crE0N3 m4/Xmyo6clH/QiaL5J+CxzdJtzGthgLRe3lt7ojthRDSqGRLWH07p2mG5wM0SzEpMEJa VzEA== X-Gm-Message-State: AIkVDXLXU7SWTOIbPi6FhH0JXJPszQGz8PcDCUlTBXXFncQmrt8F+b1jEo0ztzxchVUa2wwl X-Received: by 10.28.230.72 with SMTP id d69mr61291837wmh.119.1483546708739; Wed, 04 Jan 2017 08:18:28 -0800 (PST) Received: from localhost.localdomain (host-2-98-102-117.as13285.net. [2.98.102.117]) by smtp.gmail.com with ESMTPSA id w79sm95641291wmw.0.2017.01.04.08.18.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 04 Jan 2017 08:18:28 -0800 (PST) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: Maxime Ripard , linux-kernel@vger.kernel.org, srinivas.kandagatla@linaro.org, Vivek Gautam Subject: [PATCH 1/3] nvmem: qfprom: Allow single byte accesses for read/write Date: Wed, 4 Jan 2017 16:18:09 +0000 Message-Id: <1483546691-24099-2-git-send-email-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1483546691-24099-1-git-send-email-srinivas.kandagatla@linaro.org> References: <1483546691-24099-1-git-send-email-srinivas.kandagatla@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Vivek Gautam The nvmem core driver supports to read and write single byte. So, allow qfprom to support this feature. This change helps in extracting a required value based on bit-offset and number of bits for the required value in the nvmem cell. Signed-off-by: Vivek Gautam Cc: Srinivas Kandagatla Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/qfprom.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) -- 2.7.4 diff --git a/drivers/nvmem/qfprom.c b/drivers/nvmem/qfprom.c index b5305f0..2bdb6c3 100644 --- a/drivers/nvmem/qfprom.c +++ b/drivers/nvmem/qfprom.c @@ -21,11 +21,11 @@ static int qfprom_reg_read(void *context, unsigned int reg, void *_val, size_t bytes) { void __iomem *base = context; - u32 *val = _val; - int i = 0, words = bytes / 4; + u8 *val = _val; + int i = 0, words = bytes; while (words--) - *val++ = readl(base + reg + (i++ * 4)); + *val++ = readb(base + reg + i++); return 0; } @@ -34,11 +34,11 @@ static int qfprom_reg_write(void *context, unsigned int reg, void *_val, size_t bytes) { void __iomem *base = context; - u32 *val = _val; - int i = 0, words = bytes / 4; + u8 *val = _val; + int i = 0, words = bytes; while (words--) - writel(*val++, base + reg + (i++ * 4)); + writeb(*val++, base + reg + i++); return 0; } @@ -53,7 +53,7 @@ static int qfprom_remove(struct platform_device *pdev) static struct nvmem_config econfig = { .name = "qfprom", .owner = THIS_MODULE, - .stride = 4, + .stride = 1, .word_size = 1, .reg_read = qfprom_reg_read, .reg_write = qfprom_reg_write,