]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
6.1-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 1 Jul 2024 14:04:22 +0000 (16:04 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 1 Jul 2024 14:04:22 +0000 (16:04 +0200)
added patches:
iio-accel-fxls8962af-select-iio_buffer-iio_kfifo_buf.patch
iio-adc-ad7266-fix-variable-checking-bug.patch
iio-chemical-bme680-fix-calibration-data-variable.patch
iio-chemical-bme680-fix-overflows-in-compensate-functions.patch
iio-chemical-bme680-fix-pressure-value-output.patch
iio-chemical-bme680-fix-sensor-data-read-operation.patch
net-usb-ax88179_178a-improve-link-status-logs.patch
usb-atm-cxacru-fix-endpoint-checking-in-cxacru_bind.patch
usb-dwc3-core-remove-lock-of-otg-mode-during-gadget-suspend-resume-to-avoid-deadlock.patch
usb-gadget-aspeed_udc-fix-device-address-configuration.patch
usb-gadget-printer-fix-races-against-disable.patch
usb-gadget-printer-ss-support.patch
usb-musb-da8xx-fix-a-resource-leak-in-probe.patch
usb-ucsi-stm32-fix-command-completion-handling.patch

15 files changed:
queue-6.1/iio-accel-fxls8962af-select-iio_buffer-iio_kfifo_buf.patch [new file with mode: 0644]
queue-6.1/iio-adc-ad7266-fix-variable-checking-bug.patch [new file with mode: 0644]
queue-6.1/iio-chemical-bme680-fix-calibration-data-variable.patch [new file with mode: 0644]
queue-6.1/iio-chemical-bme680-fix-overflows-in-compensate-functions.patch [new file with mode: 0644]
queue-6.1/iio-chemical-bme680-fix-pressure-value-output.patch [new file with mode: 0644]
queue-6.1/iio-chemical-bme680-fix-sensor-data-read-operation.patch [new file with mode: 0644]
queue-6.1/net-usb-ax88179_178a-improve-link-status-logs.patch [new file with mode: 0644]
queue-6.1/series
queue-6.1/usb-atm-cxacru-fix-endpoint-checking-in-cxacru_bind.patch [new file with mode: 0644]
queue-6.1/usb-dwc3-core-remove-lock-of-otg-mode-during-gadget-suspend-resume-to-avoid-deadlock.patch [new file with mode: 0644]
queue-6.1/usb-gadget-aspeed_udc-fix-device-address-configuration.patch [new file with mode: 0644]
queue-6.1/usb-gadget-printer-fix-races-against-disable.patch [new file with mode: 0644]
queue-6.1/usb-gadget-printer-ss-support.patch [new file with mode: 0644]
queue-6.1/usb-musb-da8xx-fix-a-resource-leak-in-probe.patch [new file with mode: 0644]
queue-6.1/usb-ucsi-stm32-fix-command-completion-handling.patch [new file with mode: 0644]

diff --git a/queue-6.1/iio-accel-fxls8962af-select-iio_buffer-iio_kfifo_buf.patch b/queue-6.1/iio-accel-fxls8962af-select-iio_buffer-iio_kfifo_buf.patch
new file mode 100644 (file)
index 0000000..c92f8ba
--- /dev/null
@@ -0,0 +1,35 @@
+From a821d7111e3f7c8869961b606714a299bfe20014 Mon Sep 17 00:00:00 2001
+From: Alexander Sverdlin <alexander.sverdlin@siemens.com>
+Date: Wed, 5 Jun 2024 22:38:06 +0200
+Subject: iio: accel: fxls8962af: select IIO_BUFFER & IIO_KFIFO_BUF
+
+From: Alexander Sverdlin <alexander.sverdlin@siemens.com>
+
+commit a821d7111e3f7c8869961b606714a299bfe20014 upstream.
+
+Provide missing symbols to the module:
+ERROR: modpost: iio_push_to_buffers [drivers/iio/accel/fxls8962af-core.ko] undefined!
+ERROR: modpost: devm_iio_kfifo_buffer_setup_ext [drivers/iio/accel/fxls8962af-core.ko] undefined!
+
+Cc: stable@vger.kernel.org
+Fixes: 79e3a5bdd9ef ("iio: accel: fxls8962af: add hw buffered sampling")
+Signed-off-by: Alexander Sverdlin <alexander.sverdlin@siemens.com>
+Reviewed-by: Sean Nyekjaer <sean@geanix.com>
+Link: https://lore.kernel.org/r/20240605203810.2908980-2-alexander.sverdlin@siemens.com
+Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/iio/accel/Kconfig |    2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/drivers/iio/accel/Kconfig
++++ b/drivers/iio/accel/Kconfig
+@@ -325,6 +325,8 @@ config DMARD10
+ config FXLS8962AF
+       tristate
+       depends on I2C || !I2C # cannot be built-in for modular I2C
++      select IIO_BUFFER
++      select IIO_KFIFO_BUF
+ config FXLS8962AF_I2C
+       tristate "NXP FXLS8962AF/FXLS8964AF Accelerometer I2C Driver"
diff --git a/queue-6.1/iio-adc-ad7266-fix-variable-checking-bug.patch b/queue-6.1/iio-adc-ad7266-fix-variable-checking-bug.patch
new file mode 100644 (file)
index 0000000..3e06527
--- /dev/null
@@ -0,0 +1,33 @@
+From a2b86132955268b2a1703082fbc2d4832fc001b8 Mon Sep 17 00:00:00 2001
+From: Fernando Yang <hagisf@usp.br>
+Date: Mon, 3 Jun 2024 15:07:54 -0300
+Subject: iio: adc: ad7266: Fix variable checking bug
+
+From: Fernando Yang <hagisf@usp.br>
+
+commit a2b86132955268b2a1703082fbc2d4832fc001b8 upstream.
+
+The ret variable was not checked after iio_device_release_direct_mode(),
+which could possibly cause errors
+
+Fixes: c70df20e3159 ("iio: adc: ad7266: claim direct mode during sensor read")
+Signed-off-by: Fernando Yang <hagisf@usp.br>
+Link: https://lore.kernel.org/r/20240603180757.8560-1-hagisf@usp.br
+Cc: <Stable@vger.kernel.org>
+Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/iio/adc/ad7266.c |    2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/drivers/iio/adc/ad7266.c
++++ b/drivers/iio/adc/ad7266.c
+@@ -157,6 +157,8 @@ static int ad7266_read_raw(struct iio_de
+               ret = ad7266_read_single(st, val, chan->address);
+               iio_device_release_direct_mode(indio_dev);
++              if (ret < 0)
++                      return ret;
+               *val = (*val >> 2) & 0xfff;
+               if (chan->scan_type.sign == 's')
+                       *val = sign_extend32(*val,
diff --git a/queue-6.1/iio-chemical-bme680-fix-calibration-data-variable.patch b/queue-6.1/iio-chemical-bme680-fix-calibration-data-variable.patch
new file mode 100644 (file)
index 0000000..0c4821a
--- /dev/null
@@ -0,0 +1,35 @@
+From b47c0fee73a810c4503c4a94ea34858a1d865bba Mon Sep 17 00:00:00 2001
+From: Vasileios Amoiridis <vassilisamir@gmail.com>
+Date: Thu, 6 Jun 2024 23:22:54 +0200
+Subject: iio: chemical: bme680: Fix calibration data variable
+
+From: Vasileios Amoiridis <vassilisamir@gmail.com>
+
+commit b47c0fee73a810c4503c4a94ea34858a1d865bba upstream.
+
+According to the BME68x Sensor API [1], the h6 calibration
+data variable should be an unsigned integer of size 8.
+
+[1]: https://github.com/boschsensortec/BME68x_SensorAPI/blob/v4.4.8/bme68x_defs.h#L789
+
+Fixes: 1b3bd8592780 ("iio: chemical: Add support for Bosch BME680 sensor")
+Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com>
+Link: https://lore.kernel.org/r/20240606212313.207550-3-vassilisamir@gmail.com
+Cc: <Stable@vger.kernel.org>
+Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/iio/chemical/bme680_core.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/iio/chemical/bme680_core.c
++++ b/drivers/iio/chemical/bme680_core.c
+@@ -38,7 +38,7 @@ struct bme680_calib {
+       s8  par_h3;
+       s8  par_h4;
+       s8  par_h5;
+-      s8  par_h6;
++      u8  par_h6;
+       s8  par_h7;
+       s8  par_gh1;
+       s16 par_gh2;
diff --git a/queue-6.1/iio-chemical-bme680-fix-overflows-in-compensate-functions.patch b/queue-6.1/iio-chemical-bme680-fix-overflows-in-compensate-functions.patch
new file mode 100644 (file)
index 0000000..53b57d3
--- /dev/null
@@ -0,0 +1,72 @@
+From fdd478c3ae98c3f13628e110dce9b6cfb0d9b3c8 Mon Sep 17 00:00:00 2001
+From: Vasileios Amoiridis <vassilisamir@gmail.com>
+Date: Thu, 6 Jun 2024 23:22:55 +0200
+Subject: iio: chemical: bme680: Fix overflows in compensate() functions
+
+From: Vasileios Amoiridis <vassilisamir@gmail.com>
+
+commit fdd478c3ae98c3f13628e110dce9b6cfb0d9b3c8 upstream.
+
+There are cases in the compensate functions of the driver that
+there could be overflows of variables due to bit shifting ops.
+These implications were initially discussed here [1] and they
+were mentioned in log message of Commit 1b3bd8592780 ("iio:
+chemical: Add support for Bosch BME680 sensor").
+
+[1]: https://lore.kernel.org/linux-iio/20180728114028.3c1bbe81@archlinux/
+
+Fixes: 1b3bd8592780 ("iio: chemical: Add support for Bosch BME680 sensor")
+Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com>
+Link: https://lore.kernel.org/r/20240606212313.207550-4-vassilisamir@gmail.com
+Cc: <Stable@vger.kernel.org>
+Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/iio/chemical/bme680_core.c |   12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+--- a/drivers/iio/chemical/bme680_core.c
++++ b/drivers/iio/chemical/bme680_core.c
+@@ -342,10 +342,10 @@ static s16 bme680_compensate_temp(struct
+       if (!calib->par_t2)
+               bme680_read_calib(data, calib);
+-      var1 = (adc_temp >> 3) - (calib->par_t1 << 1);
++      var1 = (adc_temp >> 3) - ((s32)calib->par_t1 << 1);
+       var2 = (var1 * calib->par_t2) >> 11;
+       var3 = ((var1 >> 1) * (var1 >> 1)) >> 12;
+-      var3 = (var3 * (calib->par_t3 << 4)) >> 14;
++      var3 = (var3 * ((s32)calib->par_t3 << 4)) >> 14;
+       data->t_fine = var2 + var3;
+       calc_temp = (data->t_fine * 5 + 128) >> 8;
+@@ -368,9 +368,9 @@ static u32 bme680_compensate_press(struc
+       var1 = (data->t_fine >> 1) - 64000;
+       var2 = ((((var1 >> 2) * (var1 >> 2)) >> 11) * calib->par_p6) >> 2;
+       var2 = var2 + (var1 * calib->par_p5 << 1);
+-      var2 = (var2 >> 2) + (calib->par_p4 << 16);
++      var2 = (var2 >> 2) + ((s32)calib->par_p4 << 16);
+       var1 = (((((var1 >> 2) * (var1 >> 2)) >> 13) *
+-                      (calib->par_p3 << 5)) >> 3) +
++                      ((s32)calib->par_p3 << 5)) >> 3) +
+                       ((calib->par_p2 * var1) >> 1);
+       var1 = var1 >> 18;
+       var1 = ((32768 + var1) * calib->par_p1) >> 15;
+@@ -388,7 +388,7 @@ static u32 bme680_compensate_press(struc
+       var3 = ((press_comp >> 8) * (press_comp >> 8) *
+                       (press_comp >> 8) * calib->par_p10) >> 17;
+-      press_comp += (var1 + var2 + var3 + (calib->par_p7 << 7)) >> 4;
++      press_comp += (var1 + var2 + var3 + ((s32)calib->par_p7 << 7)) >> 4;
+       return press_comp;
+ }
+@@ -414,7 +414,7 @@ static u32 bme680_compensate_humid(struc
+                (((temp_scaled * ((temp_scaled * calib->par_h5) / 100))
+                  >> 6) / 100) + (1 << 14))) >> 10;
+       var3 = var1 * var2;
+-      var4 = calib->par_h6 << 7;
++      var4 = (s32)calib->par_h6 << 7;
+       var4 = (var4 + ((temp_scaled * calib->par_h7) / 100)) >> 4;
+       var5 = ((var3 >> 14) * (var3 >> 14)) >> 10;
+       var6 = (var4 * var5) >> 1;
diff --git a/queue-6.1/iio-chemical-bme680-fix-pressure-value-output.patch b/queue-6.1/iio-chemical-bme680-fix-pressure-value-output.patch
new file mode 100644 (file)
index 0000000..795c295
--- /dev/null
@@ -0,0 +1,38 @@
+From ae1f7b93b52095be6776d0f34957b4f35dda44d9 Mon Sep 17 00:00:00 2001
+From: Vasileios Amoiridis <vassilisamir@gmail.com>
+Date: Thu, 6 Jun 2024 23:22:53 +0200
+Subject: iio: chemical: bme680: Fix pressure value output
+
+From: Vasileios Amoiridis <vassilisamir@gmail.com>
+
+commit ae1f7b93b52095be6776d0f34957b4f35dda44d9 upstream.
+
+The IIO standard units are measured in kPa while the driver
+is using hPa.
+
+Apart from checking the userspace value itself, it is mentioned also
+in the Bosch API [1] that the pressure value is in Pascal.
+
+[1]: https://github.com/boschsensortec/BME68x_SensorAPI/blob/v4.4.8/bme68x_defs.h#L742
+
+Fixes: 1b3bd8592780 ("iio: chemical: Add support for Bosch BME680 sensor")
+Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com>
+Link: https://lore.kernel.org/r/20240606212313.207550-2-vassilisamir@gmail.com
+Cc: <Stable@vger.kernel.org>
+Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/iio/chemical/bme680_core.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/iio/chemical/bme680_core.c
++++ b/drivers/iio/chemical/bme680_core.c
+@@ -678,7 +678,7 @@ static int bme680_read_press(struct bme6
+       }
+       *val = bme680_compensate_press(data, adc_press);
+-      *val2 = 100;
++      *val2 = 1000;
+       return IIO_VAL_FRACTIONAL;
+ }
diff --git a/queue-6.1/iio-chemical-bme680-fix-sensor-data-read-operation.patch b/queue-6.1/iio-chemical-bme680-fix-sensor-data-read-operation.patch
new file mode 100644 (file)
index 0000000..c322746
--- /dev/null
@@ -0,0 +1,138 @@
+From 4241665e6ea063a9c1d734de790121a71db763fc Mon Sep 17 00:00:00 2001
+From: Vasileios Amoiridis <vassilisamir@gmail.com>
+Date: Thu, 6 Jun 2024 23:22:56 +0200
+Subject: iio: chemical: bme680: Fix sensor data read operation
+
+From: Vasileios Amoiridis <vassilisamir@gmail.com>
+
+commit 4241665e6ea063a9c1d734de790121a71db763fc upstream.
+
+A read operation is happening as follows:
+
+a) Set sensor to forced mode
+b) Sensor measures values and update data registers and sleeps again
+c) Read data registers
+
+In the current implementation the read operation happens immediately
+after the sensor is set to forced mode so the sensor does not have
+the time to update properly the registers. This leads to the following
+2 problems:
+
+1) The first ever value which is read by the register is always wrong
+2) Every read operation, puts the register into forced mode and reads
+the data that were calculated in the previous conversion.
+
+This behaviour was tested in 2 ways:
+
+1) The internal meas_status_0 register was read before and after every
+read operation in order to verify that the data were ready even before
+the register was set to forced mode and also to check that after the
+forced mode was set the new data were not yet ready.
+
+2) Physically changing the temperature and measuring the temperature
+
+This commit adds the waiting time in between the set of the forced mode
+and the read of the data. The function is taken from the Bosch BME68x
+Sensor API [1].
+
+[1]: https://github.com/boschsensortec/BME68x_SensorAPI/blob/v4.4.8/bme68x.c#L490
+
+Fixes: 1b3bd8592780 ("iio: chemical: Add support for Bosch BME680 sensor")
+Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com>
+Link: https://lore.kernel.org/r/20240606212313.207550-5-vassilisamir@gmail.com
+Cc: <Stable@vger.kernel.org>
+Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/iio/chemical/bme680.h      |    2 +
+ drivers/iio/chemical/bme680_core.c |   46 +++++++++++++++++++++++++++++++++++++
+ 2 files changed, 48 insertions(+)
+
+--- a/drivers/iio/chemical/bme680.h
++++ b/drivers/iio/chemical/bme680.h
+@@ -54,7 +54,9 @@
+ #define   BME680_NB_CONV_MASK                 GENMASK(3, 0)
+ #define BME680_REG_MEAS_STAT_0                        0x1D
++#define   BME680_NEW_DATA_BIT                 BIT(7)
+ #define   BME680_GAS_MEAS_BIT                 BIT(6)
++#define   BME680_MEAS_BIT                     BIT(5)
+ /* Calibration Parameters */
+ #define BME680_T2_LSB_REG     0x8A
+--- a/drivers/iio/chemical/bme680_core.c
++++ b/drivers/iio/chemical/bme680_core.c
+@@ -10,6 +10,7 @@
+  */
+ #include <linux/acpi.h>
+ #include <linux/bitfield.h>
++#include <linux/delay.h>
+ #include <linux/device.h>
+ #include <linux/module.h>
+ #include <linux/log2.h>
+@@ -532,6 +533,43 @@ static u8 bme680_oversampling_to_reg(u8
+       return ilog2(val) + 1;
+ }
++/*
++ * Taken from Bosch BME680 API:
++ * https://github.com/boschsensortec/BME68x_SensorAPI/blob/v4.4.8/bme68x.c#L490
++ */
++static int bme680_wait_for_eoc(struct bme680_data *data)
++{
++      struct device *dev = regmap_get_device(data->regmap);
++      unsigned int check;
++      int ret;
++      /*
++       * (Sum of oversampling ratios * time per oversampling) +
++       * TPH measurement + gas measurement + wait transition from forced mode
++       * + heater duration
++       */
++      int wait_eoc_us = ((data->oversampling_temp + data->oversampling_press +
++                         data->oversampling_humid) * 1936) + (477 * 4) +
++                         (477 * 5) + 1000 + (data->heater_dur * 1000);
++
++      usleep_range(wait_eoc_us, wait_eoc_us + 100);
++
++      ret = regmap_read(data->regmap, BME680_REG_MEAS_STAT_0, &check);
++      if (ret) {
++              dev_err(dev, "failed to read measurement status register.\n");
++              return ret;
++      }
++      if (check & BME680_MEAS_BIT) {
++              dev_err(dev, "Device measurement cycle incomplete.\n");
++              return -EBUSY;
++      }
++      if (!(check & BME680_NEW_DATA_BIT)) {
++              dev_err(dev, "No new data available from the device.\n");
++              return -ENODATA;
++      }
++
++      return 0;
++}
++
+ static int bme680_chip_config(struct bme680_data *data)
+ {
+       struct device *dev = regmap_get_device(data->regmap);
+@@ -622,6 +660,10 @@ static int bme680_read_temp(struct bme68
+       if (ret < 0)
+               return ret;
++      ret = bme680_wait_for_eoc(data);
++      if (ret)
++              return ret;
++
+       ret = regmap_bulk_read(data->regmap, BME680_REG_TEMP_MSB,
+                              &tmp, 3);
+       if (ret < 0) {
+@@ -738,6 +780,10 @@ static int bme680_read_gas(struct bme680
+       if (ret < 0)
+               return ret;
++      ret = bme680_wait_for_eoc(data);
++      if (ret)
++              return ret;
++
+       ret = regmap_read(data->regmap, BME680_REG_MEAS_STAT_0, &check);
+       if (check & BME680_GAS_MEAS_BIT) {
+               dev_err(dev, "gas measurement incomplete\n");
diff --git a/queue-6.1/net-usb-ax88179_178a-improve-link-status-logs.patch b/queue-6.1/net-usb-ax88179_178a-improve-link-status-logs.patch
new file mode 100644 (file)
index 0000000..8e07017
--- /dev/null
@@ -0,0 +1,57 @@
+From 058722ee350c0bdd664e467156feb2bf5d9cc271 Mon Sep 17 00:00:00 2001
+From: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
+Date: Thu, 20 Jun 2024 15:34:31 +0200
+Subject: net: usb: ax88179_178a: improve link status logs
+
+From: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
+
+commit 058722ee350c0bdd664e467156feb2bf5d9cc271 upstream.
+
+Avoid spurious link status logs that may ultimately be wrong; for example,
+if the link is set to down with the cable plugged, then the cable is
+unplugged and after this the link is set to up, the last new log that is
+appearing is incorrectly telling that the link is up.
+
+In order to avoid errors, show link status logs after link_reset
+processing, and in order to avoid spurious as much as possible, only show
+the link loss when some link status change is detected.
+
+cc: stable@vger.kernel.org
+Fixes: e2ca90c276e1 ("ax88179_178a: ASIX AX88179_178A USB 3.0/2.0 to gigabit ethernet adapter driver")
+Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
+Reviewed-by: Simon Horman <horms@kernel.org>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/usb/ax88179_178a.c |    6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+--- a/drivers/net/usb/ax88179_178a.c
++++ b/drivers/net/usb/ax88179_178a.c
+@@ -326,7 +326,8 @@ static void ax88179_status(struct usbnet
+       if (netif_carrier_ok(dev->net) != link) {
+               usbnet_link_change(dev, link, 1);
+-              netdev_info(dev->net, "ax88179 - Link status is: %d\n", link);
++              if (!link)
++                      netdev_info(dev->net, "ax88179 - Link status is: 0\n");
+       }
+ }
+@@ -1540,6 +1541,7 @@ static int ax88179_link_reset(struct usb
+                        GMII_PHY_PHYSR, 2, &tmp16);
+       if (!(tmp16 & GMII_PHY_PHYSR_LINK)) {
++              netdev_info(dev->net, "ax88179 - Link status is: 0\n");
+               return 0;
+       } else if (GMII_PHY_PHYSR_GIGA == (tmp16 & GMII_PHY_PHYSR_SMASK)) {
+               mode |= AX_MEDIUM_GIGAMODE | AX_MEDIUM_EN_125MHZ;
+@@ -1577,6 +1579,8 @@ static int ax88179_link_reset(struct usb
+       netif_carrier_on(dev->net);
++      netdev_info(dev->net, "ax88179 - Link status is: 1\n");
++
+       return 0;
+ }
index c06cd5a61cb44774c224ea4edd897779118cc314..bdfb3cc0e99c06a91f0e9cdc341b0c2ec7d5fd17 100644 (file)
@@ -76,3 +76,17 @@ iio-xilinx-ams-don-t-include-ams_ctrl_channels-in-sc.patch
 counter-ti-eqep-enable-clock-at-probe.patch
 i2c-testunit-don-t-erase-registers-after-stop.patch
 i2c-testunit-discard-write-requests-while-old-comman.patch
+iio-adc-ad7266-fix-variable-checking-bug.patch
+iio-accel-fxls8962af-select-iio_buffer-iio_kfifo_buf.patch
+iio-chemical-bme680-fix-pressure-value-output.patch
+iio-chemical-bme680-fix-calibration-data-variable.patch
+iio-chemical-bme680-fix-overflows-in-compensate-functions.patch
+iio-chemical-bme680-fix-sensor-data-read-operation.patch
+net-usb-ax88179_178a-improve-link-status-logs.patch
+usb-gadget-printer-ss-support.patch
+usb-gadget-printer-fix-races-against-disable.patch
+usb-musb-da8xx-fix-a-resource-leak-in-probe.patch
+usb-atm-cxacru-fix-endpoint-checking-in-cxacru_bind.patch
+usb-dwc3-core-remove-lock-of-otg-mode-during-gadget-suspend-resume-to-avoid-deadlock.patch
+usb-gadget-aspeed_udc-fix-device-address-configuration.patch
+usb-ucsi-stm32-fix-command-completion-handling.patch
diff --git a/queue-6.1/usb-atm-cxacru-fix-endpoint-checking-in-cxacru_bind.patch b/queue-6.1/usb-atm-cxacru-fix-endpoint-checking-in-cxacru_bind.patch
new file mode 100644 (file)
index 0000000..455b6c1
--- /dev/null
@@ -0,0 +1,88 @@
+From 2eabb655a968b862bc0c31629a09f0fbf3c80d51 Mon Sep 17 00:00:00 2001
+From: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
+Date: Sun, 9 Jun 2024 06:15:46 -0700
+Subject: usb: atm: cxacru: fix endpoint checking in cxacru_bind()
+
+From: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
+
+commit 2eabb655a968b862bc0c31629a09f0fbf3c80d51 upstream.
+
+Syzbot is still reporting quite an old issue [1] that occurs due to
+incomplete checking of present usb endpoints. As such, wrong
+endpoints types may be used at urb sumbitting stage which in turn
+triggers a warning in usb_submit_urb().
+
+Fix the issue by verifying that required endpoint types are present
+for both in and out endpoints, taking into account cmd endpoint type.
+
+Unfortunately, this patch has not been tested on real hardware.
+
+[1] Syzbot report:
+usb 1-1: BOGUS urb xfer, pipe 1 != type 3
+WARNING: CPU: 0 PID: 8667 at drivers/usb/core/urb.c:502 usb_submit_urb+0xed2/0x18a0 drivers/usb/core/urb.c:502
+Modules linked in:
+CPU: 0 PID: 8667 Comm: kworker/0:4 Not tainted 5.14.0-rc4-syzkaller #0
+Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
+Workqueue: usb_hub_wq hub_event
+RIP: 0010:usb_submit_urb+0xed2/0x18a0 drivers/usb/core/urb.c:502
+...
+Call Trace:
+ cxacru_cm+0x3c0/0x8e0 drivers/usb/atm/cxacru.c:649
+ cxacru_card_status+0x22/0xd0 drivers/usb/atm/cxacru.c:760
+ cxacru_bind+0x7ac/0x11a0 drivers/usb/atm/cxacru.c:1209
+ usbatm_usb_probe+0x321/0x1ae0 drivers/usb/atm/usbatm.c:1055
+ cxacru_usb_probe+0xdf/0x1e0 drivers/usb/atm/cxacru.c:1363
+ usb_probe_interface+0x315/0x7f0 drivers/usb/core/driver.c:396
+ call_driver_probe drivers/base/dd.c:517 [inline]
+ really_probe+0x23c/0xcd0 drivers/base/dd.c:595
+ __driver_probe_device+0x338/0x4d0 drivers/base/dd.c:747
+ driver_probe_device+0x4c/0x1a0 drivers/base/dd.c:777
+ __device_attach_driver+0x20b/0x2f0 drivers/base/dd.c:894
+ bus_for_each_drv+0x15f/0x1e0 drivers/base/bus.c:427
+ __device_attach+0x228/0x4a0 drivers/base/dd.c:965
+ bus_probe_device+0x1e4/0x290 drivers/base/bus.c:487
+ device_add+0xc2f/0x2180 drivers/base/core.c:3354
+ usb_set_configuration+0x113a/0x1910 drivers/usb/core/message.c:2170
+ usb_generic_driver_probe+0xba/0x100 drivers/usb/core/generic.c:238
+ usb_probe_device+0xd9/0x2c0 drivers/usb/core/driver.c:293
+
+Reported-and-tested-by: syzbot+00c18ee8497dd3be6ade@syzkaller.appspotmail.com
+Fixes: 902ffc3c707c ("USB: cxacru: Use a bulk/int URB to access the command endpoint")
+Cc: stable <stable@kernel.org>
+Signed-off-by: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
+Link: https://lore.kernel.org/r/20240609131546.3932-1-n.zhandarovich@fintech.ru
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/atm/cxacru.c |   14 ++++++++++++++
+ 1 file changed, 14 insertions(+)
+
+--- a/drivers/usb/atm/cxacru.c
++++ b/drivers/usb/atm/cxacru.c
+@@ -1131,6 +1131,7 @@ static int cxacru_bind(struct usbatm_dat
+       struct cxacru_data *instance;
+       struct usb_device *usb_dev = interface_to_usbdev(intf);
+       struct usb_host_endpoint *cmd_ep = usb_dev->ep_in[CXACRU_EP_CMD];
++      struct usb_endpoint_descriptor *in, *out;
+       int ret;
+       /* instance init */
+@@ -1176,6 +1177,19 @@ static int cxacru_bind(struct usbatm_dat
+               ret = -ENODEV;
+               goto fail;
+       }
++
++      if (usb_endpoint_xfer_int(&cmd_ep->desc))
++              ret = usb_find_common_endpoints(intf->cur_altsetting,
++                                              NULL, NULL, &in, &out);
++      else
++              ret = usb_find_common_endpoints(intf->cur_altsetting,
++                                              &in, &out, NULL, NULL);
++
++      if (ret) {
++              usb_err(usbatm_instance, "cxacru_bind: interface has incorrect endpoints\n");
++              ret = -ENODEV;
++              goto fail;
++      }
+       if ((cmd_ep->desc.bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)
+                       == USB_ENDPOINT_XFER_INT) {
diff --git a/queue-6.1/usb-dwc3-core-remove-lock-of-otg-mode-during-gadget-suspend-resume-to-avoid-deadlock.patch b/queue-6.1/usb-dwc3-core-remove-lock-of-otg-mode-during-gadget-suspend-resume-to-avoid-deadlock.patch
new file mode 100644 (file)
index 0000000..f9a0178
--- /dev/null
@@ -0,0 +1,77 @@
+From 7838de15bb700c2898a7d741db9b1f3cbc86c136 Mon Sep 17 00:00:00 2001
+From: Meng Li <Meng.Li@windriver.com>
+Date: Tue, 18 Jun 2024 11:19:18 +0800
+Subject: usb: dwc3: core: remove lock of otg mode during gadget suspend/resume to avoid deadlock
+
+From: Meng Li <Meng.Li@windriver.com>
+
+commit 7838de15bb700c2898a7d741db9b1f3cbc86c136 upstream.
+
+When config CONFIG_USB_DWC3_DUAL_ROLE is selected, and trigger system
+to enter suspend status with below command:
+echo mem > /sys/power/state
+There will be a deadlock issue occurring. Detailed invoking path as
+below:
+dwc3_suspend_common()
+    spin_lock_irqsave(&dwc->lock, flags);              <-- 1st
+    dwc3_gadget_suspend(dwc);
+        dwc3_gadget_soft_disconnect(dwc);
+            spin_lock_irqsave(&dwc->lock, flags);      <-- 2nd
+This issue is exposed by commit c7ebd8149ee5 ("usb: dwc3: gadget: Fix
+NULL pointer dereference in dwc3_gadget_suspend") that removes the code
+of checking whether dwc->gadget_driver is NULL or not. It causes the
+following code is executed and deadlock occurs when trying to get the
+spinlock. In fact, the root cause is the commit 5265397f9442("usb: dwc3:
+Remove DWC3 locking during gadget suspend/resume") that forgot to remove
+the lock of otg mode. So, remove the redundant lock of otg mode during
+gadget suspend/resume.
+
+Fixes: 5265397f9442 ("usb: dwc3: Remove DWC3 locking during gadget suspend/resume")
+Cc: Xu Yang <xu.yang_2@nxp.com>
+Cc: stable@vger.kernel.org
+Signed-off-by: Meng Li <Meng.Li@windriver.com>
+Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
+Link: https://lore.kernel.org/r/20240618031918.2585799-1-Meng.Li@windriver.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/dwc3/core.c |    6 ------
+ 1 file changed, 6 deletions(-)
+
+--- a/drivers/usb/dwc3/core.c
++++ b/drivers/usb/dwc3/core.c
+@@ -2087,7 +2087,6 @@ assert_reset:
+ static int dwc3_suspend_common(struct dwc3 *dwc, pm_message_t msg)
+ {
+-      unsigned long   flags;
+       u32 reg;
+       switch (dwc->current_dr_role) {
+@@ -2125,9 +2124,7 @@ static int dwc3_suspend_common(struct dw
+                       break;
+               if (dwc->current_otg_role == DWC3_OTG_ROLE_DEVICE) {
+-                      spin_lock_irqsave(&dwc->lock, flags);
+                       dwc3_gadget_suspend(dwc);
+-                      spin_unlock_irqrestore(&dwc->lock, flags);
+                       synchronize_irq(dwc->irq_gadget);
+               }
+@@ -2144,7 +2141,6 @@ static int dwc3_suspend_common(struct dw
+ static int dwc3_resume_common(struct dwc3 *dwc, pm_message_t msg)
+ {
+-      unsigned long   flags;
+       int             ret;
+       u32             reg;
+@@ -2193,9 +2189,7 @@ static int dwc3_resume_common(struct dwc
+               if (dwc->current_otg_role == DWC3_OTG_ROLE_HOST) {
+                       dwc3_otg_host_init(dwc);
+               } else if (dwc->current_otg_role == DWC3_OTG_ROLE_DEVICE) {
+-                      spin_lock_irqsave(&dwc->lock, flags);
+                       dwc3_gadget_resume(dwc);
+-                      spin_unlock_irqrestore(&dwc->lock, flags);
+               }
+               break;
diff --git a/queue-6.1/usb-gadget-aspeed_udc-fix-device-address-configuration.patch b/queue-6.1/usb-gadget-aspeed_udc-fix-device-address-configuration.patch
new file mode 100644 (file)
index 0000000..c67ce81
--- /dev/null
@@ -0,0 +1,60 @@
+From dba7567c2fbbf10a4de2471cdb0e16e5572dc007 Mon Sep 17 00:00:00 2001
+From: Jeremy Kerr <jk@codeconstruct.com.au>
+Date: Thu, 13 Jun 2024 12:20:47 +0800
+Subject: usb: gadget: aspeed_udc: fix device address configuration
+
+From: Jeremy Kerr <jk@codeconstruct.com.au>
+
+commit dba7567c2fbbf10a4de2471cdb0e16e5572dc007 upstream.
+
+In the aspeed UDC setup, we configure the UDC hardware with the assigned
+USB device address.
+
+However, we have an off-by-one in the bitmask, so we're only setting the
+lower 6 bits of the address (USB addresses being 7 bits, and the
+hardware bitmask being bits 0:6).
+
+This means that device enumeration fails if the assigned address is
+greater than 64:
+
+[  344.607255] usb 1-1: new high-speed USB device number 63 using ehci-platform
+[  344.808459] usb 1-1: New USB device found, idVendor=cc00, idProduct=cc00, bcdDevice= 6.10
+[  344.817684] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
+[  344.825671] usb 1-1: Product: Test device
+[  344.831075] usb 1-1: Manufacturer: Test vendor
+[  344.836335] usb 1-1: SerialNumber: 00
+[  349.917181] usb 1-1: USB disconnect, device number 63
+[  352.036775] usb 1-1: new high-speed USB device number 64 using ehci-platform
+[  352.249432] usb 1-1: device descriptor read/all, error -71
+[  352.696740] usb 1-1: new high-speed USB device number 65 using ehci-platform
+[  352.909431] usb 1-1: device descriptor read/all, error -71
+
+Use the correct mask of 0x7f (rather than 0x3f), and generate this
+through the GENMASK macro, so we have numbers that correspond exactly
+to the hardware register definition.
+
+Fixes: 055276c13205 ("usb: gadget: add Aspeed ast2600 udc driver")
+Cc: stable@vger.kernel.org
+Reviewed-by: Neal Liu <neal_liu@aspeedtech.com>
+Reviewed-by: Andrew Jeffery <andrew@codeconstruct.com.au>
+Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
+Link: https://lore.kernel.org/r/20240613-aspeed-udc-v2-1-29501ce9cb7a@codeconstruct.com.au
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/gadget/udc/aspeed_udc.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/usb/gadget/udc/aspeed_udc.c
++++ b/drivers/usb/gadget/udc/aspeed_udc.c
+@@ -66,8 +66,8 @@
+ #define USB_UPSTREAM_EN                       BIT(0)
+ /* Main config reg */
+-#define UDC_CFG_SET_ADDR(x)           ((x) & 0x3f)
+-#define UDC_CFG_ADDR_MASK             (0x3f)
++#define UDC_CFG_SET_ADDR(x)           ((x) & UDC_CFG_ADDR_MASK)
++#define UDC_CFG_ADDR_MASK             GENMASK(6, 0)
+ /* Interrupt ctrl & status reg */
+ #define UDC_IRQ_EP_POOL_NAK           BIT(17)
diff --git a/queue-6.1/usb-gadget-printer-fix-races-against-disable.patch b/queue-6.1/usb-gadget-printer-fix-races-against-disable.patch
new file mode 100644 (file)
index 0000000..9ba6118
--- /dev/null
@@ -0,0 +1,140 @@
+From e587a7633dfee8987a999cf253f7c52a8e09276c Mon Sep 17 00:00:00 2001
+From: Oliver Neukum <oneukum@suse.com>
+Date: Thu, 20 Jun 2024 13:40:26 +0200
+Subject: usb: gadget: printer: fix races against disable
+
+From: Oliver Neukum <oneukum@suse.com>
+
+commit e587a7633dfee8987a999cf253f7c52a8e09276c upstream.
+
+printer_read() and printer_write() guard against the race
+against disable() by checking the dev->interface flag,
+which in turn is guarded by a spinlock.
+These functions, however, drop the lock on multiple occasions.
+This means that the test has to be redone after reacquiring
+the lock and before doing IO.
+
+Add the tests.
+
+This also addresses CVE-2024-25741
+
+Fixes: 7f2ca14d2f9b9 ("usb: gadget: function: printer: Interface is disabled and returns error")
+Cc: stable <stable@kernel.org>
+Signed-off-by: Oliver Neukum <oneukum@suse.com>
+Link: https://lore.kernel.org/r/20240620114039.5767-1-oneukum@suse.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/gadget/function/f_printer.c |   39 +++++++++++++++++++++++---------
+ 1 file changed, 29 insertions(+), 10 deletions(-)
+
+--- a/drivers/usb/gadget/function/f_printer.c
++++ b/drivers/usb/gadget/function/f_printer.c
+@@ -448,11 +448,8 @@ printer_read(struct file *fd, char __use
+       mutex_lock(&dev->lock_printer_io);
+       spin_lock_irqsave(&dev->lock, flags);
+-      if (dev->interface < 0) {
+-              spin_unlock_irqrestore(&dev->lock, flags);
+-              mutex_unlock(&dev->lock_printer_io);
+-              return -ENODEV;
+-      }
++      if (dev->interface < 0)
++              goto out_disabled;
+       /* We will use this flag later to check if a printer reset happened
+        * after we turn interrupts back on.
+@@ -460,6 +457,9 @@ printer_read(struct file *fd, char __use
+       dev->reset_printer = 0;
+       setup_rx_reqs(dev);
++      /* this dropped the lock - need to retest */
++      if (dev->interface < 0)
++              goto out_disabled;
+       bytes_copied = 0;
+       current_rx_req = dev->current_rx_req;
+@@ -493,6 +493,8 @@ printer_read(struct file *fd, char __use
+               wait_event_interruptible(dev->rx_wait,
+                               (likely(!list_empty(&dev->rx_buffers))));
+               spin_lock_irqsave(&dev->lock, flags);
++              if (dev->interface < 0)
++                      goto out_disabled;
+       }
+       /* We have data to return then copy it to the caller's buffer.*/
+@@ -536,6 +538,9 @@ printer_read(struct file *fd, char __use
+                       return -EAGAIN;
+               }
++              if (dev->interface < 0)
++                      goto out_disabled;
++
+               /* If we not returning all the data left in this RX request
+                * buffer then adjust the amount of data left in the buffer.
+                * Othewise if we are done with this RX request buffer then
+@@ -565,6 +570,11 @@ printer_read(struct file *fd, char __use
+               return bytes_copied;
+       else
+               return -EAGAIN;
++
++out_disabled:
++      spin_unlock_irqrestore(&dev->lock, flags);
++      mutex_unlock(&dev->lock_printer_io);
++      return -ENODEV;
+ }
+ static ssize_t
+@@ -585,11 +595,8 @@ printer_write(struct file *fd, const cha
+       mutex_lock(&dev->lock_printer_io);
+       spin_lock_irqsave(&dev->lock, flags);
+-      if (dev->interface < 0) {
+-              spin_unlock_irqrestore(&dev->lock, flags);
+-              mutex_unlock(&dev->lock_printer_io);
+-              return -ENODEV;
+-      }
++      if (dev->interface < 0)
++              goto out_disabled;
+       /* Check if a printer reset happens while we have interrupts on */
+       dev->reset_printer = 0;
+@@ -612,6 +619,8 @@ printer_write(struct file *fd, const cha
+               wait_event_interruptible(dev->tx_wait,
+                               (likely(!list_empty(&dev->tx_reqs))));
+               spin_lock_irqsave(&dev->lock, flags);
++              if (dev->interface < 0)
++                      goto out_disabled;
+       }
+       while (likely(!list_empty(&dev->tx_reqs)) && len) {
+@@ -661,6 +670,9 @@ printer_write(struct file *fd, const cha
+                       return -EAGAIN;
+               }
++              if (dev->interface < 0)
++                      goto out_disabled;
++
+               list_add(&req->list, &dev->tx_reqs_active);
+               /* here, we unlock, and only unlock, to avoid deadlock. */
+@@ -673,6 +685,8 @@ printer_write(struct file *fd, const cha
+                       mutex_unlock(&dev->lock_printer_io);
+                       return -EAGAIN;
+               }
++              if (dev->interface < 0)
++                      goto out_disabled;
+       }
+       spin_unlock_irqrestore(&dev->lock, flags);
+@@ -684,6 +698,11 @@ printer_write(struct file *fd, const cha
+               return bytes_copied;
+       else
+               return -EAGAIN;
++
++out_disabled:
++      spin_unlock_irqrestore(&dev->lock, flags);
++      mutex_unlock(&dev->lock_printer_io);
++      return -ENODEV;
+ }
+ static int
diff --git a/queue-6.1/usb-gadget-printer-ss-support.patch b/queue-6.1/usb-gadget-printer-ss-support.patch
new file mode 100644 (file)
index 0000000..4f0f162
--- /dev/null
@@ -0,0 +1,30 @@
+From fd80731e5e9d1402cb2f85022a6abf9b1982ec5f Mon Sep 17 00:00:00 2001
+From: Oliver Neukum <oneukum@suse.com>
+Date: Thu, 20 Jun 2024 11:37:39 +0200
+Subject: usb: gadget: printer: SS+ support
+
+From: Oliver Neukum <oneukum@suse.com>
+
+commit fd80731e5e9d1402cb2f85022a6abf9b1982ec5f upstream.
+
+We need to treat super speed plus as super speed, not the default,
+which is full speed.
+
+Signed-off-by: Oliver Neukum <oneukum@suse.com>
+Cc: stable <stable@kernel.org>
+Link: https://lore.kernel.org/r/20240620093800.28901-1-oneukum@suse.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/gadget/function/f_printer.c |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/usb/gadget/function/f_printer.c
++++ b/drivers/usb/gadget/function/f_printer.c
+@@ -210,6 +210,7 @@ static inline struct usb_endpoint_descri
+                                       struct usb_endpoint_descriptor *ss)
+ {
+       switch (gadget->speed) {
++      case USB_SPEED_SUPER_PLUS:
+       case USB_SPEED_SUPER:
+               return ss;
+       case USB_SPEED_HIGH:
diff --git a/queue-6.1/usb-musb-da8xx-fix-a-resource-leak-in-probe.patch b/queue-6.1/usb-musb-da8xx-fix-a-resource-leak-in-probe.patch
new file mode 100644 (file)
index 0000000..b3c0720
--- /dev/null
@@ -0,0 +1,46 @@
+From de644a4a86be04ed8a43ef8267d0f7d021941c5e Mon Sep 17 00:00:00 2001
+From: Dan Carpenter <dan.carpenter@linaro.org>
+Date: Mon, 17 Jun 2024 12:31:30 +0300
+Subject: usb: musb: da8xx: fix a resource leak in probe()
+
+From: Dan Carpenter <dan.carpenter@linaro.org>
+
+commit de644a4a86be04ed8a43ef8267d0f7d021941c5e upstream.
+
+Call usb_phy_generic_unregister() if of_platform_populate() fails.
+
+Fixes: d6299b6efbf6 ("usb: musb: Add support of CPPI 4.1 DMA controller to DA8xx")
+Cc: stable <stable@kernel.org>
+Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
+Link: https://lore.kernel.org/r/69af1b1d-d3f4-492b-bcea-359ca5949f30@moroto.mountain
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/musb/da8xx.c |    8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+--- a/drivers/usb/musb/da8xx.c
++++ b/drivers/usb/musb/da8xx.c
+@@ -553,7 +553,7 @@ static int da8xx_probe(struct platform_d
+       ret = of_platform_populate(pdev->dev.of_node, NULL,
+                                  da8xx_auxdata_lookup, &pdev->dev);
+       if (ret)
+-              return ret;
++              goto err_unregister_phy;
+       pinfo = da8xx_dev_info;
+       pinfo.parent = &pdev->dev;
+@@ -568,9 +568,13 @@ static int da8xx_probe(struct platform_d
+       ret = PTR_ERR_OR_ZERO(glue->musb);
+       if (ret) {
+               dev_err(&pdev->dev, "failed to register musb device: %d\n", ret);
+-              usb_phy_generic_unregister(glue->usb_phy);
++              goto err_unregister_phy;
+       }
++      return 0;
++
++err_unregister_phy:
++      usb_phy_generic_unregister(glue->usb_phy);
+       return ret;
+ }
diff --git a/queue-6.1/usb-ucsi-stm32-fix-command-completion-handling.patch b/queue-6.1/usb-ucsi-stm32-fix-command-completion-handling.patch
new file mode 100644 (file)
index 0000000..db886ea
--- /dev/null
@@ -0,0 +1,94 @@
+From 8e1ec117efdfd4b2f59f57bd0ad16b4edf5b963f Mon Sep 17 00:00:00 2001
+From: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
+Date: Wed, 12 Jun 2024 14:46:56 +0200
+Subject: usb: ucsi: stm32: fix command completion handling
+
+From: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
+
+commit 8e1ec117efdfd4b2f59f57bd0ad16b4edf5b963f upstream.
+
+Sometimes errors are seen, when doing DR swap, like:
+[   24.672481] ucsi-stm32g0-i2c 0-0035: UCSI_GET_PDOS failed (-5)
+[   24.720188] ucsi-stm32g0-i2c 0-0035: ucsi_handle_connector_change:
+ GET_CONNECTOR_STATUS failed (-5)
+
+There may be some race, which lead to read CCI, before the command complete
+flag is set, hence returning -EIO. Similar fix has been done also in
+ucsi_acpi [1].
+
+In case of a spurious or otherwise delayed notification it is
+possible that CCI still reports the previous completion. The
+UCSI spec is aware of this and provides two completion bits in
+CCI, one for normal commands and one for acks. As acks and commands
+alternate the notification handler can determine if the completion
+bit is from the current command.
+
+To fix this add the ACK_PENDING bit for ucsi_stm32g0 and only complete
+commands if the completion bit matches.
+
+[1] https://lore.kernel.org/lkml/20240121204123.275441-3-lk@c--e.de/
+
+Fixes: 72849d4fcee7 ("usb: typec: ucsi: stm32g0: add support for stm32g0 controller")
+Signed-off-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
+Link: https://lore.kernel.org/stable/20240612124656.2305603-1-fabrice.gasnier%40foss.st.com
+Cc: stable <stable@kernel.org>
+Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
+Link: https://lore.kernel.org/r/20240612124656.2305603-1-fabrice.gasnier@foss.st.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/typec/ucsi/ucsi_stm32g0.c |   19 +++++++++++++++----
+ 1 file changed, 15 insertions(+), 4 deletions(-)
+
+--- a/drivers/usb/typec/ucsi/ucsi_stm32g0.c
++++ b/drivers/usb/typec/ucsi/ucsi_stm32g0.c
+@@ -64,6 +64,7 @@ struct ucsi_stm32g0 {
+       struct completion complete;
+       struct device *dev;
+       unsigned long flags;
++#define ACK_PENDING   2
+       const char *fw_name;
+       struct ucsi *ucsi;
+       bool suspended;
+@@ -395,9 +396,13 @@ static int ucsi_stm32g0_sync_write(struc
+                                  size_t len)
+ {
+       struct ucsi_stm32g0 *g0 = ucsi_get_drvdata(ucsi);
++      bool ack = UCSI_COMMAND(*(u64 *)val) == UCSI_ACK_CC_CI;
+       int ret;
+-      set_bit(COMMAND_PENDING, &g0->flags);
++      if (ack)
++              set_bit(ACK_PENDING, &g0->flags);
++      else
++              set_bit(COMMAND_PENDING, &g0->flags);
+       ret = ucsi_stm32g0_async_write(ucsi, offset, val, len);
+       if (ret)
+@@ -405,9 +410,14 @@ static int ucsi_stm32g0_sync_write(struc
+       if (!wait_for_completion_timeout(&g0->complete, msecs_to_jiffies(5000)))
+               ret = -ETIMEDOUT;
++      else
++              return 0;
+ out_clear_bit:
+-      clear_bit(COMMAND_PENDING, &g0->flags);
++      if (ack)
++              clear_bit(ACK_PENDING, &g0->flags);
++      else
++              clear_bit(COMMAND_PENDING, &g0->flags);
+       return ret;
+ }
+@@ -428,8 +438,9 @@ static irqreturn_t ucsi_stm32g0_irq_hand
+       if (UCSI_CCI_CONNECTOR(cci))
+               ucsi_connector_change(g0->ucsi, UCSI_CCI_CONNECTOR(cci));
+-      if (test_bit(COMMAND_PENDING, &g0->flags) &&
+-          cci & (UCSI_CCI_ACK_COMPLETE | UCSI_CCI_COMMAND_COMPLETE))
++      if (cci & UCSI_CCI_ACK_COMPLETE && test_and_clear_bit(ACK_PENDING, &g0->flags))
++              complete(&g0->complete);
++      if (cci & UCSI_CCI_COMMAND_COMPLETE && test_and_clear_bit(COMMAND_PENDING, &g0->flags))
+               complete(&g0->complete);
+       return IRQ_HANDLED;