From: shawn.lin@rock-chips.com (Shawn Lin)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2] clk: rockchip: reset init state before mmc card initialization
Date: Thu, 3 Sep 2015 22:13:06 +0800 [thread overview]
Message-ID: <55E85572.10005@rock-chips.com> (raw)
In-Reply-To: <1440462876-5457-1-git-send-email-shawn.lin@rock-chips.com>
On 2015/8/25 8:34, Shawn Lin wrote:
> mmc host controller's IO input/output timing is unpredictable if
> bootloader execute tuning for HS200 mode. It might make kernel failed
> to initialize mmc card in identification mode. The root cause is
> tuning phase and degree setting for HS200 mode in bootloader aren't
> applicable to that of identification mode in kernel stage. Anyway, we
> can't force all bootloaders to reset tuning phase and degree setting
> before into kernel. Simply reset it in rockchip_clk_register_mmc.
>
> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
>
> ---
>
> Changes in v2:
> - rename to rockchip_clk_mmc_reset
> - simplifying the code
>
Hi Heiko,
How about the next of this patch ? :)
Feel free to let me know if it still has something more to be done.
BTW, recently, we get another report that while changing data bus width,
uboot do bus testing(CMD19 + CMD14) for emmc DDR52 8bit bus mode by
tuning the phase and degree to fit the timing fails the kernel to
boot-up for the same reason.
> drivers/clk/rockchip/clk-mmc-phase.c | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
>
> diff --git a/drivers/clk/rockchip/clk-mmc-phase.c b/drivers/clk/rockchip/clk-mmc-phase.c
> index e9f8df32..1d3e8fe6 100644
> --- a/drivers/clk/rockchip/clk-mmc-phase.c
> +++ b/drivers/clk/rockchip/clk-mmc-phase.c
> @@ -38,6 +38,8 @@ static unsigned long rockchip_mmc_recalc(struct clk_hw *hw,
> #define ROCKCHIP_MMC_DEGREE_MASK 0x3
> #define ROCKCHIP_MMC_DELAYNUM_OFFSET 2
> #define ROCKCHIP_MMC_DELAYNUM_MASK (0xff << ROCKCHIP_MMC_DELAYNUM_OFFSET)
> +#define ROCKCHIP_MMC_INIT_STATE_RESET 0x1
> +#define ROCKCHIP_MMC_INIT_STATE_SHIFT 1
>
> #define PSECS_PER_SEC 1000000000000LL
>
> @@ -119,6 +121,14 @@ static const struct clk_ops rockchip_mmc_clk_ops = {
> .set_phase = rockchip_mmc_set_phase,
> };
>
> +static void rockchip_clk_mmc_reset(struct rockchip_mmc_clock *mmc_clock)
> +{
> + if (mmc_clock->shift == ROCKCHIP_MMC_INIT_STATE_SHIFT)
> + writel(HIWORD_UPDATE(ROCKCHIP_MMC_INIT_STATE_RESET,
> + ROCKCHIP_MMC_INIT_STATE_RESET,
> + mmc_clock->shift), mmc_clock->reg);
> +}
> +
> struct clk *rockchip_clk_register_mmc(const char *name,
> const char *const *parent_names, u8 num_parents,
> void __iomem *reg, int shift)
> @@ -139,6 +149,12 @@ struct clk *rockchip_clk_register_mmc(const char *name,
> mmc_clock->reg = reg;
> mmc_clock->shift = shift;
>
> + /*
> + * Assert init_state to soft reset the CLKGEN
> + * for mmc tuning phase and degree
> + */
> + rockchip_clk_mmc_reset(mmc_clock);
> +
> if (name)
> init.name = name;
>
>
--
Best Regards
Shawn Lin
next prev parent reply other threads:[~2015-09-03 14:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-25 0:34 [PATCH v2] clk: rockchip: reset init state before mmc card initialization Shawn Lin
2015-09-03 14:13 ` Shawn Lin [this message]
2015-09-03 19:07 ` Heiko Stuebner
2015-09-03 23:49 ` Shawn Lin
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=55E85572.10005@rock-chips.com \
--to=shawn.lin@rock-chips.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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;
as well as URLs for NNTP newsgroup(s).