Add samsung specific changes
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (C) 2015 Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
|
||||
* Copyright (c) 2021,2024 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/clk.h>
|
||||
@@ -125,6 +126,65 @@ static const struct qfprom_soc_compatible_data sc7280_qfprom = {
|
||||
.nkeepout = ARRAY_SIZE(sc7280_qfprom_keepout)
|
||||
};
|
||||
|
||||
static const struct nvmem_keepout sun_qfprom_keepout[] = {
|
||||
{.start = 0x20, .end = 0x24},
|
||||
{.start = 0x28, .end = 0x30},
|
||||
{.start = 0x34, .end = 0x40},
|
||||
{.start = 0x58, .end = 0x60},
|
||||
{.start = 0x68, .end = 0x70},
|
||||
{.start = 0x78, .end = 0x80},
|
||||
{.start = 0x90, .end = 0x100},
|
||||
{.start = 0x150, .end = 0x200},
|
||||
{.start = 0x238, .end = 0x300},
|
||||
{.start = 0x330, .end = 0x400},
|
||||
{.start = 0x4e8, .end = 0x500},
|
||||
{.start = 0x550, .end = 0x600},
|
||||
{.start = 0x608, .end = 0x610},
|
||||
{.start = 0x618, .end = 0x630},
|
||||
{.start = 0x638, .end = 0x700},
|
||||
{.start = 0x738, .end = 0x73c},
|
||||
{.start = 0x74c, .end = 0x770},
|
||||
{.start = 0x900, .end = 0x948},
|
||||
{.start = 0xbf0, .end = 0xcf0},
|
||||
{.start = 0xd00, .end = 0x1000},
|
||||
};
|
||||
|
||||
static const struct qfprom_soc_compatible_data sun_qfprom = {
|
||||
.keepout = sun_qfprom_keepout,
|
||||
.nkeepout = ARRAY_SIZE(sun_qfprom_keepout)
|
||||
};
|
||||
|
||||
static const struct nvmem_keepout ravelin_qfprom_keepout[] = {
|
||||
{.start = 0x20, .end = 0x24},
|
||||
{.start = 0x28, .end = 0x30},
|
||||
{.start = 0x34, .end = 0x40},
|
||||
{.start = 0x58, .end = 0x60},
|
||||
{.start = 0x68, .end = 0x70},
|
||||
{.start = 0x78, .end = 0x80},
|
||||
{.start = 0x90, .end = 0x100},
|
||||
{.start = 0x138, .end = 0x200},
|
||||
{.start = 0x230, .end = 0x300},
|
||||
{.start = 0x320, .end = 0x400},
|
||||
{.start = 0x460, .end = 0x500},
|
||||
{.start = 0x550, .end = 0x600},
|
||||
{.start = 0x608, .end = 0x610},
|
||||
{.start = 0x618, .end = 0x630},
|
||||
{.start = 0x638, .end = 0x700},
|
||||
{.start = 0x738, .end = 0x73c},
|
||||
{.start = 0x748, .end = 0x770},
|
||||
{.start = 0x7e8, .end = 0x800},
|
||||
{.start = 0x888, .end = 0xa00},
|
||||
{.start = 0xa38, .end = 0xb00},
|
||||
{.start = 0xb08, .end = 0xb10},
|
||||
{.start = 0xb18, .end = 0xd00},
|
||||
{.start = 0xe18, .end = 0x1000}
|
||||
};
|
||||
|
||||
static const struct qfprom_soc_compatible_data ravelin_qfprom = {
|
||||
.keepout = ravelin_qfprom_keepout,
|
||||
.nkeepout = ARRAY_SIZE(ravelin_qfprom_keepout)
|
||||
};
|
||||
|
||||
/**
|
||||
* qfprom_disable_fuse_blowing() - Undo enabling of fuse blowing.
|
||||
* @priv: Our driver data.
|
||||
@@ -322,15 +382,28 @@ static int qfprom_reg_read(void *context,
|
||||
{
|
||||
struct qfprom_priv *priv = context;
|
||||
u8 *val = _val;
|
||||
int i = 0, words = bytes;
|
||||
int buf_start, buf_end, index, i = 0;
|
||||
void __iomem *base = priv->qfpcorrected;
|
||||
char *buffer = NULL;
|
||||
u32 read_val;
|
||||
|
||||
if (read_raw_data && priv->qfpraw)
|
||||
base = priv->qfpraw;
|
||||
buf_start = ALIGN_DOWN(reg, 4);
|
||||
buf_end = ALIGN(reg + bytes, 4);
|
||||
buffer = kzalloc(buf_end - buf_start, GFP_KERNEL);
|
||||
if (!buffer) {
|
||||
pr_err("memory allocation failed in %s\n", __func__);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
while (words--)
|
||||
*val++ = readb(base + reg + i++);
|
||||
for (index = buf_start; index < buf_end; index += 4, i += 4) {
|
||||
read_val = readl_relaxed(base + index);
|
||||
memcpy(buffer + i, &read_val, 4);
|
||||
}
|
||||
|
||||
memcpy(val, buffer + reg % 4, bytes);
|
||||
kfree(buffer);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -447,6 +520,8 @@ static const struct of_device_id qfprom_of_match[] = {
|
||||
{ .compatible = "qcom,qfprom",},
|
||||
{ .compatible = "qcom,sc7180-qfprom", .data = &sc7180_qfprom},
|
||||
{ .compatible = "qcom,sc7280-qfprom", .data = &sc7280_qfprom},
|
||||
{ .compatible = "qcom,sun-qfprom", .data = &sun_qfprom},
|
||||
{ .compatible = "qcom,ravelin-qfprom", .data = &ravelin_qfprom},
|
||||
{/* sentinel */},
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, qfprom_of_match);
|
||||
|
Reference in New Issue
Block a user