summaryrefslogtreecommitdiff
path: root/recipes-kernel/linux/linux-at91-4.9.87/at91pinctrl_reprobe.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-kernel/linux/linux-at91-4.9.87/at91pinctrl_reprobe.patch')
-rw-r--r--recipes-kernel/linux/linux-at91-4.9.87/at91pinctrl_reprobe.patch60
1 files changed, 60 insertions, 0 deletions
diff --git a/recipes-kernel/linux/linux-at91-4.9.87/at91pinctrl_reprobe.patch b/recipes-kernel/linux/linux-at91-4.9.87/at91pinctrl_reprobe.patch
new file mode 100644
index 0000000..972404c
--- /dev/null
+++ b/recipes-kernel/linux/linux-at91-4.9.87/at91pinctrl_reprobe.patch
@@ -0,0 +1,60 @@
+diff -Naru linux-4.9.87.orig/drivers/pinctrl/pinctrl-at91.c linux-4.9.87/drivers/pinctrl/pinctrl-at91.c
+--- linux-4.9.87.orig/drivers/pinctrl/pinctrl-at91.c 2018-12-06 17:41:59.621200529 -0600
++++ linux-4.9.87/drivers/pinctrl/pinctrl-at91.c 2018-12-06 18:06:37.437156779 -0600
+@@ -29,7 +29,7 @@
+
+ #define MAX_GPIO_BANKS 5
+ #define MAX_NB_GPIO_PER_BANK 32
+-
++#define PLATFORM_NAME "at91_pinctrl"
+ struct at91_pinctrl_mux_ops;
+
+ struct at91_gpio_chip {
+@@ -1224,12 +1224,17 @@
+ return 0;
+ }
+
++static struct platform_device *at91_pinctrl_platform_device = NULL;
++
+ static int at91_pinctrl_probe(struct platform_device *pdev)
+ {
+ struct at91_pinctrl *info;
+ struct pinctrl_pin_desc *pdesc;
+ int ret, i, j, k, ngpio_chips_enabled = 0;
+
++ if (!at91_pinctrl_platform_device)
++ at91_pinctrl_platform_device = pdev;
++
+ info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
+ if (!info)
+ return -ENOMEM;
+@@ -1833,8 +1838,29 @@
+ &at91_pinctrl_driver,
+ };
+
++static ssize_t do_at91_pinctrl_probe(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t count)
++{
++ /* Do Probe */
++ if(at91_pinctrl_platform_device)
++ at91_pinctrl_probe(at91_pinctrl_platform_device);
++ else
++ printk(KERN_ALERT "at91pinctrl_platform_device is undefined!\n");
++ return count;
++}
++
++static struct kobj_attribute at91_pinctrl_attr =
++__ATTR(do_at91_pinctrl_probe, 0200, NULL, do_at91_pinctrl_probe);
++
+ static int __init at91_pinctrl_init(void)
+ {
++ int ret;
++ struct kobject *kobj;
++ kobj = kobject_create_and_add(PLATFORM_NAME, kernel_kobj);
++ if(kobj)
++ {
++ ret = sysfs_create_file(kobj,&at91_pinctrl_attr.attr);
++ } else
++ printk(KERN_ALERT "Could not create platform name %s\n",PLATFORM_NAME);
+ return platform_register_drivers(drivers, ARRAY_SIZE(drivers));
+ }
+ arch_initcall(at91_pinctrl_init);