Changes in 4.9.227 scsi: scsi_devinfo: fixup string compare usb: gadget: f_uac2: fix error handling in afunc_bind (again) esp6: fix memleak on error path in esp6_input spi: dw: use "smp_mb()" to avoid sending spi data error s390/ftrace: save traced function caller ARC: Fix ICCM & DCCM runtime size checks x86/mmiotrace: Use cpumask_available() for cpumask_var_t variables net: bmac: Fix read of MAC address from ROM net/ethernet/freescale: rework quiesce/activate for ucc_geth net: ethernet: stmmac: Enable interface clocks on probe for IPQ806x net: smsc911x: Fix runtime PM imbalance on error pppoe: only process PADT targeted at local interfaces mm: Fix mremap not considering huge pmd devmap HID: i2c-hid: add Schneider SCL142ALM to descriptor override p54usb: add AirVasT USB stick device-id kernel/relay.c: handle alloc_percpu returning NULL in relay_open mmc: fix compilation of user API slcan: Fix double-free on slcan_open() error path slip: not call free_netdev before rtnl_unlock in slip_open scsi: ufs: Release clock if DMA map fails airo: Fix read overflows sending packets devinet: fix memleak in inetdev_init() l2tp: do not use inet_hash()/inet_unhash() net: usb: qmi_wwan: add Telit LE910C1-EUX composition NFC: st21nfca: add missed kfree_skb() in an error path vsock: fix timeout in vsock_accept() l2tp: add sk_family checks to l2tp_validate_socket USB: serial: qcserial: add DW5816e QDL support USB: serial: usb_wwan: do not resubmit rx urb on fatal errors USB: serial: option: add Telit LE910C1-EUX compositions usb: musb: Fix runtime PM imbalance on error vt: keyboard: avoid signed integer overflow in k_ascii tty: hvc_console, fix crashes on parallel open/close staging: rtl8712: Fix IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK nvmem: qfprom: remove incorrect write support x86/cpu: Add a steppings field to struct x86_cpu_id x86/cpu: Add 'table' argument to cpu_matches() x86/speculation: Add Special Register Buffer Data Sampling (SRBDS) mitigation x86/speculation: Add SRBDS vulnerability and mitigation documentation x86/speculation: Add Ivy Bridge to affected list iio: vcnl4000: Fix i2c swapped word reading. uprobes: ensure that uprobe->offset and ->ref_ctr_offset are properly aligned Linux 4.9.227 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com> Change-Id: Ie391f1bd1785679263f1e375f0530e45459b58ed
91 lines
2.2 KiB
C
91 lines
2.2 KiB
C
/*
|
|
* Copyright (C) 2015 Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
|
|
*
|
|
* 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 <linux/device.h>
|
|
#include <linux/module.h>
|
|
#include <linux/io.h>
|
|
#include <linux/nvmem-provider.h>
|
|
#include <linux/platform_device.h>
|
|
|
|
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;
|
|
|
|
while (words--)
|
|
*val++ = readl(base + reg + (i++ * 4));
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int qfprom_remove(struct platform_device *pdev)
|
|
{
|
|
struct nvmem_device *nvmem = platform_get_drvdata(pdev);
|
|
|
|
return nvmem_unregister(nvmem);
|
|
}
|
|
|
|
static struct nvmem_config econfig = {
|
|
.name = "qfprom",
|
|
.owner = THIS_MODULE,
|
|
.stride = 4,
|
|
.word_size = 1,
|
|
.reg_read = qfprom_reg_read,
|
|
};
|
|
|
|
static int qfprom_probe(struct platform_device *pdev)
|
|
{
|
|
struct device *dev = &pdev->dev;
|
|
struct resource *res;
|
|
struct nvmem_device *nvmem;
|
|
void __iomem *base;
|
|
|
|
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
|
base = devm_ioremap_resource(dev, res);
|
|
if (IS_ERR(base))
|
|
return PTR_ERR(base);
|
|
|
|
econfig.size = resource_size(res);
|
|
econfig.dev = dev;
|
|
econfig.priv = base;
|
|
|
|
nvmem = nvmem_register(&econfig);
|
|
if (IS_ERR(nvmem))
|
|
return PTR_ERR(nvmem);
|
|
|
|
platform_set_drvdata(pdev, nvmem);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static const struct of_device_id qfprom_of_match[] = {
|
|
{ .compatible = "qcom,qfprom",},
|
|
{/* sentinel */},
|
|
};
|
|
MODULE_DEVICE_TABLE(of, qfprom_of_match);
|
|
|
|
static struct platform_driver qfprom_driver = {
|
|
.probe = qfprom_probe,
|
|
.remove = qfprom_remove,
|
|
.driver = {
|
|
.name = "qcom,qfprom",
|
|
.of_match_table = qfprom_of_match,
|
|
},
|
|
};
|
|
module_platform_driver(qfprom_driver);
|
|
MODULE_AUTHOR("Srinivas Kandagatla <srinivas.kandagatla@linaro.org>");
|
|
MODULE_DESCRIPTION("Qualcomm QFPROM driver");
|
|
MODULE_LICENSE("GPL v2");
|