1 /*
2  * (C) Copyright 2011
3  * egnite GmbH <info@egnite.de>
4  *
5  * See file CREDITS for list of people who contributed to this
6  * project.
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License as
10  * published by the Free Software Foundation; either version 2 of
11  * the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21  * MA 02111-1307 USA
22  */
23 
24 /*
25  * Ethernut 5 power management support
26  *
27  * For additional information visit the project home page at
28  * http://www.ethernut.de/
29  */
30 
31 /* I2C address of the PMC */
32 #define PWRMAN_I2C_ADDR 0x22
33 
34 /* PMC registers */
35 #define PWRMAN_REG_VERS		0	/* Version register */
36 #define PWRMAN_REG_STA		1	/* Feature status register */
37 #define PWRMAN_REG_ENA		2	/* Feature enable register */
38 #define PWRMAN_REG_DIS		3	/* Feature disable register */
39 #define PWRMAN_REG_TEMP		4	/* Board temperature */
40 #define PWRMAN_REG_VAUX		6	/* Auxiliary input voltage */
41 #define PWRMAN_REG_LEDCTL	8	/* LED blinking timer. */
42 
43 /* Feature flags used in status, enable and disable registers */
44 #define PWRMAN_BOARD	0x01	/* 1.8V and 3.3V supply */
45 #define PWRMAN_VBIN	0x02	/* VBUS input at device connector */
46 #define PWRMAN_VBOUT	0x04	/* VBUS output at host connector */
47 #define PWRMAN_MMC	0x08	/* Memory card supply */
48 #define PWRMAN_RS232	0x10	/* RS-232 driver shutdown */
49 #define PWRMAN_ETHCLK	0x20	/* Ethernet clock enable */
50 #define PWRMAN_ETHRST	0x40	/* Ethernet PHY reset */
51 #define PWRMAN_WAKEUP	0x80	/* RTC wake-up */
52 
53 /* Features, which are not essential to keep u-boot alive */
54 #define PWRMAN_DISPENSIBLE	(PWRMAN_VBOUT | PWRMAN_MMC | PWRMAN_ETHCLK)
55 
56 /* Enable Ethernut 5 power management. */
57 extern void ethernut5_power_init(void);
58 
59 /* Reset Ethernet PHY. */
60 extern void ethernut5_phy_reset(void);
61 
62 extern void ethernut5_print_version(void);
63 
64 #ifdef CONFIG_CMD_BSP
65 extern void ethernut5_print_power(void);
66 extern void ethernut5_print_celsius(void);
67 extern void ethernut5_print_voltage(void);
68 #endif
69