From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (EUR04-DB3-obe.outbound.protection.outlook.com [40.107.6.64]) by mx.groups.io with SMTP id smtpd.web10.13796.1584628595591962402 for ; Thu, 19 Mar 2020 07:36:36 -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=BSfPF4Up; spf=pass (domain: oss.nxp.com, ip: 40.107.6.64, mailfrom: pankaj.bansal@oss.nxp.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QH97jcNDuzDLpak4hyj/MvEoLRUd32+sM/wJNBDIM3wJE7F9k34+dHmh+BjVgKWC5NSZ1QB58KUIm4fGbaUe0wCjqRUCA6LuOmKYGyclxXzRdCjzZ78orOlKnoboatMQ0BqYYbluojHeMNCgTeYdkDUFG+eowp8q5iVqWclyI8jjebxH8xjLt3d/NXwjkirHNWghkWhwP1wsnuEDoU2hFEv0MoYdt9Nff2uf8zQTT4WWYRncPOZjGUr740VmimX/hapJQb7sJO8uQx0B+P0zh0Hdei/V43kF7hcWGhC/UmQc09p2It04S68U4zQJLlC2dZY72w7ZaWd4m758LpITEA== 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=Z68xBsiKR0C56j4ppye6nSKvaIhP868mhuKnZ1cpo9w=; b=ZAWAXrMG77hU5hnGKmkRydyP6zWBfOdLM6j0+tk4frlW+29CWqo+AFmRo3UmRDtYZI8j36vEtuiMWlC2pH3nlu5H+qexvLtT62ZFKq6yDbXDPXC7/jF/n/pxvh4Lsjn74g6S1A9+Cfin9/Ba4KUjIfP3juiPOVpykda99Ak2cGDX3tJ8B9lCefI848Eyy2KKaWo854qMbGL3SQyjDUcH0ynnJlomqQZT0TQJAcb9tWSOWyTREyRfdrPG6p8EqhluL84uRvR68rvg/cabyI+427zT4Fi9Y4PmwoFNRIJqN8kIvPuQJsHvGBORT5uxyoEU3+8K0COTShSzpt3grcUrQA== 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=Z68xBsiKR0C56j4ppye6nSKvaIhP868mhuKnZ1cpo9w=; b=BSfPF4UpBWScJ01m31J1YJbYgSgFkGvJVVCB17hgEX+Mffhmnq53SaRo5kVQVugAY7yDGzdChvgza8LV/cN7gEftKDGZBqa+S0GL7qWduBoEfbdzBM30TgmAbwQMTCbjq3DY4q1slKFe+z0qXtcN2MY0zMdbqnQZBbfsAmyvmfk= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=pankaj.bansal@oss.nxp.com; Received: from VI1PR0401MB2496.eurprd04.prod.outlook.com (10.168.65.10) by VI1PR0401MB2382.eurprd04.prod.outlook.com (10.169.130.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2814.21; Thu, 19 Mar 2020 14:36:33 +0000 Received: from VI1PR0401MB2496.eurprd04.prod.outlook.com ([fe80::196a:28a9:bb9:2fae]) by VI1PR0401MB2496.eurprd04.prod.outlook.com ([fe80::196a:28a9:bb9:2fae%9]) with mapi id 15.20.2835.017; Thu, 19 Mar 2020 14:36:33 +0000 From: Pankaj Bansal To: Leif Lindholm , Meenakshi Aggarwal , Michael D Kinney , devel@edk2.groups.io, Varun Sethi , Samer El-Haj-Mahmoud , Jon Nettleton Subject: [PATCH v2 04/28] Silicon/Maxim: Fix bug in RtcWrite in Ds1307RtcLib Date: Fri, 20 Mar 2020 20:05:19 +0530 Message-ID: <20200320143543.18615-5-pankaj.bansal@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200320143543.18615-1-pankaj.bansal@oss.nxp.com> References: <20200320143543.18615-1-pankaj.bansal@oss.nxp.com> X-ClientProxiedBy: SG2PR02CA0042.apcprd02.prod.outlook.com (2603:1096:3:18::30) To VI1PR0401MB2496.eurprd04.prod.outlook.com (2603:10a6:800:56::10) 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 SG2PR02CA0042.apcprd02.prod.outlook.com (2603:1096:3:18::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2835.19 via Frontend Transport; Thu, 19 Mar 2020 14:36:30 +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: 95d4a031-4bfd-46c8-26ec-08d7cc12eb9d X-MS-TrafficTypeDiagnostic: VI1PR0401MB2382:|VI1PR0401MB2382: 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: 0347410860 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4636009)(376002)(396003)(346002)(136003)(366004)(39860400002)(199004)(6666004)(316002)(186003)(16526019)(6506007)(8676002)(81166006)(81156014)(478600001)(86362001)(966005)(44832011)(19627235002)(26005)(8936002)(6486002)(5660300002)(52116002)(6512007)(956004)(66946007)(110136005)(66476007)(2616005)(2906002)(66556008)(1076003);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR0401MB2382;H:VI1PR0401MB2496.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:0; Received-SPF: None (protection.outlook.com: oss.nxp.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mxmMRjSVWVPOWSrFJOBykKzW1ioMIhCbwvB4mkiKbA7M+imEKRiz9g7JwK9PZg+6WHM3VEj34QaK235IpVreniQ8STwD9cc7YRM3hsWwHbMdVMKBjms6UZK1U6tOW0ti1LBW2JK73EHpaxkWVtSEb6vNLLMPZtqfXWmgEbiUVyQ869oN0bvVNuXVf5nkOMBXKiv8EYZ6497Hjg4Jvbi6diLCRQGBBVTyHJkJ5YscjHeBsfNZCumMjgFfmn6IeMVPCu89OP0I4fByxg3EL3KLT9+GeI8X7Srgz5dZjhNAykz5+ONj8pp/FNmXeAhST2F5HHiATXXxEf6PEE6yEyPMaqRgJPAXgaryZkWqIjQQ+XnZcc9mEWDCmf1SU5c58Yo57q69vLg9HeL9tuXbYJPlrBmi8zu4AQ0jC3Ml0fz7BGP8SGr3HzNWjK6CTw4z6ZcN5YfI0z5RfEp+u5SkP5zVz1fyd2CVsARTKVKMreeSvLX/gUhNaH8L89U14nV8ZlubgZNHbv0EbM+v4Gl27q11aA== X-MS-Exchange-AntiSpam-MessageData: nllaFviqrJIzFaFaL6/n6GlboTP74Z3GjzLKLLuSRUqIv5zqsGDHHIsk2P2a2IJZ5aemJk/VHoNJzl4OtuHyvyI++lCeU3suFpjfUMp7yQtgcR/64Z3cBOhJqN4dtGAWovAfFhnXc6b4d8seQXKPIA== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 95d4a031-4bfd-46c8-26ec-08d7cc12eb9d X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Mar 2020 14:36:33.4195 (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: m3hZqjNm0ds0Jydl8AyZP7SZjrIY2/MP6my6JcgkG5kXQl66hSLWIkz12VuQKatNTxYv8cid9eTMn9eS8/QZtg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0401MB2382 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 --- 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