|
@@ -120,3 +120,58 @@ static struct str_ident {
|
|
|
|
|
|
#if defined(CONFIG_PM)
|
|
|
static struct gpio_port_s gpio_bank_saved[GPIO_BANK_NUM];
|
|
|
+# ifdef BF538_FAMILY
|
|
|
+static unsigned short port_fer_saved[3];
|
|
|
+# endif
|
|
|
+#endif
|
|
|
+
|
|
|
+static void gpio_error(unsigned gpio)
|
|
|
+{
|
|
|
+ printk(KERN_ERR "bfin-gpio: GPIO %d wasn't requested!\n", gpio);
|
|
|
+}
|
|
|
+
|
|
|
+static void set_label(unsigned short ident, const char *label)
|
|
|
+{
|
|
|
+ if (label) {
|
|
|
+ strncpy(str_ident[ident].name, label,
|
|
|
+ RESOURCE_LABEL_SIZE);
|
|
|
+ str_ident[ident].name[RESOURCE_LABEL_SIZE - 1] = 0;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+static char *get_label(unsigned short ident)
|
|
|
+{
|
|
|
+ return (*str_ident[ident].name ? str_ident[ident].name : "UNKNOWN");
|
|
|
+}
|
|
|
+
|
|
|
+static int cmp_label(unsigned short ident, const char *label)
|
|
|
+{
|
|
|
+ if (label == NULL) {
|
|
|
+ dump_stack();
|
|
|
+ printk(KERN_ERR "Please provide none-null label\n");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (label)
|
|
|
+ return strcmp(str_ident[ident].name, label);
|
|
|
+ else
|
|
|
+ return -EINVAL;
|
|
|
+}
|
|
|
+
|
|
|
+#define map_entry(m, i) reserved_##m##_map[gpio_bank(i)]
|
|
|
+#define is_reserved(m, i, e) (map_entry(m, i) & gpio_bit(i))
|
|
|
+#define reserve(m, i) (map_entry(m, i) |= gpio_bit(i))
|
|
|
+#define unreserve(m, i) (map_entry(m, i) &= ~gpio_bit(i))
|
|
|
+#define DECLARE_RESERVED_MAP(m, c) static unsigned short reserved_##m##_map[c]
|
|
|
+
|
|
|
+DECLARE_RESERVED_MAP(gpio, GPIO_BANK_NUM);
|
|
|
+DECLARE_RESERVED_MAP(peri, DIV_ROUND_UP(MAX_RESOURCES, GPIO_BANKSIZE));
|
|
|
+DECLARE_RESERVED_MAP(gpio_irq, GPIO_BANK_NUM);
|
|
|
+
|
|
|
+inline int check_gpio(unsigned gpio)
|
|
|
+{
|
|
|
+#if defined(CONFIG_BF54x)
|
|
|
+ if (gpio == GPIO_PB15 || gpio == GPIO_PC14 || gpio == GPIO_PC15
|
|
|
+ || gpio == GPIO_PH14 || gpio == GPIO_PH15
|
|
|
+ || gpio == GPIO_PJ14 || gpio == GPIO_PJ15)
|
|
|
+ return -EINVAL;
|
|
|
+#endif
|