Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp1285819rdh; Mon, 25 Sep 2023 08:18:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHX0AIyP1Pb81G/aC3L7MUZpDKk/SArxY/3jCDNPFixP0J239p8mvQqqpSymvCE2v57swwW X-Received: by 2002:a05:6358:7250:b0:125:a552:4389 with SMTP id i16-20020a056358725000b00125a5524389mr8363801rwa.22.1695655091483; Mon, 25 Sep 2023 08:18:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695655091; cv=none; d=google.com; s=arc-20160816; b=pD+GF/7Kjv5TsXfpwQJa4HXaB3LOOjitL2b8Kpih6qnvV7pGADO8BEHVHmfesVujlA f6TSeaB+DtrdtDij4Ti6mdJdGzmpaVfLzBkykCz9lGEGokLf5595bsjvmm39914z1Rb6 vMbd7qTYnFTtqR+dAv3nInG1SLfaMOSt9PMFQPWFsR5Ld0cbcphCHGzgDfoadGApKLlN tBPvgr1/Z5Z4gZKHlDPPPKsdscFZH0AnLguz4Wrn8d/VQHSpT+tUrclZm5W3Ii4Xzux6 aea5RECosw31CLrpxHurg/TogOwd5Cog1ZJ1uyUq/3FmHW4YgsIeqdeenihEgF+lYLIu MjHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=t/sMphRuA0VcjIhUu52wZChuZavyxtp56aeA36+PYxE=; fh=VOJ3lGcaf2ThxoNHMoWFoY3qC7nBdUv4VW+8MQxKpPI=; b=Gn59TSMQ7KNyyt8nwK0kbHL2sHT9ybHJYidNkyIC5FbtpZnhnKULHwrncghzaGRSne AfjZD4iBcJaWAsMmDuA2M/DVdl3PYWaCLiwORt4eCCkfZCPdR5FvHTH9Br1GHYggqfko s2s/XmXPRUqv9QT0ENXCZyZlJ6NJvz+vrrogkjcdp+viDXxChqzcbE8lj5Vdv4nALAri u045BViEdrjsFtoJZStUdZ7x0C0vBl1hDtiZBCuwxAeFsb2+/1vhz4AYhf0myVHmN3I4 5SgjvEurv0ewaYRhjfeUWZWSiCCZTQ3JdOfh1DriDy5VBtXCv8bsyaBr2PRBDrVr9LpO iLVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=aUOOreRI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id bk13-20020a056a02028d00b00582f2161cb4si2673459pgb.300.2023.09.25.08.18.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 08:18:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=aUOOreRI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 3C059808D49E; Mon, 25 Sep 2023 07:43:57 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232306AbjIYOnr (ORCPT + 99 others); Mon, 25 Sep 2023 10:43:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229450AbjIYOnp (ORCPT ); Mon, 25 Sep 2023 10:43:45 -0400 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6707211B for ; Mon, 25 Sep 2023 07:43:39 -0700 (PDT) Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-4053c6f0d55so61666265e9.0 for ; Mon, 25 Sep 2023 07:43:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1695653018; x=1696257818; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=t/sMphRuA0VcjIhUu52wZChuZavyxtp56aeA36+PYxE=; b=aUOOreRInVc77su+vU68pq2DcBu5WxOTbtrNFudxrQ8+rlB7kQrHZIZAFzjaIGgW3D eT+c5NJqWpQELL9YvLEtchHONLQZ66xRMYZFFqofbmPmVtUJqTwz3cr/24e/yR2AAX+D ppuGlSUtnZn/ikZj/7SP5hL02ArrdVyNzxnXtW09BFh4qXgZmjDeqwj8Ya6oqbOUmL+4 dmGfwrf4+liTNGwnYco313nVsnld1qR1ZcvYf13ZOnp1lZj6FIHaIDicgzmyf9raCpqP lS6j1A7HaPGi4T/WrVpL7hgs0hI83sSJ4uPYWIReNGysu3eVDBCBra0UMPNAU6DIf3w6 k+jA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695653018; x=1696257818; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=t/sMphRuA0VcjIhUu52wZChuZavyxtp56aeA36+PYxE=; b=i/x51q+TluQMKydBepe8cfXAJH9kD55VLbIE7hNjSLPm8hDzqJj2O2lkvt2gDQUIZU cEhYmTynNz5ythP85U6kMZZrEquxrnawDW5FgGgimD1Wl9GMsxh867DtlOpPZxIfU6H6 FptAA1gaJcByg3yiVn154F4uE2W9vV5ynv7A+Pj3DusWG3lDUdOUnmv4O6n6IcMxZ5qd YnuVn9tsqWkpNFVFeeQM+R7n01C99bmPbzEzuBi0htH7QedlvmWUCeolCSec5t0AyxI+ f6iJT60RmdT2n9TuFOIpw06mjyHIyRp3PcHqFoV2wC386tskjmaHvq253Zc3uvPsxYUB QbIw== X-Gm-Message-State: AOJu0YxDKSVbNF06TrQBqsbVMqXcmCSVLPMqUwOBNbz5wvw0kpkE1e5u i1ZiuOyxepR+v8EUaGX81dkQEg== X-Received: by 2002:a7b:cd07:0:b0:405:3ae6:2401 with SMTP id f7-20020a7bcd07000000b004053ae62401mr5847424wmj.14.1695653017666; Mon, 25 Sep 2023 07:43:37 -0700 (PDT) Received: from x1 ([193.52.24.5]) by smtp.gmail.com with ESMTPSA id n13-20020a7bc5cd000000b003fee53feab5sm12588862wmk.10.2023.09.25.07.43.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 07:43:37 -0700 (PDT) Date: Mon, 25 Sep 2023 16:43:29 +0200 From: Drew Fustini To: Adrian Hunter Cc: Ulf Hansson , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jisheng Zhang , Guo Ren , Fu Wei , Paul Walmsley , Palmer Dabbelt , Albert Ou , Conor Dooley , Robert Nelson , Jason Kridner , Xi Ruoyao , Han Gao , Icenowy Zheng , linux-mmc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org Subject: Re: [PATCH 3/6] mmc: sdhci-of-dwcmshc: Add support for T-Head TH1520 Message-ID: References: <20230921-th1520-mmc-v1-0-49f76c274fb3@baylibre.com> <20230921-th1520-mmc-v1-3-49f76c274fb3@baylibre.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Mon, 25 Sep 2023 07:43:57 -0700 (PDT) On Mon, Sep 25, 2023 at 01:35:36PM +0300, Adrian Hunter wrote: > On 22/09/23 04:49, Drew Fustini wrote: > > Add support for the mmc controller in the T-Head TH1520 with the new > > compatible "thead,th1520-dwcmshc". Implement custom sdhci_ops for > > set_uhs_signaling, reset, voltage_switch, and platform_execute_tuning. > > > > Signed-off-by: Drew Fustini > > --- > > drivers/mmc/host/sdhci-of-dwcmshc.c | 456 ++++++++++++++++++++++++++++++++++++ > > 1 file changed, 456 insertions(+) > > > > diff --git a/drivers/mmc/host/sdhci-of-dwcmshc.c b/drivers/mmc/host/sdhci-of-dwcmshc.c > > index 3a3bae6948a8..7294bf1afb7d 100644 > > --- a/drivers/mmc/host/sdhci-of-dwcmshc.c > > +++ b/drivers/mmc/host/sdhci-of-dwcmshc.c > > @@ -35,6 +35,26 @@ > > #define DWCMSHC_CARD_IS_EMMC BIT(0) > > #define DWCMSHC_ENHANCED_STROBE BIT(8) > > #define DWCMSHC_EMMC_ATCTRL 0x40 > > +/* Tuning and auto-tuning fields in AT_CTRL_R control register */ > > +#define AT_CTRL_AT_EN 0x1 /* autotuning is enabled */ > > +#define AT_CTRL_CI_SEL_SHIFT 0x1 /* bit 1 */ > > +#define AT_CTRL_CI_SEL 0x1 /* interval to drive center phase select */ > > +#define AT_CTRL_SWIN_TH_EN_SHIFT 0x2 /* bit 2 */ > > +#define AT_CTRL_SWIN_TH_EN 0x1 /* sampling window threshold enable */ > > +#define AT_CTRL_RPT_TUNE_ERR_SHIFT 0x3 /* bit 3 */ > > +#define AT_CTRL_RPT_TUNE_ERR 0x1 /* enable reporting framing errors */ > > +#define AT_CTRL_SW_TUNE_EN_SHIFT 0x4 /* bit 4 */ > > +#define AT_CTRL_SW_TUNE_EN 0x1 /* enable software managed tuning */ > > +#define AT_CTRL_WIN_EDGE_SEL_SHIFT 0x8 /* bits [11:8] */ > > +#define AT_CTRL_WIN_EDGE_SEL 0xf /* sampling window edge select */ > > +#define AT_CTRL_TUNE_CLK_STOP_EN_SHIFT 0x10 /* bit 16 */ > > +#define AT_CTRL_TUNE_CLK_STOP_EN 0x1 /* clocks stopped during phase code change */ > > +#define AT_CTRL_PRE_CHANGE_DLY_SHIFT 0x11 /* bits [18:17] */ > > +#define AT_CTRL_PRE_CHANGE_DLY 0x1 /* 2-cycle latency */ > > +#define AT_CTRL_POST_CHANGE_DLY_SHIFT 0x13 /* bits [20:19] */ > > +#define AT_CTRL_POST_CHANGE_DLY 0x3 /* 4-cycle latency */ > > +#define AT_CTRL_SWIN_TH_VAL_SHIFT 0x18 /* bits [31:24] */ > > +#define AT_CTRL_SWIN_TH_VAL 0x9 /* sampling window threshold */ > > Here and elsewhere, please try to make use of BIT(), GENMASK(), > FIELD_PREP(), FIELD_GET() Thank you for the advice. FIELD_PREP() and FIELD_GET() look like they can make the code simpler. I'll make use of those macros in the next version. thanks, drew