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