Lines Matching refs:ctrl
32 struct ath79_gpio_ctrl *ctrl = to_ath79_gpio_ctrl(chip); in ath79_gpio_set_value() local
35 __raw_writel(BIT(gpio), ctrl->base + AR71XX_GPIO_REG_SET); in ath79_gpio_set_value()
37 __raw_writel(BIT(gpio), ctrl->base + AR71XX_GPIO_REG_CLEAR); in ath79_gpio_set_value()
42 struct ath79_gpio_ctrl *ctrl = to_ath79_gpio_ctrl(chip); in ath79_gpio_get_value() local
44 return (__raw_readl(ctrl->base + AR71XX_GPIO_REG_IN) >> gpio) & 1; in ath79_gpio_get_value()
50 struct ath79_gpio_ctrl *ctrl = to_ath79_gpio_ctrl(chip); in ath79_gpio_direction_input() local
53 spin_lock_irqsave(&ctrl->lock, flags); in ath79_gpio_direction_input()
56 __raw_readl(ctrl->base + AR71XX_GPIO_REG_OE) & ~BIT(offset), in ath79_gpio_direction_input()
57 ctrl->base + AR71XX_GPIO_REG_OE); in ath79_gpio_direction_input()
59 spin_unlock_irqrestore(&ctrl->lock, flags); in ath79_gpio_direction_input()
67 struct ath79_gpio_ctrl *ctrl = to_ath79_gpio_ctrl(chip); in ath79_gpio_direction_output() local
70 spin_lock_irqsave(&ctrl->lock, flags); in ath79_gpio_direction_output()
73 __raw_writel(BIT(offset), ctrl->base + AR71XX_GPIO_REG_SET); in ath79_gpio_direction_output()
75 __raw_writel(BIT(offset), ctrl->base + AR71XX_GPIO_REG_CLEAR); in ath79_gpio_direction_output()
78 __raw_readl(ctrl->base + AR71XX_GPIO_REG_OE) | BIT(offset), in ath79_gpio_direction_output()
79 ctrl->base + AR71XX_GPIO_REG_OE); in ath79_gpio_direction_output()
81 spin_unlock_irqrestore(&ctrl->lock, flags); in ath79_gpio_direction_output()
88 struct ath79_gpio_ctrl *ctrl = to_ath79_gpio_ctrl(chip); in ar934x_gpio_direction_input() local
91 spin_lock_irqsave(&ctrl->lock, flags); in ar934x_gpio_direction_input()
94 __raw_readl(ctrl->base + AR71XX_GPIO_REG_OE) | BIT(offset), in ar934x_gpio_direction_input()
95 ctrl->base + AR71XX_GPIO_REG_OE); in ar934x_gpio_direction_input()
97 spin_unlock_irqrestore(&ctrl->lock, flags); in ar934x_gpio_direction_input()
105 struct ath79_gpio_ctrl *ctrl = to_ath79_gpio_ctrl(chip); in ar934x_gpio_direction_output() local
108 spin_lock_irqsave(&ctrl->lock, flags); in ar934x_gpio_direction_output()
111 __raw_writel(BIT(offset), ctrl->base + AR71XX_GPIO_REG_SET); in ar934x_gpio_direction_output()
113 __raw_writel(BIT(offset), ctrl->base + AR71XX_GPIO_REG_CLEAR); in ar934x_gpio_direction_output()
116 __raw_readl(ctrl->base + AR71XX_GPIO_REG_OE) & ~BIT(offset), in ar934x_gpio_direction_output()
117 ctrl->base + AR71XX_GPIO_REG_OE); in ar934x_gpio_direction_output()
119 spin_unlock_irqrestore(&ctrl->lock, flags); in ar934x_gpio_direction_output()
143 struct ath79_gpio_ctrl *ctrl; in ath79_gpio_probe() local
149 ctrl = devm_kzalloc(&pdev->dev, sizeof(*ctrl), GFP_KERNEL); in ath79_gpio_probe()
150 if (!ctrl) in ath79_gpio_probe()
173 ctrl->base = devm_ioremap_nocache( in ath79_gpio_probe()
175 if (!ctrl->base) in ath79_gpio_probe()
178 spin_lock_init(&ctrl->lock); in ath79_gpio_probe()
179 memcpy(&ctrl->chip, &ath79_gpio_chip, sizeof(ctrl->chip)); in ath79_gpio_probe()
180 ctrl->chip.dev = &pdev->dev; in ath79_gpio_probe()
181 ctrl->chip.ngpio = ath79_gpio_count; in ath79_gpio_probe()
183 ctrl->chip.direction_input = ar934x_gpio_direction_input; in ath79_gpio_probe()
184 ctrl->chip.direction_output = ar934x_gpio_direction_output; in ath79_gpio_probe()
187 err = gpiochip_add(&ctrl->chip); in ath79_gpio_probe()