From patchwork Thu May 21 16:44:35 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 6457721 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 46A9FC0020 for ; Thu, 21 May 2015 16:49:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5C91720494 for ; Thu, 21 May 2015 16:49:02 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 70A2F20220 for ; Thu, 21 May 2015 16:49:01 +0000 (UTC) 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 1YvTcJ-0005zG-Fo; Thu, 21 May 2015 16:46:43 +0000 Received: from mail-wg0-f47.google.com ([74.125.82.47]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YvTae-0003bk-GK for linux-arm-kernel@lists.infradead.org; Thu, 21 May 2015 16:45:01 +0000 Received: by wgez8 with SMTP id z8so1672073wge.0 for ; Thu, 21 May 2015 09:44:41 -0700 (PDT) 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=hc/Ai2Y6Tgr98fSkkROC41mIeQv5ol5+fmp8RMXniQw=; b=GCR7Q6n/P5o+5ZqFfRnsr6xDzPib8WIGhOEkerzCNhBOmKwqF+YDj+ExrBZvrR7AFc 8AfHhJ4eSEJXWoWEtha19If0JHHMXXo6Wlzbkm/E62UnlixHMQXr37LLtvo0/tJGaVFm +ez+muPyWPhf+2Hm0tEzFwpc4C/cmXlXl54+DAFDDG3pzTYcMZrdmS1AyrmcwHC60AaQ YqiBpNmM1jQNOxwUTdieO6tKQ8HYv4HiD4KksPmK7N4JZqqOP9k5OP9BJkQhhlDczt1e DEcuK+61/5I7/PwYUJMAps3QytnkEpugAh3u/vgQ/Fs8Uwo4853HF6e9EkiDGtr8oLXc 8WdQ== X-Gm-Message-State: ALoCoQnNjk8aFM5Hrc4+T/WyF4xx43WIeYlRvXMmzSrZReZ+Yk9XwKhfPFWF8nXeA6h6aB5+TS9A X-Received: by 10.180.208.84 with SMTP id mc20mr8183876wic.38.1432226680808; Thu, 21 May 2015 09:44:40 -0700 (PDT) Received: from srini-ThinkPad-X1-Carbon-2nd.dlink.com (host-2-96-95-164.as13285.net. [2.96.95.164]) by mx.google.com with ESMTPSA id b10sm3698172wic.1.2015.05.21.09.44.38 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 21 May 2015 09:44:40 -0700 (PDT) From: Srinivas Kandagatla To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v5 08/11] nvmem: qfprom: Add Qualcomm QFPROM support. Date: Thu, 21 May 2015 17:44:35 +0100 Message-Id: <1432226675-9039-1-git-send-email-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1432226535-8640-1-git-send-email-srinivas.kandagatla@linaro.org> References: <1432226535-8640-1-git-send-email-srinivas.kandagatla@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150521_094500_737213_75804478 X-CRM114-Status: GOOD ( 14.36 ) X-Spam-Score: -0.7 (/) Cc: devicetree@vger.kernel.org, arnd@arndb.de, Greg Kroah-Hartman , s.hauer@pengutronix.de, sboyd@codeaurora.org, linux-kernel@vger.kernel.org, pantelis.antoniou@konsulko.com, Rob Herring , Srinivas Kandagatla , Mark Brown , Kumar Gala , mporter@konsulko.com, Maxime Ripard , linux-api@vger.kernel.org, linux-arm-msm@vger.kernel.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds QFPROM support driver which is used by other drivers like thermal sensor and cpufreq. On MSM parts there are some efuses (called qfprom) these fuses store things like calibration data, speed bins.. etc. Drivers like cpufreq, thermal sensors would read out this data for configuring the driver. Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/Kconfig | 15 +++++++++++++++ drivers/nvmem/Makefile | 4 ++++ drivers/nvmem/qfprom.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 70 insertions(+) create mode 100644 drivers/nvmem/qfprom.c diff --git a/drivers/nvmem/Kconfig b/drivers/nvmem/Kconfig index f157b6d..e665e23 100644 --- a/drivers/nvmem/Kconfig +++ b/drivers/nvmem/Kconfig @@ -8,3 +8,18 @@ menuconfig NVMEM from both the Linux Kernel and the userspace. If unsure, say no. + +if NVMEM + +config QCOM_QFPROM + tristate "QCOM QFPROM Support" + depends on ARCH_QCOM + select REGMAP_MMIO + help + Say y here to enable QFPROM support. The QFPROM provides access + functions for QFPROM data to rest of the drivers via nvmem interface. + + This driver can also be built as a module. If so, the module + will be called nvmem-qfprom. + +endif diff --git a/drivers/nvmem/Makefile b/drivers/nvmem/Makefile index f694cfc..caea611 100644 --- a/drivers/nvmem/Makefile +++ b/drivers/nvmem/Makefile @@ -5,3 +5,7 @@ obj-$(CONFIG_NVMEM) += nvmem_core.o nvmem_core-y := core.o nvmem_core-y += nvmem-mmio.o + +# Devices +obj-$(CONFIG_QCOM_QFPROM) += nvmem_qfprom.o +nvmem_qfprom-y := qfprom.o diff --git a/drivers/nvmem/qfprom.c b/drivers/nvmem/qfprom.c new file mode 100644 index 0000000..5ea84bb --- /dev/null +++ b/drivers/nvmem/qfprom.c @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2015 Srinivas Kandagatla + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include "nvmem-mmio.h" + +static struct regmap_config qfprom_regmap_config = { + .reg_bits = 32, + .val_bits = 8, + .reg_stride = 1, +}; + +static struct nvmem_config econfig = { + .name = "qfprom", + .owner = THIS_MODULE, +}; + +static struct nvmem_mmio_data qfprom_data = { + .nvmem_config = &econfig, + .regmap_config = &qfprom_regmap_config, +}; + +static const struct of_device_id qfprom_of_match[] = { + { .compatible = "qcom,qfprom", .data = &qfprom_data}, + {/* sentinel */}, +}; +MODULE_DEVICE_TABLE(of, qfprom_of_match); + +static struct platform_driver qfprom_driver = { + .probe = nvmem_mmio_probe, + .remove = nvmem_mmio_remove, + .driver = { + .name = "qcom,qfprom", + .of_match_table = qfprom_of_match, + }, +}; +module_platform_driver(qfprom_driver); +MODULE_AUTHOR("Srinivas Kandagatla "); +MODULE_DESCRIPTION("Qualcomm QFPROM driver"); +MODULE_LICENSE("GPL v2");