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