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: 46559 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A3B15218BE for ; Mon, 30 Mar 2015 21:58:40 +0000 (UTC) Received: by lahp7 with SMTP id p7sf24510406lah.0 for ; Mon, 30 Mar 2015 14:58:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=W1dxB7X+14uc/PN/bKo3G+oiMxUWuuRjWrtLCkuprcU=; b=NgXCV8swsEsdOKCn2JxGuJLAEryXkClNtto1czYsNmvYipM83DejY0bEP1SWrrukzk nxmAwXUtlmiG4fh69vvPXgELLvVbZgtCpx4kwPdhHDX91/DbIS3WuSykIDd1IgO8IX07 3lmE4R5KRD5GMilh0UCt9DQHysyvMYak35c5WXztIU/88khl7s6+UD4c9yna+kZyctsn TBzr9eZQbQWISW/XTqwRtvihRC3AXbN6jLIdavjX+bhmk6+hRA3D+1Lz+/yINIvL4JRY wTsXykACTkL662mmTuoR+ESVM+uFvHnKnHt/V6QkpQOmxl4tJaBscWdgCbyNwCbrJHIx AYNg== X-Gm-Message-State: ALoCoQn4GW5pUwvkZfCERwCtOkI4vZEwAyh69k809OyMgc0UMdyt9HhdXQc2BwEkozXLssqEiuwK X-Received: by 10.180.90.175 with SMTP id bx15mr4125779wib.3.1427752719444; Mon, 30 Mar 2015 14:58:39 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.243.37 with SMTP id wv5ls634030lac.60.gmail; Mon, 30 Mar 2015 14:58:39 -0700 (PDT) X-Received: by 10.152.203.134 with SMTP id kq6mr28364448lac.110.1427752719154; Mon, 30 Mar 2015 14:58:39 -0700 (PDT) Received: from mail-lb0-f173.google.com (mail-lb0-f173.google.com. [209.85.217.173]) by mx.google.com with ESMTPS id c4si7863390lah.173.2015.03.30.14.58.39 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Mar 2015 14:58:39 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.173 as permitted sender) client-ip=209.85.217.173; Received: by lbcmq2 with SMTP id mq2so104928466lbc.0 for ; Mon, 30 Mar 2015 14:58:39 -0700 (PDT) X-Received: by 10.112.185.66 with SMTP id fa2mr27863110lbc.117.1427752718765; Mon, 30 Mar 2015 14:58:38 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.57.201 with SMTP id k9csp1410442lbq; Mon, 30 Mar 2015 14:58:38 -0700 (PDT) X-Received: by 10.70.54.103 with SMTP id i7mr62544073pdp.114.1427752716746; Mon, 30 Mar 2015 14:58:36 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id px4si16521977pdb.4.2015.03.30.14.58.35; Mon, 30 Mar 2015 14:58:36 -0700 (PDT) Received-SPF: none (google.com: linux-arm-msm-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753865AbbC3V6b (ORCPT + 5 others); Mon, 30 Mar 2015 17:58:31 -0400 Received: from mail-wg0-f41.google.com ([74.125.82.41]:35103 "EHLO mail-wg0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753850AbbC3V62 (ORCPT ); Mon, 30 Mar 2015 17:58:28 -0400 Received: by wgdm6 with SMTP id m6so190169833wgd.2 for ; Mon, 30 Mar 2015 14:58:27 -0700 (PDT) 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 Cc: Maxime Ripard , Rob Herring , Kumar Gala , Mark Brown , s.hauer@pengutronix.de, Greg Kroah-Hartman , linux-api@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, arnd@arndb.de, sboyd@codeaurora.org, Srinivas Kandagatla 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> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: srinivas.kandagatla@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.173 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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");