Skip to content
Commit f07798d7 authored by Shiji Yang's avatar Shiji Yang Committed by Bartosz Golaszewski
Browse files

gpio: mmio: do not calculate bgpio_bits via "ngpios"

bgpio_bits must be aligned with the data bus width. For example, on a
32 bit big endian system and we only have 16 GPIOs. If we only assume
bgpio_bits=16 we can never control the GPIO because the base address
is the lowest address.

low address                          high address
-------------------------------------------------
|   byte3   |   byte2   |   byte1   |   byte0   |
-------------------------------------------------
|    NaN    |    NaN    |  gpio8-15 |  gpio0-7  |
-------------------------------------------------

Fixes: 55b2395e

 ("gpio: mmio: handle "ngpios" properly in bgpio_init()")
Fixes: https://github.com/openwrt/openwrt/issues/15739
Reported-by: default avatarMark Mentovai <mark@mentovai.com>
Signed-off-by: default avatarShiji Yang <yangshiji66@outlook.com>
Suggested-By: default avatarMark Mentovai <mark@mentovai.com>
Reviewed-by: default avatarJonas Gorski <jonas.gorski@gmail.com>
Tested-by: default avatarLóránd Horváth <lorand.horvath82@gmail.com>
Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/TYCP286MB089577B47D70F0AB25ABA6F5BCD52@TYCP286MB0895.JPNP286.PROD.OUTLOOK.COM
Signed-off-by: default avatarBartosz Golaszewski <bartosz.golaszewski@linaro.org>
parent 3645ffaf
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment