From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=67.231.154.184 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796169142; b=G8Bh6DbNNE2n0Y7d3sx19/Lx6Sgt6aVUVwODQWXI9Uslu2t3ZzVTG2bZz5uQ83oyWnsm 7m/jBrqkXCx/o2OmNF4RTc3lNoDnvDweU5PBPxIr2xxJHfWcyPjT5ilPGatJDKRQgFU0g qPjkqCoYmNLe0+ZDxqNFLejhrTxsO0Xub8P/UonblVLCN7Kl4SHFwkO7TmWETV/Z28Veu eYssVLsZc3sQNFB6nLbR6dP5vmxPhiJV02Bkg1jqzv80glxWz8uawt0ezinorYRXQyW53 KmF5u/da3bRKM2tNXbUlEGz5sNUKE+ryazB1F6tggve6FPFLz4uuF0mDQmaXi0FlY3A== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796169142; h=DMARC-Filter:DKIM-Signature:X-Virus-Scanned:Received:DKIM-Signature: Received:Received:From:To:CC:Subject:Thread-Topic:Thread-Index:Date: Message-ID:References:In-Reply-To:Accept-Language:Content-Language: X-MS-Has-Attach:X-MS-TNEF-Correlator:x-ms-publictraffictype: x-ms-traffictypediagnostic:x-ms-office365-filtering-correlation-id: x-ms-exchange-senderadcheck:x-ms-exchange-antispam-relay: x-microsoft-antispam:x-microsoft-antispam-message-info: x-forefront-antispam-report: x-ms-exchange-antispam-messagedata-chunkcount: x-ms-exchange-antispam-messagedata-0:Content-Type: Content-Transfer-Encoding:MIME-Version: X-Exchange-RoutingPolicyChecked:X-OriginatorOrg: X-MS-Exchange-CrossTenant-AuthAs:X-MS-Exchange-CrossTenant-AuthSource: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-originalarrivaltime: X-MS-Exchange-CrossTenant-fromentityheader: X-MS-Exchange-CrossTenant-id:X-MS-Exchange-CrossTenant-mailboxtype: X-MS-Exchange-CrossTenant-userprincipalname: X-MS-Exchange-Transport-CrossTenantHeadersStamped:X-MDID:X-PPE-STACK: X-MDID-O:X-PPE-TRUSTED; bh=rZ8B6tS3JcdWnTeGqmX/2oo0NDDfEKLoCM8Er7wCXAw=; b=VLMak6LGE8pSHZGJq3d1Gfrmbk8ssicjJshBKEEJkuRXgMPuj04Kcwc7kyYfN1c66rJk x9Ziu6WBElAGNGBhdcUyK45Be7EqU/rppXVY7Xldp+X3QML4gGasKuUg7k2DBprCHyyyW q0ca9mV4LM9C1TLYmQ7QW6E0FqSjPkopVwKis3lmxpjGKpH6w63yGt0XqssS2vZNEAik4 m8CY2Cjo+RLUrC1uj7LR8sw4n7kCAl3ZsiNGNIKV/nlyPuU0dX4baTGHj8ivcvQj3Au6X y7ZJrKJRyvNOSQ0kVI26XQ6n00PPdMFevrsJ+p2ymduoi0Kb2dZLCsGlryoegLLufvw== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass header.from=sitime.com; spf=pass smtp.mailfrom=sitime.com; dkim=pass header.d=sitime.com header.i=@sitime.com header.a=rsa-sha256 header.s=mail header.b=YVGI6us5; dkim=pass header.d=Sitime.onmicrosoft.com header.i=@Sitime.onmicrosoft.com header.a=rsa-sha256 header.s=selector1-Sitime-onmicrosoft-com header.b=rIWvVmDW; arc=pass header.oldest-pass=0 smtp.remote-ip=67.231.154.184 Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [67.231.154.184]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AB469606BAF3; Tue, 1 Dec 2026 23:52:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org AB469606BAF3 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sitime.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sitime.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sitime.com header.i=@sitime.com header.a=rsa-sha256 header.s=mail header.b=YVGI6us5; dkim=pass (2048-bit key) header.d=Sitime.onmicrosoft.com header.i=@Sitime.onmicrosoft.com header.a=rsa-sha256 header.s=selector1-Sitime-onmicrosoft-com header.b=rIWvVmDW DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sitime.com; h=cc:cc:content-transfer-encoding:content-transfer-encoding:content-type:content-type:date:date:from:from:in-reply-to:in-reply-to:message-id:message-id:mime-version:mime-version:references:references:subject:subject:to:to; s=mail; bh=rZ8B6tS3JcdWnTeGqmX/2oo0NDDfEKLoCM8Er7wCXAw=; b=YVGI6us5J7R+XrfISMGxrCLSnYy9F12bPoCyeJ9zDcmHDNuApYxo0jP2HGGqlIqOBrHFWwN4pYL/MqKEsIEtAGjBlaP2iodJaRmQxlNY9LNjd5YYMiYgrL527NLaT1RkSr7mqTjnMCqE76FBagN6DXZjJnDcFX/OuCBVlErKKAit4lO5ufpvKHyrgFRVFYoMSS9j42xdtZ8luRtBFlKO0Yqh+i9l+8riTn+l4dOKQKjwlhkUVAV4TUvBTq99HPBlS/RGLSw+t6cn9dr2C5y/QfsosXEXsexa9kxO+5/Ywu1gfzrBKbho5OIQUBTA1R7ehkXLDRwKMgVkIDyXWRi5Kw== X-Virus-Scanned: Proofpoint Essentials engine Received: from PH7PR06CU001.outbound.protection.outlook.com (mail-westus3azon11020129.outbound.protection.outlook.com [52.101.201.129]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id AD448240070; Tue, 1 Dec 2026 23:52:19 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=RHO/3/ZKVROKvEgLzaimkwmZ72ulWYGeciizuIK52jc29iTMSj1wPA8+dIkQaUHSzy9s2bA00XzQjcWDUE6H9TcF3SACHDUo695T9S8L4E2604FZYzCjduB+g/hTve/hIL7arwlWel61HCE28lxsGIGVeu/7FmllfLIk7Ce5/oFkKEnIH/GSBGexS5/W6jKYS1rFHksppJd87cwMv1xOs7Zk1vvyrOUMggsAIyXZFextNfKV320TEZ5dFWnmjLl+RDBBmfspTdz8CR803+wdf8enRIeaHXPalIfvsGYlsJS8CuDvJ6+UkD/aD/DYUlKoVvFz9H+lcrQwq8U3KuTaNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=rZ8B6tS3JcdWnTeGqmX/2oo0NDDfEKLoCM8Er7wCXAw=; b=cnkH9Yq00Cx1hOLJc2ynhjE7CAZ4+V8obTDNBMa1uCyHcnuPI/3YGS6/p3P1k5wYbwKp8szrdl7+u8Nwnm+AG7bKlwijC25uTBow2fazVKtWmIG33umXzk753Z+sSuP5roVYrxR8Bo92sMwUBRvnq7SBRHLofzEpY2eyFRvBWPMCjNxt+P9IR2XJA97+yUCKmI3SpeZxEma0qgBY6o94p/ts2tny88Vwl6FsQr9dFXI0EvWoOGHzIKwKYgLy76dYrWKy85Wksa3rwBC02Ek5qiB6KEZsQgaoQ1CAePIKmgt89vd+LA5We0aqlE7dzUKAkjuwQgOZlyNPAGdhX0Nq7A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=sitime.com; dmarc=pass action=none header.from=sitime.com; dkim=pass header.d=sitime.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Sitime.onmicrosoft.com; s=selector1-Sitime-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rZ8B6tS3JcdWnTeGqmX/2oo0NDDfEKLoCM8Er7wCXAw=; b=rIWvVmDWlSOwcGuCuOs8Zn7xfZfN12MNouOLgE5msyGOd6goUkXztha4Kpxey1IQGaP7v/au6lYIioHyUpRZR8EsYKcUjQ3CqhBhecEk2qT1bvP0bKFzdiPEmlKKVWaxSlKFkw4AD1Js9DuZHD6/9BItZaER2wfCh6GuKinExCP24SvH2UNTcTAJIzLcpZnNYSpE6FL82gh2fDAssuHYH2PCx+fUktxj3a9GE4qa7/cPsfauNaW21qYPogA426Hmu9cdKWDnRlAdWUuANIBLl2CYJo34JFze74uA5y8+gTP4iAX275+4tG/mc5aDFrkzWtAZT1UJRO/wED8FemC/cw== Received: from LVWPR20MB994915.namprd20.prod.outlook.com (2603:10b6:408:3bf::16) by SJ2PR20MB6330.namprd20.prod.outlook.com (2603:10b6:a03:502::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.688.10; Tue, 1 Dec 2026 23:52:16 +0000 Received: from LVWPR20MB994915.namprd20.prod.outlook.com ([fe80::9551:3864:128b:8c01]) by LVWPR20MB994915.namprd20.prod.outlook.com ([fe80::9551:3864:128b:8c01%4]) with mapi id 15.21.0688.009; Tue, 1 Dec 2026 23:52:16 +0000 From: Ali Rouhi To: "jiri@resnulli.us" CC: "ivecera@redhat.com" , "vadim.fedorenko@linux.dev" , "arkadiusz.kubalewski@intel.com" , "kuba@kernel.org" , "pabeni@redhat.com" , "robh@kernel.org" , "krzk+dt@kernel.org" , "conor+dt@kernel.org" , "prabhakar.mahadev-lad.rj@bp.renesas.com" , "cjubran@nvidia.com" , "Oleg.Zadorozhnyi@devoxsoftware.com" , "netdev@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: [PATCH net-next v17 09/13] dpll: sit9531x: add support to get and set frequency on pins Thread-Topic: [PATCH net-next v17 09/13] dpll: sit9531x: add support to get and set frequency on pins Thread-Index: AQHdge759IzC1Wa120auCqTO1Xab9Q== Date: Tue, 1 Dec 2026 23:52:07 +0000 Message-ID: <20261201235202.97645-10-arouhi@sitime.com> References: <20261201235202.97645-1-arouhi@sitime.com> In-Reply-To: <20261201235202.97645-1-arouhi@sitime.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=sitime.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: LVWPR20MB994915:EE_|SJ2PR20MB6330:EE_ x-ms-office365-filtering-correlation-id: ac56900c-4e3c-4319-7616-08df500620f0 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230040|376014|1800799024|23010399003|366016|38070700021|10067099003|260925021311599003|56012099006|5023799004|260925021911599003|260925022911599003|261022075727099003|261026121527099003|261021123027099003|261021121427099003|261026140227099003|261022105027099003|261028144727099003|261102123227099003|261009223027099003|261009220027099003|261009223327099003|261009221727099003|261009221227099003|22082099003|18002099003|6133799003|3023799007; x-microsoft-antispam-message-info: 82o91fsxQs6yuMH0RA4fmuKC0FXZkmIw9wRTOSabF66voAn6z/7wgdvt6wZ31uCRVIaekhHQnB2WH84SdETmhOt679KdgR4WGXXNxwmKwr6iWaI5EyeX6jbztQOenCc/5ByHmh1jf4jSyagXIQfc7rUaNtsd5PbbB4hxU/qGfRG1dDEe0P+YBA4Kae8GGTrJOU4mJR9/uggSrgUU31Q6qOCGZKT3CTcgJOf+E/v6c+AKiZX7DMHISSURxvakY6RVEm9K611mT7nrSI76gyh7t6IFoBju6PM9IZaKBbRcy20EkKQskukZap/4v4oltE6lrArEwKZIY6YoVNZwea991M4L/uP+w8B9yZIvtT/ffHa44I9XDJyUz7UwRFE+nFtYrahzKIC99hzTXW/18kjQavS9Jmq9VTKWNyEFh38cG9tZ9u/oRzHq+e+R8gHxxAeM+j8O0fJiUhHnGVyD87i2MtHLH5sB5A5cQEBTz21VnCojb6n2HJipPeysBmeZQjH68tVjrpfK3Kkxm2DPsp+DK73pJzxPtNxWmxKX3ndbpnh5ekkvIo41gihbX0nE1umJWFtzfsjCztosMcB+LR+ZwS81RF0C9hHY0sUWPvrniDzjbgDQkQ143xx3yPnEwI17oTkow3sFH9YP1uu4gQ6Kc2Cf+MNuTzFXl3yQ1g2Yms5vf8btZWdrftj+Bxh8TqvsU9SCb/zM580DE79b6Ap1PtEE96hx/MIm6lNGydAW638= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:LVWPR20MB994915.namprd20.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(1800799024)(23010399003)(366016)(38070700021)(10067099003)(260925021311599003)(56012099006)(5023799004)(260925021911599003)(260925022911599003)(261022075727099003)(261026121527099003)(261021123027099003)(261021121427099003)(261026140227099003)(261022105027099003)(261028144727099003)(261102123227099003)(261009223027099003)(261009220027099003)(261009223327099003)(261009221727099003)(261009221227099003)(22082099003)(18002099003)(6133799003)(3023799007);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?u1Ti3Kx/Ck9VZzZNklWey2+KAAnPCLOXHnPt9BiuSq0D6EskGi+1ZLi0T+?= =?iso-8859-1?Q?0J3xlAMW2Bx2z//x3P7ZPCmC5qFDi2Vn2yQU/6+5PUYw1su5O1mZFzzW2M?= =?iso-8859-1?Q?0CBx5QqCDgw7P/123Wmx4rinx31HOS25W9TBpA7gtUeIkumGXwa1pMhy1P?= =?iso-8859-1?Q?mThXMkzlzbgebIPYSpOo/znavHW0yOD/23hgUN3VIe/sTiFDJ0/AzB2GfP?= =?iso-8859-1?Q?PxJh1NMXfNKEBnVwDSlCWwvjmj6RXAXICevP8HIZMi/Ycv6HqbFsDzOT2K?= =?iso-8859-1?Q?yTm2Kbo+3gC76PWrYsrtBMDhnx4FT5oAs0YfKXDhPPkUR8If7nm38lWARs?= =?iso-8859-1?Q?2FQLK+crEgTQSUNnJOAkCjYD4YIDdXXAeGTZ1n8qs7X/2IxIsmhOJAE2g3?= =?iso-8859-1?Q?1gaZrksohQn7NNT7KFcPtbimI29orhbtaxmLPDgLOTNPXvQDP1O0pDq3ZG?= =?iso-8859-1?Q?Drq9mBWSbCRmJHQN7HoSZp+X+HSUn3o6LyNGd870F/6v47zgr+Yg98nF2i?= =?iso-8859-1?Q?WsV+7xCk8OZiD5PvGc/azYm4a9LS3BxRMMNsOcUQzhdFhXDUOLZ//rD99d?= =?iso-8859-1?Q?Wt6w7dbWjttNQZ/MDpyZTPBxHrq3SmyZTMd6g7qL/nETyCFHi5nhAxLEv3?= =?iso-8859-1?Q?05dNiengKsHpvB7HDUctfKCnOYtHcikLXaD7dgu6yGn/BTbkTbjxEdDnSU?= =?iso-8859-1?Q?qn6tw+S6RPpFPgkkesqZC6pzweLAN0k2wGHGp/IC3RqqKzuQgjO64llm4m?= =?iso-8859-1?Q?peJYF3jlMLvEO+Y2agoolAi65WSFhELvULoKmgbyBh3xf4bleLa+9nTbIk?= =?iso-8859-1?Q?rQLwD4cxVIUlBW0eo7RI70IuxCmQujzkwCeMb/8Ge9yp1cDm/9ROZReZfZ?= =?iso-8859-1?Q?JcChAc5NiUqpjDEWGeyhSCNZlbr4RYz6zxiGVh8ltX5D/XzhTZZuo1naNg?= =?iso-8859-1?Q?ZaD7f0nFpVw7iJliIxK27K8VDRfyAU/dAdizfehnkGFra+OLETfvFzGbKy?= =?iso-8859-1?Q?QAC/J0cmNLJNHrVdRnK1Ov0I0DrGCoQbXny9Cvft2T/bdFfJML42ouV7Bo?= =?iso-8859-1?Q?KBZ6iZglRIUHFuICpJXkBgn1vgQpE/UjyQUD5tQS6P/DJ+YjSAReCZA2sO?= =?iso-8859-1?Q?fgO01m9zKmfVw6PaN0cs5om1OlDTqMYBgETLuXgdDgFblPrxGDBT4Bv8eX?= =?iso-8859-1?Q?iKhfxpWJdGcZDEW2gn2GDelyLrAcwkekrl3gGUYRFRwWhf0CZWNlPZ5Spg?= =?iso-8859-1?Q?EQVSjsQ0uG5LnIZ1hCg+PQDSPC3TG9qD1h9IgJvaMA1Q8MM9owCJOUK8Ud?= =?iso-8859-1?Q?+ZHMQcGyAzWfJ2QzM0z4w2J4NG9ohhQ8uSO2MFY/1CiWfXr+/xn3lg2cz4?= =?iso-8859-1?Q?H9SrrdmmlTSelkc9Kvbpu0rVIqoBdHnKPoGhe6sVW5KblOO1TccoUrH2tw?= =?iso-8859-1?Q?2xBsTSoMymGn2GatL3zy1SxfP1kV9f1iSCiSDq+ZxLgNc+NdZNO93RhDRL?= =?iso-8859-1?Q?UiKLdQqERzrgToomQ3chjver+3x/1j6wHnPBAq5Tb6jiIowbkoHOtcKfV/?= =?iso-8859-1?Q?1nhVMwximWHHL/kXMW1JvxL1m1mJ6aENifH8zif44o4jujk3QrS2X7Vw8f?= =?iso-8859-1?Q?kbj6SP+0L3dCH1WSkwHRhlF1r1HWTg6mhmkCzJikJgigk+3O+eqKLTzdfE?= =?iso-8859-1?Q?QGKJNZIXDwbG1JOUSoMJEBkoVvGEm+HFOFEXkAaI2wycFysBYJzsZ5Cbac?= =?iso-8859-1?Q?fSxIr3c1JqnPMOlh7x8KStF3qr84M3/hsgodq9jhuucUlW?= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 X-Exchange-RoutingPolicyChecked: iOhG2aCV08kGP0VXHfNb+epqZLkJIx4pMnj+H2zRzDuGKGdKitQOG/ZuMCRCCRqpR6tF8YxrgIaQnYHGfXBCKck6lQttrn8obCbv1vYrXgy1t5jomBoHbIpVY7woiK3Lom/0IUe6+jOFEfAQ+N0M7LSMOg/YIH/vTq+ZXX2mrbITRWlANogQtPM9q+Zkq68mO92kf3cTTickBC3tcnEKVSeGcYSFQ44b44Q6WHsqhLnGEbrFBHIsCqLZCZ6ZXyDGcyTDlLpyhOrrWmrHqg9DbMfhClJpTz4xTsFEaKUb6ituIJHsy6+OTj/vmP3Nw9F4Yga6ydLBMUyNAFzxKKQnzQ== X-OriginatorOrg: sitime.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: LVWPR20MB994915.namprd20.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: ac56900c-4e3c-4319-7616-08df500620f0 X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Dec 2026 23:52:07.2000 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 8fb55916-cf10-4b0d-96f4-cf3952657263 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: IGmIZm+wvzmYG9rVsCKj702ZtHvJn9qMtTwnwrEpn3J986i6/C9HK1PpDIt1l75eWM+xvso55HvSBioR5larbw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR20MB6330 X-MDID: 1796169140-3i7PHJzCjVIl X-PPE-STACK: {"stack":"us1"} X-MDID-O: us1;at1;1796169140;3i7PHJzCjVIl;;ba04557de9d2da8490f5f1e6de07b967 X-PPE-TRUSTED: V=1;DIR=OUT; From: Oleg Zadorozhnyi =0A= =0A= Report an input's frequency from the firmware description and an=0A= output's as the VCO rate over its output divider; set it by writing a=0A= new divider. The VCO rate is Fref * DIVN, and a rate is accepted only=0A= when the VCO rate is a whole multiple of it, and on an LVCMOS output up=0A= to 250 MHz. An output whose divider chain does not resolve, or whose=0A= Fref * DIVN is outside the PLL's VCO band, reports 0 Hz and takes no=0A= rate.=0A= =0A= A divider write takes effect only inside the programming state, and the=0A= documented 100 ms settling time after the loop-lock command is waited=0A= under the device lock. The poll and removal retry a failed bank update.=0A= The phase flush after it is enabled per PLL, so it realigns every output=0A= the PLL drives. The on-demand enable of the other PLLs is cleared for=0A= the pulse and written back after it, so only this PLL is armed when the=0A= trigger fires. A PLL whose configuration has the flush off is restarted=0A= to realign its dividers, as the reference sequence does.=0A= =0A= Output pins are registered by the next patch, which adds the state=0A= callback the core requires.=0A= =0A= Signed-off-by: Oleg Zadorozhnyi =0A= Co-developed-by: Ali Rouhi =0A= Signed-off-by: Ali Rouhi =0A= ---=0A= drivers/dpll/sit9531x/core.c | 688 ++++++++++++++++++++++++++++++++++-=0A= drivers/dpll/sit9531x/core.h | 16 +=0A= drivers/dpll/sit9531x/dpll.c | 124 +++++++=0A= drivers/dpll/sit9531x/prop.c | 43 ++-=0A= drivers/dpll/sit9531x/regs.h | 44 +++=0A= 5 files changed, 904 insertions(+), 11 deletions(-)=0A= =0A= diff --git a/drivers/dpll/sit9531x/core.c b/drivers/dpll/sit9531x/core.c=0A= index 6e06e99e5ff8..bce58b337113 100644=0A= --- a/drivers/dpll/sit9531x/core.c=0A= +++ b/drivers/dpll/sit9531x/core.c=0A= @@ -463,6 +463,153 @@ static int sit9531x_output_forced_hiz(struct sit9531x= _dev *sitdev,=0A= return 0;=0A= }=0A= =0A= +#define SIT9531X_LOOP_LOCK_TRIES 3=0A= +=0A= +/* Close the loops and lock the debug block without committing */=0A= +static void sit9531x_prg_abort(struct sit9531x_dev *sitdev)=0A= +{=0A= + int rc =3D -EIO;=0A= + u8 attempt;=0A= +=0A= + for (attempt =3D 0; attempt < SIT9531X_LOOP_LOCK_TRIES; attempt++) {=0A= + rc =3D sit9531x_write_u8(sitdev, SIT9531X_REG_PRG_DIR_GEN,=0A= + SIT9531X_LOOP_LOCK);=0A= + if (!rc)=0A= + break;=0A= + usleep_range(1000, 2000);=0A= + }=0A= + if (rc)=0A= + dev_err(sitdev->dev,=0A= + "output loops left unlocked after a failed entry: %d\n",=0A= + rc);=0A= +=0A= + sitdev->loops_open =3D !!rc;=0A= + sit9531x_write_u8(sitdev, SIT9531X_REG_OUTSYS_DEBUG,=0A= + SIT9531X_DEBUG_LOCK_VAL);=0A= +}=0A= +=0A= +/*=0A= + * Leave PRG_CMD: re-lock the loops and close the debug window. The sleep = is=0A= + * the settling time after loop lock.=0A= + */=0A= +static int sit9531x_prg_relock(struct sit9531x_dev *sitdev)=0A= +{=0A= + int rc =3D 0, close_rc;=0A= + u8 attempt;=0A= +=0A= + for (attempt =3D 0; attempt < SIT9531X_LOOP_LOCK_TRIES; attempt++) {=0A= + rc =3D sit9531x_write_u8(sitdev, SIT9531X_REG_PRG_DIR_GEN,=0A= + SIT9531X_LOOP_LOCK);=0A= + if (!rc)=0A= + break;=0A= + usleep_range(1000, 2000);=0A= + }=0A= + if (rc)=0A= + dev_err(sitdev->dev,=0A= + "output loops left unlocked after programming: %d\n",=0A= + rc);=0A= +=0A= + sitdev->loops_open =3D !!rc;=0A= +=0A= + msleep(100);=0A= +=0A= + /*=0A= + * The debug key register unlocks every debug register while it holds=0A= + * the unlock value.=0A= + */=0A= + close_rc =3D sit9531x_write_close(sitdev, SIT9531X_REG_OUTSYS_DEBUG,=0A= + SIT9531X_DEBUG_LOCK_VAL);=0A= + if (close_rc)=0A= + dev_warn(sitdev->dev,=0A= + "output debug block left unlocked after programming: %d\n",=0A= + close_rc);=0A= +=0A= + return rc;=0A= +}=0A= +=0A= +/* Retry a failed loop re-lock with the debug window open, as the first tr= y */=0A= +static int sit9531x_prg_relock_retry(struct sit9531x_dev *sitdev)=0A= +{=0A= + int rc, lock_rc;=0A= +=0A= + rc =3D sit9531x_write_u8(sitdev, SIT9531X_REG_OUTSYS_DEBUG,=0A= + SIT9531X_DEBUG_UNLOCK_VAL);=0A= + if (rc) {=0A= + lock_rc =3D sit9531x_write_close(sitdev,=0A= + SIT9531X_REG_OUTSYS_DEBUG,=0A= + SIT9531X_DEBUG_LOCK_VAL);=0A= + if (lock_rc)=0A= + dev_warn(sitdev->dev,=0A= + "output debug block left unlocked: %d\n",=0A= + lock_rc);=0A= + return rc;=0A= + }=0A= +=0A= + return sit9531x_prg_relock(sitdev);=0A= +}=0A= +=0A= +/* Update the NVM bank and leave PRG_CMD */=0A= +static int sit9531x_prg_commit(struct sit9531x_dev *sitdev)=0A= +{=0A= + int rc, rc2;=0A= +=0A= + rc =3D sit9531x_write_u8(sitdev, SIT9531X_REG_PRG_DIR_GEN,=0A= + SIT9531X_UPDATE_NVM_BANK);=0A= + sitdev->bank_pending =3D !!rc;=0A= + rc2 =3D sit9531x_prg_relock(sitdev);=0A= +=0A= + return rc ? rc : rc2;=0A= +}=0A= +=0A= +/*=0A= + * Unlock the Page 3 debug registers and enter PRG_CMD; output-system writ= es=0A= + * take effect only in this state.=0A= + */=0A= +static int sit9531x_prg_enter(struct sit9531x_dev *sitdev)=0A= +{=0A= + int rc, lock_rc;=0A= +=0A= + rc =3D sit9531x_write_u8(sitdev, SIT9531X_REG_OUTSYS_DEBUG,=0A= + SIT9531X_DEBUG_UNLOCK_VAL);=0A= + if (rc) {=0A= + lock_rc =3D sit9531x_write_close(sitdev,=0A= + SIT9531X_REG_OUTSYS_DEBUG,=0A= + SIT9531X_DEBUG_LOCK_VAL);=0A= + if (lock_rc)=0A= + dev_warn(sitdev->dev,=0A= + "output debug block left unlocked: %d\n",=0A= + lock_rc);=0A= + return rc;=0A= + }=0A= +=0A= + rc =3D sit9531x_write_u8(sitdev, SIT9531X_REG_PRG_DIR_GEN,=0A= + SIT9531X_PRG_CMD_STATE);=0A= + if (rc) {=0A= + sit9531x_prg_abort(sitdev);=0A= + return rc;=0A= + }=0A= +=0A= + return 0;=0A= +}=0A= +=0A= +/*=0A= + * Retry a pending bank update or loop re-lock. The bank update is issued = in=0A= + * PRG_CMD, as Out_Freq_CHange_v2.py does.=0A= + */=0A= +static int sit9531x_prg_retry(struct sit9531x_dev *sitdev)=0A= +{=0A= + int rc;=0A= +=0A= + if (!sitdev->bank_pending)=0A= + return sit9531x_prg_relock_retry(sitdev);=0A= +=0A= + rc =3D sit9531x_prg_enter(sitdev);=0A= + if (rc)=0A= + return rc;=0A= +=0A= + return sit9531x_prg_commit(sitdev);=0A= +}=0A= +=0A= /*=0A= * Procedure:=0A= * 1. Force PLL into holdover (PLL page reg 0x6F bit 4)=0A= @@ -1199,6 +1346,525 @@ int sit9531x_input_prio_add(struct sit9531x_dev *si= tdev, u8 pll_idx,=0A= chan->prio_mask | BIT(input_idx));=0A= }=0A= =0A= +/* Per-slot DIVO base register offsets (6 slots per page) */=0A= +static const u8 clkout_odr_divn_base[] =3D {=0A= + 0x14, 0x24, 0x34, 0x44, 0x54, 0x64=0A= +};=0A= +=0A= +/* XO doubler register */=0A= +#define SIT9531X_REG_XO2_GENERIC SIT9531X_REG(0x00, 0x2D)=0A= +#define SIT9531X_XO_DOUBLER_ENB_BIT 7 /* inverted: 0 =3D enabled */=0A= +=0A= +/* VCO frequency bands (Hz) */=0A= +#define SIT9531X_FVCO_LOWBAND_MIN 4915200000ULL=0A= +#define SIT9531X_FVCO_LOWBAND_MAX 5898240000ULL=0A= +#define SIT9531X_FVCO_HIGHBAND_MIN 6875000000ULL=0A= +#define SIT9531X_FVCO_HIGHBAND_MAX 7812500000ULL=0A= +=0A= +#define SIT9531X_DIVO_MAX GENMASK_ULL(33, 0)=0A= +=0A= +/* Register 0x2D bit 7 is active-low: 0 =3D doubler enabled. */=0A= +static int sit9531x_is_xo_doubler_enabled(struct sit9531x_dev *sitdev)=0A= +{=0A= + u8 val;=0A= + int rc;=0A= +=0A= + rc =3D sit9531x_read_u8(sitdev, SIT9531X_REG_XO2_GENERIC, &val);=0A= + if (rc)=0A= + return rc;=0A= +=0A= + return (~val >> SIT9531X_XO_DOUBLER_ENB_BIT) & 1u;=0A= +}=0A= +=0A= +/*=0A= + * DIVN in fixed point: int_part + fracn/fracd, SIT9531X_DIVN_SCALE steps = per=0A= + * unit.=0A= + */=0A= +static s64 sit9531x_divn_fixed(u32 int_part, s64 fracn, u64 fracd)=0A= +{=0A= + s64 whole =3D (s64)int_part * SIT9531X_DIVN_SCALE;=0A= + u64 frac;=0A= +=0A= + if (!fracd)=0A= + return whole;=0A= +=0A= + frac =3D mul_u64_u64_div_u64(abs(fracn), SIT9531X_DIVN_SCALE, fracd);=0A= +=0A= + return fracn < 0 ? whole - (s64)frac : whole + (s64)frac;=0A= +}=0A= +=0A= +/*=0A= + * Read a PLL's configured DIVN, fixed point as per sit9531x_divn_fixed().= =0A= + * Fractions are stored LSB first; the numerator is two's complement 32-bi= t and=0A= + * the denominator register holds the divisor minus one.=0A= + */=0A= +static int sit9531x_divn_static(struct sit9531x_dev *sitdev, u8 pll_idx,= =0A= + s64 *divn)=0A= +{=0A= + u32 int_part, fracn_raw =3D 0, fracd_raw =3D 0;=0A= + u64 fracd;=0A= + s64 fracn;=0A= + int rc, i;=0A= + u8 v;=0A= +=0A= + rc =3D sit9531x_read_pll_u8(sitdev, pll_idx,=0A= + SIT9531X_PLL_REG_DIVN_INT, &v);=0A= + if (rc)=0A= + return rc;=0A= + int_part =3D v;=0A= +=0A= + for (i =3D 3; i >=3D 0; i--) {=0A= + rc =3D sit9531x_read_pll_u8(sitdev, pll_idx,=0A= + SIT9531X_PLL_REG_DIVN_NUM + i, &v);=0A= + if (rc)=0A= + return rc;=0A= + fracn_raw =3D (fracn_raw << 8) | v;=0A= + }=0A= +=0A= + for (i =3D 3; i >=3D 0; i--) {=0A= + rc =3D sit9531x_read_pll_u8(sitdev, pll_idx,=0A= + SIT9531X_PLL_REG_DIVN_DEN + i, &v);=0A= + if (rc)=0A= + return rc;=0A= + fracd_raw =3D (fracd_raw << 8) | v;=0A= + }=0A= +=0A= + fracn =3D (s32)fracn_raw;=0A= + fracd =3D (u64)fracd_raw + 1;=0A= + if ((u64)abs(fracn) >=3D fracd)=0A= + return -ENODATA;=0A= +=0A= + *divn =3D sit9531x_divn_fixed(int_part, fracn, fracd);=0A= +=0A= + return 0;=0A= +}=0A= +=0A= +/* PLLB and PLLD run their VCO in the high band, PLLA and PLLC in the low.= */=0A= +static bool sit9531x_fvco_in_band(u8 pll_idx, u64 fvco)=0A= +{=0A= + if (pll_idx =3D=3D 1 || pll_idx =3D=3D 3)=0A= + return fvco >=3D SIT9531X_FVCO_HIGHBAND_MIN &&=0A= + fvco <=3D SIT9531X_FVCO_HIGHBAND_MAX;=0A= + return fvco >=3D SIT9531X_FVCO_LOWBAND_MIN &&=0A= + fvco <=3D SIT9531X_FVCO_LOWBAND_MAX;=0A= +}=0A= +=0A= +/*=0A= + * Fvco =3D Fref * DIVN with Fref =3D xtal_freq << doubler; DIVN is the pr= ofile's=0A= + * steady-state value in free-run and sync modes alike.=0A= + */=0A= +static int sit9531x_get_fvco(struct sit9531x_dev *sitdev, u8 pll_idx,=0A= + u64 *fvco)=0A= +{=0A= + int doubler, rc;=0A= + u64 fref;=0A= + s64 divn;=0A= +=0A= + rc =3D sit9531x_divn_static(sitdev, pll_idx, &divn);=0A= + if (rc)=0A= + return rc;=0A= + if (divn <=3D 0)=0A= + return -ENODATA;=0A= +=0A= + doubler =3D sit9531x_is_xo_doubler_enabled(sitdev);=0A= + if (doubler < 0)=0A= + return doubler;=0A= +=0A= + fref =3D (u64)sitdev->xtal_freq << doubler;=0A= +=0A= + /*=0A= + * Round to the nearest hertz; the fixed-point DIVN is already floored=0A= + * once.=0A= + */=0A= + *fvco =3D mul_u64_u64_div_u64(2 * fref, (u64)divn, SIT9531X_DIVN_SCALE);= =0A= + *fvco =3D (*fvco + 1) / 2;=0A= +=0A= + /* Below the low VCO band the divider is not programmed */=0A= + if (*fvco < SIT9531X_FVCO_LOWBAND_MIN)=0A= + return -ENODATA;=0A= +=0A= + /*=0A= + * The VCO runs inside its band; Fref * DIVN outside it is not the=0A= + * PLL's rate, as for a PLL fed from another PLL.=0A= + */=0A= + if (!sit9531x_fvco_in_band(pll_idx, *fvco)) {=0A= + if (!(sitdev->fvco_band_warned & BIT(pll_idx))) {=0A= + sitdev->fvco_band_warned |=3D BIT(pll_idx);=0A= + dev_warn(sitdev->dev,=0A= + "PLL%c: Fref * DIVN =3D %llu Hz is outside its VCO band\n",=0A= + 'A' + pll_idx, *fvco);=0A= + }=0A= + return -ENODATA;=0A= + }=0A= +=0A= + return 0;=0A= +}=0A= +=0A= +static int sit9531x_pll_small_update(struct sit9531x_dev *sitdev, u8 pll_i= dx)=0A= +{=0A= + return sit9531x_write_pll_u8(sitdev, pll_idx,=0A= + SIT9531X_PLL_REG_SMALL_UPDATE,=0A= + SIT9531X_SMALL_UPDATE_CMD);=0A= +}=0A= +=0A= +/*=0A= + * Realign the PLL's output dividers with the on-demand phase flush (PHFL)= , or=0A= + * restart the PLL when its profile has PHFL off (PLL page 0x47 bit 7 clea= r), as=0A= + * Dely_program_output.py does. Without either, a rewritten DIVO keeps a f= ixed=0A= + * edge offset. Caller must hold sitdev->multiop_lock.=0A= + */=0A= +static int sit9531x_output_phase_flush(struct sit9531x_dev *sitdev, u8 pll= _idx)=0A= +{=0A= + u8 ctrl, orig, phfl, armed_mask =3D 0, parked =3D 0, i;=0A= + int rc, ret;=0A= +=0A= + rc =3D sit9531x_read_pll_u8(sitdev, pll_idx, SIT9531X_PLL_REG_CONFIG47,= =0A= + &phfl);=0A= + if (rc)=0A= + return rc;=0A= + if (!(phfl & SIT9531X_PLL_CONFIG47_PHFL_EN))=0A= + return sit9531x_write_pll_u8(sitdev, pll_idx,=0A= + SIT9531X_PLL_REG_DIRECTIVES,=0A= + SIT9531X_PLL_DIRECTIVE_RESTART);=0A= +=0A= + /* Only the target PLL keeps on-demand flush enabled for the pulse. */=0A= + for (i =3D 0; i < SIT9531X_NUM_PLLS; i++) {=0A= + rc =3D sit9531x_read_pll_u8(sitdev, i, SIT9531X_PLL_REG_PHFL_CTRL,=0A= + &phfl);=0A= + if (rc)=0A= + return rc;=0A= + if (phfl & SIT9531X_PLL_PHFL_ON_DEMAND_EN)=0A= + armed_mask |=3D BIT(i);=0A= + }=0A= +=0A= + for (i =3D 0; i < SIT9531X_NUM_PLLS; i++) {=0A= + if (i =3D=3D pll_idx || !(armed_mask & BIT(i)))=0A= + continue;=0A= + parked |=3D BIT(i);=0A= + rc =3D sit9531x_update_pll_u8(sitdev, i,=0A= + SIT9531X_PLL_REG_PHFL_CTRL,=0A= + SIT9531X_PLL_PHFL_ON_DEMAND_EN, 0);=0A= + if (rc)=0A= + goto unpark;=0A= + rc =3D sit9531x_pll_small_update(sitdev, i);=0A= + if (rc)=0A= + goto unpark;=0A= + }=0A= +=0A= + rc =3D sit9531x_update_pll_u8(sitdev, pll_idx,=0A= + SIT9531X_PLL_REG_PHFL_CTRL,=0A= + SIT9531X_PLL_PHFL_ON_DEMAND_EN,=0A= + SIT9531X_PLL_PHFL_ON_DEMAND_EN);=0A= + if (rc)=0A= + goto disarm;=0A= +=0A= + /*=0A= + * Write the update register whole; a read-modify-write skips the write= =0A= + * while the bit still reads set from the previous command.=0A= + */=0A= + rc =3D sit9531x_pll_small_update(sitdev, pll_idx);=0A= + if (rc)=0A= + goto disarm;=0A= +=0A= + /*=0A= + * Select the in-register phase trigger; the register also holds the OEb= =0A= + * bits.=0A= + */=0A= + rc =3D sit9531x_read_u8(sitdev, SIT9531X_REG_GPIO_FUNC_CTRL1, &ctrl);=0A= + if (rc)=0A= + goto disarm;=0A= +=0A= + orig =3D ctrl & ~SIT9531X_DIVO_PHASE_TRIG;=0A= + ctrl =3D orig | SIT9531X_DIVO_PHASE_SEL_REG;=0A= + rc =3D sit9531x_write_u8(sitdev, SIT9531X_REG_GPIO_FUNC_CTRL1, ctrl);=0A= + if (rc)=0A= + goto restore;=0A= +=0A= + /*=0A= + * No delay between set and clear; one I2C transfer is longer than the=0A= + * minimum pulse width.=0A= + */=0A= + rc =3D sit9531x_write_u8(sitdev, SIT9531X_REG_GPIO_FUNC_CTRL1,=0A= + ctrl | SIT9531X_DIVO_PHASE_TRIG);=0A= + if (rc)=0A= + goto restore;=0A= +=0A= + /*=0A= + * Clear the trigger with the register trigger still selected, as=0A= + * Dely_program_output.py does; the select goes back after it.=0A= + */=0A= + rc =3D sit9531x_write_close(sitdev, SIT9531X_REG_GPIO_FUNC_CTRL1, ctrl);= =0A= +=0A= +restore:=0A= + ret =3D sit9531x_write_u8(sitdev, SIT9531X_REG_GPIO_FUNC_CTRL1, orig);=0A= + if (ret && !rc)=0A= + rc =3D ret;=0A= +=0A= +disarm:=0A= + /*=0A= + * Restore the profile's flush enable; an armed flush re-flushes every=0A= + * output divider of this PLL on the next trigger.=0A= + */=0A= + if (!(armed_mask & BIT(pll_idx))) {=0A= + ret =3D sit9531x_update_pll_u8(sitdev, pll_idx,=0A= + SIT9531X_PLL_REG_PHFL_CTRL,=0A= + SIT9531X_PLL_PHFL_ON_DEMAND_EN, 0);=0A= + if (!ret)=0A= + ret =3D sit9531x_pll_small_update(sitdev, pll_idx);=0A= + if (ret && !rc)=0A= + rc =3D ret;=0A= + }=0A= +=0A= +unpark:=0A= + for (i =3D 0; i < SIT9531X_NUM_PLLS; i++) {=0A= + if (!(parked & BIT(i)))=0A= + continue;=0A= + ret =3D sit9531x_update_pll_u8(sitdev, i,=0A= + SIT9531X_PLL_REG_PHFL_CTRL,=0A= + SIT9531X_PLL_PHFL_ON_DEMAND_EN,=0A= + SIT9531X_PLL_PHFL_ON_DEMAND_EN);=0A= + if (!ret)=0A= + ret =3D sit9531x_pll_small_update(sitdev, i);=0A= + if (ret && !rc)=0A= + rc =3D ret;=0A= + }=0A= +=0A= + return rc;=0A= +}=0A= +=0A= +/*=0A= + * Compute an output's divider and VCO rate; call before entering the=0A= + * programming state.=0A= + */=0A= +static int sit9531x_output_divo_calc(struct sit9531x_dev *sitdev, u8 out_i= dx,=0A= + u8 pll_idx, u64 frequency, u64 *fvco_out,=0A= + u64 *divo_out)=0A= +{=0A= + const struct sit9531x_chip_info *info =3D sitdev->info;=0A= + u64 fvco, divo, nearest, rem;=0A= + int rc;=0A= +=0A= + if (out_idx >=3D info->num_outputs || pll_idx >=3D SIT9531X_NUM_PLLS)=0A= + return -EINVAL;=0A= +=0A= + /* An unrouted output has a placeholder in pll_idx. */=0A= + if (!sitdev->out[out_idx].routed)=0A= + return -ENODEV;=0A= +=0A= + if (!frequency)=0A= + return -EINVAL;=0A= +=0A= + if (frequency > SIT9531X_OUT_FREQ_MAX_HZ)=0A= + return -EINVAL;=0A= +=0A= + rc =3D sit9531x_get_fvco(sitdev, pll_idx, &fvco);=0A= + if (rc)=0A= + return rc =3D=3D -ENODATA ? -ENODEV : rc;=0A= +=0A= + divo =3D div64_u64(fvco + frequency / 2, frequency);=0A= + if (!divo)=0A= + return -EINVAL;=0A= +=0A= + if (divo > SIT9531X_DIVO_MAX)=0A= + return -EINVAL;=0A= +=0A= + /*=0A= + * Refuse a rate that is not exactly Fvco/N; the quotient truncates to=0A= + * the request whenever the remainder is below N.=0A= + */=0A= + nearest =3D div64_u64_rem(fvco, divo, &rem);=0A= + if (nearest !=3D frequency || rem) {=0A= + dev_dbg(sitdev->dev,=0A= + "out%u: %llu Hz is not Fvco/N (Fvco=3D%llu, nearest %llu Hz)\n",=0A= + out_idx, frequency, fvco, nearest);=0A= + return -EINVAL;=0A= + }=0A= +=0A= + dev_dbg(sitdev->dev, "out%u: Fvco=3D%llu freq=3D%llu DIVO=3D%llu\n",=0A= + out_idx, fvco, frequency, divo);=0A= +=0A= + *fvco_out =3D fvco;=0A= + *divo_out =3D divo;=0A= +=0A= + return 0;=0A= +}=0A= +=0A= +/*=0A= + * Caller must be in the programming state; @back reports whether the divi= der=0A= + * holds its old value.=0A= + */=0A= +static int sit9531x_output_divo_write(struct sit9531x_dev *sitdev, u8 out_= idx,=0A= + u64 divo, bool *back)=0A= +{=0A= + u8 slot, page, base_reg, divo_bytes[5], old_bytes[5], msb_old;=0A= + const struct sit9531x_chip_info *info =3D sitdev->info;=0A= + int rc, j, rb_rc;=0A= + u8 written =3D 0;=0A= +=0A= + *back =3D false;=0A= +=0A= + slot =3D info->clkout_map[out_idx];=0A= +=0A= + if (slot > SIT9531X_PAGE_OUTSYS0_SLOT_MAX)=0A= + page =3D SIT9531X_PAGE_OUTSYS1;=0A= + else=0A= + page =3D SIT9531X_PAGE_OUTSYS0;=0A= + base_reg =3D clkout_odr_divn_base[slot % 6];=0A= +=0A= + divo_bytes[0] =3D (divo >> 0) & 0xFF;=0A= + divo_bytes[1] =3D (divo >> 8) & 0xFF;=0A= + divo_bytes[2] =3D (divo >> 16) & 0xFF;=0A= + divo_bytes[3] =3D (divo >> 24) & 0xFF;=0A= + divo_bytes[4] =3D (divo >> 32) & 0x03; /* only bits [1:0] */=0A= +=0A= + for (j =3D 0; j < 5; j++) {=0A= + rc =3D sit9531x_read_u8(sitdev,=0A= + SIT9531X_REG(page, base_reg - j),=0A= + &old_bytes[j]);=0A= + if (rc)=0A= + return rc;=0A= + }=0A= +=0A= + msb_old =3D old_bytes[4];=0A= + divo_bytes[4] |=3D msb_old & 0xFC;=0A= +=0A= + for (j =3D 0; j < 5; j++) {=0A= + rc =3D sit9531x_write_u8(sitdev,=0A= + SIT9531X_REG(page, base_reg - j),=0A= + divo_bytes[j]);=0A= + if (rc)=0A= + goto rollback;=0A= + written++;=0A= + }=0A= +=0A= + return 0;=0A= +=0A= +rollback:=0A= + /* The byte whose write failed may have reached the part */=0A= + *back =3D true;=0A= + for (j =3D 0; j <=3D written && j < 5; j++) {=0A= + rb_rc =3D sit9531x_write_u8(sitdev,=0A= + SIT9531X_REG(page, base_reg - j),=0A= + old_bytes[j]);=0A= + if (rb_rc) {=0A= + *back =3D false;=0A= + dev_err(sitdev->dev,=0A= + "out%u: DIVO rollback failed (%d), the divider is part old and part ne= w\n",=0A= + out_idx, rb_rc);=0A= + if (!rc)=0A= + rc =3D rb_rc;=0A= + }=0A= + }=0A= +=0A= + return rc;=0A= +}=0A= +=0A= +static int sit9531x_output_divo_read(struct sit9531x_dev *sitdev, u8 out_i= dx,=0A= + u64 *divo)=0A= +{=0A= + u8 slot, page, base_reg, v;=0A= + int rc, j;=0A= +=0A= + slot =3D sitdev->info->clkout_map[out_idx];=0A= + if (slot > SIT9531X_PAGE_OUTSYS0_SLOT_MAX)=0A= + page =3D SIT9531X_PAGE_OUTSYS1;=0A= + else=0A= + page =3D SIT9531X_PAGE_OUTSYS0;=0A= + base_reg =3D clkout_odr_divn_base[slot % 6];=0A= +=0A= + *divo =3D 0;=0A= + for (j =3D 4; j >=3D 0; j--) {=0A= + rc =3D sit9531x_read_u8(sitdev,=0A= + SIT9531X_REG(page, base_reg - j), &v);=0A= + if (rc)=0A= + return rc;=0A= + if (j =3D=3D 4)=0A= + v &=3D 0x03;=0A= + *divo =3D (*divo << 8) | v;=0A= + }=0A= +=0A= + return *divo ? 0 : -ENODATA;=0A= +}=0A= +=0A= +int sit9531x_output_freq_set(struct sit9531x_dev *sitdev, u8 out_idx,=0A= + u8 pll_idx, u64 frequency)=0A= +{=0A= + u64 fvco, divo;=0A= + int rc, ret;=0A= + bool back;=0A= +=0A= + lockdep_assert_held(&sitdev->multiop_lock);=0A= +=0A= + rc =3D sit9531x_output_divo_calc(sitdev, out_idx, pll_idx, frequency,=0A= + &fvco, &divo);=0A= + if (rc)=0A= + return rc;=0A= +=0A= + rc =3D sit9531x_prg_enter(sitdev);=0A= + if (rc)=0A= + return rc;=0A= +=0A= + rc =3D sit9531x_output_divo_write(sitdev, out_idx, divo, &back);=0A= + /* NVM update and loop lock */=0A= + ret =3D sit9531x_prg_commit(sitdev);=0A= + if (ret && !rc)=0A= + rc =3D ret;=0A= + if (rc)=0A= + return rc;=0A= +=0A= + /* Flush the output phase so the new DIVO starts aligned */=0A= + rc =3D sit9531x_output_phase_flush(sitdev, pll_idx);=0A= + if (rc) {=0A= + dev_warn(sitdev->dev,=0A= + "out%u: rate changed but the divider phase was not realigned (%d)\n",= =0A= + out_idx, rc);=0A= + rc =3D 0;=0A= + }=0A= +=0A= + sitdev->out[out_idx].freq =3D div64_u64(fvco, divo);=0A= +=0A= + return 0;=0A= +}=0A= +=0A= +/*=0A= + * Read the output rate back as Fvco / DIVO and refresh the cached rate. C= aller=0A= + * must hold sitdev->multiop_lock.=0A= + */=0A= +int sit9531x_output_freq_get(struct sit9531x_dev *sitdev, u8 out_idx,=0A= + u64 *frequency)=0A= +{=0A= + const struct sit9531x_chip_info *info =3D sitdev->info;=0A= + u64 fvco, divo;=0A= + u8 pll_idx;=0A= + int rc;=0A= +=0A= + lockdep_assert_held(&sitdev->multiop_lock);=0A= +=0A= + if (out_idx >=3D info->num_outputs)=0A= + return -EINVAL;=0A= +=0A= + pll_idx =3D sitdev->out[out_idx].pll_idx;=0A= + if (pll_idx >=3D SIT9531X_NUM_PLLS || !sitdev->out[out_idx].routed) {=0A= + sitdev->out[out_idx].freq =3D 0;=0A= + return -ENODATA;=0A= + }=0A= +=0A= + rc =3D sit9531x_get_fvco(sitdev, pll_idx, &fvco);=0A= + if (!rc)=0A= + rc =3D sit9531x_output_divo_read(sitdev, out_idx, &divo);=0A= + if (rc) {=0A= + if (rc =3D=3D -ENODATA)=0A= + sitdev->out[out_idx].freq =3D 0;=0A= + return rc;=0A= + }=0A= +=0A= + /* Nearest hertz; truncation can take a listed rate out of its range */= =0A= + *frequency =3D div64_u64(fvco + divo / 2, divo);=0A= + sitdev->out[out_idx].freq =3D *frequency;=0A= +=0A= + return 0;=0A= +}=0A= +=0A= /* The latches INTRB reports, each with its sticky bits */=0A= static const struct {=0A= unsigned int reg;=0A= @@ -2012,9 +2678,17 @@ static void sit9531x_reselect(struct sit9531x_dev *s= itdev, u8 pll_idx)=0A= static bool=0A= sit9531x_dev_chan_states_update(struct sit9531x_dev *sitdev)=0A= {=0A= - bool answered =3D false;=0A= + bool answered =3D false, bank;=0A= int i, rc;=0A= =0A= + /* Retry pending writes first so the reads below see their result */=0A= + if (sitdev->bank_pending || sitdev->loops_open) {=0A= + bank =3D sitdev->bank_pending;=0A= + sit9531x_prg_retry(sitdev);=0A= + if (bank && !sitdev->bank_pending)=0A= + dev_info(sitdev->dev, "output divider bank updated\n");=0A= + }=0A= +=0A= sit9531x_input_off_retry(sitdev);=0A= for (i =3D 0; i < SIT9531X_NUM_PLLS; i++) {=0A= sit9531x_table_back_retry(sitdev, i);=0A= @@ -2359,6 +3033,18 @@ static void sit9531x_dev_stop(struct sit9531x_dev *s= itdev)=0A= "input %u: receiver gate-off not applied at removal\n",=0A= i);=0A= mutex_unlock(&sitdev->multiop_lock);=0A= +=0A= + mutex_lock(&sitdev->multiop_lock);=0A= + if (sitdev->bank_pending || sitdev->loops_open) {=0A= + sit9531x_prg_retry(sitdev);=0A= + if (sitdev->bank_pending)=0A= + dev_warn(sitdev->dev,=0A= + "output divider bank update not issued at removal\n");=0A= + if (sitdev->loops_open)=0A= + dev_warn(sitdev->dev,=0A= + "output loops left unlocked at removal\n");=0A= + }=0A= + mutex_unlock(&sitdev->multiop_lock);=0A= }=0A= =0A= static struct sit9531x_dpll_pin *=0A= diff --git a/drivers/dpll/sit9531x/core.h b/drivers/dpll/sit9531x/core.h=0A= index 222f34a79b9b..e664a3d247e1 100644=0A= --- a/drivers/dpll/sit9531x/core.h=0A= +++ b/drivers/dpll/sit9531x/core.h=0A= @@ -33,6 +33,9 @@=0A= */=0A= #define SIT9531X_OUT_FREQ_CONT_MAX_HZ 800000000ULL=0A= #define SIT9531X_OUT_FREQ_STEP_HZ 61440000ULL=0A= +#define SIT9531X_OUT_FREQ_MAX_HZ (SIT9531X_OUT_FREQ_STEP_HZ * 48)=0A= +/* Datasheet Table 6: a single-ended (LVCMOS) output runs up to 250 MHz */= =0A= +#define SIT9531X_OUT_FREQ_CMOS_MAX_HZ 250000000ULL=0A= /*=0A= * INTSYNC, the inter-PLL sync line, is two pins: an input pin on the PLL = that=0A= * locks to it, numbered after the inputs and the xtal, and an output pin = on the=0A= @@ -240,6 +243,10 @@ struct sit9531x_chan {=0A= * @reset_gpio: optional reset line, NULL if absent=0A= * @irq: optional INTRB IRQ, 0 if not wired=0A= * @irq_ack_fails: consecutive failed INTRB acknowledgements=0A= + * @fvco_band_warned: bit per PLL warned for Fref * DIVN outside its VCO= =0A= + * band; written under @multiop_lock=0A= + * @loops_open: output loops not yet re-locked=0A= + * @bank_pending: output divider bank update still to be issued=0A= */=0A= struct sit9531x_dev {=0A= struct device *dev;=0A= @@ -253,6 +260,7 @@ struct sit9531x_dev {=0A= int page;=0A= =0A= u8 irq_ack_fails;=0A= + u8 fvco_band_warned;=0A= struct sit9531x_ref ref[SIT9531X_MAX_INPUTS + 1]; /* +1 for xtal */=0A= struct sit9531x_out out[SIT9531X_MAX_OUTPUTS];=0A= struct sit9531x_chan chan[SIT9531X_NUM_PLLS];=0A= @@ -269,6 +277,9 @@ struct sit9531x_dev {=0A= =0A= struct gpio_desc *reset_gpio;=0A= int irq;=0A= +=0A= + bool loops_open;=0A= + bool bank_pending;=0A= };=0A= =0A= int sit9531x_read_u8(struct sit9531x_dev *sitdev, unsigned int reg,=0A= @@ -296,6 +307,11 @@ int sit9531x_input_prio_remove(struct sit9531x_dev *si= tdev, u8 pll_idx,=0A= int sit9531x_input_prio_add(struct sit9531x_dev *sitdev, u8 pll_idx,=0A= u8 input_idx);=0A= =0A= +int sit9531x_output_freq_set(struct sit9531x_dev *sitdev, u8 out_idx,=0A= + u8 pll_idx, u64 frequency);=0A= +int sit9531x_output_freq_get(struct sit9531x_dev *sitdev, u8 out_idx,=0A= + u64 *frequency);=0A= +=0A= static inline u8 sit9531x_pll_page(u8 pll_idx)=0A= {=0A= return SIT9531X_PAGE_PLLA + pll_idx;=0A= diff --git a/drivers/dpll/sit9531x/dpll.c b/drivers/dpll/sit9531x/dpll.c=0A= index 3a31d0707127..25bee483bb5a 100644=0A= --- a/drivers/dpll/sit9531x/dpll.c=0A= +++ b/drivers/dpll/sit9531x/dpll.c=0A= @@ -305,6 +305,24 @@ sit9531x_dpll_input_pin_direction_get(const struct dpl= l_pin *pin,=0A= return 0;=0A= }=0A= =0A= +/* Report the first supported-frequencies-hz entry */=0A= +static int=0A= +sit9531x_dpll_input_pin_frequency_get(const struct dpll_pin *pin,=0A= + void *pin_priv,=0A= + const struct dpll_device *dpll,=0A= + void *dpll_priv, u64 *frequency,=0A= + struct netlink_ext_ack *extack)=0A= +{=0A= + struct sit9531x_dpll_pin *dpin =3D pin_priv;=0A= + struct sit9531x_dpll *sitdpll =3D dpll_priv;=0A= + const struct sit9531x_ref *ref;=0A= +=0A= + ref =3D sit9531x_ref_state_get(sitdpll->dev, dpin->id);=0A= + *frequency =3D ref->freq;=0A= +=0A= + return 0;=0A= +}=0A= +=0A= static int=0A= sit9531x_dpll_input_pin_state_on_dpll_get(const struct dpll_pin *pin,=0A= void *pin_priv,=0A= @@ -496,6 +514,20 @@ sit9531x_dpll_input_pin_prio_set(const struct dpll_pin= *pin, void *pin_priv,=0A= }=0A= =0A= static const struct dpll_pin_ops sit9531x_dpll_input_pin_ops =3D {=0A= + .direction_get =3D sit9531x_dpll_input_pin_direction_get,=0A= + .frequency_get =3D sit9531x_dpll_input_pin_frequency_get,=0A= + .state_on_dpll_get =3D sit9531x_dpll_input_pin_state_on_dpll_get,=0A= + .state_on_dpll_set =3D sit9531x_dpll_input_pin_state_on_dpll_set,=0A= + .operstate_on_dpll_get =3D sit9531x_dpll_input_pin_operstate_on_dpll_get,= =0A= + .prio_get =3D sit9531x_dpll_input_pin_prio_get,=0A= + .prio_set =3D sit9531x_dpll_input_pin_prio_set,=0A= +};=0A= +=0A= +/*=0A= + * For an input with no supported-frequencies-hz: the core fails a whole p= in=0A= + * dump if any callback returns an error.=0A= + */=0A= +static const struct dpll_pin_ops sit9531x_dpll_input_pin_norate_ops =3D {= =0A= .direction_get =3D sit9531x_dpll_input_pin_direction_get,=0A= .state_on_dpll_get =3D sit9531x_dpll_input_pin_state_on_dpll_get,=0A= .state_on_dpll_set =3D sit9531x_dpll_input_pin_state_on_dpll_set,=0A= @@ -520,6 +552,14 @@ sit9531x_dpll_manual_pin_state_on_dpll_set(const struc= t dpll_pin *pin,=0A= }=0A= =0A= static const struct dpll_pin_ops sit9531x_dpll_input_pin_manual_ops =3D {= =0A= + .direction_get =3D sit9531x_dpll_input_pin_direction_get,=0A= + .frequency_get =3D sit9531x_dpll_input_pin_frequency_get,=0A= + .state_on_dpll_get =3D sit9531x_dpll_input_pin_state_on_dpll_get,=0A= + .state_on_dpll_set =3D sit9531x_dpll_manual_pin_state_on_dpll_set,=0A= + .operstate_on_dpll_get =3D sit9531x_dpll_input_pin_operstate_on_dpll_get,= =0A= +};=0A= +=0A= +static const struct dpll_pin_ops sit9531x_dpll_input_pin_norate_manual_ops= =3D {=0A= .direction_get =3D sit9531x_dpll_input_pin_direction_get,=0A= .state_on_dpll_get =3D sit9531x_dpll_input_pin_state_on_dpll_get,=0A= .state_on_dpll_set =3D sit9531x_dpll_manual_pin_state_on_dpll_set,=0A= @@ -545,6 +585,7 @@ sit9531x_dpll_xo_pin_state_on_dpll_get(const struct dpl= l_pin *pin,=0A= =0A= static const struct dpll_pin_ops sit9531x_dpll_xo_pin_ops =3D {=0A= .direction_get =3D sit9531x_dpll_input_pin_direction_get,=0A= + .frequency_get =3D sit9531x_dpll_input_pin_frequency_get,=0A= .state_on_dpll_get =3D sit9531x_dpll_xo_pin_state_on_dpll_get,=0A= .prio_get =3D sit9531x_dpll_input_pin_prio_get,=0A= };=0A= @@ -552,6 +593,7 @@ static const struct dpll_pin_ops sit9531x_dpll_xo_pin_o= ps =3D {=0A= /* For a PLL on manual input select, which uses no priority table */=0A= static const struct dpll_pin_ops sit9531x_dpll_xo_pin_manual_ops =3D {=0A= .direction_get =3D sit9531x_dpll_input_pin_direction_get,=0A= + .frequency_get =3D sit9531x_dpll_input_pin_frequency_get,=0A= .state_on_dpll_get =3D sit9531x_dpll_xo_pin_state_on_dpll_get,=0A= };=0A= =0A= @@ -567,8 +609,84 @@ sit9531x_dpll_output_pin_direction_get(const struct dp= ll_pin *pin,=0A= return 0;=0A= }=0A= =0A= +/*=0A= + * Report Fvco / DIVO, or 0 Hz when the divider chain does not resolve; an= =0A= + * error here fails the whole pin dump. A rate found outside the advertise= d=0A= + * ranges is reported as found.=0A= + */=0A= +static int=0A= +sit9531x_dpll_output_pin_frequency_get(const struct dpll_pin *pin,=0A= + void *pin_priv,=0A= + const struct dpll_device *dpll,=0A= + void *dpll_priv, u64 *frequency,=0A= + struct netlink_ext_ack *extack)=0A= +{=0A= + struct sit9531x_dpll_pin *dpin =3D pin_priv;=0A= + struct sit9531x_dpll *sitdpll =3D dpll_priv;=0A= + struct sit9531x_dev *sitdev =3D sitdpll->dev;=0A= + int rc;=0A= +=0A= + mutex_lock(&sitdev->multiop_lock);=0A= + rc =3D sit9531x_output_freq_get(sitdev, dpin->id, frequency);=0A= + if (rc =3D=3D -ENODATA)=0A= + *frequency =3D 0;=0A= + mutex_unlock(&sitdev->multiop_lock);=0A= +=0A= + return rc =3D=3D -ENODATA ? 0 : rc;=0A= +}=0A= +=0A= +static int=0A= +sit9531x_dpll_output_pin_frequency_set(const struct dpll_pin *pin,=0A= + void *pin_priv,=0A= + const struct dpll_device *dpll,=0A= + void *dpll_priv, u64 frequency,=0A= + struct netlink_ext_ack *extack)=0A= +{=0A= + struct sit9531x_dpll_pin *dpin =3D pin_priv;=0A= + struct sit9531x_dpll *sitdpll =3D dpll_priv;=0A= + struct sit9531x_dev *sitdev =3D sitdpll->dev;=0A= + bool moved =3D false;=0A= + u8 actual_pll;=0A= + u64 was, hz;=0A= + int rc;=0A= +=0A= + actual_pll =3D sitdev->out[dpin->id].pll_idx;=0A= +=0A= + mutex_lock(&sitdev->multiop_lock);=0A= + /* The advertised range is the same for every output mode */=0A= + if (sitdev->out[dpin->id].cmos &&=0A= + frequency > SIT9531X_OUT_FREQ_CMOS_MAX_HZ) {=0A= + mutex_unlock(&sitdev->multiop_lock);=0A= + NL_SET_ERR_MSG(extack,=0A= + "Frequency above the 250 MHz limit of an LVCMOS output");=0A= + return -EINVAL;=0A= + }=0A= + was =3D sitdev->out[dpin->id].freq;=0A= + rc =3D sit9531x_output_freq_set(sitdev, dpin->id, actual_pll,=0A= + frequency);=0A= + if (rc) {=0A= + if (!sit9531x_output_freq_get(sitdev, dpin->id, &hz))=0A= + moved |=3D hz !=3D was;=0A= + }=0A= + mutex_unlock(&sitdev->multiop_lock);=0A= +=0A= + if (rc) {=0A= + struct dpll_pin *dpll_pin;=0A= +=0A= + NL_SET_ERR_MSG(extack, "Output frequency set failed");=0A= + /* The core notifies only a request that succeeded */=0A= + dpll_pin =3D READ_ONCE(dpin->dpll_pin);=0A= + if (moved && dpll_pin)=0A= + __dpll_pin_change_ntf(dpll_pin);=0A= + }=0A= +=0A= + return rc;=0A= +}=0A= +=0A= static const struct dpll_pin_ops sit9531x_dpll_output_pin_ops =3D {=0A= .direction_get =3D sit9531x_dpll_output_pin_direction_get,=0A= + .frequency_get =3D sit9531x_dpll_output_pin_frequency_get,=0A= + .frequency_set =3D sit9531x_dpll_output_pin_frequency_set,=0A= };=0A= =0A= const struct dpll_pin_ops *=0A= @@ -584,6 +702,12 @@ sit9531x_dpll_pin_ops_get(const struct sit9531x_dpll_p= in *pin)=0A= if (sit9531x_dpll_is_xo_pin(pin))=0A= return manual ? &sit9531x_dpll_xo_pin_manual_ops :=0A= &sit9531x_dpll_xo_pin_ops;=0A= + /*=0A= + * Set before any pin of the input is published and not written again.=0A= + */=0A= + if (!sit9531x_ref_state_get(sitdev, pin->id)->freq)=0A= + return manual ? &sit9531x_dpll_input_pin_norate_manual_ops :=0A= + &sit9531x_dpll_input_pin_norate_ops;=0A= return manual ? &sit9531x_dpll_input_pin_manual_ops :=0A= &sit9531x_dpll_input_pin_ops;=0A= }=0A= diff --git a/drivers/dpll/sit9531x/prop.c b/drivers/dpll/sit9531x/prop.c=0A= index cfe1ab044c0b..15294d07b703 100644=0A= --- a/drivers/dpll/sit9531x/prop.c=0A= +++ b/drivers/dpll/sit9531x/prop.c=0A= @@ -251,14 +251,6 @@ sit9531x_pin_props_get(struct sit9531x_dev *sitdev,=0A= goto err_alloc_ranges;=0A= }=0A= =0A= - /* The first listed rate seeds the input's rate */=0A= - if (num_freqs > 0 && dir =3D=3D DPLL_PIN_DIRECTION_INPUT && !xo)=0A= - curr_freq =3D freqs[0];=0A= -=0A= -skip_fwnode_props:=0A= - if (sync_in || sync_out)=0A= - return props;=0A= -=0A= /* A rate written as a 64-bit cell reads as 0, then the rate */=0A= for (i =3D 0; i < num_freqs; i++) {=0A= if (!freqs[i]) {=0A= @@ -270,6 +262,33 @@ sit9531x_pin_props_get(struct sit9531x_dev *sitdev,=0A= }=0A= }=0A= =0A= + /*=0A= + * The driver does not read an input's rate; the first listed rate seeds= =0A= + * it.=0A= + */=0A= + if (num_freqs > 0 && dir =3D=3D DPLL_PIN_DIRECTION_INPUT && !xo)=0A= + curr_freq =3D freqs[0];=0A= +=0A= +skip_fwnode_props:=0A= + if (sync_in || sync_out)=0A= + return props;=0A= +=0A= + /*=0A= + * Read the divider once so a bus fault fails the probe and the cached=0A= + * rate starts at the running one; -ENODATA is an unprogrammed divider=0A= + * or unknown VCO rate.=0A= + */=0A= + if (dir =3D=3D DPLL_PIN_DIRECTION_OUTPUT &&=0A= + index < sitdev->info->num_outputs) {=0A= + u64 hw_freq;=0A= +=0A= + mutex_lock(&sitdev->multiop_lock);=0A= + rc =3D sit9531x_output_freq_get(sitdev, index, &hw_freq);=0A= + mutex_unlock(&sitdev->multiop_lock);=0A= + if (rc && rc !=3D -ENODATA)=0A= + goto err_alloc_ranges;=0A= + }=0A= +=0A= /*=0A= * An output with no listed rates gets the output rates of the=0A= * datasheet; the XO gets its one rate.=0A= @@ -281,8 +300,12 @@ sit9531x_pin_props_get(struct sit9531x_dev *sitdev,=0A= goto err_alloc_ranges;=0A= }=0A= =0A= - /* Set after the last allocation that can fail */=0A= - if (curr_freq && dir =3D=3D DPLL_PIN_DIRECTION_INPUT)=0A= + /*=0A= + * Set after the last allocation that can fail, and only once, as pins=0A= + * of other DPLLs on this input may already be published.=0A= + */=0A= + if (curr_freq && dir =3D=3D DPLL_PIN_DIRECTION_INPUT &&=0A= + !sitdev->ref[index].freq)=0A= sitdev->ref[index].freq =3D curr_freq;=0A= =0A= j =3D 0;=0A= diff --git a/drivers/dpll/sit9531x/regs.h b/drivers/dpll/sit9531x/regs.h=0A= index 8f0e9593022a..04723097d2b2 100644=0A= --- a/drivers/dpll/sit9531x/regs.h=0A= +++ b/drivers/dpll/sit9531x/regs.h=0A= @@ -83,6 +83,8 @@=0A= * bit 2 program the efuse (the driver never issues it)=0A= * bit 1 small change update=0A= * bit 0 escape to the PRG_CMD state=0A= + * Writes made in PRG_CMD take effect with bit 4, as Out_Freq_CHange_v2.py= =0A= + * does; bit 6 then leaves the state.=0A= */=0A= #define SIT9531X_REG_GLOBAL_UPDATE SIT9531X_REG(0x00, 0x0F)=0A= #define SIT9531X_SMALL_UPDATE_CMD 0x02=0A= @@ -139,6 +141,40 @@=0A= */=0A= #define SIT9531X_PAGE_OUTSYS0_SLOT_MAX 5 /* slots 0-5 on Page 0x03 */=0A= =0A= +#define SIT9531X_REG_PRG_DIR_GEN SIT9531X_REG(0x03, 0x0F)=0A= +#define SIT9531X_PRG_CMD_STATE 0x01=0A= +#define SIT9531X_UPDATE_NVM_BANK 0x10=0A= +#define SIT9531X_LOOP_LOCK 0x40=0A= +=0A= +/* Debug register (same offset, per-page) */=0A= +#define SIT9531X_REG_OUTSYS_DEBUG SIT9531X_REG(0x03, 0xBD)=0A= +#define SIT9531X_DEBUG_UNLOCK_VAL 0xC3=0A= +#define SIT9531X_DEBUG_LOCK_VAL 0x00=0A= +=0A= +/*=0A= + * Register-triggered phase flush: DIVO_PHASE_SEL_REG selects the register= =0A= + * trigger; pulsing DIVO_PHASE_TRIG high then low flushes. Preserve the OE= b=0A= + * trigger bits [7:6].=0A= + */=0A= +#define SIT9531X_REG_GPIO_FUNC_CTRL1 SIT9531X_REG(0x00, 0x65)=0A= +#define SIT9531X_DIVO_PHASE_SEL_REG BIT(5)=0A= +#define SIT9531X_DIVO_PHASE_TRIG BIT(4)=0A= +=0A= +/* PLL page register offsets, pages 0x0A-0x0D */=0A= +#define SIT9531X_PLL_REG_SMALL_UPDATE 0x0F=0A= +=0A= +/* On-demand phase-flush enable (PLL page reg 0x3D bit 7) */=0A= +#define SIT9531X_PLL_REG_PHFL_CTRL 0x3D=0A= +#define SIT9531X_PLL_PHFL_ON_DEMAND_EN BIT(7)=0A= +=0A= +/* Whether the PLL has the phase-flush feature (PLL page reg 0x47 bit 7) *= /=0A= +#define SIT9531X_PLL_REG_CONFIG47 0x47=0A= +#define SIT9531X_PLL_CONFIG47_PHFL_EN BIT(7)=0A= +=0A= +/* Directives_GENERIC_PLL: the restart bit restarts the PLL, self-clearing= */=0A= +#define SIT9531X_PLL_REG_DIRECTIVES 0x05=0A= +#define SIT9531X_PLL_DIRECTIVE_RESTART BIT(0)=0A= +=0A= /*=0A= * PLL page regs 0x10-0x15 hold the loop-filter coefficients (3 normal, 3= =0A= * fast-lock); they are GUI generated and must not be changed at runtime.= =0A= @@ -152,6 +188,14 @@=0A= #define SIT9531X_PLL_REG_OUT_MAP_LO 0x28=0A= #define SIT9531X_PLL_REG_STATUS 0x31=0A= =0A= +/* DIVN registers (free-run divider readback) */=0A= +#define SIT9531X_PLL_REG_DIVN_INT 0x30=0A= +#define SIT9531X_PLL_REG_DIVN_NUM 0x32 /* 4 bytes (0x32-0x35) */=0A= +#define SIT9531X_PLL_REG_DIVN_DEN 0x38 /* 4 bytes (0x38-0x3B) */=0A= +=0A= +/* DIVN is carried as fixed point, in steps of 1e-12 of a whole divider */= =0A= +#define SIT9531X_DIVN_SCALE 1000000000000ULL=0A= +=0A= #define SIT9531X_PLL_REG_ACTIVE 0x02=0A= #define SIT9531X_PLL_ACTIVE_BIT BIT(0) /* PLL reached active state */=0A= =0A= -- =0A= 2.39.2 (Apple Git-143)=0A= =0A=