From nobody Wed May 15 01:27:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+98501+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+98501+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1673632607; cv=none; d=zohomail.com; s=zohoarc; b=TruNll523DimjtXpE7q/Rv06Nl/hYVvDYhKFnOMnzKBRKSKT6s9PJRjVpAtOyH9fZEAuH8qWWoO0frS16JOrw0JERYGpbmbwGaI1lyyCqIid5LOx/NEEaA4ASr0Jk/HdIFJmV87azs+SeiiCN/kFtUViPbtJvIlozRC9a4L8NKs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673632607; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=isS9FB8FFVIikJ0MM0Z1V4SMoteyYhb9EYar4/cuwog=; b=ENZCAY53DHY00+E49mIhHh13KvcYY7lLsa5suEig3HdXXd+LndVb2aWGk7RX78qzRA0w4R7TE7ObMn45s76Z1MzvJ9KXPYomL6gN22dAyJciz3qAu/CQ+mbPDO4TxMsfzKXzwyumRgFgnIqckQekhJGjwuadz/1Tfm3vYQIRGy4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+98501+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1673632607506877.1435652213039; Fri, 13 Jan 2023 09:56:47 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id aGjHYY1788612xa4w4kRjFEx; Fri, 13 Jan 2023 09:56:47 -0800 X-Received: from mail-vs1-f42.google.com (mail-vs1-f42.google.com [209.85.217.42]) by mx.groups.io with SMTP id smtpd.web10.95195.1673632606490455124 for ; Fri, 13 Jan 2023 09:56:46 -0800 X-Received: by mail-vs1-f42.google.com with SMTP id o63so22956029vsc.10 for ; Fri, 13 Jan 2023 09:56:46 -0800 (PST) X-Gm-Message-State: 44Y15C5LkW5S3P56xyAmceosx1787277AA= X-Google-Smtp-Source: AMrXdXtAV9r4OzcWUouYglknwDvNR3Gg/UD06btFgUdOg9/F8hAMs8suIR+CdzKxsu4hEPB1+q3ZyA== X-Received: by 2002:a05:6102:f07:b0:3d0:cfd6:5d0d with SMTP id v7-20020a0561020f0700b003d0cfd65d0dmr12246762vss.5.1673632605231; Fri, 13 Jan 2023 09:56:45 -0800 (PST) X-Received: from aturtleortwo-benjamindomain.. ([2607:f2c0:e98c:e:b067:d983:eed5:30ec]) by smtp.gmail.com with ESMTPSA id x10-20020a05620a448a00b006faa2c0100bsm13202094qkp.110.2023.01.13.09.56.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Jan 2023 09:56:44 -0800 (PST) From: "Benjamin Doron" To: devel@edk2.groups.io Cc: Sai Chaganty , Isaac Oram , Nate DeSimone , Chasel Chiu Subject: [edk2-devel][edk2-platforms][PATCH v2] KabylakeOpenBoardPkg/I2cHdmiDebugSerialPortLib: Configurable timings Date: Fri, 13 Jan 2023 12:56:17 -0500 Message-Id: <7e10276730e9a60e39dc5f4be06a49c2a11e56a5.1673632431.git.benjamin.doron00@gmail.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,benjamin.doron00@gmail.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1673632607; bh=ce+Y8+WSeJNRPsWKxD2g8wYfhXJUHPlAim7elBonOSk=; h=Cc:Date:From:Reply-To:Subject:To; b=OQpmGT2WyUUMorkA/6sJV2BpGTp5SKd8nsEAyXFi6qOKDnT3QGFJ47f5XDaoO1Lsunz Q90gPuHUATxy7AgSlni+HXccTorUnrJUpX4rcABUHf1ru3rRBec9EIh3dMAx5sY3k2m2j xev9TV6Xv2/BS2Cu/kpq3zOQ3i717/VdYV4= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1673632608578100002 Content-Type: text/plain; charset="utf-8" Now that an implementation of the HDMI debug port is available at high speed, make the timing parameters configurable. As this is implementation, not board dependent, perhaps these could become dynamic PCDs. Arduino sketch available at https://github.com/benjamindoron/i2c_debug_port. Tested on Adafruit ItsyBitsy M4, using 1 MHz clock and 60 us delay. Cc: Sai Chaganty Cc: Isaac Oram Cc: Nate DeSimone Cc: Chasel Chiu Signed-off-by: Benjamin Doron Reviewed-by: Isaac Oram Reviewed-by: Nate DeSimone --- .../DxeI2cHdmiDebugSerialPortLib.inf | 2 ++ .../Library/I2cHdmiDebugSerialPortLib/Gmbus.c | 9 +++++++-- .../I2cDebugPortProtocol.c | 12 +++++++++--- .../PeiI2cHdmiDebugSerialPortLib.inf | 2 ++ .../SecI2cHdmiDebugSerialPortLib.inf | 2 ++ .../SmmI2cHdmiDebugSerialPortLib.inf | 2 ++ .../KabylakeOpenBoardPkg/OpenBoardPkg.dec | 19 +++++++++++++++++++ 7 files changed, 43 insertions(+), 5 deletions(-) diff --git a/Platform/Intel/KabylakeOpenBoardPkg/Library/I2cHdmiDebugSerial= PortLib/DxeI2cHdmiDebugSerialPortLib.inf b/Platform/Intel/KabylakeOpenBoard= Pkg/Library/I2cHdmiDebugSerialPortLib/DxeI2cHdmiDebugSerialPortLib.inf index 736b11a561f0..e8af25161008 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/Library/I2cHdmiDebugSerialPortLib= /DxeI2cHdmiDebugSerialPortLib.inf +++ b/Platform/Intel/KabylakeOpenBoardPkg/Library/I2cHdmiDebugSerialPortLib= /DxeI2cHdmiDebugSerialPortLib.inf @@ -51,3 +51,5 @@ [Pcd] gKabylakeOpenBoardPkgTokenSpaceGuid.PcdI2cHdmiDebugPortDdcI2cChannel = ## CONSUMES gKabylakeOpenBoardPkgTokenSpaceGuid.PcdGttMmAddress = ## CONSUMES + gKabylakeOpenBoardPkgTokenSpaceGuid.PcdI2cHdmiDebugPortGmbusClockRate = ## CONSUMES + gKabylakeOpenBoardPkgTokenSpaceGuid.PcdI2cHdmiDebugPortPacketStallUs = ## CONSUMES diff --git a/Platform/Intel/KabylakeOpenBoardPkg/Library/I2cHdmiDebugSerial= PortLib/Gmbus.c b/Platform/Intel/KabylakeOpenBoardPkg/Library/I2cHdmiDebugS= erialPortLib/Gmbus.c index c6453117843a..31965a1b3a54 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/Library/I2cHdmiDebugSerialPortLib= /Gmbus.c +++ b/Platform/Intel/KabylakeOpenBoardPkg/Library/I2cHdmiDebugSerialPortLib= /Gmbus.c @@ -443,6 +443,7 @@ GmbusRead ( { EFI_STATUS Status; EFI_STATUS Status2; + UINT8 GmbusClockRate; UINT32 Index; UINT32 GmbusCmdSts; UINT32 GmbusStatus; @@ -472,7 +473,8 @@ GmbusRead ( // // Configure Gmbus port and clock speed // - Status =3D GmbusPrepare (GMBUS_CLOCK_RATE_50K, (DdcBusPinPair & B_SA_GTT= MMADR_GMBUS0_PIN_PAIR_MASK)); + GmbusClockRate =3D FixedPcdGet8 (PcdI2cHdmiDebugPortGmbusClockRate); + Status =3D GmbusPrepare (GmbusClockRate, (DdcBusPinPair & B_SA_GTTMMADR_= GMBUS0_PIN_PAIR_MASK)); if (EFI_ERROR (Status)) { goto Done; } @@ -607,6 +609,7 @@ GmbusWrite ( { EFI_STATUS Status; EFI_STATUS Status2; + UINT8 GmbusClockRate; UINT32 Index; UINT32 GmbusCmdSts; UINT32 GmbusStatus; @@ -637,7 +640,9 @@ GmbusWrite ( =20 // // Configure Gmbus port and clock speed - Status =3D GmbusPrepare (GMBUS_CLOCK_RATE_50K, (DdcBusPinPair & B_SA_GTT= MMADR_GMBUS0_PIN_PAIR_MASK)); + // + GmbusClockRate =3D FixedPcdGet8 (PcdI2cHdmiDebugPortGmbusClockRate); + Status =3D GmbusPrepare (GmbusClockRate, (DdcBusPinPair & B_SA_GTTMMADR_= GMBUS0_PIN_PAIR_MASK)); if (EFI_ERROR (Status)) { goto Done; } diff --git a/Platform/Intel/KabylakeOpenBoardPkg/Library/I2cHdmiDebugSerial= PortLib/I2cDebugPortProtocol.c b/Platform/Intel/KabylakeOpenBoardPkg/Librar= y/I2cHdmiDebugSerialPortLib/I2cDebugPortProtocol.c index f76bcf364cd1..d64251b75b4e 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/Library/I2cHdmiDebugSerialPortLib= /I2cDebugPortProtocol.c +++ b/Platform/Intel/KabylakeOpenBoardPkg/Library/I2cHdmiDebugSerialPortLib= /I2cDebugPortProtocol.c @@ -38,6 +38,7 @@ I2cDebugPortWrite ( UINT8 WriteBuffer[I2C_DEBUG_PORT_MAX_DATA_SIZE + 1]; EFI_STATUS Status; UINT32 Index; + UINT32 ImplementationDelayUs; UINT8 CurrentSize; UINT8 DdcBusPinPair; =20 @@ -51,9 +52,10 @@ I2cDebugPortWrite ( if (EFI_ERROR (Status)) { return Status; } + ImplementationDelayUs =3D FixedPcdGet32 (PcdI2cHdmiDebugPortPacketStallU= s); //BP: 3ms stall to catch up RaiseTplForI2cDebugPortAccess (); for (Index =3D 0; Index < Count; Index +=3D I2C_DEBUG_PORT_MAX_DATA_SIZE= ) { - MicroSecondDelay (3000); //3ms stall to let the BusPirate catch up + MicroSecondDelay (ImplementationDelayUs); if ((Index + I2C_DEBUG_PORT_MAX_DATA_SIZE) >=3D Count) { CurrentSize =3D (UINT8) (Count - Index); } else { @@ -95,6 +97,7 @@ I2cDebugPortRead ( EFI_STATUS Status; UINT32 Index; UINT32 BytesRead; + UINT32 ImplementationDelayUs; UINT32 CurrentSize; UINT8 DdcBusPinPair; UINT8 GmbusIndexData; @@ -110,9 +113,10 @@ I2cDebugPortRead ( if (EFI_ERROR (Status)) { return Status; } + ImplementationDelayUs =3D FixedPcdGet32 (PcdI2cHdmiDebugPortPacketStallU= s); //BP: 3ms stall to catch up RaiseTplForI2cDebugPortAccess (); for (Index =3D 0; Index < (*Count); Index +=3D I2C_DEBUG_PORT_MAX_DATA_S= IZE) { - MicroSecondDelay (3000); //3ms stall to let the BusPirate catch up + MicroSecondDelay (ImplementationDelayUs); if ((Index + I2C_DEBUG_PORT_MAX_DATA_SIZE) >=3D (*Count)) { CurrentSize =3D (*Count) - Index; } else { @@ -163,6 +167,7 @@ I2cDebugPortReadyToRead ( EFI_STATUS Status; UINT32 BytesRead; UINT8 DdcBusPinPair; + UINT32 ImplementationDelayUs; UINT8 GmbusIndexData; =20 BytesRead =3D 1; @@ -173,7 +178,8 @@ I2cDebugPortReadyToRead ( if (EFI_ERROR (Status)) { return Status; } - MicroSecondDelay (3000); //3ms stall to let the BusPirate catch up + ImplementationDelayUs =3D FixedPcdGet32 (PcdI2cHdmiDebugPortPacketStallU= s); //BP: 3ms stall to catch up + MicroSecondDelay (ImplementationDelayUs); GmbusIndexData =3D (I2C_DEBUG_PORT_READY_TO_READ_COMMAND << I2C_DEBUG_P= ORT_COMMAND_BIT_POSITION) | (1 & I2C_DEBUG_PORT_DATA_SIZE_BIT_MASK); //READY_TO_RE= AD always returns 1 byte RaiseTplForI2cDebugPortAccess (); diff --git a/Platform/Intel/KabylakeOpenBoardPkg/Library/I2cHdmiDebugSerial= PortLib/PeiI2cHdmiDebugSerialPortLib.inf b/Platform/Intel/KabylakeOpenBoard= Pkg/Library/I2cHdmiDebugSerialPortLib/PeiI2cHdmiDebugSerialPortLib.inf index c82e0c9e9b76..c141521a0cd9 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/Library/I2cHdmiDebugSerialPortLib= /PeiI2cHdmiDebugSerialPortLib.inf +++ b/Platform/Intel/KabylakeOpenBoardPkg/Library/I2cHdmiDebugSerialPortLib= /PeiI2cHdmiDebugSerialPortLib.inf @@ -52,3 +52,5 @@ [Pcd] gKabylakeOpenBoardPkgTokenSpaceGuid.PcdI2cHdmiDebugPortDdcI2cChannel = ## CONSUMES gKabylakeOpenBoardPkgTokenSpaceGuid.PcdGttMmAddress = ## CONSUMES + gKabylakeOpenBoardPkgTokenSpaceGuid.PcdI2cHdmiDebugPortGmbusClockRate = ## CONSUMES + gKabylakeOpenBoardPkgTokenSpaceGuid.PcdI2cHdmiDebugPortPacketStallUs = ## CONSUMES diff --git a/Platform/Intel/KabylakeOpenBoardPkg/Library/I2cHdmiDebugSerial= PortLib/SecI2cHdmiDebugSerialPortLib.inf b/Platform/Intel/KabylakeOpenBoard= Pkg/Library/I2cHdmiDebugSerialPortLib/SecI2cHdmiDebugSerialPortLib.inf index 3b84b25c3148..ed755699c312 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/Library/I2cHdmiDebugSerialPortLib= /SecI2cHdmiDebugSerialPortLib.inf +++ b/Platform/Intel/KabylakeOpenBoardPkg/Library/I2cHdmiDebugSerialPortLib= /SecI2cHdmiDebugSerialPortLib.inf @@ -51,3 +51,5 @@ [Pcd] gKabylakeOpenBoardPkgTokenSpaceGuid.PcdI2cHdmiDebugPortDdcI2cChannel = ## CONSUMES gKabylakeOpenBoardPkgTokenSpaceGuid.PcdGttMmAddress = ## CONSUMES + gKabylakeOpenBoardPkgTokenSpaceGuid.PcdI2cHdmiDebugPortGmbusClockRate = ## CONSUMES + gKabylakeOpenBoardPkgTokenSpaceGuid.PcdI2cHdmiDebugPortPacketStallUs = ## CONSUMES diff --git a/Platform/Intel/KabylakeOpenBoardPkg/Library/I2cHdmiDebugSerial= PortLib/SmmI2cHdmiDebugSerialPortLib.inf b/Platform/Intel/KabylakeOpenBoard= Pkg/Library/I2cHdmiDebugSerialPortLib/SmmI2cHdmiDebugSerialPortLib.inf index 68ff31495071..9f46d45b8a38 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/Library/I2cHdmiDebugSerialPortLib= /SmmI2cHdmiDebugSerialPortLib.inf +++ b/Platform/Intel/KabylakeOpenBoardPkg/Library/I2cHdmiDebugSerialPortLib= /SmmI2cHdmiDebugSerialPortLib.inf @@ -51,3 +51,5 @@ [Pcd] gKabylakeOpenBoardPkgTokenSpaceGuid.PcdI2cHdmiDebugPortDdcI2cChannel = ## CONSUMES gKabylakeOpenBoardPkgTokenSpaceGuid.PcdGttMmAddress = ## CONSUMES + gKabylakeOpenBoardPkgTokenSpaceGuid.PcdI2cHdmiDebugPortGmbusClockRate = ## CONSUMES + gKabylakeOpenBoardPkgTokenSpaceGuid.PcdI2cHdmiDebugPortPacketStallUs = ## CONSUMES diff --git a/Platform/Intel/KabylakeOpenBoardPkg/OpenBoardPkg.dec b/Platfor= m/Intel/KabylakeOpenBoardPkg/OpenBoardPkg.dec index 448eafacbfcd..401f6416aa1c 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/OpenBoardPkg.dec +++ b/Platform/Intel/KabylakeOpenBoardPkg/OpenBoardPkg.dec @@ -102,6 +102,25 @@ gKabylakeOpenBoardPkgTokenSpaceGuid.PcdI2cHdmiDebugPor= tSerialTerminalEnable|FALS # @Prompt DDC I2C channel to claim as the HDMI debug port gKabylakeOpenBoardPkgTokenSpaceGuid.PcdI2cHdmiDebugPortDdcI2cChannel|0x000= 00000|UINT32|0x90000035 =20 +## Specifies the DDC I2C speed to use for the HDMI debug port +# The value is defined as below. +# 0: I2C speed 100K +# 1: I2C speed 50K +# 2: I2C speed 400K +# 3: I2C speed 1M +# Recommendations as below: +# BusPirate: 50K. Increase internal baudrate generator for 100K, maybe 40= 0K. Potentially less stable +# Atmel SAMD boards: 1M +# @Prompt DDC I2C speed to use for the HDMI debug port +gKabylakeOpenBoardPkgTokenSpaceGuid.PcdI2cHdmiDebugPortGmbusClockRate|0x01= |UINT8|0x90000036 + +## Specifies the stall in microsends between packets on the HDMI debug port +# Recommendations as below: +# BusPirate: 3000 +# Atmel SAMD boards: 60 +# @Prompt Stall in microsends between packets on the HDMI debug port +gKabylakeOpenBoardPkgTokenSpaceGuid.PcdI2cHdmiDebugPortPacketStallUs|3000|= UINT32|0x90000037 + [PcdsDynamic] =20 # Board GPIO Table --=20 2.39.0 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#98501): https://edk2.groups.io/g/devel/message/98501 Mute This Topic: https://groups.io/mt/96251636/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-