diff options
author | oliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-09-22 23:23:54 +0000 |
---|---|---|
committer | oliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-09-22 23:23:54 +0000 |
commit | efe5f1a232abd5a43157368a6e2df292bce0e923 (patch) | |
tree | b66e8f1507d9e5a5436e3d29ad5c1421fc2e5d67 /BeagleBoardPkg | |
parent | 95b3580f8217f1cd19994b480447c42cee752a20 (diff) | |
download | edk2-platforms-efe5f1a232abd5a43157368a6e2df292bce0e923.tar.xz |
BeagleBoardPkg: Set paddings following the BeagleBoard revision (A, B, xM, etc)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12431 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'BeagleBoardPkg')
-rwxr-xr-x | BeagleBoardPkg/Include/BeagleBoard.h | 11 | ||||
-rwxr-xr-x | BeagleBoardPkg/Library/BeagleBoardLib/BeagleBoard.c | 35 | ||||
-rwxr-xr-x | BeagleBoardPkg/Library/BeagleBoardLib/PadConfiguration.c | 74 |
3 files changed, 100 insertions, 20 deletions
diff --git a/BeagleBoardPkg/Include/BeagleBoard.h b/BeagleBoardPkg/Include/BeagleBoard.h index 532d6e4ca6..cdd7242331 100755 --- a/BeagleBoardPkg/Include/BeagleBoard.h +++ b/BeagleBoardPkg/Include/BeagleBoard.h @@ -165,4 +165,15 @@ #define ARM_EB_EFI_MEMORY_REGION_SZ 0x1000000
#endif
+typedef enum {
+ REVISION_XM,
+ REVISION_UNKNOWN0,
+ REVISION_UNKNOWN1,
+ REVISION_UNKNOWN2,
+ REVISION_UNKNOWN3,
+ REVISION_C4,
+ REVISION_C123,
+ REVISION_AB,
+} BEAGLEBOARD_REVISION;
+
#endif
diff --git a/BeagleBoardPkg/Library/BeagleBoardLib/BeagleBoard.c b/BeagleBoardPkg/Library/BeagleBoardLib/BeagleBoard.c index 5a40ccea91..8acb6d9710 100755 --- a/BeagleBoardPkg/Library/BeagleBoardLib/BeagleBoard.c +++ b/BeagleBoardPkg/Library/BeagleBoardLib/BeagleBoard.c @@ -18,10 +18,11 @@ #include <Library/PcdLib.h> #include <Omap3530/Omap3530.h> +#include <BeagleBoard.h> VOID PadConfiguration ( - VOID + BEAGLEBOARD_REVISION Revision ); VOID @@ -30,6 +31,30 @@ ClockInit ( ); /** + Detect board revision + + @return Board revision +**/ +BEAGLEBOARD_REVISION +BeagleBoardGetRevision ( + VOID + ) +{ + UINT32 OldPinDir; + UINT32 Revision; + + // Read GPIO 171, 172, 173 + OldPinDir = MmioRead32 (GPIO6_BASE + GPIO_OE); + MmioWrite32(GPIO6_BASE + GPIO_OE, (OldPinDir | BIT11 | BIT12 | BIT13)); + Revision = MmioRead32 (GPIO6_BASE + GPIO_DATAIN); + + // Restore I/O settings + MmioWrite32 (GPIO6_BASE + GPIO_OE, OldPinDir); + + return (BEAGLEBOARD_REVISION)((Revision >> 11) & 0x7); +} + +/** Return if Trustzone is supported by your platform A non-zero value must be returned if you want to support a Secure World on your platform. @@ -105,8 +130,12 @@ ArmPlatformNormalInitialize ( VOID ) { - //Set up Pin muxing. - PadConfiguration (); + BEAGLEBOARD_REVISION Revision; + + Revision = BeagleBoardGetRevision(); + + // Set up Pin muxing. + PadConfiguration (Revision); // Set up system clocking ClockInit (); diff --git a/BeagleBoardPkg/Library/BeagleBoardLib/PadConfiguration.c b/BeagleBoardPkg/Library/BeagleBoardLib/PadConfiguration.c index ddd9296120..45438023d2 100755 --- a/BeagleBoardPkg/Library/BeagleBoardLib/PadConfiguration.c +++ b/BeagleBoardPkg/Library/BeagleBoardLib/PadConfiguration.c @@ -16,10 +16,13 @@ #include <Library/IoLib.h>
#include <Library/DebugLib.h>
#include <Omap3530/Omap3530.h>
+#include <BeagleBoard.h>
-#define NUM_PINS 238
+#define NUM_PINS_SHARED 232
+#define NUM_PINS_ABC 6
+#define NUM_PINS_XM 12
-PAD_CONFIGURATION PadConfigurationTable[NUM_PINS] = {
+PAD_CONFIGURATION PadConfigurationTableShared[] = {
//Pin, MuxMode, PullConfig, InputEnable
{ SDRC_D0, MUXMODE0, PULL_DISABLED, INPUT },
{ SDRC_D1, MUXMODE0, PULL_DISABLED, INPUT },
@@ -127,12 +130,6 @@ PAD_CONFIGURATION PadConfigurationTable[NUM_PINS] = { { DSS_DATA15, MUXMODE0, PULL_DISABLED, OUTPUT },
{ DSS_DATA16, MUXMODE0, PULL_DISABLED, OUTPUT },
{ DSS_DATA17, MUXMODE0, PULL_DISABLED, OUTPUT },
- { DSS_DATA18, MUXMODE0, PULL_DISABLED, OUTPUT },
- { DSS_DATA19, MUXMODE0, PULL_DISABLED, OUTPUT },
- { DSS_DATA20, MUXMODE0, PULL_DISABLED, OUTPUT },
- { DSS_DATA21, MUXMODE0, PULL_DISABLED, OUTPUT },
- { DSS_DATA22, MUXMODE0, PULL_DISABLED, OUTPUT },
- { DSS_DATA23, MUXMODE0, PULL_DISABLED, OUTPUT },
{ CAM_HS, MUXMODE0, PULL_UP_SELECTED, INPUT },
{ CAM_VS, MUXMODE0, PULL_UP_SELECTED, INPUT },
{ CAM_XCLKA, MUXMODE0, PULL_DISABLED, OUTPUT },
@@ -226,7 +223,7 @@ PAD_CONFIGURATION PadConfigurationTable[NUM_PINS] = { { I2C2_SDA, MUXMODE4, PULL_UP_SELECTED, INPUT },
{ I2C3_SCL, MUXMODE0, PULL_UP_SELECTED, INPUT },
{ I2C3_SDA, MUXMODE0, PULL_UP_SELECTED, INPUT },
- { HDQ_SIO, MUXMODE4, PULL_UP_SELECTED, OUTPUT },
+ { HDQ_SIO, MUXMODE4, PULL_DISABLED, OUTPUT },
{ MCSPI1_CLK, MUXMODE4, PULL_UP_SELECTED, INPUT },
{ MCSPI1_SIMO, MUXMODE4, PULL_UP_SELECTED, INPUT },
{ MCSPI1_SOMI, MUXMODE0, PULL_DISABLED, INPUT },
@@ -261,22 +258,65 @@ PAD_CONFIGURATION PadConfigurationTable[NUM_PINS] = { { ETK_D15, MUXMODE3, PULL_UP_SELECTED, INPUT }
};
+PAD_CONFIGURATION PadConfigurationTableAbc[] = {
+ { DSS_DATA18, MUXMODE0, PULL_DISABLED, OUTPUT },
+ { DSS_DATA19, MUXMODE0, PULL_DISABLED, OUTPUT },
+ { DSS_DATA20, MUXMODE0, PULL_DISABLED, OUTPUT },
+ { DSS_DATA21, MUXMODE0, PULL_DISABLED, OUTPUT },
+ { DSS_DATA22, MUXMODE0, PULL_DISABLED, OUTPUT },
+ { DSS_DATA23, MUXMODE0, PULL_DISABLED, OUTPUT }
+};
+
+PAD_CONFIGURATION PadConfigurationTableXm[] = {
+ { DSS_DATA18, MUXMODE3, PULL_DISABLED, OUTPUT },
+ { DSS_DATA19, MUXMODE3, PULL_DISABLED, OUTPUT },
+ { DSS_DATA20, MUXMODE3, PULL_DISABLED, OUTPUT },
+ { DSS_DATA21, MUXMODE3, PULL_DISABLED, OUTPUT },
+ { DSS_DATA22, MUXMODE3, PULL_DISABLED, OUTPUT },
+ { DSS_DATA23, MUXMODE3, PULL_DISABLED, OUTPUT },
+ { SYS_BOOT0, MUXMODE3, PULL_DISABLED, OUTPUT },
+ { SYS_BOOT1, MUXMODE3, PULL_DISABLED, OUTPUT },
+ { SYS_BOOT3, MUXMODE3, PULL_DISABLED, OUTPUT },
+ { SYS_BOOT4, MUXMODE3, PULL_DISABLED, OUTPUT },
+ { SYS_BOOT5, MUXMODE3, PULL_DISABLED, OUTPUT },
+ { SYS_BOOT6, MUXMODE3, PULL_DISABLED, OUTPUT }
+};
+
VOID
PadConfiguration (
- VOID
+ BEAGLEBOARD_REVISION Revision
)
{
- UINTN Index;
- UINT16 PadConfiguration;
- UINTN NumPinsToConfigure = sizeof(PadConfigurationTable)/sizeof(PAD_CONFIGURATION);
+ UINTN Index;
+ UINT16 PadConfiguration;
+ PAD_CONFIGURATION *BoardConfiguration;
+ UINTN NumPinsToConfigure;
+
+ for (Index = 0; Index < NUM_PINS_SHARED; Index++) {
+ // Set up Pad configuration for particular pin.
+ PadConfiguration = (PadConfigurationTableShared[Index].MuxMode << MUXMODE_OFFSET);
+ PadConfiguration |= (PadConfigurationTableShared[Index].PullConfig << PULL_CONFIG_OFFSET);
+ PadConfiguration |= (PadConfigurationTableShared[Index].InputEnable << INPUTENABLE_OFFSET);
+
+ // Configure the pin with specific Pad configuration.
+ MmioWrite16(PadConfigurationTableShared[Index].Pin, PadConfiguration);
+ }
+
+ if (Revision == REVISION_XM) {
+ BoardConfiguration = PadConfigurationTableXm;
+ NumPinsToConfigure = NUM_PINS_XM;
+ } else {
+ BoardConfiguration = PadConfigurationTableAbc;
+ NumPinsToConfigure = NUM_PINS_ABC;
+ }
for (Index = 0; Index < NumPinsToConfigure; Index++) {
//Set up Pad configuration for particular pin.
- PadConfiguration = (PadConfigurationTable[Index].MuxMode << MUXMODE_OFFSET);
- PadConfiguration |= (PadConfigurationTable[Index].PullConfig << PULL_CONFIG_OFFSET);
- PadConfiguration |= (PadConfigurationTable[Index].InputEnable << INPUTENABLE_OFFSET);
+ PadConfiguration = (BoardConfiguration[Index].MuxMode << MUXMODE_OFFSET);
+ PadConfiguration |= (BoardConfiguration[Index].PullConfig << PULL_CONFIG_OFFSET);
+ PadConfiguration |= (BoardConfiguration[Index].InputEnable << INPUTENABLE_OFFSET);
//Configure the pin with specific Pad configuration.
- MmioWrite16(PadConfigurationTable[Index].Pin, PadConfiguration);
+ MmioWrite16(BoardConfiguration[Index].Pin, PadConfiguration);
}
}
|