Patch "gpio: mmio: do not calculate bgpio_bits via "ngpios"" has been added to the 6.9-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

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

to the 6.9-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     gpio-mmio-do-not-calculate-bgpio_bits-via-ngpios.patch
and it can be found in the queue-6.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 1a9dc7a58560622daf10af515734c8042c8857c4
Author: Shiji Yang <yangshiji66@xxxxxxxxxxx>
Date:   Tue Jun 25 09:19:49 2024 +0800

    gpio: mmio: do not calculate bgpio_bits via "ngpios"
    
    [ Upstream commit f07798d7bb9c46d17d80103fb772fd2c75d47919 ]
    
    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: 55b2395e4e92 ("gpio: mmio: handle "ngpios" properly in bgpio_init()")
    Fixes: https://github.com/openwrt/openwrt/issues/15739
    Reported-by: Mark Mentovai <mark@xxxxxxxxxxxx>
    Signed-off-by: Shiji Yang <yangshiji66@xxxxxxxxxxx>
    Suggested-By: Mark Mentovai <mark@xxxxxxxxxxxx>
    Reviewed-by: Jonas Gorski <jonas.gorski@xxxxxxxxx>
    Tested-by: Lóránd Horváth <lorand.horvath82@xxxxxxxxx>
    Reviewed-by: Linus Walleij <linus.walleij@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/TYCP286MB089577B47D70F0AB25ABA6F5BCD52@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/gpio/gpio-mmio.c b/drivers/gpio/gpio-mmio.c
index 71e1af7c21847..d89e78f0ead31 100644
--- a/drivers/gpio/gpio-mmio.c
+++ b/drivers/gpio/gpio-mmio.c
@@ -619,8 +619,6 @@ int bgpio_init(struct gpio_chip *gc, struct device *dev,
 	ret = gpiochip_get_ngpios(gc, dev);
 	if (ret)
 		gc->ngpio = gc->bgpio_bits;
-	else
-		gc->bgpio_bits = roundup_pow_of_two(round_up(gc->ngpio, 8));
 
 	ret = bgpio_setup_io(gc, dat, set, clr, flags);
 	if (ret)




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux