From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (EUR05-VI1-obe.outbound.protection.outlook.com [40.107.21.79]) by mx.groups.io with SMTP id smtpd.web12.2012.1588225875013867149 for ; Wed, 29 Apr 2020 22:51:15 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@nxp1.onmicrosoft.com header.s=selector2-nxp1-onmicrosoft-com header.b=itX8I/69; spf=pass (domain: oss.nxp.com, ip: 40.107.21.79, mailfrom: pankaj.bansal@oss.nxp.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=koOVHASGaL3AecAFFibF1oLDQZMer1Oe6luNcHpF8zEYjM+8w9oZNzEnA9zIXKzJ1KSSjkt8QK8K1V903CEq6VWnzln/WZGgCERqtVnvVvwk8e8+NlaGzQTPSA62gTSGlBkbqfiS0VZ1HkhHaPQRXawZICwEZ5C4VPCXtHPtC58/RTbhSsLb/29TuPw1EkaAesr82CF17lWf98fB6fJbXA46C2W2zqObnbBStLP4Efk7nxcJRi38ZUv3l6b1at6ByPFom6OEi08kwY2QZbQsWJ294x6hikn4KyToIBRZ7hgkK5fKFDGTPBsM+KYp/9bLH+d4rWAefgUh3f2MRvI2ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=i2gSuLarAVsxJCfYlgfFJEdKZrcsxL9T+YcrRZNqBqE=; b=ZFAJd0DRNv33WEjxOU3q5ceFG6ysgikp8NldKiLc6ulK5/ib9c+gVviSFKiy6/zTTTZSMzlW1PkJCh29guOvHU25uc+H9lEmEjLO3Ud05MWbT4Jp4onUvafo2FwtSlSPthaGyLqOoH/qM5C0HlKf95qt2iXI2YnYBBug6ldAgsCq4VBAgqN44OY7H/ZZMN5uJ40PyWjPQhpJR4P5BXEFYhm7ip42LbYAdu2Rdi57VIpzpgZbxlEcFyoADVS42h56vz38bJZUx3E4nreBElyPMBAb1jLnw2UGcTALeWFQhK0MMTu2MnsDfu+hM9VleB5B+DvYPzTsd3K5oLdWzRPrWg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=i2gSuLarAVsxJCfYlgfFJEdKZrcsxL9T+YcrRZNqBqE=; b=itX8I/69TNDYiLPzQcJV/b/QRK5mRIsUu67K2rpzY6ylBSp3teYtqxOQq2QIpJ0OesZ4yjdmWQcW6bPeWzgv4KJ5TWcls/Tf7u1WvSi2umE6UkVLiVEDm4mFR86aso+y/FZfz0VyprdGXDfJLyYFCLt6FVqo7Amld/fB8QtF2lM= Authentication-Results: nuviainc.com; dkim=none (message not signed) header.d=none;nuviainc.com; dmarc=none action=none header.from=oss.nxp.com; Received: from VI1PR04MB5933.eurprd04.prod.outlook.com (2603:10a6:803:ec::16) by VI1PR04MB4429.eurprd04.prod.outlook.com (2603:10a6:803:6e::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2937.13; Thu, 30 Apr 2020 05:51:12 +0000 Received: from VI1PR04MB5933.eurprd04.prod.outlook.com ([fe80::45c4:8846:5327:9513]) by VI1PR04MB5933.eurprd04.prod.outlook.com ([fe80::45c4:8846:5327:9513%7]) with mapi id 15.20.2958.020; Thu, 30 Apr 2020 05:51:12 +0000 From: "Pankaj Bansal" To: Leif Lindholm , Meenakshi Aggarwal , Michael D Kinney , devel@edk2.groups.io, Varun Sethi , Samer El-Haj-Mahmoud , Jon Nettleton , Ard Biesheuvel Subject: [PATCH edk2-platforms v4 04/24] Silicon/Maxim: Fix bug in RtcWrite in Ds1307RtcLib Date: Fri, 1 May 2020 11:19:35 +0530 Message-ID: <20200501054955.13025-5-pankaj.bansal@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200501054955.13025-1-pankaj.bansal@oss.nxp.com> References: <20200501054955.13025-1-pankaj.bansal@oss.nxp.com> X-ClientProxiedBy: SG2PR03CA0131.apcprd03.prod.outlook.com (2603:1096:4:91::35) To VI1PR04MB5933.eurprd04.prod.outlook.com (2603:10a6:803:ec::16) Return-Path: pankaj.bansal@oss.nxp.com MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from uefi-workstation.ap.freescale.net (92.120.0.69) by SG2PR03CA0131.apcprd03.prod.outlook.com (2603:1096:4:91::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.14 via Frontend Transport; Thu, 30 Apr 2020 05:51:10 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [92.120.0.69] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: deb12e33-16b3-4cb2-09ca-08d7ecca7d28 X-MS-TrafficTypeDiagnostic: VI1PR04MB4429:|VI1PR04MB4429: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4303; X-Forefront-PRVS: 0389EDA07F X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5933.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(4636009)(136003)(376002)(39860400002)(346002)(366004)(396003)(6512007)(26005)(16526019)(5660300002)(6666004)(966005)(478600001)(186003)(2906002)(110136005)(52116002)(6486002)(316002)(8676002)(6506007)(66476007)(19627235002)(86362001)(2616005)(66946007)(44832011)(956004)(66556008)(1076003)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1xPfoBd7jfTpDxda2biyqYvHmvfKq9XtjN8DqmjEBABH6XPHttDw8NOZnEjOZE2bb70MLHbNY6iJ7VVra/LA2BvTxZySh5vJhj5pD0dIjjtM8MftH0EsNH4mDYLMZ5VWPNlP/xkgQkf1+B+AMHRHryp3btWHrI6YATtDwh2DE4pzc3UEmsVx1mi3HIy9H+9hssB+C7rR6pqXhBe+6D5axNahND6T6gsCKY8kkHMlr0wDaLkKtAOoo/v34ZU1QuHi+dL/OfEGazFg+hqwxhwpajTRtHTA13NaWOEmv7Pz5kgRYJI2PGIp0H/aKX4tPlgImJ05wCrZGyT3S2BnXcYSvFtYdf4WndjnFLEd1H2wRnQNAYqnE/64nB4P5Ka4XK9Y2cy3MB7nGWbX8VxiQUYadcRvXSk6buT7UWPmlhysV3uheJ3nxommlH37rm2rpvV8bRcpGqyB73WtxtSxDk0gKwIV0KwJa2mr1nOlJVtfI1GBBi17HZqOPk3ZqJ25hXju5C1o3eTV/Ytdtvn/w41Yvg== X-MS-Exchange-AntiSpam-MessageData: UVwmL9SJg1qBJ4YHCNydIP0EFcd1DZD5kx2YudFqupcig6x54Oxc+sxX8aNPvKJgxk73G4p+NCfms8fqEInfDHpbWZ8pvbuB97xakic3499SRYQXAdLoPuK9h3CHlLtJy/VtHs0iFQHt9utbFdVlOQSqo4Rd3gDbC+DqlUUziuUXHvd9HUCtR4aoDRP5IZA7CT1iv9A0Q2hfqPcoGgPOmv+OKXGxdGNxrqpaZNZ3enlb/gzdOpNS0THLJk1ANaVNCYZa0/mva8W2KKah0PFh2tmF23NxNlS0nHoKPvDApo05N8VGozH66B52vvBF08TMOHg4Kupf4LaKs9Utuar9tbWZ72SNn2jNTMtVKurLqad3X1L/YyfiSg37FuMcq26WpFAxNLRfD3s8q/is45yciQDItsKGQgyFCb9SATknXel6LwjuJTdQCgjTk3b2P5Zw7S+qutRrU7QvyXfz4C38JYdazymDbt9d/kUTf8hm0J/yuO/LjHs6ApLo5bPDXYQEOJ+HFiBhkQX6BhirMw33jW2Lu8b+W3IYhrlFhqwuCWMXrBesna6E3oKLjzlDTnHOO0tZ4eDoqjBq8vkKrfokk9rtxGGf7w45F6v+qKg0TEZ/UBemcN+enJpNF4OgAAuED1jNcOXkGWotSgz5BdnFJhGvjKshKtX+Zil0G1vSEdR6rhVx8p8ypX5dujpbHkgsIYS7LPMmpq5To9tjmj9FPatbc892//uaClEyMZWHHG+e2p+dNGUBmXyigGIQalUpi8nIOA4IYRwmz3pamhYAfInWgrGKmsRExXsW7HNvUpY= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: deb12e33-16b3-4cb2-09ca-08d7ecca7d28 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Apr 2020 05:51:12.5678 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: D0BuEh1BysgkUgex896UxTuJbfNyyz2uFq18bCTj170sebx0NS/LF8S/3uHHu0DHlpIPsL6yFq404h6CiUXPOQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4429 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain From: Pankaj Bansal There was a bug in I2C DXE implementation, which caused the Ds1307 RTC device to issue two operation for register write, while this is a single operation task. refer page 12 (Slave Receiver Mode (Write Mode)) on https://datasheets.maximintegrated.com/en/ds/DS1307.pdf Modify ds1307 RtcWrite code accordingly. Signed-off-by: Pankaj Bansal Reviewed-by: Leif Lindholm --- Notes: V4: - No change =20 V3: - No change Silicon/Maxim/Library/Ds1307RtcLib/Ds1307RtcLib.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/Silicon/Maxim/Library/Ds1307RtcLib/Ds1307RtcLib.c b/Silicon/Ma= xim/Library/Ds1307RtcLib/Ds1307RtcLib.c index 88dc198ffec8..fd7a8696e405 100644 --- a/Silicon/Maxim/Library/Ds1307RtcLib/Ds1307RtcLib.c +++ b/Silicon/Maxim/Library/Ds1307RtcLib/Ds1307RtcLib.c @@ -5,7 +5,7 @@ EmbeddedPkg/Library/TemplateRealTimeClockLib/RealTimeClockLib.c =20 Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
- Copyright 2017 NXP + Copyright 2017, 2020 NXP =20 SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -84,16 +84,15 @@ RtcWrite ( { RTC_I2C_REQUEST Req; EFI_STATUS Status; + UINT8 Buffer[2]; =20 - Req.OperationCount =3D 2; + Req.OperationCount =3D 1; + Buffer[0] =3D RtcRegAddr; + Buffer[1] =3D Val; =20 Req.SetAddressOp.Flags =3D 0; - Req.SetAddressOp.LengthInBytes =3D sizeof (RtcRegAddr); - Req.SetAddressOp.Buffer =3D &RtcRegAddr; - - Req.GetSetDateTimeOp.Flags =3D 0; - Req.GetSetDateTimeOp.LengthInBytes =3D sizeof (Val); - Req.GetSetDateTimeOp.Buffer =3D &Val; + Req.SetAddressOp.LengthInBytes =3D sizeof (Buffer); + Req.SetAddressOp.Buffer =3D Buffer; =20 Status =3D mI2cMaster->StartRequest (mI2cMaster, FixedPcdGet8 (PcdI2cSla= veAddress), (VOID *)&Req, --=20 2.17.1