From patchwork Thu Dec 14 15:24:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Min Li X-Patchwork-Id: 13493193 X-Patchwork-Delegate: kuba@kernel.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=hotmail.com header.i=@hotmail.com header.b="dGcFUNhl" Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11olkn2069.outbound.protection.outlook.com [40.92.19.69]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B52E3120; Thu, 14 Dec 2023 07:24:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WVZ5ptb0vgAVW9rH8JCjYPC42QX8Z/huA6galMCzojaVnVGKsiMflfaZbyeMAdsC7vlk+JiIG60e8mNtIdRefy02SCGB9FuKyInSxXT+ZDv4ujdqlCumVPz/uWE4PWiJNJ/Le5zpCtK9xdCFxVE5OXmJsqpCI4TLTmpMzYiv6aVg0G/MYHi4CIeee98a8rQzPSjoCF9TFDRuCVe+cbCh75LhThQlxk3uCOEHOuOOaDlP9RJ2ijVzs/FUvZVikM6uX8E5c2hThRCqm5g0E80DMczMSpme0osJvO93rh6n2mVuvPu0q97930FvtfD1Dt1K+9XFNQGJYBm4v9/ZZ81OZQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=xGPPzyxW99d6Lw7ezMhtXHhJX44cjofP8jGdKVcHmig=; b=d/7OUK6WGIgPHsSPYBfErfQcg3DzYTnHl0r19MJ7bCmKHX41M0bUeK+OGz7H9bOzOjWtf9Ua9QO9dZrg2EDlyf/kCZsjfBg+c1QW1I3l1iP1CqfnvcaG/rFKeAc7fbEe8CbEvVog7jmXcTJAUZFdUn+CBf2e6WEkVyy1itrZArqnhso5MDx/zocuhtEDsedBnJKb9WA2elRl0seecup1LwlhXEX0ShCb/AlbSbeioEF3U3DdUu1QJ9Bx4yecQoYWr5MrbpeX+4vFHUzkpPVNMsk7SKzoBGwBl5yoxTcAgt70qdf0ClEZVX8NolJS4S/XunRjuezmo007X9Hg2V1gFQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xGPPzyxW99d6Lw7ezMhtXHhJX44cjofP8jGdKVcHmig=; b=dGcFUNhlg2b7lGK1OqAwa3H4l2WuC0PQHP3IwlelOwuJrG/mlARS4JvejfdSpO0vkZschYNdFjxUxvehqZTdSCilDkzyYB2kXWmQVGy5uj81MnDypBo3ZCqNlB99vfJePn7P+tPvRIsP2QlfZE3RFVZSwok9UZsooU7i/ilznZvJ1kVT3Iq6rzqt5bKWiPzb/ue+MvOkJKFhfMbKLx97NbTEruKgeZwjnNyZloSQhY+W2rSSQqnVg53WE8h3U8fXjWDxEaMuePJ8Gi/yL40I5euebZtnNm7n/8CQYre6h4Hfkq02p8p3n906BHZcAeQPnY6ytwHhQR7y0u6PuaDhKQ== Received: from PH7PR03MB7064.namprd03.prod.outlook.com (2603:10b6:510:2a5::8) by PH0PR03MB6252.namprd03.prod.outlook.com (2603:10b6:510:e6::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7091.28; Thu, 14 Dec 2023 15:24:32 +0000 Received: from PH7PR03MB7064.namprd03.prod.outlook.com ([fe80::9ca4:4c22:a89:9a8]) by PH7PR03MB7064.namprd03.prod.outlook.com ([fe80::9ca4:4c22:a89:9a8%7]) with mapi id 15.20.7091.028; Thu, 14 Dec 2023 15:24:31 +0000 From: Min Li To: richardcochran@gmail.com, lee@kernel.org Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Min Li Subject: [PATCH net-next v7 2/5] ptp: clockmatrix: set write phase timer to 0 when not in PCW mode Date: Thu, 14 Dec 2023 10:24:12 -0500 Message-ID: X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231214152415.14785-1-lnimi@hotmail.com> References: <20231214152415.14785-1-lnimi@hotmail.com> X-TMN: [69T+CHlrNl+YEp8KEKym5TOkrPhuoAuo/+kJee/6yJc=] X-ClientProxiedBy: YQBPR01CA0054.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c01:2::26) To PH7PR03MB7064.namprd03.prod.outlook.com (2603:10b6:510:2a5::8) X-Microsoft-Original-Message-ID: <20231214152415.14785-2-lnimi@hotmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH7PR03MB7064:EE_|PH0PR03MB6252:EE_ X-MS-Office365-Filtering-Correlation-Id: 7b2c54c6-4d97-42a0-f04a-08dbfcb8c4fd X-MS-Exchange-SLBlob-MailProps: Cq7lScuPrnrf5XTkHvzLuPL047Guub836M0TKV9kS/HQspHgRwjaoz8Wvjo7seIKeHa9dAQc1pj3EtirVilnplIAIQGdMYPOrGB8QlTnL1pQ1U4N0Z3GoRzl7D1NJWtMK6GaO0tMEQeDrNl/TaplW/dRLwzlHuwlFCL94OLc9rIUez+2eQ5geZHNeDObwMxAdbFNAPwBRNGSyeana6EIlBPuv18H3vVSw9YtgVBas23lkFBPeDpYub1yH8OTbvhy4+hvFwfUvveqB5udgBcaegSU9PpshDJ58mveVq5zORbOtAR2utQJGRfKBnZouZU0q3l/L3GhA4G6Hw6JM/OiNAHSweygfs3dulXbkymCfbzmIzKqBrMAr5lE4R5bAdm7ZhxA/uA0qwn4yePuclh378gZC9C27JE/PDpsbPOm6QR5N5ZlershfokDm2m5L2CRhAPG6frck7EqbyB26ElJRNaOBl9WnbzJPW6wopgkJMRvMpwiezPShwgorwwlVVZl9P8tZCfgUL2WpKPv5S5C8YnsUJcK2EQ+3TlBzy7rBablmREKMlpY3H8RmTyKCERtGpBsys3yOVtm1TAPdbUyY6/wii263dn8r8/ZPg5Yf3zlNDEkzKAgMClhrBhMtfvP7+uZHHJLf8LuF4fSyrvBmVoAMvsHCqo9c4ikrOMmjghNyY8fFxQ2Ty+2ORain0EUh3HuhKV54kLRaLArn8bamolOxujWTTI21+QHP1g14pB2CRmAo/nf97DNjDDnjYGis3YZZYy9qIc= X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: I6eKG3nh024IINtMtA9542ysBSQZjr8Ye75Se98nut/YjwC4KwXp1TiDXPCr3cUXk65MHz3Rfrvv4Ds9KFIoJt3O/W/kBIQvaDfpQoCG+5OJ7tlom0L3y7VGldEwo+Ad0PyCPV4XTsXxo9T8DFVV90ucuarV4YhTLJvoh65z4KwdKcuIuhJBhT9vS6hhWNFynDFO2oId0UHskEwxeukZml73w+YkWDeeF14MurTlJWMxQA60+1yFl4bjtgBAkeozLkMxlBaZPmdcdcIa/92Y7dg3YR/zvefWS0tAjyP4U9QG7wTVSIEPftbWZ1tB8fZULf8FZy5rIaBYVLp7edem8v53D8v2vtwl8SfUloz1Sbec6k0vyJisawHte9iKCruvC5qEPYR+pb8L1/mzX2fKL3BMHb98IOL+FFgFoCegPKCcx9Ct/gJTx9QsAbibQ8W11q0OIa1luvTEgss7VmLyJGJMTHZwV4L8ngmVUGl8ORypDXp0dD0gnZN+HUQkfSCKfM/89+tp+kMUVFWGQGh2Ft6sBsVp5m9GkI8e07c6nnq8iJ3+jpX/QvRGs3W+iMoR X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: cQHtbTyTUWhQlvVFHiilPVCEu2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6qsyDNa1aAfFDivZqJu5sraLzQrG5JGj/2I0OmHyjG4q+WOkTeCwidlGPoxX7ADIxOzSl1RJuVmEz36y/6hgeQ6wOEOVhZPJ9mFgwUnk6TqGpUDXuWYW6ajHGRiiHfB91qQYsfg== X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-839f4.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: 7b2c54c6-4d97-42a0-f04a-08dbfcb8c4fd X-MS-Exchange-CrossTenant-AuthSource: PH7PR03MB7064.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Dec 2023 15:24:31.9037 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR03MB6252 X-Patchwork-Delegate: kuba@kernel.org From: Min Li In order for phase pull-in to work, write phase timer shall be 0 when not in write phase mode. Also Fix u8 -> u16, DPLL_WF_TIMER and DPLL_WP_TIMER are 2-byte registers Signed-off-by: Min Li --- drivers/ptp/ptp_clockmatrix.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/ptp/ptp_clockmatrix.c b/drivers/ptp/ptp_clockmatrix.c index f8556627befa..d069b6e451ef 100644 --- a/drivers/ptp/ptp_clockmatrix.c +++ b/drivers/ptp/ptp_clockmatrix.c @@ -1396,6 +1396,20 @@ static int idtcm_set_pll_mode(struct idtcm_channel *channel, struct idtcm *idtcm = channel->idtcm; int err; u8 dpll_mode; + u8 buf[2] = {0}; + + /* Setup WF/WP timer for phase pull-in to work correctly */ + err = idtcm_write(idtcm, channel->dpll_n, DPLL_WF_TIMER, + buf, sizeof(buf)); + if (err) + return err; + + if (mode == PLL_MODE_WRITE_PHASE) + buf[0] = 160; + err = idtcm_write(idtcm, channel->dpll_n, DPLL_WP_TIMER, + buf, sizeof(buf)); + if (err) + return err; err = idtcm_read(idtcm, channel->dpll_n, IDTCM_FW_REG(idtcm->fw_ver, V520, DPLL_MODE),