From patchwork Tue Jun 23 13:44:57 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sanchayan X-Patchwork-Id: 6661291 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 1C62DC05AC for ; Tue, 23 Jun 2015 13:50:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1F4A920513 for ; Tue, 23 Jun 2015 13:50:39 +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 2DBF520454 for ; Tue, 23 Jun 2015 13:50:38 +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 1Z7OZF-0002k4-SO; Tue, 23 Jun 2015 13:48:49 +0000 Received: from mail-pd0-x233.google.com ([2607:f8b0:400e:c02::233]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Z7OYm-0002R9-60 for linux-arm-kernel@lists.infradead.org; Tue, 23 Jun 2015 13:48:22 +0000 Received: by pdcu2 with SMTP id u2so7744049pdc.3 for ; Tue, 23 Jun 2015 06:47:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=PnGTmPbXg7vi+WQKVlCtAKLKydNiQkoSkmGBuTQrKAQ=; b=HsFiL/mE9fHm3kNWBr8XBdvB9peqjlu2wU44Q8+3TuIxkNAxOh+/uYI+Sv22uyrGtR 64p0gUy81maO1GHNvDNeBIWs06kXWKIzzRPRK33/dZ9X9CVmf/3UlLJUWh6mTvn7E8EO qrKaQxcfH1BSu7lXnbOj9SonUSgwpwyOvh5/BC7pkFNbEAYQh83q7p6icrZbnqrQ515K kkSJ4csnB0Dmh7BfzvmbyiwLMn2qYAYF4qz8ZPrCJJM4Sgmadc8dV/l2Y9RuiMklTeha xK3quqPQ8JNntavEG1wFPZ+J+4fp33cD8RHydjBsPNhRfuVmIG//VVwO6zYC3b+pjh5d TjRQ== X-Received: by 10.66.159.68 with SMTP id xa4mr60008711pab.105.1435067277293; Tue, 23 Jun 2015 06:47:57 -0700 (PDT) Received: from localhost ([115.115.225.206]) by mx.google.com with ESMTPSA id zf1sm23335123pbc.43.2015.06.23.06.47.54 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Jun 2015 06:47:55 -0700 (PDT) From: Sanchayan Maity To: linux-arm-kernel@lists.infradead.org, srinivas.kandagatla@linaro.org, maxime.ripard@free-electrons.com Subject: [RFC PATCH v6 2/2] nvmem: Add Vybrid OCOTP and OCROM support Date: Tue, 23 Jun 2015 19:14:57 +0530 Message-Id: X-Mailer: git-send-email 2.4.4 In-Reply-To: References: In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150623_064820_323651_CC1D96D2 X-CRM114-Status: GOOD ( 18.41 ) X-Spam-Score: -2.7 (--) Cc: arnd@arndb.de, linux-kernel@vger.kernel.org, stefan@agner.ch, Sanchayan Maity , kernel@pengutronix.de, shawn.guo@linaro.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=-5.5 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 The patch adds support for the On Chip One Time Programmable Peripheral (OCOTP) and On Chip ROM (OCROM) support. On Vybrid OCOTP contain data like SoC ID, MAC address and OCROM has the revision ID. Signed-off-by: Sanchayan Maity --- drivers/nvmem/Kconfig | 11 +++++++++ drivers/nvmem/Makefile | 2 ++ drivers/nvmem/vf610-ocotp.c | 60 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 73 insertions(+) create mode 100644 drivers/nvmem/vf610-ocotp.c diff --git a/drivers/nvmem/Kconfig b/drivers/nvmem/Kconfig index 17f1a57..557c1e0 100644 --- a/drivers/nvmem/Kconfig +++ b/drivers/nvmem/Kconfig @@ -33,4 +33,15 @@ config NVMEM_SUNXI_SID This driver can also be built as a module. If so, the module will be called eeprom-sunxi-sid. +config NVMEM_VF610_OCOTP + tristate "VF610 SoCs OCOTP support" + depends on SOC_VF610 + select REGMAP_MMIO + help + This is a driver for the 'OCOTP' available on various Vybrid + devices. + + This driver can also be built as a module. If so, the module + will be called nvmem-vf610-ocotp. + endif diff --git a/drivers/nvmem/Makefile b/drivers/nvmem/Makefile index cc46791..a9ed113 100644 --- a/drivers/nvmem/Makefile +++ b/drivers/nvmem/Makefile @@ -11,3 +11,5 @@ obj-$(CONFIG_QCOM_QFPROM) += nvmem_qfprom.o nvmem_qfprom-y := qfprom.o obj-$(CONFIG_NVMEM_SUNXI_SID) += nvmem-sunxi-sid.o nvmem-sunxi-sid-y := sunxi-sid.o +obj-$(CONFIG_NVMEM_VF610_OCOTP) += nvmem-vf610-ocotp.o +nvmem-vf610-ocotp-y := vf610-ocotp.o diff --git a/drivers/nvmem/vf610-ocotp.c b/drivers/nvmem/vf610-ocotp.c new file mode 100644 index 0000000..d98772d --- /dev/null +++ b/drivers/nvmem/vf610-ocotp.c @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2015 Sanchayan Maity + * + * 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 regmap_config = { + .reg_bits = 32, + .val_bits = 32, + .reg_stride = 4, +}; + +static struct nvmem_config ocotp_config = { + .name = "soc_id", +}; + +static struct nvmem_config rom_config = { + .name = "rom_rev", +}; + +static struct nvmem_mmio_data ocotp_data = { + .nvmem_config = &ocotp_config, + .regmap_config = ®map_config, +}; + +static struct nvmem_mmio_data rom_data = { + .nvmem_config = &rom_config, + .regmap_config = ®map_config, +}; + +static const struct of_device_id ocotp_of_match[] = { + { .compatible = "fsl,vf610-ocotp", .data = &ocotp_data}, + { .compatible = "fsl,vf610-ocrom", .data = &rom_data}, + {/* sentinel */}, +}; +MODULE_DEVICE_TABLE(of, ocotp_of_match); + +static struct platform_driver vf610_ocotp_driver = { + .probe = nvmem_mmio_probe, + .remove = nvmem_mmio_remove, + .driver = { + .name = "vf610-nvmem", + .of_match_table = ocotp_of_match, + }, +}; +module_platform_driver(vf610_ocotp_driver); +MODULE_AUTHOR("Sanchayan Maity "); +MODULE_DESCRIPTION("Vybrid NVMEM driver"); +MODULE_LICENSE("GPL v2");