]>
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 | |
0eb3de2e | 6 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
b303605e MK |
7 | \r |
8 | **/\r | |
9 | \r | |
10 | #include <PiDxe.h>\r | |
11 | \r | |
12 | #include "CommonHeader.h"\r | |
13 | \r | |
14 | //\r | |
15 | // Routines defined in other source modules of this component.\r | |
16 | //\r | |
17 | \r | |
18 | //\r | |
19 | // Routines local to this source module.\r | |
20 | //\r | |
21 | \r | |
22 | VOID\r | |
23 | GalileoGen2RouteOutFlashUpdateLed (\r | |
24 | VOID\r | |
25 | )\r | |
26 | {\r | |
27 | //\r | |
28 | // For GpioNums below values 0 to 7 are for Port0 ie P0-0 - P0-7 and\r | |
29 | // values 8 to 15 are for Port1 ie P1-0 - P1-7.\r | |
30 | //\r | |
31 | \r | |
32 | //\r | |
33 | // Disable Pull-ups / pull downs on EXP0 pin for LVL_B_PU7 signal.\r | |
34 | //\r | |
35 | PlatformPcal9555GpioDisablePull (\r | |
36 | GALILEO_GEN2_IOEXP0_7BIT_SLAVE_ADDR, // IO Expander 0.\r | |
37 | 15 // P1-7.\r | |
38 | );\r | |
39 | \r | |
40 | //\r | |
41 | // Make LVL_B_OE7_N an output pin.\r | |
42 | //\r | |
43 | PlatformPcal9555GpioSetDir (\r | |
44 | GALILEO_GEN2_IOEXP0_7BIT_SLAVE_ADDR, // IO Expander 0.\r | |
45 | 14, // P1-6.\r | |
46 | FALSE\r | |
47 | );\r | |
48 | \r | |
49 | //\r | |
50 | // Set level of LVL_B_OE7_N to low.\r | |
51 | //\r | |
52 | PlatformPcal9555GpioSetLevel (\r | |
53 | GALILEO_GEN2_IOEXP0_7BIT_SLAVE_ADDR,\r | |
54 | 14,\r | |
55 | FALSE\r | |
56 | );\r | |
57 | \r | |
58 | //\r | |
59 | // Make MUX8_SEL an output pin.\r | |
60 | //\r | |
61 | PlatformPcal9555GpioSetDir (\r | |
62 | GALILEO_GEN2_IOEXP1_7BIT_SLAVE_ADDR, // IO Expander 1.\r | |
63 | 14, // P1-6.\r | |
64 | FALSE\r | |
65 | );\r | |
66 | \r | |
67 | //\r | |
68 | // Set level of MUX8_SEL to low to route GPIO_SUS<5> to LED.\r | |
69 | //\r | |
70 | PlatformPcal9555GpioSetLevel (\r | |
71 | GALILEO_GEN2_IOEXP1_7BIT_SLAVE_ADDR, // IO Expander 1.\r | |
72 | 14, // P1-6.\r | |
73 | FALSE\r | |
74 | );\r | |
75 | }\r | |
76 | \r | |
77 | //\r | |
78 | // Routines exported by this source module.\r | |
79 | //\r | |
80 | \r | |
81 | /**\r | |
82 | Init platform LEDs into known state.\r | |
83 | \r | |
84 | @param PlatformType Executing platform type.\r | |
85 | @param I2cBus Pointer to I2c Host controller protocol.\r | |
86 | \r | |
87 | @retval EFI_SUCCESS Operation success.\r | |
88 | \r | |
89 | **/\r | |
90 | EFI_STATUS\r | |
91 | EFIAPI\r | |
92 | PlatformLedInit (\r | |
93 | IN CONST EFI_PLATFORM_TYPE Type\r | |
94 | )\r | |
95 | {\r | |
96 | EFI_BOOT_MODE BootMode;\r | |
97 | \r | |
98 | BootMode = GetBootModeHob ();\r | |
99 | \r | |
100 | //\r | |
101 | // Init Flash update / recovery LED in OFF state.\r | |
102 | //\r | |
103 | if (BootMode == BOOT_ON_FLASH_UPDATE || BootMode == BOOT_IN_RECOVERY_MODE) {\r | |
104 | if (Type == GalileoGen2) {\r | |
105 | PlatformLegacyGpioSetLevel (R_QNC_GPIO_RGLVL_RESUME_WELL, GALILEO_GEN2_FLASH_UPDATE_LED_RESUMEWELL_GPIO, FALSE);\r | |
106 | GalileoGen2RouteOutFlashUpdateLed ();\r | |
107 | } else if (Type == Galileo) {\r | |
108 | PlatformLegacyGpioSetLevel (R_QNC_GPIO_RGLVL_RESUME_WELL, GALILEO_FLASH_UPDATE_LED_RESUMEWELL_GPIO, FALSE);\r | |
109 | } else {\r | |
110 | //\r | |
111 | // These platforms have no flash update LED.\r | |
112 | //\r | |
113 | }\r | |
114 | }\r | |
115 | \r | |
116 | return EFI_SUCCESS;\r | |
117 | }\r | |
118 | \r | |
119 | /**\r | |
120 | Turn on or off platform flash update LED.\r | |
121 | \r | |
122 | @param PlatformType Executing platform type.\r | |
123 | @param TurnOn If TRUE turn on else turn off.\r | |
124 | \r | |
125 | @retval EFI_SUCCESS Operation success.\r | |
126 | \r | |
127 | **/\r | |
128 | EFI_STATUS\r | |
129 | EFIAPI\r | |
130 | PlatformFlashUpdateLed (\r | |
131 | IN CONST EFI_PLATFORM_TYPE Type,\r | |
132 | IN CONST BOOLEAN TurnOn\r | |
133 | )\r | |
134 | {\r | |
135 | if (Type == GalileoGen2) {\r | |
136 | PlatformLegacyGpioSetLevel (R_QNC_GPIO_RGLVL_RESUME_WELL, GALILEO_GEN2_FLASH_UPDATE_LED_RESUMEWELL_GPIO, TurnOn);\r | |
137 | } else if (Type == Galileo) {\r | |
138 | PlatformLegacyGpioSetLevel (R_QNC_GPIO_RGLVL_RESUME_WELL, GALILEO_FLASH_UPDATE_LED_RESUMEWELL_GPIO, TurnOn);\r | |
139 | } else {\r | |
140 | //\r | |
141 | // These platforms have no flash update LED.\r | |
142 | //\r | |
143 | }\r | |
144 | \r | |
145 | return EFI_SUCCESS;\r | |
146 | }\r |