diff --git a/target/linux/generic/hack-6.12/800-GPIO-add-named-gpio-exports.patch b/target/linux/generic/hack-6.12/800-GPIO-add-named-gpio-exports.patch index 4fe2d87df305b2..a68b2fe80e4d5c 100644 --- a/target/linux/generic/hack-6.12/800-GPIO-add-named-gpio-exports.patch +++ b/target/linux/generic/hack-6.12/800-GPIO-add-named-gpio-exports.patch @@ -15,7 +15,7 @@ Signed-off-by: John Crispin #include "gpiolib.h" #include "gpiolib-of.h" -@@ -1187,3 +1189,72 @@ void of_gpiochip_remove(struct gpio_chip +@@ -1187,3 +1189,73 @@ void of_gpiochip_remove(struct gpio_chip { of_node_put(dev_of_node(&chip->gpiodev->dev)); } @@ -44,17 +44,19 @@ Signed-off-by: John Crispin + of_property_read_string(cnp, "gpio-export,name", &name); + + if (!name) -+ // max_gpio = of_gpio_count(cnp); ++ max_gpio = of_gpio_named_count(cnp, "gpios"); + + for (i = 0; i < max_gpio; i++) { ++ struct gpio_desc *desc; + unsigned flags = 0; + enum of_gpio_flags of_flags; + -+ gpio = of_get_named_gpio(cnp, i, &of_flags); -+ if (!gpio_is_valid(gpio)) -+ return gpio; ++ desc = of_get_named_gpiod_flags(cnp, "gpios", i, &of_flags); ++ if (IS_ERR(desc)) ++ return PTR_ERR(desc); ++ gpio = desc_to_gpio(desc); + -+ if (of_flags == OF_GPIO_ACTIVE_LOW) ++ if (of_flags & OF_GPIO_ACTIVE_LOW) + flags |= GPIOF_ACTIVE_LOW; + + if (!of_property_read_u32(cnp, "gpio-export,output", &val)) @@ -66,7 +68,7 @@ Signed-off-by: John Crispin + continue; + + dmc = of_property_read_bool(cnp, "gpio-export,direction_may_change"); -+ gpio_export_with_name(gpio, dmc, name); ++ gpio_export_with_name(gpio_to_desc(gpio), dmc, name); + nb++; + } + } @@ -79,7 +81,6 @@ Signed-off-by: John Crispin +static struct platform_driver gpio_export_driver = { + .driver = { + .name = "gpio-export", -+ .owner = THIS_MODULE, + .of_match_table = of_match_ptr(gpio_export_ids), + }, + .probe = of_gpio_export_probe, @@ -88,22 +89,24 @@ Signed-off-by: John Crispin +module_platform_driver(gpio_export_driver); + +#endif -\ No newline at end of file --- a/include/linux/gpio/consumer.h +++ b/include/linux/gpio/consumer.h -@@ -628,6 +628,7 @@ static inline int devm_acpi_dev_add_driv +@@ -628,7 +628,10 @@ static inline int devm_acpi_dev_add_driv #if IS_ENABLED(CONFIG_GPIOLIB) && IS_ENABLED(CONFIG_GPIO_SYSFS) -+int _gpiod_export(struct gpio_desc *desc, bool direction_may_change, const char *name); ++int __gpiod_export(struct gpio_desc *desc, bool direction_may_change, const char *name); int gpiod_export(struct gpio_desc *desc, bool direction_may_change); ++int gpio_export_with_name(struct gpio_desc *desc, bool direction_may_change, ++ const char *name); int gpiod_export_link(struct device *dev, const char *name, struct gpio_desc *desc); -@@ -637,6 +638,13 @@ void gpiod_unexport(struct gpio_desc *de + void gpiod_unexport(struct gpio_desc *desc); +@@ -637,11 +640,25 @@ void gpiod_unexport(struct gpio_desc *de #include -+static inline int _gpiod_export(struct gpio_desc *desc, ++static inline int __gpiod_export(struct gpio_desc *desc, + bool direction_may_change, + const char *name) +{ @@ -113,6 +116,18 @@ Signed-off-by: John Crispin static inline int gpiod_export(struct gpio_desc *desc, bool direction_may_change) { + return -ENOSYS; + } ++ ++static inline int gpio_export_with_name(struct gpio_desc *desc, ++ bool direction_may_change, ++ const char *name) ++{ ++ return -ENOSYS; ++} + + static inline int gpiod_export_link(struct device *dev, const char *name, + struct gpio_desc *desc) --- a/drivers/gpio/gpiolib-sysfs.c +++ b/drivers/gpio/gpiolib-sysfs.c @@ -571,7 +571,7 @@ static struct class gpio_class = { @@ -133,7 +148,7 @@ Signed-off-by: John Crispin dev = device_create_with_groups(&gpio_class, &gdev->dev, MKDEV(0, 0), data, gpio_groups, -@@ -650,6 +652,12 @@ err_unlock: +@@ -650,8 +652,21 @@ err_unlock: gpiod_dbg(desc, "%s: status %d\n", __func__, status); return status; } @@ -145,4 +160,13 @@ Signed-off-by: John Crispin +} EXPORT_SYMBOL_GPL(gpiod_export); ++int gpio_export_with_name(struct gpio_desc *desc, bool direction_may_change, ++ const char *name) ++{ ++ return __gpiod_export(desc, direction_may_change, name); ++} ++EXPORT_SYMBOL_GPL(gpio_export_with_name); ++ static int match_export(struct device *dev, const void *desc) + { + struct gpiod_data *data = dev_get_drvdata(dev); diff --git a/target/linux/generic/pending-6.12/465-m25p80-mx-disable-software-protection.patch b/target/linux/generic/pending-6.12/465-m25p80-mx-disable-software-protection.patch index e0adcdd9f09481..5667e273f1724a 100644 --- a/target/linux/generic/pending-6.12/465-m25p80-mx-disable-software-protection.patch +++ b/target/linux/generic/pending-6.12/465-m25p80-mx-disable-software-protection.patch @@ -12,7 +12,7 @@ Signed-off-by: Felix Fietkau { if (!nor->params->set_4byte_addr_mode) nor->params->set_4byte_addr_mode = spi_nor_set_4byte_addr_mode_en4b_ex4b; -+ nor->flags |= SNOR_F_HAS_LOCK; ++ nor->flags |= SNOR_F_HAS_LOCK; return 0; } diff --git a/target/linux/generic/pending-6.12/499-mtd-spi-nor-disable-16-bit-sr-for-macronix.patch b/target/linux/generic/pending-6.12/499-mtd-spi-nor-disable-16-bit-sr-for-macronix.patch index 9fecf843d08439..6e08beabda664e 100644 --- a/target/linux/generic/pending-6.12/499-mtd-spi-nor-disable-16-bit-sr-for-macronix.patch +++ b/target/linux/generic/pending-6.12/499-mtd-spi-nor-disable-16-bit-sr-for-macronix.patch @@ -24,7 +24,7 @@ Signed-off-by: Nick Hainke { if (!nor->params->set_4byte_addr_mode) nor->params->set_4byte_addr_mode = spi_nor_set_4byte_addr_mode_en4b_ex4b; -+ nor->flags &= ~SNOR_F_HAS_16BIT_SR; - nor->flags |= SNOR_F_HAS_LOCK; ++ nor->flags &= ~SNOR_F_HAS_16BIT_SR; + nor->flags |= SNOR_F_HAS_LOCK; return 0;