Skip to contentSkip to conversation

rk3328: fix SPI

PATCH In review Trevor Woerner 2 participants 2 messages Aug 21, 2024 Arm Rockchip

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rk3328: fix SPI

The latest linux-yocto broke SPI for RK3328 devices. Add the submitted fix.

---
 ...-correct-RK3328-iomux-width-flag-for.patch | 50 +++++++++++++++++++
 recipes-kernel/linux/linux-yocto_%.bbappend   |  1 +
 2 files changed, 51 insertions(+)
 create mode 100644 recipes-kernel/linux/linux-yocto/rk3328/0001-pinctrl-rockchip-correct-RK3328-iomux-width-flag-for.patch
recipes-kernel/linux/linux-yocto/rk3328/0001-pinctrl-rockchip-correct-RK3328-iomux-width-flag-for.patch new file +50 -0
new file mode 100644
index 000000000000..36071511c2a8
@@ -0,0 +1,50 @@
+From ed875ae5b8ca511c11d227c0d9c6d2d13a2e6c15 Mon Sep 17 00:00:00 2001
+From: Huang-Huang Bao <[email protected]>
+Date: Tue,  9 Jul 2024 18:54:28 +0800
+Subject: [PATCH] pinctrl: rockchip: correct RK3328 iomux width flag for
+ GPIO2-B pins
+
+The base iomux offsets for each GPIO pin line are accumulatively
+calculated based off iomux width flag in rockchip_pinctrl_get_soc_data.
+If the iomux width flag is one of IOMUX_WIDTH_4BIT, IOMUX_WIDTH_3BIT or
+IOMUX_WIDTH_2BIT, the base offset for next pin line would increase by 8
+bytes, otherwise it would increase by 4 bytes.
+
+Despite most of GPIO2-B iomux have 2-bit data width, which can be fit
+into 4 bytes space with write mask, it actually take 8 bytes width for
+whole GPIO2-B line.
+
+Commit e8448a6c817c ("pinctrl: rockchip: fix pinmux bits for RK3328
+GPIO2-B pins") wrongly set iomux width flag to 0, causing all base
+iomux offset for line after GPIO2-B to be calculated wrong. Fix the
+iomux width flag to IOMUX_WIDTH_2BIT so the offset after GPIO2-B is
+correctly increased by 8, matching the actual width of GPIO2-B iomux.
+
+Upstream-Status: Submitted
+Fixes: e8448a6c817c ("pinctrl: rockchip: fix pinmux bits for RK3328 GPIO2-B pins")
+Cc: [email protected]
+Reported-by: Richard Kojedzinszky <[email protected]>
+Closes: https://lore.kernel.org/linux-rockchip/[email protected]/
+Tested-By: Trevor Woerner <[email protected]>
+Tested-by: Richard Kojedzinszky <[email protected]>
+Signed-off-by: Huang-Huang Bao <[email protected]>
+---
+ drivers/pinctrl/pinctrl-rockchip.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c
+index 6a7461978630..7b7b8601d01a 100644
+--- a/drivers/pinctrl/pinctrl-rockchip.c
++++ b/drivers/pinctrl/pinctrl-rockchip.c
+@@ -3800,7 +3800,7 @@ static struct rockchip_pin_bank rk3328_pin_banks[] = {
+ 	PIN_BANK_IOMUX_FLAGS(0, 32, "gpio0", 0, 0, 0, 0),
+ 	PIN_BANK_IOMUX_FLAGS(1, 32, "gpio1", 0, 0, 0, 0),
+ 	PIN_BANK_IOMUX_FLAGS(2, 32, "gpio2", 0,
+-			     0,
++			     IOMUX_WIDTH_2BIT,
+ 			     IOMUX_WIDTH_3BIT,
+ 			     0),
+ 	PIN_BANK_IOMUX_FLAGS(3, 32, "gpio3",
+-- 
+2.44.0.478.g7774cfed6261
+
recipes-kernel/linux/linux-yocto_%.bbappend +1 -0
index 5528bab0d17c..509138034082 100644
@@ -25,3 +25,4 @@ COMPATIBLE_MACHINE:rock-5b = "rock-5b"
 
 SRC_URI:append = " file://rockchip-kmeta;type=kmeta;name=rockchip-kmeta;destsuffix=rockchip-kmeta"
 SRC_URI:append:nanopi-r4s = " file://nanopi-r4s.scc"
+SRC_URI:append:rk3328 = " file://0001-pinctrl-rockchip-correct-RK3328-iomux-width-flag-for.patch"
Signature · 1 line
2.44.0.478.g7774cfed6261
Reviewed-by on v1 1/1
#1 lore raw

Hi Trevor,

Quoted 28 lines · Trevor Woerner via lists.yoctoproject.org

The latest linux-yocto broke SPI for RK3328 devices. Add the submitted fix.

---
  ...-correct-RK3328-iomux-width-flag-for.patch | 50 +++++++++++++++++++
  recipes-kernel/linux/linux-yocto_%.bbappend   |  1 +
  2 files changed, 51 insertions(+)

create mode 100644 recipes-kernel/linux/linux-yocto/rk3328/0001-pinctrl-rockchip-correct-RK3328-iomux-width-flag-for.patch

recipes-kernel/linux/linux-yocto/rk3328/0001-pinctrl-rockchip-correct-RK3328-iomux-width-flag-for.patch new file +13 -0
new file mode 100644
index 000000000000..36071511c2a8
@@ -0,0 +1,50 @@
+From ed875ae5b8ca511c11d227c0d9c6d2d13a2e6c15 Mon Sep 17 00:00:00 2001
+From: Huang-Huang Bao <[email protected]>
+Date: Tue,  9 Jul 2024 18:54:28 +0800
+Subject: [PATCH] pinctrl: rockchip: correct RK3328 iomux width flag for
+ GPIO2-B pins
+
+The base iomux offsets for each GPIO pin line are accumulatively
+calculated based off iomux width flag in rockchip_pinctrl_get_soc_data.
+If the iomux width flag is one of IOMUX_WIDTH_4BIT, IOMUX_WIDTH_3BIT or
+IOMUX_WIDTH_2BIT, the base offset for next pin line would increase by 8
+bytes, otherwise it would increase by 4 bytes.
+
+Despite most of GPIO2-B iomux have 2-bit data width, which can be fit

recipes-kernel/linux/linux-yocto/rk3328/0001-pinctrl-rockchip-correct-RK3328-iomux-width-flag-for.patch line 23

Quoted 10 lines
recipes-kernel/linux/linux-yocto/rk3328/0001-pinctrl-rockchip-correct-RK3328-iomux-width-flag-for.patch new file +10 -0
+into 4 bytes space with write mask, it actually take 8 bytes width for
+whole GPIO2-B line.
+
+Commit e8448a6c817c ("pinctrl: rockchip: fix pinmux bits for RK3328
+GPIO2-B pins") wrongly set iomux width flag to 0, causing all base
+iomux offset for line after GPIO2-B to be calculated wrong. Fix the
+iomux width flag to IOMUX_WIDTH_2BIT so the offset after GPIO2-B is
+correctly increased by 8, matching the actual width of GPIO2-B iomux.
+
+Upstream-Status: Submitted

Please provide the link to the patch (between square brackets I believe?).

I personally like to have the original commit log only appended with stuff we add, e.g. Upstream-Status: tag after the last Signed-off-by? But that's really just a matter of taste :)

Looks good to me otherwise,

Thanks!
Quentin