From: Chin-Ting Kuo <chin-ting_kuo@aspeedtech.com>
To: Paul Menzel <pmenzel@molgen.mpg.de>
Cc: "devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
"linux-clk@vger.kernel.org" <linux-clk@vger.kernel.org>,
"linux-aspeed@lists.ozlabs.org" <linux-aspeed@lists.ozlabs.org>,
BMC-SW <BMC-SW@aspeedtech.com>,
"sboyd@kernel.org" <sboyd@kernel.org>,
Steven Lee <steven_lee@aspeedtech.com>,
"mturquette@baylibre.com" <mturquette@baylibre.com>,
"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
"adrian.hunter@intel.com" <adrian.hunter@intel.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"andrew@aj.id.au" <andrew@aj.id.au>,
"robh+dt@kernel.org" <robh+dt@kernel.org>,
"openbmc@lists.ozlabs.org" <openbmc@lists.ozlabs.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>
Subject: RE: [PATCH 01/10] clk: aspeed: ast2600: Porting sdhci clock source
Date: Fri, 26 Nov 2021 02:27:28 +0000 [thread overview]
Message-ID: <HK0PR06MB2786FC6CB0CFEAED52ACD793B2639@HK0PR06MB2786.apcprd06.prod.outlook.com> (raw)
In-Reply-To: <24f55e7d-2f2d-2181-2265-7365d648be8f@molgen.mpg.de>
Hi Paul,
> -----Original Message-----
> From: Paul Menzel <pmenzel@molgen.mpg.de>
> Sent: Tuesday, October 26, 2021 2:10 PM
> To: Chin-Ting Kuo <chin-ting_kuo@aspeedtech.com>
> Cc: robh+dt@kernel.org; joel@jms.id.au; mturquette@baylibre.com;
> sboyd@kernel.org; adrian.hunter@intel.com; linux-aspeed@lists.ozlabs.org;
> openbmc@lists.ozlabs.org; linux-mmc@vger.kernel.org;
> devicetree@vger.kernel.org; linux-arm-kernel@lists.infradead.org;
> linux-kernel@vger.kernel.org; linux-clk@vger.kernel.org; andrew@aj.id.au;
> BMC-SW <BMC-SW@aspeedtech.com>; Steven Lee
> <steven_lee@aspeedtech.com>
> Subject: Re: [PATCH 01/10] clk: aspeed: ast2600: Porting sdhci clock source
>
> Dear Chin-Ting,
>
>
> Thank you for your patch. Some small things.
>
> Please use imperative mood in the commit messages summary [1]:
>
> clk: aspeed: ast2600: Port SDHCI clock source
Okay.
> On 22.09.21 12:31, Chin-Ting Kuo wrote:
> > - There are two clock sources used to generate
> > SD/SDIO clock, APLL clock and HCLK (200MHz).
> > User can select which clock source should be used
> > by configuring SCU310[8].
> > - The SD/SDIO clock divider selection table SCU310[30:28]
> > is different between AST2600-A1 and AST2600-A2/A3.
> > For AST2600-A1, 200MHz SD/SDIO clock cannot be
> > gotten by the dividers in SCU310[30:28] if APLL
> > is not the multiple of 200MHz and HCLK is 200MHz.
> > For AST2600-A2/A3, a new divider, "1", is added and
> > 200MHz SD/SDIO clock can be obtained by adopting HCLK
> > as clock source and setting SCU310[30:28] to 3b'111.
>
> Please reference the datasheet name and version, and please reflow the
> commit message for 75 characters per line.
>
Okay, it will be updated in the next patch version.
> > Signed-off-by: Chin-Ting Kuo <chin-ting_kuo@aspeedtech.com>
> > ---
> > drivers/clk/clk-ast2600.c | 69
> ++++++++++++++++++++++++++++++++++-----
> > 1 file changed, 61 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/clk/clk-ast2600.c b/drivers/clk/clk-ast2600.c
> > index bc3be5f3eae1..a6778c18274a 100644
> > --- a/drivers/clk/clk-ast2600.c
> > +++ b/drivers/clk/clk-ast2600.c
> > @@ -168,6 +168,30 @@ static const struct clk_div_table ast2600_div_table[]
> = {
> > { 0 }
> > };
> >
> > +static const struct clk_div_table ast2600_sd_div_a1_table[] = {
> > + { 0x0, 2 },
> > + { 0x1, 4 },
> > + { 0x2, 6 },
> > + { 0x3, 8 },
> > + { 0x4, 10 },
> > + { 0x5, 12 },
> > + { 0x6, 14 },
> > + { 0x7, 16 },
> > + { 0 }
> > +};
> > +
> > +static const struct clk_div_table ast2600_sd_div_a2_table[] = {
> > + { 0x0, 2 },
> > + { 0x1, 4 },
> > + { 0x2, 6 },
> > + { 0x3, 8 },
> > + { 0x4, 10 },
> > + { 0x5, 12 },
> > + { 0x6, 14 },
> > + { 0x7, 1 },
> > + { 0 }
> > +};
> > +
> > /* For hpll/dpll/epll/mpll */
> > static struct clk_hw *ast2600_calc_pll(const char *name, u32 val)
> > {
> > @@ -424,6 +448,11 @@ static const char *const
> emmc_extclk_parent_names[] = {
> > "mpll",
> > };
> >
> > +static const char *const sd_extclk_parent_names[] = {
> > + "hclk",
> > + "apll",
> > +};
> > +
> > static const char * const vclk_parent_names[] = {
> > "dpll",
> > "d1pll",
> > @@ -523,18 +552,42 @@ static int aspeed_g6_clk_probe(struct
> platform_device *pdev)
> > return PTR_ERR(hw);
> > aspeed_g6_clk_data->hws[ASPEED_CLK_EMMC] = hw;
> >
> > - /* SD/SDIO clock divider and gate */
> > - hw = clk_hw_register_gate(dev, "sd_extclk_gate", "hpll", 0,
> > - scu_g6_base + ASPEED_G6_CLK_SELECTION4, 31, 0,
> > - &aspeed_g6_clk_lock);
> > + clk_hw_register_fixed_rate(NULL, "hclk", NULL, 0, 200000000);
> > +
> > + regmap_read(map, 0x310, &val);
> > + hw = clk_hw_register_mux(dev, "sd_extclk_mux",
> > + sd_extclk_parent_names,
> > + ARRAY_SIZE(sd_extclk_parent_names), 0,
> > + scu_g6_base + ASPEED_G6_CLK_SELECTION4, 8, 1,
> > + 0, &aspeed_g6_clk_lock);
> > if (IS_ERR(hw))
> > return PTR_ERR(hw);
> > - hw = clk_hw_register_divider_table(dev, "sd_extclk", "sd_extclk_gate",
> > - 0, scu_g6_base + ASPEED_G6_CLK_SELECTION4, 28, 3, 0,
> > - ast2600_div_table,
> > - &aspeed_g6_clk_lock);
> > +
> > + hw = clk_hw_register_gate(dev, "sd_extclk_gate", "sd_extclk_mux",
> > + 0, scu_g6_base + ASPEED_G6_CLK_SELECTION4,
> > + 31, 0, &aspeed_g6_clk_lock);
> > if (IS_ERR(hw))
> > return PTR_ERR(hw);
> > +
> > + regmap_read(map, 0x14, &val);
> > + /* AST2600-A2/A3 clock divisor is different from AST2600-A1 */
> > + if (((val & GENMASK(23, 16)) >> 16) >= 2) {
> > + /* AST2600-A2/A3 */
> > + hw = clk_hw_register_divider_table(dev, "sd_extclk",
> "sd_extclk_gate",
> > + 0, scu_g6_base + ASPEED_G6_CLK_SELECTION4, 28, 3,
> 0,
> > + ast2600_sd_div_a2_table,
> > + &aspeed_g6_clk_lock);
> > + if (IS_ERR(hw))
> > + return PTR_ERR(hw);
> > + } else {
> > + /* AST2600-A1 */
> > + hw = clk_hw_register_divider_table(dev, "sd_extclk",
> "sd_extclk_gate",
> > + 0, scu_g6_base + ASPEED_G6_CLK_SELECTION4, 28, 3,
> 0,
> > + ast2600_sd_div_a1_table,
> > + &aspeed_g6_clk_lock);
> > + if (IS_ERR(hw))
> > + return PTR_ERR(hw);
> > + }
> > aspeed_g6_clk_data->hws[ASPEED_CLK_SDIO] = hw;
> >
> > /* MAC1/2 RMII 50MHz RCLK */
> >
>
> Does Linux already log, if A1 or A2/A3 is detected?
>
No, but Joel provided a related patch for SoC version in clk-ast2600.c.
> Should a debug message be added, what clock divisor is used?
>
Okay, the debug message for clock divisor will be added in the next patch version.
>
> Kind regards,
>
> Paul
Best Wishes,
Chin-Ting
next prev parent reply other threads:[~2021-11-26 2:28 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-22 10:31 [PATCH 00/10] ASPEED SD/eMMC controller clock configuration Chin-Ting Kuo
2021-09-22 10:31 ` [PATCH 01/10] clk: aspeed: ast2600: Porting sdhci clock source Chin-Ting Kuo
2021-09-23 0:02 ` Joel Stanley
2021-09-23 5:31 ` Chin-Ting Kuo
2021-10-26 6:10 ` Paul Menzel
2021-11-26 2:27 ` Chin-Ting Kuo [this message]
2021-09-22 10:31 ` [PATCH 02/10] sdhci: aspeed: Add SDR50 support Chin-Ting Kuo
2021-10-26 0:31 ` Andrew Jeffery
2021-11-06 10:01 ` Chin-Ting Kuo
2021-09-22 10:31 ` [PATCH 03/10] dts: aspeed: ast2600: Support SDR50 for SD device Chin-Ting Kuo
2021-10-26 0:42 ` Andrew Jeffery
2021-11-06 10:01 ` Chin-Ting Kuo
2021-09-22 10:31 ` [PATCH 04/10] mmc: Add invert flag for clock phase signedness Chin-Ting Kuo
2021-10-26 0:52 ` Andrew Jeffery
2021-11-06 10:02 ` Chin-Ting Kuo
2021-11-08 0:21 ` Andrew Jeffery
2021-09-22 10:31 ` [PATCH 05/10] mmc: aspeed: Adjust delay taps calculation method Chin-Ting Kuo
2021-10-26 3:10 ` Andrew Jeffery
2021-11-06 10:05 ` Chin-Ting Kuo
2021-11-07 23:42 ` Andrew Jeffery
2021-09-22 10:31 ` [PATCH 06/10] arm: dts: aspeed: Change eMMC device compatible Chin-Ting Kuo
2021-09-22 10:31 ` [PATCH 07/10] arm: dts: aspeed: Adjust clock phase parameter Chin-Ting Kuo
2021-09-22 10:31 ` [PATCH 08/10] arm: dts: ibm: " Chin-Ting Kuo
2021-09-22 10:31 ` [PATCH 09/10] dt-bindings: mmc: aspeed: Add max-tap-delay property Chin-Ting Kuo
2021-09-27 18:40 ` Rob Herring
2021-09-28 2:50 ` Chin-Ting Kuo
2021-09-22 10:31 ` [PATCH 10/10] dt-bindings: mmc: aspeed: Add a new compatible string Chin-Ting Kuo
2021-09-27 18:59 ` Rob Herring
2021-09-28 2:50 ` Chin-Ting Kuo
2021-09-28 22:28 ` Rob Herring
2021-09-29 3:03 ` Chin-Ting Kuo
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=HK0PR06MB2786FC6CB0CFEAED52ACD793B2639@HK0PR06MB2786.apcprd06.prod.outlook.com \
--to=chin-ting_kuo@aspeedtech.com \
--cc=BMC-SW@aspeedtech.com \
--cc=adrian.hunter@intel.com \
--cc=andrew@aj.id.au \
--cc=devicetree@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-aspeed@lists.ozlabs.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=openbmc@lists.ozlabs.org \
--cc=pmenzel@molgen.mpg.de \
--cc=robh+dt@kernel.org \
--cc=sboyd@kernel.org \
--cc=steven_lee@aspeedtech.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 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).