All of lore.kernel.org
 help / color / mirror / Atom feed
From: Drew Fustini <dfustini@baylibre.com>
To: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ulf Hansson <ulf.hansson@linaro.org>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Jisheng Zhang <jszhang@kernel.org>, Guo Ren <guoren@kernel.org>,
	Fu Wei <wefu@redhat.com>,
	Paul Walmsley <paul.walmsley@sifive.com>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>,
	Conor Dooley <conor@kernel.org>,
	Robert Nelson <robertcnelson@beagleboard.org>,
	Jason Kridner <jkridner@beagleboard.org>,
	Xi Ruoyao <xry111@xry111.site>, Han Gao <gaohan@iscas.ac.cn>,
	Icenowy Zheng <uwu@icenowy.me>,
	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
Date: Mon, 25 Sep 2023 16:43:29 +0200	[thread overview]
Message-ID: <ZRGckWotC4RYHLNZ@x1> (raw)
In-Reply-To: <a420c2e5-db23-4b61-a110-476f8fb8636a@intel.com>

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 <dfustini@baylibre.com>
> > ---
> >  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

WARNING: multiple messages have this Message-ID (diff)
From: Drew Fustini <dfustini@baylibre.com>
To: Adrian Hunter <adrian.hunter@intel.com>
Cc: devicetree@vger.kernel.org, Ulf Hansson <ulf.hansson@linaro.org>,
	Albert Ou <aou@eecs.berkeley.edu>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Jason Kridner <jkridner@beagleboard.org>,
	linux-kernel@vger.kernel.org, Han Gao <gaohan@iscas.ac.cn>,
	linux-mmc@vger.kernel.org, Conor Dooley <conor+dt@kernel.org>,
	Conor Dooley <conor@kernel.org>,
	Robert Nelson <robertcnelson@beagleboard.org>,
	Rob Herring <robh+dt@kernel.org>, Guo Ren <guoren@kernel.org>,
	Xi Ruoyao <xry111@xry111.site>,
	Jisheng Zhang <jszhang@kernel.org>,
	Paul Walmsley <paul.walmsley@sifive.com>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	linux-riscv@lists.infradead.org, Fu Wei <wefu@redhat.com>
Subject: Re: [PATCH 3/6] mmc: sdhci-of-dwcmshc: Add support for T-Head TH1520
Date: Mon, 25 Sep 2023 16:43:29 +0200	[thread overview]
Message-ID: <ZRGckWotC4RYHLNZ@x1> (raw)
In-Reply-To: <a420c2e5-db23-4b61-a110-476f8fb8636a@intel.com>

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 <dfustini@baylibre.com>
> > ---
> >  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

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  reply	other threads:[~2023-09-25 14:43 UTC|newest]

