]> git.baikalelectronics.ru Git - kernel.git/commit
nvmem: sunxi_sid: Always use 32-bit MMIO reads
authorSamuel Holland <samuel@sholland.org>
Fri, 27 Jan 2023 10:40:07 +0000 (10:40 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Feb 2023 10:28:19 +0000 (11:28 +0100)
commita2c1d32ad5c8c45d700f0f8b4f5f6d909c1157f5
treeb8d47683f1d97e9ba912e6f7d9fd8d396c70cc7a
parentc1f422262f089e26452da4284321f8d172ac80a4
nvmem: sunxi_sid: Always use 32-bit MMIO reads

commit 912ee96dbdd5db0d5446bbcb1c93e8165d1b6d68 upstream.

The SID SRAM on at least some SoCs (A64 and D1) returns different values
when read with bus cycles narrower than 32 bits. This is not immediately
obvious, because memcpy_fromio() uses word-size accesses as long as
enough data is being copied.

The vendor driver always uses 32-bit MMIO reads, so do the same here.
This is faster than the register-based method, which is currently used
as a workaround on A64. And it fixes the values returned on D1, where
the SRAM method was being used.

The special case for the last word is needed to maintain .word_size == 1
for sysfs ABI compatibility, as noted previously in commit 429da8d07307
("nvmem: sunxi_sid: Optimize register read-out method").

Fixes: 143b11c02862 ("nvmem: sunxi_sid: Add support for D1 variant")
Cc: stable@vger.kernel.org
Tested-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20230127104015.23839-3-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/nvmem/sunxi_sid.c