Lines Matching full:pcs

205 #define PCS_QUIRK_HAS_SHARED_IRQ	(pcs->flags & PCS_QUIRK_SHARED_IRQ)
206 #define PCS_HAS_IRQ (pcs->flags & PCS_FEAT_IRQ)
207 #define PCS_HAS_PINCONF (pcs->flags & PCS_FEAT_PINCONF)
268 static unsigned int pcs_pin_reg_offset_get(struct pcs_device *pcs, in pcs_pin_reg_offset_get() argument
271 unsigned int mux_bytes = pcs->width / BITS_PER_BYTE; in pcs_pin_reg_offset_get()
273 if (pcs->bits_per_mux) { in pcs_pin_reg_offset_get()
276 pin_offset_bytes = (pcs->bits_per_pin * pin) / BITS_PER_BYTE; in pcs_pin_reg_offset_get()
283 static unsigned int pcs_pin_shift_reg_get(struct pcs_device *pcs, in pcs_pin_shift_reg_get() argument
286 return (pin % (pcs->width / pcs->bits_per_pin)) * pcs->bits_per_pin; in pcs_pin_shift_reg_get()
293 struct pcs_device *pcs; in pcs_pin_dbg_show() local
298 pcs = pinctrl_dev_get_drvdata(pctldev); in pcs_pin_dbg_show()
300 offset = pcs_pin_reg_offset_get(pcs, pin); in pcs_pin_dbg_show()
301 val = pcs->read(pcs->base + offset); in pcs_pin_dbg_show()
303 if (pcs->bits_per_mux) in pcs_pin_dbg_show()
304 val &= pcs->fmask << pcs_pin_shift_reg_get(pcs, pin); in pcs_pin_dbg_show()
306 pa = pcs->res->start + offset; in pcs_pin_dbg_show()
314 struct pcs_device *pcs; in pcs_dt_free_map() local
316 pcs = pinctrl_dev_get_drvdata(pctldev); in pcs_dt_free_map()
317 devm_kfree(pcs->dev, map); in pcs_dt_free_map()
336 struct pcs_device *pcs = pinctrl_dev_get_drvdata(pctldev); in pcs_get_function() local
352 dev_err(pcs->dev, "%s could not find function%i\n", in pcs_get_function()
362 struct pcs_device *pcs; in pcs_set_mux() local
367 pcs = pinctrl_dev_get_drvdata(pctldev); in pcs_set_mux()
369 if (!pcs->fmask) in pcs_set_mux()
378 dev_dbg(pcs->dev, "enabling %s function%i\n", in pcs_set_mux()
387 raw_spin_lock_irqsave(&pcs->lock, flags); in pcs_set_mux()
388 val = pcs->read(vals->reg); in pcs_set_mux()
390 if (pcs->bits_per_mux) in pcs_set_mux()
393 mask = pcs->fmask; in pcs_set_mux()
397 pcs->write(val, vals->reg); in pcs_set_mux()
398 raw_spin_unlock_irqrestore(&pcs->lock, flags); in pcs_set_mux()
407 struct pcs_device *pcs = pinctrl_dev_get_drvdata(pctldev); in pcs_request_gpio() local
413 if (!pcs->fmask) in pcs_request_gpio()
416 list_for_each_safe(pos, tmp, &pcs->gpiofuncs) { in pcs_request_gpio()
424 offset = pcs_pin_reg_offset_get(pcs, pin); in pcs_request_gpio()
426 if (pcs->bits_per_mux) { in pcs_request_gpio()
427 int pin_shift = pcs_pin_shift_reg_get(pcs, pin); in pcs_request_gpio()
429 data = pcs->read(pcs->base + offset); in pcs_request_gpio()
430 data &= ~(pcs->fmask << pin_shift); in pcs_request_gpio()
432 pcs->write(data, pcs->base + offset); in pcs_request_gpio()
434 data = pcs->read(pcs->base + offset); in pcs_request_gpio()
435 data &= ~pcs->fmask; in pcs_request_gpio()
437 pcs->write(data, pcs->base + offset); in pcs_request_gpio()
485 struct pcs_device *pcs = pinctrl_dev_get_drvdata(pctldev); in pcs_pinconf_get() local
507 offset = pin * (pcs->width / BITS_PER_BYTE); in pcs_pinconf_get()
508 data = pcs->read(pcs->base + offset) & func->conf[i].mask; in pcs_pinconf_get()
550 struct pcs_device *pcs = pinctrl_dev_get_drvdata(pctldev); in pcs_pinconf_set() local
575 offset = pin * (pcs->width / BITS_PER_BYTE); in pcs_pinconf_set()
576 data = pcs->read(pcs->base + offset); in pcs_pinconf_set()
605 pcs->write(data, pcs->base + offset); in pcs_pinconf_set()
685 * @pcs: pcs driver instance
688 static int pcs_add_pin(struct pcs_device *pcs, unsigned int offset) in pcs_add_pin() argument
690 struct pcs_soc_data *pcs_soc = &pcs->socdata; in pcs_add_pin()
694 i = pcs->pins.cur; in pcs_add_pin()
695 if (i >= pcs->desc.npins) { in pcs_add_pin()
696 dev_err(pcs->dev, "too many pins, max %i\n", in pcs_add_pin()
697 pcs->desc.npins); in pcs_add_pin()
704 val = pcs->read(pcs->base + offset); in pcs_add_pin()
706 dev_dbg(pcs->dev, "irq enabled at boot for pin at %lx (%x), clearing\n", in pcs_add_pin()
707 (unsigned long)pcs->res->start + offset, val); in pcs_add_pin()
709 pcs->write(val, pcs->base + offset); in pcs_add_pin()
713 pin = &pcs->pins.pa[i]; in pcs_add_pin()
715 pcs->pins.cur++; in pcs_add_pin()
722 * @pcs: pcs driver instance
729 static int pcs_allocate_pin_table(struct pcs_device *pcs) in pcs_allocate_pin_table() argument
733 mux_bytes = pcs->width / BITS_PER_BYTE; in pcs_allocate_pin_table()
735 if (pcs->bits_per_mux && pcs->fmask) { in pcs_allocate_pin_table()
736 pcs->bits_per_pin = fls(pcs->fmask); in pcs_allocate_pin_table()
737 nr_pins = (pcs->size * BITS_PER_BYTE) / pcs->bits_per_pin; in pcs_allocate_pin_table()
739 nr_pins = pcs->size / mux_bytes; in pcs_allocate_pin_table()
742 dev_dbg(pcs->dev, "allocating %i pins\n", nr_pins); in pcs_allocate_pin_table()
743 pcs->pins.pa = devm_kcalloc(pcs->dev, in pcs_allocate_pin_table()
744 nr_pins, sizeof(*pcs->pins.pa), in pcs_allocate_pin_table()
746 if (!pcs->pins.pa) in pcs_allocate_pin_table()
749 pcs->desc.pins = pcs->pins.pa; in pcs_allocate_pin_table()
750 pcs->desc.npins = nr_pins; in pcs_allocate_pin_table()
752 for (i = 0; i < pcs->desc.npins; i++) { in pcs_allocate_pin_table()
756 offset = pcs_pin_reg_offset_get(pcs, i); in pcs_allocate_pin_table()
757 res = pcs_add_pin(pcs, offset); in pcs_allocate_pin_table()
759 dev_err(pcs->dev, "error adding pins: %i\n", res); in pcs_allocate_pin_table()
769 * @pcs: pcs driver instance
779 static int pcs_add_function(struct pcs_device *pcs, in pcs_add_function() argument
790 function = devm_kzalloc(pcs->dev, sizeof(*function), GFP_KERNEL); in pcs_add_function()
798 selector = pinmux_generic_add_function(pcs->pctl, name, in pcs_add_function()
802 devm_kfree(pcs->dev, function); in pcs_add_function()
813 * @pcs: pcs driver instance
818 static int pcs_get_pin_by_offset(struct pcs_device *pcs, unsigned offset) in pcs_get_pin_by_offset() argument
822 if (offset >= pcs->size) { in pcs_get_pin_by_offset()
823 dev_err(pcs->dev, "mux offset out of range: 0x%x (0x%x)\n", in pcs_get_pin_by_offset()
824 offset, pcs->size); in pcs_get_pin_by_offset()
828 if (pcs->bits_per_mux) in pcs_get_pin_by_offset()
829 index = (offset * BITS_PER_BYTE) / pcs->bits_per_pin; in pcs_get_pin_by_offset()
831 index = offset / (pcs->width / BITS_PER_BYTE); in pcs_get_pin_by_offset()
872 static void pcs_add_conf2(struct pcs_device *pcs, struct device_node *np, in pcs_add_conf2() argument
891 static void pcs_add_conf4(struct pcs_device *pcs, struct device_node *np, in pcs_add_conf4() argument
903 dev_err(pcs->dev, "mask field of the property can't be 0\n"); in pcs_add_conf4()
911 dev_dbg(pcs->dev, "failed to match enable or disable bits\n"); in pcs_add_conf4()
916 static int pcs_parse_pinconf(struct pcs_device *pcs, struct device_node *np, in pcs_parse_pinconf() argument
955 func->conf = devm_kcalloc(pcs->dev, in pcs_parse_pinconf()
963 settings = devm_kcalloc(pcs->dev, nconfs, sizeof(unsigned long), in pcs_parse_pinconf()
970 pcs_add_conf2(pcs, np, prop2[i].name, prop2[i].param, in pcs_parse_pinconf()
973 pcs_add_conf4(pcs, np, prop4[i].name, prop4[i].param, in pcs_parse_pinconf()
984 * @pcs: pinctrl driver instance
1001 static int pcs_parse_one_pinctrl_entry(struct pcs_device *pcs, in pcs_parse_one_pinctrl_entry() argument
1014 dev_err(pcs->dev, "Invalid number of rows: %d\n", rows); in pcs_parse_one_pinctrl_entry()
1018 vals = devm_kcalloc(pcs->dev, rows, sizeof(*vals), GFP_KERNEL); in pcs_parse_one_pinctrl_entry()
1022 pins = devm_kcalloc(pcs->dev, rows, sizeof(*pins), GFP_KERNEL); in pcs_parse_one_pinctrl_entry()
1036 dev_err(pcs->dev, "invalid args_count for spec: %i\n", in pcs_parse_one_pinctrl_entry()
1042 vals[found].reg = pcs->base + offset; in pcs_parse_one_pinctrl_entry()
1053 dev_dbg(pcs->dev, "%pOFn index: 0x%x value: 0x%x\n", in pcs_parse_one_pinctrl_entry()
1056 pin = pcs_get_pin_by_offset(pcs, offset); in pcs_parse_one_pinctrl_entry()
1058 dev_err(pcs->dev, in pcs_parse_one_pinctrl_entry()
1067 mutex_lock(&pcs->mutex); in pcs_parse_one_pinctrl_entry()
1068 fsel = pcs_add_function(pcs, &function, np->name, vals, found, in pcs_parse_one_pinctrl_entry()
1075 gsel = pinctrl_generic_add_group(pcs->pctl, np->name, pins, found, pcs); in pcs_parse_one_pinctrl_entry()
1086 res = pcs_parse_pinconf(pcs, np, function, map); in pcs_parse_one_pinctrl_entry()
1096 mutex_unlock(&pcs->mutex); in pcs_parse_one_pinctrl_entry()
1101 pinctrl_generic_remove_group(pcs->pctl, gsel); in pcs_parse_one_pinctrl_entry()
1104 pinmux_generic_remove_function(pcs->pctl, fsel); in pcs_parse_one_pinctrl_entry()
1106 mutex_unlock(&pcs->mutex); in pcs_parse_one_pinctrl_entry()
1107 devm_kfree(pcs->dev, pins); in pcs_parse_one_pinctrl_entry()
1110 devm_kfree(pcs->dev, vals); in pcs_parse_one_pinctrl_entry()
1115 static int pcs_parse_bits_in_pinctrl_entry(struct pcs_device *pcs, in pcs_parse_bits_in_pinctrl_entry() argument
1129 dev_err(pcs->dev, "Invalid number of rows: %d\n", rows); in pcs_parse_bits_in_pinctrl_entry()
1134 dev_err(pcs->dev, "pinconf not supported\n"); in pcs_parse_bits_in_pinctrl_entry()
1138 npins_in_row = pcs->width / pcs->bits_per_pin; in pcs_parse_bits_in_pinctrl_entry()
1140 vals = devm_kzalloc(pcs->dev, in pcs_parse_bits_in_pinctrl_entry()
1146 pins = devm_kzalloc(pcs->dev, in pcs_parse_bits_in_pinctrl_entry()
1164 dev_err(pcs->dev, "invalid args_count for spec: %i\n", in pcs_parse_bits_in_pinctrl_entry()
1174 dev_dbg(pcs->dev, "%pOFn index: 0x%x value: 0x%x mask: 0x%x\n", in pcs_parse_bits_in_pinctrl_entry()
1180 pin_num_from_lsb = bit_pos / pcs->bits_per_pin; in pcs_parse_bits_in_pinctrl_entry()
1181 mask_pos = ((pcs->fmask) << bit_pos); in pcs_parse_bits_in_pinctrl_entry()
1186 dev_err(pcs->dev, in pcs_parse_bits_in_pinctrl_entry()
1195 dev_warn(pcs->dev, in pcs_parse_bits_in_pinctrl_entry()
1202 vals[found].reg = pcs->base + offset; in pcs_parse_bits_in_pinctrl_entry()
1205 pin = pcs_get_pin_by_offset(pcs, offset); in pcs_parse_bits_in_pinctrl_entry()
1207 dev_err(pcs->dev, in pcs_parse_bits_in_pinctrl_entry()
1217 mutex_lock(&pcs->mutex); in pcs_parse_bits_in_pinctrl_entry()
1218 fsel = pcs_add_function(pcs, &function, np->name, vals, found, in pcs_parse_bits_in_pinctrl_entry()
1225 res = pinctrl_generic_add_group(pcs->pctl, np->name, pins, found, pcs); in pcs_parse_bits_in_pinctrl_entry()
1234 mutex_unlock(&pcs->mutex); in pcs_parse_bits_in_pinctrl_entry()
1239 pinmux_generic_remove_function(pcs->pctl, fsel); in pcs_parse_bits_in_pinctrl_entry()
1241 mutex_unlock(&pcs->mutex); in pcs_parse_bits_in_pinctrl_entry()
1242 devm_kfree(pcs->dev, pins); in pcs_parse_bits_in_pinctrl_entry()
1245 devm_kfree(pcs->dev, vals); in pcs_parse_bits_in_pinctrl_entry()
1260 struct pcs_device *pcs; in pcs_dt_node_to_map() local
1264 pcs = pinctrl_dev_get_drvdata(pctldev); in pcs_dt_node_to_map()
1267 *map = devm_kcalloc(pcs->dev, 2, sizeof(**map), GFP_KERNEL); in pcs_dt_node_to_map()
1273 pgnames = devm_kzalloc(pcs->dev, sizeof(*pgnames), GFP_KERNEL); in pcs_dt_node_to_map()
1279 if (pcs->bits_per_mux) { in pcs_dt_node_to_map()
1280 ret = pcs_parse_bits_in_pinctrl_entry(pcs, np_config, map, in pcs_dt_node_to_map()
1283 dev_err(pcs->dev, "no pins entries for %pOFn\n", in pcs_dt_node_to_map()
1288 ret = pcs_parse_one_pinctrl_entry(pcs, np_config, map, in pcs_dt_node_to_map()
1291 dev_err(pcs->dev, "no pins entries for %pOFn\n", in pcs_dt_node_to_map()
1300 devm_kfree(pcs->dev, pgnames); in pcs_dt_node_to_map()
1302 devm_kfree(pcs->dev, *map); in pcs_dt_node_to_map()
1309 * @pcs: pcs driver instance
1311 static void pcs_irq_free(struct pcs_device *pcs) in pcs_irq_free() argument
1313 struct pcs_soc_data *pcs_soc = &pcs->socdata; in pcs_irq_free()
1318 if (pcs->domain) in pcs_irq_free()
1319 irq_domain_remove(pcs->domain); in pcs_irq_free()
1329 * @pcs: pcs driver instance
1331 static void pcs_free_resources(struct pcs_device *pcs) in pcs_free_resources() argument
1333 pcs_irq_free(pcs); in pcs_free_resources()
1336 if (pcs->missing_nr_pinctrl_cells) in pcs_free_resources()
1337 of_remove_property(pcs->np, pcs->missing_nr_pinctrl_cells); in pcs_free_resources()
1341 static int pcs_add_gpio_func(struct device_node *node, struct pcs_device *pcs) in pcs_add_gpio_func() argument
1357 range = devm_kzalloc(pcs->dev, sizeof(*range), GFP_KERNEL); in pcs_add_gpio_func()
1365 mutex_lock(&pcs->mutex); in pcs_add_gpio_func()
1366 list_add_tail(&range->node, &pcs->gpiofuncs); in pcs_add_gpio_func()
1367 mutex_unlock(&pcs->mutex); in pcs_add_gpio_func()
1398 struct pcs_device *pcs; in pcs_irq_set() local
1402 pcs = container_of(pcs_soc, struct pcs_device, socdata); in pcs_irq_set()
1403 list_for_each(pos, &pcs->irqs) { in pcs_irq_set()
1412 raw_spin_lock(&pcs->lock); in pcs_irq_set()
1413 mask = pcs->read(pcswi->reg); in pcs_irq_set()
1418 pcs->write(mask, pcswi->reg); in pcs_irq_set()
1421 mask = pcs->read(pcswi->reg); in pcs_irq_set()
1422 raw_spin_unlock(&pcs->lock); in pcs_irq_set()
1479 struct pcs_device *pcs; in pcs_irq_handle() local
1483 pcs = container_of(pcs_soc, struct pcs_device, socdata); in pcs_irq_handle()
1484 list_for_each(pos, &pcs->irqs) { in pcs_irq_handle()
1489 raw_spin_lock(&pcs->lock); in pcs_irq_handle()
1490 mask = pcs->read(pcswi->reg); in pcs_irq_handle()
1491 raw_spin_unlock(&pcs->lock); in pcs_irq_handle()
1493 generic_handle_domain_irq(pcs->domain, in pcs_irq_handle()
1540 struct pcs_device *pcs; in pcs_irqdomain_map() local
1543 pcs = container_of(pcs_soc, struct pcs_device, socdata); in pcs_irqdomain_map()
1544 pcswi = devm_kzalloc(pcs->dev, sizeof(*pcswi), GFP_KERNEL); in pcs_irqdomain_map()
1548 pcswi->reg = pcs->base + hwirq; in pcs_irqdomain_map()
1552 mutex_lock(&pcs->mutex); in pcs_irqdomain_map()
1553 list_add_tail(&pcswi->node, &pcs->irqs); in pcs_irqdomain_map()
1554 mutex_unlock(&pcs->mutex); in pcs_irqdomain_map()
1557 irq_set_chip_and_handler(irq, &pcs->chip, in pcs_irqdomain_map()
1572 * @pcs: pcs driver instance
1575 static int pcs_irq_init_chained_handler(struct pcs_device *pcs, in pcs_irq_init_chained_handler() argument
1578 struct pcs_soc_data *pcs_soc = &pcs->socdata; in pcs_irq_init_chained_handler()
1588 INIT_LIST_HEAD(&pcs->irqs); in pcs_irq_init_chained_handler()
1589 pcs->chip.name = name; in pcs_irq_init_chained_handler()
1590 pcs->chip.irq_ack = pcs_irq_mask; in pcs_irq_init_chained_handler()
1591 pcs->chip.irq_mask = pcs_irq_mask; in pcs_irq_init_chained_handler()
1592 pcs->chip.irq_unmask = pcs_irq_unmask; in pcs_irq_init_chained_handler()
1593 pcs->chip.irq_set_wake = pcs_irq_set_wake; in pcs_irq_init_chained_handler()
1618 num_irqs = pcs->size; in pcs_irq_init_chained_handler()
1620 pcs->domain = irq_domain_add_simple(np, num_irqs, 0, in pcs_irq_init_chained_handler()
1623 if (!pcs->domain) { in pcs_irq_init_chained_handler()
1631 static int pcs_save_context(struct pcs_device *pcs) in pcs_save_context() argument
1638 mux_bytes = pcs->width / BITS_PER_BYTE; in pcs_save_context()
1640 if (!pcs->saved_vals) { in pcs_save_context()
1641 pcs->saved_vals = devm_kzalloc(pcs->dev, pcs->size, GFP_ATOMIC); in pcs_save_context()
1642 if (!pcs->saved_vals) in pcs_save_context()
1646 switch (pcs->width) { in pcs_save_context()
1648 regsl = pcs->saved_vals; in pcs_save_context()
1649 for (i = 0; i < pcs->size; i += mux_bytes) in pcs_save_context()
1650 *regsl++ = pcs->read(pcs->base + i); in pcs_save_context()
1653 regsw = pcs->saved_vals; in pcs_save_context()
1654 for (i = 0; i < pcs->size; i += mux_bytes) in pcs_save_context()
1655 *regsw++ = pcs->read(pcs->base + i); in pcs_save_context()
1658 regshw = pcs->saved_vals; in pcs_save_context()
1659 for (i = 0; i < pcs->size; i += mux_bytes) in pcs_save_context()
1660 *regshw++ = pcs->read(pcs->base + i); in pcs_save_context()
1667 static void pcs_restore_context(struct pcs_device *pcs) in pcs_restore_context() argument
1674 mux_bytes = pcs->width / BITS_PER_BYTE; in pcs_restore_context()
1676 switch (pcs->width) { in pcs_restore_context()
1678 regsl = pcs->saved_vals; in pcs_restore_context()
1679 for (i = 0; i < pcs->size; i += mux_bytes) in pcs_restore_context()
1680 pcs->write(*regsl++, pcs->base + i); in pcs_restore_context()
1683 regsw = pcs->saved_vals; in pcs_restore_context()
1684 for (i = 0; i < pcs->size; i += mux_bytes) in pcs_restore_context()
1685 pcs->write(*regsw++, pcs->base + i); in pcs_restore_context()
1688 regshw = pcs->saved_vals; in pcs_restore_context()
1689 for (i = 0; i < pcs->size; i += mux_bytes) in pcs_restore_context()
1690 pcs->write(*regshw++, pcs->base + i); in pcs_restore_context()
1697 struct pcs_device *pcs = dev_get_drvdata(dev); in pinctrl_single_suspend_noirq() local
1699 if (pcs->flags & PCS_CONTEXT_LOSS_OFF) { in pinctrl_single_suspend_noirq()
1702 ret = pcs_save_context(pcs); in pinctrl_single_suspend_noirq()
1707 return pinctrl_force_sleep(pcs->pctl); in pinctrl_single_suspend_noirq()
1712 struct pcs_device *pcs = dev_get_drvdata(dev); in pinctrl_single_resume_noirq() local
1714 if (pcs->flags & PCS_CONTEXT_LOSS_OFF) in pinctrl_single_resume_noirq()
1715 pcs_restore_context(pcs); in pinctrl_single_resume_noirq()
1717 return pinctrl_force_default(pcs->pctl); in pinctrl_single_resume_noirq()
1726 * @pcs: pinctrl driver instance
1734 static int pcs_quirk_missing_pinctrl_cells(struct pcs_device *pcs, in pcs_quirk_missing_pinctrl_cells() argument
1747 dev_warn(pcs->dev, "please update dts to use %s = <%i>\n", in pcs_quirk_missing_pinctrl_cells()
1750 p = devm_kzalloc(pcs->dev, sizeof(*p), GFP_KERNEL); in pcs_quirk_missing_pinctrl_cells()
1755 p->value = devm_kzalloc(pcs->dev, sizeof(__be32), GFP_KERNEL); in pcs_quirk_missing_pinctrl_cells()
1760 p->name = devm_kstrdup(pcs->dev, name, GFP_KERNEL); in pcs_quirk_missing_pinctrl_cells()
1764 pcs->missing_nr_pinctrl_cells = p; in pcs_quirk_missing_pinctrl_cells()
1767 error = of_add_property(np, pcs->missing_nr_pinctrl_cells); in pcs_quirk_missing_pinctrl_cells()
1778 struct pcs_device *pcs; in pcs_probe() local
1786 pcs = devm_kzalloc(&pdev->dev, sizeof(*pcs), GFP_KERNEL); in pcs_probe()
1787 if (!pcs) in pcs_probe()
1790 pcs->dev = &pdev->dev; in pcs_probe()
1791 pcs->np = np; in pcs_probe()
1792 raw_spin_lock_init(&pcs->lock); in pcs_probe()
1793 mutex_init(&pcs->mutex); in pcs_probe()
1794 INIT_LIST_HEAD(&pcs->gpiofuncs); in pcs_probe()
1795 pcs->flags = soc->flags; in pcs_probe()
1796 memcpy(&pcs->socdata, soc, sizeof(*soc)); in pcs_probe()
1799 &pcs->width); in pcs_probe()
1801 dev_err(pcs->dev, "register width not specified\n"); in pcs_probe()
1807 &pcs->fmask); in pcs_probe()
1809 pcs->fshift = __ffs(pcs->fmask); in pcs_probe()
1810 pcs->fmax = pcs->fmask >> pcs->fshift; in pcs_probe()
1813 pcs->fmask = 0; in pcs_probe()
1814 pcs->fshift = 0; in pcs_probe()
1815 pcs->fmax = 0; in pcs_probe()
1819 &pcs->foff); in pcs_probe()
1821 pcs->foff = PCS_OFF_DISABLED; in pcs_probe()
1823 pcs->bits_per_mux = of_property_read_bool(np, in pcs_probe()
1825 ret = pcs_quirk_missing_pinctrl_cells(pcs, np, in pcs_probe()
1826 pcs->bits_per_mux ? 2 : 1); in pcs_probe()
1835 dev_err(pcs->dev, "could not get resource\n"); in pcs_probe()
1839 pcs->res = devm_request_mem_region(pcs->dev, res->start, in pcs_probe()
1841 if (!pcs->res) { in pcs_probe()
1842 dev_err(pcs->dev, "could not get mem_region\n"); in pcs_probe()
1846 pcs->size = resource_size(pcs->res); in pcs_probe()
1847 pcs->base = devm_ioremap(pcs->dev, pcs->res->start, pcs->size); in pcs_probe()
1848 if (!pcs->base) { in pcs_probe()
1849 dev_err(pcs->dev, "could not ioremap\n"); in pcs_probe()
1853 platform_set_drvdata(pdev, pcs); in pcs_probe()
1855 switch (pcs->width) { in pcs_probe()
1857 pcs->read = pcs_readb; in pcs_probe()
1858 pcs->write = pcs_writeb; in pcs_probe()
1861 pcs->read = pcs_readw; in pcs_probe()
1862 pcs->write = pcs_writew; in pcs_probe()
1865 pcs->read = pcs_readl; in pcs_probe()
1866 pcs->write = pcs_writel; in pcs_probe()
1872 pcs->desc.name = DRIVER_NAME; in pcs_probe()
1873 pcs->desc.pctlops = &pcs_pinctrl_ops; in pcs_probe()
1874 pcs->desc.pmxops = &pcs_pinmux_ops; in pcs_probe()
1876 pcs->desc.confops = &pcs_pinconf_ops; in pcs_probe()
1877 pcs->desc.owner = THIS_MODULE; in pcs_probe()
1879 ret = pcs_allocate_pin_table(pcs); in pcs_probe()
1883 ret = devm_pinctrl_register_and_init(pcs->dev, &pcs->desc, pcs, &pcs->pctl); in pcs_probe()
1885 dev_err(pcs->dev, "could not register single pinctrl driver\n"); in pcs_probe()
1889 ret = pcs_add_gpio_func(np, pcs); in pcs_probe()
1893 pcs->socdata.irq = irq_of_parse_and_map(np, 0); in pcs_probe()
1894 if (pcs->socdata.irq) in pcs_probe()
1895 pcs->flags |= PCS_FEAT_IRQ; in pcs_probe()
1901 pcs->socdata.rearm = pdata->rearm; in pcs_probe()
1903 pcs->socdata.irq = pdata->irq; in pcs_probe()
1904 pcs->flags |= PCS_FEAT_IRQ; in pcs_probe()
1909 ret = pcs_irq_init_chained_handler(pcs, np); in pcs_probe()
1911 dev_warn(pcs->dev, "initialized with no interrupts\n"); in pcs_probe()
1914 dev_info(pcs->dev, "%i pins, size %u\n", pcs->desc.npins, pcs->size); in pcs_probe()
1916 ret = pinctrl_enable(pcs->pctl); in pcs_probe()
1922 pcs_free_resources(pcs); in pcs_probe()
1929 struct pcs_device *pcs = platform_get_drvdata(pdev); in pcs_remove() local
1931 pcs_free_resources(pcs); in pcs_remove()