From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=104.47.2.69; helo=eur01-db5-obe.outbound.protection.outlook.com; envelope-from=meenakshi.aggarwal@nxp.com; receiver=edk2-devel@lists.01.org Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0069.outbound.protection.outlook.com [104.47.2.69]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 410BB21EBD1AA for ; Thu, 19 Apr 2018 20:20:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=nLn14cwDBspYCUtJgEklXKVeYJVZNDxFfdDA6HfjPG4=; b=ZbgrBfZni3adnW8fInYfnnECFn9Tqoq+rHX2RkYnkAnKEqpCS4d18Oyvfv9kzYqT3hPU/6tagSoSPpgCsGe/SdeImcqtKkB9RESIM3DhaEP1quwJLXCdhpcBlayo/vDlWAspVaMC7NR3Q3J2lgOHMnvHp+glC9W8zgSSU+DogiM= Received: from DB5PR04MB0998.eurprd04.prod.outlook.com (10.161.199.12) by DB5PR04MB1030.eurprd04.prod.outlook.com (10.161.199.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.675.15; Fri, 20 Apr 2018 03:20:28 +0000 Received: from DB5PR04MB0998.eurprd04.prod.outlook.com ([fe80::18ce:390:67ab:40af]) by DB5PR04MB0998.eurprd04.prod.outlook.com ([fe80::18ce:390:67ab:40af%15]) with mapi id 15.20.0696.011; Fri, 20 Apr 2018 03:20:28 +0000 From: Meenakshi Aggarwal To: Leif Lindholm CC: "ard.biesheuvel@linaro.org" , "edk2-devel@lists.01.org" , Udit Kumar , Varun Sethi , Vabhav Sharma Thread-Topic: [PATCH edk2-platforms 19/39] Silicon/NXP:Add support for PCF2129 Real Time Clock Library Thread-Index: AQHT18bdIGQBfHfcgEKKRtqHPkENNKQIBK7QgAAVm4CAAOMowA== Date: Fri, 20 Apr 2018 03:20:28 +0000 Message-ID: References: <1518771035-6733-1-git-send-email-meenakshi.aggarwal@nxp.com> <1518771035-6733-20-git-send-email-meenakshi.aggarwal@nxp.com> <20180419101156.6biaqkoduoczfjgp@bivouac.eciton.net> <20180419134713.75awm3muksmko57t@bivouac.eciton.net> In-Reply-To: <20180419134713.75awm3muksmko57t@bivouac.eciton.net> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: linaro.org; dkim=none (message not signed) header.d=none;linaro.org; dmarc=none action=none header.from=nxp.com; x-originating-ip: [14.142.187.166] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB5PR04MB1030; 7:+rYcBOvbLHPknfLht+ElS6tchlxyk+Q5n9jNFpjJrX/uWzh0q+0luoEfZF6N9FBTJDiB5rtsXzgpjyd9xlxLf/J1fEUJhWErQcfkUWFIqktBNIe+nMewlwsdo6YVnWahe8GmUUc0mNpYgkkCjKOr/0AhZvrU9eBxDB+JUCPMAHI+yZHqsipA8/x6kESn0Ct6LsoRjhTdEDQkBDX7E/sC5FOuc/quEj3Tk498QdiQJ3WQbLi3rYu2Bf1J5kUtKP7G x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(48565401081)(2017052603328)(7153060)(7193020); SRVR:DB5PR04MB1030; x-ms-traffictypediagnostic: DB5PR04MB1030: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(185117386973197)(162533806227266); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3231232)(944501389)(52105095)(3002001)(6055026)(6041310)(20161123558120)(20161123560045)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:DB5PR04MB1030; BCL:0; PCL:0; RULEID:; SRVR:DB5PR04MB1030; x-forefront-prvs: 0648FCFFA8 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(346002)(366004)(396003)(376002)(39380400002)(39860400002)(13464003)(76176011)(478600001)(54906003)(3660700001)(2906002)(93886005)(5660300001)(2900100001)(6116002)(74316002)(25786009)(5250100002)(316002)(66066001)(3280700002)(186003)(446003)(8936002)(305945005)(4326008)(55016002)(6916009)(6436002)(8676002)(6246003)(3846002)(55236004)(81166006)(53546011)(26005)(53936002)(59450400001)(7736002)(102836004)(33656002)(6506007)(9686003)(44832011)(476003)(7696005)(86362001)(229853002)(11346002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB5PR04MB1030; H:DB5PR04MB0998.eurprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; MLV:sfv; x-microsoft-antispam-message-info: 8Z7mamUThMK3VGU2SXreGLyYU6/TkoDJzFmrzjyIEVaIQioU8sUu+9kKDJsfcAtLAdIpcNhMcrq/7bWtzBPtjcYArqoVOMgXInCqIz0ngzJDJyCoKvaTAL0yC+ZLAOcmIZUas2/BXYYmKnJBroYQc+uEI+eBfY7lnvUpFBndJkt+vmHvp4wlWx+14hWQo3BF spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 3461c196-29c7-4344-ef83-08d5a66daa76 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3461c196-29c7-4344-ef83-08d5a66daa76 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Apr 2018 03:20:28.3266 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5PR04MB1030 Subject: Re: [PATCH edk2-platforms 19/39] Silicon/NXP:Add support for PCF2129 Real Time Clock Library X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Apr 2018 03:20:33 -0000 Content-Language: en-US Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable > -----Original Message----- > From: Leif Lindholm [mailto:leif.lindholm@linaro.org] > Sent: Thursday, April 19, 2018 7:17 PM > To: Meenakshi Aggarwal > Cc: ard.biesheuvel@linaro.org; edk2-devel@lists.01.org; Udit Kumar > ; Varun Sethi ; Vabhav Sharma > > Subject: Re: [PATCH edk2-platforms 19/39] Silicon/NXP:Add support for > PCF2129 Real Time Clock Library >=20 > On Thu, Apr 19, 2018 at 12:33:50PM +0000, Meenakshi Aggarwal wrote: > > > > +EFI_STATUS > > > > +EFIAPI > > > > +LibSetTime ( > > > > + IN EFI_TIME *Time > > > > + ) > > > > +{ > > > > + UINT8 Buffer[8]; > > > > + UINT8 Index; > > > > + EFI_STATUS Status; > > > > + RTC_I2C_REQUEST Req; > > > > + UINT8 RtcRegAddr; > > > > + > > > > + Index =3D 0; > > > > + Status =3D EFI_SUCCESS; > > > > + RtcRegAddr =3D PCF2129_CTRL1_REG_ADDR; > > > > + > > > > + if (mI2cMaster =3D=3D NULL) { > > > > + return EFI_DEVICE_ERROR; > > > > + } > > > > + > > > > + // start register address > > > > + Buffer[Index++] =3D PCF2129_SEC_REG_ADDR; > > > > + > > > > + // hours, minutes and seconds > > > > + Buffer[Index++] =3D DecimalToBcd8 (Time->Second); > > > > + Buffer[Index++] =3D DecimalToBcd8 (Time->Minute); > > > > + Buffer[Index++] =3D DecimalToBcd8 (Time->Hour); > > > > + Buffer[Index++] =3D DecimalToBcd8 (Time->Day); > > > > + Buffer[Index++] =3D EfiTimeToWday (Time) & 0x07; > > > > > > Why mask at the call site? > > > > > In GetTime function, data is been read from RTC device so we need to > > mask the unnecessary bits > > [as described in RTC registers] while > > In SetTime, we are receiving the appropriate buffer so no need to > > mask the data. >=20 > But EfiTimeToWday returns an integer in the range 0-6: > return (EpochDays + 4) % 7; >=20 > Anding the result of that with 0x7 has no effect. >=20 I will check this. > / > Leif