Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp801095pxb; Fri, 21 Jan 2022 03:44:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJxvgpEHYGB6AmUlPxOp45c/m51Ii8fiu9RUPE9/Wf2n4/LFeJVOd2mHcSMMl35+HnHJI/R7 X-Received: by 2002:a17:90a:5994:: with SMTP id l20mr362705pji.121.1642765497424; Fri, 21 Jan 2022 03:44:57 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1642765497; cv=pass; d=google.com; s=arc-20160816; b=soZSz+MtrljbH5CimlDvfmTByap7bMl0hJSuhDSOWovy0zAQI66YS8GNG+I1zwtq3E VS2I+ZrtE69jADZzWhyHo9Apakjat6h7+4u4WdeA9yjRtMRMrrGj1I2GB01nny4AcGdw WrSX2SndpC1TXYffHE8fyGGys86ouo3zVr4zHTc5EmDLaIwzKcxSOUTuEp5ABKKOtVZl kbQVv1LY9BSEHQ3qX/vivXdm8rH3KLxNfRRkNe5IzVuX31MpBuUHLObUG38zRAhCEUoV W+MGCTapH1f+1Ej2a+5oZLbPFEUJcaRDXClZYbstBmOK1jcAPWPmC7sn500I8HbaOSwi ntnQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-language:in-reply-to:user-agent:date:message-id:references :cc:to:subject:from:dkim-signature; bh=nQQpQtM2B2mCmPpZjvJhpcjnEwSZFUErOslKcdU4l1w=; b=IUDBGd8mTBoZLckVGJls+NEkvOeeZM1AiIo9uoaGcGuv7+pITrdWex79r1++isQ05n IRIAs/sTMgEu2Ao+znBF9b4I6QMGov0p68j1F6YLOuuQyqQw+dSxQiOBIi+K9pbcY+k/ uiSu7LGtukE8y47paJn9m2f+Oym7bhZ5c1vv/v1vMaH2tniZdPbjmqF2MLf5QLLqNPta t/JTxkjSCCooNKZc8/AmOln+M7sXw2GRV645GaYfGT7g0D0jMYC98Ze0WEJftZeBgJ3P vXUlVi4EGqZ282GQkuwHDreGXZn2LGOqro45/enxwrAe7mZtOYG1Bloa450ov38JXwqF gJ5g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@seco.com header.s=selector2 header.b=K4BRHLLp; arc=pass (i=1 spf=pass spfdomain=seco.com dkim=pass dkdomain=seco.com dmarc=pass fromdomain=seco.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=seco.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gl7si3273750pjb.5.2022.01.21.03.44.45; Fri, 21 Jan 2022 03:44:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@seco.com header.s=selector2 header.b=K4BRHLLp; arc=pass (i=1 spf=pass spfdomain=seco.com dkim=pass dkdomain=seco.com dmarc=pass fromdomain=seco.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=seco.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350236AbiARXP0 (ORCPT + 99 others); Tue, 18 Jan 2022 18:15:26 -0500 Received: from mail-am6eur05on2060.outbound.protection.outlook.com ([40.107.22.60]:23137 "EHLO EUR05-AM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1350210AbiARXPZ (ORCPT ); Tue, 18 Jan 2022 18:15:25 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YmWReaJJcT+/C61uSZjf8Q58aR0R7AMioNCDcNjkJjI1mQ2eqX4KGf0fmtLeJtCwUx0LhY8AofOWI6QW6MfL6iyfKA44ATBl1tO9r23nm576FziUg3yw2iYeoW7TGYSvM1Kv7Qg9MBpilsZRXk54djkP8G+TRtIMb7BWZ0AMrRIEw4m609tKQvJRNeyqri8SwBPSAaFKlyiuqg1gdx4FSVQKjFgcDheBCRpRW8qDDX4rWfagni5P3CE8Dk5dOFF8nk+cKn6cDIxRH3oK0YlBy5e2cOwtvUpYgQtPHCFVzqgz/lMxVQtkgBptHFmz4Qv5IUf9PAGySKRhOS9GuKLWqQ== 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=nQQpQtM2B2mCmPpZjvJhpcjnEwSZFUErOslKcdU4l1w=; b=c1Rd11EoTb1j3xDdmsKKuD1QWcp+Zwx/rrxhmMY9oSZsF+4F/s7rfEkIyjn/nvX+0FXtdGZnm7tWpFF1nsUYUQsFISbbm09HhqYAQwmJn+fHQ/pMnpyYBNSqh4GCdU+71m21m5kmCrxRLMdW3wrkmz6MoD65C6JS1bp1MkPXnslRlPcFxdQswctI/9r2BtpCd/DU0DOov9ygJG3bjmb4UiEKmkJe2EmlxruunJt85NGZAG0F6NCTEtpmnJoPxs/1kFt1K5wvs5Bs8sj7B2QdjBycDT5vQ5JkIl0bqN9AJTMWyRqqVxOgMa2u6hkNebxbgkG2gwh2wa1Irhp/RpIKQg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=seco.com; dmarc=pass action=none header.from=seco.com; dkim=pass header.d=seco.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seco.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nQQpQtM2B2mCmPpZjvJhpcjnEwSZFUErOslKcdU4l1w=; b=K4BRHLLpvNuhtUVi047BXn0g8YrkMAV3je8Z1+uC0F1DQDahf6nfmxX9xci39dhEcMwW8Rfy57G6CQE3GSyuAbH6bnOuQWhq5Tcx7x44CmyRbJa//CrkPN6RoHM2CHNvxQ3heeMal+GOt+J3NSuNFZamCy4ckD3fkRgBDOMBao5KcgGIueqQGVB69Xu/Q/pP1s2vWyHI1eLe365TicvhOXoUFGnJ+j656hBmfzaXf+Ud2/Q8dm5NJJqOjTAD/G4IODQF7glorIv3zVj4JgXohsw8WXotcsIkgBbTZ+gUjQxG7ckq8VhyHU8vfIwnw/SXm1Flx3KNY0PKFmzgIJ1/NA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB7PR03MB4523.eurprd03.prod.outlook.com (2603:10a6:10:19::27) by AM0PR03MB3682.eurprd03.prod.outlook.com (2603:10a6:208:4d::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4888.12; Tue, 18 Jan 2022 23:15:21 +0000 Received: from DB7PR03MB4523.eurprd03.prod.outlook.com ([fe80::d47e:81b0:256:3005]) by DB7PR03MB4523.eurprd03.prod.outlook.com ([fe80::d47e:81b0:256:3005%4]) with mapi id 15.20.4888.014; Tue, 18 Jan 2022 23:15:21 +0000 From: Sean Anderson Subject: Re: [PATCH 0/6] usb: dwc3: Calculate REFCLKPER et. al. from reference clock To: Robert Hancock , "lijun.kernel@gmail.com" , "jun.li@nxp.com" Cc: "linux-kernel@vger.kernel.org" , "robh+dt@kernel.org" , "linux-usb@vger.kernel.org" , "devicetree@vger.kernel.org" , "bjagadee@codeaurora.org" , "linux-arm-msm@vger.kernel.org" , "michal.simek@xilinx.com" , "Thinh.Nguyen@synopsys.com" , "baruch@tkos.co.il" , "balbi@kernel.org" , "bjorn.andersson@linaro.org" , "gregkh@linuxfoundation.org" , "linux-arm-kernel@lists.infradead.org" , "agross@kernel.org" References: <20220114233904.907918-1-sean.anderson@seco.com> <79d6057a70dae09bcc30a35f608f51c5a768d097.camel@calian.com> Message-ID: <4dd8aced-174c-03b9-87f3-70026c963f6e@seco.com> Date: Tue, 18 Jan 2022 18:15:16 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 In-Reply-To: <79d6057a70dae09bcc30a35f608f51c5a768d097.camel@calian.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-ClientProxiedBy: BLAPR03CA0016.namprd03.prod.outlook.com (2603:10b6:208:32b::21) To DB7PR03MB4523.eurprd03.prod.outlook.com (2603:10a6:10:19::27) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8657d560-659b-4c02-fefe-08d9dad86618 X-MS-TrafficTypeDiagnostic: AM0PR03MB3682:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Kpdj2Qs6ZJW16MqSCU6uZGzz0cpYMYjMNWjjpZZie2/6TtSO+zQxM5uz5lWIrUufwSQMiVTqzVQO2nTEw8QDaOwyV2pKv8FlMSHZxSKk+FP1TRzw+Qyk+E9W/a0CETcCoTwiAwni6wYR3uRN9o2Bc6FE2PdijttKzrprKm2d1bbA1OyjRXGnVenDw1DVcSVte04y5CJ1wwIhV8+Uv2T00v/lRzb2y2NnjAgphC1v5BxDWefnVAI9Vt0d0ucLzSYKrq+DsmZxuUerAdlNiNj8j7ftnoDDyXjLvR3PzQlSGpdjPpg8N5sYzyYFHO6QmN5BSHJ7WKDrsmsOAUv88A0rMR3nC+YI1/t25SYASzUjKwwpIZqREmflLWHQDFOldvgv9o/4lEnffzrPDXkqeAzWBXxsPgJ7oi2cgSLBVPrGyLuMKk1qNGIEq55JpdHeLBJvnHFguva4M/dUgCxlucM+Cp9YK61SrmwEr/DPHPI1Nknv4hWHWwQB+za1q7JtcouUyFNW6B0cisynojjBg8aJyYEhAd2aG2LvyYQn2N2mcU3uO1ddftKDrmFF/PJt2BI0s4nKX1csxu6+ETlQYjOE5nyHoCZ9jhuRs0fVnJtnNWiO4NLBDbck35JKmirFcb9r4liFKa6SgTtOqBDsrzjNlXAr/yaVyDXFbV7+sy9oauy1B+qbSiXhw40ANb7gVRx49YqhpCn9LBL4SFKlZujuta5KqAFG8vXzB0LiJf0E0BtLsh3+BMwjUyuoaHcjMl8bsoXIRx+2TtcWAwe8FS4+5DkZoXn3aV52mysgDc770BEb3n7WGtaWLlGBSBzQEjbtGXDknTCVR1MWWyOm3MFtHBK/O0ivJ5pANdjI7NNet/E= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR03MB4523.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(66476007)(966005)(5660300002)(66946007)(8676002)(66556008)(36756003)(31696002)(508600001)(86362001)(6486002)(8936002)(186003)(52116002)(53546011)(2616005)(7416002)(6666004)(316002)(44832011)(2906002)(6512007)(4326008)(31686004)(83380400001)(110136005)(38350700002)(38100700002)(6506007)(26005)(54906003)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?ZjN2L3ZRaXlNODZZbUFOREZHb0JFVGtyTUJnNnhaVWx6Qlc4WEVOT2QzTW51?= =?utf-8?B?NnR3SUg3elFLZU4veXd2N0pxQS9lY1JoME54R2Y4eDA0RkVNWDZWemxTZmZ5?= =?utf-8?B?dTcxNkJNd0ZsRm90eFBWZ0FqdHJwUTdwcHlZd1dXZ1dtSkFlQUZxMHQ1V2hI?= =?utf-8?B?YUhKQ3hZSzVM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HdHUnhVSnRZZ3VQQ2hT?= =?utf-8?B?ZFYzdTNiRjA4cEt3VzVmcDRtZjBsZkRxVnViZ3JDdWl2RGUrcmVzc0IzbjF2?= =?utf-8?B?QXlDdDhxVW9UZ2RtWjlKNlVpeUV4cGg2bXdETDNxcmRHQWlPMWNPaTI3dWQx?= =?utf-8?B?cWlCNjZwaHFhMFVoS2VGak83Vm5rVHpaQ1V4dmpzS2xTdlJjbVQ3bldaa3ZJ?= =?utf-8?Q?+Bkq34iEudodjGHdoQL/DJk=3D?= X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8657d560-659b-4c02-fefe-08d9dad86618 X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4523.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jan 2022 23:15:21.2528 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: pOPqW3xxdk8D8W+z4IoRBjl0l5YrP/yAiFAUgFrLc/ojBDpWp7jlgirmiFSKW9Y7UNHm2bi6mep/fK6hr0WKTw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR03MB3682 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/17/22 6:49 PM, Robert Hancock wrote: > On Mon, 2022-01-17 at 20:30 +0800, Jun Li wrote: >> Sean Anderson 于2022年1月15日周六 10:11写道: >> > This is a rework of patches 3-5 of [1]. It attempts to correctly program >> > REFCLKPER and REFCLK_FLADJ based on the reference clock frequency. Since >> > we no longer need a special property duplicating this configuration, >> > snps,ref-clock-period-ns is deprecated. >> > >> > Please test this! Patches 3/4 in this series have the effect of >> > programming REFCLKPER and REFCLK_FLADJ on boards which already configure >> > the "ref" clock. I have build tested, but not much else. >> >> DWC3 databook states a *condition* for program those settings: >> >> This field must be programmed to a non-zero value only if >> GFLADJ_REFCLK_LPM_SEL is set to '1' or GCTL.SOFITPSYNC is set to '1'. >> The value is derived as follows: >> FLADJ_REF_CLK_FLADJ=((125000/ref_clk_period_integer)-(125000/ref_clk_period)) >> * ref_clk_period where >> ■ the ref_clk_period_integer is the integer value of the ref_clk >> period got by truncating the decimal (fractional) value that is >> programmed in the GUCTL.REF_CLK_PERIOD field. >> ■ the ref_clk_period is the ref_clk period including the fractional value. >> >> So you may need a condition check, with that, only required users >> are effected even with "ref" clock specified. >> > > The Xilinx register documentation for this register in the DWC3 core ( > https://www.xilinx.com/html_docs/registers/ug1087/usb3_xhci___gfladj.html ) has > the same description, but it is rather confusingly worded. I suspect what they > really mean is that "this field only needs to be programmed if > GFLADJ_REFCLK_LPM_SEL is set to '1' or GCTL.SOFITPSYNC is set to '1'", not > "this field should only be programmed if GFLADJ_REFCLK_LPM_SEL is set to '1' or > GCTL.SOFITPSYNC is set to '1'". I'm not sure if someone can confirm that > interpretation is correct? This is the interpretation I was using as well, since GUCTL.REFCLKPER has similar documentation and it was always programmed before this series. > However, looking at that description a bit further, it looks like there are > some other fields in that register which are dependent on the reference clock: > GFLADJ_REFCLK_240MHZ_DECR (bits 30:24) and GFLADJ_REFCLK_240MHZDECR_PLS1 (bit > 31). It looks like the Xilinx board I am using has those set properly, i.e. to > 12 and 0 respectively (I'm guessing by hardware default, since I don't see > anything in the FSBL psu_init code setting those), but it wouldn't hurt to > ensure those fields are also set correctly. I'll add those in v2. --Sean