sunxi-5.15: Fix duplicate nodes for sun50i-h5-orangepi-pc2 board. (#3588)

* Fix duplicate nodes for sun50i-h5-orangepi-pc2

* Remove unused patch for pinctrl: sunxi: Fix deadlock.

This fix duplicates the upstream commit
896d1b8a36129c3f1378fbbafd7c394a877635b5 of the linux-5.15.y branch

pinctrl: sunxi: Use unique lockdep classes for IRQs

commit bac129dbc6560dfeb634c03f0c08b78024e71915 upstream.

This driver, like several others, uses a chained IRQ for each GPIO bank,
and forwards .irq_set_wake to the GPIO bank's upstream IRQ. As a result,
a call to irq_set_irq_wake() needs to lock both the upstream and
downstream irq_desc's. Lockdep considers this to be a possible deadlock
when the irq_desc's share lockdep classes, which they do by default:

============================================
WARNING: possible recursive locking detected
5.17.0-rc3-00394-gc849047c2473 #1 Not tainted
...

* Add to series.armbian Fix-duplicate-nodes-for-sun50i-h5-orangepi-pc2.patch

The problem with duplicate nodes in the device tree is that the first
one in the queue will be applied. The subsequent one will be ignored,
not replaced.

Fix spi-nor node initialization error for orangepi-pc2

[    1.288263] spi-nor spi0.0: supply vdd not found, using dummy regulator
[    1.306391] spi-nor spi0.0: mx25l1606e (2048 Kbytes)
[    1.845203] Freeing initrd memory: 10824K
[    1.855263] sun6i-spi 1c68000.spi: chipselect 0 already in use
[    1.861159] spi_master spi0: spi_device register error /soc/spi@1c68000/spi-flash@0
[    1.868842] spi_master spi0: Failed to create SPI device for /soc/spi@1c68000/spi-flash@0

Remove duplicate nodes from applied patches for the board
sun50i-h5-orangepi-pc2. After this fix:

[    1.290252] sun50i-h5-pinctrl 1c20800.pinctrl: supply vcc-pc not found, using dummy regulator
[    1.291250] spi-nor spi0.0: supply vdd not found, using dummy regulator
[    1.310397] spi-nor spi0.0: mx25l1606e (2048 Kbytes)
[    1.845686] Freeing initrd memory: 10824K
[    1.854333] 2 fixed-partitions partitions found on MTD device spi0.0
[    1.854369] Creating 2 MTD partitions on "spi0.0":
[    1.854381] 0x000000000000-0x000000100000 : "uboot"
[    1.855679] 0x000000100000-0x000000200000 : "env"
This commit is contained in:
The-going 2022-03-28 02:18:17 +03:00 committed by GitHub
parent 0eb7675283
commit 6a53633703
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 90 additions and 110 deletions

View File

@ -1,108 +0,0 @@
From 14f5c0dc48d8405ee2d0386dcab097519566890f Mon Sep 17 00:00:00 2001
From: Ondrej Jirman <megous@megous.com>
Date: Wed, 13 Oct 2021 19:20:44 +0200
Subject: [PATCH 289/467] pinctrl: sunxi: Fix misleading lockdep deadlock
warning
============================================
WARNING: possible recursive locking detected
5.15.0-rc4-00828-g8c78cd1f12fe-dirty #1 Tainted: G C
--------------------------------------------
ueventd/180 is trying to acquire lock:
ffffff8006a108c8 (&irq_desc_lock_class){-.-.}-{2:2}, at: __irq_get_desc_lock+0x5c/0xb4
but task is already holding lock:
ffffff800a3aa0c8 (&irq_desc_lock_class){-.-.}-{2:2}, at: __irq_get_desc_lock+0x5c/0xb4
other info that might help us debug this:
Possible unsafe locking scenario:
CPU0
----
lock(&irq_desc_lock_class);
lock(&irq_desc_lock_class);
*** DEADLOCK ***
May be due to missing lock nesting notation
2 locks held by ueventd/180:
#0: ffffff800e60a180 (&dev->mutex){....}-{3:3}, at: __driver_attach+0xc4/0x1f4
#1: ffffff800a3aa0c8 (&irq_desc_lock_class){-.-.}-{2:2}, at: __irq_get_desc_lock+0x5c/0xb4
stack backtrace:
CPU: 3 PID: 180 Comm: ueventd Tainted: G C 5.15.0-rc4-00828-g8c78cd1f12fe-dirty #1
Hardware name: Pine64 PinePhone (1.2) (DT)
Call trace:
dump_backtrace+0x0/0x29c
show_stack+0x14/0x20
dump_stack_lvl+0x98/0xd0
dump_stack+0x18/0x30
validate_chain+0x640/0x650
__lock_acquire+0x714/0xbd0
lock_acquire.part.0+0x188/0x354
lock_acquire+0x6c/0x8c
_raw_spin_lock_irqsave+0x90/0x13c
__irq_get_desc_lock+0x5c/0xb4
irq_set_irq_wake+0x84/0x270
sunxi_pinctrl_irq_set_wake+0x58/0x70
irq_set_irq_wake+0x164/0x270
rtw_drv_init+0x2ec/0x390 [8723cs]
sdio_bus_probe+0x138/0x230
really_probe.part.0+0xf4/0x48c
__driver_probe_device+0x120/0x1d4
driver_probe_device+0x60/0x16c
__driver_attach+0xd0/0x1f4
bus_for_each_dev+0xe0/0x14c
driver_attach+0x30/0x40
bus_add_driver+0x19c/0x2c0
driver_register+0xe8/0x200
sdio_register_driver+0x48/0x5c
rtw_drv_entry+0x48/0x90 [8723cs]
do_one_initcall+0x9c/0x1fc
do_init_module+0xe0/0x374
load_module+0xf24/0x10d4
__do_sys_finit_module+0xf8/0x15c
__arm64_sys_finit_module+0x40/0x50
invoke_syscall+0x5c/0x180
el0_svc_common.constprop.0+0x7c/0x160
do_el0_svc+0x30/0x40
el0_svc+0x74/0x230
el0t_64_sync_handler+0x9c/0x120
el0t_64_sync+0x15c/0x160
Signed-off-by: Ondrej Jirman <megous@megous.com>
---
drivers/pinctrl/sunxi/pinctrl-sunxi.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
index 862c84efb..023ff4a96 100644
--- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c
+++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
@@ -36,6 +36,14 @@
#include "../core.h"
#include "pinctrl-sunxi.h"
+/*
+ * This lock class tells lockdep that irqchip core that this single
+ * pinctrl can be in a different category than its parents, so it won't
+ * report false recursion.
+ */
+static struct lock_class_key sunxi_pinctrl_lock_class;
+static struct lock_class_key sunxi_pinctrl_request_class;
+
static struct irq_chip sunxi_pinctrl_edge_irq_chip;
static struct irq_chip sunxi_pinctrl_level_irq_chip;
@@ -1554,6 +1562,7 @@ int sunxi_pinctrl_init_with_variant(struct platform_device *pdev,
irq_set_chip_and_handler(irqno, &sunxi_pinctrl_edge_irq_chip,
handle_edge_irq);
irq_set_chip_data(irqno, pctl);
+ irq_set_lockdep_class(irqno, &sunxi_pinctrl_lock_class, &sunxi_pinctrl_request_class);
}
for (i = 0; i < pctl->desc->irq_banks; i++) {
--
2.34.0

View File

@ -0,0 +1,89 @@
From fef9381530bdeda69c0f4c0b95e65b12c6180392 Mon Sep 17 00:00:00 2001
From: The-going <48602507+The-going@users.noreply.github.com>
Date: Thu, 24 Mar 2022 17:21:08 +0300
Subject: [PATCH] Fix duplicate nodes for sun50i-h5-orangepi-pc2
The problem with duplicate nodes in the device tree is that the first one
in the queue will be applied. The subsequent one will be ignored, not replaced.
Fix spi-nor node initialization error for orangepi-pc2
[ 1.288263] spi-nor spi0.0: supply vdd not found, using dummy regulator
[ 1.306391] spi-nor spi0.0: mx25l1606e (2048 Kbytes)
[ 1.845203] Freeing initrd memory: 10824K
[ 1.855263] sun6i-spi 1c68000.spi: chipselect 0 already in use
[ 1.861159] spi_master spi0: spi_device register error /soc/spi@1c68000/spi-flash@0
[ 1.868842] spi_master spi0: Failed to create SPI device for /soc/spi@1c68000/spi-flash@0
Remove duplicate nodes from applied patches for the board
sun50i-h5-orangepi-pc2. After this fix:
[ 1.290252] sun50i-h5-pinctrl 1c20800.pinctrl: supply vcc-pc not found, using dummy regulator
[ 1.291250] spi-nor spi0.0: supply vdd not found, using dummy regulator
[ 1.310397] spi-nor spi0.0: mx25l1606e (2048 Kbytes)
[ 1.845686] Freeing initrd memory: 10824K
[ 1.854333] 2 fixed-partitions partitions found on MTD device spi0.0
[ 1.854369] Creating 2 MTD partitions on "spi0.0":
[ 1.854381] 0x000000000000-0x000000100000 : "uboot"
[ 1.855679] 0x000000100000-0x000000200000 : "env"
---
.../dts/allwinner/sun50i-h5-orangepi-pc2.dts | 32 -------------------
1 file changed, 32 deletions(-)
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts b/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts
index 181a465fb..0c821deec 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts
@@ -99,10 +99,6 @@ &codec {
status = "okay";
};
-&cpu0 {
- cpu-supply = <&reg_vdd_cpux>;
-};
-
&de {
status = "okay";
};
@@ -182,38 +178,10 @@ &ohci3 {
status = "okay";
};
-&r_i2c {
- status = "okay";
-
- reg_vdd_cpux: regulator@65 {
- compatible = "silergy,sy8106a";
- reg = <0x65>;
- regulator-name = "vdd-cpux";
- silergy,fixed-microvolt = <1100000>;
- regulator-min-microvolt = <1000000>;
- regulator-max-microvolt = <1400000>;
- regulator-ramp-delay = <200>;
- regulator-boot-on;
- regulator-always-on;
- };
-};
-
&sound_hdmi {
status = "okay";
};
-&spi0 {
- status = "okay";
-
- flash@0 {
- #address-cells = <1>;
- #size-cells = <1>;
- compatible = "jedec,spi-nor";
- reg = <0>;
- spi-max-frequency = <40000000>;
- };
-};
-
&r_i2c {
status = "okay";
--
2.34.1

View File

@ -182,3 +182,4 @@
patches.armbian/arm64-dts-sun50i-h5-orangepi-prime-add-rtl8723cs.patch
patches.armbian/arm-dts-sun8i-h2-plus-orangepi-zero-fix-xradio-inter.patch
patches.armbian/drv-mtd-nand-disable-badblock-check-for-migration.patch
patches.armbian/Fix-duplicate-nodes-for-sun50i-h5-orangepi-pc2.patch

View File

@ -137,7 +137,6 @@
megous/of-property-fw_devlink-Support-allwinner-sram-links.patch
megous/mfd-rk808-Add-support-for-power-off-on-RK817.patch
megous/mfd-rk808-Add-support-for-restart-via-PMIC.patch
- megous/pinctrl-sunxi-Fix-misleading-lockdep-deadlock-warnin.patch
megous/usb-quirks-Add-USB_QUIRK_RESET-for-Quectel-EG25G-Mod.patch
megous/drm-sun4i-Fix-wrong-location-of-clk_prepare_enable.patch
megous/drm-panel-st7703-Improve-the-power-up-sequence-of-th.patch

View File

@ -138,7 +138,6 @@
megous/of-property-fw_devlink-Support-allwinner-sram-links.patch
megous/mfd-rk808-Add-support-for-power-off-on-RK817.patch
megous/mfd-rk808-Add-support-for-restart-via-PMIC.patch
megous/pinctrl-sunxi-Fix-misleading-lockdep-deadlock-warnin.patch
megous/usb-quirks-Add-USB_QUIRK_RESET-for-Quectel-EG25G-Mod.patch
megous/drm-sun4i-Fix-wrong-location-of-clk_prepare_enable.patch
megous/drm-panel-st7703-Improve-the-power-up-sequence-of-th.patch