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
|
/**
*
* Copyright (C) 2019, Marvell International Ltd. and its affiliates.
*
* SPDX-License-Identifier: BSD-2-Clause-Patent
*
**/
#include <Uefi.h>
#include <Library/ArmadaBoardDescLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/IoLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/MvGpioLib.h>
#include <Library/UefiBootServicesTableLib.h>
//
// GPIO Expander
//
STATIC MV_GPIO_EXPANDER mGpioExpander = {
PCA9555_ID,
0x21,
0x0,
};
EFI_STATUS
EFIAPI
ArmadaBoardGpioExpanderGet (
IN OUT MV_GPIO_EXPANDER **GpioExpanders,
IN OUT UINTN *GpioExpanderCount
)
{
*GpioExpanderCount = 1;
*GpioExpanders = &mGpioExpander;
return EFI_SUCCESS;
}
//
// PCIE
//
STATIC
MV_PCIE_CONTROLLER mPcieController[] = {
{ /* PCIE0 @0xF2640000 */
.PcieDbiAddress = 0xF2600000,
.ConfigSpaceAddress = 0xD0000000,
.HaveResetGpio = FALSE,
.PcieResetGpio = { 0 },
.PcieBusMin = 0,
.PcieBusMax = 0xFE,
.PcieIoTranslation = 0xDFF00000,
.PcieIoWinBase = 0x0,
.PcieIoWinSize = 0x10000,
.PcieMmio32Translation = 0,
.PcieMmio32WinBase = 0xC0000000,
.PcieMmio32WinSize = 0x10000000,
.PcieMmio64Translation = 0,
.PcieMmio64WinBase = MAX_UINT64,
.PcieMmio64WinSize = 0,
}
};
/**
Return the number and description of PCIE controllers used on the platform.
@param[in out] **PcieControllers Array containing PCIE controllers'
description.
@param[in out] *PcieControllerCount Amount of used PCIE controllers.
@retval EFI_SUCCESS The data were obtained successfully.
@retval other Return error status.
**/
EFI_STATUS
EFIAPI
ArmadaBoardPcieControllerGet (
IN OUT MV_PCIE_CONTROLLER CONST **PcieControllers,
IN OUT UINTN *PcieControllerCount
)
{
*PcieControllers = mPcieController;
*PcieControllerCount = ARRAY_SIZE (mPcieController);
return EFI_SUCCESS;
}
//
// Order of devices in SdMmcDescTemplate has to be in par with ArmadaSoCDescLib
//
STATIC
MV_BOARD_SDMMC_DESC mSdMmcDescTemplate[] = {
{ /* eMMC 0xF06E0000 */
0, /* SOC will be filled by MvBoardDescDxe */
0, /* SdMmcDevCount will be filled by MvBoardDescDxe */
FALSE, /* Xenon1v8Enabled */
TRUE, /* Xenon8BitBusEnabled */
FALSE, /* XenonSlowModeEnabled */
0x40, /* XenonTuningStepDivisor */
EmbeddedSlot /* SlotType */
},
{ /* SD/MMC 0xF2780000 */
0, /* SOC will be filled by MvBoardDescDxe */
0, /* SdMmcDevCount will be filled by MvBoardDescDxe */
FALSE, /* Xenon1v8Enabled */
FALSE, /* Xenon8BitBusEnabled */
FALSE, /* XenonSlowModeEnabled */
0x19, /* XenonTuningStepDivisor */
EmbeddedSlot /* SlotType */
}
};
EFI_STATUS
EFIAPI
ArmadaBoardDescSdMmcGet (
OUT UINTN *SdMmcDevCount,
OUT MV_BOARD_SDMMC_DESC **SdMmcDesc
)
{
*SdMmcDesc = mSdMmcDescTemplate;
*SdMmcDevCount = ARRAY_SIZE (mSdMmcDescTemplate);
return EFI_SUCCESS;
}
|