Lines Matching full:pcs
210 #define PCS_QUIRK_HAS_SHARED_IRQ (pcs->flags & PCS_QUIRK_SHARED_IRQ)
211 #define PCS_HAS_IRQ (pcs->flags & PCS_FEAT_IRQ)
212 #define PCS_HAS_PINCONF (pcs->flags & PCS_FEAT_PINCONF)
277 struct pcs_device *pcs; in pcs_pin_dbg_show() local
282 pcs = pinctrl_dev_get_drvdata(pctldev); in pcs_pin_dbg_show()
284 mux_bytes = pcs->width / BITS_PER_BYTE; in pcs_pin_dbg_show()
286 val = pcs->read(pcs->base + offset); in pcs_pin_dbg_show()
287 pa = pcs->res->start + offset; in pcs_pin_dbg_show()
295 struct pcs_device *pcs; in pcs_dt_free_map() local
297 pcs = pinctrl_dev_get_drvdata(pctldev); in pcs_dt_free_map()
298 devm_kfree(pcs->dev, map); in pcs_dt_free_map()
317 struct pcs_device *pcs = pinctrl_dev_get_drvdata(pctldev); in pcs_get_function() local
331 dev_err(pcs->dev, "%s could not find function%i\n", in pcs_get_function()
341 struct pcs_device *pcs; in pcs_set_mux() local
346 pcs = pinctrl_dev_get_drvdata(pctldev); in pcs_set_mux()
348 if (!pcs->fmask) in pcs_set_mux()
355 dev_dbg(pcs->dev, "enabling %s function%i\n", in pcs_set_mux()
364 raw_spin_lock_irqsave(&pcs->lock, flags); in pcs_set_mux()
365 val = pcs->read(vals->reg); in pcs_set_mux()
367 if (pcs->bits_per_mux) in pcs_set_mux()
370 mask = pcs->fmask; in pcs_set_mux()
374 pcs->write(val, vals->reg); in pcs_set_mux()
375 raw_spin_unlock_irqrestore(&pcs->lock, flags); in pcs_set_mux()
384 struct pcs_device *pcs = pinctrl_dev_get_drvdata(pctldev); in pcs_request_gpio() local
391 if (!pcs->fmask) in pcs_request_gpio()
394 list_for_each_safe(pos, tmp, &pcs->gpiofuncs) { in pcs_request_gpio()
399 mux_bytes = pcs->width / BITS_PER_BYTE; in pcs_request_gpio()
401 if (pcs->bits_per_mux) { in pcs_request_gpio()
404 byte_num = (pcs->bits_per_pin * pin) / BITS_PER_BYTE; in pcs_request_gpio()
406 pin_shift = pin % (pcs->width / pcs->bits_per_pin) * in pcs_request_gpio()
407 pcs->bits_per_pin; in pcs_request_gpio()
409 data = pcs->read(pcs->base + offset); in pcs_request_gpio()
410 data &= ~(pcs->fmask << pin_shift); in pcs_request_gpio()
412 pcs->write(data, pcs->base + offset); in pcs_request_gpio()
414 data = pcs->read(pcs->base + pin * mux_bytes); in pcs_request_gpio()
415 data &= ~pcs->fmask; in pcs_request_gpio()
417 pcs->write(data, pcs->base + pin * mux_bytes); in pcs_request_gpio()
465 struct pcs_device *pcs = pinctrl_dev_get_drvdata(pctldev); in pcs_pinconf_get() local
487 offset = pin * (pcs->width / BITS_PER_BYTE); in pcs_pinconf_get()
488 data = pcs->read(pcs->base + offset) & func->conf[i].mask; in pcs_pinconf_get()
529 struct pcs_device *pcs = pinctrl_dev_get_drvdata(pctldev); in pcs_pinconf_set() local
545 offset = pin * (pcs->width / BITS_PER_BYTE); in pcs_pinconf_set()
546 data = pcs->read(pcs->base + offset); in pcs_pinconf_set()
577 pcs->write(data, pcs->base + offset); in pcs_pinconf_set()
657 * @pcs: pcs driver instance
661 static int pcs_add_pin(struct pcs_device *pcs, unsigned offset, in pcs_add_pin() argument
664 struct pcs_soc_data *pcs_soc = &pcs->socdata; in pcs_add_pin()
668 i = pcs->pins.cur; in pcs_add_pin()
669 if (i >= pcs->desc.npins) { in pcs_add_pin()
670 dev_err(pcs->dev, "too many pins, max %i\n", in pcs_add_pin()
671 pcs->desc.npins); in pcs_add_pin()
678 val = pcs->read(pcs->base + offset); in pcs_add_pin()
680 dev_dbg(pcs->dev, "irq enabled at boot for pin at %lx (%x), clearing\n", in pcs_add_pin()
681 (unsigned long)pcs->res->start + offset, val); in pcs_add_pin()
683 pcs->write(val, pcs->base + offset); in pcs_add_pin()
687 pin = &pcs->pins.pa[i]; in pcs_add_pin()
689 pcs->pins.cur++; in pcs_add_pin()
696 * @pcs: pcs driver instance
703 static int pcs_allocate_pin_table(struct pcs_device *pcs) in pcs_allocate_pin_table() argument
708 mux_bytes = pcs->width / BITS_PER_BYTE; in pcs_allocate_pin_table()
710 if (pcs->bits_per_mux) { in pcs_allocate_pin_table()
711 pcs->bits_per_pin = fls(pcs->fmask); in pcs_allocate_pin_table()
712 nr_pins = (pcs->size * BITS_PER_BYTE) / pcs->bits_per_pin; in pcs_allocate_pin_table()
713 num_pins_in_register = pcs->width / pcs->bits_per_pin; in pcs_allocate_pin_table()
715 nr_pins = pcs->size / mux_bytes; in pcs_allocate_pin_table()
718 dev_dbg(pcs->dev, "allocating %i pins\n", nr_pins); in pcs_allocate_pin_table()
719 pcs->pins.pa = devm_kcalloc(pcs->dev, in pcs_allocate_pin_table()
720 nr_pins, sizeof(*pcs->pins.pa), in pcs_allocate_pin_table()
722 if (!pcs->pins.pa) in pcs_allocate_pin_table()
725 pcs->desc.pins = pcs->pins.pa; in pcs_allocate_pin_table()
726 pcs->desc.npins = nr_pins; in pcs_allocate_pin_table()
728 for (i = 0; i < pcs->desc.npins; i++) { in pcs_allocate_pin_table()
734 if (pcs->bits_per_mux) { in pcs_allocate_pin_table()
735 byte_num = (pcs->bits_per_pin * i) / BITS_PER_BYTE; in pcs_allocate_pin_table()
741 res = pcs_add_pin(pcs, offset, pin_pos); in pcs_allocate_pin_table()
743 dev_err(pcs->dev, "error adding pins: %i\n", res); in pcs_allocate_pin_table()
753 * @pcs: pcs driver instance
763 static int pcs_add_function(struct pcs_device *pcs, in pcs_add_function() argument
774 function = devm_kzalloc(pcs->dev, sizeof(*function), GFP_KERNEL); in pcs_add_function()
781 selector = pinmux_generic_add_function(pcs->pctl, name, in pcs_add_function()
785 devm_kfree(pcs->dev, function); in pcs_add_function()
796 * @pcs: pcs driver instance
801 static int pcs_get_pin_by_offset(struct pcs_device *pcs, unsigned offset) in pcs_get_pin_by_offset() argument
805 if (offset >= pcs->size) { in pcs_get_pin_by_offset()
806 dev_err(pcs->dev, "mux offset out of range: 0x%x (0x%x)\n", in pcs_get_pin_by_offset()
807 offset, pcs->size); in pcs_get_pin_by_offset()
811 if (pcs->bits_per_mux) in pcs_get_pin_by_offset()
812 index = (offset * BITS_PER_BYTE) / pcs->bits_per_pin; in pcs_get_pin_by_offset()
814 index = offset / (pcs->width / BITS_PER_BYTE); in pcs_get_pin_by_offset()
855 static void pcs_add_conf2(struct pcs_device *pcs, struct device_node *np, in pcs_add_conf2() argument
874 static void pcs_add_conf4(struct pcs_device *pcs, struct device_node *np, in pcs_add_conf4() argument
886 dev_err(pcs->dev, "mask field of the property can't be 0\n"); in pcs_add_conf4()
894 dev_dbg(pcs->dev, "failed to match enable or disable bits\n"); in pcs_add_conf4()
899 static int pcs_parse_pinconf(struct pcs_device *pcs, struct device_node *np, in pcs_parse_pinconf() argument
937 func->conf = devm_kcalloc(pcs->dev, in pcs_parse_pinconf()
945 settings = devm_kcalloc(pcs->dev, nconfs, sizeof(unsigned long), in pcs_parse_pinconf()
952 pcs_add_conf2(pcs, np, prop2[i].name, prop2[i].param, in pcs_parse_pinconf()
955 pcs_add_conf4(pcs, np, prop4[i].name, prop4[i].param, in pcs_parse_pinconf()
966 * @pcs: pinctrl driver instance
983 static int pcs_parse_one_pinctrl_entry(struct pcs_device *pcs, in pcs_parse_one_pinctrl_entry() argument
996 dev_err(pcs->dev, "Invalid number of rows: %d\n", rows); in pcs_parse_one_pinctrl_entry()
1000 vals = devm_kcalloc(pcs->dev, rows, sizeof(*vals), GFP_KERNEL); in pcs_parse_one_pinctrl_entry()
1004 pins = devm_kcalloc(pcs->dev, rows, sizeof(*pins), GFP_KERNEL); in pcs_parse_one_pinctrl_entry()
1018 dev_err(pcs->dev, "invalid args_count for spec: %i\n", in pcs_parse_one_pinctrl_entry()
1024 vals[found].reg = pcs->base + offset; in pcs_parse_one_pinctrl_entry()
1035 dev_dbg(pcs->dev, "%pOFn index: 0x%x value: 0x%x\n", in pcs_parse_one_pinctrl_entry()
1038 pin = pcs_get_pin_by_offset(pcs, offset); in pcs_parse_one_pinctrl_entry()
1040 dev_err(pcs->dev, in pcs_parse_one_pinctrl_entry()
1049 mutex_lock(&pcs->mutex); in pcs_parse_one_pinctrl_entry()
1050 fsel = pcs_add_function(pcs, &function, np->name, vals, found, in pcs_parse_one_pinctrl_entry()
1057 gsel = pinctrl_generic_add_group(pcs->pctl, np->name, pins, found, pcs); in pcs_parse_one_pinctrl_entry()
1068 res = pcs_parse_pinconf(pcs, np, function, map); in pcs_parse_one_pinctrl_entry()
1078 mutex_unlock(&pcs->mutex); in pcs_parse_one_pinctrl_entry()
1083 pinctrl_generic_remove_group(pcs->pctl, gsel); in pcs_parse_one_pinctrl_entry()
1086 pinmux_generic_remove_function(pcs->pctl, fsel); in pcs_parse_one_pinctrl_entry()
1088 mutex_unlock(&pcs->mutex); in pcs_parse_one_pinctrl_entry()
1089 devm_kfree(pcs->dev, pins); in pcs_parse_one_pinctrl_entry()
1092 devm_kfree(pcs->dev, vals); in pcs_parse_one_pinctrl_entry()
1097 static int pcs_parse_bits_in_pinctrl_entry(struct pcs_device *pcs, in pcs_parse_bits_in_pinctrl_entry() argument
1111 dev_err(pcs->dev, "Invalid number of rows: %d\n", rows); in pcs_parse_bits_in_pinctrl_entry()
1115 npins_in_row = pcs->width / pcs->bits_per_pin; in pcs_parse_bits_in_pinctrl_entry()
1117 vals = devm_kzalloc(pcs->dev, in pcs_parse_bits_in_pinctrl_entry()
1123 pins = devm_kzalloc(pcs->dev, in pcs_parse_bits_in_pinctrl_entry()
1141 dev_err(pcs->dev, "invalid args_count for spec: %i\n", in pcs_parse_bits_in_pinctrl_entry()
1151 dev_dbg(pcs->dev, "%pOFn index: 0x%x value: 0x%x mask: 0x%x\n", in pcs_parse_bits_in_pinctrl_entry()
1157 pin_num_from_lsb = bit_pos / pcs->bits_per_pin; in pcs_parse_bits_in_pinctrl_entry()
1158 mask_pos = ((pcs->fmask) << bit_pos); in pcs_parse_bits_in_pinctrl_entry()
1163 dev_err(pcs->dev, in pcs_parse_bits_in_pinctrl_entry()
1172 dev_warn(pcs->dev, in pcs_parse_bits_in_pinctrl_entry()
1179 vals[found].reg = pcs->base + offset; in pcs_parse_bits_in_pinctrl_entry()
1182 pin = pcs_get_pin_by_offset(pcs, offset); in pcs_parse_bits_in_pinctrl_entry()
1184 dev_err(pcs->dev, in pcs_parse_bits_in_pinctrl_entry()
1194 mutex_lock(&pcs->mutex); in pcs_parse_bits_in_pinctrl_entry()
1195 fsel = pcs_add_function(pcs, &function, np->name, vals, found, in pcs_parse_bits_in_pinctrl_entry()
1202 gsel = pinctrl_generic_add_group(pcs->pctl, np->name, pins, found, pcs); in pcs_parse_bits_in_pinctrl_entry()
1213 dev_err(pcs->dev, "pinconf not supported\n"); in pcs_parse_bits_in_pinctrl_entry()
1218 mutex_unlock(&pcs->mutex); in pcs_parse_bits_in_pinctrl_entry()
1223 pinctrl_generic_remove_group(pcs->pctl, gsel); in pcs_parse_bits_in_pinctrl_entry()
1226 pinmux_generic_remove_function(pcs->pctl, fsel); in pcs_parse_bits_in_pinctrl_entry()
1228 mutex_unlock(&pcs->mutex); in pcs_parse_bits_in_pinctrl_entry()
1229 devm_kfree(pcs->dev, pins); in pcs_parse_bits_in_pinctrl_entry()
1232 devm_kfree(pcs->dev, vals); in pcs_parse_bits_in_pinctrl_entry()
1247 struct pcs_device *pcs; in pcs_dt_node_to_map() local
1251 pcs = pinctrl_dev_get_drvdata(pctldev); in pcs_dt_node_to_map()
1254 *map = devm_kcalloc(pcs->dev, 2, sizeof(**map), GFP_KERNEL); in pcs_dt_node_to_map()
1260 pgnames = devm_kzalloc(pcs->dev, sizeof(*pgnames), GFP_KERNEL); in pcs_dt_node_to_map()
1266 if (pcs->bits_per_mux) { in pcs_dt_node_to_map()
1267 ret = pcs_parse_bits_in_pinctrl_entry(pcs, np_config, map, in pcs_dt_node_to_map()
1270 dev_err(pcs->dev, "no pins entries for %pOFn\n", in pcs_dt_node_to_map()
1275 ret = pcs_parse_one_pinctrl_entry(pcs, np_config, map, in pcs_dt_node_to_map()
1278 dev_err(pcs->dev, "no pins entries for %pOFn\n", in pcs_dt_node_to_map()
1287 devm_kfree(pcs->dev, pgnames); in pcs_dt_node_to_map()
1289 devm_kfree(pcs->dev, *map); in pcs_dt_node_to_map()
1296 * @pcs: pcs driver instance
1298 static void pcs_irq_free(struct pcs_device *pcs) in pcs_irq_free() argument
1300 struct pcs_soc_data *pcs_soc = &pcs->socdata; in pcs_irq_free()
1305 if (pcs->domain) in pcs_irq_free()
1306 irq_domain_remove(pcs->domain); in pcs_irq_free()
1316 * @pcs: pcs driver instance
1318 static void pcs_free_resources(struct pcs_device *pcs) in pcs_free_resources() argument
1320 pcs_irq_free(pcs); in pcs_free_resources()
1321 pinctrl_unregister(pcs->pctl); in pcs_free_resources()
1324 if (pcs->missing_nr_pinctrl_cells) in pcs_free_resources()
1325 of_remove_property(pcs->np, pcs->missing_nr_pinctrl_cells); in pcs_free_resources()
1329 static int pcs_add_gpio_func(struct device_node *node, struct pcs_device *pcs) in pcs_add_gpio_func() argument
1345 range = devm_kzalloc(pcs->dev, sizeof(*range), GFP_KERNEL); in pcs_add_gpio_func()
1353 mutex_lock(&pcs->mutex); in pcs_add_gpio_func()
1354 list_add_tail(&range->node, &pcs->gpiofuncs); in pcs_add_gpio_func()
1355 mutex_unlock(&pcs->mutex); in pcs_add_gpio_func()
1386 struct pcs_device *pcs; in pcs_irq_set() local
1390 pcs = container_of(pcs_soc, struct pcs_device, socdata); in pcs_irq_set()
1391 list_for_each(pos, &pcs->irqs) { in pcs_irq_set()
1400 raw_spin_lock(&pcs->lock); in pcs_irq_set()
1401 mask = pcs->read(pcswi->reg); in pcs_irq_set()
1406 pcs->write(mask, pcswi->reg); in pcs_irq_set()
1409 mask = pcs->read(pcswi->reg); in pcs_irq_set()
1410 raw_spin_unlock(&pcs->lock); in pcs_irq_set()
1467 struct pcs_device *pcs; in pcs_irq_handle() local
1471 pcs = container_of(pcs_soc, struct pcs_device, socdata); in pcs_irq_handle()
1472 list_for_each(pos, &pcs->irqs) { in pcs_irq_handle()
1477 raw_spin_lock(&pcs->lock); in pcs_irq_handle()
1478 mask = pcs->read(pcswi->reg); in pcs_irq_handle()
1479 raw_spin_unlock(&pcs->lock); in pcs_irq_handle()
1481 generic_handle_irq(irq_find_mapping(pcs->domain, in pcs_irq_handle()
1528 struct pcs_device *pcs; in pcs_irqdomain_map() local
1531 pcs = container_of(pcs_soc, struct pcs_device, socdata); in pcs_irqdomain_map()
1532 pcswi = devm_kzalloc(pcs->dev, sizeof(*pcswi), GFP_KERNEL); in pcs_irqdomain_map()
1536 pcswi->reg = pcs->base + hwirq; in pcs_irqdomain_map()
1540 mutex_lock(&pcs->mutex); in pcs_irqdomain_map()
1541 list_add_tail(&pcswi->node, &pcs->irqs); in pcs_irqdomain_map()
1542 mutex_unlock(&pcs->mutex); in pcs_irqdomain_map()
1545 irq_set_chip_and_handler(irq, &pcs->chip, in pcs_irqdomain_map()
1560 * @pcs: pcs driver instance
1563 static int pcs_irq_init_chained_handler(struct pcs_device *pcs, in pcs_irq_init_chained_handler() argument
1566 struct pcs_soc_data *pcs_soc = &pcs->socdata; in pcs_irq_init_chained_handler()
1576 INIT_LIST_HEAD(&pcs->irqs); in pcs_irq_init_chained_handler()
1577 pcs->chip.name = name; in pcs_irq_init_chained_handler()
1578 pcs->chip.irq_ack = pcs_irq_mask; in pcs_irq_init_chained_handler()
1579 pcs->chip.irq_mask = pcs_irq_mask; in pcs_irq_init_chained_handler()
1580 pcs->chip.irq_unmask = pcs_irq_unmask; in pcs_irq_init_chained_handler()
1581 pcs->chip.irq_set_wake = pcs_irq_set_wake; in pcs_irq_init_chained_handler()
1606 num_irqs = pcs->size; in pcs_irq_init_chained_handler()
1608 pcs->domain = irq_domain_add_simple(np, num_irqs, 0, in pcs_irq_init_chained_handler()
1611 if (!pcs->domain) { in pcs_irq_init_chained_handler()
1620 static int pcs_save_context(struct pcs_device *pcs) in pcs_save_context() argument
1627 mux_bytes = pcs->width / BITS_PER_BYTE; in pcs_save_context()
1629 if (!pcs->saved_vals) { in pcs_save_context()
1630 pcs->saved_vals = devm_kzalloc(pcs->dev, pcs->size, GFP_ATOMIC); in pcs_save_context()
1631 if (!pcs->saved_vals) in pcs_save_context()
1635 switch (pcs->width) { in pcs_save_context()
1637 regsl = pcs->saved_vals; in pcs_save_context()
1638 for (i = 0; i < pcs->size; i += mux_bytes) in pcs_save_context()
1639 *regsl++ = pcs->read(pcs->base + i); in pcs_save_context()
1642 regsw = pcs->saved_vals; in pcs_save_context()
1643 for (i = 0; i < pcs->size; i += mux_bytes) in pcs_save_context()
1644 *regsw++ = pcs->read(pcs->base + i); in pcs_save_context()
1647 regshw = pcs->saved_vals; in pcs_save_context()
1648 for (i = 0; i < pcs->size; i += mux_bytes) in pcs_save_context()
1649 *regshw++ = pcs->read(pcs->base + i); in pcs_save_context()
1656 static void pcs_restore_context(struct pcs_device *pcs) in pcs_restore_context() argument
1663 mux_bytes = pcs->width / BITS_PER_BYTE; in pcs_restore_context()
1665 switch (pcs->width) { in pcs_restore_context()
1667 regsl = pcs->saved_vals; in pcs_restore_context()
1668 for (i = 0; i < pcs->size; i += mux_bytes) in pcs_restore_context()
1669 pcs->write(*regsl++, pcs->base + i); in pcs_restore_context()
1672 regsw = pcs->saved_vals; in pcs_restore_context()
1673 for (i = 0; i < pcs->size; i += mux_bytes) in pcs_restore_context()
1674 pcs->write(*regsw++, pcs->base + i); in pcs_restore_context()
1677 regshw = pcs->saved_vals; in pcs_restore_context()
1678 for (i = 0; i < pcs->size; i += mux_bytes) in pcs_restore_context()
1679 pcs->write(*regshw++, pcs->base + i); in pcs_restore_context()
1687 struct pcs_device *pcs; in pinctrl_single_suspend() local
1689 pcs = platform_get_drvdata(pdev); in pinctrl_single_suspend()
1690 if (!pcs) in pinctrl_single_suspend()
1693 if (pcs->flags & PCS_CONTEXT_LOSS_OFF) { in pinctrl_single_suspend()
1696 ret = pcs_save_context(pcs); in pinctrl_single_suspend()
1701 return pinctrl_force_sleep(pcs->pctl); in pinctrl_single_suspend()
1706 struct pcs_device *pcs; in pinctrl_single_resume() local
1708 pcs = platform_get_drvdata(pdev); in pinctrl_single_resume()
1709 if (!pcs) in pinctrl_single_resume()
1712 if (pcs->flags & PCS_CONTEXT_LOSS_OFF) in pinctrl_single_resume()
1713 pcs_restore_context(pcs); in pinctrl_single_resume()
1715 return pinctrl_force_default(pcs->pctl); in pinctrl_single_resume()
1721 * @pcs: pinctrl driver instance
1729 static int pcs_quirk_missing_pinctrl_cells(struct pcs_device *pcs, in pcs_quirk_missing_pinctrl_cells() argument
1742 dev_warn(pcs->dev, "please update dts to use %s = <%i>\n", in pcs_quirk_missing_pinctrl_cells()
1745 p = devm_kzalloc(pcs->dev, sizeof(*p), GFP_KERNEL); in pcs_quirk_missing_pinctrl_cells()
1750 p->value = devm_kzalloc(pcs->dev, sizeof(__be32), GFP_KERNEL); in pcs_quirk_missing_pinctrl_cells()
1755 p->name = devm_kstrdup(pcs->dev, name, GFP_KERNEL); in pcs_quirk_missing_pinctrl_cells()
1759 pcs->missing_nr_pinctrl_cells = p; in pcs_quirk_missing_pinctrl_cells()
1762 error = of_add_property(np, pcs->missing_nr_pinctrl_cells); in pcs_quirk_missing_pinctrl_cells()
1773 struct pcs_device *pcs; in pcs_probe() local
1781 pcs = devm_kzalloc(&pdev->dev, sizeof(*pcs), GFP_KERNEL); in pcs_probe()
1782 if (!pcs) in pcs_probe()
1785 pcs->dev = &pdev->dev; in pcs_probe()
1786 pcs->np = np; in pcs_probe()
1787 raw_spin_lock_init(&pcs->lock); in pcs_probe()
1788 mutex_init(&pcs->mutex); in pcs_probe()
1789 INIT_LIST_HEAD(&pcs->gpiofuncs); in pcs_probe()
1790 pcs->flags = soc->flags; in pcs_probe()
1791 memcpy(&pcs->socdata, soc, sizeof(*soc)); in pcs_probe()
1794 &pcs->width); in pcs_probe()
1796 dev_err(pcs->dev, "register width not specified\n"); in pcs_probe()
1802 &pcs->fmask); in pcs_probe()
1804 pcs->fshift = __ffs(pcs->fmask); in pcs_probe()
1805 pcs->fmax = pcs->fmask >> pcs->fshift; in pcs_probe()
1808 pcs->fmask = 0; in pcs_probe()
1809 pcs->fshift = 0; in pcs_probe()
1810 pcs->fmax = 0; in pcs_probe()
1814 &pcs->foff); in pcs_probe()
1816 pcs->foff = PCS_OFF_DISABLED; in pcs_probe()
1818 pcs->bits_per_mux = of_property_read_bool(np, in pcs_probe()
1820 ret = pcs_quirk_missing_pinctrl_cells(pcs, np, in pcs_probe()
1821 pcs->bits_per_mux ? 2 : 1); in pcs_probe()
1830 dev_err(pcs->dev, "could not get resource\n"); in pcs_probe()
1834 pcs->res = devm_request_mem_region(pcs->dev, res->start, in pcs_probe()
1836 if (!pcs->res) { in pcs_probe()
1837 dev_err(pcs->dev, "could not get mem_region\n"); in pcs_probe()
1841 pcs->size = resource_size(pcs->res); in pcs_probe()
1842 pcs->base = devm_ioremap(pcs->dev, pcs->res->start, pcs->size); in pcs_probe()
1843 if (!pcs->base) { in pcs_probe()
1844 dev_err(pcs->dev, "could not ioremap\n"); in pcs_probe()
1848 platform_set_drvdata(pdev, pcs); in pcs_probe()
1850 switch (pcs->width) { in pcs_probe()
1852 pcs->read = pcs_readb; in pcs_probe()
1853 pcs->write = pcs_writeb; in pcs_probe()
1856 pcs->read = pcs_readw; in pcs_probe()
1857 pcs->write = pcs_writew; in pcs_probe()
1860 pcs->read = pcs_readl; in pcs_probe()
1861 pcs->write = pcs_writel; in pcs_probe()
1867 pcs->desc.name = DRIVER_NAME; in pcs_probe()
1868 pcs->desc.pctlops = &pcs_pinctrl_ops; in pcs_probe()
1869 pcs->desc.pmxops = &pcs_pinmux_ops; in pcs_probe()
1871 pcs->desc.confops = &pcs_pinconf_ops; in pcs_probe()
1872 pcs->desc.owner = THIS_MODULE; in pcs_probe()
1874 ret = pcs_allocate_pin_table(pcs); in pcs_probe()
1878 ret = pinctrl_register_and_init(&pcs->desc, pcs->dev, pcs, &pcs->pctl); in pcs_probe()
1880 dev_err(pcs->dev, "could not register single pinctrl driver\n"); in pcs_probe()
1884 ret = pcs_add_gpio_func(np, pcs); in pcs_probe()
1888 pcs->socdata.irq = irq_of_parse_and_map(np, 0); in pcs_probe()
1889 if (pcs->socdata.irq) in pcs_probe()
1890 pcs->flags |= PCS_FEAT_IRQ; in pcs_probe()
1896 pcs->socdata.rearm = pdata->rearm; in pcs_probe()
1898 pcs->socdata.irq = pdata->irq; in pcs_probe()
1899 pcs->flags |= PCS_FEAT_IRQ; in pcs_probe()
1904 ret = pcs_irq_init_chained_handler(pcs, np); in pcs_probe()
1906 dev_warn(pcs->dev, "initialized with no interrupts\n"); in pcs_probe()
1909 dev_info(pcs->dev, "%i pins, size %u\n", pcs->desc.npins, pcs->size); in pcs_probe()
1911 return pinctrl_enable(pcs->pctl); in pcs_probe()
1914 pcs_free_resources(pcs); in pcs_probe()
1921 struct pcs_device *pcs = platform_get_drvdata(pdev); in pcs_remove() local
1923 if (!pcs) in pcs_remove()
1926 pcs_free_resources(pcs); in pcs_remove()