xref: /openbmc/u-boot/include/power/as3722.h (revision c2012cb4)
1 /*
2  * Copyright (C) 2014 NVIDIA Corporation
3  *
4  * SPDX-License-Identifier: GPL-2.0+
5  */
6 
7 #ifndef __POWER_AS3722_H__
8 #define __POWER_AS3722_H__
9 
10 #include <asm/types.h>
11 
12 #define AS3722_GPIO_OUTPUT_VDDH (1 << 0)
13 #define AS3722_GPIO_INVERT (1 << 1)
14 
15 #define AS3722_DEVICE_ID 0x0c
16 #define AS3722_SD_VOLTAGE(n) (0x00 + (n))
17 #define AS3722_LDO_VOLTAGE(n) (0x10 + (n))
18 #define AS3722_SD_CONTROL 0x4d
19 #define AS3722_LDO_CONTROL 0x4e
20 #define AS3722_ASIC_ID1 0x90
21 #define AS3722_ASIC_ID2 0x91
22 
23 #define AS3722_GPIO_CONTROL(n) (0x08 + (n))
24 #define AS3722_GPIO_CONTROL_MODE_OUTPUT_VDDH (1 << 0)
25 #define AS3722_GPIO_CONTROL_MODE_OUTPUT_VDDL (7 << 0)
26 #define AS3722_GPIO_CONTROL_INVERT (1 << 7)
27 
28 struct udevice;
29 
30 int as3722_init(struct udevice **devp);
31 int as3722_sd_enable(struct udevice *pmic, unsigned int sd);
32 int as3722_sd_set_voltage(struct udevice *pmic, unsigned int sd, u8 value);
33 int as3722_ldo_enable(struct udevice *pmic, unsigned int ldo);
34 int as3722_ldo_set_voltage(struct udevice *pmic, unsigned int ldo, u8 value);
35 int as3722_gpio_configure(struct udevice *pmic, unsigned int gpio,
36 			  unsigned long flags);
37 int as3722_gpio_direction_output(struct udevice *pmic, unsigned int gpio,
38 				 unsigned int level);
39 int as3722_read(struct udevice *pmic, u8 reg, u8 *value);
40 int as3722_write(struct udevice *pmic, u8 reg, u8 value);
41 int as3722_get(struct udevice **devp);
42 
43 #endif /* __POWER_AS3722_H__ */
44