Lines Matching +full:uart +full:- +full:attached
1 // SPDX-License-Identifier: GPL-2.0-only
25 * The Device Configuration and UART Configuration Registers
26 * for each UART channel take 1KB of memory address space.
50 unsigned int pin = exar_gpio->first_pin + (offset % 16); in exar_offset_to_sel_addr()
54 return addr + (cascaded ? exar_gpio->cascaded_offset : 0); in exar_offset_to_sel_addr()
60 unsigned int pin = exar_gpio->first_pin + (offset % 16); in exar_offset_to_lvl_addr()
64 return addr + (cascaded ? exar_gpio->cascaded_offset : 0); in exar_offset_to_lvl_addr()
70 unsigned int pin = exar_gpio->first_pin + (offset % 16); in exar_offset_to_bit()
81 if (regmap_test_bits(exar_gpio->regmap, addr, BIT(bit))) in exar_get_direction()
93 return !!(regmap_test_bits(exar_gpio->regmap, addr, BIT(bit))); in exar_get_value()
104 regmap_set_bits(exar_gpio->regmap, addr, BIT(bit)); in exar_set_value()
106 regmap_clear_bits(exar_gpio->regmap, addr, BIT(bit)); in exar_set_value()
117 regmap_clear_bits(exar_gpio->regmap, addr, BIT(bit)); in exar_direction_output()
128 regmap_set_bits(exar_gpio->regmap, addr, BIT(bit)); in exar_direction_input()
137 ida_free(&ida_index, exar_gpio->index); in exar_devm_ida_free()
141 .name = "exar-gpio",
148 struct device *dev = &pdev->dev; in gpio_exar_probe()
149 struct pci_dev *pcidev = to_pci_dev(dev->parent); in gpio_exar_probe()
156 * The UART driver must have mapped region 0 prior to registering this in gpio_exar_probe()
157 * device - use it. in gpio_exar_probe()
161 return -ENOMEM; in gpio_exar_probe()
163 ret = device_property_read_u32(dev, "exar,first-pin", &first_pin); in gpio_exar_probe()
173 return -ENOMEM; in gpio_exar_probe()
178 * PCI Device ID is the number of its UART channels. in gpio_exar_probe()
180 if (pcidev->device & GENMASK(15, 12)) { in gpio_exar_probe()
182 exar_gpio->cascaded_offset = (pcidev->device & GENMASK(3, 0)) * in gpio_exar_probe()
188 * the regmap has a clock attached which is not the case here). in gpio_exar_probe()
190 exar_gpio->regmap = devm_regmap_init_mmio(dev, p, &exar_regmap_config); in gpio_exar_probe()
191 if (IS_ERR(exar_gpio->regmap)) in gpio_exar_probe()
192 return PTR_ERR(exar_gpio->regmap); in gpio_exar_probe()
202 sprintf(exar_gpio->name, "exar_gpio%d", index); in gpio_exar_probe()
203 exar_gpio->gpio_chip.label = exar_gpio->name; in gpio_exar_probe()
204 exar_gpio->gpio_chip.parent = dev; in gpio_exar_probe()
205 exar_gpio->gpio_chip.direction_output = exar_direction_output; in gpio_exar_probe()
206 exar_gpio->gpio_chip.direction_input = exar_direction_input; in gpio_exar_probe()
207 exar_gpio->gpio_chip.get_direction = exar_get_direction; in gpio_exar_probe()
208 exar_gpio->gpio_chip.get = exar_get_value; in gpio_exar_probe()
209 exar_gpio->gpio_chip.set = exar_set_value; in gpio_exar_probe()
210 exar_gpio->gpio_chip.base = -1; in gpio_exar_probe()
211 exar_gpio->gpio_chip.ngpio = ngpios; in gpio_exar_probe()
212 exar_gpio->index = index; in gpio_exar_probe()
213 exar_gpio->first_pin = first_pin; in gpio_exar_probe()
215 ret = devm_gpiochip_add_data(dev, &exar_gpio->gpio_chip, exar_gpio); in gpio_exar_probe()