From 4de19dff28a55283591900b5943bffd72347b5dc Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Sun, 22 Oct 2023 19:09:39 -0400 Subject: [PATCH] Fixes for 6.5 Signed-off-by: Sasha Levin --- ...ix-soft-lockups-caused-by-parallel-m.patch | 157 ++++++++++++++++++ ...6600-fix-pinctrl_pm-handling-for-sle.patch | 111 +++++++++++++ ...mdm6600-fix-runtime-disable-on-probe.patch | 51 ++++++ ...ne-mdm6600-fix-runtime-pm-for-remove.patch | 40 +++++ ...p-combo-initialize-pcs_usb-registers.patch | 48 ++++++ ...bo-square-out-8550-power_state_confi.patch | 68 ++++++++ ...qmp-usb-initialize-pcs_usb-registers.patch | 47 ++++++ ...-split-pcs_usb-init-table-for-sc8280.patch | 94 +++++++++++ queue-6.5/series | 8 + 9 files changed, 624 insertions(+) create mode 100644 queue-6.5/efi-unaccepted-fix-soft-lockups-caused-by-parallel-m.patch create mode 100644 queue-6.5/phy-mapphone-mdm6600-fix-pinctrl_pm-handling-for-sle.patch create mode 100644 queue-6.5/phy-mapphone-mdm6600-fix-runtime-disable-on-probe.patch create mode 100644 queue-6.5/phy-mapphone-mdm6600-fix-runtime-pm-for-remove.patch create mode 100644 queue-6.5/phy-qcom-qmp-combo-initialize-pcs_usb-registers.patch create mode 100644 queue-6.5/phy-qcom-qmp-combo-square-out-8550-power_state_confi.patch create mode 100644 queue-6.5/phy-qcom-qmp-usb-initialize-pcs_usb-registers.patch create mode 100644 queue-6.5/phy-qcom-qmp-usb-split-pcs_usb-init-table-for-sc8280.patch diff --git a/queue-6.5/efi-unaccepted-fix-soft-lockups-caused-by-parallel-m.patch b/queue-6.5/efi-unaccepted-fix-soft-lockups-caused-by-parallel-m.patch new file mode 100644 index 00000000000..1bfda4815eb --- /dev/null +++ b/queue-6.5/efi-unaccepted-fix-soft-lockups-caused-by-parallel-m.patch @@ -0,0 +1,157 @@ +From f3ec2f45a3c954460dc32bf447e2fb4cf5ad6d61 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 16 Oct 2023 19:31:22 +0300 +Subject: efi/unaccepted: Fix soft lockups caused by parallel memory acceptance + +From: Kirill A. Shutemov + +[ Upstream commit 50e782a86c980d4f8292ef82ed8139282ca07a98 ] + +Michael reported soft lockups on a system that has unaccepted memory. +This occurs when a user attempts to allocate and accept memory on +multiple CPUs simultaneously. + +The root cause of the issue is that memory acceptance is serialized with +a spinlock, allowing only one CPU to accept memory at a time. The other +CPUs spin and wait for their turn, leading to starvation and soft lockup +reports. + +To address this, the code has been modified to release the spinlock +while accepting memory. This allows for parallel memory acceptance on +multiple CPUs. + +A newly introduced "accepting_list" keeps track of which memory is +currently being accepted. This is necessary to prevent parallel +acceptance of the same memory block. If a collision occurs, the lock is +released and the process is retried. + +Such collisions should rarely occur. The main path for memory acceptance +is the page allocator, which accepts memory in MAX_ORDER chunks. As long +as MAX_ORDER is equal to or larger than the unit_size, collisions will +never occur because the caller fully owns the memory block being +accepted. + +Aside from the page allocator, only memblock and deferered_free_range() +accept memory, but this only happens during boot. + +The code has been tested with unit_size == 128MiB to trigger collisions +and validate the retry codepath. + +Fixes: 2053bc57f367 ("efi: Add unaccepted memory support") +Signed-off-by: Kirill A. Shutemov +Reported-by: Michael Roth +Reviewed-by: Vlastimil Babka +Tested-by: Michael Roth +[ardb: drop unnecessary cpu_relax() call] +Signed-off-by: Ard Biesheuvel +Signed-off-by: Sasha Levin +--- + drivers/firmware/efi/unaccepted_memory.c | 64 ++++++++++++++++++++++-- + 1 file changed, 60 insertions(+), 4 deletions(-) + +diff --git a/drivers/firmware/efi/unaccepted_memory.c b/drivers/firmware/efi/unaccepted_memory.c +index 853f7dc3c21d8..135278ddaf627 100644 +--- a/drivers/firmware/efi/unaccepted_memory.c ++++ b/drivers/firmware/efi/unaccepted_memory.c +@@ -5,9 +5,17 @@ + #include + #include + +-/* Protects unaccepted memory bitmap */ ++/* Protects unaccepted memory bitmap and accepting_list */ + static DEFINE_SPINLOCK(unaccepted_memory_lock); + ++struct accept_range { ++ struct list_head list; ++ unsigned long start; ++ unsigned long end; ++}; ++ ++static LIST_HEAD(accepting_list); ++ + /* + * accept_memory() -- Consult bitmap and accept the memory if needed. + * +@@ -24,6 +32,7 @@ void accept_memory(phys_addr_t start, phys_addr_t end) + { + struct efi_unaccepted_memory *unaccepted; + unsigned long range_start, range_end; ++ struct accept_range range, *entry; + unsigned long flags; + u64 unit_size; + +@@ -78,20 +87,67 @@ void accept_memory(phys_addr_t start, phys_addr_t end) + if (end > unaccepted->size * unit_size * BITS_PER_BYTE) + end = unaccepted->size * unit_size * BITS_PER_BYTE; + +- range_start = start / unit_size; +- ++ range.start = start / unit_size; ++ range.end = DIV_ROUND_UP(end, unit_size); ++retry: + spin_lock_irqsave(&unaccepted_memory_lock, flags); ++ ++ /* ++ * Check if anybody works on accepting the same range of the memory. ++ * ++ * The check is done with unit_size granularity. It is crucial to catch ++ * all accept requests to the same unit_size block, even if they don't ++ * overlap on physical address level. ++ */ ++ list_for_each_entry(entry, &accepting_list, list) { ++ if (entry->end < range.start) ++ continue; ++ if (entry->start >= range.end) ++ continue; ++ ++ /* ++ * Somebody else accepting the range. Or at least part of it. ++ * ++ * Drop the lock and retry until it is complete. ++ */ ++ spin_unlock_irqrestore(&unaccepted_memory_lock, flags); ++ goto retry; ++ } ++ ++ /* ++ * Register that the range is about to be accepted. ++ * Make sure nobody else will accept it. ++ */ ++ list_add(&range.list, &accepting_list); ++ ++ range_start = range.start; + for_each_set_bitrange_from(range_start, range_end, unaccepted->bitmap, +- DIV_ROUND_UP(end, unit_size)) { ++ range.end) { + unsigned long phys_start, phys_end; + unsigned long len = range_end - range_start; + + phys_start = range_start * unit_size + unaccepted->phys_base; + phys_end = range_end * unit_size + unaccepted->phys_base; + ++ /* ++ * Keep interrupts disabled until the accept operation is ++ * complete in order to prevent deadlocks. ++ * ++ * Enabling interrupts before calling arch_accept_memory() ++ * creates an opportunity for an interrupt handler to request ++ * acceptance for the same memory. The handler will continuously ++ * spin with interrupts disabled, preventing other task from ++ * making progress with the acceptance process. ++ */ ++ spin_unlock(&unaccepted_memory_lock); ++ + arch_accept_memory(phys_start, phys_end); ++ ++ spin_lock(&unaccepted_memory_lock); + bitmap_clear(unaccepted->bitmap, range_start, len); + } ++ ++ list_del(&range.list); + spin_unlock_irqrestore(&unaccepted_memory_lock, flags); + } + +-- +2.42.0 + diff --git a/queue-6.5/phy-mapphone-mdm6600-fix-pinctrl_pm-handling-for-sle.patch b/queue-6.5/phy-mapphone-mdm6600-fix-pinctrl_pm-handling-for-sle.patch new file mode 100644 index 00000000000..de46d26ae45 --- /dev/null +++ b/queue-6.5/phy-mapphone-mdm6600-fix-pinctrl_pm-handling-for-sle.patch @@ -0,0 +1,111 @@ +From 59449010ee59349378cfd785552971900bc82c14 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 13 Sep 2023 09:04:29 +0300 +Subject: phy: mapphone-mdm6600: Fix pinctrl_pm handling for sleep pins + +From: Tony Lindgren + +[ Upstream commit 3b384cc74b00b5ac21d18e4c1efc3c1da5300971 ] + +Looks like the driver sleep pins configuration is unusable. Adding the +sleep pins causes the usb phy to not respond. We need to use the default +pins in probe, and only set sleep pins at phy_mdm6600_device_power_off(). + +As the modem can also be booted to a serial port mode for firmware +flashing, let's make the pin changes limited to probe and remove. For +probe, we get the default pins automatically. We only need to set the +sleep pins in phy_mdm6600_device_power_off() to prevent the modem from +waking up because the gpio line glitches. + +If it turns out that we need a separate state for phy_mdm6600_power_on() +and phy_mdm6600_power_off(), we can use the pinctrl idle state. + +Cc: Ivaylo Dimitrov +Cc: Merlijn Wajer +Cc: Pavel Machek +Cc: Sebastian Reichel +Fixes: 2ad2af081622 ("phy: mapphone-mdm6600: Improve phy related runtime PM calls") +Signed-off-by: Tony Lindgren +Reviewed-by: Sebastian Reichel +Link: https://lore.kernel.org/r/20230913060433.48373-3-tony@atomide.com +Signed-off-by: Vinod Koul +Signed-off-by: Sasha Levin +--- + drivers/phy/motorola/phy-mapphone-mdm6600.c | 29 +++++++++------------ + 1 file changed, 12 insertions(+), 17 deletions(-) + +diff --git a/drivers/phy/motorola/phy-mapphone-mdm6600.c b/drivers/phy/motorola/phy-mapphone-mdm6600.c +index df48b1becebe6..376d023a0aa90 100644 +--- a/drivers/phy/motorola/phy-mapphone-mdm6600.c ++++ b/drivers/phy/motorola/phy-mapphone-mdm6600.c +@@ -122,16 +122,10 @@ static int phy_mdm6600_power_on(struct phy *x) + { + struct phy_mdm6600 *ddata = phy_get_drvdata(x); + struct gpio_desc *enable_gpio = ddata->ctrl_gpios[PHY_MDM6600_ENABLE]; +- int error; + + if (!ddata->enabled) + return -ENODEV; + +- error = pinctrl_pm_select_default_state(ddata->dev); +- if (error) +- dev_warn(ddata->dev, "%s: error with default_state: %i\n", +- __func__, error); +- + gpiod_set_value_cansleep(enable_gpio, 1); + + /* Allow aggressive PM for USB, it's only needed for n_gsm port */ +@@ -160,11 +154,6 @@ static int phy_mdm6600_power_off(struct phy *x) + + gpiod_set_value_cansleep(enable_gpio, 0); + +- error = pinctrl_pm_select_sleep_state(ddata->dev); +- if (error) +- dev_warn(ddata->dev, "%s: error with sleep_state: %i\n", +- __func__, error); +- + return 0; + } + +@@ -456,6 +445,7 @@ static void phy_mdm6600_device_power_off(struct phy_mdm6600 *ddata) + { + struct gpio_desc *reset_gpio = + ddata->ctrl_gpios[PHY_MDM6600_RESET]; ++ int error; + + ddata->enabled = false; + phy_mdm6600_cmd(ddata, PHY_MDM6600_CMD_BP_SHUTDOWN_REQ); +@@ -471,6 +461,17 @@ static void phy_mdm6600_device_power_off(struct phy_mdm6600 *ddata) + } else { + dev_err(ddata->dev, "Timed out powering down\n"); + } ++ ++ /* ++ * Keep reset gpio high with padconf internal pull-up resistor to ++ * prevent modem from waking up during deeper SoC idle states. The ++ * gpio bank lines can have glitches if not in the always-on wkup ++ * domain. ++ */ ++ error = pinctrl_pm_select_sleep_state(ddata->dev); ++ if (error) ++ dev_warn(ddata->dev, "%s: error with sleep_state: %i\n", ++ __func__, error); + } + + static void phy_mdm6600_deferred_power_on(struct work_struct *work) +@@ -571,12 +572,6 @@ static int phy_mdm6600_probe(struct platform_device *pdev) + ddata->dev = &pdev->dev; + platform_set_drvdata(pdev, ddata); + +- /* Active state selected in phy_mdm6600_power_on() */ +- error = pinctrl_pm_select_sleep_state(ddata->dev); +- if (error) +- dev_warn(ddata->dev, "%s: error with sleep_state: %i\n", +- __func__, error); +- + error = phy_mdm6600_init_lines(ddata); + if (error) + return error; +-- +2.42.0 + diff --git a/queue-6.5/phy-mapphone-mdm6600-fix-runtime-disable-on-probe.patch b/queue-6.5/phy-mapphone-mdm6600-fix-runtime-disable-on-probe.patch new file mode 100644 index 00000000000..bff24230b92 --- /dev/null +++ b/queue-6.5/phy-mapphone-mdm6600-fix-runtime-disable-on-probe.patch @@ -0,0 +1,51 @@ +From 9b3015bf94f625df0bf236df416bfbcb15b66020 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 13 Sep 2023 09:04:27 +0300 +Subject: phy: mapphone-mdm6600: Fix runtime disable on probe + +From: Tony Lindgren + +[ Upstream commit 719606154c7033c068a5d4c1dc5f9163b814b3c8 ] + +Commit d644e0d79829 ("phy: mapphone-mdm6600: Fix PM error handling in +phy_mdm6600_probe") caused a regression where we now unconditionally +disable runtime PM at the end of the probe while it is only needed on +errors. + +Cc: Ivaylo Dimitrov +Cc: Merlijn Wajer +Cc: Miaoqian Lin +Cc: Pavel Machek +Reviewed-by: Sebastian Reichel +Fixes: d644e0d79829 ("phy: mapphone-mdm6600: Fix PM error handling in phy_mdm6600_probe") +Signed-off-by: Tony Lindgren +Link: https://lore.kernel.org/r/20230913060433.48373-1-tony@atomide.com +Signed-off-by: Vinod Koul +Signed-off-by: Sasha Levin +--- + drivers/phy/motorola/phy-mapphone-mdm6600.c | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/drivers/phy/motorola/phy-mapphone-mdm6600.c b/drivers/phy/motorola/phy-mapphone-mdm6600.c +index 1d567604b650d..0147112f77b17 100644 +--- a/drivers/phy/motorola/phy-mapphone-mdm6600.c ++++ b/drivers/phy/motorola/phy-mapphone-mdm6600.c +@@ -627,10 +627,12 @@ static int phy_mdm6600_probe(struct platform_device *pdev) + pm_runtime_put_autosuspend(ddata->dev); + + cleanup: +- if (error < 0) ++ if (error < 0) { + phy_mdm6600_device_power_off(ddata); +- pm_runtime_disable(ddata->dev); +- pm_runtime_dont_use_autosuspend(ddata->dev); ++ pm_runtime_disable(ddata->dev); ++ pm_runtime_dont_use_autosuspend(ddata->dev); ++ } ++ + return error; + } + +-- +2.42.0 + diff --git a/queue-6.5/phy-mapphone-mdm6600-fix-runtime-pm-for-remove.patch b/queue-6.5/phy-mapphone-mdm6600-fix-runtime-pm-for-remove.patch new file mode 100644 index 00000000000..911725103c2 --- /dev/null +++ b/queue-6.5/phy-mapphone-mdm6600-fix-runtime-pm-for-remove.patch @@ -0,0 +1,40 @@ +From ffa3997b3db1be52476951fec60a07636169a487 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 13 Sep 2023 09:04:28 +0300 +Subject: phy: mapphone-mdm6600: Fix runtime PM for remove + +From: Tony Lindgren + +[ Upstream commit b99e0ba9633af51638e5ee1668da2e33620c134f ] + +Otherwise we will get an underflow on remove. + +Cc: Ivaylo Dimitrov +Cc: Merlijn Wajer +Cc: Pavel Machek +Cc: Sebastian Reichel +Fixes: f7f50b2a7b05 ("phy: mapphone-mdm6600: Add runtime PM support for n_gsm on USB suspend") +Signed-off-by: Tony Lindgren +Reviewed-by: Sebastian Reichel +Link: https://lore.kernel.org/r/20230913060433.48373-2-tony@atomide.com +Signed-off-by: Vinod Koul +Signed-off-by: Sasha Levin +--- + drivers/phy/motorola/phy-mapphone-mdm6600.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/phy/motorola/phy-mapphone-mdm6600.c b/drivers/phy/motorola/phy-mapphone-mdm6600.c +index 0147112f77b17..df48b1becebe6 100644 +--- a/drivers/phy/motorola/phy-mapphone-mdm6600.c ++++ b/drivers/phy/motorola/phy-mapphone-mdm6600.c +@@ -641,6 +641,7 @@ static void phy_mdm6600_remove(struct platform_device *pdev) + struct phy_mdm6600 *ddata = platform_get_drvdata(pdev); + struct gpio_desc *reset_gpio = ddata->ctrl_gpios[PHY_MDM6600_RESET]; + ++ pm_runtime_get_noresume(ddata->dev); + pm_runtime_dont_use_autosuspend(ddata->dev); + pm_runtime_put_sync(ddata->dev); + pm_runtime_disable(ddata->dev); +-- +2.42.0 + diff --git a/queue-6.5/phy-qcom-qmp-combo-initialize-pcs_usb-registers.patch b/queue-6.5/phy-qcom-qmp-combo-initialize-pcs_usb-registers.patch new file mode 100644 index 00000000000..0079da57ca6 --- /dev/null +++ b/queue-6.5/phy-qcom-qmp-combo-initialize-pcs_usb-registers.patch @@ -0,0 +1,48 @@ +From 21ace2d978014b407d754b8c5fac3f95b26ac005 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 11 Sep 2023 22:07:15 +0200 +Subject: phy: qcom-qmp-combo: initialize PCS_USB registers + +From: Konrad Dybcio + +[ Upstream commit 76d20290d0c66a84a7a40c6231e73d1ab25994e5 ] + +Currently, PCS_USB registers that have their initialization data in a +pcs_usb_tbl table are never initialized. Fix that. + +Fixes: fc64623637da ("phy: qcom-qmp-combo,usb: add support for separate PCS_USB region") +Reported-by: Adrien Thierry +Reviewed-by: Dmitry Baryshkov +Signed-off-by: Konrad Dybcio +Link: https://lore.kernel.org/r/20230829-topic-8550_usbphy-v3-2-34ec434194c5@linaro.org +Signed-off-by: Vinod Koul +Signed-off-by: Sasha Levin +--- + drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c +index 48639b88a1e28..3e6bec4c4d6ce 100644 +--- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c ++++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c +@@ -2649,6 +2649,7 @@ static int qmp_combo_usb_power_on(struct phy *phy) + void __iomem *tx2 = qmp->tx2; + void __iomem *rx2 = qmp->rx2; + void __iomem *pcs = qmp->pcs; ++ void __iomem *pcs_usb = qmp->pcs_usb; + void __iomem *status; + unsigned int val; + int ret; +@@ -2670,6 +2671,9 @@ static int qmp_combo_usb_power_on(struct phy *phy) + + qmp_combo_configure(pcs, cfg->pcs_tbl, cfg->pcs_tbl_num); + ++ if (pcs_usb) ++ qmp_combo_configure(pcs_usb, cfg->pcs_usb_tbl, cfg->pcs_usb_tbl_num); ++ + if (cfg->has_pwrdn_delay) + usleep_range(10, 20); + +-- +2.42.0 + diff --git a/queue-6.5/phy-qcom-qmp-combo-square-out-8550-power_state_confi.patch b/queue-6.5/phy-qcom-qmp-combo-square-out-8550-power_state_confi.patch new file mode 100644 index 00000000000..aeda3b9f180 --- /dev/null +++ b/queue-6.5/phy-qcom-qmp-combo-square-out-8550-power_state_confi.patch @@ -0,0 +1,68 @@ +From 4fb994cb341b847d021244c606b7d14141f19626 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 11 Sep 2023 22:07:14 +0200 +Subject: phy: qcom-qmp-combo: Square out 8550 POWER_STATE_CONFIG1 + +From: Konrad Dybcio + +[ Upstream commit 112c23705c6dc59a05290c8e3e597e1b4e9c23fc ] + +There are two instances of the POWER_STATE_CONFIG1 register: one in +the PCS space and another one in PCS_USB. + +The downstream init sequence pokes the latter one while we've been poking +the former one (and misnamed it as the latter one, impostor!). Fix that +up to avoid UB. + +Fixes: 49742e9edab3 ("phy: qcom-qmp-combo: Add support for SM8550") +Reviewed-by: Abel Vesa +Reviewed-by: Dmitry Baryshkov +Signed-off-by: Konrad Dybcio +Link: https://lore.kernel.org/r/20230829-topic-8550_usbphy-v3-1-34ec434194c5@linaro.org +Signed-off-by: Vinod Koul +Signed-off-by: Sasha Levin +--- + drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 2 +- + drivers/phy/qualcomm/phy-qcom-qmp-pcs-usb-v6.h | 3 ++- + 2 files changed, 3 insertions(+), 2 deletions(-) + +diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c +index bebce8c591a30..48639b88a1e28 100644 +--- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c ++++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c +@@ -772,10 +772,10 @@ static const struct qmp_phy_init_tbl sm8550_usb3_pcs_tbl[] = { + QMP_PHY_INIT_CFG(QPHY_USB_V6_PCS_PCS_TX_RX_CONFIG, 0x0c), + QMP_PHY_INIT_CFG(QPHY_USB_V6_PCS_EQ_CONFIG1, 0x4b), + QMP_PHY_INIT_CFG(QPHY_USB_V6_PCS_EQ_CONFIG5, 0x10), +- QMP_PHY_INIT_CFG(QPHY_USB_V6_PCS_USB3_POWER_STATE_CONFIG1, 0x68), + }; + + static const struct qmp_phy_init_tbl sm8550_usb3_pcs_usb_tbl[] = { ++ QMP_PHY_INIT_CFG(QPHY_USB_V6_PCS_USB3_POWER_STATE_CONFIG1, 0x68), + QMP_PHY_INIT_CFG(QPHY_USB_V6_PCS_USB3_LFPS_DET_HIGH_COUNT_VAL, 0xf8), + QMP_PHY_INIT_CFG(QPHY_USB_V6_PCS_USB3_RXEQTRAINING_DFE_TIME_S2, 0x07), + QMP_PHY_INIT_CFG(QPHY_USB_V6_PCS_USB3_RCVR_DTCT_DLY_U3_L, 0x40), +diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-pcs-usb-v6.h b/drivers/phy/qualcomm/phy-qcom-qmp-pcs-usb-v6.h +index 9510e63ba9d8a..c38530d6776b4 100644 +--- a/drivers/phy/qualcomm/phy-qcom-qmp-pcs-usb-v6.h ++++ b/drivers/phy/qualcomm/phy-qcom-qmp-pcs-usb-v6.h +@@ -12,7 +12,7 @@ + #define QPHY_USB_V6_PCS_LOCK_DETECT_CONFIG3 0xcc + #define QPHY_USB_V6_PCS_LOCK_DETECT_CONFIG6 0xd8 + #define QPHY_USB_V6_PCS_REFGEN_REQ_CONFIG1 0xdc +-#define QPHY_USB_V6_PCS_USB3_POWER_STATE_CONFIG1 0x90 ++#define QPHY_USB_V6_PCS_POWER_STATE_CONFIG1 0x90 + #define QPHY_USB_V6_PCS_RX_SIGDET_LVL 0x188 + #define QPHY_USB_V6_PCS_RCVR_DTCT_DLY_P1U2_L 0x190 + #define QPHY_USB_V6_PCS_RCVR_DTCT_DLY_P1U2_H 0x194 +@@ -23,6 +23,7 @@ + #define QPHY_USB_V6_PCS_EQ_CONFIG1 0x1dc + #define QPHY_USB_V6_PCS_EQ_CONFIG5 0x1ec + ++#define QPHY_USB_V6_PCS_USB3_POWER_STATE_CONFIG1 0x00 + #define QPHY_USB_V6_PCS_USB3_LFPS_DET_HIGH_COUNT_VAL 0x18 + #define QPHY_USB_V6_PCS_USB3_RXEQTRAINING_DFE_TIME_S2 0x3c + #define QPHY_USB_V6_PCS_USB3_RCVR_DTCT_DLY_U3_L 0x40 +-- +2.42.0 + diff --git a/queue-6.5/phy-qcom-qmp-usb-initialize-pcs_usb-registers.patch b/queue-6.5/phy-qcom-qmp-usb-initialize-pcs_usb-registers.patch new file mode 100644 index 00000000000..751d879cc32 --- /dev/null +++ b/queue-6.5/phy-qcom-qmp-usb-initialize-pcs_usb-registers.patch @@ -0,0 +1,47 @@ +From 95cbd34b914f888d93f1644214d146a158835872 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 28 Aug 2023 11:23:50 -0400 +Subject: phy: qcom-qmp-usb: initialize PCS_USB registers + +From: Adrien Thierry + +[ Upstream commit 2d3465a75c9f83684d17da6807423824bf260524 ] + +Currently, PCS_USB registers that have their initialization data in a +pcs_usb_tbl table are never initialized. Fix that. + +Fixes: fc64623637da ("phy: qcom-qmp-combo,usb: add support for separate PCS_USB region") +Signed-off-by: Adrien Thierry +Reviewed-by: Dmitry Baryshkov +Link: https://lore.kernel.org/r/20230828152353.16529-2-athierry@redhat.com +Signed-off-by: Vinod Koul +Signed-off-by: Sasha Levin +--- + drivers/phy/qualcomm/phy-qcom-qmp-usb.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-usb.c b/drivers/phy/qualcomm/phy-qcom-qmp-usb.c +index 466f0a56c82e1..f9cb60f12575b 100644 +--- a/drivers/phy/qualcomm/phy-qcom-qmp-usb.c ++++ b/drivers/phy/qualcomm/phy-qcom-qmp-usb.c +@@ -2233,6 +2233,7 @@ static int qmp_usb_power_on(struct phy *phy) + void __iomem *tx = qmp->tx; + void __iomem *rx = qmp->rx; + void __iomem *pcs = qmp->pcs; ++ void __iomem *pcs_usb = qmp->pcs_usb; + void __iomem *status; + unsigned int val; + int ret; +@@ -2256,6 +2257,9 @@ static int qmp_usb_power_on(struct phy *phy) + + qmp_usb_configure(pcs, cfg->pcs_tbl, cfg->pcs_tbl_num); + ++ if (pcs_usb) ++ qmp_usb_configure(pcs_usb, cfg->pcs_usb_tbl, cfg->pcs_usb_tbl_num); ++ + if (cfg->has_pwrdn_delay) + usleep_range(10, 20); + +-- +2.42.0 + diff --git a/queue-6.5/phy-qcom-qmp-usb-split-pcs_usb-init-table-for-sc8280.patch b/queue-6.5/phy-qcom-qmp-usb-split-pcs_usb-init-table-for-sc8280.patch new file mode 100644 index 00000000000..ac984dfaff7 --- /dev/null +++ b/queue-6.5/phy-qcom-qmp-usb-split-pcs_usb-init-table-for-sc8280.patch @@ -0,0 +1,94 @@ +From 5958a8c35a33fda8d13a85a2cf1f6b391e8965dc Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 28 Aug 2023 11:23:51 -0400 +Subject: phy: qcom-qmp-usb: split PCS_USB init table for sc8280xp and sa8775p + +From: Adrien Thierry + +[ Upstream commit c599dc5cca4dd6a5c664e4a8837246e68a96cb4c ] + +For sc8280xp and sa8775p, PCS and PCS_USB initialization data is +described in the same table, thus the pcs_usb offset is not being +applied during initialization of PCS_USB registers. Fix this by adding +the appropriate pcs_usb_tbl tables. + +Fixes: 8bd2d6e11c99 ("phy: qcom-qmp: Add SA8775P USB3 UNI phy") +Fixes: c0c7769cdae2 ("phy: qcom-qmp: Add SC8280XP USB3 UNI phy") +Reviewed-by: Dmitry Baryshkov +Signed-off-by: Adrien Thierry +Link: https://lore.kernel.org/r/20230828152353.16529-3-athierry@redhat.com +Signed-off-by: Vinod Koul +Signed-off-by: Sasha Levin +--- + drivers/phy/qualcomm/phy-qcom-qmp-usb.c | 20 +++++++++++++++----- + 1 file changed, 15 insertions(+), 5 deletions(-) + +diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-usb.c b/drivers/phy/qualcomm/phy-qcom-qmp-usb.c +index f9cb60f12575b..575329004b901 100644 +--- a/drivers/phy/qualcomm/phy-qcom-qmp-usb.c ++++ b/drivers/phy/qualcomm/phy-qcom-qmp-usb.c +@@ -1480,8 +1480,6 @@ static const struct qmp_phy_init_tbl sc8280xp_usb3_uniphy_pcs_tbl[] = { + QMP_PHY_INIT_CFG(QPHY_V5_PCS_RCVR_DTCT_DLY_P1U2_H, 0x03), + QMP_PHY_INIT_CFG(QPHY_V5_PCS_RX_SIGDET_LVL, 0xaa), + QMP_PHY_INIT_CFG(QPHY_V5_PCS_PCS_TX_RX_CONFIG, 0x0c), +- QMP_PHY_INIT_CFG(QPHY_V5_PCS_USB3_RXEQTRAINING_DFE_TIME_S2, 0x07), +- QMP_PHY_INIT_CFG(QPHY_V5_PCS_USB3_LFPS_DET_HIGH_COUNT_VAL, 0xf8), + QMP_PHY_INIT_CFG(QPHY_V5_PCS_CDR_RESET_TIME, 0x0a), + QMP_PHY_INIT_CFG(QPHY_V5_PCS_ALIGN_DETECT_CONFIG1, 0x88), + QMP_PHY_INIT_CFG(QPHY_V5_PCS_ALIGN_DETECT_CONFIG2, 0x13), +@@ -1490,6 +1488,11 @@ static const struct qmp_phy_init_tbl sc8280xp_usb3_uniphy_pcs_tbl[] = { + QMP_PHY_INIT_CFG(QPHY_V5_PCS_REFGEN_REQ_CONFIG1, 0x21), + }; + ++static const struct qmp_phy_init_tbl sc8280xp_usb3_uniphy_pcs_usb_tbl[] = { ++ QMP_PHY_INIT_CFG(QPHY_V5_PCS_USB3_RXEQTRAINING_DFE_TIME_S2, 0x07), ++ QMP_PHY_INIT_CFG(QPHY_V5_PCS_USB3_LFPS_DET_HIGH_COUNT_VAL, 0xf8), ++}; ++ + static const struct qmp_phy_init_tbl sa8775p_usb3_uniphy_pcs_tbl[] = { + QMP_PHY_INIT_CFG(QPHY_V5_PCS_LOCK_DETECT_CONFIG1, 0xc4), + QMP_PHY_INIT_CFG(QPHY_V5_PCS_LOCK_DETECT_CONFIG2, 0x89), +@@ -1499,9 +1502,6 @@ static const struct qmp_phy_init_tbl sa8775p_usb3_uniphy_pcs_tbl[] = { + QMP_PHY_INIT_CFG(QPHY_V5_PCS_RCVR_DTCT_DLY_P1U2_H, 0x03), + QMP_PHY_INIT_CFG(QPHY_V5_PCS_RX_SIGDET_LVL, 0xaa), + QMP_PHY_INIT_CFG(QPHY_V5_PCS_PCS_TX_RX_CONFIG, 0x0c), +- QMP_PHY_INIT_CFG(QPHY_V5_PCS_USB3_RXEQTRAINING_DFE_TIME_S2, 0x07), +- QMP_PHY_INIT_CFG(QPHY_V5_PCS_USB3_LFPS_DET_HIGH_COUNT_VAL, 0xf8), +- QMP_PHY_INIT_CFG(QPHY_V5_PCS_USB3_POWER_STATE_CONFIG1, 0x6f), + QMP_PHY_INIT_CFG(QPHY_V5_PCS_CDR_RESET_TIME, 0x0a), + QMP_PHY_INIT_CFG(QPHY_V5_PCS_ALIGN_DETECT_CONFIG1, 0x88), + QMP_PHY_INIT_CFG(QPHY_V5_PCS_ALIGN_DETECT_CONFIG2, 0x13), +@@ -1510,6 +1510,12 @@ static const struct qmp_phy_init_tbl sa8775p_usb3_uniphy_pcs_tbl[] = { + QMP_PHY_INIT_CFG(QPHY_V5_PCS_REFGEN_REQ_CONFIG1, 0x21), + }; + ++static const struct qmp_phy_init_tbl sa8775p_usb3_uniphy_pcs_usb_tbl[] = { ++ QMP_PHY_INIT_CFG(QPHY_V5_PCS_USB3_RXEQTRAINING_DFE_TIME_S2, 0x07), ++ QMP_PHY_INIT_CFG(QPHY_V5_PCS_USB3_LFPS_DET_HIGH_COUNT_VAL, 0xf8), ++ QMP_PHY_INIT_CFG(QPHY_V5_PCS_USB3_POWER_STATE_CONFIG1, 0x6f), ++}; ++ + struct qmp_usb_offsets { + u16 serdes; + u16 pcs; +@@ -1788,6 +1794,8 @@ static const struct qmp_phy_cfg sa8775p_usb3_uniphy_cfg = { + .rx_tbl_num = ARRAY_SIZE(sc8280xp_usb3_uniphy_rx_tbl), + .pcs_tbl = sa8775p_usb3_uniphy_pcs_tbl, + .pcs_tbl_num = ARRAY_SIZE(sa8775p_usb3_uniphy_pcs_tbl), ++ .pcs_usb_tbl = sa8775p_usb3_uniphy_pcs_usb_tbl, ++ .pcs_usb_tbl_num = ARRAY_SIZE(sa8775p_usb3_uniphy_pcs_usb_tbl), + .clk_list = qmp_v4_phy_clk_l, + .num_clks = ARRAY_SIZE(qmp_v4_phy_clk_l), + .reset_list = qcm2290_usb3phy_reset_l, +@@ -1833,6 +1841,8 @@ static const struct qmp_phy_cfg sc8280xp_usb3_uniphy_cfg = { + .rx_tbl_num = ARRAY_SIZE(sc8280xp_usb3_uniphy_rx_tbl), + .pcs_tbl = sc8280xp_usb3_uniphy_pcs_tbl, + .pcs_tbl_num = ARRAY_SIZE(sc8280xp_usb3_uniphy_pcs_tbl), ++ .pcs_usb_tbl = sc8280xp_usb3_uniphy_pcs_usb_tbl, ++ .pcs_usb_tbl_num = ARRAY_SIZE(sc8280xp_usb3_uniphy_pcs_usb_tbl), + .clk_list = qmp_v4_phy_clk_l, + .num_clks = ARRAY_SIZE(qmp_v4_phy_clk_l), + .reset_list = qcm2290_usb3phy_reset_l, +-- +2.42.0 + diff --git a/queue-6.5/series b/queue-6.5/series index d241d33cb90..f5509a62b7f 100644 --- a/queue-6.5/series +++ b/queue-6.5/series @@ -226,3 +226,11 @@ powerpc-qspinlock-fix-stale-propagated-yield_cpu.patch net-make-sure-we-never-create-ifindex-0.patch docs-move-rustdoc-output-cross-reference-it.patch rust-docs-fix-logo-replacement.patch +phy-mapphone-mdm6600-fix-runtime-disable-on-probe.patch +phy-mapphone-mdm6600-fix-runtime-pm-for-remove.patch +phy-mapphone-mdm6600-fix-pinctrl_pm-handling-for-sle.patch +phy-qcom-qmp-usb-initialize-pcs_usb-registers.patch +phy-qcom-qmp-usb-split-pcs_usb-init-table-for-sc8280.patch +phy-qcom-qmp-combo-square-out-8550-power_state_confi.patch +phy-qcom-qmp-combo-initialize-pcs_usb-registers.patch +efi-unaccepted-fix-soft-lockups-caused-by-parallel-m.patch -- 2.47.3