]> git.proxmox.com Git - mirror_edk2.git/blame - BeagleBoardPkg/Library/BeagleBoardLib/BeagleBoard.c
ARM Packages: Fixed line endings
[mirror_edk2.git] / BeagleBoardPkg / Library / BeagleBoardLib / BeagleBoard.c
CommitLineData
1e57a462 1/** @file\r
2*\r
3* Copyright (c) 2011-2012, ARM Limited. All rights reserved.\r
4* \r
5* This program and the accompanying materials \r
6* are licensed and made available under the terms and conditions of the BSD License \r
7* which accompanies this distribution. The full text of the license may be found at \r
8* http://opensource.org/licenses/bsd-license.php \r
9*\r
10* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
11* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
12*\r
13**/\r
14\r
15#include <Library/IoLib.h>\r
16#include <Library/ArmPlatformLib.h>\r
17#include <Library/DebugLib.h>\r
18#include <Library/PcdLib.h>\r
19\r
20#include <Omap3530/Omap3530.h>\r
21#include <BeagleBoard.h>\r
22\r
23VOID\r
24PadConfiguration (\r
25 BEAGLEBOARD_REVISION Revision\r
26 );\r
27\r
28VOID\r
29ClockInit (\r
30 VOID\r
31 );\r
32\r
33/**\r
34 Detect board revision\r
35\r
36 @return Board revision\r
37**/\r
38BEAGLEBOARD_REVISION\r
39BeagleBoardGetRevision (\r
40 VOID\r
41 )\r
42{\r
43 UINT32 OldPinDir;\r
44 UINT32 Revision;\r
45\r
46 // Read GPIO 171, 172, 173\r
47 OldPinDir = MmioRead32 (GPIO6_BASE + GPIO_OE);\r
48 MmioWrite32(GPIO6_BASE + GPIO_OE, (OldPinDir | BIT11 | BIT12 | BIT13));\r
49 Revision = MmioRead32 (GPIO6_BASE + GPIO_DATAIN);\r
50 \r
51 // Restore I/O settings\r
52 MmioWrite32 (GPIO6_BASE + GPIO_OE, OldPinDir);\r
53 \r
54 return (BEAGLEBOARD_REVISION)((Revision >> 11) & 0x7);\r
55}\r
56\r
57/**\r
58 Return the current Boot Mode\r
59\r
60 This function returns the boot reason on the platform\r
61\r
62**/\r
63EFI_BOOT_MODE\r
64ArmPlatformGetBootMode (\r
65 VOID\r
66 )\r
67{\r
68 return BOOT_WITH_FULL_CONFIGURATION;\r
69}\r
70\r
71/**\r
72 Initialize controllers that must setup at the early stage\r
73\r
74 Some peripherals must be initialized in Secure World.\r
75 For example, some L2x0 requires to be initialized in Secure World\r
76\r
77**/\r
78RETURN_STATUS\r
79ArmPlatformInitialize (\r
80 IN UINTN MpId\r
81 )\r
82{\r
83 BEAGLEBOARD_REVISION Revision;\r
84\r
85 Revision = BeagleBoardGetRevision();\r
86\r
87 // Set up Pin muxing.\r
88 PadConfiguration (Revision);\r
89\r
90 // Set up system clocking\r
91 ClockInit ();\r
92\r
93 // Turn off the functional clock for Timer 3\r
94 MmioAnd32 (CM_FCLKEN_PER, 0xFFFFFFFF ^ CM_ICLKEN_PER_EN_GPT3_ENABLE );\r
95 ArmDataSyncronizationBarrier ();\r
96\r
97 // Clear IRQs\r
98 MmioWrite32 (INTCPS_CONTROL, INTCPS_CONTROL_NEWIRQAGR);\r
99 ArmDataSyncronizationBarrier ();\r
100\r
101 return RETURN_SUCCESS;\r
102}\r
103\r
104/**\r
105 Initialize the system (or sometimes called permanent) memory\r
106\r
107 This memory is generally represented by the DRAM.\r
108\r
109**/\r
110VOID\r
111ArmPlatformInitializeSystemMemory (\r
112 VOID\r
113 )\r
114{\r
115 // We do not need to initialize the System Memory on RTSM\r
116}\r
117\r
118VOID\r
119ArmPlatformGetPlatformPpiList (\r
120 OUT UINTN *PpiListSize,\r
121 OUT EFI_PEI_PPI_DESCRIPTOR **PpiList\r
122 )\r
123{\r
124 *PpiListSize = 0;\r
125 *PpiList = NULL;\r
126}\r
127\r
128UINTN\r
129ArmPlatformGetCorePosition (\r
130 IN UINTN MpId\r
131 )\r
132{\r
133 return 1;\r
134}\r
135\r