From 0b6dd132954260feb92d482eb4860bc7153d00e8 Mon Sep 17 00:00:00 2001 From: The-going <48602507+The-going@users.noreply.github.com> Date: Mon, 28 Mar 2022 02:15:47 +0300 Subject: [PATCH] sunxi-5.16: Fix spi-nor node initialization error for orangepi-pc2 (#3597) * Remove unused pinctrl-sunxi-Fix-misleading-lockdep-deadlock-warnin.patch The problem was solved in the upstream kernel. commit e221ef82d9f5e97bca61f7c25e2b58b04466de87 linux-5.16.y branch. 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 ... * 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" --- ...ate-nodes-for-sun50i-h5-orangepi-pc2.patch | 66 +++++++++++ ...-misleading-lockdep-deadlock-warning.patch | 108 ------------------ .../kernel/archive/sunxi-5.16/series.armbian | 1 + patch/kernel/archive/sunxi-5.16/series.conf | 2 +- patch/kernel/archive/sunxi-5.16/series.megous | 1 - 5 files changed, 68 insertions(+), 110 deletions(-) create mode 100644 patch/kernel/archive/sunxi-5.16/patches.armbian/Fix-duplicate-nodes-for-sun50i-h5-orangepi-pc2.patch delete mode 100644 patch/kernel/archive/sunxi-5.16/patches.megous/pinctrl-sunxi-Fix-misleading-lockdep-deadlock-warning.patch diff --git a/patch/kernel/archive/sunxi-5.16/patches.armbian/Fix-duplicate-nodes-for-sun50i-h5-orangepi-pc2.patch b/patch/kernel/archive/sunxi-5.16/patches.armbian/Fix-duplicate-nodes-for-sun50i-h5-orangepi-pc2.patch new file mode 100644 index 0000000000..3e47186f16 --- /dev/null +++ b/patch/kernel/archive/sunxi-5.16/patches.armbian/Fix-duplicate-nodes-for-sun50i-h5-orangepi-pc2.patch @@ -0,0 +1,66 @@ +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 + +--- + .../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 = <®_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 + diff --git a/patch/kernel/archive/sunxi-5.16/patches.megous/pinctrl-sunxi-Fix-misleading-lockdep-deadlock-warning.patch b/patch/kernel/archive/sunxi-5.16/patches.megous/pinctrl-sunxi-Fix-misleading-lockdep-deadlock-warning.patch deleted file mode 100644 index 9562a8d573..0000000000 --- a/patch/kernel/archive/sunxi-5.16/patches.megous/pinctrl-sunxi-Fix-misleading-lockdep-deadlock-warning.patch +++ /dev/null @@ -1,108 +0,0 @@ -From bdc65ea4cce22091f8bd679ee0c0b7f024018244 Mon Sep 17 00:00:00 2001 -From: Ondrej Jirman -Date: Wed, 13 Oct 2021 19:20:44 +0200 -Subject: [PATCH 133/446] 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 ---- - 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.31.1 - diff --git a/patch/kernel/archive/sunxi-5.16/series.armbian b/patch/kernel/archive/sunxi-5.16/series.armbian index 9ca112619b..47afb69851 100644 --- a/patch/kernel/archive/sunxi-5.16/series.armbian +++ b/patch/kernel/archive/sunxi-5.16/series.armbian @@ -178,3 +178,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 diff --git a/patch/kernel/archive/sunxi-5.16/series.conf b/patch/kernel/archive/sunxi-5.16/series.conf index 5aa4f53412..4016d20ebd 100644 --- a/patch/kernel/archive/sunxi-5.16/series.conf +++ b/patch/kernel/archive/sunxi-5.16/series.conf @@ -135,7 +135,6 @@ patches.megous/media-cedrus-Fix-failure-to-clean-up-hardware-on-probe-failure.patch patches.megous/Revert-drm-sun4i-lvds-Invert-the-LVDS-polarity.patch patches.megous/of-property-fw_devlink-Support-allwinner-sram-links.patch -- patches.megous/pinctrl-sunxi-Fix-misleading-lockdep-deadlock-warning.patch patches.megous/Bluetooth-Add-new-quirk-for-broken-local-ext-features-max_page.patch patches.megous/Bluetooth-btrtl-add-support-for-the-RTL8723CS.patch patches.megous/rtw89-Fix-crash-by-loading-compressed-firmware-file.patch @@ -696,3 +695,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 diff --git a/patch/kernel/archive/sunxi-5.16/series.megous b/patch/kernel/archive/sunxi-5.16/series.megous index 48999e6e34..be73ad4409 100644 --- a/patch/kernel/archive/sunxi-5.16/series.megous +++ b/patch/kernel/archive/sunxi-5.16/series.megous @@ -139,7 +139,6 @@ patches.megous/media-cedrus-Fix-failure-to-clean-up-hardware-on-probe-failure.patch patches.megous/Revert-drm-sun4i-lvds-Invert-the-LVDS-polarity.patch patches.megous/of-property-fw_devlink-Support-allwinner-sram-links.patch - patches.megous/pinctrl-sunxi-Fix-misleading-lockdep-deadlock-warning.patch patches.megous/Bluetooth-Add-new-quirk-for-broken-local-ext-features-max_page.patch patches.megous/Bluetooth-btrtl-add-support-for-the-RTL8723CS.patch patches.megous/rtw89-Fix-crash-by-loading-compressed-firmware-file.patch