Skip to content

Commit

Permalink
Ampere: Add full set of I2C buses to Ac01.h
Browse files Browse the repository at this point in the history
Boards based on the Altra SoC from vendors such as ADLINK are
configured differently and require access to I2C buses not
listed in Ac01.h. Fix this by expanding AC01_I2C_BASE_ADDRESS_LIST to
contain the full set of buses available.

Since this changes the indexing of the buses, update the Mt Jade files
to match. Add a new PCD to contain the bus number of the RTC since this
is different between Mt Jade and ADLINK's COM-HPC-ALT platform.

Signed-off-by: Rebecca Cran <[email protected]>
  • Loading branch information
Rebecca Cran committed Sep 30, 2024
1 parent 5ea9660 commit 69a2a39
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@
//
// CPU I2C Bus for IO Expander
//
#define S0_RISER_I2C_BUS 0x02
#define S0_OCP_I2C_BUS 0x02
#define S1_RISER_I2C_BUS 0x03
#define S0_RISER_I2C_BUS 0x06
#define S0_OCP_I2C_BUS 0x06
#define S1_RISER_I2C_BUS 0x0F

//
// I2C address of IO Expander devices
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@
#include <Uefi.h>

#include <Library/BaseLib.h>
#include <Library/PcdLib.h>
#include <Library/RealTimeClockLib.h>

//
// I2C bus address that RTC connected to
//
#define I2C_RTC_BUS_ADDRESS 1
#define I2C_RTC_BUS_ADDRESS (FixedPcdGet8 (PcdRtcBusAddress))

//
// I2C RTC bus speed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
GpioLib
DxeServicesTableLib
I2cLib
PcdLib
TimeBaseLib
TimerLib
UefiLib
Expand All @@ -44,3 +45,6 @@

[Guids]
gEfiEventVirtualAddressChangeGuid

[Pcd]
gAmpereTokenSpaceGuid.PcdRtcBusAddress
21 changes: 19 additions & 2 deletions Silicon/Ampere/AmpereAltraPkg/Include/Platform/Ac01.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,29 @@
//
// The maximum number of I2C bus
//
#define AC01_I2C_MAX_BUS_NUM 4
#define AC01_I2C_MAX_BUS_NUM 18

//
// The base address of DW I2C
//
#define AC01_I2C_BASE_ADDRESS_LIST 0x1000026B0000ULL, 0x100002750000ULL, 0x100002770000ULL, 0x500002770000ULL
#define AC01_I2C_BASE_ADDRESS_LIST 0x100002690000, /* Socket 0 IIC 2 */ \
0x1000026A0000, /* IIC 3 */ \
0x1000026B0000, /* IIC 4 */ \
0x1000026C0000, /* IIC 5 */ \
0x100002750000, /* IIC 6 */ \
0x100002760000, /* IIC 7 */ \
0x100002770000, /* IIC 8 */ \
0x100002780000, /* IIC 9 */ \
0x100002790000, /* IIC 10 */ \
0x500002690000, /* Socket 1 IIC 2 */ \
0x5000026A0000, /* IIC 3 */ \
0x5000026B0000, /* IIC 4 */ \
0x5000026C0000, /* IIC 5 */ \
0x500002750000, /* IIC 6 */ \
0x500002760000, /* IIC 7 */ \
0x500002770000, /* IIC 8 */ \
0x500002780000, /* IIC 9 */ \
0x500002790000 /* IIC 10 */

//
// The Array of Soc Gpio Base Address
Expand Down
7 changes: 6 additions & 1 deletion Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@
#
gAmpereTokenSpaceGuid.PcdPlatformConfigUuid|"C416535D-970B-41B9-859A-3CAF0FAF198C"|VOID*|0x00000010

#
# RTC
#
gAmpereTokenSpaceGuid.PcdRtcBusAddress|0x4|UINT8|0x00000011

#
# SMpro PMpro Pcds
#
Expand All @@ -78,7 +83,7 @@
#
# I2C PCDs for SMBUS
#
gAmpereTokenSpaceGuid.PcdSmbusI2cBusNumber|0x00|UINT8|0x00000007
gAmpereTokenSpaceGuid.PcdSmbusI2cBusNumber|0x02|UINT8|0x00000007
gAmpereTokenSpaceGuid.PcdSmbusI2cBusSpeed|100000|UINT32|0x00000008 # Hz

#
Expand Down

0 comments on commit 69a2a39

Please sign in to comment.