]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 4.19
authorSasha Levin <sashal@kernel.org>
Fri, 26 Jan 2024 14:04:46 +0000 (09:04 -0500)
committerSasha Levin <sashal@kernel.org>
Fri, 26 Jan 2024 14:04:46 +0000 (09:04 -0500)
Signed-off-by: Sasha Levin <sashal@kernel.org>
queue-4.19/driver-core-add-device-probe-log-helper.patch [new file with mode: 0644]
queue-4.19/include-linux-units.h-add-helpers-for-kelvin-to-from.patch [new file with mode: 0644]
queue-4.19/pci-mediatek-clear-interrupt-status-before-dispatchi.patch [new file with mode: 0644]
queue-4.19/serial-sc16is7xx-add-check-for-unsupported-spi-modes.patch [new file with mode: 0644]
queue-4.19/serial-sc16is7xx-set-safe-default-spi-clock-frequenc.patch [new file with mode: 0644]
queue-4.19/series [new file with mode: 0644]
queue-4.19/spi-introduce-spi_mode_x_mask-macro.patch [new file with mode: 0644]
queue-4.19/units-add-the-hz-macros.patch [new file with mode: 0644]
queue-4.19/units-add-watt-units.patch [new file with mode: 0644]
queue-4.19/units-change-from-l-to-ul.patch [new file with mode: 0644]

diff --git a/queue-4.19/driver-core-add-device-probe-log-helper.patch b/queue-4.19/driver-core-add-device-probe-log-helper.patch
new file mode 100644 (file)
index 0000000..c639c05
--- /dev/null
@@ -0,0 +1,105 @@
+From 10c8424521598005444a9b2512f393bd01e0f2f2 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 13 Jul 2020 16:43:21 +0200
+Subject: driver core: add device probe log helper
+
+From: Andrzej Hajda <a.hajda@samsung.com>
+
+[ Upstream commit a787e5400a1ceeb0ef92d71ec43aeb35b1fa1334 ]
+
+During probe every time driver gets resource it should usually check for
+error printk some message if it is not -EPROBE_DEFER and return the error.
+This pattern is simple but requires adding few lines after any resource
+acquisition code, as a result it is often omitted or implemented only
+partially.
+dev_err_probe helps to replace such code sequences with simple call,
+so code:
+       if (err != -EPROBE_DEFER)
+               dev_err(dev, ...);
+       return err;
+becomes:
+       return dev_err_probe(dev, err, ...);
+
+Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
+Reviewed-by: Rafael J. Wysocki <rafael@kernel.org>
+Reviewed-by: Mark Brown <broonie@kernel.org>
+Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
+Link: https://lore.kernel.org/r/20200713144324.23654-2-a.hajda@samsung.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Stable-dep-of: 6d710b769c1f ("serial: sc16is7xx: add check for unsupported SPI modes during probe")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/base/core.c    | 42 ++++++++++++++++++++++++++++++++++++++++++
+ include/linux/device.h |  3 +++
+ 2 files changed, 45 insertions(+)
+
+diff --git a/drivers/base/core.c b/drivers/base/core.c
+index 6e380ad9d08a..b66647277d52 100644
+--- a/drivers/base/core.c
++++ b/drivers/base/core.c
+@@ -3334,6 +3334,48 @@ define_dev_printk_level(_dev_info, KERN_INFO);
+ #endif
++/**
++ * dev_err_probe - probe error check and log helper
++ * @dev: the pointer to the struct device
++ * @err: error value to test
++ * @fmt: printf-style format string
++ * @...: arguments as specified in the format string
++ *
++ * This helper implements common pattern present in probe functions for error
++ * checking: print debug or error message depending if the error value is
++ * -EPROBE_DEFER and propagate error upwards.
++ * It replaces code sequence:
++ *    if (err != -EPROBE_DEFER)
++ *            dev_err(dev, ...);
++ *    else
++ *            dev_dbg(dev, ...);
++ *    return err;
++ * with
++ *    return dev_err_probe(dev, err, ...);
++ *
++ * Returns @err.
++ *
++ */
++int dev_err_probe(const struct device *dev, int err, const char *fmt, ...)
++{
++      struct va_format vaf;
++      va_list args;
++
++      va_start(args, fmt);
++      vaf.fmt = fmt;
++      vaf.va = &args;
++
++      if (err != -EPROBE_DEFER)
++              dev_err(dev, "error %d: %pV", err, &vaf);
++      else
++              dev_dbg(dev, "error %d: %pV", err, &vaf);
++
++      va_end(args);
++
++      return err;
++}
++EXPORT_SYMBOL_GPL(dev_err_probe);
++
+ static inline bool fwnode_is_primary(struct fwnode_handle *fwnode)
+ {
+       return fwnode && !IS_ERR(fwnode->secondary);
+diff --git a/include/linux/device.h b/include/linux/device.h
+index bccd367c11de..0714d6e5d500 100644
+--- a/include/linux/device.h
++++ b/include/linux/device.h
+@@ -1581,6 +1581,9 @@ do {                                                                     \
+       WARN_ONCE(condition, "%s %s: " format, \
+                       dev_driver_string(dev), dev_name(dev), ## arg)
++extern __printf(3, 4)
++int dev_err_probe(const struct device *dev, int err, const char *fmt, ...);
++
+ /* Create alias, so I can be autoloaded. */
+ #define MODULE_ALIAS_CHARDEV(major,minor) \
+       MODULE_ALIAS("char-major-" __stringify(major) "-" __stringify(minor))
+-- 
+2.43.0
+
diff --git a/queue-4.19/include-linux-units.h-add-helpers-for-kelvin-to-from.patch b/queue-4.19/include-linux-units.h-add-helpers-for-kelvin-to-from.patch
new file mode 100644 (file)
index 0000000..e143828
--- /dev/null
@@ -0,0 +1,160 @@
+From 49182db4bb8f4aaa0d851d3d469d5505650edbb1 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 30 Jan 2020 22:15:28 -0800
+Subject: include/linux/units.h: add helpers for kelvin to/from Celsius
+ conversion
+
+From: Akinobu Mita <akinobu.mita@gmail.com>
+
+[ Upstream commit 23331e4893614deb555c65cdf115c8a28ed32471 ]
+
+Patch series "add header file for kelvin to/from Celsius conversion
+helpers", v4.
+
+There are several helper macros to convert kelvin to/from Celsius in
+<linux/thermal.h> for thermal drivers.  These are useful for any other
+drivers or subsystems, but it's odd to include <linux/thermal.h> just
+for the helpers.
+
+This adds a new <linux/units.h> that provides the equivalent inline
+functions for any drivers or subsystems, and switches all the users of
+conversion helpers in <linux/thermal.h> to use <linux/units.h> helpers.
+
+This patch (of 12):
+
+There are several helper macros to convert kelvin to/from Celsius in
+<linux/thermal.h> for thermal drivers.  These are useful for any other
+drivers or subsystems, but it's odd to include <linux/thermal.h> just
+for the helpers.
+
+This adds a new <linux/units.h> that provides the equivalent inline
+functions for any drivers or subsystems.  It is intended to replace the
+helpers in <linux/thermal.h>.
+
+Link: http://lkml.kernel.org/r/1576386975-7941-2-git-send-email-akinobu.mita@gmail.com
+Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
+Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
+Cc: Sujith Thomas <sujith.thomas@intel.com>
+Cc: Darren Hart <dvhart@infradead.org>
+Cc: Zhang Rui <rui.zhang@intel.com>
+Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
+Cc: Amit Kucheria <amit.kucheria@verdurent.com>
+Cc: Jean Delvare <jdelvare@suse.com>
+Cc: Guenter Roeck <linux@roeck-us.net>
+Cc: Keith Busch <kbusch@kernel.org>
+Cc: Jens Axboe <axboe@fb.com>
+Cc: Christoph Hellwig <hch@lst.de>
+Cc: Sagi Grimberg <sagi@grimberg.me>
+Cc: Kalle Valo <kvalo@codeaurora.org>
+Cc: Stanislaw Gruszka <sgruszka@redhat.com>
+Cc: Johannes Berg <johannes.berg@intel.com>
+Cc: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
+Cc: Luca Coelho <luciano.coelho@intel.com>
+Cc: Jonathan Cameron <jic23@kernel.org>
+Cc: Hartmut Knaack <knaack.h@gmx.de>
+Cc: Lars-Peter Clausen <lars@metafoo.de>
+Cc: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
+Cc: Andy Shevchenko <andy@infradead.org>
+Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Stable-dep-of: 3ef79cd14122 ("serial: sc16is7xx: set safe default SPI clock frequency")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ include/linux/units.h | 84 +++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 84 insertions(+)
+ create mode 100644 include/linux/units.h
+
+diff --git a/include/linux/units.h b/include/linux/units.h
+new file mode 100644
+index 000000000000..aaf716364ec3
+--- /dev/null
++++ b/include/linux/units.h
+@@ -0,0 +1,84 @@
++/* SPDX-License-Identifier: GPL-2.0 */
++#ifndef _LINUX_UNITS_H
++#define _LINUX_UNITS_H
++
++#include <linux/kernel.h>
++
++#define ABSOLUTE_ZERO_MILLICELSIUS -273150
++
++static inline long milli_kelvin_to_millicelsius(long t)
++{
++      return t + ABSOLUTE_ZERO_MILLICELSIUS;
++}
++
++static inline long millicelsius_to_milli_kelvin(long t)
++{
++      return t - ABSOLUTE_ZERO_MILLICELSIUS;
++}
++
++#define MILLIDEGREE_PER_DEGREE 1000
++#define MILLIDEGREE_PER_DECIDEGREE 100
++
++static inline long kelvin_to_millicelsius(long t)
++{
++      return milli_kelvin_to_millicelsius(t * MILLIDEGREE_PER_DEGREE);
++}
++
++static inline long millicelsius_to_kelvin(long t)
++{
++      t = millicelsius_to_milli_kelvin(t);
++
++      return DIV_ROUND_CLOSEST(t, MILLIDEGREE_PER_DEGREE);
++}
++
++static inline long deci_kelvin_to_celsius(long t)
++{
++      t = milli_kelvin_to_millicelsius(t * MILLIDEGREE_PER_DECIDEGREE);
++
++      return DIV_ROUND_CLOSEST(t, MILLIDEGREE_PER_DEGREE);
++}
++
++static inline long celsius_to_deci_kelvin(long t)
++{
++      t = millicelsius_to_milli_kelvin(t * MILLIDEGREE_PER_DEGREE);
++
++      return DIV_ROUND_CLOSEST(t, MILLIDEGREE_PER_DECIDEGREE);
++}
++
++/**
++ * deci_kelvin_to_millicelsius_with_offset - convert Kelvin to Celsius
++ * @t: temperature value in decidegrees Kelvin
++ * @offset: difference between Kelvin and Celsius in millidegrees
++ *
++ * Return: temperature value in millidegrees Celsius
++ */
++static inline long deci_kelvin_to_millicelsius_with_offset(long t, long offset)
++{
++      return t * MILLIDEGREE_PER_DECIDEGREE - offset;
++}
++
++static inline long deci_kelvin_to_millicelsius(long t)
++{
++      return milli_kelvin_to_millicelsius(t * MILLIDEGREE_PER_DECIDEGREE);
++}
++
++static inline long millicelsius_to_deci_kelvin(long t)
++{
++      t = millicelsius_to_milli_kelvin(t);
++
++      return DIV_ROUND_CLOSEST(t, MILLIDEGREE_PER_DECIDEGREE);
++}
++
++static inline long kelvin_to_celsius(long t)
++{
++      return t + DIV_ROUND_CLOSEST(ABSOLUTE_ZERO_MILLICELSIUS,
++                                   MILLIDEGREE_PER_DEGREE);
++}
++
++static inline long celsius_to_kelvin(long t)
++{
++      return t - DIV_ROUND_CLOSEST(ABSOLUTE_ZERO_MILLICELSIUS,
++                                   MILLIDEGREE_PER_DEGREE);
++}
++
++#endif /* _LINUX_UNITS_H */
+-- 
+2.43.0
+
diff --git a/queue-4.19/pci-mediatek-clear-interrupt-status-before-dispatchi.patch b/queue-4.19/pci-mediatek-clear-interrupt-status-before-dispatchi.patch
new file mode 100644 (file)
index 0000000..6bb087e
--- /dev/null
@@ -0,0 +1,65 @@
+From 096fd4849adc3690fd0852c805dd38f1ad8f0002 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 11 Dec 2023 17:49:23 +0800
+Subject: PCI: mediatek: Clear interrupt status before dispatching handler
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: qizhong cheng <qizhong.cheng@mediatek.com>
+
+[ Upstream commit 4e11c29873a8a296a20f99b3e03095e65ebf897d ]
+
+We found a failure when using the iperf tool during WiFi performance
+testing, where some MSIs were received while clearing the interrupt
+status, and these MSIs cannot be serviced.
+
+The interrupt status can be cleared even if the MSI status remains pending.
+As such, given the edge-triggered interrupt type, its status should be
+cleared before being dispatched to the handler of the underling device.
+
+[kwilczynski: commit log, code comment wording]
+Link: https://lore.kernel.org/linux-pci/20231211094923.31967-1-jianjun.wang@mediatek.com
+Fixes: 43e6409db64d ("PCI: mediatek: Add MSI support for MT2712 and MT7622")
+Signed-off-by: qizhong cheng <qizhong.cheng@mediatek.com>
+Signed-off-by: Jianjun Wang <jianjun.wang@mediatek.com>
+Signed-off-by: Krzysztof WilczyƄski <kwilczynski@kernel.org>
+[bhelgaas: rewrap comment]
+Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
+Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
+Cc:  <stable@vger.kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/pci/controller/pcie-mediatek.c | 10 ++++++++--
+ 1 file changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/pci/controller/pcie-mediatek.c b/drivers/pci/controller/pcie-mediatek.c
+index 066e9e00de11..0d5be37660aa 100644
+--- a/drivers/pci/controller/pcie-mediatek.c
++++ b/drivers/pci/controller/pcie-mediatek.c
+@@ -605,14 +605,20 @@ static void mtk_pcie_intr_handler(struct irq_desc *desc)
+               if (status & MSI_STATUS){
+                       unsigned long imsi_status;
++                      /*
++                       * The interrupt status can be cleared even if the
++                       * MSI status remains pending. As such, given the
++                       * edge-triggered interrupt type, its status should
++                       * be cleared before being dispatched to the
++                       * handler of the underlying device.
++                       */
++                      writel(MSI_STATUS, port->base + PCIE_INT_STATUS);
+                       while ((imsi_status = readl(port->base + PCIE_IMSI_STATUS))) {
+                               for_each_set_bit(bit, &imsi_status, MTK_MSI_IRQS_NUM) {
+                                       virq = irq_find_mapping(port->inner_domain, bit);
+                                       generic_handle_irq(virq);
+                               }
+                       }
+-                      /* Clear MSI interrupt status */
+-                      writel(MSI_STATUS, port->base + PCIE_INT_STATUS);
+               }
+       }
+-- 
+2.43.0
+
diff --git a/queue-4.19/serial-sc16is7xx-add-check-for-unsupported-spi-modes.patch b/queue-4.19/serial-sc16is7xx-add-check-for-unsupported-spi-modes.patch
new file mode 100644 (file)
index 0000000..05d78d7
--- /dev/null
@@ -0,0 +1,55 @@
+From 888cbad9c63d5f2694958d56fc064a48477f8f35 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 21 Dec 2023 18:18:09 -0500
+Subject: serial: sc16is7xx: add check for unsupported SPI modes during probe
+
+From: Hugo Villeneuve <hvilleneuve@dimonoff.com>
+
+[ Upstream commit 6d710b769c1f5f0d55c9ad9bb49b7dce009ec103 ]
+
+The original comment is confusing because it implies that variants other
+than the SC16IS762 supports other SPI modes beside SPI_MODE_0.
+
+Extract from datasheet:
+    The SC16IS762 differs from the SC16IS752 in that it supports SPI clock
+    speeds up to 15 Mbit/s instead of the 4 Mbit/s supported by the
+    SC16IS752... In all other aspects, the SC16IS762 is functionally and
+    electrically the same as the SC16IS752.
+
+The same is also true of the SC16IS760 variant versus the SC16IS740 and
+SC16IS750 variants.
+
+For all variants, only SPI mode 0 is supported.
+
+Change comment and abort probing if the specified SPI mode is not
+SPI_MODE_0.
+
+Fixes: 2c837a8a8f9f ("sc16is7xx: spi interface is added")
+Cc:  <stable@vger.kernel.org>
+Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
+Link: https://lore.kernel.org/r/20231221231823.2327894-3-hugo@hugovil.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/tty/serial/sc16is7xx.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c
+index 07898a46fd96..800cb94e4b91 100644
+--- a/drivers/tty/serial/sc16is7xx.c
++++ b/drivers/tty/serial/sc16is7xx.c
+@@ -1407,7 +1407,10 @@ static int sc16is7xx_spi_probe(struct spi_device *spi)
+       /* Setup SPI bus */
+       spi->bits_per_word      = 8;
+-      /* only supports mode 0 on SC16IS762 */
++      /* For all variants, only mode 0 is supported */
++      if ((spi->mode & SPI_MODE_X_MASK) != SPI_MODE_0)
++              return dev_err_probe(&spi->dev, -EINVAL, "Unsupported SPI mode\n");
++
+       spi->mode               = spi->mode ? : SPI_MODE_0;
+       spi->max_speed_hz       = spi->max_speed_hz ? : 4 * HZ_PER_MHZ;
+       ret = spi_setup(spi);
+-- 
+2.43.0
+
diff --git a/queue-4.19/serial-sc16is7xx-set-safe-default-spi-clock-frequenc.patch b/queue-4.19/serial-sc16is7xx-set-safe-default-spi-clock-frequenc.patch
new file mode 100644 (file)
index 0000000..76d876c
--- /dev/null
@@ -0,0 +1,50 @@
+From 8ed11abb2953cd0de2ce0cd0a847fbfe6551f3a4 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 21 Dec 2023 18:18:10 -0500
+Subject: serial: sc16is7xx: set safe default SPI clock frequency
+
+From: Hugo Villeneuve <hvilleneuve@dimonoff.com>
+
+[ Upstream commit 3ef79cd1412236d884ab0c46b4d1921380807b48 ]
+
+15 MHz is supported only by 76x variants.
+
+If the SPI clock frequency is not specified, use a safe default clock value
+of 4 MHz that is supported by all variants.
+
+Also use HZ_PER_MHZ macro to improve readability.
+
+Fixes: 2c837a8a8f9f ("sc16is7xx: spi interface is added")
+Cc:  <stable@vger.kernel.org>
+Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
+Link: https://lore.kernel.org/r/20231221231823.2327894-4-hugo@hugovil.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/tty/serial/sc16is7xx.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c
+index c65f9194abb0..07898a46fd96 100644
+--- a/drivers/tty/serial/sc16is7xx.c
++++ b/drivers/tty/serial/sc16is7xx.c
+@@ -24,6 +24,7 @@
+ #include <linux/tty_flip.h>
+ #include <linux/spi/spi.h>
+ #include <linux/uaccess.h>
++#include <linux/units.h>
+ #include <uapi/linux/sched/types.h>
+ #define SC16IS7XX_NAME                        "sc16is7xx"
+@@ -1408,7 +1409,7 @@ static int sc16is7xx_spi_probe(struct spi_device *spi)
+       spi->bits_per_word      = 8;
+       /* only supports mode 0 on SC16IS762 */
+       spi->mode               = spi->mode ? : SPI_MODE_0;
+-      spi->max_speed_hz       = spi->max_speed_hz ? : 15000000;
++      spi->max_speed_hz       = spi->max_speed_hz ? : 4 * HZ_PER_MHZ;
+       ret = spi_setup(spi);
+       if (ret)
+               return ret;
+-- 
+2.43.0
+
diff --git a/queue-4.19/series b/queue-4.19/series
new file mode 100644 (file)
index 0000000..4a489da
--- /dev/null
@@ -0,0 +1,9 @@
+pci-mediatek-clear-interrupt-status-before-dispatchi.patch
+include-linux-units.h-add-helpers-for-kelvin-to-from.patch
+units-add-watt-units.patch
+units-change-from-l-to-ul.patch
+units-add-the-hz-macros.patch
+serial-sc16is7xx-set-safe-default-spi-clock-frequenc.patch
+driver-core-add-device-probe-log-helper.patch
+spi-introduce-spi_mode_x_mask-macro.patch
+serial-sc16is7xx-add-check-for-unsupported-spi-modes.patch
diff --git a/queue-4.19/spi-introduce-spi_mode_x_mask-macro.patch b/queue-4.19/spi-introduce-spi_mode_x_mask-macro.patch
new file mode 100644 (file)
index 0000000..35a53b8
--- /dev/null
@@ -0,0 +1,46 @@
+From d566cc0c7fc623b55d14dd45fbf20040b59f56f5 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 27 Oct 2020 10:57:23 +0100
+Subject: spi: introduce SPI_MODE_X_MASK macro
+
+From: Oleksij Rempel <o.rempel@pengutronix.de>
+
+[ Upstream commit 029b42d8519cef70c4fb5fcaccd08f1053ed2bf0 ]
+
+Provide a macro to filter all SPI_MODE_0,1,2,3 mode in one run.
+
+The latest SPI framework will parse the devicetree in following call
+sequence: of_register_spi_device() -> of_spi_parse_dt()
+So, driver do not need to pars the devicetree and will get prepared
+flags in the probe.
+
+On one hand it is good far most drivers. On other hand some drivers need to
+filter flags provide by SPI framework and apply know to work flags. This drivers
+may use SPI_MODE_X_MASK to filter MODE flags and set own, known flags:
+  spi->flags &= ~SPI_MODE_X_MASK;
+  spi->flags |= SPI_MODE_0;
+
+Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
+Link: https://lore.kernel.org/r/20201027095724.18654-2-o.rempel@pengutronix.de
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Stable-dep-of: 6d710b769c1f ("serial: sc16is7xx: add check for unsupported SPI modes during probe")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ include/linux/spi/spi.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
+index 16158fe097a8..23a232d6db69 100644
+--- a/include/linux/spi/spi.h
++++ b/include/linux/spi/spi.h
+@@ -153,6 +153,7 @@ struct spi_device {
+ #define       SPI_MODE_1      (0|SPI_CPHA)
+ #define       SPI_MODE_2      (SPI_CPOL|0)
+ #define       SPI_MODE_3      (SPI_CPOL|SPI_CPHA)
++#define       SPI_MODE_X_MASK (SPI_CPOL|SPI_CPHA)
+ #define       SPI_CS_HIGH     0x04                    /* chipselect active high? */
+ #define       SPI_LSB_FIRST   0x08                    /* per-word bits-on-wire */
+ #define       SPI_3WIRE       0x10                    /* SI/SO signals shared */
+-- 
+2.43.0
+
diff --git a/queue-4.19/units-add-the-hz-macros.patch b/queue-4.19/units-add-the-hz-macros.patch
new file mode 100644 (file)
index 0000000..05d1e6b
--- /dev/null
@@ -0,0 +1,57 @@
+From 0de4d60b8ec50d9e62282e98b2aa2ef0b63eb16b Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 7 Sep 2021 19:57:48 -0700
+Subject: units: add the HZ macros
+
+From: Daniel Lezcano <daniel.lezcano@linaro.org>
+
+[ Upstream commit e2c77032fcbe515194107994d12cd72ddb77b022 ]
+
+The macros for the unit conversion for frequency are duplicated in
+different places.
+
+Provide these macros in the 'units' header, so they can be reused.
+
+Link: https://lkml.kernel.org/r/20210816114732.1834145-3-daniel.lezcano@linaro.org
+Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
+Reviewed-by: Christian Eggers <ceggers@arri.de>
+Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+Cc: Chanwoo Choi <cw00.choi@samsung.com>
+Cc: Guenter Roeck <linux@roeck-us.net>
+Cc: Jonathan Cameron <jic23@kernel.org>
+Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>
+Cc: Kyungmin Park <kyungmin.park@samsung.com>
+Cc: Lars-Peter Clausen <lars@metafoo.de>
+Cc: Lukasz Luba <lukasz.luba@arm.com>
+Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
+Cc: Miquel Raynal <miquel.raynal@bootlin.com>
+Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
+Cc: Peter Meerwald <pmeerw@pmeerw.net>
+Cc: "Rafael J. Wysocki" <rafael@kernel.org>
+Cc: Zhang Rui <rui.zhang@intel.com>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Stable-dep-of: 3ef79cd14122 ("serial: sc16is7xx: set safe default SPI clock frequency")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ include/linux/units.h | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/include/linux/units.h b/include/linux/units.h
+index 4a23e39acc7b..a0af6d2ef4e5 100644
+--- a/include/linux/units.h
++++ b/include/linux/units.h
+@@ -4,6 +4,10 @@
+ #include <linux/kernel.h>
++#define HZ_PER_KHZ            1000UL
++#define KHZ_PER_MHZ           1000UL
++#define HZ_PER_MHZ            1000000UL
++
+ #define MILLIWATT_PER_WATT    1000UL
+ #define MICROWATT_PER_MILLIWATT       1000UL
+ #define MICROWATT_PER_WATT    1000000UL
+-- 
+2.43.0
+
diff --git a/queue-4.19/units-add-watt-units.patch b/queue-4.19/units-add-watt-units.patch
new file mode 100644 (file)
index 0000000..f9d3e1d
--- /dev/null
@@ -0,0 +1,38 @@
+From c69da1e0f530d6524dd9e626d0d736904d45d9a1 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 8 Dec 2020 17:41:42 +0100
+Subject: units: Add Watt units
+
+From: Daniel Lezcano <daniel.lezcano@linaro.org>
+
+[ Upstream commit 2ee5f8f05949735fa2f4c463a5e13fcb3660c719 ]
+
+As there are the temperature units, let's add the Watt macros definition.
+
+Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
+Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Stable-dep-of: 3ef79cd14122 ("serial: sc16is7xx: set safe default SPI clock frequency")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ include/linux/units.h | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/include/linux/units.h b/include/linux/units.h
+index aaf716364ec3..92c234e71cab 100644
+--- a/include/linux/units.h
++++ b/include/linux/units.h
+@@ -4,6 +4,10 @@
+ #include <linux/kernel.h>
++#define MILLIWATT_PER_WATT    1000L
++#define MICROWATT_PER_MILLIWATT       1000L
++#define MICROWATT_PER_WATT    1000000L
++
+ #define ABSOLUTE_ZERO_MILLICELSIUS -273150
+ static inline long milli_kelvin_to_millicelsius(long t)
+-- 
+2.43.0
+
diff --git a/queue-4.19/units-change-from-l-to-ul.patch b/queue-4.19/units-change-from-l-to-ul.patch
new file mode 100644 (file)
index 0000000..d742f47
--- /dev/null
@@ -0,0 +1,71 @@
+From f84c4cb56dbd67889626027f571c3ba917721b6a Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 7 Sep 2021 19:57:44 -0700
+Subject: units: change from 'L' to 'UL'
+
+From: Daniel Lezcano <daniel.lezcano@linaro.org>
+
+[ Upstream commit c9221919a2d2df5741ab074dfec5bdfc6f1e043b ]
+
+Patch series "Add Hz macros", v3.
+
+There are multiple definitions of the HZ_PER_MHZ or HZ_PER_KHZ in the
+different drivers.  Instead of duplicating this definition again and
+again, add one in the units.h header to be reused in all the place the
+redefiniton occurs.
+
+At the same time, change the type of the Watts, as they can not be
+negative.
+
+This patch (of 10):
+
+The users of the macros are safe to be assigned with an unsigned instead
+of signed as the variables using them are themselves unsigned.
+
+Link: https://lkml.kernel.org/r/20210816114732.1834145-1-daniel.lezcano@linaro.org
+Link: https://lkml.kernel.org/r/20210816114732.1834145-2-daniel.lezcano@linaro.org
+Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
+Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+Cc: Jonathan Cameron <jic23@kernel.org>
+Cc: Christian Eggers <ceggers@arri.de>
+Cc: Lukasz Luba <lukasz.luba@arm.com>
+Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
+Cc: Kyungmin Park <kyungmin.park@samsung.com>
+Cc: Lars-Peter Clausen <lars@metafoo.de>
+Cc: Peter Meerwald <pmeerw@pmeerw.net>
+Cc: Zhang Rui <rui.zhang@intel.com>
+Cc: Guenter Roeck <linux@roeck-us.net>
+Cc: Miquel Raynal <miquel.raynal@bootlin.com>
+Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
+Cc: "Rafael J. Wysocki" <rafael@kernel.org>
+Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
+Cc: Chanwoo Choi <cw00.choi@samsung.com>
+Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Stable-dep-of: 3ef79cd14122 ("serial: sc16is7xx: set safe default SPI clock frequency")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ include/linux/units.h | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/include/linux/units.h b/include/linux/units.h
+index 92c234e71cab..4a23e39acc7b 100644
+--- a/include/linux/units.h
++++ b/include/linux/units.h
+@@ -4,9 +4,9 @@
+ #include <linux/kernel.h>
+-#define MILLIWATT_PER_WATT    1000L
+-#define MICROWATT_PER_MILLIWATT       1000L
+-#define MICROWATT_PER_WATT    1000000L
++#define MILLIWATT_PER_WATT    1000UL
++#define MICROWATT_PER_MILLIWATT       1000UL
++#define MICROWATT_PER_WATT    1000000UL
+ #define ABSOLUTE_ZERO_MILLICELSIUS -273150
+-- 
+2.43.0
+