From: Heiko Stuebner <heiko@sntech.de>
To: Shawn Lin <shawn.lin@rock-chips.com>
Cc: Stephen Boyd <sboyd@codeaurora.org>,
Michael Turquette <mturquette@baylibre.com>,
linux-clk@vger.kernel.org, linux-rockchip@lists.infradead.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [RESEND PATCH] clk: rockchip: disable init state before mmc card initialization
Date: Mon, 24 Aug 2015 12:01:19 +0200 [thread overview]
Message-ID: <120036049.vlT25D4un8@phil> (raw)
In-Reply-To: <1440404863-14350-1-git-send-email-shawn.lin@rock-chips.com>
Hi Shawn,
Am Montag, 24. August 2015, 16:27:43 schrieb Shawn Lin:
> 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 disable tuning phase and degree setting
> before into kernel. Simply disable it in rockchip_clk_register_mmc.
>
> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
>
> ---
>
> drivers/clk/rockchip/clk-mmc-phase.c | 20 ++++++++++++++++++++
> 1 file changed, 20 insertions(+)
>
> diff --git a/drivers/clk/rockchip/clk-mmc-phase.c
> b/drivers/clk/rockchip/clk-mmc-phase.c index e9f8df32..ae21592 100644
> --- a/drivers/clk/rockchip/clk-mmc-phase.c
> +++ b/drivers/clk/rockchip/clk-mmc-phase.c
> @@ -38,6 +38,9 @@ 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_DISABLE (0x1)
> +#define ROCKCHIP_MMC_INIT_STATE_SHIFT (1)
> +#define ROCKCHIP_MMC_INIT_STATE_MASK (0x1)
you don't need the "()" around primitive values. Also I don't think you need
the second MASK attribute, doing
writel(HIWORD_UPDATE(ROCKCHIP_MMC_INIT_STATE_DISABLE,
ROCKCHIP_MMC_INIT_STATE_DISABLE,
mmc_clock->shift),
should be enough. And thirdly I'm undecided about the naming of the constant.
The manual describes the init_state as "Assert init_state to soft reset the
CLKGEN.", so I guess I'd prefer
ROCKCHIP_MMC_INIT_STATE_RESET
or so
>
> #define PSECS_PER_SEC 1000000000000LL
>
> @@ -119,6 +122,21 @@ static const struct clk_ops rockchip_mmc_clk_ops = {
> .set_phase = rockchip_mmc_set_phase,
> };
>
> +static void rockchip_clk_mmc_disable_init(struct rockchip_mmc_clock
I guess similar to the thoughts above, simply name this
rockchip_clk_mmc_reset()
or alternatively just do the reset in rockchip_clk_register_mmc directly:
if (mmc_clock->shift == ROCKCHIP_MMC_INIT_STATE_SHIFT))
writel(HIWORD_UPDATE(ROCKCHIP_MMC_INIT_STATE_DISABLE,
ROCKCHIP_MMC_INIT_STATE_MASK,
mmc_clock->shift),
mmc_clock->reg);
as the pr_debug does not really serve a purpose.
Heiko
> *mmc_clock) +{
> + if (mmc_clock->shift != ROCKCHIP_MMC_INIT_STATE_SHIFT)
> + return;
> +
> + writel(HIWORD_UPDATE(ROCKCHIP_MMC_INIT_STATE_DISABLE,
> + ROCKCHIP_MMC_INIT_STATE_MASK,
> + mmc_clock->shift),
> + mmc_clock->reg);
> +
> + pr_debug("%s: clear mmc init state to %d", __func__,
> + (readl(mmc_clock->reg) >> (mmc_clock->shift)) &
> + ROCKCHIP_MMC_INIT_STATE_MASK);
> +}
> +
> struct clk *rockchip_clk_register_mmc(const char *name,
> const char *const *parent_names, u8 num_parents,
> void __iomem *reg, int shift)
> @@ -139,6 +157,8 @@ struct clk *rockchip_clk_register_mmc(const char *name,
> mmc_clock->reg = reg;
> mmc_clock->shift = shift;
>
> + rockchip_clk_mmc_disable_init(mmc_clock);
> +
> if (name)
> init.name = name;
WARNING: multiple messages have this Message-ID (diff)
From: heiko@sntech.de (Heiko Stuebner)
To: linux-arm-kernel@lists.infradead.org
Subject: [RESEND PATCH] clk: rockchip: disable init state before mmc card initialization
Date: Mon, 24 Aug 2015 12:01:19 +0200 [thread overview]
Message-ID: <120036049.vlT25D4un8@phil> (raw)
In-Reply-To: <1440404863-14350-1-git-send-email-shawn.lin@rock-chips.com>
Hi Shawn,
Am Montag, 24. August 2015, 16:27:43 schrieb Shawn Lin:
> 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 disable tuning phase and degree setting
> before into kernel. Simply disable it in rockchip_clk_register_mmc.
>
> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
>
> ---
>
> drivers/clk/rockchip/clk-mmc-phase.c | 20 ++++++++++++++++++++
> 1 file changed, 20 insertions(+)
>
> diff --git a/drivers/clk/rockchip/clk-mmc-phase.c
> b/drivers/clk/rockchip/clk-mmc-phase.c index e9f8df32..ae21592 100644
> --- a/drivers/clk/rockchip/clk-mmc-phase.c
> +++ b/drivers/clk/rockchip/clk-mmc-phase.c
> @@ -38,6 +38,9 @@ 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_DISABLE (0x1)
> +#define ROCKCHIP_MMC_INIT_STATE_SHIFT (1)
> +#define ROCKCHIP_MMC_INIT_STATE_MASK (0x1)
you don't need the "()" around primitive values. Also I don't think you need
the second MASK attribute, doing
writel(HIWORD_UPDATE(ROCKCHIP_MMC_INIT_STATE_DISABLE,
ROCKCHIP_MMC_INIT_STATE_DISABLE,
mmc_clock->shift),
should be enough. And thirdly I'm undecided about the naming of the constant.
The manual describes the init_state as "Assert init_state to soft reset the
CLKGEN.", so I guess I'd prefer
ROCKCHIP_MMC_INIT_STATE_RESET
or so
>
> #define PSECS_PER_SEC 1000000000000LL
>
> @@ -119,6 +122,21 @@ static const struct clk_ops rockchip_mmc_clk_ops = {
> .set_phase = rockchip_mmc_set_phase,
> };
>
> +static void rockchip_clk_mmc_disable_init(struct rockchip_mmc_clock
I guess similar to the thoughts above, simply name this
rockchip_clk_mmc_reset()
or alternatively just do the reset in rockchip_clk_register_mmc directly:
if (mmc_clock->shift == ROCKCHIP_MMC_INIT_STATE_SHIFT))
writel(HIWORD_UPDATE(ROCKCHIP_MMC_INIT_STATE_DISABLE,
ROCKCHIP_MMC_INIT_STATE_MASK,
mmc_clock->shift),
mmc_clock->reg);
as the pr_debug does not really serve a purpose.
Heiko
> *mmc_clock) +{
> + if (mmc_clock->shift != ROCKCHIP_MMC_INIT_STATE_SHIFT)
> + return;
> +
> + writel(HIWORD_UPDATE(ROCKCHIP_MMC_INIT_STATE_DISABLE,
> + ROCKCHIP_MMC_INIT_STATE_MASK,
> + mmc_clock->shift),
> + mmc_clock->reg);
> +
> + pr_debug("%s: clear mmc init state to %d", __func__,
> + (readl(mmc_clock->reg) >> (mmc_clock->shift)) &
> + ROCKCHIP_MMC_INIT_STATE_MASK);
> +}
> +
> struct clk *rockchip_clk_register_mmc(const char *name,
> const char *const *parent_names, u8 num_parents,
> void __iomem *reg, int shift)
> @@ -139,6 +157,8 @@ struct clk *rockchip_clk_register_mmc(const char *name,
> mmc_clock->reg = reg;
> mmc_clock->shift = shift;
>
> + rockchip_clk_mmc_disable_init(mmc_clock);
> +
> if (name)
> init.name = name;
next prev parent reply other threads:[~2015-08-24 10:01 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-24 8:27 [RESEND PATCH] clk: rockchip: disable init state before mmc card initialization Shawn Lin
2015-08-24 8:27 ` Shawn Lin
2015-08-24 10:01 ` Heiko Stuebner [this message]
2015-08-24 10:01 ` Heiko Stuebner
2015-08-24 14:02 ` Shawn Lin
2015-08-24 14:02 ` 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=120036049.vlT25D4un8@phil \
--to=heiko@sntech.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=mturquette@baylibre.com \
--cc=sboyd@codeaurora.org \
--cc=shawn.lin@rock-chips.com \
/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.