]> git.proxmox.com Git - mirror_edk2.git/blame - BeagleBoardPkg/Library/BeagleBoardLib/BeagleBoard.c
ArmPlatformPkg/ArmPlatformLib.h: Introduced ArmPlatformGetCorePosition()
[mirror_edk2.git] / BeagleBoardPkg / Library / BeagleBoardLib / BeagleBoard.c
CommitLineData
7f21c4a2 1/** @file
2*
f437141a 3* Copyright (c) 2011-2012, ARM Limited. All rights reserved.
7f21c4a2 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
2d08d17d 20#include <Omap3530/Omap3530.h>
efe5f1a2 21#include <BeagleBoard.h>
2d08d17d 22
7f21c4a2 23VOID
24PadConfiguration (
efe5f1a2 25 BEAGLEBOARD_REVISION Revision
7f21c4a2 26 );
27
28VOID
29ClockInit (
30 VOID
31 );
32
efe5f1a2 33/**
34 Detect board revision
35
36 @return Board revision
37**/
38BEAGLEBOARD_REVISION
39BeagleBoardGetRevision (
40 VOID
41 )
42{
43 UINT32 OldPinDir;
44 UINT32 Revision;
45
46 // Read GPIO 171, 172, 173
47 OldPinDir = MmioRead32 (GPIO6_BASE + GPIO_OE);
48 MmioWrite32(GPIO6_BASE + GPIO_OE, (OldPinDir | BIT11 | BIT12 | BIT13));
49 Revision = MmioRead32 (GPIO6_BASE + GPIO_DATAIN);
50
51 // Restore I/O settings
52 MmioWrite32 (GPIO6_BASE + GPIO_OE, OldPinDir);
53
54 return (BEAGLEBOARD_REVISION)((Revision >> 11) & 0x7);
55}
56
7f21c4a2 57/**
58 Return the current Boot Mode
59
60 This function returns the boot reason on the platform
61
62**/
63EFI_BOOT_MODE
64ArmPlatformGetBootMode (
65 VOID
66 )
67{
68 return BOOT_WITH_FULL_CONFIGURATION;
69}
70
71/**
72 Initialize controllers that must setup at the early stage
73
74 Some peripherals must be initialized in Secure World.
75 For example, some L2x0 requires to be initialized in Secure World
76
77**/
f437141a 78RETURN_STATUS
79ArmPlatformInitialize (
80 IN UINTN MpId
2d08d17d 81 )
82{
efe5f1a2 83 BEAGLEBOARD_REVISION Revision;
84
85 Revision = BeagleBoardGetRevision();
86
87 // Set up Pin muxing.
88 PadConfiguration (Revision);
7f21c4a2 89
90 // Set up system clocking
91 ClockInit ();
2d08d17d 92
93 // Turn off the functional clock for Timer 3
94 MmioAnd32 (CM_FCLKEN_PER, 0xFFFFFFFF ^ CM_ICLKEN_PER_EN_GPT3_ENABLE );
95 ArmDataSyncronizationBarrier ();
96
97 // Clear IRQs
98 MmioWrite32 (INTCPS_CONTROL, INTCPS_CONTROL_NEWIRQAGR);
99 ArmDataSyncronizationBarrier ();
f437141a 100
101 return RETURN_SUCCESS;
7f21c4a2 102}
103
104/**
105 Initialize the system (or sometimes called permanent) memory
106
107 This memory is generally represented by the DRAM.
108
109**/
110VOID
111ArmPlatformInitializeSystemMemory (
112 VOID
113 )
114{
115 // We do not need to initialize the System Memory on RTSM
116}
0dbbacdf 117
118VOID
119ArmPlatformGetPlatformPpiList (
120 OUT UINTN *PpiListSize,
121 OUT EFI_PEI_PPI_DESCRIPTOR **PpiList
122 )
123{
124 *PpiListSize = 0;
125 *PpiList = NULL;
126}
0657689b 127
128UINTN
129ArmPlatformGetCorePosition (
130 IN UINTN MpId
131 )
132{
133 return 1;
134}
135