Skip to content

Commit

Permalink
Platforms: Enable HYM8563 RTC support
Browse files Browse the repository at this point in the history
Enabled on all platforms, except for:
 - Radxa ROCK 5A: I2C location unknown yet
 - Mixtile Blade 3: no RTC present

Not tested on Hinlink and FriendlyElec devices.
  • Loading branch information
mariobalanica committed Aug 3, 2023
1 parent 9ec4c35 commit 51f33c1
Show file tree
Hide file tree
Showing 21 changed files with 180 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@
FLASH_DEFINITION = Silicon/Rockchip/RK3588/RK3588.fdf
RK_PLATFORM_FVMAIN_MODULES = $(PLATFORM_DIRECTORY)/$(PLATFORM_NAME).Modules.fdf.inc

#
# HYM8563 RTC support
# I2C location configured by PCDs below.
#
DEFINE RK_RTC8563_ENABLE = TRUE

#
# RK3588S-based platform
#
Expand Down Expand Up @@ -55,11 +61,13 @@
gRockchipTokenSpaceGuid.PcdProductUrl|"https://indiedroid.us"

# I2C
gRockchipTokenSpaceGuid.PcdI2cSlaveAddresses|{ 0x42, 0x43 }
gRockchipTokenSpaceGuid.PcdI2cSlaveBuses|{ 0x0, 0x0 }
gRockchipTokenSpaceGuid.PcdI2cSlaveAddresses|{ 0x42, 0x43, 0x51 }
gRockchipTokenSpaceGuid.PcdI2cSlaveBuses|{ 0x0, 0x0, 0x6 }
gRockchipTokenSpaceGuid.PcdRk860xRegulatorAddresses|{ 0x42, 0x43 }
gRockchipTokenSpaceGuid.PcdRk860xRegulatorBuses|{ 0x0, 0x0 }
gRockchipTokenSpaceGuid.PcdRk860xRegulatorTags|{ SCMI_CLK_CPUB01, SCMI_CLK_CPUB23 }
gPcf8563RealTimeClockLibTokenSpaceGuid.PcdI2cSlaveAddress|0x51
gRockchipTokenSpaceGuid.PcdRtc8563Bus|0x6

