From patchwork Mon Mar 30 21:58:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 6125931 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 8B096BF4A6 for ; Mon, 30 Mar 2015 22:07:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9FB36203B0 for ; Mon, 30 Mar 2015 22:07:31 +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 B135B2043C for ; Mon, 30 Mar 2015 22:07:30 +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 1Ychmx-0004BY-23; Mon, 30 Mar 2015 22:04:07 +0000 Received: from casper.infradead.org ([2001:770:15f::2]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Ychhu-0000aQ-93 for linux-arm-kernel@bombadil.infradead.org; Mon, 30 Mar 2015 21:58:54 +0000 Received: from mail-wg0-f50.google.com ([74.125.82.50]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Ychhq-0001VO-Df for linux-arm-kernel@lists.infradead.org; Mon, 30 Mar 2015 21:58:51 +0000 Received: by wgra20 with SMTP id a20so189254902wgr.3 for ; Mon, 30 Mar 2015 14:58:27 -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=rAGHbGoqYedrwwLKM16J02V+n1HRAVM5b0vvvN/dZms=; b=iJOKYMDUrphCAB5Sy90vuK7ah5vZfJh+sf9HbyKfPhGYXQF/gijFYHdwGoJPQfRfzr M89Rj6HZJGQOieP5nhPhXD2vTOVH9fs67qHQo0tZPU2rnVoIKO00YnlwoPXZhN5amF51 rfVnLE5cu9t8vCIZNhZt2MBvJ3cpo+MgqEweiVhr9HBT0LCkjt6U4ZZmXJrDTRvMH5om E+wGeMwI16ak29S1VawB/S7akFNa5dMGFnrLJfWHG5+XvBRlXFbz6MlLMgA9I2YpWHOJ XTt7v34ZkZXzKhkeZIUzCfnvdbPueMydDFLEolyaMIItdL1O/dpRVsfzNqHAhjIIMuCj zx8A== X-Gm-Message-State: ALoCoQkK3Vt5zasUbwrGMEDY5o+2F3IvQ5H8H8h7k2Tlrj6BIKHqP0fGQ28ivjCqdAk0TJ+9m7aT X-Received: by 10.180.208.107 with SMTP id md11mr27040584wic.10.1427752707022; Mon, 30 Mar 2015 14:58:27 -0700 (PDT) Received: from srini-ThinkPad-X1-Carbon-2nd.dlink.com (host-78-145-247-151.as13285.net. [78.145.247.151]) by mx.google.com with ESMTPSA id hq4sm12296723wib.0.2015.03.30.14.58.24 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 30 Mar 2015 14:58:25 -0700 (PDT) From: Srinivas Kandagatla To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v4 07/10] eeprom: qfprom: Add Qualcomm QFPROM support. Date: Mon, 30 Mar 2015 22:58:22 +0100 Message-Id: <1427752702-17345-1-git-send-email-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1427752492-17039-1-git-send-email-srinivas.kandagatla@linaro.org> References: <1427752492-17039-1-git-send-email-srinivas.kandagatla@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150330_225850_469835_8B3668FF X-CRM114-Status: GOOD ( 16.31 ) X-Spam-Score: -2.6 (--) Cc: devicetree@vger.kernel.org, arnd@arndb.de, Greg Kroah-Hartman , s.hauer@pengutronix.de, sboyd@codeaurora.org, linux-kernel@vger.kernel.org, Rob Herring , Srinivas Kandagatla , Mark Brown , Kumar Gala , 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/eeprom/Kconfig | 15 +++++++++++++++ drivers/eeprom/Makefile | 4 ++++ drivers/eeprom/qfprom.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 70 insertions(+) create mode 100644 drivers/eeprom/qfprom.c diff --git a/drivers/eeprom/Kconfig b/drivers/eeprom/Kconfig index 15985e1..8fcde9b 100644 --- a/drivers/eeprom/Kconfig +++ b/drivers/eeprom/Kconfig @@ -8,3 +8,18 @@ menuconfig EEPROM from both the Linux Kernel and the userspace. If unsure, say no. + +if EEPROM + +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 eeprom interface. + + This driver can also be built as a module. If so, the module + will be called eeprom-qfprom. + +endif diff --git a/drivers/eeprom/Makefile b/drivers/eeprom/Makefile index 6812bbe..819476c 100644 --- a/drivers/eeprom/Makefile +++ b/drivers/eeprom/Makefile @@ -5,3 +5,7 @@ obj-$(CONFIG_EEPROM) += eeprom_core.o eeprom_core-y := core.o eeprom_core-y += eeprom-mmio.o + +# Devices +obj-$(CONFIG_QCOM_QFPROM) += eeprom_qfprom.o +eeprom_qfprom-y := qfprom.o diff --git a/drivers/eeprom/qfprom.c b/drivers/eeprom/qfprom.c new file mode 100644 index 0000000..011bdf1 --- /dev/null +++ b/drivers/eeprom/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 "eeprom-mmio.h" + +static struct regmap_config qfprom_regmap_config = { + .reg_bits = 32, + .val_bits = 8, + .reg_stride = 1, +}; + +static struct eeprom_config econfig = { + .name = "qfprom", + .owner = THIS_MODULE, +}; + +static struct eeprom_mmio_data qfprom_data = { + .eeprom_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 = eeprom_mmio_probe, + .remove = eeprom_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");