Lines Matching refs:line
49 unsigned int line; member
64 static unsigned int bit_cfg_reg(unsigned int line) in bit_cfg_reg() argument
66 return 8 * line + GPIO_BIT_CFG; in bit_cfg_reg()
69 static unsigned int intr_reg(unsigned int line) in intr_reg() argument
71 return 8 * line + GPIO_INTR; in intr_reg()
75 unsigned int line) in thunderx_gpio_is_gpio_nowarn() argument
77 u64 bit_cfg = readq(txgpio->register_base + bit_cfg_reg(line)); in thunderx_gpio_is_gpio_nowarn()
87 unsigned int line) in thunderx_gpio_is_gpio() argument
89 bool rv = thunderx_gpio_is_gpio_nowarn(txgpio, line); in thunderx_gpio_is_gpio()
91 WARN_RATELIMIT(!rv, "Pin %d not available for GPIO\n", line); in thunderx_gpio_is_gpio()
96 static int thunderx_gpio_request(struct gpio_chip *chip, unsigned int line) in thunderx_gpio_request() argument
100 return thunderx_gpio_is_gpio(txgpio, line) ? 0 : -EIO; in thunderx_gpio_request()
103 static int thunderx_gpio_dir_in(struct gpio_chip *chip, unsigned int line) in thunderx_gpio_dir_in() argument
107 if (!thunderx_gpio_is_gpio(txgpio, line)) in thunderx_gpio_dir_in()
111 clear_bit(line, txgpio->invert_mask); in thunderx_gpio_dir_in()
112 clear_bit(line, txgpio->od_mask); in thunderx_gpio_dir_in()
113 writeq(txgpio->line_entries[line].fil_bits, in thunderx_gpio_dir_in()
114 txgpio->register_base + bit_cfg_reg(line)); in thunderx_gpio_dir_in()
119 static void thunderx_gpio_set(struct gpio_chip *chip, unsigned int line, in thunderx_gpio_set() argument
123 int bank = line / 64; in thunderx_gpio_set()
124 int bank_bit = line % 64; in thunderx_gpio_set()
132 static int thunderx_gpio_dir_out(struct gpio_chip *chip, unsigned int line, in thunderx_gpio_dir_out() argument
136 u64 bit_cfg = txgpio->line_entries[line].fil_bits | GPIO_BIT_CFG_TX_OE; in thunderx_gpio_dir_out()
138 if (!thunderx_gpio_is_gpio(txgpio, line)) in thunderx_gpio_dir_out()
143 thunderx_gpio_set(chip, line, value); in thunderx_gpio_dir_out()
145 if (test_bit(line, txgpio->invert_mask)) in thunderx_gpio_dir_out()
148 if (test_bit(line, txgpio->od_mask)) in thunderx_gpio_dir_out()
151 writeq(bit_cfg, txgpio->register_base + bit_cfg_reg(line)); in thunderx_gpio_dir_out()
157 static int thunderx_gpio_get_direction(struct gpio_chip *chip, unsigned int line) in thunderx_gpio_get_direction() argument
162 if (!thunderx_gpio_is_gpio_nowarn(txgpio, line)) in thunderx_gpio_get_direction()
170 bit_cfg = readq(txgpio->register_base + bit_cfg_reg(line)); in thunderx_gpio_get_direction()
179 unsigned int line, in thunderx_gpio_set_config() argument
185 int bank = line / 64; in thunderx_gpio_set_config()
186 int bank_bit = line % 64; in thunderx_gpio_set_config()
191 if (!thunderx_gpio_is_gpio(txgpio, line)) in thunderx_gpio_set_config()
195 orig_invert = test_bit(line, txgpio->invert_mask); in thunderx_gpio_set_config()
197 orig_od = test_bit(line, txgpio->od_mask); in thunderx_gpio_set_config()
200 bit_cfg = readq(txgpio->register_base + bit_cfg_reg(line)); in thunderx_gpio_set_config()
208 set_bit(line, txgpio->invert_mask); in thunderx_gpio_set_config()
210 set_bit(line, txgpio->od_mask); in thunderx_gpio_set_config()
215 clear_bit(line, txgpio->invert_mask); in thunderx_gpio_set_config()
217 clear_bit(line, txgpio->od_mask); in thunderx_gpio_set_config()
234 txgpio->line_entries[line].fil_bits = in thunderx_gpio_set_config()
238 bit_cfg |= txgpio->line_entries[line].fil_bits; in thunderx_gpio_set_config()
239 writeq(bit_cfg, txgpio->register_base + bit_cfg_reg(line)); in thunderx_gpio_set_config()
253 ret = thunderx_gpio_dir_out(chip, line, orig_dat ^ new_invert); in thunderx_gpio_set_config()
258 static int thunderx_gpio_get(struct gpio_chip *chip, unsigned int line) in thunderx_gpio_get() argument
261 int bank = line / 64; in thunderx_gpio_get()
262 int bank_bit = line % 64; in thunderx_gpio_get()
266 if (test_bit(line, txgpio->invert_mask)) in thunderx_gpio_get()
347 set_bit(txline->line, txgpio->invert_mask); in thunderx_gpio_irq_set_type()
349 clear_bit(txline->line, txgpio->invert_mask); in thunderx_gpio_irq_set_type()
351 clear_bit(txline->line, txgpio->od_mask); in thunderx_gpio_irq_set_type()
352 writeq(bit_cfg, txgpio->register_base + bit_cfg_reg(txline->line)); in thunderx_gpio_irq_set_type()
499 txgpio->line_entries[i].line = i; in thunderx_gpio_probe()