Lines Matching full:bank
353 * given a pin number that is local to a pin controller, find out the pin bank
354 * and the register base of the pin bank.
358 struct samsung_pin_bank **bank) in pin_to_reg_bank() argument
370 if (bank) in pin_to_reg_bank()
371 *bank = b; in pin_to_reg_bank()
380 struct samsung_pin_bank *bank; in samsung_pinmux_setup() local
392 ®, &pin_offset, &bank); in samsung_pinmux_setup()
393 type = bank->type; in samsung_pinmux_setup()
402 raw_spin_lock_irqsave(&bank->slock, flags); in samsung_pinmux_setup()
409 raw_spin_unlock_irqrestore(&bank->slock, flags); in samsung_pinmux_setup()
435 struct samsung_pin_bank *bank; in samsung_pinconf_rw() local
444 &pin_offset, &bank); in samsung_pinconf_rw()
445 type = bank->type; in samsung_pinconf_rw()
453 raw_spin_lock_irqsave(&bank->slock, flags); in samsung_pinconf_rw()
470 raw_spin_unlock_irqrestore(&bank->slock, flags); in samsung_pinconf_rw()
537 * The samsung_gpio_set_vlaue() should be called with "bank->slock" held
543 struct samsung_pin_bank *bank = gpiochip_get_data(gc); in samsung_gpio_set_value() local
544 const struct samsung_pin_bank_type *type = bank->type; in samsung_gpio_set_value()
548 reg = bank->pctl_base + bank->pctl_offset; in samsung_gpio_set_value()
560 struct samsung_pin_bank *bank = gpiochip_get_data(gc); in samsung_gpio_set() local
563 raw_spin_lock_irqsave(&bank->slock, flags); in samsung_gpio_set()
565 raw_spin_unlock_irqrestore(&bank->slock, flags); in samsung_gpio_set()
573 struct samsung_pin_bank *bank = gpiochip_get_data(gc); in samsung_gpio_get() local
574 const struct samsung_pin_bank_type *type = bank->type; in samsung_gpio_get()
576 reg = bank->pctl_base + bank->pctl_offset; in samsung_gpio_get()
585 * The samsung_gpio_set_direction() should be called with "bank->slock" held
594 struct samsung_pin_bank *bank; in samsung_gpio_set_direction() local
598 bank = gpiochip_get_data(gc); in samsung_gpio_set_direction()
599 type = bank->type; in samsung_gpio_set_direction()
601 reg = bank->pctl_base + bank->pctl_offset in samsung_gpio_set_direction()
624 struct samsung_pin_bank *bank = gpiochip_get_data(gc); in samsung_gpio_direction_input() local
628 raw_spin_lock_irqsave(&bank->slock, flags); in samsung_gpio_direction_input()
630 raw_spin_unlock_irqrestore(&bank->slock, flags); in samsung_gpio_direction_input()
638 struct samsung_pin_bank *bank = gpiochip_get_data(gc); in samsung_gpio_direction_output() local
642 raw_spin_lock_irqsave(&bank->slock, flags); in samsung_gpio_direction_output()
645 raw_spin_unlock_irqrestore(&bank->slock, flags); in samsung_gpio_direction_output()
656 struct samsung_pin_bank *bank = gpiochip_get_data(gc); in samsung_gpio_to_irq() local
659 if (!bank->irq_domain) in samsung_gpio_to_irq()
662 virq = irq_create_mapping(bank->irq_domain, offset); in samsung_gpio_to_irq()
860 int pin, bank, ret; in samsung_pinctrl_register() local
891 /* for each pin, the name of the pin is pin-bank name + pin number */ in samsung_pinctrl_register()
892 for (bank = 0; bank < drvdata->nr_banks; bank++) { in samsung_pinctrl_register()
893 pin_bank = &drvdata->pin_banks[bank]; in samsung_pinctrl_register()
913 for (bank = 0; bank < drvdata->nr_banks; ++bank) { in samsung_pinctrl_register()
914 pin_bank = &drvdata->pin_banks[bank]; in samsung_pinctrl_register()
916 pin_bank->grange.id = bank; in samsung_pinctrl_register()
932 struct samsung_pin_bank *bank = drvdata->pin_banks; in samsung_pinctrl_unregister() local
935 for (i = 0; i < drvdata->nr_banks; ++i, ++bank) in samsung_pinctrl_unregister()
936 pinctrl_remove_gpio_range(drvdata->pctl_dev, &bank->grange); in samsung_pinctrl_unregister()
956 struct samsung_pin_bank *bank = drvdata->pin_banks; in samsung_gpiolib_register() local
961 for (i = 0; i < drvdata->nr_banks; ++i, ++bank) { in samsung_gpiolib_register()
962 bank->gpio_chip = samsung_gpiolib_chip; in samsung_gpiolib_register()
964 gc = &bank->gpio_chip; in samsung_gpiolib_register()
965 gc->base = bank->grange.base; in samsung_gpiolib_register()
966 gc->ngpio = bank->nr_pins; in samsung_gpiolib_register()
968 gc->fwnode = bank->fwnode; in samsung_gpiolib_register()
969 gc->label = bank->name; in samsung_gpiolib_register()
971 ret = devm_gpiochip_add_data(&pdev->dev, gc, bank); in samsung_gpiolib_register()
1006 struct samsung_pin_bank *bank; in samsung_banks_node_put() local
1009 bank = d->pin_banks; in samsung_banks_node_put()
1010 for (i = 0; i < d->nr_banks; ++i, ++bank) in samsung_banks_node_put()
1011 fwnode_handle_put(bank->fwnode); in samsung_banks_node_put()
1016 * skipping optional "-gpio" node suffix. When found, assign node to the bank.
1020 const char *suffix = "-gpio-bank"; in samsung_banks_node_get()
1021 struct samsung_pin_bank *bank; in samsung_banks_node_get() local
1023 /* Pin bank names are up to 4 characters */ in samsung_banks_node_get()
1028 bank = d->pin_banks; in samsung_banks_node_get()
1029 for (i = 0; i < d->nr_banks; ++i, ++bank) { in samsung_banks_node_get()
1030 strscpy(node_name, bank->name, sizeof(node_name)); in samsung_banks_node_get()
1033 dev_err(dev, "Too long pin bank name '%s', ignoring\n", in samsung_banks_node_get()
1034 bank->name); in samsung_banks_node_get()
1043 if (of_node_name_eq(np, bank->name)) in samsung_banks_node_get()
1048 bank->fwnode = child; in samsung_banks_node_get()
1050 dev_warn(dev, "Missing node for bank %s - invalid DTB\n", in samsung_banks_node_get()
1051 bank->name); in samsung_banks_node_get()
1063 struct samsung_pin_bank *bank; in samsung_pinctrl_get_soc_data() local
1097 bank = d->pin_banks; in samsung_pinctrl_get_soc_data()
1099 for (i = 0; i < ctrl->nr_banks; ++i, ++bdata, ++bank) { in samsung_pinctrl_get_soc_data()
1100 bank->type = bdata->type; in samsung_pinctrl_get_soc_data()
1101 bank->pctl_offset = bdata->pctl_offset; in samsung_pinctrl_get_soc_data()
1102 bank->nr_pins = bdata->nr_pins; in samsung_pinctrl_get_soc_data()
1103 bank->eint_func = bdata->eint_func; in samsung_pinctrl_get_soc_data()
1104 bank->eint_type = bdata->eint_type; in samsung_pinctrl_get_soc_data()
1105 bank->eint_mask = bdata->eint_mask; in samsung_pinctrl_get_soc_data()
1106 bank->eint_offset = bdata->eint_offset; in samsung_pinctrl_get_soc_data()
1107 bank->name = bdata->name; in samsung_pinctrl_get_soc_data()
1109 raw_spin_lock_init(&bank->slock); in samsung_pinctrl_get_soc_data()
1110 bank->drvdata = d; in samsung_pinctrl_get_soc_data()
1111 bank->pin_base = d->nr_pins; in samsung_pinctrl_get_soc_data()
1112 d->nr_pins += bank->nr_pins; in samsung_pinctrl_get_soc_data()
1114 bank->eint_base = virt_base[0]; in samsung_pinctrl_get_soc_data()
1115 bank->pctl_base = virt_base[bdata->pctl_res_idx]; in samsung_pinctrl_get_soc_data()
1200 struct samsung_pin_bank *bank = &drvdata->pin_banks[i]; in samsung_pinctrl_suspend() local
1201 void __iomem *reg = bank->pctl_base + bank->pctl_offset; in samsung_pinctrl_suspend()
1202 const u8 *offs = bank->type->reg_offset; in samsung_pinctrl_suspend()
1203 const u8 *widths = bank->type->fld_width; in samsung_pinctrl_suspend()
1212 bank->pm_save[type] = readl(reg + offs[type]); in samsung_pinctrl_suspend()
1214 if (widths[PINCFG_TYPE_FUNC] * bank->nr_pins > 32) { in samsung_pinctrl_suspend()
1216 bank->pm_save[PINCFG_TYPE_NUM] = in samsung_pinctrl_suspend()
1219 bank->name, reg, in samsung_pinctrl_suspend()
1220 bank->pm_save[PINCFG_TYPE_FUNC], in samsung_pinctrl_suspend()
1221 bank->pm_save[PINCFG_TYPE_NUM]); in samsung_pinctrl_suspend()
1223 pr_debug("Save %s @ %p (con %#010x)\n", bank->name, in samsung_pinctrl_suspend()
1224 reg, bank->pm_save[PINCFG_TYPE_FUNC]); in samsung_pinctrl_suspend()
1253 struct samsung_pin_bank *bank = &drvdata->pin_banks[i]; in samsung_pinctrl_resume() local
1254 void __iomem *reg = bank->pctl_base + bank->pctl_offset; in samsung_pinctrl_resume()
1255 const u8 *offs = bank->type->reg_offset; in samsung_pinctrl_resume()
1256 const u8 *widths = bank->type->fld_width; in samsung_pinctrl_resume()
1263 if (widths[PINCFG_TYPE_FUNC] * bank->nr_pins > 32) { in samsung_pinctrl_resume()
1266 bank->name, reg, in samsung_pinctrl_resume()
1269 bank->pm_save[PINCFG_TYPE_FUNC], in samsung_pinctrl_resume()
1270 bank->pm_save[PINCFG_TYPE_NUM]); in samsung_pinctrl_resume()
1271 writel(bank->pm_save[PINCFG_TYPE_NUM], in samsung_pinctrl_resume()
1274 pr_debug("%s @ %p (con %#010x => %#010x)\n", bank->name, in samsung_pinctrl_resume()
1276 bank->pm_save[PINCFG_TYPE_FUNC]); in samsung_pinctrl_resume()
1280 writel(bank->pm_save[type], reg + offs[type]); in samsung_pinctrl_resume()