#
# CPU Performance default values
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,11 @@ I2cIomux (
break;
case 5:
break;
case 6:
/* io mux M3 */
BUS_IOC->GPIO4B_IOMUX_SEL_L = (0x00F0UL << 16) | 0x0090;
BUS_IOC->GPIO4B_IOMUX_SEL_L = (0x000FUL << 16) | 0x0009;
break;
default:
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@
FLASH_DEFINITION = Silicon/Rockchip/RK3588/RK3588.fdf
RK_PLATFORM_FVMAIN_MODULES = Platform/Firefly/ROC-RK3588S-PC/ROC-RK3588S-PC.Modules.fdf.inc

#
# HYM8563 RTC support
# I2C location configured by PCDs below.
#
DEFINE RK_RTC8563_ENABLE = TRUE

#
# RK3588S-based platform
#
Expand All @@ -42,11 +48,13 @@
gRockchipTokenSpaceGuid.PcdBoardVendorName|"Firefly"

# I2C
gRockchipTokenSpaceGuid.PcdI2cSlaveAddresses|{ 0x42, 0x43 }
gRockchipTokenSpaceGuid.PcdI2cSlaveBuses|{ 0x0, 0x0 }
gRockchipTokenSpaceGuid.PcdI2cSlaveAddresses|{ 0x42, 0x43, 0x51 }
gRockchipTokenSpaceGuid.PcdI2cSlaveBuses|{ 0x0, 0x0, 0x2 }
gRockchipTokenSpaceGuid.PcdRk860xRegulatorAddresses|{ 0x42, 0x43 }
gRockchipTokenSpaceGuid.PcdRk860xRegulatorBuses|{ 0x0, 0x0 }
gRockchipTokenSpaceGuid.PcdRk860xRegulatorTags|{ SCMI_CLK_CPUB01, SCMI_CLK_CPUB23 }
gPcf8563RealTimeClockLibTokenSpaceGuid.PcdI2cSlaveAddress|0x51
gRockchipTokenSpaceGuid.PcdRtc8563Bus|0x2

#
# CPU Performance default values
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,13 @@ I2cIomux (
break;
case 5:
break;
case 6:
/* io mux M0 */
BUS_IOC->GPIO0C_IOMUX_SEL_H = (0xF000UL << 16) | 0x9000;
BUS_IOC->GPIO0D_IOMUX_SEL_L = (0x000FUL << 16) | 0x0009;
PMU2_IOC->GPIO0C_IOMUX_SEL_H = (0xF000UL << 16) | 0x8000;
PMU2_IOC->GPIO0D_IOMUX_SEL_L = (0x000FUL << 16) | 0x0008;
break;
default:
break;
}
Expand Down
12 changes: 10 additions & 2 deletions edk2-rockchip/Platform/FriendlyElec/NanoPC-T6/NanoPC-T6.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@
FLASH_DEFINITION = Silicon/Rockchip/RK3588/RK3588.fdf
RK_PLATFORM_FVMAIN_MODULES = $(PLATFORM_DIRECTORY)/$(PLATFORM_NAME).Modules.fdf.inc

#
# HYM8563 RTC support
# I2C location configured by PCDs below.
#
DEFINE RK_RTC8563_ENABLE = TRUE

#
# RK3588-based platform
#
Expand Down Expand Up @@ -56,11 +62,13 @@
gRockchipTokenSpaceGuid.PcdProductUrl|"https://wiki.friendlyelec.com/wiki/index.php/NanoPC-T6"

# I2C
gRockchipTokenSpaceGuid.PcdI2cSlaveAddresses|{ 0x42, 0x43 }
gRockchipTokenSpaceGuid.PcdI2cSlaveBuses|{ 0x0, 0x0 }
gRockchipTokenSpaceGuid.PcdI2cSlaveAddresses|{ 0x42, 0x43, 0x51 }
gRockchipTokenSpaceGuid.PcdI2cSlaveBuses|{ 0x0, 0x0, 0x6 }
gRockchipTokenSpaceGuid.PcdRk860xRegulatorAddresses|{ 0x42, 0x43 }
gRockchipTokenSpaceGuid.PcdRk860xRegulatorBuses|{ 0x0, 0x0 }
gRockchipTokenSpaceGuid.PcdRk860xRegulatorTags|{ SCMI_CLK_CPUB01, SCMI_CLK_CPUB23 }
gPcf8563RealTimeClockLibTokenSpaceGuid.PcdI2cSlaveAddress|0x51
gRockchipTokenSpaceGuid.PcdRtc8563Bus|0x6

#
# CPU Performance default values
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,13 @@ I2cIomux (
break;
case 5:
break;
case 6:
/* io mux M0 */
BUS_IOC->GPIO0C_IOMUX_SEL_H = (0xF000UL << 16) | 0x9000;
BUS_IOC->GPIO0D_IOMUX_SEL_L = (0x000FUL << 16) | 0x0009;
PMU2_IOC->GPIO0C_IOMUX_SEL_H = (0xF000UL << 16) | 0x8000;
PMU2_IOC->GPIO0D_IOMUX_SEL_L = (0x000FUL << 16) | 0x0008;
break;
default:
break;
}
Expand Down
12 changes: 10 additions & 2 deletions edk2-rockchip/Platform/FriendlyElec/NanoPi-R6C/NanoPi-R6C.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@
FLASH_DEFINITION = Silicon/Rockchip/RK3588/RK3588.fdf
RK_PLATFORM_FVMAIN_MODULES = $(PLATFORM_DIRECTORY)/$(PLATFORM_NAME).Modules.fdf.inc

#
# HYM8563 RTC support
# I2C location configured by PCDs below.
#
DEFINE RK_RTC8563_ENABLE = TRUE

#
# RK3588S-based platform
#
Expand Down Expand Up @@ -57,11 +63,13 @@
gRockchipTokenSpaceGuid.PcdProductUrl|"https://wiki.friendlyelec.com/wiki/index.php/NanoPi_R6"

# I2C
gRockchipTokenSpaceGuid.PcdI2cSlaveAddresses|{ 0x42, 0x43 }
gRockchipTokenSpaceGuid.PcdI2cSlaveBuses|{ 0x0, 0x0 }
gRockchipTokenSpaceGuid.PcdI2cSlaveAddresses|{ 0x42, 0x43, 0x51 }
gRockchipTokenSpaceGuid.PcdI2cSlaveBuses|{ 0x0, 0x0, 0x6 }
gRockchipTokenSpaceGuid.PcdRk860xRegulatorAddresses|{ 0x42, 0x43 }
gRockchipTokenSpaceGuid.PcdRk860xRegulatorBuses|{ 0x0, 0x0 }
gRockchipTokenSpaceGuid.PcdRk860xRegulatorTags|{ SCMI_CLK_CPUB01, SCMI_CLK_CPUB23 }
gPcf8563RealTimeClockLibTokenSpaceGuid.PcdI2cSlaveAddress|0x51
gRockchipTokenSpaceGuid.PcdRtc8563Bus|0x6

#
# CPU Performance default values
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,13 @@ I2cIomux (
break;
case 5:
break;
case 6:
/* io mux M0 */
BUS_IOC->GPIO0C_IOMUX_SEL_H = (0xF000UL << 16) | 0x9000;
BUS_IOC->GPIO0D_IOMUX_SEL_L = (0x000FUL << 16) | 0x0009;
PMU2_IOC->GPIO0C_IOMUX_SEL_H = (0xF000UL << 16) | 0x8000;
PMU2_IOC->GPIO0D_IOMUX_SEL_L = (0x000FUL << 16) | 0x0008;
break;
default:
break;
}
Expand All @@ -192,7 +199,7 @@ UsbPortPowerEnable (
)
{
DEBUG((EFI_D_WARN, "UsbPortPowerEnable called\n"));

/* Set GPIO4 PB5 (USB_HOST_PWREN) output high to power USB ports */
GpioPinSetDirection (4, GPIO_PIN_PB5, GPIO_PIN_OUTPUT);
GpioPinWrite (4, GPIO_PIN_PB5, TRUE);
Expand Down Expand Up @@ -225,7 +232,7 @@ UsbDpPhyEnable (
/* enable rx_lfps_en & usbdp_low_pwrn */
MmioWrite32(0xfd5c8004, 0x60006000);
MmioWrite32(0xfd5cc004, 0x60006000);

/* remove rx-termination, we don't support SS yet */
MmioWrite32 (0xfd5c800c, 0x00030001);
MmioWrite32 (0xfd5cc00c, 0x00030001);
Expand Down
12 changes: 10 additions & 2 deletions edk2-rockchip/Platform/FriendlyElec/NanoPi-R6S/NanoPi-R6S.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@
FLASH_DEFINITION = Silicon/Rockchip/RK3588/RK3588.fdf
RK_PLATFORM_FVMAIN_MODULES = $(PLATFORM_DIRECTORY)/$(PLATFORM_NAME).Modules.fdf.inc

#
# HYM8563 RTC support
# I2C location configured by PCDs below.
#
DEFINE RK_RTC8563_ENABLE = TRUE

#
# RK3588S-based platform
#
Expand Down Expand Up @@ -56,11 +62,13 @@
gRockchipTokenSpaceGuid.PcdProductUrl|"https://wiki.friendlyelec.com/wiki/index.php/NanoPi_R6S"

# I2C
gRockchipTokenSpaceGuid.PcdI2cSlaveAddresses|{ 0x42, 0x43 }
gRockchipTokenSpaceGuid.PcdI2cSlaveBuses|{ 0x0, 0x0 }
gRockchipTokenSpaceGuid.PcdI2cSlaveAddresses|{ 0x42, 0x43, 0x51 }
gRockchipTokenSpaceGuid.PcdI2cSlaveBuses|{ 0x0, 0x0, 0x6 }
gRockchipTokenSpaceGuid.PcdRk860xRegulatorAddresses|{ 0x42, 0x43 }
gRockchipTokenSpaceGuid.PcdRk860xRegulatorBuses|{ 0x0, 0x0 }
gRockchipTokenSpaceGuid.PcdRk860xRegulatorTags|{ SCMI_CLK_CPUB01, SCMI_CLK_CPUB23 }
gPcf8563RealTimeClockLibTokenSpaceGuid.PcdI2cSlaveAddress|0x51
gRockchipTokenSpaceGuid.PcdRtc8563Bus|0x6

#
# CPU Performance default values
Expand Down
12 changes: 10 additions & 2 deletions edk2-rockchip/Platform/Hinlink/H88K/H88K.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@
FLASH_DEFINITION = Silicon/Rockchip/RK3588/RK3588.fdf
RK_PLATFORM_FVMAIN_MODULES = $(PLATFORM_DIRECTORY)/$(PLATFORM_NAME).Modules.fdf.inc

#
# HYM8563 RTC support
# I2C location configured by PCDs below.
#
DEFINE RK_RTC8563_ENABLE = TRUE

#
# RK3588-based platform
#
Expand Down Expand Up @@ -56,11 +62,13 @@
gRockchipTokenSpaceGuid.PcdProductUrl|"http://www.hinlink.com/"

# I2C
gRockchipTokenSpaceGuid.PcdI2cSlaveAddresses|{ 0x42, 0x43 }
gRockchipTokenSpaceGuid.PcdI2cSlaveBuses|{ 0x0, 0x0 }
gRockchipTokenSpaceGuid.PcdI2cSlaveAddresses|{ 0x42, 0x43, 0x51 }
gRockchipTokenSpaceGuid.PcdI2cSlaveBuses|{ 0x0, 0x0, 0x2 }
gRockchipTokenSpaceGuid.PcdRk860xRegulatorAddresses|{ 0x42, 0x43 }
gRockchipTokenSpaceGuid.PcdRk860xRegulatorBuses|{ 0x0, 0x0 }
gRockchipTokenSpaceGuid.PcdRk860xRegulatorTags|{ SCMI_CLK_CPUB01, SCMI_CLK_CPUB23 }
gPcf8563RealTimeClockLibTokenSpaceGuid.PcdI2cSlaveAddress|0x51
gRockchipTokenSpaceGuid.PcdRtc8563Bus|0x2

#
# CPU Performance default values
Expand Down
12 changes: 10 additions & 2 deletions edk2-rockchip/Platform/Khadas/Edge2/Edge2.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@
FLASH_DEFINITION = Silicon/Rockchip/RK3588/RK3588.fdf
RK_PLATFORM_FVMAIN_MODULES = $(PLATFORM_DIRECTORY)/$(PLATFORM_NAME).Modules.fdf.inc

#
# HYM8563 RTC support
# I2C location configured by PCDs below.
#
DEFINE RK_RTC8563_ENABLE = TRUE

#
# RK3588S-based platform
#
Expand Down Expand Up @@ -55,11 +61,13 @@
gRockchipTokenSpaceGuid.PcdProductUrl|"https://www.khadas.com/edge2"

# I2C
gRockchipTokenSpaceGuid.PcdI2cSlaveAddresses|{ 0x42, 0x43 }
gRockchipTokenSpaceGuid.PcdI2cSlaveBuses|{ 0x0, 0x0 }
gRockchipTokenSpaceGuid.PcdI2cSlaveAddresses|{ 0x42, 0x43, 0x51 }
gRockchipTokenSpaceGuid.PcdI2cSlaveBuses|{ 0x0, 0x0, 0x2 }
gRockchipTokenSpaceGuid.PcdRk860xRegulatorAddresses|{ 0x42, 0x43 }
gRockchipTokenSpaceGuid.PcdRk860xRegulatorBuses|{ 0x0, 0x0 }
gRockchipTokenSpaceGuid.PcdRk860xRegulatorTags|{ SCMI_CLK_CPUB01, SCMI_CLK_CPUB23 }
gPcf8563RealTimeClockLibTokenSpaceGuid.PcdI2cSlaveAddress|0x51
gRockchipTokenSpaceGuid.PcdRtc8563Bus|0x2

#
# CPU Performance default values
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,13 @@ I2cIomux (
break;
case 5:
break;
case 6:
/* io mux M0 */
BUS_IOC->GPIO0C_IOMUX_SEL_H = (0xF000UL << 16) | 0x9000;
BUS_IOC->GPIO0D_IOMUX_SEL_L = (0x000FUL << 16) | 0x0009;
PMU2_IOC->GPIO0C_IOMUX_SEL_H = (0xF000UL << 16) | 0x8000;
PMU2_IOC->GPIO0D_IOMUX_SEL_L = (0x000FUL << 16) | 0x0008;
break;
default:
break;
}
Expand Down
12 changes: 10 additions & 2 deletions edk2-rockchip/Platform/Mekotronics/R58-Mini/R58-Mini.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@
# This board lacks an SD card slot.
DEFINE RK_SD_ENABLE = FALSE

#
# HYM8563 RTC support
# I2C location configured by PCDs below.
#
DEFINE RK_RTC8563_ENABLE = TRUE

#
# RK3588-based platform
#
Expand Down Expand Up @@ -59,11 +65,13 @@
gRockchipTokenSpaceGuid.PcdBoardName|"MINI-PC-RK3588-4D32-V1.0"

# I2C
gRockchipTokenSpaceGuid.PcdI2cSlaveAddresses|{ 0x42, 0x43 }
gRockchipTokenSpaceGuid.PcdI2cSlaveBuses|{ 0x0, 0x0 }
gRockchipTokenSpaceGuid.PcdI2cSlaveAddresses|{ 0x42, 0x43, 0x51 }
gRockchipTokenSpaceGuid.PcdI2cSlaveBuses|{ 0x0, 0x0, 0x6 }
gRockchipTokenSpaceGuid.PcdRk860xRegulatorAddresses|{ 0x42, 0x43 }
gRockchipTokenSpaceGuid.PcdRk860xRegulatorBuses|{ 0x0, 0x0 }
gRockchipTokenSpaceGuid.PcdRk860xRegulatorTags|{ SCMI_CLK_CPUB01, SCMI_CLK_CPUB23 }
gPcf8563RealTimeClockLibTokenSpaceGuid.PcdI2cSlaveAddress|0x51
gRockchipTokenSpaceGuid.PcdRtc8563Bus|0x6

#
# CPU Performance default values
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,12 @@ I2cIomux (
break;
case 5:
break;
case 6:
/* io mux M0 */
BUS_IOC->GPIO0C_IOMUX_SEL_H = (0xF000UL << 16) | 0x9000;
BUS_IOC->GPIO0D_IOMUX_SEL_L = (0x000FUL << 16) | 0x0009;
PMU2_IOC->GPIO0C_IOMUX_SEL_H = (0xF000UL << 16) | 0x8000;
PMU2_IOC->GPIO0D_IOMUX_SEL_L = (0x000FUL << 16) | 0x0008;
default:
break;
}
Expand Down
12 changes: 10 additions & 2 deletions edk2-rockchip/Platform/Mekotronics/R58X/R58X.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@
FLASH_DEFINITION = Silicon/Rockchip/RK3588/RK3588.fdf
RK_PLATFORM_FVMAIN_MODULES = $(PLATFORM_DIRECTORY)/$(PLATFORM_NAME).Modules.fdf.inc

#
# HYM8563 RTC support
# I2C location configured by PCDs below.
#
DEFINE RK_RTC8563_ENABLE = TRUE

#
# RK3588-based platform
#
Expand Down Expand Up @@ -56,11 +62,13 @@
gRockchipTokenSpaceGuid.PcdBoardName|"EDGE-RK3588-4D32-V1.2"

# I2C
gRockchipTokenSpaceGuid.PcdI2cSlaveAddresses|{ 0x42, 0x43 }
gRockchipTokenSpaceGuid.PcdI2cSlaveBuses|{ 0x0, 0x0 }
gRockchipTokenSpaceGuid.PcdI2cSlaveAddresses|{ 0x42, 0x43, 0x51 }
gRockchipTokenSpaceGuid.PcdI2cSlaveBuses|{ 0x0, 0x0, 0x6 }
gRockchipTokenSpaceGuid.PcdRk860xRegulatorAddresses|{ 0x42, 0x43 }
gRockchipTokenSpaceGuid.PcdRk860xRegulatorBuses|{ 0x0, 0x0 }
gRockchipTokenSpaceGuid.PcdRk860xRegulatorTags|{ SCMI_CLK_CPUB01, SCMI_CLK_CPUB23 }
gPcf8563RealTimeClockLibTokenSpaceGuid.PcdI2cSlaveAddress|0x51
gRockchipTokenSpaceGuid.PcdRtc8563Bus|0x6

#
# CPU Performance default values
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,11 @@ I2cIomux (
break;
case 5:
break;
case 6:
/* io mux M3 */
BUS_IOC->GPIO4B_IOMUX_SEL_L = (0x00F0UL << 16) | 0x0090;
BUS_IOC->GPIO4B_IOMUX_SEL_L = (0x000FUL << 16) | 0x0009;
break;
default:
break;
}
Expand Down
Loading

0 comments on commit 51f33c1

Please sign in to comment.