]> git.proxmox.com Git - mirror_edk2.git/blob - BeagleBoardPkg/Library/BeagleBoardLib/BeagleBoard.c
BeagleBoardPkg: Ensure there is no pending IRQ and disable timer
[mirror_edk2.git] / BeagleBoardPkg / Library / BeagleBoardLib / BeagleBoard.c
1 /** @file
2 *
3 * Copyright (c) 2011, ARM Limited. All rights reserved.
4 *
5 * This program and the accompanying materials
6 * are licensed and made available under the terms and conditions of the BSD License
7 * which accompanies this distribution. The full text of the license may be found at
8 * http://opensource.org/licenses/bsd-license.php
9 *
10 * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 *
13 **/
14
15 #include <Library/IoLib.h>
16 #include <Library/ArmPlatformLib.h>
17 #include <Library/DebugLib.h>
18 #include <Library/PcdLib.h>
19
20 #include <Omap3530/Omap3530.h>
21
22 VOID
23 PadConfiguration (
24 VOID
25 );
26
27 VOID
28 ClockInit (
29 VOID
30 );
31
32 /**
33 Return if Trustzone is supported by your platform
34
35 A non-zero value must be returned if you want to support a Secure World on your platform.
36 ArmPlatformTrustzoneInit() will later set up the secure regions.
37 This function can return 0 even if Trustzone is supported by your processor. In this case,
38 the platform will continue to run in Secure World.
39
40 @return A non-zero value if Trustzone supported.
41
42 **/
43 UINTN
44 ArmPlatformTrustzoneSupported (
45 VOID
46 )
47 {
48 // The BeagleBoard starts in Normal World (Non Secure World)
49 return FALSE;
50 }
51
52 /**
53 Initialize the Secure peripherals and memory regions
54
55 If Trustzone is supported by your platform then this function makes the required initialization
56 of the secure peripherals and memory regions.
57
58 **/
59 VOID
60 ArmPlatformTrustzoneInit (
61 VOID
62 )
63 {
64 ASSERT(FALSE);
65 }
66
67 /**
68 Remap the memory at 0x0
69
70 Some platform requires or gives the ability to remap the memory at the address 0x0.
71 This function can do nothing if this feature is not relevant to your platform.
72
73 **/
74 VOID
75 ArmPlatformBootRemapping (
76 VOID
77 )
78 {
79 // Do nothing for the BeagleBoard
80 }
81
82 /**
83 Return the current Boot Mode
84
85 This function returns the boot reason on the platform
86
87 **/
88 EFI_BOOT_MODE
89 ArmPlatformGetBootMode (
90 VOID
91 )
92 {
93 return BOOT_WITH_FULL_CONFIGURATION;
94 }
95
96 /**
97 Initialize controllers that must setup at the early stage
98
99 Some peripherals must be initialized in Secure World.
100 For example, some L2x0 requires to be initialized in Secure World
101
102 **/
103 VOID
104 ArmPlatformNormalInitialize (
105 VOID
106 )
107 {
108 //Set up Pin muxing.
109 PadConfiguration ();
110
111 // Set up system clocking
112 ClockInit ();
113
114 // Turn off the functional clock for Timer 3
115 MmioAnd32 (CM_FCLKEN_PER, 0xFFFFFFFF ^ CM_ICLKEN_PER_EN_GPT3_ENABLE );
116 ArmDataSyncronizationBarrier ();
117
118 // Clear IRQs
119 MmioWrite32 (INTCPS_CONTROL, INTCPS_CONTROL_NEWIRQAGR);
120 ArmDataSyncronizationBarrier ();
121 }
122
123 /**
124 Initialize the system (or sometimes called permanent) memory
125
126 This memory is generally represented by the DRAM.
127
128 **/
129 VOID
130 ArmPlatformInitializeSystemMemory (
131 VOID
132 )
133 {
134 // We do not need to initialize the System Memory on RTSM
135 }