|
@@ -1044,3 +1044,59 @@ void bfin_special_gpio_free(unsigned gpio)
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ unreserve(special_gpio, gpio);
|
|
|
|
+ unreserve(peri, gpio);
|
|
|
|
+ set_label(gpio, "free");
|
|
|
|
+ hard_local_irq_restore(flags);
|
|
|
|
+}
|
|
|
|
+EXPORT_SYMBOL(bfin_special_gpio_free);
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+int bfin_gpio_irq_request(unsigned gpio, const char *label)
|
|
|
|
+{
|
|
|
|
+ unsigned long flags;
|
|
|
|
+
|
|
|
|
+ if (check_gpio(gpio) < 0)
|
|
|
|
+ return -EINVAL;
|
|
|
|
+
|
|
|
|
+ flags = hard_local_irq_save();
|
|
|
|
+
|
|
|
|
+ if (unlikely(is_reserved(peri, gpio, 1))) {
|
|
|
|
+ if (system_state == SYSTEM_BOOTING)
|
|
|
|
+ dump_stack();
|
|
|
|
+ printk(KERN_ERR
|
|
|
|
+ "bfin-gpio: GPIO %d is already reserved as Peripheral by %s !\n",
|
|
|
|
+ gpio, get_label(gpio));
|
|
|
|
+ hard_local_irq_restore(flags);
|
|
|
|
+ return -EBUSY;
|
|
|
|
+ }
|
|
|
|
+ if (unlikely(is_reserved(gpio, gpio, 1)))
|
|
|
|
+ printk(KERN_NOTICE "bfin-gpio: GPIO %d is already reserved by %s! "
|
|
|
|
+ "(Documentation/blackfin/bfin-gpio-notes.txt)\n",
|
|
|
|
+ gpio, get_label(gpio));
|
|
|
|
+
|
|
|
|
+ reserve(gpio_irq, gpio);
|
|
|
|
+ set_label(gpio, label);
|
|
|
|
+
|
|
|
|
+ hard_local_irq_restore(flags);
|
|
|
|
+
|
|
|
|
+ port_setup(gpio, GPIO_USAGE);
|
|
|
|
+
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void bfin_gpio_irq_free(unsigned gpio)
|
|
|
|
+{
|
|
|
|
+ unsigned long flags;
|
|
|
|
+
|
|
|
|
+ if (check_gpio(gpio) < 0)
|
|
|
|
+ return;
|
|
|
|
+
|
|
|
|
+ flags = hard_local_irq_save();
|
|
|
|
+
|
|
|
|
+ if (unlikely(!is_reserved(gpio_irq, gpio, 0))) {
|
|
|
|
+ if (system_state == SYSTEM_BOOTING)
|
|
|
|
+ dump_stack();
|
|
|
|
+ gpio_error(gpio);
|
|
|
|
+ hard_local_irq_restore(flags);
|