Revert "nvmem: qfprom: switch to 4-byte aligned reads"

This reverts commit beb6382add which is
commit 3566a737db87a9bf360c2fd36433c5149f805f2e upstream.

It breaks the Android kernel build and can be brought back in the future
in an safe way if it is really needed.

Bug: 161946584
Change-Id: I64fa85920cf9346d61ec92a6e15df5ea4c44368f
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
Greg Kroah-Hartman
2025-06-05 15:05:04 +00:00
parent 2cb8fe26d3
commit c6d284ab16

View File

@@ -321,32 +321,19 @@ static int qfprom_reg_read(void *context,
unsigned int reg, void *_val, size_t bytes)
{
struct qfprom_priv *priv = context;
u32 *val = _val;
u8 *val = _val;
int i = 0, words = bytes;
void __iomem *base = priv->qfpcorrected;
int words = DIV_ROUND_UP(bytes, sizeof(u32));
int i;
if (read_raw_data && priv->qfpraw)
base = priv->qfpraw;
for (i = 0; i < words; i++)
*val++ = readl(base + reg + i * sizeof(u32));
while (words--)
*val++ = readb(base + reg + i++);
return 0;
}
/* Align reads to word boundary */
static void qfprom_fixup_dt_cell_info(struct nvmem_device *nvmem,
struct nvmem_cell_info *cell)
{
unsigned int byte_offset = cell->offset % sizeof(u32);
cell->bit_offset += byte_offset * BITS_PER_BYTE;
cell->offset -= byte_offset;
if (byte_offset && !cell->nbits)
cell->nbits = cell->bytes * BITS_PER_BYTE;
}
static void qfprom_runtime_disable(void *data)
{
pm_runtime_disable(data);
@@ -371,11 +358,10 @@ static int qfprom_probe(struct platform_device *pdev)
struct nvmem_config econfig = {
.name = "qfprom",
.add_legacy_fixed_of_cells = true,
.stride = 4,
.word_size = 4,
.stride = 1,
.word_size = 1,
.id = NVMEM_DEVID_AUTO,
.reg_read = qfprom_reg_read,
.fixup_dt_cell_info = qfprom_fixup_dt_cell_info,
};
struct device *dev = &pdev->dev;
struct resource *res;