Lines Matching refs:line
50 unsigned int line; member
65 static unsigned int bit_cfg_reg(unsigned int line) in bit_cfg_reg() argument
67 return 8 * line + GPIO_BIT_CFG; in bit_cfg_reg()
70 static unsigned int intr_reg(unsigned int line) in intr_reg() argument
72 return 8 * line + GPIO_INTR; in intr_reg()
76 unsigned int line) in thunderx_gpio_is_gpio_nowarn() argument
78 u64 bit_cfg = readq(txgpio->register_base + bit_cfg_reg(line)); in thunderx_gpio_is_gpio_nowarn()
88 unsigned int line) in thunderx_gpio_is_gpio() argument
90 bool rv = thunderx_gpio_is_gpio_nowarn(txgpio, line); in thunderx_gpio_is_gpio()
92 WARN_RATELIMIT(!rv, "Pin %d not available for GPIO\n", line); in thunderx_gpio_is_gpio()
97 static int thunderx_gpio_request(struct gpio_chip *chip, unsigned int line) in thunderx_gpio_request() argument
101 return thunderx_gpio_is_gpio(txgpio, line) ? 0 : -EIO; in thunderx_gpio_request()
104 static int thunderx_gpio_dir_in(struct gpio_chip *chip, unsigned int line) in thunderx_gpio_dir_in() argument
108 if (!thunderx_gpio_is_gpio(txgpio, line)) in thunderx_gpio_dir_in()
112 clear_bit(line, txgpio->invert_mask); in thunderx_gpio_dir_in()
113 clear_bit(line, txgpio->od_mask); in thunderx_gpio_dir_in()
114 writeq(txgpio->line_entries[line].fil_bits, in thunderx_gpio_dir_in()
115 txgpio->register_base + bit_cfg_reg(line)); in thunderx_gpio_dir_in()
120 static void thunderx_gpio_set(struct gpio_chip *chip, unsigned int line, in thunderx_gpio_set() argument
124 int bank = line / 64; in thunderx_gpio_set()
125 int bank_bit = line % 64; in thunderx_gpio_set()
133 static int thunderx_gpio_dir_out(struct gpio_chip *chip, unsigned int line, in thunderx_gpio_dir_out() argument
137 u64 bit_cfg = txgpio->line_entries[line].fil_bits | GPIO_BIT_CFG_TX_OE; in thunderx_gpio_dir_out()
139 if (!thunderx_gpio_is_gpio(txgpio, line)) in thunderx_gpio_dir_out()
144 thunderx_gpio_set(chip, line, value); in thunderx_gpio_dir_out()
146 if (test_bit(line, txgpio->invert_mask)) in thunderx_gpio_dir_out()
149 if (test_bit(line, txgpio->od_mask)) in thunderx_gpio_dir_out()
152 writeq(bit_cfg, txgpio->register_base + bit_cfg_reg(line)); in thunderx_gpio_dir_out()
158 static int thunderx_gpio_get_direction(struct gpio_chip *chip, unsigned int line) in thunderx_gpio_get_direction() argument
163 if (!thunderx_gpio_is_gpio_nowarn(txgpio, line)) in thunderx_gpio_get_direction()
171 bit_cfg = readq(txgpio->register_base + bit_cfg_reg(line)); in thunderx_gpio_get_direction()
180 unsigned int line, in thunderx_gpio_set_config() argument
186 int bank = line / 64; in thunderx_gpio_set_config()
187 int bank_bit = line % 64; in thunderx_gpio_set_config()
192 if (!thunderx_gpio_is_gpio(txgpio, line)) in thunderx_gpio_set_config()
196 orig_invert = test_bit(line, txgpio->invert_mask); in thunderx_gpio_set_config()
198 orig_od = test_bit(line, txgpio->od_mask); in thunderx_gpio_set_config()
201 bit_cfg = readq(txgpio->register_base + bit_cfg_reg(line)); in thunderx_gpio_set_config()
209 set_bit(line, txgpio->invert_mask); in thunderx_gpio_set_config()
211 set_bit(line, txgpio->od_mask); in thunderx_gpio_set_config()
216 clear_bit(line, txgpio->invert_mask); in thunderx_gpio_set_config()
218 clear_bit(line, txgpio->od_mask); in thunderx_gpio_set_config()
235 txgpio->line_entries[line].fil_bits = in thunderx_gpio_set_config()
239 bit_cfg |= txgpio->line_entries[line].fil_bits; in thunderx_gpio_set_config()
240 writeq(bit_cfg, txgpio->register_base + bit_cfg_reg(line)); in thunderx_gpio_set_config()
254 ret = thunderx_gpio_dir_out(chip, line, orig_dat ^ new_invert); in thunderx_gpio_set_config()
259 static int thunderx_gpio_get(struct gpio_chip *chip, unsigned int line) in thunderx_gpio_get() argument
262 int bank = line / 64; in thunderx_gpio_get()
263 int bank_bit = line % 64; in thunderx_gpio_get()
267 if (test_bit(line, txgpio->invert_mask)) in thunderx_gpio_get()
348 set_bit(txline->line, txgpio->invert_mask); in thunderx_gpio_irq_set_type()
350 clear_bit(txline->line, txgpio->invert_mask); in thunderx_gpio_irq_set_type()
352 clear_bit(txline->line, txgpio->od_mask); in thunderx_gpio_irq_set_type()
353 writeq(bit_cfg, txgpio->register_base + bit_cfg_reg(txline->line)); in thunderx_gpio_irq_set_type()
497 txgpio->line_entries[i].line = i; in thunderx_gpio_probe()