blob: 2b997d90590ce04d450065849379346a2f4b6202 [file] [log] [blame]
Holger Brunck95626872020-01-10 12:47:42 +01001/* SPDX-License-Identifier: GPL-2.0+ */
2/*
3 * (C) Copyright 2018 ABB
Holger Brunck078e1b72020-07-09 17:31:23 +02004 * Valentin Longchamp <valentin.longchamp@hitachi-powergrids.com>
Holger Brunck95626872020-01-10 12:47:42 +01005 */
6
7#ifndef __QRIO_H
8#define __QRIO_H
9
10/* QRIO GPIO ports */
11#define QRIO_GPIO_A 0x40
12#define QRIO_GPIO_B 0x60
13
Aleksandar Gerasimovski69d5b7b2021-01-13 16:20:51 +000014void show_qrio(void);
Aleksandar Gerasimovski8a78d922021-11-16 12:48:46 +000015bool qrio_get_selftest_pin(void);
Aleksandar Gerasimovski4908d3c2021-11-16 12:50:54 +000016bool qrio_get_pgy_pres_pin(void);
Holger Brunck95626872020-01-10 12:47:42 +010017int qrio_get_gpio(u8 port_off, u8 gpio_nr);
18void qrio_set_opendrain_gpio(u8 port_off, u8 gpio_nr, u8 val);
19void qrio_set_gpio(u8 port_off, u8 gpio_nr, bool value);
20void qrio_gpio_direction_output(u8 port_off, u8 gpio_nr, bool value);
21void qrio_gpio_direction_input(u8 port_off, u8 gpio_nr);
22
23/* QRIO Periphery reset configurations */
24#define PRSTCFG_POWUP_UNIT_CORE_RST 0x0
25#define PRSTCFG_POWUP_UNIT_RST 0x1
26#define PRSTCFG_POWUP_RST 0x3
27
28void qrio_prst(u8 bit, bool en, bool wden);
29void qrio_wdmask(u8 bit, bool wden);
30void qrio_prstcfg(u8 bit, u8 mode);
31void qrio_set_leds(void);
32void qrio_enable_app_buffer(void);
33void qrio_cpuwd_flag(bool flag);
34bool qrio_reason_unitrst(void);
35
36/* QRIO uP reset request configurations */
37#define UPREQ_UNIT_RST 0x0
38#define UPREQ_CORE_RST 0x1
39
40void qrio_uprstreq(u8 mode);
41
42void i2c_deblock_gpio_cfg(void);
43#endif /* __QRIO_H */