Lines Matching +full:edge +full:- +full:offset
1 // SPDX-License-Identifier: GPL-2.0+
23 #define GPIO_EDGLEVEL 0x24 /* Edge/level Select Register */
25 #define GPIO_BOTHEDGE 0x4c /* One Edge/Both Edge Select Register */
36 static int rcar_gpio_get_value(struct udevice *dev, unsigned offset) in rcar_gpio_get_value() argument
39 const u32 bit = BIT(offset); in rcar_gpio_get_value()
45 if (readl(priv->regs + GPIO_INOUTSEL) & bit) in rcar_gpio_get_value()
46 return !!(readl(priv->regs + GPIO_OUTDT) & bit); in rcar_gpio_get_value()
48 return !!(readl(priv->regs + GPIO_INDT) & bit); in rcar_gpio_get_value()
51 static int rcar_gpio_set_value(struct udevice *dev, unsigned offset, in rcar_gpio_set_value() argument
57 setbits_le32(priv->regs + GPIO_OUTDT, BIT(offset)); in rcar_gpio_set_value()
59 clrbits_le32(priv->regs + GPIO_OUTDT, BIT(offset)); in rcar_gpio_set_value()
64 static void rcar_gpio_set_direction(void __iomem *regs, unsigned offset, in rcar_gpio_set_direction() argument
74 clrbits_le32(regs + GPIO_POSNEG, BIT(offset)); in rcar_gpio_set_direction()
77 clrbits_le32(regs + GPIO_IOINTSEL, BIT(offset)); in rcar_gpio_set_direction()
81 setbits_le32(regs + GPIO_INOUTSEL, BIT(offset)); in rcar_gpio_set_direction()
83 clrbits_le32(regs + GPIO_INOUTSEL, BIT(offset)); in rcar_gpio_set_direction()
86 static int rcar_gpio_direction_input(struct udevice *dev, unsigned offset) in rcar_gpio_direction_input() argument
90 rcar_gpio_set_direction(priv->regs, offset, false); in rcar_gpio_direction_input()
95 static int rcar_gpio_direction_output(struct udevice *dev, unsigned offset, in rcar_gpio_direction_output() argument
101 rcar_gpio_set_value(dev, offset, value); in rcar_gpio_direction_output()
102 rcar_gpio_set_direction(priv->regs, offset, true); in rcar_gpio_direction_output()
107 static int rcar_gpio_get_function(struct udevice *dev, unsigned offset) in rcar_gpio_get_function() argument
111 if (readl(priv->regs + GPIO_INOUTSEL) & BIT(offset)) in rcar_gpio_get_function()
117 static int rcar_gpio_request(struct udevice *dev, unsigned offset, in rcar_gpio_request() argument
128 return sh_pfc_config_mux_for_gpio(pctldev, priv->pfc_offset + offset); in rcar_gpio_request()
149 priv->regs = (void __iomem *)devfdt_get_addr(dev); in rcar_gpio_probe()
150 uc_priv->bank_name = dev->name; in rcar_gpio_probe()
152 ret = fdtdec_parse_phandle_with_args(gd->fdt_blob, node, "gpio-ranges", in rcar_gpio_probe()
154 priv->pfc_offset = ret == 0 ? args.args[1] : -1; in rcar_gpio_probe()
155 uc_priv->gpio_count = ret == 0 ? args.args[2] : RCAR_MAX_GPIO_PER_BANK; in rcar_gpio_probe()
174 { .compatible = "renesas,gpio-r8a7795" },
175 { .compatible = "renesas,gpio-r8a7796" },
176 { .compatible = "renesas,gpio-r8a77965" },
177 { .compatible = "renesas,gpio-r8a77970" },
178 { .compatible = "renesas,gpio-r8a77990" },
179 { .compatible = "renesas,gpio-r8a77995" },
180 { .compatible = "renesas,rcar-gen2-gpio" },
181 { .compatible = "renesas,rcar-gen3-gpio" },
186 .name = "rcar-gpio",