]>
Commit | Line | Data |
---|---|---|
b303605e MK |
1 | /** @file\r |
2 | Platform helper LED routines.\r | |
3 | \r | |
4 | Copyright (c) 2013-2015 Intel Corporation.\r | |
5 | \r | |
6 | This program and the accompanying materials\r | |
7 | are licensed and made available under the terms and conditions of the BSD License\r | |
8 | which accompanies this distribution. The full text of the license may be found at\r | |
9 | http://opensource.org/licenses/bsd-license.php\r | |
10 | \r | |
11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
13 | \r | |
14 | **/\r | |
15 | \r | |
16 | #include <PiDxe.h>\r | |
17 | \r | |
18 | #include "CommonHeader.h"\r | |
19 | \r | |
20 | //\r | |
21 | // Routines defined in other source modules of this component.\r | |
22 | //\r | |
23 | \r | |
24 | //\r | |
25 | // Routines local to this source module.\r | |
26 | //\r | |
27 | \r | |
28 | VOID\r | |
29 | GalileoGen2RouteOutFlashUpdateLed (\r | |
30 | VOID\r | |
31 | )\r | |
32 | {\r | |
33 | //\r | |
34 | // For GpioNums below values 0 to 7 are for Port0 ie P0-0 - P0-7 and\r | |
35 | // values 8 to 15 are for Port1 ie P1-0 - P1-7.\r | |
36 | //\r | |
37 | \r | |
38 | //\r | |
39 | // Disable Pull-ups / pull downs on EXP0 pin for LVL_B_PU7 signal.\r | |
40 | //\r | |
41 | PlatformPcal9555GpioDisablePull (\r | |
42 | GALILEO_GEN2_IOEXP0_7BIT_SLAVE_ADDR, // IO Expander 0.\r | |
43 | 15 // P1-7.\r | |
44 | );\r | |
45 | \r | |
46 | //\r | |
47 | // Make LVL_B_OE7_N an output pin.\r | |
48 | //\r | |
49 | PlatformPcal9555GpioSetDir (\r | |
50 | GALILEO_GEN2_IOEXP0_7BIT_SLAVE_ADDR, // IO Expander 0.\r | |
51 | 14, // P1-6.\r | |
52 | FALSE\r | |
53 | );\r | |
54 | \r | |
55 | //\r | |
56 | // Set level of LVL_B_OE7_N to low.\r | |
57 | //\r | |
58 | PlatformPcal9555GpioSetLevel (\r | |
59 | GALILEO_GEN2_IOEXP0_7BIT_SLAVE_ADDR,\r | |
60 | 14,\r | |
61 | FALSE\r | |
62 | );\r | |
63 | \r | |
64 | //\r | |
65 | // Make MUX8_SEL an output pin.\r | |
66 | //\r | |
67 | PlatformPcal9555GpioSetDir (\r | |
68 | GALILEO_GEN2_IOEXP1_7BIT_SLAVE_ADDR, // IO Expander 1.\r | |
69 | 14, // P1-6.\r | |
70 | FALSE\r | |
71 | );\r | |
72 | \r | |
73 | //\r | |
74 | // Set level of MUX8_SEL to low to route GPIO_SUS<5> to LED.\r | |
75 | //\r | |
76 | PlatformPcal9555GpioSetLevel (\r | |
77 | GALILEO_GEN2_IOEXP1_7BIT_SLAVE_ADDR, // IO Expander 1.\r | |
78 | 14, // P1-6.\r | |
79 | FALSE\r | |
80 | );\r | |
81 | }\r | |
82 | \r | |
83 | //\r | |
84 | // Routines exported by this source module.\r | |
85 | //\r | |
86 | \r | |
87 | /**\r | |
88 | Init platform LEDs into known state.\r | |
89 | \r | |
90 | @param PlatformType Executing platform type.\r | |
91 | @param I2cBus Pointer to I2c Host controller protocol.\r | |
92 | \r | |
93 | @retval EFI_SUCCESS Operation success.\r | |
94 | \r | |
95 | **/\r | |
96 | EFI_STATUS\r | |
97 | EFIAPI\r | |
98 | PlatformLedInit (\r | |
99 | IN CONST EFI_PLATFORM_TYPE Type\r | |
100 | )\r | |
101 | {\r | |
102 | EFI_BOOT_MODE BootMode;\r | |
103 | \r | |
104 | BootMode = GetBootModeHob ();\r | |
105 | \r | |
106 | //\r | |
107 | // Init Flash update / recovery LED in OFF state.\r | |
108 | //\r | |
109 | if (BootMode == BOOT_ON_FLASH_UPDATE || BootMode == BOOT_IN_RECOVERY_MODE) {\r | |
110 | if (Type == GalileoGen2) {\r | |
111 | PlatformLegacyGpioSetLevel (R_QNC_GPIO_RGLVL_RESUME_WELL, GALILEO_GEN2_FLASH_UPDATE_LED_RESUMEWELL_GPIO, FALSE);\r | |
112 | GalileoGen2RouteOutFlashUpdateLed ();\r | |
113 | } else if (Type == Galileo) {\r | |
114 | PlatformLegacyGpioSetLevel (R_QNC_GPIO_RGLVL_RESUME_WELL, GALILEO_FLASH_UPDATE_LED_RESUMEWELL_GPIO, FALSE);\r | |
115 | } else {\r | |
116 | //\r | |
117 | // These platforms have no flash update LED.\r | |
118 | //\r | |
119 | }\r | |
120 | }\r | |
121 | \r | |
122 | return EFI_SUCCESS;\r | |
123 | }\r | |
124 | \r | |
125 | /**\r | |
126 | Turn on or off platform flash update LED.\r | |
127 | \r | |
128 | @param PlatformType Executing platform type.\r | |
129 | @param TurnOn If TRUE turn on else turn off.\r | |
130 | \r | |
131 | @retval EFI_SUCCESS Operation success.\r | |
132 | \r | |
133 | **/\r | |
134 | EFI_STATUS\r | |
135 | EFIAPI\r | |
136 | PlatformFlashUpdateLed (\r | |
137 | IN CONST EFI_PLATFORM_TYPE Type,\r | |
138 | IN CONST BOOLEAN TurnOn\r | |
139 | )\r | |
140 | {\r | |
141 | if (Type == GalileoGen2) {\r | |
142 | PlatformLegacyGpioSetLevel (R_QNC_GPIO_RGLVL_RESUME_WELL, GALILEO_GEN2_FLASH_UPDATE_LED_RESUMEWELL_GPIO, TurnOn);\r | |
143 | } else if (Type == Galileo) {\r | |
144 | PlatformLegacyGpioSetLevel (R_QNC_GPIO_RGLVL_RESUME_WELL, GALILEO_FLASH_UPDATE_LED_RESUMEWELL_GPIO, TurnOn);\r | |
145 | } else {\r | |
146 | //\r | |
147 | // These platforms have no flash update LED.\r | |
148 | //\r | |
149 | }\r | |
150 | \r | |
151 | return EFI_SUCCESS;\r | |
152 | }\r |