From: "Jaehoon Chung" <jh80.chung@samsung.com>
To: "'Judith Mendez'" <jm@ti.com>, "'Peng Fan'" <peng.fan@nxp.com>,
"'Tom Rini'" <trini@konsulko.com>
Cc: "'Nitin Yadav'" <n-yadav@ti.com>,
"'Simon Glass'" <sjg@chromium.org>, <u-boot@lists.denx.de>
Subject: RE: [PATCH 3/5] mmc: am654_sdhci: Add itap_del_ena[] to store itapdlyena bit
Date: Wed, 17 Apr 2024 20:34:08 +0900 [thread overview]
Message-ID: <01fd01da90bb$28fc5300$7af4f900$@samsung.com> (raw)
In-Reply-To: <20240415212747.2678974-4-jm@ti.com>
Hi,
> -----Original Message-----
> From: Judith Mendez <jm@ti.com>
> Sent: Tuesday, April 16, 2024 6:28 AM
> To: Peng Fan <peng.fan@nxp.com>; Jaehoon Chung <jh80.chung@samsung.com>; Tom Rini <trini@konsulko.com>
> Cc: Nitin Yadav <n-yadav@ti.com>; Simon Glass <sjg@chromium.org>; u-boot@lists.denx.de
> Subject: [PATCH 3/5] mmc: am654_sdhci: Add itap_del_ena[] to store itapdlyena bit
>
> Set itap_del_ena if ITAPDLY is found in DT or if the tuning
> algorithm was executed and found the optimal ITAPDLY. Add the
> functionality to save ITAPDLYENA that can be referenced later
> by storing the bit in array itap_del_ena[].
>
> Signed-off-by: Judith Mendez <jm@ti.com>
> ---
> drivers/mmc/am654_sdhci.c | 30 ++++++++++++++++++++----------
> 1 file changed, 20 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/mmc/am654_sdhci.c b/drivers/mmc/am654_sdhci.c
> index 1dd032e1e36..38f1ad28ec4 100644
> --- a/drivers/mmc/am654_sdhci.c
> +++ b/drivers/mmc/am654_sdhci.c
> @@ -92,6 +92,7 @@ struct am654_sdhci_plat {
> bool non_removable;
> u32 otap_del_sel[MMC_MODES_END];
> u32 itap_del_sel[MMC_MODES_END];
> + u32 itap_del_ena[MMC_MODES_END];
> u32 trm_icp;
> u32 drv_strength;
> u32 strb_sel;
> @@ -223,8 +224,10 @@ static int am654_sdhci_setup_dll(struct am654_sdhci_plat *plat,
> }
>
> static void am654_sdhci_write_itapdly(struct am654_sdhci_plat *plat,
> - u32 itapdly)
> + u32 itapdly, u32 enable)
> {
> + regmap_update_bits(plat->base, PHY_CTRL4, ITAPDLYENA_MASK,
> + enable << ITAPDLYENA_SHIFT);
> /* Set ITAPCHGWIN before writing to ITAPDLY */
> regmap_update_bits(plat->base, PHY_CTRL4, ITAPCHGWIN_MASK,
> 1 << ITAPCHGWIN_SHIFT);
> @@ -242,7 +245,8 @@ static void am654_sdhci_setup_delay_chain(struct am654_sdhci_plat *plat,
> mask = SELDLYTXCLK_MASK | SELDLYRXCLK_MASK;
> regmap_update_bits(plat->base, PHY_CTRL5, mask, val);
>
> - am654_sdhci_write_itapdly(plat, plat->itap_del_sel[mode]);
> + am654_sdhci_write_itapdly(plat, plat->itap_del_sel[mode],
> + plat->itap_del_ena[mode]);
> }
>
> static int am654_sdhci_set_ios_post(struct sdhci_host *host)
> @@ -443,6 +447,7 @@ static int am654_sdhci_execute_tuning(struct mmc *mmc, u8 opcode)
> struct udevice *dev = mmc->dev;
> struct am654_sdhci_plat *plat = dev_get_plat(dev);
> struct window fail_window[ITAPDLY_LENGTH];
> + int mode = mmc->selected_mode;
> u8 curr_pass, itap;
> u8 fail_index = 0;
> u8 prev_pass = 1;
> @@ -450,11 +455,10 @@ static int am654_sdhci_execute_tuning(struct mmc *mmc, u8 opcode)
> memset(fail_window, 0, sizeof(fail_window));
>
> /* Enable ITAPDLY */
> - regmap_update_bits(plat->base, PHY_CTRL4, ITAPDLYENA_MASK,
> - 1 << ITAPDLYENA_SHIFT);
> + plat->itap_del_ena[mode] = 0x1;
0x1 means "enable"? I want to use a macro with meaning.
>
> for (itap = 0; itap < ITAPDLY_LENGTH; itap++) {
> - am654_sdhci_write_itapdly(plat, itap);
> + am654_sdhci_write_itapdly(plat, itap, plat->itap_del_ena[mode]);
>
> curr_pass = !mmc_send_tuning(mmc, opcode, NULL);
>
> @@ -478,7 +482,7 @@ static int am654_sdhci_execute_tuning(struct mmc *mmc, u8 opcode)
> itap = am654_sdhci_calculate_itap(dev, fail_window, fail_index,
> plat->dll_enable);
>
> - am654_sdhci_write_itapdly(plat, itap);
> + am654_sdhci_write_itapdly(plat, itap, plat->itap_del_ena[mode]);
>
> return 0;
> }
> @@ -515,6 +519,7 @@ static int j721e_4bit_sdhci_set_ios_post(struct sdhci_host *host)
> struct am654_sdhci_plat *plat = dev_get_plat(dev);
> int mode = host->mmc->selected_mode;
> u32 otap_del_sel;
> + u32 itap_del_ena;
> u32 itap_del_sel;
> u32 mask, val;
>
> @@ -524,10 +529,11 @@ static int j721e_4bit_sdhci_set_ios_post(struct sdhci_host *host)
> val = (1 << OTAPDLYENA_SHIFT) |
> (otap_del_sel << OTAPDLYSEL_SHIFT);
>
> + itap_del_ena = plat->itap_del_ena[mode];
> itap_del_sel = plat->itap_del_sel[mode];
>
> mask |= ITAPDLYENA_MASK | ITAPDLYSEL_MASK;
> - val = (1 << ITAPDLYENA_SHIFT) |
> + val = (itap_del_ena << ITAPDLYENA_SHIFT) |
> (itap_del_sel << ITAPDLYSEL_SHIFT);
>
> regmap_update_bits(plat->base, PHY_CTRL4, ITAPCHGWIN_MASK,
> @@ -599,9 +605,13 @@ static int sdhci_am654_get_otap_delay(struct udevice *dev,
> cfg->host_caps &= ~td[i].capability;
> }
>
> - if (td[i].itap_binding)
> - dev_read_u32(dev, td[i].itap_binding,
> - &plat->itap_del_sel[i]);
> + if (td[i].itap_binding) {
> + ret = dev_read_u32(dev, td[i].itap_binding,
> + &plat->itap_del_sel[i]);
> +
> + if (!ret)
> + plat->itap_del_ena[i] = 0x1;
Ditto.
Best Regards,
Jaehoon Chung
> + }
> }
>
> return 0;
> --
> 2.43.2
next prev parent reply other threads:[~2024-04-17 11:34 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-15 21:27 [PATCH 0/5] Fix MMC tuning algorithm Judith Mendez
2024-04-15 21:27 ` [PATCH 1/5] mmc: am654_sdhci: Add tuning algorithm for delay chain Judith Mendez
2024-04-17 11:23 ` Jaehoon Chung
2024-04-18 14:28 ` Judith Mendez
2024-04-15 21:27 ` [PATCH 2/5] mmc: am654_sdhci: Fix OTAP/ITAP delay values Judith Mendez
2024-04-17 11:28 ` Jaehoon Chung
2024-04-18 14:39 ` Judith Mendez
2024-04-15 21:27 ` [PATCH 3/5] mmc: am654_sdhci: Add itap_del_ena[] to store itapdlyena bit Judith Mendez
2024-04-17 11:34 ` Jaehoon Chung [this message]
2024-04-18 14:40 ` Judith Mendez
2024-04-15 21:27 ` [PATCH 4/5] mmc: am654_sdhci: Set ENDLL=1 for DDR52 mode Judith Mendez
2024-04-17 11:36 ` Jaehoon Chung
2024-04-15 21:27 ` [PATCH 5/5] mmc: am654_sdhci: Fix ITAPDLY for HS400 timing Judith Mendez
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='01fd01da90bb$28fc5300$7af4f900$@samsung.com' \
--to=jh80.chung@samsung.com \
--cc=jm@ti.com \
--cc=n-yadav@ti.com \
--cc=peng.fan@nxp.com \
--cc=sjg@chromium.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox