mirror of
git://git.openwrt.org/openwrt/openwrt.git
synced 2024-12-23 15:12:50 +00:00
738b04c881
Removed upstreamed:
pending-5.15/101-Use-stddefs.h-instead-of-compiler.h.patch[1]
ipq806x/patches-5.15/122-01-clk-qcom-clk-krait-fix-wrong-div2-functions.patch[2]
bcm27xx/patches-5.15/950-0198-drm-fourcc-Add-packed-10bit-YUV-4-2-0-format.patch[3]
Manually rebased:
ramips/patches-5.15/100-PCI-mt7621-Add-MediaTek-MT7621-PCIe-host-controller-.patch[4]
Added patch/backported:
ramips/patches-5.15/107-PCI-mt7621-Add-sentinel-to-quirks-table.patch[5]
All other patches automatically rebased.
1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.86&id=c160505c9b574b346031fdf2c649d19e7939ca11
2. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.86&id=a051e10bfc6906d29dae7a31f0773f2702edfe1b
3. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.86&id=ec1727f89ecd6f2252c0c75e200058819f7ce47a
4. Quilt gave this output when I applied the patch to rebase it:
% quilt push -f
Applying patch platform/100-PCI-mt7621-Add-MediaTek-MT7621-PCIe-host-controller-.patch
patching file arch/mips/ralink/Kconfig
patching file drivers/pci/controller/Kconfig
patching file drivers/pci/controller/Makefile
patching file drivers/staging/Kconfig
patching file drivers/staging/Makefile
patching file drivers/staging/mt7621-pci/Kconfig
patching file drivers/staging/mt7621-pci/Makefile
patching file drivers/staging/mt7621-pci/TODO
patching file drivers/staging/mt7621-pci/mediatek,mt7621-pci.txt
patching file drivers/staging/mt7621-pci/pci-mt7621.c
Hunk #1 FAILED at 1.
Not deleting file drivers/staging/mt7621-pci/pci-mt7621.c as content differs from patch
1 out of 1 hunk FAILED -- saving rejects to file drivers/staging/mt7621-pci/pci-mt7621.c.rej
patching file drivers/pci/controller/pcie-mt7621.c
Applied patch platform/100-PCI-mt7621-Add-MediaTek-MT7621-PCIe-host-controller-.patch (forced; needs refresh)
Upon inspecting drivers/staging/mt7621-pci/pci-mt7621.c.rej, it seems that
the original patch wants to delete drivers/staging/mt7621-pci/pci-mt7621.c
but upstream's version was not an exact match. I opted to delete that
file.
5. Suggestion by hauke: 19098934f9
"This patch is in upstream kernel, but it was backported to the old
staging driver in kernel 5.15."
Build system: x86_64
Build-tested: bcm2711/RPi4B, filogic/xiaomi_redmi-router-ax6000-ubootmod
Run-tested: bcm2711/RPi4B, filogic/xiaomi_redmi-router-ax6000-ubootmod
Signed-off-by: John Audia <therealgraysky@proton.me>
162 lines
5.2 KiB
Diff
162 lines
5.2 KiB
Diff
From e058fa1969019c2f6705c53c4130e364a877d4e6 Mon Sep 17 00:00:00 2001
|
|
From: Jonas Gorski <jonas.gorski@gmail.com>
|
|
Date: Sun, 26 Nov 2017 12:07:31 +0100
|
|
Subject: [PATCH] gpio: fix device tree gpio hogs on dual role gpio/pincontrol
|
|
controllers
|
|
|
|
For dual role gpio and pincontrol controller, the device registration
|
|
path is often:
|
|
|
|
pinctrl_register(...);
|
|
gpiochip_add_data(...);
|
|
gpiochip_add_pin_range(...);
|
|
|
|
If the device tree node has any gpio-hogs, the code will try to apply them
|
|
in the gpiochip_add_data step, but fail as they cannot be requested, as the
|
|
ranges are missing. But we also cannot first add the pinranges, as the
|
|
appropriate data structures are only initialized in gpiochip_add_data.
|
|
|
|
To fix this, defer gpio-hogs to the time pin ranges get added instead of
|
|
directly at chip request time, if the gpio-chip has a request method.
|
|
|
|
Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
|
|
---
|
|
|
|
drivers/gpio/gpiolib-of.c | 20 +++++++++++++++-----
|
|
drivers/gpio/gpiolib.c | 5 +++--
|
|
drivers/gpio/gpiolib.h | 8 ++++++++
|
|
3 files changed, 26 insertions(+), 7 deletions(-)
|
|
|
|
--- a/drivers/gpio/gpiolib-of.c
|
|
+++ b/drivers/gpio/gpiolib-of.c
|
|
@@ -646,23 +646,30 @@ static struct gpio_desc *of_parse_own_gp
|
|
* of_gpiochip_add_hog - Add all hogs in a hog device node
|
|
* @chip: gpio chip to act on
|
|
* @hog: device node describing the hogs
|
|
+ * @start: first gpio to check
|
|
+ * @num: number of gpios to check
|
|
*
|
|
* Returns error if it fails otherwise 0 on success.
|
|
*/
|
|
-static int of_gpiochip_add_hog(struct gpio_chip *chip, struct device_node *hog)
|
|
+static int of_gpiochip_add_hog(struct gpio_chip *chip, struct device_node *hog,
|
|
+ unsigned int start, unsigned int num)
|
|
{
|
|
enum gpiod_flags dflags;
|
|
struct gpio_desc *desc;
|
|
unsigned long lflags;
|
|
const char *name;
|
|
unsigned int i;
|
|
- int ret;
|
|
+ int ret, hwgpio;
|
|
|
|
for (i = 0;; i++) {
|
|
desc = of_parse_own_gpio(hog, chip, i, &name, &lflags, &dflags);
|
|
if (IS_ERR(desc))
|
|
break;
|
|
|
|
+ hwgpio = gpio_chip_hwgpio(desc);
|
|
+ if (hwgpio < start || hwgpio >= (start + num))
|
|
+ continue;
|
|
+
|
|
ret = gpiod_hog(desc, name, lflags, dflags);
|
|
if (ret < 0)
|
|
return ret;
|
|
@@ -678,12 +685,15 @@ static int of_gpiochip_add_hog(struct gp
|
|
/**
|
|
* of_gpiochip_scan_gpios - Scan gpio-controller for gpio definitions
|
|
* @chip: gpio chip to act on
|
|
+ * @start: first gpio to check
|
|
+ * @num: number of gpios to check
|
|
*
|
|
- * This is only used by of_gpiochip_add to request/set GPIO initial
|
|
- * configuration.
|
|
+ * This is used by of_gpiochip_add, gpiochip_add_pingroup_range and
|
|
+ * gpiochip_add_pin_range to request/set GPIO initial configuration.
|
|
* It returns error if it fails otherwise 0 on success.
|
|
*/
|
|
-static int of_gpiochip_scan_gpios(struct gpio_chip *chip)
|
|
+int of_gpiochip_scan_gpios(struct gpio_chip *chip, unsigned int start,
|
|
+ unsigned int num)
|
|
{
|
|
struct device_node *np;
|
|
int ret;
|
|
@@ -692,7 +702,7 @@ static int of_gpiochip_scan_gpios(struct
|
|
if (!of_property_read_bool(np, "gpio-hog"))
|
|
continue;
|
|
|
|
- ret = of_gpiochip_add_hog(chip, np);
|
|
+ ret = of_gpiochip_add_hog(chip, np, start, num);
|
|
if (ret < 0) {
|
|
of_node_put(np);
|
|
return ret;
|
|
@@ -758,7 +768,7 @@ static int of_gpio_notify(struct notifie
|
|
if (chip == NULL)
|
|
return NOTIFY_OK; /* not for us */
|
|
|
|
- ret = of_gpiochip_add_hog(chip, rd->dn);
|
|
+ ret = of_gpiochip_add_hog(chip, rd->dn, 0, chip->ngpio);
|
|
if (ret < 0) {
|
|
pr_err("%s: failed to add hogs for %pOF\n", __func__,
|
|
rd->dn);
|
|
@@ -1037,9 +1047,11 @@ int of_gpiochip_add(struct gpio_chip *ch
|
|
|
|
of_node_get(chip->of_node);
|
|
|
|
- ret = of_gpiochip_scan_gpios(chip);
|
|
- if (ret)
|
|
- of_node_put(chip->of_node);
|
|
+ if (!chip->request) {
|
|
+ ret = of_gpiochip_scan_gpios(chip, 0, chip->ngpio);
|
|
+ if (ret)
|
|
+ of_node_put(chip->of_node);
|
|
+ }
|
|
|
|
return ret;
|
|
}
|
|
--- a/drivers/gpio/gpiolib.c
|
|
+++ b/drivers/gpio/gpiolib.c
|
|
@@ -1802,7 +1802,8 @@ int gpiochip_add_pingroup_range(struct g
|
|
|
|
list_add_tail(&pin_range->node, &gdev->pin_ranges);
|
|
|
|
- return 0;
|
|
+ return of_gpiochip_scan_gpios(gc, gpio_offset,
|
|
+ pin_range->range.npins);
|
|
}
|
|
EXPORT_SYMBOL_GPL(gpiochip_add_pingroup_range);
|
|
|
|
@@ -1859,7 +1860,7 @@ int gpiochip_add_pin_range(struct gpio_c
|
|
|
|
list_add_tail(&pin_range->node, &gdev->pin_ranges);
|
|
|
|
- return 0;
|
|
+ return of_gpiochip_scan_gpios(gc, gpio_offset, npins);
|
|
}
|
|
EXPORT_SYMBOL_GPL(gpiochip_add_pin_range);
|
|
|
|
--- a/drivers/gpio/gpiolib-of.h
|
|
+++ b/drivers/gpio/gpiolib-of.h
|
|
@@ -13,6 +13,8 @@ struct gpio_desc *of_find_gpio(struct de
|
|
unsigned long *lookupflags);
|
|
int of_gpiochip_add(struct gpio_chip *gc);
|
|
void of_gpiochip_remove(struct gpio_chip *gc);
|
|
+int of_gpiochip_scan_gpios(struct gpio_chip *chip, unsigned int start,
|
|
+ unsigned int num);
|
|
int of_gpio_get_count(struct device *dev, const char *con_id);
|
|
bool of_gpio_need_valid_mask(const struct gpio_chip *gc);
|
|
void of_gpio_dev_init(struct gpio_chip *gc, struct gpio_device *gdev);
|
|
@@ -26,6 +28,12 @@ static inline struct gpio_desc *of_find_
|
|
}
|
|
static inline int of_gpiochip_add(struct gpio_chip *gc) { return 0; }
|
|
static inline void of_gpiochip_remove(struct gpio_chip *gc) { }
|
|
+static inline int of_gpiochip_scan_gpios(struct gpio_chip *chip,
|
|
+ unsigned int start,
|
|
+ unsigned int num)
|
|
+{
|
|
+ return 0;
|
|
+}
|
|
static inline int of_gpio_get_count(struct device *dev, const char *con_id)
|
|
{
|
|
return 0;
|