xref: /rk3399_rockchip-uboot/board/egnite/ethernut5/ethernut5_pwrman.h (revision 326ea986ac150acdc7656d57fca647db80b50158)
114c32614STim Schendekehl /*
214c32614STim Schendekehl  * (C) Copyright 2011
314c32614STim Schendekehl  * egnite GmbH <info@egnite.de>
414c32614STim Schendekehl  *
5*1a459660SWolfgang Denk  * SPDX-License-Identifier:	GPL-2.0+
614c32614STim Schendekehl  */
714c32614STim Schendekehl 
814c32614STim Schendekehl /*
914c32614STim Schendekehl  * Ethernut 5 power management support
1014c32614STim Schendekehl  *
1114c32614STim Schendekehl  * For additional information visit the project home page at
1214c32614STim Schendekehl  * http://www.ethernut.de/
1314c32614STim Schendekehl  */
1414c32614STim Schendekehl 
1514c32614STim Schendekehl /* I2C address of the PMC */
1614c32614STim Schendekehl #define PWRMAN_I2C_ADDR 0x22
1714c32614STim Schendekehl 
1814c32614STim Schendekehl /* PMC registers */
1914c32614STim Schendekehl #define PWRMAN_REG_VERS		0	/* Version register */
2014c32614STim Schendekehl #define PWRMAN_REG_STA		1	/* Feature status register */
2114c32614STim Schendekehl #define PWRMAN_REG_ENA		2	/* Feature enable register */
2214c32614STim Schendekehl #define PWRMAN_REG_DIS		3	/* Feature disable register */
2314c32614STim Schendekehl #define PWRMAN_REG_TEMP		4	/* Board temperature */
2414c32614STim Schendekehl #define PWRMAN_REG_VAUX		6	/* Auxiliary input voltage */
2514c32614STim Schendekehl #define PWRMAN_REG_LEDCTL	8	/* LED blinking timer. */
2614c32614STim Schendekehl 
2714c32614STim Schendekehl /* Feature flags used in status, enable and disable registers */
2814c32614STim Schendekehl #define PWRMAN_BOARD	0x01	/* 1.8V and 3.3V supply */
2914c32614STim Schendekehl #define PWRMAN_VBIN	0x02	/* VBUS input at device connector */
3014c32614STim Schendekehl #define PWRMAN_VBOUT	0x04	/* VBUS output at host connector */
3114c32614STim Schendekehl #define PWRMAN_MMC	0x08	/* Memory card supply */
3214c32614STim Schendekehl #define PWRMAN_RS232	0x10	/* RS-232 driver shutdown */
3314c32614STim Schendekehl #define PWRMAN_ETHCLK	0x20	/* Ethernet clock enable */
3414c32614STim Schendekehl #define PWRMAN_ETHRST	0x40	/* Ethernet PHY reset */
3514c32614STim Schendekehl #define PWRMAN_WAKEUP	0x80	/* RTC wake-up */
3614c32614STim Schendekehl 
3714c32614STim Schendekehl /* Features, which are not essential to keep u-boot alive */
3814c32614STim Schendekehl #define PWRMAN_DISPENSIBLE	(PWRMAN_VBOUT | PWRMAN_MMC | PWRMAN_ETHCLK)
3914c32614STim Schendekehl 
4014c32614STim Schendekehl /* Enable Ethernut 5 power management. */
4114c32614STim Schendekehl extern void ethernut5_power_init(void);
4214c32614STim Schendekehl 
4314c32614STim Schendekehl /* Reset Ethernet PHY. */
4414c32614STim Schendekehl extern void ethernut5_phy_reset(void);
4514c32614STim Schendekehl 
4614c32614STim Schendekehl extern void ethernut5_print_version(void);
4714c32614STim Schendekehl 
4814c32614STim Schendekehl #ifdef CONFIG_CMD_BSP
4914c32614STim Schendekehl extern void ethernut5_print_power(void);
5014c32614STim Schendekehl extern void ethernut5_print_celsius(void);
5114c32614STim Schendekehl extern void ethernut5_print_voltage(void);
5214c32614STim Schendekehl #endif
53