summaryrefslogtreecommitdiff
path: root/lib/utils/regmap/fdt_regmap_syscon.c
AgeCommit message (Collapse)Author
2026-05-11lib: utils/regmap: Fix reg_stride calculation in syscon regmapDavid E. Garcia Porras
The reg_stride field represents the address stride in bytes between consecutive registers. The Linux kernel regmap framework validates register accesses using IS_ALIGNED(reg, map->reg_stride) as an address alignment check (drivers/base/regmap/regmap.c). The Linux kernel syscon driver (drivers/mfd/syscon.c) sets reg_stride directly to reg_io_width: syscon_config.reg_stride = reg_io_width; The current OpenSBI code incorrectly multiplies reg_io_width by 8, converting a byte value to bits. Fix this by using reg_io_width directly as the stride value, consistent with the Linux kernel. Fixes: f21d8f7d5911 ("lib: utils/regmap: Add simple FDT based syscon regmap driver") Signed-off-by: David E. Garcia Porras <[email protected]> Reviewed-by: Anup Patel <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Anup Patel <[email protected]>
2024-11-28lib: utils/regmap: Use fdt_driver for initializationSamuel Holland
The regmap driver subsystem does not need any extra data, so it can use `struct fdt_driver` directly. It always initializes the driver for a specific DT node. Signed-off-by: Samuel Holland <[email protected]> Reviewed-by: Anup Patel <[email protected]>
2024-11-05lib: utils/regmap: Use FDT node offset as regmap IDSamuel Holland
Since the FDT is not modified during driver initialization, node offsets are just as suitable as phandles for use as identifiers: they are stable and unique. With this change, it is no longer necessary to pass the phandle to the driver init functions, so these init functions now use the same prototype as other kinds of drivers. This matches what is already done for I2C adapters. Signed-off-by: Samuel Holland <[email protected]> Reviewed-by: Anup Patel <[email protected]>
2024-08-24lib: utils/regmap: Constify FDT pointers in parsing functionsSamuel Holland
Indicate that none of these functions modify the devicetree by constifying the parameter type. Signed-off-by: Samuel Holland <[email protected]> Reviewed-by: Andrew Jones <[email protected]> Reviewed-by: Anup Patel <[email protected]>
2023-09-24lib: utils/regmap: Mark syscon region as shared read-writeAnup Patel
The syscon region used by OpenSBI should be marked as a shared read-write region between M-mode and SU-mode. Signed-off-by: Anup Patel <[email protected]> Signed-off-by: Mayuresh Chitale <[email protected]>
2023-07-31lib: utils/regmap: Add simple FDT based syscon regmap driverAnup Patel
Let us add a simple FDT based system regmap driver which follows the device tree bindings already defined in the Linux kernel. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Xiang W <[email protected]>