From 93574e5e319757db4f6b424572bdc3ada682644c Mon Sep 17 00:00:00 2001 From: XiaoDong Huang Date: Fri, 15 Sep 2023 18:27:17 +0800 Subject: [PATCH 1/6] ARM: rockchip: rv1106: sleep: enable fst_glb_rst trigger pmu reset Signed-off-by: XiaoDong Huang Change-Id: I7bcd7dd2904435a6fc0faec6c3d3d3bc963207b4 --- arch/arm/mach-rockchip/rv1106_sleep.S | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/arm/mach-rockchip/rv1106_sleep.S b/arch/arm/mach-rockchip/rv1106_sleep.S index a8a8c1dfbfc2..bb50dff9263e 100644 --- a/arch/arm/mach-rockchip/rv1106_sleep.S +++ b/arch/arm/mach-rockchip/rv1106_sleep.S @@ -13,6 +13,9 @@ #define RV1106_PMUGRF_SOC_CON4 0xff020010 #define RV1106_CRU_GLB_SRST_FST 0xff3b0c08 +#define RV1106_CRU_GLB_RST_CON_ADDR 0xff3b0c10 +#define CRU_FST_RST_PMU_VAL 0x000c000c + #if RV1106_SLEEP_DEBUG /********************* console used for sleep.S ******************************/ #define UART_REG_DLL (0x00) @@ -98,6 +101,11 @@ ENTRY(rockchip_slp_cpu_resume) ldr r1, [r1] str r1, [r0] + /* enable first reset trigger pmu reset */ + ldr r0, =RV1106_CRU_GLB_RST_CON_ADDR + ldr r1, =CRU_FST_RST_PMU_VAL + str r1, [r0] + /* clear pmu reset hold */ ldr r0, =RV1106_PMUGRF_SOC_CON4 ldr r1, =0xffff0000 From d0632dae5cf341ccc12efe095189d3e756cd038b Mon Sep 17 00:00:00 2001 From: XiaoDong Huang Date: Fri, 7 Jul 2023 10:14:48 +0800 Subject: [PATCH 2/6] ARM: rockchip: rv1106: pm: fix error when WAKEUP_TO_SYSTEM_RESET Signed-off-by: XiaoDong Huang Change-Id: I5136c90c75001d473543365f6aa31a532b84506f --- arch/arm/mach-rockchip/rv1106_pm.c | 13 ++++++++++++- arch/arm/mach-rockchip/rv1106_pm.h | 2 ++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-rockchip/rv1106_pm.c b/arch/arm/mach-rockchip/rv1106_pm.c index 8725c4efd27a..7767b44c58d2 100644 --- a/arch/arm/mach-rockchip/rv1106_pm.c +++ b/arch/arm/mach-rockchip/rv1106_pm.c @@ -1036,7 +1036,18 @@ static int rockchip_lpmode_enter(unsigned long arg) cpu_do_idle(); - pr_err("%s: Failed to suspend\n", __func__); +#if RV1106_WAKEUP_TO_SYSTEM_RESET + /* If reaches here, it means wakeup source cames before cpu enter wfi. + * So we should do system reset if RV1106_WAKEUP_TO_SYSTEM_RESET. + */ + writel_relaxed(0x000c000c, cru_base + RV1106_CRU_GLB_RST_CON); + writel_relaxed(0xffff0000, pmugrf_base + RV1106_PMUGRF_SOC_CON(4)); + writel_relaxed(0xffff0000, pmugrf_base + RV1106_PMUGRF_SOC_CON(5)); + dsb(sy); + writel_relaxed(0xfdb9, cru_base + RV1106_CRU_GLB_SRST_FST); +#endif + + rkpm_printstr("Failed to suspend\n"); return 1; } diff --git a/arch/arm/mach-rockchip/rv1106_pm.h b/arch/arm/mach-rockchip/rv1106_pm.h index 61c3f9816d02..da857a5b6fa2 100644 --- a/arch/arm/mach-rockchip/rv1106_pm.h +++ b/arch/arm/mach-rockchip/rv1106_pm.h @@ -72,6 +72,8 @@ #define RV1106_CRU_MODE_CON00 0x280 #define RV1106_CRU_GATE_CON(i) (0x800 + (i) * 4) #define RV1106_CRU_GATE_CON_NUM 4 +#define RV1106_CRU_GLB_SRST_FST 0xc08 +#define RV1106_CRU_GLB_RST_CON 0xc10 #define CRU_PLLCON1_PWRDOWN BIT(13) #define CRU_PLLCON1_LOCK_STATUS BIT(10) From c78736852cc3dd9e3ac8106dc55e9f95f1597c8c Mon Sep 17 00:00:00 2001 From: Huibin Hong Date: Thu, 21 Sep 2023 03:47:34 +0000 Subject: [PATCH 3/6] fiq_debugger: fix spurious triggering of fiq Before this patch, when input rk_fiq_debugger in commdline, which would trigger fiq debugger mode. Signed-off-by: Huibin Hong Change-Id: Id4360c1b41ab65b7edd82f676a82b27c7ec7c3b5 --- drivers/soc/rockchip/fiq_debugger/rk_fiq_debugger.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/soc/rockchip/fiq_debugger/rk_fiq_debugger.c b/drivers/soc/rockchip/fiq_debugger/rk_fiq_debugger.c index c6299aebaf2f..1fb72a5601ea 100644 --- a/drivers/soc/rockchip/fiq_debugger/rk_fiq_debugger.c +++ b/drivers/soc/rockchip/fiq_debugger/rk_fiq_debugger.c @@ -179,11 +179,13 @@ static int debug_getc(struct platform_device *pdev) if (lsr & UART_LSR_DR) { temp = rk_fiq_read(t, UART_RX); - buf[n & 0x1f] = temp; - n++; - if (temp == 'q' && n > 2) { - if ((buf[(n - 2) & 0x1f] == 'i') && - (buf[(n - 3) & 0x1f] == 'f')) + buf[++n & 0x1f] = temp; + + if (temp == 'q') { + if ((buf[(n - 1) & 0x1f] == 'i') && + (buf[(n - 2) & 0x1f] == 'f') && + (buf[(n - 3) & 0x1f] != '_') && + (buf[(n - 3) & 0x1f] != ' ')) return FIQ_DEBUGGER_BREAK; else return temp; From b44e92aeaca9a3e526c4e4ec5aa2a653e0c27a1a Mon Sep 17 00:00:00 2001 From: Weiwen Chen Date: Mon, 25 Sep 2023 18:08:11 +0800 Subject: [PATCH 4/6] ARM: dts: rockchip: add rv1106g-evb2-v12-nofastae-spi-nand.dts Signed-off-by: Weiwen Chen Change-Id: Ia120e2dd041ca61efb904336f31ce34073a5a012 --- arch/arm/boot/dts/Makefile | 1 + .../rv1106g-evb2-v12-nofastae-spi-nand.dts | 129 ++++++++++++++++++ 2 files changed, 130 insertions(+) create mode 100644 arch/arm/boot/dts/rv1106g-evb2-v12-nofastae-spi-nand.dts diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index 55e6477489bf..36464dc36216 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -1005,6 +1005,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += \ rv1106g-evb2-v11-emmc.dtb \ rv1106g-evb2-v11-trailcam-emmc.dtb \ rv1106g-evb2-v12-nofastae-emmc.dtb \ + rv1106g-evb2-v12-nofastae-spi-nand.dtb \ rv1106g-evb2-v12-nofastae-spi-nor.dtb \ rv1106g-evb2-v12-wakeup.dtb \ rv1106g-smart-door-lock-rmsl-v10.dtb \ diff --git a/arch/arm/boot/dts/rv1106g-evb2-v12-nofastae-spi-nand.dts b/arch/arm/boot/dts/rv1106g-evb2-v12-nofastae-spi-nand.dts new file mode 100644 index 000000000000..a7b53a738158 --- /dev/null +++ b/arch/arm/boot/dts/rv1106g-evb2-v12-nofastae-spi-nand.dts @@ -0,0 +1,129 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2023 Rockchip Electronics Co., Ltd. + */ + +/dts-v1/; + +#include "rv1106.dtsi" +#include "rv1106-evb-v10.dtsi" +#include "rv1106-evb-cam.dtsi" +#include "rv1106-tb-nofastae.dtsi" + +/ { + model = "Rockchip RV1106G EVB2 V12 Board SPI NAND"; + compatible = "rockchip,rv1106g-evb2-v12", "rockchip,rv1106"; + chosen { + bootargs = "loglevel=0 rootfstype=erofs rootflags=dax console=ttyFIQ0 root=/dev/rd0 snd_soc_core.prealloc_buffer_size_kbytes=16 coherent_pool=0 driver_async_probe=dwmmc_rockchip"; + }; + + vcc_1v8: vcc-1v8 { + compatible = "regulator-fixed"; + regulator-name = "vcc_1v8"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + }; + + vcc_3v3: vcc-3v3 { + compatible = "regulator-fixed"; + regulator-name = "vcc_3v3"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + }; + + vcc3v3_sd: vcc3v3-sd { + compatible = "regulator-fixed"; + gpio = <&gpio2 RK_PA7 GPIO_ACTIVE_LOW>; + regulator-name = "vcc3v3_sd"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc_pwren>; + }; + + wireless_wlan: wireless-wlan { + compatible = "wlan-platdata"; + WIFI,host_wake_irq = <&gpio1 RK_PB0 GPIO_ACTIVE_HIGH>; + status = "okay"; + }; +}; + +&fiq_debugger { + rockchip,baudrate = <1500000>; +}; + +&pinctrl { + sdmmc { + /omit-if-no-ref/ + sdmmc_pwren: sdmmc-pwren { + rockchip,pins = <2 RK_PA7 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; +}; + +&pwm10 { + status = "okay"; +}; + +&pwm11 { + status = "okay"; +}; + +&ramdisk_r { + reg = <0x800000 (15 * 0x00100000)>; +}; + +&ramdisk_c { + reg = <0x1700000 (10 * 0x00100000)>; +}; + +&sdio { + max-frequency = <50000000>; + bus-width = <1>; + cap-sd-highspeed; + cap-sdio-irq; + keep-power-in-suspend; + non-removable; + rockchip,default-sample-phase = <90>; + no-sd; + no-mmc; + supports-sdio; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc1m0_cmd &sdmmc1m0_clk &sdmmc1m0_bus4>; + status = "okay"; +}; + +&sdmmc { + max-frequency = <200000000>; + no-sdio; + no-mmc; + bus-width = <4>; + cap-mmc-highspeed; + cap-sd-highspeed; + disable-wp; + pinctrl-names = "normal", "idle"; + pinctrl-0 = <&sdmmc0_clk &sdmmc0_cmd &sdmmc0_det &sdmmc0_bus4>; + pinctrl-1 = <&sdmmc0_idle_pins &sdmmc0_det>; + vmmc-supply = <&vcc3v3_sd>; + status = "okay"; +}; + +&sfc { + status = "okay"; + + flash@0 { + compatible = "spi-nand"; + reg = <0>; + spi-max-frequency = <75000000>; + spi-rx-bus-width = <4>; + spi-tx-bus-width = <1>; + }; +}; + +&usbdrd_dwc3 { + dr_mode = "peripheral"; +}; From b457b68a97a47efee922aca10ec478281a19dac1 Mon Sep 17 00:00:00 2001 From: Longjian Lin Date: Mon, 9 May 2022 06:08:56 +0000 Subject: [PATCH 5/6] net: rfkill-bt: match irq_wake to irq. Signed-off-by: Longjian Lin Change-Id: I5965b5d12bf3fa8bb13c9346fb8ee609800abdf6 Signed-off-by: Zou Dengming --- net/rfkill/rfkill-bt.c | 18 +++++++----------- net/rfkill/rfkill-wlan.c | 5 +++++ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/net/rfkill/rfkill-bt.c b/net/rfkill/rfkill-bt.c index b3567912e24b..73b802c7faa4 100644 --- a/net/rfkill/rfkill-bt.c +++ b/net/rfkill/rfkill-bt.c @@ -175,15 +175,11 @@ static int rfkill_rk_setup_wake_irq(struct rfkill_rk_data *rfkill, int flag) rfkill->irq_req = 1; LOG("** disable irq\n"); disable_irq(irq->irq); - ret = enable_irq_wake(irq->irq); - if (ret) - goto fail3; + /*ret = disable_irq_wake(irq->irq);init irq wake is disabled,no need to disable*/ } return ret; -fail3: - free_irq(irq->irq, rfkill); fail2: gpio_free(irq->gpio.io); fail1: @@ -292,12 +288,6 @@ static int rfkill_rk_set_power(void *data, bool blocked) toggle = rfkill->pdata->power_toggle; - if (toggle) { - if (rfkill_get_wifi_power_state(&wifi_power)) { - LOG("%s: cannot get wifi power state!\n", __func__); - return -1; - } - } DBG("%s: toggle = %s\n", __func__, toggle ? "true" : "false"); @@ -372,6 +362,10 @@ static int rfkill_rk_set_power(void *data, bool blocked) } } if (toggle) { + if (rfkill_get_wifi_power_state(&wifi_power)) { + LOG("%s: cannot get wifi power state!\n", __func__); + return -EPERM; + } if (!wifi_power) { LOG("%s: bt will set vbat to low\n", __func__); rfkill_set_wifi_bt_power(0); @@ -413,6 +407,7 @@ static int rfkill_rk_pm_prepare(struct device *dev) if (gpio_is_valid(wake_host_irq->gpio.io) && bt_power_state) { DBG("enable irq for bt wakeup host\n"); enable_irq(wake_host_irq->irq); + enable_irq_wake(wake_host_irq->irq); } #ifdef CONFIG_RFKILL_RESET @@ -442,6 +437,7 @@ static void rfkill_rk_pm_complete(struct device *dev) if (gpio_is_valid(wake_host_irq->gpio.io) && bt_power_state) { LOG("** disable irq\n"); disable_irq(wake_host_irq->irq); + disable_irq_wake(wake_host_irq->irq); } if (rfkill->pdata->pinctrl && gpio_is_valid(rts->io)) { diff --git a/net/rfkill/rfkill-wlan.c b/net/rfkill/rfkill-wlan.c index 89d9787b9ad9..338b59c53dbc 100644 --- a/net/rfkill/rfkill-wlan.c +++ b/net/rfkill/rfkill-wlan.c @@ -319,6 +319,11 @@ int rockchip_wifi_power(int on) } wifi_power_state = 0; + + if (!rfkill_get_bt_power_state(&bt_power, &toggle)) { + LOG("%s: toggle = %s\n", __func__, toggle ? "true" : "false"); + } + if (toggle) { if (!bt_power) { LOG("%s: wifi will set vbat to low\n", __func__); From f12d67042fa3fd21e64ea25bfebb138201f36b16 Mon Sep 17 00:00:00 2001 From: Tao Huang Date: Wed, 20 Sep 2023 14:40:14 +0800 Subject: [PATCH 6/6] Input: gt1x - Enable async suspend/resume on fb blank On rk3588-evb1-lp4-v10: Before: [ 101.214271][ T1989] PM: suspend exit [ 101.772978][ T412] dw-mipi-dsi2 fde20000.dsi: [drm:dw_mipi_dsi2_encoder_atomic_enable] final DSI-Link bandwidth: 880000 x 4 Kbps total: 0.558707 After: [ 266.604393][ T1971] PM: suspend exit [ 266.792421][ T410] dw-mipi-dsi2 fde20000.dsi: [drm:dw_mipi_dsi2_encoder_atomic_enable] final DSI-Link bandwidth: 880000 x 4 Kbps total: 0.188028, save about 0.37s. Signed-off-by: Tao Huang Change-Id: I7310b11e2897c79ce8b0c61d8b98760a4f8699f3 --- drivers/input/touchscreen/gt1x/gt1x.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/input/touchscreen/gt1x/gt1x.c b/drivers/input/touchscreen/gt1x/gt1x.c index 5871d5d556ef..8c8e06d6e96d 100644 --- a/drivers/input/touchscreen/gt1x/gt1x.c +++ b/drivers/input/touchscreen/gt1x/gt1x.c @@ -656,6 +656,18 @@ static int gt1x_ts_remove(struct i2c_client *client) } #if defined(CONFIG_FB) +#include + +static void gt1x_resume_async(void *data, async_cookie_t cookie) +{ + gt1x_resume(); +} + +static void gt1x_suspend_async(void *data, async_cookie_t cookie) +{ + gt1x_suspend(); +} + /* frame buffer notifier block control the suspend/resume procedure */ static struct notifier_block gt1x_fb_notifier; static int tp_status; @@ -686,7 +698,7 @@ static int gtp_fb_notifier_callback(struct notifier_block *noti, unsigned long e if (*blank == FB_BLANK_UNBLANK) { tp_status = *blank; GTP_DEBUG("Resume by fb notifier."); - gt1x_resume(); + async_schedule(gt1x_resume_async, NULL); } } #endif @@ -697,7 +709,7 @@ static int gtp_fb_notifier_callback(struct notifier_block *noti, unsigned long e if (*blank == FB_BLANK_POWERDOWN) { tp_status = *blank; GTP_DEBUG("Suspend by fb notifier."); - gt1x_suspend(); + async_schedule(gt1x_suspend_async, NULL); } }