From patchwork Thu Nov 30 18:46:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Min Li X-Patchwork-Id: 13474811 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="b9DGKTfj" Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04olkn2109.outbound.protection.outlook.com [40.92.47.109]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A9CD10E5; Thu, 30 Nov 2023 10:46:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LJyrqb8XIKmowxsAPG6YeoQn3MHxtHBsXr8pyWnyF3VUl8s0/XqXjU9DbdBp/cP9ZX3P6pWeEZOE4RQdoa7LJOyvKYOFLIti6DyiNMY4V7kHXolSqJOhXiVV/HV52iKrl6e2FTVwkytVpkX5bQuw4gg6VzU8wTwuL5U0lj94JCg8QSG1/pRafGULsEmsCmNt4ranYskmIunhxREEaO4gBad7Dfrwu+Yw0HheownZNUfO420LE21dtCz9B/CkOibWE2lKk8fR+fd6M3Zx80briwyQoZqSLLtou2n/fYL2TeJGsDnbTLo0DQ9PpqOVN/qDlmMWYTV/3dcDNG9LyKqSnQ== 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=1/wvCDlyoOhOad3Bk9co/Bz6U2HPu3OekBdenXZ6/4k=; b=MkiBIVTmgdYowv2NJR8rJmmSfcKugGf8/9TKdbsiLoPLvrHQFD+Mj1iiY5pp+YmGkaqvDWwZp37mNemjZIRU+y9+8lvtVv/2dx4/ikj7uqNRFPAknu++d0wpH1bOCRhCRxXbtLMcu1QqFiLdUPBWx5dct/ZBfoEYAmg0S02Tokpp9VWyJPfaS3q++Y3lyJiC09cQqd6MEe36VkedOaXbKRJifuCGYXpdsPCO0oggExxuSdU0XcioFLLtNPtsC2qzE7b5wzA4DTpe0c0ZsTINZVRNduPh9bwbSx5+pzurwRfzsYheGlk5QY4n3hKkutugWqnebBFXs5YtDL9B+kYkAQ== 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=1/wvCDlyoOhOad3Bk9co/Bz6U2HPu3OekBdenXZ6/4k=; b=b9DGKTfjWSCj9UX2g7KZiKiCWJL+aqJnBmGpii7Fz8JCngmqYXP0WdWWju9SgIc1qaM1EVAQQ3d9dDDOtcyx9KUn+c9MrKL2xqf/TiptWz6Z9T9Hdso5cvXCtMC/4N/mkM2oo4f4Tlm9rsAwO5olSlM0cYUdzGzWzmtKI4dA9J1bjriLEYa4DAgepV6xatuCYdD8XQwi6JGuYXmerON09+ClXG/DZ5AuyaRbY0BswhIWNdv1MYGwJ9fPucSTGhgq4usUG3buaVDd0wZCcqnp7Mb8giMqG4u9CE8EIzDoa3oTwDPdoHQQ98ef5xalAaHeZQ202th803Uo19txSsI5Fw== Received: from PH7PR03MB7064.namprd03.prod.outlook.com (2603:10b6:510:2a5::8) by CO1PR03MB5905.namprd03.prod.outlook.com (2603:10b6:303:9b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.8; Thu, 30 Nov 2023 18:46:47 +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.7068.012; Thu, 30 Nov 2023 18:46:47 +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 v6 1/6] ptp: clockmatrix: support 32-bit address space Date: Thu, 30 Nov 2023 13:46:29 -0500 Message-ID: X-Mailer: git-send-email 2.39.2 X-TMN: [UGg26cenEszTorhY7UJKgyWYaiHmHple] X-ClientProxiedBy: YQBPR0101CA0262.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c01:68::24) To PH7PR03MB7064.namprd03.prod.outlook.com (2603:10b6:510:2a5::8) X-Microsoft-Original-Message-ID: <20231130184634.22577-1-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_|CO1PR03MB5905:EE_ X-MS-Office365-Filtering-Correlation-Id: 8667bd7b-e086-419a-82fb-08dbf1d4b4ba X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yEbs3d0OnmVbH6BFmmBjhe2f8Ig/CdIaOdJ4nBDD0T4NlUyrvHo1gyaILwyslaq/HEbcjaihkHMURZrGEZrGIGOfmWuZ6B+18Chd35tK6vjHDKUXviDPg69s0yFTRG2o1IVksetp8bgSxQZSFAdrsjtdDXDMFQq9Swuokj8R9VAAUhqj0xnit8szkcsNAMlvVewoSy+JWVDDKg/7kVGHyJaEw4fgizQ/pkpOPXWMRXl9nYQmvGQNC+tPAoM9N2EETr3rNtVdY5CGvvrcKRuDX5celDF/Uoiv9dpN/KWpc8CDfzWWXEBWMMDSDC/WvZgeNOPGMXyIfIUqOSurAbEW58ZzIEz23Fmag0PivuL5PbfKrQka6QrMTKvp2bRwvhyplKWGk6t8m5vyxh6dosVPcarNKtevNi38rVJQanqgs2zfxp6gfPUCniuu+76yEZpr3Mr6T3YlI519SG7X6/F56SOIOaIVxZuqU05U+OCzM/42AndRZT+UcwVTPZUuHwtDcXUs1L6lgYQVapQtRnf6e2c6ctfh1m5B2rltCYxOSEaHEeKsyJxUfe5HhHc45BBn X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: S1UpX+XkO8exrrlZPobJubKC/WuzPCo3j6+cV65N5QiOLUaXBnPDpq46HxopVaZUO91LBnEG0UjdpgyweYuEGccHgLsSaAMW5zILJ88fYcFaDAevM8j3EVMVZesMCSV1+dMa8FQix8a6V3pxcPM5tuqvwlC+xG8vF7sRh6Ryq7Irjy79vzAPV8fX5iGXG8W+NOctkfWwsOJyiQ/uuGN5AuyUurlUP0HhPi2wFZve+hiHkM4ZuiJKdV+Xfy5eMIXn3Pdevi402V4iR4TXBVU1i26U0LbPtBJZoF9002Xulnpd5Gg0YkhyZpjTjPdOI67C1cI3DNssHO/N6Ea3bSNPkPnYGkWae07/Ia8S2EKbmCTW7yfpVYfNVEg9Rn57pOQTUMF8oNStDga4/6y8B3ZKAzdjO5y/J4vJDImmRwtuOS4Hjm6jzm2ggt+EN7Fi6M+AZK+d9CgVmgGxyRdJQ/7LbJNB58CF5k9FSan2n7s351BpZ3syddWFrXWn7yGtEDol7u06DrpB8zpO6d0j6wM2C/pTusaRt+7NLc+RDGyjZGBoTE+x31AzcnKh1nBvJ3isntsygdUGHrO0HDAMFqySjuxhQ0T7vSdFrMByUeZ/w3dZ9xQkH6JYx1ghs3p9Peaz0Q/zpg5fahmTOFo5uGIVPE3+pu82WODMTTWGdS3KVm/NEiaDCFbrwchgAikiGAa/pHH5J5ou+3lSQU2e0FJjcc4A8FzZIvs+P28u9eymUZEYYMItUfiebvnwv98CqsjChhjXirCw4aYkWwxTlHoG7q8+xpPdeakEFVo0LOhBL3Px9FHxFIx+gHCKYQuI5IiiHYaSZikdwYx+3Sp8bdQlw+uVYlWk3NmMGsU1YPFjF2XByfPaPCGuiZR7QA1PQ90PBtoywCYvOz4UB48h7jm8rDPFm8RabZxUrv3Xzc/uMqMR5eylNEJbgGFjsieDZe0abzG8IoATm3TBRd/UizXyr50uGZ5ti0LcxA6jIUE4x8uG2LECDZ5TnznG8oQ1XQNmOktr9zm2lbmehe3w4idvA/H4hRzM95AXRcpNrB8q7IwQ46PPgM68hyh4MmsFHoVwZMU6iXijbXw/goPRU7sxe5U2MfYAYGcAx7hQPa5Z0hB5iVWT2zN3+4ZBld9JAKgEx7f+NqA4zGW/lfjebxR1mxUC3h2oQLk1tFHZVW6RRc+xHd7EfFulwHVXECmbJZ4pXqmvH4kJBLdKnGrRtuOenQ== X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-685f7.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: 8667bd7b-e086-419a-82fb-08dbf1d4b4ba X-MS-Exchange-CrossTenant-AuthSource: PH7PR03MB7064.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2023 18:46:47.6750 (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: CO1PR03MB5905 X-Patchwork-Delegate: kuba@kernel.org From: Min Li We used to assume 0x2010xxxx address. Now that we need to access 0x2011xxxx address, we need to support read/write the whole 32-bit address space. Signed-off-by: Min Li --- - Drop MAX_ABS_WRITE_PHASE_PICOSECONDS advised by Rahul - Apply SCSR_ADDR to scrach register in idtcm_load_firmware advised by Simon - Apply u32 to base in idtcm_output_enable advised by Simon - Correct sync_ctrl0/1 parameter position for idtcm_write advised by Simon - Restore adjphase function suggested by Rahul - Separate unrelated stuff to patches suggested by Paolo drivers/ptp/ptp_clockmatrix.c | 59 ++-- drivers/ptp/ptp_clockmatrix.h | 32 +- include/linux/mfd/idt8a340_reg.h | 542 ++++++++++++++++--------------- 3 files changed, 317 insertions(+), 316 deletions(-) diff --git a/drivers/ptp/ptp_clockmatrix.c b/drivers/ptp/ptp_clockmatrix.c index f6f9d4adce04..f8556627befa 100644 --- a/drivers/ptp/ptp_clockmatrix.c +++ b/drivers/ptp/ptp_clockmatrix.c @@ -41,8 +41,8 @@ module_param(firmware, charp, 0); static int _idtcm_adjfine(struct idtcm_channel *channel, long scaled_ppm); static inline int idtcm_read(struct idtcm *idtcm, - u16 module, - u16 regaddr, + u32 module, + u32 regaddr, u8 *buf, u16 count) { @@ -50,8 +50,8 @@ static inline int idtcm_read(struct idtcm *idtcm, } static inline int idtcm_write(struct idtcm *idtcm, - u16 module, - u16 regaddr, + u32 module, + u32 regaddr, u8 *buf, u16 count) { @@ -62,7 +62,8 @@ static int contains_full_configuration(struct idtcm *idtcm, const struct firmware *fw) { struct idtcm_fwrc *rec = (struct idtcm_fwrc *)fw->data; - u16 scratch = IDTCM_FW_REG(idtcm->fw_ver, V520, SCRATCH); + u16 scratch = SCSR_ADDR(IDTCM_FW_REG(idtcm->fw_ver, V520, SCRATCH)); + u16 gpio_control = SCSR_ADDR(GPIO_USER_CONTROL); s32 full_count; s32 count = 0; u16 regaddr; @@ -70,8 +71,8 @@ static int contains_full_configuration(struct idtcm *idtcm, s32 len; /* 4 bytes skipped every 0x80 */ - full_count = (scratch - GPIO_USER_CONTROL) - - ((scratch >> 7) - (GPIO_USER_CONTROL >> 7)) * 4; + full_count = (scratch - gpio_control) - + ((scratch >> 7) - (gpio_control >> 7)) * 4; /* If the firmware contains 'full configuration' SM_RESET can be used * to ensure proper configuration. @@ -88,7 +89,7 @@ static int contains_full_configuration(struct idtcm *idtcm, rec++; /* Top (status registers) and bottom are read-only */ - if (regaddr < GPIO_USER_CONTROL || regaddr >= scratch) + if (regaddr < gpio_control || regaddr >= scratch) continue; /* Page size 128, last 4 bytes of page skipped */ @@ -506,8 +507,8 @@ static int _sync_pll_output(struct idtcm *idtcm, { int err; u8 val; - u16 sync_ctrl0; - u16 sync_ctrl1; + u32 sync_ctrl0; + u32 sync_ctrl1; u8 temp; if (qn == 0 && qn_plus_1 == 0) @@ -553,11 +554,11 @@ static int _sync_pll_output(struct idtcm *idtcm, val = SYNCTRL1_MASTER_SYNC_RST; /* Place master sync in reset */ - err = idtcm_write(idtcm, 0, sync_ctrl1, &val, sizeof(val)); + err = idtcm_write(idtcm, sync_ctrl1, 0, &val, sizeof(val)); if (err) return err; - err = idtcm_write(idtcm, 0, sync_ctrl0, &sync_src, sizeof(sync_src)); + err = idtcm_write(idtcm, sync_ctrl0, 0, &sync_src, sizeof(sync_src)); if (err) return err; @@ -570,27 +571,27 @@ static int _sync_pll_output(struct idtcm *idtcm, if (qn_plus_1) val |= SYNCTRL1_Q1_DIV_SYNC_TRIG; - err = idtcm_write(idtcm, 0, sync_ctrl1, &val, sizeof(val)); + err = idtcm_write(idtcm, sync_ctrl1, 0, &val, sizeof(val)); if (err) return err; /* PLL5 can have OUT8 as second additional output. */ if (pll == 5 && qn_plus_1 != 0) { - err = idtcm_read(idtcm, 0, HW_Q8_CTRL_SPARE, + err = idtcm_read(idtcm, HW_Q8_CTRL_SPARE, 0, &temp, sizeof(temp)); if (err) return err; temp &= ~(Q9_TO_Q8_SYNC_TRIG); - err = idtcm_write(idtcm, 0, HW_Q8_CTRL_SPARE, + err = idtcm_write(idtcm, HW_Q8_CTRL_SPARE, 0, &temp, sizeof(temp)); if (err) return err; temp |= Q9_TO_Q8_SYNC_TRIG; - err = idtcm_write(idtcm, 0, HW_Q8_CTRL_SPARE, + err = idtcm_write(idtcm, HW_Q8_CTRL_SPARE, 0, &temp, sizeof(temp)); if (err) return err; @@ -598,21 +599,21 @@ static int _sync_pll_output(struct idtcm *idtcm, /* PLL6 can have OUT11 as second additional output. */ if (pll == 6 && qn_plus_1 != 0) { - err = idtcm_read(idtcm, 0, HW_Q11_CTRL_SPARE, + err = idtcm_read(idtcm, HW_Q11_CTRL_SPARE, 0, &temp, sizeof(temp)); if (err) return err; temp &= ~(Q10_TO_Q11_SYNC_TRIG); - err = idtcm_write(idtcm, 0, HW_Q11_CTRL_SPARE, + err = idtcm_write(idtcm, HW_Q11_CTRL_SPARE, 0, &temp, sizeof(temp)); if (err) return err; temp |= Q10_TO_Q11_SYNC_TRIG; - err = idtcm_write(idtcm, 0, HW_Q11_CTRL_SPARE, + err = idtcm_write(idtcm, HW_Q11_CTRL_SPARE, 0, &temp, sizeof(temp)); if (err) return err; @@ -620,7 +621,7 @@ static int _sync_pll_output(struct idtcm *idtcm, /* Place master sync out of reset */ val &= ~(SYNCTRL1_MASTER_SYNC_RST); - err = idtcm_write(idtcm, 0, sync_ctrl1, &val, sizeof(val)); + err = idtcm_write(idtcm, sync_ctrl1, 0, &val, sizeof(val)); return err; } @@ -637,7 +638,7 @@ static int idtcm_sync_pps_output(struct idtcm_channel *channel) u8 temp; u16 output_mask = channel->output_mask; - err = idtcm_read(idtcm, 0, HW_Q8_CTRL_SPARE, + err = idtcm_read(idtcm, HW_Q8_CTRL_SPARE, 0, &temp, sizeof(temp)); if (err) return err; @@ -646,7 +647,7 @@ static int idtcm_sync_pps_output(struct idtcm_channel *channel) Q9_TO_Q8_FANOUT_AND_CLOCK_SYNC_ENABLE_MASK) out8_mux = 1; - err = idtcm_read(idtcm, 0, HW_Q11_CTRL_SPARE, + err = idtcm_read(idtcm, HW_Q11_CTRL_SPARE, 0, &temp, sizeof(temp)); if (err) return err; @@ -1253,7 +1254,7 @@ static void display_pll_and_masks(struct idtcm *idtcm) static int idtcm_load_firmware(struct idtcm *idtcm, struct device *dev) { - u16 scratch = IDTCM_FW_REG(idtcm->fw_ver, V520, SCRATCH); + u16 scratch = SCSR_ADDR(IDTCM_FW_REG(idtcm->fw_ver, V520, SCRATCH)); char fname[128] = FW_FILENAME; const struct firmware *fw; struct idtcm_fwrc *rec; @@ -1303,14 +1304,14 @@ static int idtcm_load_firmware(struct idtcm *idtcm, err = 0; /* Top (status registers) and bottom are read-only */ - if (regaddr < GPIO_USER_CONTROL || regaddr >= scratch) + if (regaddr < SCSR_ADDR(GPIO_USER_CONTROL) || regaddr >= scratch) continue; /* Page size 128, last 4 bytes of page skipped */ if ((loaddr > 0x7b && loaddr <= 0x7f) || loaddr > 0xfb) continue; - err = idtcm_write(idtcm, regaddr, 0, &val, sizeof(val)); + err = idtcm_write(idtcm, SCSR_BASE, regaddr, &val, sizeof(val)); } if (err) @@ -1340,7 +1341,7 @@ static int idtcm_output_enable(struct idtcm_channel *channel, return base; } - err = idtcm_read(idtcm, (u16)base, OUT_CTRL_1, &val, sizeof(val)); + err = idtcm_read(idtcm, (u32)base, OUT_CTRL_1, &val, sizeof(val)); if (err) return err; @@ -1349,7 +1350,7 @@ static int idtcm_output_enable(struct idtcm_channel *channel, else val &= ~SQUELCH_DISABLE; - return idtcm_write(idtcm, (u16)base, OUT_CTRL_1, &val, sizeof(val)); + return idtcm_write(idtcm, (u32)base, OUT_CTRL_1, &val, sizeof(val)); } static int idtcm_perout_enable(struct idtcm_channel *channel, @@ -1713,10 +1714,10 @@ static s32 idtcm_getmaxphase(struct ptp_clock_info *ptp __always_unused) static int _idtcm_adjphase(struct idtcm_channel *channel, s32 delta_ns) { struct idtcm *idtcm = channel->idtcm; - int err; - u8 i; u8 buf[4] = {0}; s32 phase_50ps; + int err; + u8 i; if (channel->mode != PTP_PLL_MODE_WRITE_PHASE) { err = channel->configure_write_phase(channel); diff --git a/drivers/ptp/ptp_clockmatrix.h b/drivers/ptp/ptp_clockmatrix.h index 7c17c4f7f573..ad39dc6decdf 100644 --- a/drivers/ptp/ptp_clockmatrix.h +++ b/drivers/ptp/ptp_clockmatrix.h @@ -54,21 +54,9 @@ #define LOCK_TIMEOUT_MS (2000) #define LOCK_POLL_INTERVAL_MS (10) -#define IDTCM_MAX_WRITE_COUNT (512) - #define PHASE_PULL_IN_MAX_PPB (144000) #define PHASE_PULL_IN_MIN_THRESHOLD_NS (2) -/* - * Return register address based on passed in firmware version - */ -#define IDTCM_FW_REG(FW, VER, REG) (((FW) < (VER)) ? (REG) : (REG##_##VER)) -enum fw_version { - V_DEFAULT = 0, - V487 = 1, - V520 = 2, -}; - /* PTP PLL Mode */ enum ptp_pll_mode { PTP_PLL_MODE_MIN = 0, @@ -84,16 +72,16 @@ struct idtcm_channel { struct ptp_clock_info caps; struct ptp_clock *ptp_clock; struct idtcm *idtcm; - u16 dpll_phase; - u16 dpll_freq; - u16 dpll_n; - u16 dpll_ctrl_n; - u16 dpll_phase_pull_in; - u16 tod_read_primary; - u16 tod_read_secondary; - u16 tod_write; - u16 tod_n; - u16 hw_dpll_n; + u32 dpll_phase; + u32 dpll_freq; + u32 dpll_n; + u32 dpll_ctrl_n; + u32 dpll_phase_pull_in; + u32 tod_read_primary; + u32 tod_read_secondary; + u32 tod_write; + u32 tod_n; + u32 hw_dpll_n; u8 sync_src; enum ptp_pll_mode mode; int (*configure_write_frequency)(struct idtcm_channel *channel); diff --git a/include/linux/mfd/idt8a340_reg.h b/include/linux/mfd/idt8a340_reg.h index 0c706085c205..b680a0eb5f68 100644 --- a/include/linux/mfd/idt8a340_reg.h +++ b/include/linux/mfd/idt8a340_reg.h @@ -7,20 +7,20 @@ #ifndef HAVE_IDT8A340_REG #define HAVE_IDT8A340_REG -#define PAGE_ADDR_BASE 0x0000 -#define PAGE_ADDR 0x00fc +#define SCSR_BASE 0x20100000 +#define SCSR_ADDR(x) ((x) & 0xffff) -#define HW_REVISION 0x8180 +#define HW_REVISION 0x20108180 #define REV_ID 0x007a -#define HW_DPLL_0 (0x8a00) -#define HW_DPLL_1 (0x8b00) -#define HW_DPLL_2 (0x8c00) -#define HW_DPLL_3 (0x8d00) -#define HW_DPLL_4 (0x8e00) -#define HW_DPLL_5 (0x8f00) -#define HW_DPLL_6 (0x9000) -#define HW_DPLL_7 (0x9100) +#define HW_DPLL_0 (0x20108a00) +#define HW_DPLL_1 (0x20108b00) +#define HW_DPLL_2 (0x20108c00) +#define HW_DPLL_3 (0x20108d00) +#define HW_DPLL_4 (0x20108e00) +#define HW_DPLL_5 (0x20108f00) +#define HW_DPLL_6 (0x20109000) +#define HW_DPLL_7 (0x20109100) #define HW_DPLL_TOD_SW_TRIG_ADDR__0 (0x080) #define HW_DPLL_TOD_CTRL_1 (0x089) @@ -28,22 +28,22 @@ #define HW_DPLL_TOD_OVR__0 (0x098) #define HW_DPLL_TOD_OUT_0__0 (0x0B0) -#define HW_Q0_Q1_CH_SYNC_CTRL_0 (0xa740) -#define HW_Q0_Q1_CH_SYNC_CTRL_1 (0xa741) -#define HW_Q2_Q3_CH_SYNC_CTRL_0 (0xa742) -#define HW_Q2_Q3_CH_SYNC_CTRL_1 (0xa743) -#define HW_Q4_Q5_CH_SYNC_CTRL_0 (0xa744) -#define HW_Q4_Q5_CH_SYNC_CTRL_1 (0xa745) -#define HW_Q6_Q7_CH_SYNC_CTRL_0 (0xa746) -#define HW_Q6_Q7_CH_SYNC_CTRL_1 (0xa747) -#define HW_Q8_CH_SYNC_CTRL_0 (0xa748) -#define HW_Q8_CH_SYNC_CTRL_1 (0xa749) -#define HW_Q9_CH_SYNC_CTRL_0 (0xa74a) -#define HW_Q9_CH_SYNC_CTRL_1 (0xa74b) -#define HW_Q10_CH_SYNC_CTRL_0 (0xa74c) -#define HW_Q10_CH_SYNC_CTRL_1 (0xa74d) -#define HW_Q11_CH_SYNC_CTRL_0 (0xa74e) -#define HW_Q11_CH_SYNC_CTRL_1 (0xa74f) +#define HW_Q0_Q1_CH_SYNC_CTRL_0 (0x2010a740) +#define HW_Q0_Q1_CH_SYNC_CTRL_1 (0x2010a741) +#define HW_Q2_Q3_CH_SYNC_CTRL_0 (0x2010a742) +#define HW_Q2_Q3_CH_SYNC_CTRL_1 (0x2010a743) +#define HW_Q4_Q5_CH_SYNC_CTRL_0 (0x2010a744) +#define HW_Q4_Q5_CH_SYNC_CTRL_1 (0x2010a745) +#define HW_Q6_Q7_CH_SYNC_CTRL_0 (0x2010a746) +#define HW_Q6_Q7_CH_SYNC_CTRL_1 (0x2010a747) +#define HW_Q8_CH_SYNC_CTRL_0 (0x2010a748) +#define HW_Q8_CH_SYNC_CTRL_1 (0x2010a749) +#define HW_Q9_CH_SYNC_CTRL_0 (0x2010a74a) +#define HW_Q9_CH_SYNC_CTRL_1 (0x2010a74b) +#define HW_Q10_CH_SYNC_CTRL_0 (0x2010a74c) +#define HW_Q10_CH_SYNC_CTRL_1 (0x2010a74d) +#define HW_Q11_CH_SYNC_CTRL_0 (0x2010a74e) +#define HW_Q11_CH_SYNC_CTRL_1 (0x2010a74f) #define SYNC_SOURCE_DPLL0_TOD_PPS 0x14 #define SYNC_SOURCE_DPLL1_TOD_PPS 0x15 @@ -58,8 +58,8 @@ #define SYNCTRL1_Q1_DIV_SYNC_TRIG BIT(1) #define SYNCTRL1_Q0_DIV_SYNC_TRIG BIT(0) -#define HW_Q8_CTRL_SPARE (0xa7d4) -#define HW_Q11_CTRL_SPARE (0xa7ec) +#define HW_Q8_CTRL_SPARE (0x2010a7d4) +#define HW_Q11_CTRL_SPARE (0x2010a7ec) /** * Select FOD5 as sync_trigger for Q8 divider. @@ -95,12 +95,12 @@ */ #define Q10_TO_Q11_FANOUT_AND_CLOCK_SYNC_ENABLE_MASK (BIT(0) | BIT(2)) -#define RESET_CTRL 0xc000 +#define RESET_CTRL 0x2010c000 #define SM_RESET 0x0012 #define SM_RESET_V520 0x0013 #define SM_RESET_CMD 0x5A -#define GENERAL_STATUS 0xc014 +#define GENERAL_STATUS 0x2010c014 #define BOOT_STATUS 0x0000 #define HW_REV_ID 0x000A #define BOND_ID 0x000B @@ -115,7 +115,7 @@ #define PRODUCT_ID 0x001e #define OTP_SCSR_CONFIG_SELECT 0x0022 -#define STATUS 0xc03c +#define STATUS 0x2010c03c #define DPLL0_STATUS 0x0018 #define DPLL1_STATUS 0x0019 #define DPLL2_STATUS 0x001a @@ -138,60 +138,62 @@ #define USER_GPIO0_TO_7_STATUS 0x008a #define USER_GPIO8_TO_15_STATUS 0x008b -#define GPIO_USER_CONTROL 0xc160 +#define GPIO_USER_CONTROL 0x2010c160 #define GPIO0_TO_7_OUT 0x0000 #define GPIO8_TO_15_OUT 0x0001 #define GPIO0_TO_7_OUT_V520 0x0002 #define GPIO8_TO_15_OUT_V520 0x0003 -#define STICKY_STATUS_CLEAR 0xc164 - -#define GPIO_TOD_NOTIFICATION_CLEAR 0xc16c - -#define ALERT_CFG 0xc188 - -#define SYS_DPLL_XO 0xc194 - -#define SYS_APLL 0xc19c - -#define INPUT_0 0xc1b0 -#define INPUT_1 0xc1c0 -#define INPUT_2 0xc1d0 -#define INPUT_3 0xc200 -#define INPUT_4 0xc210 -#define INPUT_5 0xc220 -#define INPUT_6 0xc230 -#define INPUT_7 0xc240 -#define INPUT_8 0xc250 -#define INPUT_9 0xc260 -#define INPUT_10 0xc280 -#define INPUT_11 0xc290 -#define INPUT_12 0xc2a0 -#define INPUT_13 0xc2b0 -#define INPUT_14 0xc2c0 -#define INPUT_15 0xc2d0 - -#define REF_MON_0 0xc2e0 -#define REF_MON_1 0xc2ec -#define REF_MON_2 0xc300 -#define REF_MON_3 0xc30c -#define REF_MON_4 0xc318 -#define REF_MON_5 0xc324 -#define REF_MON_6 0xc330 -#define REF_MON_7 0xc33c -#define REF_MON_8 0xc348 -#define REF_MON_9 0xc354 -#define REF_MON_10 0xc360 -#define REF_MON_11 0xc36c -#define REF_MON_12 0xc380 -#define REF_MON_13 0xc38c -#define REF_MON_14 0xc398 -#define REF_MON_15 0xc3a4 - -#define DPLL_0 0xc3b0 +#define STICKY_STATUS_CLEAR 0x2010c164 + +#define GPIO_TOD_NOTIFICATION_CLEAR 0x2010c16c + +#define ALERT_CFG 0x2010c188 + +#define SYS_DPLL_XO 0x2010c194 + +#define SYS_APLL 0x2010c19c + +#define INPUT_0 0x2010c1b0 +#define INPUT_1 0x2010c1c0 +#define INPUT_2 0x2010c1d0 +#define INPUT_3 0x2010c200 +#define INPUT_4 0x2010c210 +#define INPUT_5 0x2010c220 +#define INPUT_6 0x2010c230 +#define INPUT_7 0x2010c240 +#define INPUT_8 0x2010c250 +#define INPUT_9 0x2010c260 +#define INPUT_10 0x2010c280 +#define INPUT_11 0x2010c290 +#define INPUT_12 0x2010c2a0 +#define INPUT_13 0x2010c2b0 +#define INPUT_14 0x2010c2c0 +#define INPUT_15 0x2010c2d0 + +#define REF_MON_0 0x2010c2e0 +#define REF_MON_1 0x2010c2ec +#define REF_MON_2 0x2010c300 +#define REF_MON_3 0x2010c30c +#define REF_MON_4 0x2010c318 +#define REF_MON_5 0x2010c324 +#define REF_MON_6 0x2010c330 +#define REF_MON_7 0x2010c33c +#define REF_MON_8 0x2010c348 +#define REF_MON_9 0x2010c354 +#define REF_MON_10 0x2010c360 +#define REF_MON_11 0x2010c36c +#define REF_MON_12 0x2010c380 +#define REF_MON_13 0x2010c38c +#define REF_MON_14 0x2010c398 +#define REF_MON_15 0x2010c3a4 + +#define DPLL_0 0x2010c3b0 #define DPLL_CTRL_REG_0 0x0002 #define DPLL_CTRL_REG_1 0x0003 #define DPLL_CTRL_REG_2 0x0004 +#define DPLL_WF_TIMER 0x002c +#define DPLL_WP_TIMER 0x002e #define DPLL_TOD_SYNC_CFG 0x0031 #define DPLL_COMBO_SLAVE_CFG_0 0x0032 #define DPLL_COMBO_SLAVE_CFG_1 0x0033 @@ -200,69 +202,69 @@ #define DPLL_PHASE_MEASUREMENT_CFG 0x0036 #define DPLL_MODE 0x0037 #define DPLL_MODE_V520 0x003B -#define DPLL_1 0xc400 -#define DPLL_2 0xc438 -#define DPLL_2_V520 0xc43c -#define DPLL_3 0xc480 -#define DPLL_4 0xc4b8 -#define DPLL_4_V520 0xc4bc -#define DPLL_5 0xc500 -#define DPLL_6 0xc538 -#define DPLL_6_V520 0xc53c -#define DPLL_7 0xc580 -#define SYS_DPLL 0xc5b8 -#define SYS_DPLL_V520 0xc5bc - -#define DPLL_CTRL_0 0xc600 +#define DPLL_1 0x2010c400 +#define DPLL_2 0x2010c438 +#define DPLL_2_V520 0x2010c43c +#define DPLL_3 0x2010c480 +#define DPLL_4 0x2010c4b8 +#define DPLL_4_V520 0x2010c4bc +#define DPLL_5 0x2010c500 +#define DPLL_6 0x2010c538 +#define DPLL_6_V520 0x2010c53c +#define DPLL_7 0x2010c580 +#define SYS_DPLL 0x2010c5b8 +#define SYS_DPLL_V520 0x2010c5bc + +#define DPLL_CTRL_0 0x2010c600 #define DPLL_CTRL_DPLL_MANU_REF_CFG 0x0001 #define DPLL_CTRL_DPLL_FOD_FREQ 0x001c #define DPLL_CTRL_COMBO_MASTER_CFG 0x003a -#define DPLL_CTRL_1 0xc63c -#define DPLL_CTRL_2 0xc680 -#define DPLL_CTRL_3 0xc6bc -#define DPLL_CTRL_4 0xc700 -#define DPLL_CTRL_5 0xc73c -#define DPLL_CTRL_6 0xc780 -#define DPLL_CTRL_7 0xc7bc -#define SYS_DPLL_CTRL 0xc800 - -#define DPLL_PHASE_0 0xc818 +#define DPLL_CTRL_1 0x2010c63c +#define DPLL_CTRL_2 0x2010c680 +#define DPLL_CTRL_3 0x2010c6bc +#define DPLL_CTRL_4 0x2010c700 +#define DPLL_CTRL_5 0x2010c73c +#define DPLL_CTRL_6 0x2010c780 +#define DPLL_CTRL_7 0x2010c7bc +#define SYS_DPLL_CTRL 0x2010c800 + +#define DPLL_PHASE_0 0x2010c818 /* Signed 42-bit FFO in units of 2^(-53) */ #define DPLL_WR_PHASE 0x0000 -#define DPLL_PHASE_1 0xc81c -#define DPLL_PHASE_2 0xc820 -#define DPLL_PHASE_3 0xc824 -#define DPLL_PHASE_4 0xc828 -#define DPLL_PHASE_5 0xc82c -#define DPLL_PHASE_6 0xc830 -#define DPLL_PHASE_7 0xc834 - -#define DPLL_FREQ_0 0xc838 +#define DPLL_PHASE_1 0x2010c81c +#define DPLL_PHASE_2 0x2010c820 +#define DPLL_PHASE_3 0x2010c824 +#define DPLL_PHASE_4 0x2010c828 +#define DPLL_PHASE_5 0x2010c82c +#define DPLL_PHASE_6 0x2010c830 +#define DPLL_PHASE_7 0x2010c834 + +#define DPLL_FREQ_0 0x2010c838 /* Signed 42-bit FFO in units of 2^(-53) */ #define DPLL_WR_FREQ 0x0000 -#define DPLL_FREQ_1 0xc840 -#define DPLL_FREQ_2 0xc848 -#define DPLL_FREQ_3 0xc850 -#define DPLL_FREQ_4 0xc858 -#define DPLL_FREQ_5 0xc860 -#define DPLL_FREQ_6 0xc868 -#define DPLL_FREQ_7 0xc870 - -#define DPLL_PHASE_PULL_IN_0 0xc880 +#define DPLL_FREQ_1 0x2010c840 +#define DPLL_FREQ_2 0x2010c848 +#define DPLL_FREQ_3 0x2010c850 +#define DPLL_FREQ_4 0x2010c858 +#define DPLL_FREQ_5 0x2010c860 +#define DPLL_FREQ_6 0x2010c868 +#define DPLL_FREQ_7 0x2010c870 + +#define DPLL_PHASE_PULL_IN_0 0x2010c880 #define PULL_IN_OFFSET 0x0000 /* Signed 32 bit */ #define PULL_IN_SLOPE_LIMIT 0x0004 /* Unsigned 24 bit */ #define PULL_IN_CTRL 0x0007 -#define DPLL_PHASE_PULL_IN_1 0xc888 -#define DPLL_PHASE_PULL_IN_2 0xc890 -#define DPLL_PHASE_PULL_IN_3 0xc898 -#define DPLL_PHASE_PULL_IN_4 0xc8a0 -#define DPLL_PHASE_PULL_IN_5 0xc8a8 -#define DPLL_PHASE_PULL_IN_6 0xc8b0 -#define DPLL_PHASE_PULL_IN_7 0xc8b8 - -#define GPIO_CFG 0xc8c0 +#define DPLL_PHASE_PULL_IN_1 0x2010c888 +#define DPLL_PHASE_PULL_IN_2 0x2010c890 +#define DPLL_PHASE_PULL_IN_3 0x2010c898 +#define DPLL_PHASE_PULL_IN_4 0x2010c8a0 +#define DPLL_PHASE_PULL_IN_5 0x2010c8a8 +#define DPLL_PHASE_PULL_IN_6 0x2010c8b0 +#define DPLL_PHASE_PULL_IN_7 0x2010c8b8 + +#define GPIO_CFG 0x2010c8c0 #define GPIO_CFG_GBL 0x0000 -#define GPIO_0 0xc8c2 +#define GPIO_0 0x2010c8c2 #define GPIO_DCO_INC_DEC 0x0000 #define GPIO_OUT_CTRL_0 0x0001 #define GPIO_OUT_CTRL_1 0x0002 @@ -281,25 +283,25 @@ #define GPIO_TOD_NOTIFICATION_CFG 0x000f #define GPIO_CTRL 0x0010 #define GPIO_CTRL_V520 0x0011 -#define GPIO_1 0xc8d4 -#define GPIO_2 0xc8e6 -#define GPIO_3 0xc900 -#define GPIO_4 0xc912 -#define GPIO_5 0xc924 -#define GPIO_6 0xc936 -#define GPIO_7 0xc948 -#define GPIO_8 0xc95a -#define GPIO_9 0xc980 -#define GPIO_10 0xc992 -#define GPIO_11 0xc9a4 -#define GPIO_12 0xc9b6 -#define GPIO_13 0xc9c8 -#define GPIO_14 0xc9da -#define GPIO_15 0xca00 - -#define OUT_DIV_MUX 0xca12 -#define OUTPUT_0 0xca14 -#define OUTPUT_0_V520 0xca20 +#define GPIO_1 0x2010c8d4 +#define GPIO_2 0x2010c8e6 +#define GPIO_3 0x2010c900 +#define GPIO_4 0x2010c912 +#define GPIO_5 0x2010c924 +#define GPIO_6 0x2010c936 +#define GPIO_7 0x2010c948 +#define GPIO_8 0x2010c95a +#define GPIO_9 0x2010c980 +#define GPIO_10 0x2010c992 +#define GPIO_11 0x2010c9a4 +#define GPIO_12 0x2010c9b6 +#define GPIO_13 0x2010c9c8 +#define GPIO_14 0x2010c9da +#define GPIO_15 0x2010ca00 + +#define OUT_DIV_MUX 0x2010ca12 +#define OUTPUT_0 0x2010ca14 +#define OUTPUT_0_V520 0x2010ca20 /* FOD frequency output divider value */ #define OUT_DIV 0x0000 #define OUT_DUTY_CYCLE_HIGH 0x0004 @@ -307,88 +309,88 @@ #define OUT_CTRL_1 0x0009 /* Phase adjustment in FOD cycles */ #define OUT_PHASE_ADJ 0x000c -#define OUTPUT_1 0xca24 -#define OUTPUT_1_V520 0xca30 -#define OUTPUT_2 0xca34 -#define OUTPUT_2_V520 0xca40 -#define OUTPUT_3 0xca44 -#define OUTPUT_3_V520 0xca50 -#define OUTPUT_4 0xca54 -#define OUTPUT_4_V520 0xca60 -#define OUTPUT_5 0xca64 -#define OUTPUT_5_V520 0xca80 -#define OUTPUT_6 0xca80 -#define OUTPUT_6_V520 0xca90 -#define OUTPUT_7 0xca90 -#define OUTPUT_7_V520 0xcaa0 -#define OUTPUT_8 0xcaa0 -#define OUTPUT_8_V520 0xcab0 -#define OUTPUT_9 0xcab0 -#define OUTPUT_9_V520 0xcac0 -#define OUTPUT_10 0xcac0 -#define OUTPUT_10_V520 0xcad0 -#define OUTPUT_11 0xcad0 -#define OUTPUT_11_V520 0xcae0 - -#define SERIAL 0xcae0 -#define SERIAL_V520 0xcaf0 - -#define PWM_ENCODER_0 0xcb00 -#define PWM_ENCODER_1 0xcb08 -#define PWM_ENCODER_2 0xcb10 -#define PWM_ENCODER_3 0xcb18 -#define PWM_ENCODER_4 0xcb20 -#define PWM_ENCODER_5 0xcb28 -#define PWM_ENCODER_6 0xcb30 -#define PWM_ENCODER_7 0xcb38 -#define PWM_DECODER_0 0xcb40 -#define PWM_DECODER_1 0xcb48 -#define PWM_DECODER_1_V520 0xcb4a -#define PWM_DECODER_2 0xcb50 -#define PWM_DECODER_2_V520 0xcb54 -#define PWM_DECODER_3 0xcb58 -#define PWM_DECODER_3_V520 0xcb5e -#define PWM_DECODER_4 0xcb60 -#define PWM_DECODER_4_V520 0xcb68 -#define PWM_DECODER_5 0xcb68 -#define PWM_DECODER_5_V520 0xcb80 -#define PWM_DECODER_6 0xcb70 -#define PWM_DECODER_6_V520 0xcb8a -#define PWM_DECODER_7 0xcb80 -#define PWM_DECODER_7_V520 0xcb94 -#define PWM_DECODER_8 0xcb88 -#define PWM_DECODER_8_V520 0xcb9e -#define PWM_DECODER_9 0xcb90 -#define PWM_DECODER_9_V520 0xcba8 -#define PWM_DECODER_10 0xcb98 -#define PWM_DECODER_10_V520 0xcbb2 -#define PWM_DECODER_11 0xcba0 -#define PWM_DECODER_11_V520 0xcbbc -#define PWM_DECODER_12 0xcba8 -#define PWM_DECODER_12_V520 0xcbc6 -#define PWM_DECODER_13 0xcbb0 -#define PWM_DECODER_13_V520 0xcbd0 -#define PWM_DECODER_14 0xcbb8 -#define PWM_DECODER_14_V520 0xcbda -#define PWM_DECODER_15 0xcbc0 -#define PWM_DECODER_15_V520 0xcbe4 -#define PWM_USER_DATA 0xcbc8 -#define PWM_USER_DATA_V520 0xcbf0 - -#define TOD_0 0xcbcc -#define TOD_0_V520 0xcc00 +#define OUTPUT_1 0x2010ca24 +#define OUTPUT_1_V520 0x2010ca30 +#define OUTPUT_2 0x2010ca34 +#define OUTPUT_2_V520 0x2010ca40 +#define OUTPUT_3 0x2010ca44 +#define OUTPUT_3_V520 0x2010ca50 +#define OUTPUT_4 0x2010ca54 +#define OUTPUT_4_V520 0x2010ca60 +#define OUTPUT_5 0x2010ca64 +#define OUTPUT_5_V520 0x2010ca80 +#define OUTPUT_6 0x2010ca80 +#define OUTPUT_6_V520 0x2010ca90 +#define OUTPUT_7 0x2010ca90 +#define OUTPUT_7_V520 0x2010caa0 +#define OUTPUT_8 0x2010caa0 +#define OUTPUT_8_V520 0x2010cab0 +#define OUTPUT_9 0x2010cab0 +#define OUTPUT_9_V520 0x2010cac0 +#define OUTPUT_10 0x2010cac0 +#define OUTPUT_10_V520 0x2010cad0 +#define OUTPUT_11 0x2010cad0 +#define OUTPUT_11_V520 0x2010cae0 + +#define SERIAL 0x2010cae0 +#define SERIAL_V520 0x2010caf0 + +#define PWM_ENCODER_0 0x2010cb00 +#define PWM_ENCODER_1 0x2010cb08 +#define PWM_ENCODER_2 0x2010cb10 +#define PWM_ENCODER_3 0x2010cb18 +#define PWM_ENCODER_4 0x2010cb20 +#define PWM_ENCODER_5 0x2010cb28 +#define PWM_ENCODER_6 0x2010cb30 +#define PWM_ENCODER_7 0x2010cb38 +#define PWM_DECODER_0 0x2010cb40 +#define PWM_DECODER_1 0x2010cb48 +#define PWM_DECODER_1_V520 0x2010cb4a +#define PWM_DECODER_2 0x2010cb50 +#define PWM_DECODER_2_V520 0x2010cb54 +#define PWM_DECODER_3 0x2010cb58 +#define PWM_DECODER_3_V520 0x2010cb5e +#define PWM_DECODER_4 0x2010cb60 +#define PWM_DECODER_4_V520 0x2010cb68 +#define PWM_DECODER_5 0x2010cb68 +#define PWM_DECODER_5_V520 0x2010cb80 +#define PWM_DECODER_6 0x2010cb70 +#define PWM_DECODER_6_V520 0x2010cb8a +#define PWM_DECODER_7 0x2010cb80 +#define PWM_DECODER_7_V520 0x2010cb94 +#define PWM_DECODER_8 0x2010cb88 +#define PWM_DECODER_8_V520 0x2010cb9e +#define PWM_DECODER_9 0x2010cb90 +#define PWM_DECODER_9_V520 0x2010cba8 +#define PWM_DECODER_10 0x2010cb98 +#define PWM_DECODER_10_V520 0x2010cbb2 +#define PWM_DECODER_11 0x2010cba0 +#define PWM_DECODER_11_V520 0x2010cbbc +#define PWM_DECODER_12 0x2010cba8 +#define PWM_DECODER_12_V520 0x2010cbc6 +#define PWM_DECODER_13 0x2010cbb0 +#define PWM_DECODER_13_V520 0x2010cbd0 +#define PWM_DECODER_14 0x2010cbb8 +#define PWM_DECODER_14_V520 0x2010cbda +#define PWM_DECODER_15 0x2010cbc0 +#define PWM_DECODER_15_V520 0x2010cbe4 +#define PWM_USER_DATA 0x2010cbc8 +#define PWM_USER_DATA_V520 0x2010cbf0 + +#define TOD_0 0x2010cbcc +#define TOD_0_V520 0x2010cc00 /* Enable TOD counter, output channel sync and even-PPS mode */ #define TOD_CFG 0x0000 #define TOD_CFG_V520 0x0001 -#define TOD_1 0xcbce -#define TOD_1_V520 0xcc02 -#define TOD_2 0xcbd0 -#define TOD_2_V520 0xcc04 -#define TOD_3 0xcbd2 -#define TOD_3_V520 0xcc06 - -#define TOD_WRITE_0 0xcc00 -#define TOD_WRITE_0_V520 0xcc10 +#define TOD_1 0x2010cbce +#define TOD_1_V520 0x2010cc02 +#define TOD_2 0x2010cbd0 +#define TOD_2_V520 0x2010cc04 +#define TOD_3 0x2010cbd2 +#define TOD_3_V520 0x2010cc06 + +#define TOD_WRITE_0 0x2010cc00 +#define TOD_WRITE_0_V520 0x2010cc10 /* 8-bit subns, 32-bit ns, 48-bit seconds */ #define TOD_WRITE 0x0000 /* Counter increments after TOD write is completed */ @@ -397,15 +399,15 @@ #define TOD_WRITE_SELECT_CFG_0 0x000d /* TOD write trigger selection */ #define TOD_WRITE_CMD 0x000f -#define TOD_WRITE_1 0xcc10 -#define TOD_WRITE_1_V520 0xcc20 -#define TOD_WRITE_2 0xcc20 -#define TOD_WRITE_2_V520 0xcc30 -#define TOD_WRITE_3 0xcc30 -#define TOD_WRITE_3_V520 0xcc40 - -#define TOD_READ_PRIMARY_0 0xcc40 -#define TOD_READ_PRIMARY_0_V520 0xcc50 +#define TOD_WRITE_1 0x2010cc10 +#define TOD_WRITE_1_V520 0x2010cc20 +#define TOD_WRITE_2 0x2010cc20 +#define TOD_WRITE_2_V520 0x2010cc30 +#define TOD_WRITE_3 0x2010cc30 +#define TOD_WRITE_3_V520 0x2010cc40 + +#define TOD_READ_PRIMARY_0 0x2010cc40 +#define TOD_READ_PRIMARY_0_V520 0x2010cc50 /* 8-bit subns, 32-bit ns, 48-bit seconds */ #define TOD_READ_PRIMARY_BASE 0x0000 /* Counter increments after TOD write is completed */ @@ -415,15 +417,15 @@ /* Read trigger selection */ #define TOD_READ_PRIMARY_CMD 0x000e #define TOD_READ_PRIMARY_CMD_V520 0x000f -#define TOD_READ_PRIMARY_1 0xcc50 -#define TOD_READ_PRIMARY_1_V520 0xcc60 -#define TOD_READ_PRIMARY_2 0xcc60 -#define TOD_READ_PRIMARY_2_V520 0xcc80 -#define TOD_READ_PRIMARY_3 0xcc80 -#define TOD_READ_PRIMARY_3_V520 0xcc90 - -#define TOD_READ_SECONDARY_0 0xcc90 -#define TOD_READ_SECONDARY_0_V520 0xcca0 +#define TOD_READ_PRIMARY_1 0x2010cc50 +#define TOD_READ_PRIMARY_1_V520 0x2010cc60 +#define TOD_READ_PRIMARY_2 0x2010cc60 +#define TOD_READ_PRIMARY_2_V520 0x2010cc80 +#define TOD_READ_PRIMARY_3 0x2010cc80 +#define TOD_READ_PRIMARY_3_V520 0x2010cc90 + +#define TOD_READ_SECONDARY_0 0x2010cc90 +#define TOD_READ_SECONDARY_0_V520 0x2010cca0 /* 8-bit subns, 32-bit ns, 48-bit seconds */ #define TOD_READ_SECONDARY_BASE 0x0000 /* Counter increments after TOD write is completed */ @@ -434,30 +436,30 @@ #define TOD_READ_SECONDARY_CMD 0x000e #define TOD_READ_SECONDARY_CMD_V520 0x000f -#define TOD_READ_SECONDARY_1 0xcca0 -#define TOD_READ_SECONDARY_1_V520 0xccb0 -#define TOD_READ_SECONDARY_2 0xccb0 -#define TOD_READ_SECONDARY_2_V520 0xccc0 -#define TOD_READ_SECONDARY_3 0xccc0 -#define TOD_READ_SECONDARY_3_V520 0xccd0 +#define TOD_READ_SECONDARY_1 0x2010cca0 +#define TOD_READ_SECONDARY_1_V520 0x2010ccb0 +#define TOD_READ_SECONDARY_2 0x2010ccb0 +#define TOD_READ_SECONDARY_2_V520 0x2010ccc0 +#define TOD_READ_SECONDARY_3 0x2010ccc0 +#define TOD_READ_SECONDARY_3_V520 0x2010ccd0 -#define OUTPUT_TDC_CFG 0xccd0 -#define OUTPUT_TDC_CFG_V520 0xcce0 -#define OUTPUT_TDC_0 0xcd00 -#define OUTPUT_TDC_1 0xcd08 -#define OUTPUT_TDC_2 0xcd10 -#define OUTPUT_TDC_3 0xcd18 -#define INPUT_TDC 0xcd20 +#define OUTPUT_TDC_CFG 0x2010ccd0 +#define OUTPUT_TDC_CFG_V520 0x2010cce0 +#define OUTPUT_TDC_0 0x2010cd00 +#define OUTPUT_TDC_1 0x2010cd08 +#define OUTPUT_TDC_2 0x2010cd10 +#define OUTPUT_TDC_3 0x2010cd18 +#define INPUT_TDC 0x2010cd20 -#define SCRATCH 0xcf50 -#define SCRATCH_V520 0xcf4c +#define SCRATCH 0x2010cf50 +#define SCRATCH_V520 0x2010cf4c -#define EEPROM 0xcf68 -#define EEPROM_V520 0xcf64 +#define EEPROM 0x2010cf68 +#define EEPROM_V520 0x2010cf64 -#define OTP 0xcf70 +#define OTP 0x2010cf70 -#define BYTE 0xcf80 +#define BYTE 0x2010cf80 /* Bit definitions for the MAJ_REL register */ #define MAJOR_SHIFT (1) @@ -665,6 +667,16 @@ #define DPLL_STATE_MASK (0xf) #define DPLL_STATE_SHIFT (0x0) +/* + * Return register address based on passed in firmware version + */ +#define IDTCM_FW_REG(FW, VER, REG) (((FW) < (VER)) ? (REG) : (REG##_##VER)) +enum fw_version { + V_DEFAULT = 0, + V487 = 1, + V520 = 2, +}; + /* Values of DPLL_N.DPLL_MODE.PLL_MODE */ enum pll_mode { PLL_MODE_MIN = 0, From patchwork Thu Nov 30 18:46:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Min Li X-Patchwork-Id: 13474810 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="rqr4TBia" Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11olkn2081.outbound.protection.outlook.com [40.92.18.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 777C210E6; Thu, 30 Nov 2023 10:46:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DiYFcEa9dZ+Qm+JCwGKstl/U5ImQOfqIgOakfYuaIP01iLYaViGjwn+/CmCkQr/6HlMf2O0O50vAMhpNM/1Vi7nA8QuUmQm7ZX7cyWznkb56i4RU+cBv8hd5H6tTZs3yhLPaJ+ubud5xxB1th3To0dZTRd3RpggFf0BTWMRHRG4QrktyeL3KplSwnbUBhrlZP9+VoL/upwBEsWTekGsmm6BZJjubukyKZORjj2Cx5pMdWN7xJxv41rLimZ29YMMvW8uZbtYVWDfwMYsY4apeMn1p1tFLPUgxsEV5BmfFYqfbLqu3aBT1AJplbjRIvo/jdwS0roM+VhNGoRBZIYqKIg== 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=8CooryLmNa1dj1SA4KgSc3T9KA4dLeGUZnSc6Ztcfzo=; b=KDb8X6YK2YYyKar7sPDjY5J5K9yRK7U1E2UurE6rcf86j2Nks6/LkeHmZsZzPZRRMAmeP9vO5BLk7dzMidZMUCf0PVaZZytsrRZF+PTmB/UBA7TgU/WdhN2sxSXoY1SZmB1NqDp5DPbmvOri4V/XHkqY526sMFE2gXlhphntC62QOvj966ue3fTFXAI8GaQ1ZltHySNyRwKuj7rupMqaJaEwYc1YjKaD9L+3mzPwyVYaB9tJbagS5o4if464+Qs+FnCXhbrU/u+zKL/3OEahe/jkQg3w23SORXdvw2TfpmMa6hR/9jbwR4EDm7TLdU2ng6b1gL+RqnfCpQNMhFkfOQ== 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=8CooryLmNa1dj1SA4KgSc3T9KA4dLeGUZnSc6Ztcfzo=; b=rqr4TBia4f/JgXFp/6Y3f+CXelBiF61O9yZ+X1YMqSHiwCCX3hhRcH/R8fG6NNfxZVCT54u/13EMt3D4uaCHjThLyDfPzw5Bf7hAU3qdmLqDuVuQ8AoQs25cikWIMO87tcyTh020l+Zb5kVqZeOs/022+KVbO3ibZHs9LJsYPM3bsV55OvC/0E1Udx4cuwM1CNOgvugnShfb3dIJ1ruPUVeo+xgWUOBeHdsz2IWoI3DX9X+OFehtfziiJH2E62so+VoU1ZOa0z59x9pF31/89Qmpju6+LFYBf+qi8SpGumyev/HQtfQYeTkHvnr5+pF8wTnCY9YVjaCKhdczf/+e0w== Received: from PH7PR03MB7064.namprd03.prod.outlook.com (2603:10b6:510:2a5::8) by SJ0PR03MB6779.namprd03.prod.outlook.com (2603:10b6:a03:40e::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.13; Thu, 30 Nov 2023 18:46:51 +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.7068.012; Thu, 30 Nov 2023 18:46:51 +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 v6 2/6] ptp: clockmatrix: set write phase timer to 0 when not in PCW mode Date: Thu, 30 Nov 2023 13:46:30 -0500 Message-ID: X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231130184634.22577-1-lnimi@hotmail.com> References: <20231130184634.22577-1-lnimi@hotmail.com> X-TMN: [VWfRdhi9pgAXfe30cFSayPjHIqBz3suH] X-ClientProxiedBy: YQBPR0101CA0262.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c01:68::24) To PH7PR03MB7064.namprd03.prod.outlook.com (2603:10b6:510:2a5::8) X-Microsoft-Original-Message-ID: <20231130184634.22577-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_|SJ0PR03MB6779:EE_ X-MS-Office365-Filtering-Correlation-Id: f7585186-b48d-4ce5-7bc3-08dbf1d4b6fb X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nD4PEuLr2PPrvvVIe0lD2A0lKoK5M9giCOcpBM+8QT25kFkyvqxmI8ehXbWnvvTp/EOIPmeWEVRd6dEkgJO4Cn+P5QCbePTT2dF+h8CdBQ4hh0nmPQogqOsJEQJ6aASfc3LVvsNEuQVpGvKWUYvYKgob20iFKn4sYlIh2vIFxzMmR96ToaZ6bS4y/KZMa/cHWt4VBHqc712osoXYUokE6k+mYfyKlMO3vOts2Ak/rt7QIeQVS//p5ydPZLK7KKwYG8lmmL/BfbKNsvInbkDcvKMkaZM/ofCJVXVWDLV6GUV4RdQ1MuEH+ak5cuP9CO15kN9L9MZIn7a1pxU8JINMPipGRPOrX5gRhMAdFS4L/R9C/0fkrou9xtED/d68k1V4dXT9yS2PW1s1VXj8s6n3cle9W0rhBP5ObGxJl2cXisTrNsJEnG1BhhB/TSZXg6XUzFbMlF0HbFGW7Lw/zmSUCMNjlouT7fKVkLP1vOnWoJaygPm18konVaMhgZC2MscpUCtcufv8s2KUMoJ5cz1WUp3CTnIxoGVAq57OaMaVVBUQdFi2Nogujb1XgNZDOJsE X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: m0dhl6Cb49xDdjrHIKfsCUFbdxGdySomNNMZjK1xtIfHAbeCWRaS0Mc3hyopo+klqi9tCDiY21jA5ZKE0FJ673hPiseT/JWd5/10Snu4B6cdRe+wdHWcUofEUEbEFsCSOwAjxJoKbM3Ii6PikorzwfouZpcr6M40HKJoX8KX/qusG/C9jqlK05MwP0V7YaOcdpCTqFHywTQvmKRyEu+LdW4nWV7TtuOkbUdWo0mfoQa0IA/um1zRmbavcnkMZ9WlsNZpQimKurkS97GG3kdCaxEQfi4AiFEg4NmD7tnAC3dbj3GOFlG9sJYxRwMDlYIA9Sc7VJAbjOg9hS2tmgtHffAJO9t6PdCQZeWt2Ai7dRSd3TG1OnDtDnEFYH8ZqJ86xuhS1sQ178KqQQ6S/y3SyNmJRg5p/iroHveSn/qlA5vCZ2m252imb2M030mLidamJTZGW14SOVI85XRRawCKrxV9s4dj9cqzP6RuTNXd/ww+jt0kHbc5ghgp+3GH0ka+vS3Vr4EWvHHF+8cpUtZkBYmXNmvklP/vQ6ctWGnleAkfR3qNkU1399dFt67beilU7m1RJeGahq3O4MXYzNaMfVCtBfTKR5MVI2+JsNVVTDvVMK2vdzCgWtnsrx5MNEb+HO88z3/nVlWfMqJ2M3EJeok9ZDa1ud6xI30UYKkA6quVU94IgfSls97fI5WB7W/r8ryuVZE11JF3T8enejLHq+U5UzQ0GCbzDvCf2D71GqGYsrtg3iOdzwiDo9LkOoI7ePfYb6uK/qh5IkL05eobDqDKcAInQqhNNiLY1kEpPjCHivml5h8Hs5WHG7gcSoZWMXBJryEqirWyVdpU+6Oqn9WcFCNQTQxN849ykysublf8YQ/E6uHjBBy7MRr7gyNj1nDoTtZ5A9hKyI3p5jzFa/0/vdQGj1ifsreTr1b79iwud1XWrX2Km6QuJgYrWV6elxbcsOJ7Mm2E9+qQYT7eJi6GPPmBw4k/S+jyIty/5gU0JLpyOWaeNz1xu61Potch8q+CGeRzuEjgQhIkcUOWanMUFTyQBza+mMGPNiVAsA7qRAVVbywrlIz/eVk5+VxgW8Q/+CPrH4G187mEZwIl2hYj95fYQLoMU7UvsTf3qg1UG+rM2RJwnsICAvQ2NPgrO62r8fZSlgY9gUtVRuNE1W1aSYulkeKZkJQPl/4avKt+vrTW1Gxv0Q8Q2jcaGJxjOfYRoyLILUymjKD4vTcb5Q== X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-685f7.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: f7585186-b48d-4ce5-7bc3-08dbf1d4b6fb X-MS-Exchange-CrossTenant-AuthSource: PH7PR03MB7064.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2023 18:46:51.3963 (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: SJ0PR03MB6779 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. 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..6d55da54e496 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 timeout = 0; + + /* Setup WF/WP timer for phase pull-in to work correctly */ + err = idtcm_write(idtcm, channel->dpll_n, DPLL_WF_TIMER, + &timeout, sizeof(timeout)); + if (err) + return err; + + if (mode == PLL_MODE_WRITE_PHASE) + timeout = 160; + err = idtcm_write(idtcm, channel->dpll_n, DPLL_WP_TIMER, + &timeout, sizeof(timeout)); + if (err) + return err; err = idtcm_read(idtcm, channel->dpll_n, IDTCM_FW_REG(idtcm->fw_ver, V520, DPLL_MODE), From patchwork Thu Nov 30 18:46:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Min Li X-Patchwork-Id: 13474812 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="E1FHwBKI" Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11olkn2076.outbound.protection.outlook.com [40.92.18.76]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88F6210DE; Thu, 30 Nov 2023 10:46:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iydVL6Ry7fki+gH4oS27nnziUHf7AtQSStU04wj1h7EnYccQzvZO1mOFb3S6u9qyJVxi0WHquEvyD538c7F5G78Yx6mYwoxfJVyEgkracu68SxDqGUGrv5SiKRSoPd0WQb0fE9eo4sIZTbgPqnuMQQOlYqoU17Nm7nhSsj9afE7dxHvk0dJg6Jzm62kC1Zk6kLJEZnjG7BryEpjMjG5tN0KgXojzSDplhVYUie73IEAFgUXC/GH8AFIoahpPRKKpzOf6070NYSVxHq+rIFOPawofivVZ4IxoIz2K2+1ib9ugOjE3++pIRL5x22dgAeLmonpMb2LMtZttGk/facSKIA== 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=rnYg6tXqS/UXyC0JDSDC8eyG6rh0mINlAAkhRQrZuLc=; b=SYJhab2g915G3VqYl3b0qOQME7r6kmNI+FnukJ2V8FRGhYFc/f6XmpwYjKagu4n5Zk0sXo6QX07H0JgLQmclQWh+OXk0QxKuXuWpaTsYkyCHKEa6LChEjXw9+ue8t3myu9rt1DhhiJHK3UmJi9myo3byXGpgafUy7rYfB3xAsal9AGAiIXRFgMkUs6YuD7CyT26wFieV+KcVSJ16qq77UBvIG5X+6oZ4AzQLRqxoU3Z6OU1Ig9KwFLPT+4Q5RR7OABtVqRKhjtEBNR9/tolM180lLZ4/Gbto4gaD+0sV8zqqUmtg1wR5CUjkwa5qfKy9RnqmlMWDoRJV1CrSgmSMqg== 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=rnYg6tXqS/UXyC0JDSDC8eyG6rh0mINlAAkhRQrZuLc=; b=E1FHwBKI7SudhXw+O98pA6yVQiIPAY37y2VnaiFuGmDUd4p40KZ/ji8MEmwXeb/Dd7nAztqBvoKKOJWMWotfn9o0cerf12YNTCCW8qqfS2kNuPkHa+nM9pYW4m8LVwSBFhV/LVYQUErmGsEa5UAb7riTYvcyniOOqLBe5y466KwOdcgM2riCiHpRIkaKzO74Lo7XYSs2srQIfLge+0EMtlj0DNPnlnqlW8JRnhjyQQUhs5Vc9OMhZPM5n43O+MbO0Xy3cD5YmuTyzrud1ZmLh4J8Mk9Uttz05UrN7ztcWa6m46+vy55ClzLvZ9vqxAVDxGF26dMJsgBxuIE6hnmQzg== Received: from PH7PR03MB7064.namprd03.prod.outlook.com (2603:10b6:510:2a5::8) by SJ0PR03MB6779.namprd03.prod.outlook.com (2603:10b6:a03:40e::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.13; Thu, 30 Nov 2023 18:46:54 +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.7068.012; Thu, 30 Nov 2023 18:46:54 +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 v6 3/6] ptp: clockmatrix: Fix u8 -> u16, DPLL_WF_TIMER and DPLL_WP_TIMER are 2-byte registers Date: Thu, 30 Nov 2023 13:46:31 -0500 Message-ID: X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231130184634.22577-1-lnimi@hotmail.com> References: <20231130184634.22577-1-lnimi@hotmail.com> X-TMN: [BOStujframyzf09/fZBCDl7yndnp9D3B] X-ClientProxiedBy: YQBPR0101CA0262.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c01:68::24) To PH7PR03MB7064.namprd03.prod.outlook.com (2603:10b6:510:2a5::8) X-Microsoft-Original-Message-ID: <20231130184634.22577-3-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_|SJ0PR03MB6779:EE_ X-MS-Office365-Filtering-Correlation-Id: 5002e956-d910-4a10-3fd5-08dbf1d4b8e4 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UtxiddZHvfUUlrBCWNRbogxjkfpjkFMXnxo5T7G1DzDQGaC38YHyZZV5tPfcrdDOngGA8/mbUxuXvphjt7lfCDbjuYOVX3unVnvvxTZCA5Wj2iTdFKoS+Kuu6600Z/62BN0f4WLf/I58hCx47/9eiiEmraAzKu1ODdPhtgzfCXhfuYuXQuDl10/hN7fwKUFUczclvHDUpxUyPQi17yf83C2H3KohR5S6eNq4J7ZGqqe7v15yOw0aCwPDbJ4gVyi0TADYsFvFl8HG3Ik7gMzBMdlFbnDqYLn2VLzDAJQBhHich7arHyBWliN813ckswhGc2WFWH6/MMISyWt0ke+d1TYeqVGp1T1C+4Ya82tleqxe+kvDVffhqN2SNDt9vhs2DjYZ6kzJA8Mgw6TUxvBKHkDnFo9bh6z8+Q7XR6rHeSUW4C8Fj/vzkUMPMtYQ/c4ZNxeIiMZ5oqPOKtHYDPhcNkewgIR74/j3jOI5OnIJqHFOHgeRpudgvYx8P8b2LmALhhVBLBmrL/szBSKOof4OCjr6A+egH+NU2cHe6DVA9x09w93zBEaQBtT0KFrTLzL+ X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: MEoAOa+puwP4E7tvkG/MjoDyYLOtX0fztxp9gL2dgTiFItg/MSF/Jxcp4ya4LnZMs4ZR9Pn/7rjr8CuX1FBT+K5jgT6m8EUCPUURmdvlhL48cE9qfe+p7YvfUYYKpeSfyU+81m/bEN4VkzmJQDCT+KfU4Ie6OnZcg2LyKHxUy22EpDtBuosWveigJyg7SUUZHAl6gDp9UxjMMYNT9xp2xSr3GIGno8fzuFAANKLjPuqXpw7Kr4mUlcyQvwEWXwjPIJn4/iMjS5uI6VBmN2WgKBQECOSmJORy8E4/Evsu8SwsAom6vyrvGTotAOMIbcL1jR9Q6j7BjQztf0IN8WFIasIyMyBrbntJkAdXiarez7S47mcDMgVrddj6PJgshic9VizOkE0XKz8DWo0rLMJ4QJxPH1OuL4UX31VwhVCLeuAuQA4Hn9Yk3GmPj9qe3OTT4WQ4ukOCqpcrlVBQtvxKsfqB/uSOI0GNye5iIXCFQlDDso3PhXpOV7pGTVL85JtYE748uoup1p6hSIkTGNt1Mnv2akai+oJV/8aFVqlS8CTszpMuNTVAAyaiU8lcPtEOt2Q4Z+hVFsTYVDJ96Yj356i8b9DhpZM45o/UgOK9u+TzaK5ecGoCoaHEwZcyg6HkWBPSu4gT95JoNJghsxmYlWUuefNqGS85NAkrYMWG0lXbDu7QB+OadjXauZqvScsSajCo4d94AkRQxjwJ70mPYDlT9NMHHmkgWoBCd7Cyr+FYGn815Ty68aRkTNo+jXSt+YRoHiggLy4TigWvUVHTLd7Z+WEVJOYj8IIkbqNgWtmy8NlSwkkgaqto5XR1PukHd2vp8/bNAwVKo4oqWaTH04Ivtsk5mm59TktIQ/MdKqtxfMFMZVnn8gRNEgn+Ng9hOWJ+u1AoCHFm134BVikLGSDJhYkJCIlsBMKq1Gyii/i7Op1jE8wclDC//5ZolKoq7H77tTJkZAaE3ddKp+oXsF6sPixQvl1vYXoXXRbSOg8i6VlGtpbu5OiQKm9fIUZuVsam7++DY4nk09iHd90GJPh4DRh3IP0hxJl8rfVeb39KOuUP2rioc6VDDyMnIzIC1xE0HrHFR9dtvWCZx/UGHflVla5cFfIml+bzVVZfdmTTz13RJ7MnGgj2hPhWlJEGgnCMDVaUiRKkSLdjl3cN3yKFwkCQA1/GhVxaZuL1U7rGweuI5XxNwqCUh3ikyOrtnIcxEsZpIw6L0BYOGgM+Sw== X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-685f7.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: 5002e956-d910-4a10-3fd5-08dbf1d4b8e4 X-MS-Exchange-CrossTenant-AuthSource: PH7PR03MB7064.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2023 18:46:54.5853 (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: SJ0PR03MB6779 X-Patchwork-Delegate: kuba@kernel.org From: Min Li Signed-off-by: Min Li --- drivers/ptp/ptp_clockmatrix.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/ptp/ptp_clockmatrix.c b/drivers/ptp/ptp_clockmatrix.c index 6d55da54e496..d069b6e451ef 100644 --- a/drivers/ptp/ptp_clockmatrix.c +++ b/drivers/ptp/ptp_clockmatrix.c @@ -1396,18 +1396,18 @@ static int idtcm_set_pll_mode(struct idtcm_channel *channel, struct idtcm *idtcm = channel->idtcm; int err; u8 dpll_mode; - u8 timeout = 0; + 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, - &timeout, sizeof(timeout)); + buf, sizeof(buf)); if (err) return err; if (mode == PLL_MODE_WRITE_PHASE) - timeout = 160; + buf[0] = 160; err = idtcm_write(idtcm, channel->dpll_n, DPLL_WP_TIMER, - &timeout, sizeof(timeout)); + buf, sizeof(buf)); if (err) return err; From patchwork Thu Nov 30 18:46:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Min Li X-Patchwork-Id: 13474813 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="RTEFs+MF" Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11olkn2039.outbound.protection.outlook.com [40.92.18.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48C2210F0; Thu, 30 Nov 2023 10:46:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZcOwEytcXFRwpvFqGr94x1W3RfkmbsU14VDBRn0Yvni62zcR26Aa43DOQZKW3XGszHbFL8UeBS4Mfvb65KwtfjVQUAiZQzCDVtdwIdGZJtGd70gXEqFMJaU51yXOTKSQGBOxmXlnXfApkIB2oO2GkwIYt9F2vdQ4Opaxl/sl9pmqYX0ATruEdOhOvn53wkno3+6mam/DtBzGGQ6LNd7v4BC9MnYgsBMyjncymNVEywXfCUryPwn3aAqVe4kpX3yo2DaXwLeaRynxdgzV8WK1wery5rBIVi6FIVFgRBDy9/plv5AdRuOUueMkAEjP1igw3PYY7kK5pDl/OjeV6/Hznw== 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=tCR4dH+nSgJwKX/AKlXC9LZZ9ptdyMnaaKrpFcXKJSc=; b=U08RDgAEnQxQFkiyhnPnHK1h6nDuTHgvBB0GR79ii/HMIcsMdj4B474mvPn/zqvcEL/jg1VGs0MyfXZHqHglVQfY+parHsHZAcGYeNq+Igw8Gkj1++nHEfMqvIFx5y3KPCBpbpK1NnzI2XQuvPcDstKjiE/GX6zeSfcpKiVfEq+wwxW6aFc26K46aBp+kjjAiULjaB+dl0TmIpYvoa4klfFjKApBLNv55cGTZw003SlUCpIcihZzz0eAZcTU2+aSM0MneAK9NcJlwDwbiBHLeGSH3G/u/oWrjhuQn7DqWNijvaPXPNzx/1AyTOkFENErqQhHXkqDewSj1Oc8rtDUdQ== 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=tCR4dH+nSgJwKX/AKlXC9LZZ9ptdyMnaaKrpFcXKJSc=; b=RTEFs+MFwPa4FT0myzLvee5LDONmJp9fyKYrji2S94ECkEcqaBfrj7/o4PaE5qxLolvoADz6GOsUmmM2R4bJ7losjWxzJdqrKrbYdr4NgG58Rifx7eoU36kCxliRdK48a9rWRie1ahaxQhdpY6AjERB+AxEHXgSI1Yrlr41bIdqNsGFzNwBTvonEKKiKag9nYOdXgKWLtHeq56GvALHFmzqOEPwPlwlDFndrP5uGhJi895VjiaQ4UBE5qJYeNONRT28Okkv5umWuveILpsz+b3BJvIyHZM1KNBJ5Bmd+qZ6cwZmFgEUmxsXQwSWK4FJ60BuCK9PF4POJeAFb4+95mw== Received: from PH7PR03MB7064.namprd03.prod.outlook.com (2603:10b6:510:2a5::8) by SJ0PR03MB6779.namprd03.prod.outlook.com (2603:10b6:a03:40e::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.13; Thu, 30 Nov 2023 18:46:57 +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.7068.012; Thu, 30 Nov 2023 18:46:57 +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 v6 4/6] ptp: clockmatrix: dco input-to-output delay is 20 FOD cycles + 8ns Date: Thu, 30 Nov 2023 13:46:32 -0500 Message-ID: X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231130184634.22577-1-lnimi@hotmail.com> References: <20231130184634.22577-1-lnimi@hotmail.com> X-TMN: [C0hL0toyEmrxLneOU1BepbnB3dnHexEK] X-ClientProxiedBy: YQBPR0101CA0262.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c01:68::24) To PH7PR03MB7064.namprd03.prod.outlook.com (2603:10b6:510:2a5::8) X-Microsoft-Original-Message-ID: <20231130184634.22577-4-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_|SJ0PR03MB6779:EE_ X-MS-Office365-Filtering-Correlation-Id: 953bb17e-b09a-438c-1b24-08dbf1d4ba83 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YQstSANJ3QnGOJgDcN92X+kXcqPn64noTNxAivSSunn/j062aY9edyEYBoeyjt9bk1Q1jdfzOwdvFvJQQLvR02nkIAyHSSVUJOGm3+yGsy3B996OZqHgdlFNV6VrYJIP5h+6KCo3anX97RHp3Umbmzam7Ndluy5P7TeU8oKPLWiyCsZgU3WK1fvjcTBqAR3jsS62/6zkVcu1azoglT8NhYhk9Pg5FHqYG6bj/9uBFSIPIdFJB4UTiNKACkLXYJDd+Zc2PMQg4rZeRi7hUyYao9Wd0NWweaq+7lbOVqHBgajyDAhnu12WCoFD7+LQX4okonW5unrYeBODi2jnGxmcTKGljpAy8t1jxgPur5OigIEaQpAdyj9vqSDHs2gioADcm59zK1ntiXDIk1KMGFDhQKsMyEBiHXEjIWyA75LzE1bxFVuykiM3kIGx+8MtQoN1Sp5wHJiwQZAWULZSorUqhgzM4yNtXfNBg/Zpz9sbR07TyLQlga5vq2eASaRjx0x4oIqx9Flp7HanReamDNUtWlo5Tin4PQaazzevUaPnn47Iel5zjLSg8MwaEhCkYX23 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: xOghqp2cUTOdFn03wE5/gi7zLvWdm2Kq9CDftZH4QKDkpoxcsG5DgYHAonhbGvgba2quzaDg+GtcLSnLGcK417wbleaUQe1k6gtmVgQxZGy8nqeYkTjb+DsijNimISfyy0QNS+NV4WeHuJ/VQtEILQOtN0ufxtn6ON9inZ8b2ONsix+SC2v6v1Oa5/Lul40to6W6pirhmh3/WBzx+fLMTe+z5sEgZeBElCDav5YG/DmbtQDbLtYt35qEaobpR/lqNS/2WLJUaRau909QUAzsDfaSKOUW5pGPgAldg3MDn0SOWiNYLqQEo6uSGEvQ2Ej/7o0kFS/W30uT0WudJgUvR9Md5y+8L4xtLV6jSjyT3XtCaYpLbeeRFMNzAWCdT26Kq1t7+HYGdeAOjXnm/FXCJ+SrtUc9E8rO0z/lDlke3eB6ruxsd9Cfms5YSI9EQTKGhxVmeRJU53rn9Ey4iIt27hmT1bnEKekmq2+NzRSnz15HSAhcSVubecVR9kN/CDKUNQlrY0xk1wOOH1CGKBj38h4c7ozvya689ArT/F58A/YtRI/YqcLJeqvWP55jMfad1TDEiDNr21Vf8+fev7o3vaSTCiCcQFjTXaudUlHtBp2bndq8TcUhM8da8ln28xhe9BiVG6m0NqlIv/3ERd7KdA+6c05FFde11Iv60C0rLvP2trqPmm7Ea3t3elZoTO6gwT0Y23F5LPDaxOfXqQJaplO/RpKAG8MQOc/oxmJIVLUh3GE+CNOLgA9ywmlhIj4+Y2ZblsBlyP+1aoIltOdln+2jGuap6B2E3eajlqncNovlTs8zsxf30YRf3T7XJFBF6+Lg1/QgOUL+0stHMipN8xAZ2Ldg8Aj4A+MEu+DpdWtSTlh5PldeD/aXLgbg1YuZkNq8IQYVY+MJK8FCe1JF8TxMkEreob1rf9sa45OM6qqCW+NbePNVb/hKpYjAHnRNmiZrc2oFENK6aG4XN3jW7cWXrQ8wRmJl04oZqnPBomh+9JwRTRiy8tIX/iJGZv5if0ullSP8bbrOv832gXv8tZttl8qmbX3QH4narTQuBkE5+6f6PhdBcoZ3vPKkgrjIoY0V+Uy5L5pcr2sALCeFHjol7guAMHpoMXWcMpxZtC7eBGfGFJqBovgW63CcfATvfY+rFTP6xRjRDEAto11lEuJ+vciiNuxiDw0DAghMkmTqMZOi4aJjjP2zCg3tG+/OlXqSwtaL7jmOEBMUXPdSNw== X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-685f7.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: 953bb17e-b09a-438c-1b24-08dbf1d4ba83 X-MS-Exchange-CrossTenant-AuthSource: PH7PR03MB7064.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2023 18:46:57.3089 (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: SJ0PR03MB6779 X-Patchwork-Delegate: kuba@kernel.org From: Min Li Signed-off-by: Min Li --- drivers/ptp/ptp_clockmatrix.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/ptp/ptp_clockmatrix.c b/drivers/ptp/ptp_clockmatrix.c index d069b6e451ef..21f3a2c179f5 100644 --- a/drivers/ptp/ptp_clockmatrix.c +++ b/drivers/ptp/ptp_clockmatrix.c @@ -2165,7 +2165,7 @@ static int configure_channel_pll(struct idtcm_channel *channel) /* * Compensate for the PTP DCO input-to-output delay. - * This delay is 18 FOD cycles. + * This delay is 20 FOD cycles + 8ns. */ static u32 idtcm_get_dco_delay(struct idtcm_channel *channel) { @@ -2196,7 +2196,7 @@ static u32 idtcm_get_dco_delay(struct idtcm_channel *channel) fodFreq = (u32)div_u64(m, n); if (fodFreq >= 500000000) - return (u32)div_u64(18 * (u64)NSEC_PER_SEC, fodFreq); + return (u32)div_u64(20 * (u64)NSEC_PER_SEC, fodFreq) + 8; return 0; } From patchwork Thu Nov 30 18:46:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Min Li X-Patchwork-Id: 13474814 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="r96MYxaz" Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11olkn2078.outbound.protection.outlook.com [40.92.18.78]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56CDF170D; Thu, 30 Nov 2023 10:47:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aKuJ9NoOjLw7X7ASF5jSmO31DtxKZS2Ou3M0YQ7FIGwCJqsLYQHmNkgdAahZOrfw0dD4dOsrj2XZvnScssrFhU90O5i0vR6flplA3p9BqLo5QsrgjiZoRFNx3NSmmiqpuHJwlEsIaVI6Z/9glMThnBMMIOnvDm0zAcYpG71domWxPO6zAm3oLf9tTfwFmJxzC+SaYts/jUGR1PZzZ6DC85y0Y9+NwDN9VnfqcPdN5YKukyJF+gD9q9/ZVtjcs+cDD+wY4zXfEKPqVXdbg3pwYekoVREP1AuqPXox2H7Q5rjAZSjkhSxkj60vGAinwp/qxqjMbVGlziaskQDkOcMqUg== 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=yoNEDh+iFq7lzKBU9CENiMetKrSdJTglln2bu+84U0E=; b=hW0i0gQ0UoBY4EtRvoQ4yOnCJJ/KtxHasBVVDEO3wTznY4aC9Y+6H48wb4byQWXyquOeQJAJeBHNgJN1enCAu0GzH3LEpeSuvOgxBZpdLJa0yEATm6YyDIKsudT6Gs1v+2cy4QbNNYdM634NWn5I1JoqsZBuXe2H5nR6YP+dWcKMqUCTqkPmhQWE91+Z+E3Wqz6ecWNCCWob6QxYhLcyP5Xhmr23cxb5bvEwCFZ387I5ZtsZ2+q815WJ9AyPkePKJ+xheS1friXss1gdaMg5DKmBg0+B9XT3EDO69MmoBcVmlxQB7H4mqk+4pIiEIDQ14BAyvpdrN6/s8OnaM5FlVQ== 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=yoNEDh+iFq7lzKBU9CENiMetKrSdJTglln2bu+84U0E=; b=r96MYxaz7+cJQTHYBO1Lqk9ImJjP5vgldoyV1Y1nIOp2WbrO5vFR7tMWtkycr3eknA9sEjPRh12cbL0AOLvHJ+8SNjM/h9GwMxbUrscnQpXFYBNAuBAzR2hmPDr/SuOFSOJQQvd5oSztzuQ2BxbVhxQ+32fHo8nljsJnlSykjXiCrSepLzcYIO4v2krWMzatdzb7n7QhIyQECaPTU2w2y4LrSuC0aOm5UQSb11pziBqWHxJ2RL5G6LUiJLE4KyZouYuxc1j1MEnHOD6sZhvGB6f0ScoORX86mevCYhJhEKY+RI/GH7bRQz+/eMqKOmARnpdEq7+V7tA3bd/mUAg+Cw== Received: from PH7PR03MB7064.namprd03.prod.outlook.com (2603:10b6:510:2a5::8) by SJ0PR03MB6779.namprd03.prod.outlook.com (2603:10b6:a03:40e::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.13; Thu, 30 Nov 2023 18:47:00 +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.7068.012; Thu, 30 Nov 2023 18:47:00 +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 v6 5/6] ptp: clockmatrix: Fix caps.max_adj to reflect DPLL_MAX_FREQ_OFFSET[MAX_FFO] Date: Thu, 30 Nov 2023 13:46:33 -0500 Message-ID: X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231130184634.22577-1-lnimi@hotmail.com> References: <20231130184634.22577-1-lnimi@hotmail.com> X-TMN: [pgBF6m/n465qySNt0c7UOXsedwtjImSB] X-ClientProxiedBy: YQBPR0101CA0262.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c01:68::24) To PH7PR03MB7064.namprd03.prod.outlook.com (2603:10b6:510:2a5::8) X-Microsoft-Original-Message-ID: <20231130184634.22577-5-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_|SJ0PR03MB6779:EE_ X-MS-Office365-Filtering-Correlation-Id: 0ebcec75-243b-4754-f59f-08dbf1d4bc21 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tNDDSOBTznFAwxTtIgmlZv/mzJfwKycypbS/OBCspnjz7s0JRpuEuCriaOVDqds2ogljn8SSqogaV4SZOwh45ec6YaTtcBNvd+Sb2TvuAp1WWqzM7wJFY87VOBZgHgPeSRo0ylapi37hbjF9xlNWkAtx+D5Pd6rsYPHaxg4bdOJASmrIx+MO8wRhHRPvorVMCn8yjYe5Bp4/+Eo/PbY7xswvERFLIx55NwWhNCJJ1WzlsYkwe/nYec2mfERDfDnSBdySg/g6E6E9G0kQGiTdkZPvvzcnCOLiGRVweEN5h0sw/AkAsak0Gf6m9dmVP+Q59woBlimsIZnZFZGuvoECKbm9n5uQ1r5KaUxJKgjOrFfge0PhKTmYAyHVco69k+QZoHHx6PeNlqcMpc+eOgDnvMw2FZwHCcYmVO4ZrFWCTyuEhvivjPN9xCb90k9nkx3IS1IupMLsFbobINU4AAUGnbLRbyNtKUNJOUiYLC0XfmLfHnNsi4DkN83aiBWf470rxXmO548E+THJtEtD6smeDIkvzzm1PNZHRq0mfy1w9fsnqOfTKYucThnJ9/jt2EPl X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: +2dL+7MSzUvpQwuDgD2JUY5ozyTLa/NiJAPGX58p/QQ6JP4gqd4mPxjdEfufGp0ltymRWuiLoS6PYsibfZjIGWePNmjBCdGJm7zhjmHPi+FyL84OLJO7Xbjq6BKvzQEtXkWUGDsyxWb9p62BuXn29M+KoOrsJZveVzSn3mEpnhJh6mpL3X68CpqTFaXn9Z2tGCaiduehvGlizoUyV3jIal83+0N3vF0tIeBS9vXPITe9ETO3ngTEvn+pHUS02Ht1M3j8le0sD805/HL4R4pHrV3XRp3r/1P7J6/ySdDoVE1tPbw2mjWPtLz5T3KjuM3cNCOUfCuRo3tzCbm6wtDmklq2zARxPzu4cxgyjOS6f4E14IItPYHTsKeZjwWs/GOfyyCWJLflBbxSREbFVLiBamQoBaSVGHxd4YrdcYDgIXs9z2DI2q4F9zcJRBVit4erkX69JLQ8P83TiaB5AbIDqkpcpybOrpijL75vGoGBUIannf/1E8N87b7i9dZMUUCShsvkqUMzkPNDm10Ggr18WlR+3QHcClcQCqRoyOlowBid5lUjZKdnTIpMHk1GQSViefO0yyExfYQ2SD4AZ46G+kLPipIpgjJtJB8ZkrimK4qX5mO4rFUux1UZWoWxLILN9oXj6/ysRcn7wijFuKvMj7aVd4o1xF83GfARwlGBjd3o4riJ5JZOj3H9E9Sd2NX5j/aVffc1WAkHqoweFEoPVgkhO48Z+q07evOQHHgLwcvY+JO3SLifGuZ9ApmYV3Y6xnG6IBeNwfhfRG30rSU6XOHMeatPaVf04xyovD5414e+kScRmHfSakm65vb8zOKptgxomVXP9blT4iee/cR1F4/FfIB0XOKL8SpJfBILfk2lU1hGUk6/IhieyVepwzbte7KUboKM+m+9LdY9I3o+j8esAXnhDdj4imPTHk+d1Cm+CfA/ixeR6X4PpYvoVwpvTADZkiMMCypKJ64pKLLkgb6l6vxY2OL+kMGK2lhMllcJGlvdRRfkQhmtbJhFBIoPUPzNSiCHp08srGA/xxHVWX36NAP20qSE78AHBQ8c9yszDUF/5z+mJH32Mzhhece3dCtNNE+gq6wr/lLKhfzyg16GtbHEfo7QqSpT8NiyI+tPpc12ildtipvy3q5dWLRJhIpUSL8ghVoZluDOmsRX9HrZmZD7fuGRBvJs7KzXV4tM83boACJgCsJTyTP3PteA2kgG31hdfkr/FY/xkrXz5w== X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-685f7.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: 0ebcec75-243b-4754-f59f-08dbf1d4bc21 X-MS-Exchange-CrossTenant-AuthSource: PH7PR03MB7064.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2023 18:47:00.0779 (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: SJ0PR03MB6779 X-Patchwork-Delegate: kuba@kernel.org From: Min Li Query MAX_FREQ_OFFSET register to set the proper limit. Signed-off-by: Min Li --- drivers/ptp/ptp_clockmatrix.c | 43 +++++++++++++++++++++++++------- drivers/ptp/ptp_clockmatrix.h | 1 + include/linux/mfd/idt8a340_reg.h | 1 + 3 files changed, 36 insertions(+), 9 deletions(-) diff --git a/drivers/ptp/ptp_clockmatrix.c b/drivers/ptp/ptp_clockmatrix.c index 21f3a2c179f5..cd7b3110f8e4 100644 --- a/drivers/ptp/ptp_clockmatrix.c +++ b/drivers/ptp/ptp_clockmatrix.c @@ -1038,7 +1038,7 @@ static int _idtcm_adjtime_deprecated(struct idtcm_channel *channel, s64 delta) s64 now; if (abs(delta) < PHASE_PULL_IN_THRESHOLD_NS_DEPRECATED) { - err = channel->do_phase_pull_in(channel, delta, 0); + err = channel->do_phase_pull_in(channel, delta, channel->caps.max_adj); } else { idtcm->calculate_overhead_flag = 1; @@ -1594,7 +1594,7 @@ static int do_phase_pull_in_sw(struct idtcm_channel *channel, if (abs(delta_ns) < PHASE_PULL_IN_MIN_THRESHOLD_NS) return 0; - if (max_ffo_ppb == 0) + if (max_ffo_ppb == 0 || max_ffo_ppb > PHASE_PULL_IN_MAX_PPB) max_ffo_ppb = PHASE_PULL_IN_MAX_PPB; /* For most cases, keep phase pull-in duration 1 second */ @@ -1880,7 +1880,7 @@ static int idtcm_adjtime(struct ptp_clock_info *ptp, s64 delta) mutex_lock(idtcm->lock); if (abs(delta) < PHASE_PULL_IN_THRESHOLD_NS) { - err = channel->do_phase_pull_in(channel, delta, 0); + err = channel->do_phase_pull_in(channel, delta, channel->caps.max_adj); } else { if (delta >= 0) { ts = ns_to_timespec64(delta); @@ -1927,9 +1927,6 @@ static int idtcm_adjfine(struct ptp_clock_info *ptp, long scaled_ppm) if (channel->phase_pull_in == true) return 0; - if (scaled_ppm == channel->current_freq_scaled_ppm) - return 0; - mutex_lock(idtcm->lock); err = _idtcm_adjfine(channel, scaled_ppm); mutex_unlock(idtcm->lock); @@ -2054,7 +2051,7 @@ static struct ptp_pin_desc pin_config[MAX_TOD][MAX_REF_CLK]; static const struct ptp_clock_info idtcm_caps = { .owner = THIS_MODULE, - .max_adj = 244000, + .max_adj = MAX_FFO_PPB, .n_per_out = 12, .n_ext_ts = MAX_TOD, .n_pins = MAX_REF_CLK, @@ -2071,7 +2068,7 @@ static const struct ptp_clock_info idtcm_caps = { static const struct ptp_clock_info idtcm_caps_deprecated = { .owner = THIS_MODULE, - .max_adj = 244000, + .max_adj = MAX_FFO_PPB, .n_per_out = 12, .n_ext_ts = MAX_TOD, .n_pins = MAX_REF_CLK, @@ -2242,6 +2239,25 @@ static int configure_channel_tod(struct idtcm_channel *channel, u32 index) return 0; } +static int initialize_max_adj(struct idtcm_channel *channel) +{ + struct idtcm *idtcm = channel->idtcm; + u8 ffo_ppm; + int err; + + err = idtcm_read(idtcm, channel->dpll_n, DPLL_MAX_FREQ_OFFSET, + &ffo_ppm, sizeof(ffo_ppm)); + if (err) + return err; + + if (ffo_ppm && ffo_ppm <= (MAX_FFO_PPB / 1000)) + channel->caps.max_adj = ffo_ppm * 1000; + else + channel->caps.max_adj = MAX_FFO_PPB; + + return 0; +} + static int idtcm_enable_channel(struct idtcm *idtcm, u32 index) { struct idtcm_channel *channel; @@ -2285,6 +2301,10 @@ static int idtcm_enable_channel(struct idtcm *idtcm, u32 index) ppd->chan = index; } + err = initialize_max_adj(channel); + if (err) + return err; + err = initialize_dco_operating_mode(channel); if (err) return err; @@ -2437,8 +2457,13 @@ static int idtcm_probe(struct platform_device *pdev) err = idtcm_load_firmware(idtcm, &pdev->dev); - if (err) + if (err) { + if (err == -ENOENT) { + mutex_unlock(idtcm->lock); + return -EPROBE_DEFER; + } dev_warn(idtcm->dev, "loading firmware failed with %d", err); + } wait_for_chip_ready(idtcm); diff --git a/drivers/ptp/ptp_clockmatrix.h b/drivers/ptp/ptp_clockmatrix.h index ad39dc6decdf..31d90b1bf025 100644 --- a/drivers/ptp/ptp_clockmatrix.h +++ b/drivers/ptp/ptp_clockmatrix.h @@ -19,6 +19,7 @@ #define MAX_REF_CLK (16) #define MAX_ABS_WRITE_PHASE_NANOSECONDS (107374182L) +#define MAX_FFO_PPB (244000) #define TOD_MASK_ADDR (0xFFA5) #define DEFAULT_TOD_MASK (0x04) diff --git a/include/linux/mfd/idt8a340_reg.h b/include/linux/mfd/idt8a340_reg.h index b680a0eb5f68..13b36f4858b3 100644 --- a/include/linux/mfd/idt8a340_reg.h +++ b/include/linux/mfd/idt8a340_reg.h @@ -192,6 +192,7 @@ #define DPLL_CTRL_REG_0 0x0002 #define DPLL_CTRL_REG_1 0x0003 #define DPLL_CTRL_REG_2 0x0004 +#define DPLL_MAX_FREQ_OFFSET 0x0025 #define DPLL_WF_TIMER 0x002c #define DPLL_WP_TIMER 0x002e #define DPLL_TOD_SYNC_CFG 0x0031 From patchwork Thu Nov 30 18:46:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Min Li X-Patchwork-Id: 13474815 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="Mc9Sk6Cx" Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04olkn2077.outbound.protection.outlook.com [40.92.47.77]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E1C51712; Thu, 30 Nov 2023 10:47:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Wb7QG06PlEdMAVBDos4rJ5UXzJ0ctyfJSl2bOxdYANtPv1IOpuoavSJl2XtXYD7m5P8jSl5t0SHNB948QFq5ix5BgLPMdDoui+3wf0OwphTZpsev4VFh81RFTLjYZ1adZCO9VG2bnq557bIIZXVA8OCkYsXvj2c5QXq+2Td3re5vJjaQCBzo8FJ/9hYdmTAx46QRzTUw9DPji3RkUNxu2Vdhbf88r+SqAxpCQrwMyMkFJ33l8H11H/bDO5mG6zNkHCDy97eJ36nXdNZWF9pqGUhKb5Zrsz+k6TOPWew4h8O2QH6+IKl+LjeEZmZb2+XppZ3wTBxS2iTZsUoeA0saUA== 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=Jg7b6p+xqD2UoF2S3eJvncZGfTYlOgCJeL446xehAFE=; b=R6AcLACjem01c8GayrNkA9GV0zxKWXos1kqrjnC7KewaXRLqW+xg+RuzQbt+rmEC8DC63MGp3t5fDmPnehqk4luzwpCv5UD7jVt/Qnc34UNkWMjmjFN8sFmfAVOPpvrHtY2qv1DsKIMX8DL5MuiXu1HoLNOriWKV0H0QZjqhjoXE+UQDGCgACOSHfodwkWe2iobG8J8qzedAa2DrkSYobbBPjYsr5L25E2YuRRQUo1npRzbQMaoidhg8Q/MbPNKoO5S/xziLxU3hQmb5CxnyMeQ9DSRrsUFzuJevZ3kG5jBjWTZL+C5JVkVqFudjNtk3rYKU4X2FkdDvjjc40bdfPQ== 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=Jg7b6p+xqD2UoF2S3eJvncZGfTYlOgCJeL446xehAFE=; b=Mc9Sk6CxooYjJTBA6EkFX0IY5v6HBtAoGyMpMZrn8fb1nHFcxHkwRRq1rEFWIiIe1qXjvGDo3hmRKKSqEVJo0FPgvRltgNkzObL1iSqkQFYaKur8GJYRiTmiEqKDq5JgZ3o7b51S8xbnrN3cdazQGWw9eV9zGcr+Gf9vadTZ5Gf81mzQNbOAmaNF4fuLnmPGoq1Hyh3Tj2Ibng+aLlrneQPGtSuC/f/GLufw9y7yEpi7VXDpGhza0wbboDd66xxVgLMw2HbihSDMQi2ZtU5lgKeJHX8WG/rV5/Lr0ECjeuUeiO+0w0uu9HnPYHrt1h/0c/T6QOy+scBgzrZw8DUt5g== Received: from PH7PR03MB7064.namprd03.prod.outlook.com (2603:10b6:510:2a5::8) by CO1PR03MB5905.namprd03.prod.outlook.com (2603:10b6:303:9b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.8; Thu, 30 Nov 2023 18:47:03 +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.7068.012; Thu, 30 Nov 2023 18:47:03 +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 v6 6/6] ptp: clockmatrix: move register and firmware related definition to idt8a340_reg.h Date: Thu, 30 Nov 2023 13:46:34 -0500 Message-ID: X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231130184634.22577-1-lnimi@hotmail.com> References: <20231130184634.22577-1-lnimi@hotmail.com> X-TMN: [/xfBx6/lF9F5BG0uspKjusiwXRPJbJVs] X-ClientProxiedBy: YQBPR0101CA0262.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c01:68::24) To PH7PR03MB7064.namprd03.prod.outlook.com (2603:10b6:510:2a5::8) X-Microsoft-Original-Message-ID: <20231130184634.22577-6-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_|CO1PR03MB5905:EE_ X-MS-Office365-Filtering-Correlation-Id: 94a40415-6742-4d4b-5756-08dbf1d4be08 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ertx5e2YY3IeAl7ZVpkaxXlkO+TCn9L0YMVhRSQFOuZ04A5bf/0hWdS9zuiFxZ7r5OdMQofBYX6Zy/+1ylJKAlXaaYzYGGvB5Y7A+zqwHpXRNwcIXfBRnKTN3jFeeBmzax0Jj8zPDauHxVSjlTl9Cs0BwDCGK58J+cjt+lXQz3reiaKyv2X7HxYLjR0nQAH0AathgHD68jnTeH44ocQnEkNzDE8b9NHjJMoKvFIz8vgs/CQ1ehet3MFVO94SjLphL5oUXPiRD+Pk/wHLK6SgUp3iI++8ZVzaU2G5nbVxSsBZHrFs/xciP7sw33QXXyyhQJKt2x1EwZA4jYyX5vGgMHsQwibViITle4Cb3GTCC9OrxSA17yGjIuWgqpn1o6l7bCv0cHxvJeWkGT+AviFyUeLU4WATV7PVlnn+qqDcIxbU4y8FEy78WOGeA9qLCWqn8cLaAW6MK1Ik5tiDHhbSx/YuqbvXZibFha/dqUPBXDp0J/BskM3KBTS7Sz4gcktP5weNS3BxcF6rGRZtB2OqFx55K616VHDd5fCayaTwokl7XvSL+9y38eXqUVtzc10Z X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: yAjErtFPdV9uDRqLayzsRn7A7aC/1CFTRmMpZat5m8QBsHMVrZBteZa5VC/GdwRDrf+1ZiH/3Ru3fLWiGGaTpkCRU7a9dgt+J4nDpngTB1Zc6unJi0wdIgSKMYvOJG3lOOxTF0etRKFRw71LoJRj5+5coUV/eZV4NUJBqlyaAfh9IfBQww0Nu0MHuYa3wOZLTzhwCWM/oOkDqok6vRBWHcwahpfOPXEmKCDaRVI0YYv8rz/Jc4dsk0jMP8BJ8dA9931SNE6ZPMF/697iUro+CJ2Hcepq7EqdgU1m7gOziRI/+d7julXHjb1NpBm9AqHJhbl4YmH/ynZ3X1iomb3LXKUQDl/OLPWC7MOZWIfB3rjCyuUh1epnvOYcn6LEv0ra5UwtWcOgpyLOm8Y5J2Rp5bIfovQDJzf8pTbDy7v2WLVeeLB5CVXdfN8BTaoSphVpebU3IGbyycIZPGv/mY0+eUsnndNhckXQIkWdJ90ila2oWcgp8x8B7WgBwWnqijmBatwYvW92G2JTlyi5kRq2rXjqakTz1HIdMEf4QPVJYESOLFq95h+guaLHsCiSDei4Kgvn+zH48u5s7vPgLJjbYOxDmuEm9ANjQrKF2WXleHPnx0BOA8cJB2e7+p4xIll237JQMNvjDSluIQclnZZ8e5ayhaPgOIFsYi6dqomyG3qvf7FhYEZnF/oTtWkJ+97YXnFAxfVVrm5nj1mSQgFWxz5bYIvy9Lsndj9fBaxVZ8OJttmnt/ZVsJyRv0k3+G7hgo6RirY6dqYsLnK86h9WWRkZT9mHc+kRdm4vP1sejTFJRl+7oLO7qgcPk5U5PDN6UpcuLlc3HtM8sa5ouu3Y1SWxprWNrce1y0UcWsFaRGKmZ/dBXIYHgcCbUuvy4VRbr9dXE0450ODLcYKanWoOLXoGyCgDDTvTjHABHMdC9pAAniWZ7Ob0cENrPuUDCmiULvm4pILp804cmkhD2Gf2nEz75tWoHL89db1jcaG6N4I9wInh4dtnuzSmB9pqwgDM+nu+P5nAoKMKMhu0l3N6zNTm/ely3EqNbIeyhdJvZCQCjZuibL9scblIgpgYzOmTXBAS0ZJx2ixsWbrb1w71abcgzBnDUXaLxceEVIRNZbCux/qNDKmEItZm6KP4TWvwwue+rUosZpY8GWta88k4WPbh77h45ATBHVCwij8y7LSqofXJwvkCkhKtvYKbIWJ0PrRhj6tc+37PNeSiTTpJEQ== X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-685f7.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: 94a40415-6742-4d4b-5756-08dbf1d4be08 X-MS-Exchange-CrossTenant-AuthSource: PH7PR03MB7064.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2023 18:47:03.2474 (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: CO1PR03MB5905 X-Patchwork-Delegate: kuba@kernel.org From: Min Li This change is needed by rsmu driver, which will be submitted separately from mfd tree. Signed-off-by: Min Li --- drivers/ptp/ptp_clockmatrix.h | 33 --------- include/linux/mfd/idt8a340_reg.h | 121 +++++++++++++++++++++++++++++-- 2 files changed, 113 insertions(+), 41 deletions(-) diff --git a/drivers/ptp/ptp_clockmatrix.h b/drivers/ptp/ptp_clockmatrix.h index 31d90b1bf025..f041c7999ddc 100644 --- a/drivers/ptp/ptp_clockmatrix.h +++ b/drivers/ptp/ptp_clockmatrix.h @@ -21,32 +21,6 @@ #define MAX_ABS_WRITE_PHASE_NANOSECONDS (107374182L) #define MAX_FFO_PPB (244000) -#define TOD_MASK_ADDR (0xFFA5) -#define DEFAULT_TOD_MASK (0x04) - -#define SET_U16_LSB(orig, val8) (orig = (0xff00 & (orig)) | (val8)) -#define SET_U16_MSB(orig, val8) (orig = (0x00ff & (orig)) | (val8 << 8)) - -#define TOD0_PTP_PLL_ADDR (0xFFA8) -#define TOD1_PTP_PLL_ADDR (0xFFA9) -#define TOD2_PTP_PLL_ADDR (0xFFAA) -#define TOD3_PTP_PLL_ADDR (0xFFAB) - -#define TOD0_OUT_ALIGN_MASK_ADDR (0xFFB0) -#define TOD1_OUT_ALIGN_MASK_ADDR (0xFFB2) -#define TOD2_OUT_ALIGN_MASK_ADDR (0xFFB4) -#define TOD3_OUT_ALIGN_MASK_ADDR (0xFFB6) - -#define DEFAULT_OUTPUT_MASK_PLL0 (0x003) -#define DEFAULT_OUTPUT_MASK_PLL1 (0x00c) -#define DEFAULT_OUTPUT_MASK_PLL2 (0x030) -#define DEFAULT_OUTPUT_MASK_PLL3 (0x0c0) - -#define DEFAULT_TOD0_PTP_PLL (0) -#define DEFAULT_TOD1_PTP_PLL (1) -#define DEFAULT_TOD2_PTP_PLL (2) -#define DEFAULT_TOD3_PTP_PLL (3) - #define PHASE_PULL_IN_THRESHOLD_NS_DEPRECATED (150000) #define PHASE_PULL_IN_THRESHOLD_NS (15000) #define TOD_WRITE_OVERHEAD_COUNT_MAX (2) @@ -121,11 +95,4 @@ struct idtcm { ktime_t start_time; }; -struct idtcm_fwrc { - u8 hiaddr; - u8 loaddr; - u8 value; - u8 reserved; -} __packed; - #endif /* PTP_IDTCLOCKMATRIX_H */ diff --git a/include/linux/mfd/idt8a340_reg.h b/include/linux/mfd/idt8a340_reg.h index 13b36f4858b3..5aeb0820f876 100644 --- a/include/linux/mfd/idt8a340_reg.h +++ b/include/linux/mfd/idt8a340_reg.h @@ -116,16 +116,41 @@ #define OTP_SCSR_CONFIG_SELECT 0x0022 #define STATUS 0x2010c03c -#define DPLL0_STATUS 0x0018 -#define DPLL1_STATUS 0x0019 -#define DPLL2_STATUS 0x001a -#define DPLL3_STATUS 0x001b -#define DPLL4_STATUS 0x001c -#define DPLL5_STATUS 0x001d -#define DPLL6_STATUS 0x001e -#define DPLL7_STATUS 0x001f +#define IN0_MON_STATUS 0x0008 +#define IN1_MON_STATUS 0x0009 +#define IN2_MON_STATUS 0x000a +#define IN3_MON_STATUS 0x000b +#define IN4_MON_STATUS 0x000c +#define IN5_MON_STATUS 0x000d +#define IN6_MON_STATUS 0x000e +#define IN7_MON_STATUS 0x000f +#define IN8_MON_STATUS 0x0010 +#define IN9_MON_STATUS 0x0011 +#define IN10_MON_STATUS 0x0012 +#define IN11_MON_STATUS 0x0013 +#define IN12_MON_STATUS 0x0014 +#define IN13_MON_STATUS 0x0015 +#define IN14_MON_STATUS 0x0016 +#define IN15_MON_STATUS 0x0017 +#define DPLL0_STATUS 0x0018 +#define DPLL1_STATUS 0x0019 +#define DPLL2_STATUS 0x001a +#define DPLL3_STATUS 0x001b +#define DPLL4_STATUS 0x001c +#define DPLL5_STATUS 0x001d +#define DPLL6_STATUS 0x001e +#define DPLL7_STATUS 0x001f #define DPLL_SYS_STATUS 0x0020 #define DPLL_SYS_APLL_STATUS 0x0021 +#define DPLL0_REF_STATUS 0x0022 +#define DPLL1_REF_STATUS 0x0023 +#define DPLL2_REF_STATUS 0x0024 +#define DPLL3_REF_STATUS 0x0025 +#define DPLL4_REF_STATUS 0x0026 +#define DPLL5_REF_STATUS 0x0027 +#define DPLL6_REF_STATUS 0x0028 +#define DPLL7_REF_STATUS 0x0029 +#define DPLL_SYS_REF_STATUS 0x002a #define DPLL0_FILTER_STATUS 0x0044 #define DPLL1_FILTER_STATUS 0x004c #define DPLL2_FILTER_STATUS 0x0054 @@ -192,6 +217,25 @@ #define DPLL_CTRL_REG_0 0x0002 #define DPLL_CTRL_REG_1 0x0003 #define DPLL_CTRL_REG_2 0x0004 +#define DPLL_REF_PRIORITY_0 0x000f +#define DPLL_REF_PRIORITY_1 0x0010 +#define DPLL_REF_PRIORITY_2 0x0011 +#define DPLL_REF_PRIORITY_3 0x0012 +#define DPLL_REF_PRIORITY_4 0x0013 +#define DPLL_REF_PRIORITY_5 0x0014 +#define DPLL_REF_PRIORITY_6 0x0015 +#define DPLL_REF_PRIORITY_7 0x0016 +#define DPLL_REF_PRIORITY_8 0x0017 +#define DPLL_REF_PRIORITY_9 0x0018 +#define DPLL_REF_PRIORITY_10 0x0019 +#define DPLL_REF_PRIORITY_11 0x001a +#define DPLL_REF_PRIORITY_12 0x001b +#define DPLL_REF_PRIORITY_13 0x001c +#define DPLL_REF_PRIORITY_14 0x001d +#define DPLL_REF_PRIORITY_15 0x001e +#define DPLL_REF_PRIORITY_16 0x001f +#define DPLL_REF_PRIORITY_17 0x0020 +#define DPLL_REF_PRIORITY_18 0x0021 #define DPLL_MAX_FREQ_OFFSET 0x0025 #define DPLL_WF_TIMER 0x002c #define DPLL_WP_TIMER 0x002e @@ -450,6 +494,10 @@ #define OUTPUT_TDC_1 0x2010cd08 #define OUTPUT_TDC_2 0x2010cd10 #define OUTPUT_TDC_3 0x2010cd18 + +#define OUTPUT_TDC_CTRL_4 0x0006 +#define OUTPUT_TDC_CTRL_4_V520 0x0007 + #define INPUT_TDC 0x2010cd20 #define SCRATCH 0x2010cf50 @@ -668,6 +716,28 @@ #define DPLL_STATE_MASK (0xf) #define DPLL_STATE_SHIFT (0x0) +/* Bit definitions for the DPLL0_REF_STAT register */ +#define DPLL_REF_STATUS_MASK (0x1f) + +/* Bit definitions for the DPLL register */ +#define DPLL_REF_PRIORITY_ENABLE_SHIFT (0) +#define DPLL_REF_PRIORITY_REF_SHIFT (1) +#define DPLL_REF_PRIORITY_GROUP_NUMBER_SHIFT (6) + +/* Bit definitions for the IN0_MON_STATUS register */ +#define IN_MON_STATUS_LOS_SHIFT (0) +#define IN_MON_STATUS_NO_ACT_SHIFT (1) +#define IN_MON_STATUS_FFO_LIMIT_SHIFT (2) + +#define DEFAULT_PRIORITY_GROUP (0) +#define MAX_PRIORITY_GROUP (3) + +#define MAX_REF_PRIORITIES (19) + +#define MAX_ELECTRICAL_REFERENCES (16) + +#define NO_REFERENCE (0x1f) + /* * Return register address based on passed in firmware version */ @@ -778,4 +848,39 @@ enum scsr_tod_write_type_sel { SCSR_TOD_WR_TYPE_SEL_DELTA_MINUS = 2, SCSR_TOD_WR_TYPE_SEL_MAX = SCSR_TOD_WR_TYPE_SEL_DELTA_MINUS, }; + +/* firmware interface */ +struct idtcm_fwrc { + u8 hiaddr; + u8 loaddr; + u8 value; + u8 reserved; +} __packed; + +#define SET_U16_LSB(orig, val8) (orig = (0xff00 & (orig)) | (val8)) +#define SET_U16_MSB(orig, val8) (orig = (0x00ff & (orig)) | (val8 << 8)) + +#define TOD_MASK_ADDR (0xFFA5) +#define DEFAULT_TOD_MASK (0x04) + +#define TOD0_PTP_PLL_ADDR (0xFFA8) +#define TOD1_PTP_PLL_ADDR (0xFFA9) +#define TOD2_PTP_PLL_ADDR (0xFFAA) +#define TOD3_PTP_PLL_ADDR (0xFFAB) + +#define TOD0_OUT_ALIGN_MASK_ADDR (0xFFB0) +#define TOD1_OUT_ALIGN_MASK_ADDR (0xFFB2) +#define TOD2_OUT_ALIGN_MASK_ADDR (0xFFB4) +#define TOD3_OUT_ALIGN_MASK_ADDR (0xFFB6) + +#define DEFAULT_OUTPUT_MASK_PLL0 (0x003) +#define DEFAULT_OUTPUT_MASK_PLL1 (0x00c) +#define DEFAULT_OUTPUT_MASK_PLL2 (0x030) +#define DEFAULT_OUTPUT_MASK_PLL3 (0x0c0) + +#define DEFAULT_TOD0_PTP_PLL (0) +#define DEFAULT_TOD1_PTP_PLL (1) +#define DEFAULT_TOD2_PTP_PLL (2) +#define DEFAULT_TOD3_PTP_PLL (3) + #endif