Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp5842437pxb; Sun, 7 Nov 2021 21:51:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJzzQXiWa52BJWxCpHjL1I/MGNZMX+LskeH8baPEpR+Tc3zCePEaZoy7ouYZpOh4zwmT6O1V X-Received: by 2002:a02:cab6:: with SMTP id e22mr10672024jap.73.1636350682446; Sun, 07 Nov 2021 21:51:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636350682; cv=none; d=google.com; s=arc-20160816; b=wdflEOjbW5F3CkZrQnsP2NxBkerT0Q9rU+Mf8hougsZ6Jl7EnXESL8JKdzCFcZ+8jl WW4x+cEH5QbnZRsKf0ySz2JrO5EbW/5AxKyhTEGzUyPKQgDm4vXT5I4Ieqol9bTnZER6 VozuFusK+QZO7NcPwD8/29yRUJt21RACMPG2Ox/8b5E9lePAjtXgEdtbTxV3X3okA9zz 9rc3GyzI3aBxX/pnUY1N+H/mjePk0VXvVMEb9kI8T1TwWqm3fFg46jHROjKANY/07TMM 34XRkwZW2SQCq/K6uveJveW/vNAnUl9tzhfNOGFpSr7R8op0/FmNWt5v/7slUchPZ6Vw uSDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:cc:to:from:date:references:in-reply-to :message-id:mime-version:user-agent:dkim-signature:dkim-signature; bh=hbglKme3vaas4sAGDC3hQO7l8i5Rd5gigqzNWaFWDOk=; b=WNsOXjc5m0dnbId08mOufOSefalj+nPbZVNl20pRU8yN1L+PA9/hMbbRns4lUO1Lg9 fulE6pzVHi1Bq7VX2pkREa6ejdEOHBhrjX9zmW+vegVZatEshGV76ZtdbwA2Cre6Eyb6 Hf7gJymLz764vlY+zTYoHeYr/fUQvj0XpZ3PA8rlwMSHqJnHFxjkyE2cNygFW9QiQEj9 gtKhCiuCb5qX/5oKYMHmdk5xWxRqrVMqFS0I9e/F//0KNz1TR+FJQhr+7pmWai70XYl6 o20m4wjzI+scEZ6jQiHUASZjD66iNSeouZtJaqBLwE3EBUY+2Y1ZqrMfFJEOI7Sxag1P Ayuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@aj.id.au header.s=fm1 header.b="cg/olrAc"; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=clVyKuFz; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z4si23235832ilz.95.2021.11.07.21.51.10; Sun, 07 Nov 2021 21:51:22 -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=@aj.id.au header.s=fm1 header.b="cg/olrAc"; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=clVyKuFz; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236056AbhKGXpy (ORCPT + 99 others); Sun, 7 Nov 2021 18:45:54 -0500 Received: from new2-smtp.messagingengine.com ([66.111.4.224]:42425 "EHLO new2-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236047AbhKGXpx (ORCPT ); Sun, 7 Nov 2021 18:45:53 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id 8B2365807D9; Sun, 7 Nov 2021 18:42:59 -0500 (EST) Received: from imap43 ([10.202.2.93]) by compute4.internal (MEProxy); Sun, 07 Nov 2021 18:42:59 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aj.id.au; h= mime-version:message-id:in-reply-to:references:date:from:to:cc :subject:content-type; s=fm1; bh=hbglKme3vaas4sAGDC3hQO7l8i5Rd5g igqzNWaFWDOk=; b=cg/olrAcD9tCJS1i8M23c2flw8WZk1wp4xkWGoML32//6N1 qpzOO+o7dMA8eWLFE6rAsFHsKng+Si7yzX4kDg4aQo7L4qrTvx5MClQ7yQM5fpg+ UOecU3cxTvQ14n90S68RZDuQT/clgf03ZdWu2qOCwhW243IOELSvWBwto2XrJXUL 8Va2qo9ggNRRA2TzvjUKPWPyJi3XXkmQBo9a+p9RQqY4PCKaT9D8mTP/DJarhvYY Ap+Ry5N3Rik+IwlzLY4asm9rCLX3eDrxVLQK58sRR7hD/En0mSU4zUdKWkPZt8P4 gY+YKRZMdJQWlyPPsvNkHYdlk9Ro6vNptu8A47A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=hbglKm e3vaas4sAGDC3hQO7l8i5Rd5gigqzNWaFWDOk=; b=clVyKuFzr3sg/qW8emnEu/ uSflp/Th4kX9QtyLi140V7rgiZSGXP4DNrqqUKTLsq6zHVgEjOztoS7ow26ULuHW kooIkJ6cOXyFxd1cxdxoRGglACdZu4pU8dnH4vbEI3xgVupAQ6zQSl1mJ0/eYsa2 N3Xd8E/756QBt8wVuPf/U0jPmnb8QIplCzch5nl2cLM0zuHtJo6LwWhSe3YywUji aCcBatQcHXMX8qn8jFVd+G70nnvrT6tOQ/ivmUhYxb+L4yCu3fV19GA8gYcB44+b WOOQUw3v5E7SiCAwqAwcjKajlkP8yW1NdCA7T/n0yPa0ukWyRP+auHDVX53mkbxQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddruddugddtkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefofgggkfgjfhffhffvufgtsehttdertderredtnecuhfhrohhmpedftehnughr vgifucflvghffhgvrhihfdcuoegrnhgurhgvfiesrghjrdhiugdrrghuqeenucggtffrrg htthgvrhhnpeehhfefkefgkeduveehffehieehudejfeejveejfedugfefuedtuedvhefh veeuffenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe grnhgurhgvfiesrghjrdhiugdrrghu X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 7E8C5AC0DD1; Sun, 7 Nov 2021 18:42:58 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-1369-gd055fb5e7c-fm-20211018.002-gd055fb5e Mime-Version: 1.0 Message-Id: <30748da1-0fdb-40c1-bf28-8682d3a89c73@www.fastmail.com> In-Reply-To: References: <20210922103116.30652-1-chin-ting_kuo@aspeedtech.com> <20210922103116.30652-6-chin-ting_kuo@aspeedtech.com> <95669b37-d512-4439-86cb-418ab085118f@www.fastmail.com> Date: Mon, 08 Nov 2021 10:12:38 +1030 From: "Andrew Jeffery" To: "Chin-Ting Kuo" , "Rob Herring" , "Joel Stanley" , "Michael Turquette" , "Stephen Boyd" , "Adrian Hunter" , "linux-aspeed@lists.ozlabs.org" , "openbmc@lists.ozlabs.org" , linux-mmc , "devicetree@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "linux-clk@vger.kernel.org" Cc: BMC-SW , "Steven Lee" Subject: Re: [PATCH 05/10] mmc: aspeed: Adjust delay taps calculation method Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Chin-Ting, I've had another think about this, see my comments below. On Sat, 6 Nov 2021, at 20:35, Chin-Ting Kuo wrote: > Hi Andrew, >> > struct aspeed_sdhci_pdata { >> > @@ -158,43 +160,60 @@ aspeed_sdc_set_phase_taps(struct aspeed_sdc >> > *sdc, } >> > >> > #define PICOSECONDS_PER_SECOND 1000000000000ULL >> > -#define ASPEED_SDHCI_NR_TAPS 15 >> > -/* Measured value with *handwave* environmentals and static loading */ >> > -#define ASPEED_SDHCI_MAX_TAP_DELAY_PS 1253 >> > +#define ASPEED_SDHCI_MAX_TAPS 15 >> >> Why are we renaming this? It looks to cause a bit of noise in the diff. >> > > Okay, it can be changed back to the original one in the next patch version. Well, maybe it makes sense, but I think we have to take into account how we describe the taps in the discussion below. >> > - if (phase_deg >= 180) { >> > - inverted = ASPEED_SDHCI_TAP_PARAM_INVERT_CLK; >> > - phase_deg -= 180; >> > - dev_dbg(dev, >> > - "Inverting clock to reduce phase correction from %d to %d >> degrees\n", >> > - phase_deg + 180, phase_deg); >> > - } else { >> > - inverted = 0; >> > + prop_delay_ps = sdc->max_tap_delay_ps / nr_taps; >> > + clk_period_ps = div_u64(PICOSECONDS_PER_SECOND, (u64)rate_hz); >> > + >> > + /* >> > + * For ast2600, if clock phase degree is negative, clock signal is >> > + * output from falling edge first by default. Namely, clock signal >> > + * is leading to data signal by 90 degrees at least. >> > + */ >> >> Have I missed something about a asymmetric clock timings? Otherwise the >> falling edge is 180 degrees away from the rising edge? I'm still not clear on >> why 90 degrees is used here. >> > > Oh, you are right. It should be 180 degrees. > >> > + if (invert) { >> > + if (phase_deg >= 90) >> > + phase_deg -= 90; >> > + else >> > + phase_deg = 0; >> >> Why are we throwing away information? >> > > With the above correction, it should be modified as below. > If the "invert" is needed, we expect that its value should be greater than 180 > degrees. We clear "phase_deg" if its value is unexpected. Maybe, a warning > should be shown and -EINVAL can be returned. > > if (invert) { > if (phase_deg >= 180) > phase_deg -= 180; > else > phase_deg = 0; Though we want this to return the EINVAL right? \>> > + /* >> > + * There are 15 taps recorded in AST2600 datasheet. >> > + * But, actually, the time period of the first tap >> > + * is two times of others. Thus, 16 tap is used to >> > + * emulate this situation. >> > + */ >> > + .nr_taps = 16, >> >> I think this is a very indirect way to communicate the problem. The only time >> we look at nr_taps is in a test that explicitly compensates for the non-uniform >> delay. I think we should just have a boolean struct member called >> 'non_uniform_delay' rather than 'nr_taps', as the number of taps isn't what's >> changing. But also see the discussion below about a potential >> aspeed,tap-delays property. >> > > A new property may be the better choice. I think I'm changing my mind on this sorry. I'm think that aiming for fewer custom devicetree properties is better. Using SoC-specific and device-specific compatibles (i.e. to differentiate between the eMMC and SD controllers in the 2600) we can just encode this data straight in the driver using the OF match data. Rob and/or Joel: Thoughts? > >> Something further to consider is whether we >> separate the compatibles or add e.g. an aspeed,tap-delays property that >> specifies the specific delay of each logic element. This might take the place of >> e.g. the max-tap-delay property? >> > > Yes, an additional property may be better. Again, flip-flopping on this a bit, the aspeed,ast2600-emmc compatible is probably fine, and we add the tap delays in the OF match data for the compatible. This means we get rid of any aspeed-specific devictree properties with respect to the delays. Andrew