Lines Matching refs:line
48 unsigned int line; member
63 static unsigned int bit_cfg_reg(unsigned int line) in bit_cfg_reg() argument
65 return 8 * line + GPIO_BIT_CFG; in bit_cfg_reg()
68 static unsigned int intr_reg(unsigned int line) in intr_reg() argument
70 return 8 * line + GPIO_INTR; in intr_reg()
74 unsigned int line) in thunderx_gpio_is_gpio_nowarn() argument
76 u64 bit_cfg = readq(txgpio->register_base + bit_cfg_reg(line)); in thunderx_gpio_is_gpio_nowarn()
86 unsigned int line) in thunderx_gpio_is_gpio() argument
88 bool rv = thunderx_gpio_is_gpio_nowarn(txgpio, line); in thunderx_gpio_is_gpio()
90 WARN_RATELIMIT(!rv, "Pin %d not available for GPIO\n", line); in thunderx_gpio_is_gpio()
95 static int thunderx_gpio_request(struct gpio_chip *chip, unsigned int line) in thunderx_gpio_request() argument
99 return thunderx_gpio_is_gpio(txgpio, line) ? 0 : -EIO; in thunderx_gpio_request()
102 static int thunderx_gpio_dir_in(struct gpio_chip *chip, unsigned int line) in thunderx_gpio_dir_in() argument
106 if (!thunderx_gpio_is_gpio(txgpio, line)) in thunderx_gpio_dir_in()
110 clear_bit(line, txgpio->invert_mask); in thunderx_gpio_dir_in()
111 clear_bit(line, txgpio->od_mask); in thunderx_gpio_dir_in()
112 writeq(txgpio->line_entries[line].fil_bits, in thunderx_gpio_dir_in()
113 txgpio->register_base + bit_cfg_reg(line)); in thunderx_gpio_dir_in()
118 static void thunderx_gpio_set(struct gpio_chip *chip, unsigned int line, in thunderx_gpio_set() argument
122 int bank = line / 64; in thunderx_gpio_set()
123 int bank_bit = line % 64; in thunderx_gpio_set()
131 static int thunderx_gpio_dir_out(struct gpio_chip *chip, unsigned int line, in thunderx_gpio_dir_out() argument
135 u64 bit_cfg = txgpio->line_entries[line].fil_bits | GPIO_BIT_CFG_TX_OE; in thunderx_gpio_dir_out()
137 if (!thunderx_gpio_is_gpio(txgpio, line)) in thunderx_gpio_dir_out()
142 thunderx_gpio_set(chip, line, value); in thunderx_gpio_dir_out()
144 if (test_bit(line, txgpio->invert_mask)) in thunderx_gpio_dir_out()
147 if (test_bit(line, txgpio->od_mask)) in thunderx_gpio_dir_out()
150 writeq(bit_cfg, txgpio->register_base + bit_cfg_reg(line)); in thunderx_gpio_dir_out()
156 static int thunderx_gpio_get_direction(struct gpio_chip *chip, unsigned int line) in thunderx_gpio_get_direction() argument
161 if (!thunderx_gpio_is_gpio_nowarn(txgpio, line)) in thunderx_gpio_get_direction()
169 bit_cfg = readq(txgpio->register_base + bit_cfg_reg(line)); in thunderx_gpio_get_direction()
178 unsigned int line, in thunderx_gpio_set_config() argument
184 int bank = line / 64; in thunderx_gpio_set_config()
185 int bank_bit = line % 64; in thunderx_gpio_set_config()
190 if (!thunderx_gpio_is_gpio(txgpio, line)) in thunderx_gpio_set_config()
194 orig_invert = test_bit(line, txgpio->invert_mask); in thunderx_gpio_set_config()
196 orig_od = test_bit(line, txgpio->od_mask); in thunderx_gpio_set_config()
199 bit_cfg = readq(txgpio->register_base + bit_cfg_reg(line)); in thunderx_gpio_set_config()
207 set_bit(line, txgpio->invert_mask); in thunderx_gpio_set_config()
209 set_bit(line, txgpio->od_mask); in thunderx_gpio_set_config()
214 clear_bit(line, txgpio->invert_mask); in thunderx_gpio_set_config()
216 clear_bit(line, txgpio->od_mask); in thunderx_gpio_set_config()
233 txgpio->line_entries[line].fil_bits = in thunderx_gpio_set_config()
237 bit_cfg |= txgpio->line_entries[line].fil_bits; in thunderx_gpio_set_config()
238 writeq(bit_cfg, txgpio->register_base + bit_cfg_reg(line)); in thunderx_gpio_set_config()
252 ret = thunderx_gpio_dir_out(chip, line, orig_dat ^ new_invert); in thunderx_gpio_set_config()
257 static int thunderx_gpio_get(struct gpio_chip *chip, unsigned int line) in thunderx_gpio_get() argument
260 int bank = line / 64; in thunderx_gpio_get()
261 int bank_bit = line % 64; in thunderx_gpio_get()
265 if (test_bit(line, txgpio->invert_mask)) in thunderx_gpio_get()
346 set_bit(txline->line, txgpio->invert_mask); in thunderx_gpio_irq_set_type()
348 clear_bit(txline->line, txgpio->invert_mask); in thunderx_gpio_irq_set_type()
350 clear_bit(txline->line, txgpio->od_mask); in thunderx_gpio_irq_set_type()
351 writeq(bit_cfg, txgpio->register_base + bit_cfg_reg(txline->line)); in thunderx_gpio_irq_set_type()
498 txgpio->line_entries[i].line = i; in thunderx_gpio_probe()