mirror of https://github.com/acidanthera/audk.git
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
This commit is contained in:
parent
95b3580f82
commit
efe5f1a232
|
@ -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
|
||||
|
|
|
@ -18,10 +18,11 @@
|
|||
#include <Library/PcdLib.h>
|
||||
|
||||
#include <Omap3530/Omap3530.h>
|
||||
#include <BeagleBoard.h>
|
||||
|
||||
VOID
|
||||
PadConfiguration (
|
||||
VOID
|
||||
BEAGLEBOARD_REVISION Revision
|
||||
);
|
||||
|
||||
VOID
|
||||
|
@ -29,6 +30,30 @@ ClockInit (
|
|||
VOID
|
||||
);
|
||||
|
||||
/**
|
||||
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
|
||||
|
||||
|
@ -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 ();
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -256,6 +256,12 @@
|
|||
#define ETK_D13 (SYSTEM_CONTROL_MODULE_BASE + 0x5F6)
|
||||
#define ETK_D14 (SYSTEM_CONTROL_MODULE_BASE + 0x5F8)
|
||||
#define ETK_D15 (SYSTEM_CONTROL_MODULE_BASE + 0x5FA)
|
||||
#define SYS_BOOT0 (SYSTEM_CONTROL_MODULE_BASE + 0xA0A)
|
||||
#define SYS_BOOT1 (SYSTEM_CONTROL_MODULE_BASE + 0xA0C)
|
||||
#define SYS_BOOT3 (SYSTEM_CONTROL_MODULE_BASE + 0xA10)
|
||||
#define SYS_BOOT4 (SYSTEM_CONTROL_MODULE_BASE + 0xA12)
|
||||
#define SYS_BOOT5 (SYSTEM_CONTROL_MODULE_BASE + 0xA14)
|
||||
#define SYS_BOOT6 (SYSTEM_CONTROL_MODULE_BASE + 0xA16)
|
||||
|
||||
//Mux modes
|
||||
#define MUXMODE0 (0x0UL)
|
||||
|
|
|
@ -64,7 +64,17 @@
|
|||
#define VAUX2_DEDICATED 0x79
|
||||
#define VAUX2_DEV_GRP 0x76
|
||||
|
||||
#define VAUX_DEV_GRP_NONE 0x00
|
||||
#define VAUX_DEV_GRP_P1 0x20
|
||||
#define VAUX_DEV_GRP_P2 0x40
|
||||
#define VAUX_DEV_GRP_P3 0x80
|
||||
#define VAUX_DEDICATED_18V 0x05
|
||||
|
||||
// Display subsystem
|
||||
#define VPLL2_DEDICATED 0x91
|
||||
#define VPLL2_DEV_GRP 0x8E
|
||||
|
||||
#define GPIODATADIR1 0x9B
|
||||
#define SETGPIODATAOUT1 0xA4
|
||||
|
||||
#endif //__TPS65950_H__
|
||||
|
|
Loading…
Reference in New Issue