From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR02-HE1-obe.outbound.protection.outlook.com (EUR02-HE1-obe.outbound.protection.outlook.com [40.107.1.83]) by mx.groups.io with SMTP id smtpd.web10.5810.1586153939577827666 for ; Sun, 05 Apr 2020 23:19:00 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@nxp1.onmicrosoft.com header.s=selector2-nxp1-onmicrosoft-com header.b=KgsRxooR; spf=pass (domain: oss.nxp.com, ip: 40.107.1.83, mailfrom: pankaj.bansal@oss.nxp.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dV7wMMuOjJaRDgetq/L3r6I+NPxnYDtOQMGT+I+W2/WCocNpFq9qoxtZumP8j+8IyPkLEsZeFPxlp45FmfPLhawJTQ9kSvEbaBmWNRBsGi2o+lPN2EsmJRJCUswHPFEPnRQV1LVHcwdbQ5DExTg197mbOWgPI88szZYJ0smVY4WnYBAQ1aC8KzRhNzN8JDkc3vgsu57fonoOrdvmrsjY7/y9bfnzdpAxWwJNucma1cv4MWT0XqZIV/lel1NZLcbmv3Y42XLcjI+fxpgra71CDg4CQEkJvyI1KweUWOjBtUOsfSqJrutFRIebuW8X2l+d1Lyc7n/nJAJn7T/PAN7tIA== 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=yAeok0nYvYAO5aWGXUOcphDxwTL87GkYpsmlE3mDZJk=; b=g9yYMGkfBoGYFrc11GtiPfGC9DlE9jVvtPeTa7CgIS1NjKKgaI06OM4E17GrDi4HSQFc1SqdBC7XacwGqmOxFD5fpiGRCrIUtuqtyOTckAR3NL1frm9Wb0Pwegg4IPdk6fnASgOZheQOtjVQezxe3Mj2T6eq1YX1S3P5uvTB4l25AUxYi+RkzX57LF75I+Avl8RfIP2LtU+ACmBe/duVzlPp++2FY4xi+xopoFzr+0LllrDjrAPqz+PJREMKashXY9475425Xk3IffvVXdf+yZgSQ6ijIzEkZUR5Hcew5Tjl4MwaFsi5DKGMwKwCXNB4tgdEpJxcuuivgVvsm6tX9A== 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=yAeok0nYvYAO5aWGXUOcphDxwTL87GkYpsmlE3mDZJk=; b=KgsRxooRXkGcOC/DrTakjktU+euyUNqK+M3+cJmc/UsWCw/Vyj+hEU3TkuZUX4vSvGRWvtHz+B5Zskm2bRdo15qRRvNDNOkrOWU7/vP7057kehuYjmBiM4CIzecl/vo7t/KlDVGYRSy6Eo4JwWif4bzzp7ni/vnuSYCwGa7vFuw= Received: from VI1PR04MB5933.eurprd04.prod.outlook.com (2603:10a6:803:ec::16) by VI1SPR01MB0339.eurprd04.prod.outlook.com (2603:10a6:802:69::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2878.16; Mon, 6 Apr 2020 06:18:56 +0000 Received: from VI1PR04MB5933.eurprd04.prod.outlook.com ([fe80::e581:c145:2f3c:fa18]) by VI1PR04MB5933.eurprd04.prod.outlook.com ([fe80::e581:c145:2f3c:fa18%6]) with mapi id 15.20.2878.018; Mon, 6 Apr 2020 06:18:56 +0000 From: "Pankaj Bansal" To: Leif Lindholm , "Pankaj Bansal (OSS)" CC: Meenakshi Aggarwal , Michael D Kinney , "devel@edk2.groups.io" , Varun Sethi , Samer El-Haj-Mahmoud , Jon Nettleton Subject: Re: [PATCH v2 04/28] Silicon/Maxim: Fix bug in RtcWrite in Ds1307RtcLib Thread-Topic: [PATCH v2 04/28] Silicon/Maxim: Fix bug in RtcWrite in Ds1307RtcLib Thread-Index: AQHWC9tAci1Bu4hRBkyBTCudu6ymFw== Date: Mon, 6 Apr 2020 06:18:56 +0000 Message-ID: References: <20200320143543.18615-1-pankaj.bansal@oss.nxp.com> <20200320143543.18615-5-pankaj.bansal@oss.nxp.com> <20200331123058.GF7468@vanye> In-Reply-To: <20200331123058.GF7468@vanye> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=pankaj.bansal@oss.nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [49.36.135.41] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: eb0139a6-7f24-443b-29e7-08d7d9f26324 x-ms-traffictypediagnostic: VI1SPR01MB0339:|VI1SPR01MB0339: x-ms-exchange-sharedmailbox-routingagent-processed: True x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-forefront-prvs: 0365C0E14B 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:(10009020)(4636009)(136003)(396003)(39860400002)(366004)(346002)(376002)(81156014)(8676002)(76116006)(26005)(81166006)(110136005)(186003)(33656002)(54906003)(316002)(4326008)(71200400001)(478600001)(66946007)(7696005)(64756008)(66476007)(5660300002)(86362001)(8936002)(9686003)(66556008)(6506007)(55016002)(19627235002)(966005)(2906002)(53546011)(52536014)(66446008);DIR:OUT;SFP:1101; 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: mfav1QLKCmeG+U0niAMzWONwi/kFKB8GGQkhhgWK9IIJzPPbdIfBnfRNHaaMWBaKglawEJnGq4Cwv1y1k4woZBu6AEF4yDlDmUJHrVCg2+Hml9uefljcmhTOBIFA6H1TQFWJqZmwk1kOtXe4JJ8Ixi/864k010/u6p0FlkxsnhBzkIR+2DvpsYaLVNl6uJk3vi5w+TJaJPrRJJheGSSggROzOkSAlwUHTTvhfi/W3N99jP9kw9gTjqP5sCQIZG8ToqwX53tGfRA13dbYhlPxBulAlxedQ7Xomfb8ssacKMF+15PQkeiqc8OpcOekDWPbMyTHP2DEs7pTQ8+aJRCcTSXcS9+YhKrr/c6HovSP58e29GaQ6VFniEcBkmpELiSovyD9DtL4dBerbtdjnIa8beCcJzgJqOKgRKN6pJclN3RaBke21pVuL2eQhXWlyafmJcTRP7/TegG2sAlkOPxr7MjndsTz8Ub3RCBQQSwQWYsqPyrCVkcqg2TLqi6f/EWibRKlMcLWEaKawOjduqqIWQ== x-ms-exchange-antispam-messagedata: GbbqxrtT9naeQBNlviyHrHlexSSJDTYlfW6Jej0jNEcuKGkJCFQbqevCgkSwXLk3ngGJ2EC9lJywT7W5y3QFMgVB3Tk0/E01MTEADeZibJs7VuSwOXQW2RtWiDjZmsmDszAISoUFhFRip+uvu2XEeQ== MIME-Version: 1.0 X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: eb0139a6-7f24-443b-29e7-08d7d9f26324 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Apr 2020 06:18:56.3572 (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: Jjc6iPP1YnjCQ1TIr5y3QlR8XoZf0xXo7lPVJAgV+w5u/R5hu+ywJ0gEO5IGguVqpwfkd41QR0HQeTYAqKdlHg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1SPR01MB0339 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable > -----Original Message----- > From: Leif Lindholm > Sent: Tuesday, March 31, 2020 6:01 PM > To: Pankaj Bansal (OSS) > Cc: Meenakshi Aggarwal ; Michael D Kinney > ; devel@edk2.groups.io; Varun Sethi > ; Samer El-Haj-Mahmoud Mahmoud@arm.com>; Jon Nettleton > Subject: Re: [PATCH v2 04/28] Silicon/Maxim: Fix bug in RtcWrite in > Ds1307RtcLib >=20 > On Fri, Mar 20, 2020 at 20:05:19 +0530, Pankaj Bansal wrote: > > 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 singl= e > > 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 >=20 > So, I'm OK with this patch, but I'll mention that I prefer the design > in Silicon/NXP/Library/Pcf8563RealTimeClockLib which I think could > also be applied here. I think that might have avoided the confusion > that caused the bug. Actually this bug was introduced because the Pcf2129 RTC driver was written Based on I2cDxe driver, which assumed that all I2c transaction would be (re= g, data) Pair, i.e. always two operations.=20 >=20 > Reviewed-by: Leif Lindholm >=20 > > --- > > 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/Maxim/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 > > > > Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
> > - Copyright 2017 NXP > > + Copyright 2017, 2020 NXP > > > > SPDX-License-Identifier: BSD-2-Clause-Patent > > > > @@ -84,16 +84,15 @@ RtcWrite ( > > { > > RTC_I2C_REQUEST Req; > > EFI_STATUS Status; > > + UINT8 Buffer[2]; > > > > - Req.OperationCount =3D 2; > > + Req.OperationCount =3D 1; > > + Buffer[0] =3D RtcRegAddr; > > + Buffer[1] =3D Val; > > > > 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; > > > > Status =3D mI2cMaster->StartRequest (mI2cMaster, FixedPcdGet8 > (PcdI2cSlaveAddress), > > (VOID *)&Req, > > -- > > 2.17.1 > >