Thread overview: 82+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-22  1:49 [PATCH 0/6] RISC-V: Add eMMC support for TH1520 boards Drew Fustini
2023-09-22  1:49 ` Drew Fustini
2023-09-22  1:49 ` [PATCH 1/6] dt-bindings: mmc: sdhci-of-dwcmhsc: Add T-Head TH1520 support Drew Fustini
2023-09-22  1:49   ` Drew Fustini
2023-09-22  9:57   ` Conor Dooley
2023-09-22  9:57     ` Conor Dooley
2023-09-22 15:18     ` Drew Fustini
2023-09-22 15:18       ` Drew Fustini
2023-09-23  8:10       ` Guo Ren
2023-09-23  8:10         ` Guo Ren
2023-09-24 21:04         ` Drew Fustini
2023-09-24 21:04           ` Drew Fustini
2023-09-22  1:49 ` [PATCH 2/6] mmc: sdhci: add __sdhci_execute_tuning() to header Drew Fustini
2023-09-22  1:49   ` Drew Fustini
2023-09-25 10:21   ` Adrian Hunter
2023-09-25 10:21     ` Adrian Hunter
2023-09-25 10:23     ` Xi Ruoyao
2023-09-25 10:23       ` Xi Ruoyao
2023-09-25 10:31       ` Adrian Hunter
2023-09-25 10:31         ` Adrian Hunter
2023-09-25 14:41     ` Drew Fustini
2023-09-25 14:41       ` Drew Fustini
2023-09-22  1:49 ` [PATCH 3/6] mmc: sdhci-of-dwcmshc: Add support for T-Head TH1520 Drew Fustini
2023-09-22  1:49   ` Drew Fustini
2023-09-25 10:35   ` Adrian Hunter
2023-09-25 10:35     ` Adrian Hunter
2023-09-25 14:43     ` Drew Fustini [this message]
2023-09-25 14:43       ` Drew Fustini
2023-10-04 16:19   ` Jisheng Zhang
2023-10-04 16:19     ` Jisheng Zhang
2023-10-04 19:12     ` Drew Fustini
2023-10-04 19:12       ` Drew Fustini
2023-09-22  1:49 ` [PATCH 4/6] riscv: dts: thead: Add TH1520 mmc controller and sdhci clock Drew Fustini
2023-09-22  1:49   ` Drew Fustini
2023-09-22  1:49 ` [PATCH 5/6] riscv: dts: thead: Enable BeagleV Ahead eMMC controller Drew Fustini
2023-09-22  1:49   ` Drew Fustini
2023-09-22  1:49 ` [PATCH 6/6] riscv: dts: thead: Enable LicheePi 4A " Drew Fustini
2023-09-22  1:49   ` Drew Fustini
2023-09-22 11:41 ` [PATCH 0/6] RISC-V: Add eMMC support for TH1520 boards Xi Ruoyao
2023-09-22 11:41   ` Xi Ruoyao
2023-09-22 16:23   ` Drew Fustini
2023-09-22 16:23     ` Drew Fustini
2023-09-23 16:33     ` Xi Ruoyao
2023-09-23 16:33       ` Xi Ruoyao
2023-09-23  0:11   ` Icenowy Zheng
2023-09-23  0:11     ` Icenowy Zheng
2023-09-22 19:08 ` Robert Nelson
2023-09-22 19:08   ` Robert Nelson
2023-09-22 22:48   ` Robert Nelson
2023-09-22 22:48     ` Robert Nelson
2023-10-03  4:37     ` Drew Fustini
2023-10-03  4:37       ` Drew Fustini
2023-10-04 11:30       ` Jisheng Zhang
2023-10-04 11:30         ` Jisheng Zhang
2023-10-04 13:02         ` Lad, Prabhakar
2023-10-04 13:02           ` Lad, Prabhakar
2023-10-04 13:49           ` Robin Murphy
2023-10-04 13:49             ` Robin Murphy
2023-10-04 14:02             ` Icenowy Zheng
2023-10-04 14:02               ` Icenowy Zheng
2023-10-04 14:18               ` Robin Murphy
2023-10-04 14:18                 ` Robin Murphy
2023-10-04 14:46                 ` Icenowy Zheng
2023-10-04 14:46                   ` Icenowy Zheng
2023-10-04 14:58                 ` Icenowy Zheng
2023-10-04 14:58                   ` Icenowy Zheng
2023-10-04 16:03                 ` Lad, Prabhakar
2023-10-04 16:03                   ` Lad, Prabhakar
2023-10-04 17:16                   ` Lad, Prabhakar
2023-10-04 17:16                     ` Lad, Prabhakar
2023-10-04 18:49                     ` Samuel Holland
2023-10-04 18:49                       ` Samuel Holland
2023-10-04 19:38                       ` Robin Murphy
2023-10-04 19:38                         ` Robin Murphy
2023-10-04 20:47                         ` Lad, Prabhakar
2023-10-04 20:47                           ` Lad, Prabhakar
2023-10-05  6:57                     ` Christoph Hellwig
2023-10-05  6:57                       ` Christoph Hellwig
2023-10-04 14:06             ` Jisheng Zhang
2023-10-04 14:06               ` Jisheng Zhang
2023-10-04 15:27               ` Geert Uytterhoeven
2023-10-04 15:27                 ` Geert Uytterhoeven

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZRGckWotC4RYHLNZ@x1 \
    --to=dfustini@baylibre.com \
    --cc=adrian.hunter@intel.com \
    --cc=aou@eecs.berkeley.edu \
    --cc=conor+dt@kernel.org \
    --cc=conor@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gaohan@iscas.ac.cn \
    --cc=guoren@kernel.org \
    --cc=jkridner@beagleboard.org \
    --cc=jszhang@kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=robertcnelson@beagleboard.org \
    --cc=robh+dt@kernel.org \
    --cc=ulf.hansson@linaro.org \
    --cc=uwu@icenowy.me \
    --cc=wefu@redhat.com \
    --cc=xry111@xry111.site \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.