]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
gpio: aspeed-sgpio: Create llops to handle hardware access
authorBilly Tsai <billy_tsai@aspeedtech.com>
Fri, 23 Jan 2026 09:26:28 +0000 (17:26 +0800)
committerBartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Tue, 27 Jan 2026 10:17:25 +0000 (11:17 +0100)
commita3d37e0cccf530a1bad377b3503d6af757f532c4
tree5ebbc85636dcd306ab9d3083cfa0adac0c319ce5
parent5928e0d1f66112b49869c83ed8f1cc9db3df69e5
gpio: aspeed-sgpio: Create llops to handle hardware access

Add low-level operations (llops) to abstract the register access for SGPIO
registers. With this abstraction layer, the driver can separate the
hardware and software logic, making it easier to extend the driver to
support different hardware register layouts.
The llops abstraction changes the programming semantics from bitmask-based
writes to a value-based interface.

Instead of passing a pre-shifted bitmask to the caller, the driver now
passes:
- the GPIO offset, and
- the value to be set (0 or 1),

and the llops helpers are responsible for deriving the correct register
and bit position internally.

As a result, assignments such as:
  type0 = 1;
  type1 = 1;
  type2 = 1;
do not represent a behavioral change. They indicate that the bit
corresponding to the given GPIO offset should be set, with the actual
bit manipulation handled by llops.

Reviewed-by: Linus Walleij <linusw@kernel.org>
Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com>
Link: https://lore.kernel.org/r/20260123-upstream_sgpio-v2-3-69cfd1631400@aspeedtech.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
drivers/gpio/gpio-aspeed-sgpio.c