From 22d22a4338ab7c1a71d96f73ad414733c0044d25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20B=C4=83l=C4=83nic=C4=83?= Date: Sun, 31 Dec 2023 03:34:41 +0200 Subject: [PATCH] Silicon/RK3588: Add _DSM for setting GMAC RGMII speed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mario Bălănică --- .../Rockchip/RK3588/AcpiTables/Gmac0.asl | 47 +++++++++++++++++++ .../Rockchip/RK3588/AcpiTables/Gmac1.asl | 47 +++++++++++++++++++ 2 files changed, 94 insertions(+) diff --git a/edk2-rockchip/Silicon/Rockchip/RK3588/AcpiTables/Gmac0.asl b/edk2-rockchip/Silicon/Rockchip/RK3588/AcpiTables/Gmac0.asl index b73dc9df8..a800b7ea0 100644 --- a/edk2-rockchip/Silicon/Rockchip/RK3588/AcpiTables/Gmac0.asl +++ b/edk2-rockchip/Silicon/Rockchip/RK3588/AcpiTables/Gmac0.asl @@ -46,4 +46,51 @@ Device (MAC0) { Package () { "snps,blen", Package () { 0, 0, 0, 0, 16, 8, 4 } }, } }) + + Method (_DSM, 4, Serialized) { + // PHP_GRF_CLK_CON1 + OperationRegion (PGRF, SystemMemory, 0xfd5b0070, 0x4) + Field (PGRF, DWordAcc, NoLock, Preserve) { + CON1, 32 + } + + // Check the UUID + If (Arg0 == ToUUID ("d637828d-556c-4829-966a-237072f00ff1")) { + // Check the revision + If (Arg1 >= 0) { + // Check the function index + Switch (ToInteger (Arg2)) { + // + // Supported functions: + // Bit 0 - Indicates support for functions other than 0 + // Bit 1 - Indicates support for setting the MII speed + // + Case (0) { + Return (Buffer () { 0x03 }) + } + + // + // Function Index 1: Set MII speed + // + Case (1) { + Local0 = DerefOf (Arg3[0]) + + Switch (ToInteger (Local0)) { + Case (1000) { + CON1 = 0x000c0000 + } + Case (100) { + CON1 = 0x000c000c + } + Case (10) { + CON1 = 0x000c0008 + } + } + Return (Buffer () { 0x00 }) + } + } // Function index check + } // Revision check + } // UUID check + Return (Buffer () { 0x0 }) + } // _DSM } diff --git a/edk2-rockchip/Silicon/Rockchip/RK3588/AcpiTables/Gmac1.asl b/edk2-rockchip/Silicon/Rockchip/RK3588/AcpiTables/Gmac1.asl index cbd13b620..314c4bb9e 100644 --- a/edk2-rockchip/Silicon/Rockchip/RK3588/AcpiTables/Gmac1.asl +++ b/edk2-rockchip/Silicon/Rockchip/RK3588/AcpiTables/Gmac1.asl @@ -46,4 +46,51 @@ Device (MAC1) { Package () { "snps,blen", Package () { 0, 0, 0, 0, 16, 8, 4 } }, } }) + + Method (_DSM, 4, Serialized) { + // PHP_GRF_CLK_CON1 + OperationRegion (PGRF, SystemMemory, 0xfd5b0070, 0x4) + Field (PGRF, DWordAcc, NoLock, Preserve) { + CON1, 32 + } + + // Check the UUID + If (Arg0 == ToUUID ("d637828d-556c-4829-966a-237072f00ff1")) { + // Check the revision + If (Arg1 >= 0) { + // Check the function index + Switch (ToInteger (Arg2)) { + // + // Supported functions: + // Bit 0 - Indicates support for functions other than 0 + // Bit 1 - Indicates support for setting the MII speed + // + Case (0) { + Return (Buffer () { 0x03 }) + } + + // + // Function Index 1: Set MII speed + // + Case (1) { + Local0 = DerefOf (Arg3[0]) + + Switch (ToInteger (Local0)) { + Case (1000) { + CON1 = 0x01800000 + } + Case (100) { + CON1 = 0x01800180 + } + Case (10) { + CON1 = 0x01800100 + } + } + Return (Buffer () { 0x00 }) + } + } // Function index check + } // Revision check + } // UUID check + Return (Buffer () { 0x0 }) + } // _DSM }