[{"id":1758307,"web_url":"http://patchwork.ozlabs.org/comment/1758307/","msgid":"<CAPnjgZ3NVzZdnppR00M0yggQGPxS-grcL2T86TSJ0uEZ9Kg5uw@mail.gmail.com>","list_archive_url":null,"date":"2017-08-27T20:10:01","subject":"Re: [U-Boot] [PATCH] rockchip: clk: rk3368: always run rkclk_init\n\twhen driver probe","submitter":{"id":6170,"url":"http://patchwork.ozlabs.org/api/people/6170/","name":"Simon Glass","email":"sjg@chromium.org"},"content":"Hi Andy\n\nOn 23 August 2017 at 01:26, Andy Yan <andy.yan@rock-chips.com> wrote:\n> commit 4bebf94e8544(\"rockchip: clk: rk3368: do not change\n> CPLL/GPLL before returning to BROM\") limits the pll can only\n> be setup in SPL stage, but there are still some rk3368 based\n> boards have not use SPL yet, so they need run rkclk_init to\n> setup the pll in full u-boot stage, otherwise the clk_set_rate\n> function will run into wrong logic, because it assume that all\n> the pll have been set to the desired frequency.\n>\n> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>\n> ---\n>\n>  drivers/clk/rockchip/clk_rk3368.c | 10 ++--------\n>  1 file changed, 2 insertions(+), 8 deletions(-)\n>\n> diff --git a/drivers/clk/rockchip/clk_rk3368.c b/drivers/clk/rockchip/clk_rk3368.c\n> index 2be1f57..ee754f0 100644\n> --- a/drivers/clk/rockchip/clk_rk3368.c\n> +++ b/drivers/clk/rockchip/clk_rk3368.c\n> @@ -47,14 +47,12 @@ struct pll_div {\n>                        (_nr * _no) == hz, #hz \"Hz cannot be hit with PLL \" \\\n>                        \"divisors on line \" __stringify(__LINE__));\n>\n> -#if IS_ENABLED(CONFIG_SPL_BUILD) || IS_ENABLED(CONFIG_TPL_BUILD)\n>  static const struct pll_div apll_l_init_cfg = PLL_DIVISORS(APLL_L_HZ, 12, 2);\n>  static const struct pll_div apll_b_init_cfg = PLL_DIVISORS(APLL_B_HZ, 1, 2);\n>  #if !defined(CONFIG_TPL_BUILD)\n>  static const struct pll_div gpll_init_cfg = PLL_DIVISORS(GPLL_HZ, 1, 2);\n>  static const struct pll_div cpll_init_cfg = PLL_DIVISORS(CPLL_HZ, 1, 6);\n>  #endif\n> -#endif\n>\n>  static ulong rk3368_clk_get_rate(struct clk *clk);\n>\n> @@ -85,7 +83,6 @@ static uint32_t rkclk_pll_get_rate(struct rk3368_cru *cru,\n>         }\n>  }\n>\n> -#if IS_ENABLED(CONFIG_SPL_BUILD) || IS_ENABLED(CONFIG_TPL_BUILD)\n>  static int rkclk_set_pll(struct rk3368_cru *cru, enum rk3368_pll_id pll_id,\n>                          const struct pll_div *div)\n>  {\n> @@ -125,9 +122,7 @@ static int rkclk_set_pll(struct rk3368_cru *cru, enum rk3368_pll_id pll_id,\n>\n>         return 0;\n>  }\n> -#endif\n>\n> -#if IS_ENABLED(CONFIG_SPL_BUILD) || IS_ENABLED(CONFIG_TPL_BUILD)\n>  static void rkclk_init(struct rk3368_cru *cru)\n>  {\n>         u32 apllb, aplll, dpll, cpll, gpll;\n> @@ -152,7 +147,7 @@ static void rkclk_init(struct rk3368_cru *cru)\n>         debug(\"%s apllb(%d) apll(%d) dpll(%d) cpll(%d) gpll(%d)\\n\",\n>                __func__, apllb, aplll, dpll, cpll, gpll);\n>  }\n> -#endif\n> +\n>\n>  #if !IS_ENABLED(CONFIG_SPL_BUILD) || CONFIG_IS_ENABLED(MMC_SUPPORT)\n>  static ulong rk3368_mmc_get_clk(struct rk3368_cru *cru, uint clk_id)\n> @@ -473,9 +468,8 @@ static int rk3368_clk_probe(struct udevice *dev)\n>\n>         priv->cru = map_sysmem(plat->dtd.reg[1], plat->dtd.reg[3]);\n>  #endif\n> -#if IS_ENABLED(CONFIG_SPL_BUILD) || IS_ENABLED(CONFIG_TPL_BUILD)\n\nCan you please use if() instead of #if? Then you can drop the #if above.\n\n> +\n>         rkclk_init(priv->cru);\n> -#endif\n>\n>         return 0;\n>  }\n> --\n> 2.7.4\n>\n>\n\nRegards,\nSimon","headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=google.com header.i=@google.com\n\theader.b=\"hi7NWF6J\"; \n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"CI1ftm8j\"; dkim-atps=neutral"],"Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xgR4313dQz9s8V\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 28 Aug 2017 06:16:03 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid CA735C2232C; Sun, 27 Aug 2017 20:13:09 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id E1053C22339;\n\tSun, 27 Aug 2017 20:12:35 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid 662E4C2232E; Sun, 27 Aug 2017 20:10:26 +0000 (UTC)","from mail-qt0-f178.google.com (mail-qt0-f178.google.com\n\t[209.85.216.178])\n\tby lists.denx.de (Postfix) with ESMTPS id C5747C22312\n\tfor <u-boot@lists.denx.de>; Sun, 27 Aug 2017 20:10:22 +0000 (UTC)","by mail-qt0-f178.google.com with SMTP id d15so17597134qta.4\n\tfor <u-boot@lists.denx.de>; Sun, 27 Aug 2017 13:10:22 -0700 (PDT)","by 10.200.52.117 with HTTP; Sun, 27 Aug 2017 13:10:01 -0700 (PDT)"],"X-Spam-Checker-Version":"SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,\n\tRCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,\n\tT_DKIM_INVALID autolearn=unavailable\n\tautolearn_force=no version=3.4.0","DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\n\ts=20161025; \n\th=mime-version:sender:in-reply-to:references:from:date:message-id\n\t:subject:to:cc;\n\tbh=eCl9+tUhd4B7o0xBBYJ5p6WEDBH36IwuISMVmb0QXrQ=;\n\tb=hi7NWF6JNRs4WzchC2jbGpR2Zg/NEGijWonBhf9oJboF4kU3hsSP/vvhogq35Xd30N\n\tArxTs0JO4Zxbf47uNaC6roCf04nVvIuZ2fWjiYDvxlprMP2CPrVprJqUcq+HaLUC4C/g\n\thqkUHWO79+jStZrzyv0Hz/WxxWcLLyp7wydQwdxkOBqi1A9WZYLCdOUQCuruVxaG82kC\n\t5UqHzmA4kTirO3feS/rBN2YkToMSd1lCArIafWs4RU1HHnBFlRGSajC8BSUmicjx8ztU\n\tjq3IW3V97dLPy9C5Nzz1bgDoqbJIOzxbYd7ptRxFkMgQrtc9XwvrxfKNliS3uklbDvCE\n\tN6dQ==","v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=mime-version:sender:in-reply-to:references:from:date:message-id\n\t:subject:to:cc;\n\tbh=eCl9+tUhd4B7o0xBBYJ5p6WEDBH36IwuISMVmb0QXrQ=;\n\tb=CI1ftm8js2QvF0v1FqCoPjM28EIEzSl2jMkQzgOH7N7FET3p+i5A8NOH+1m2g0Pe8j\n\tPtwU04PGsxWvcwUqeEiVddJkBXLgDPi6kgLhhAwpWo3j7Rss7v1ZzXDaTxbBEk6Z23ee\n\tGHzC4aTgZUlo+qVtHJrglNl2q6qtOReHc0lqw="],"X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:sender:in-reply-to:references:from\n\t:date:message-id:subject:to:cc;\n\tbh=eCl9+tUhd4B7o0xBBYJ5p6WEDBH36IwuISMVmb0QXrQ=;\n\tb=OwuDiPYdlGo81zsQV1uztoCFQ58pJH4sWzIOK6mleHiPPXFO4z0HXI2ScnRurUv31J\n\tgZYIYhO/Sov7zqqo8hLQ5sKgHalP97nNAlAkD36g99ltYlr8FxNu8LgieZlwzbLPt/6w\n\tKBBcJ0H7t2GosR4AxBy/H6THtyKZ3ZQfSUFN3zID9qEFGz8hgFC72bbM6N/ojZEuyO9E\n\t3I0ty8sMBcl0St9CqGl4oMGcdtMoMQ/YiCiCauT4W+J64teLRGWXmwZVA2xPug5a4/pO\n\ttrxEslLbwJ95ExxVbnhCeJCpINR2SlJOLQKcHh3QsNq2MdGYkQbutBjk8Unx4fRfvY2w\n\tTOMQ==","X-Gm-Message-State":"AHYfb5jtI8r2iZWxT7Toa2Aa21R/OXk6OTULO51OQhBnOT9F/Q2AeGSY\n\txGepKsXwQyq61MkR41KR79xoYjzZMm/J","X-Google-Smtp-Source":"ADKCNb4rXhdtm9n5/8UzrjjGUvFQAOa8IpcKZwgLnpWiVfAR6Zd2vf6bmhwrFkotwhdKKp1neqlPVySvXIyGFEl6+Ao=","X-Received":"by 10.200.37.133 with SMTP id e5mr7390583qte.51.1503864621549;\n\tSun, 27 Aug 2017 13:10:21 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<1503473218-16773-1-git-send-email-andy.yan@rock-chips.com>","References":"<1503473218-16773-1-git-send-email-andy.yan@rock-chips.com>","From":"Simon Glass <sjg@chromium.org>","Date":"Sun, 27 Aug 2017 14:10:01 -0600","X-Google-Sender-Auth":"wu9sMLtPtEiRmXSQnlAykm3qAx4","Message-ID":"<CAPnjgZ3NVzZdnppR00M0yggQGPxS-grcL2T86TSJ0uEZ9Kg5uw@mail.gmail.com>","To":"Andy Yan <andy.yan@rock-chips.com>","Cc":"U-Boot Mailing List <u-boot@lists.denx.de>","Subject":"Re: [U-Boot] [PATCH] rockchip: clk: rk3368: always run rkclk_init\n\twhen driver probe","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.18","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<http://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>"}},{"id":1758313,"web_url":"http://patchwork.ozlabs.org/comment/1758313/","msgid":"<70B4A699-CEE9-4403-8D30-2FD5CD512190@theobroma-systems.com>","list_archive_url":null,"date":"2017-08-27T20:21:06","subject":"Re: [U-Boot] [PATCH] rockchip: clk: rk3368: always run rkclk_init\n\twhen driver probe","submitter":{"id":53488,"url":"http://patchwork.ozlabs.org/api/people/53488/","name":"Philipp Tomsich","email":"philipp.tomsich@theobroma-systems.com"},"content":"> On 23 Aug 2017, at 09:26, Andy Yan <andy.yan@rock-chips.com> wrote:\n> \n> commit 4bebf94e8544(\"rockchip: clk: rk3368: do not change\n> CPLL/GPLL before returning to BROM\") limits the pll can only\n> be setup in SPL stage, but there are still some rk3368 based\n> boards have not use SPL yet, so they need run rkclk_init to\n> setup the pll in full u-boot stage, otherwise the clk_set_rate\n> function will run into wrong logic, because it assume that all\n> the pll have been set to the desired frequency.\n\nIf SPL is enabled, rkclk_init should not be called from the full\nU-Boot, though.  I.e. we’ll need an appropriate conditional\ntest to check whether SPL is enabled or not...\n\n> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>\n> ---\n> \n> drivers/clk/rockchip/clk_rk3368.c | 10 ++--------\n> 1 file changed, 2 insertions(+), 8 deletions(-)\n> \n> diff --git a/drivers/clk/rockchip/clk_rk3368.c b/drivers/clk/rockchip/clk_rk3368.c\n> index 2be1f57..ee754f0 100644\n> --- a/drivers/clk/rockchip/clk_rk3368.c\n> +++ b/drivers/clk/rockchip/clk_rk3368.c\n> @@ -47,14 +47,12 @@ struct pll_div {\n> \t\t       (_nr * _no) == hz, #hz \"Hz cannot be hit with PLL \" \\\n> \t\t       \"divisors on line \" __stringify(__LINE__));\n> \n> -#if IS_ENABLED(CONFIG_SPL_BUILD) || IS_ENABLED(CONFIG_TPL_BUILD)\n> static const struct pll_div apll_l_init_cfg = PLL_DIVISORS(APLL_L_HZ, 12, 2);\n> static const struct pll_div apll_b_init_cfg = PLL_DIVISORS(APLL_B_HZ, 1, 2);\n> #if !defined(CONFIG_TPL_BUILD)\n> static const struct pll_div gpll_init_cfg = PLL_DIVISORS(GPLL_HZ, 1, 2);\n> static const struct pll_div cpll_init_cfg = PLL_DIVISORS(CPLL_HZ, 1, 6);\n> #endif\n> -#endif\n> \n> static ulong rk3368_clk_get_rate(struct clk *clk);\n> \n> @@ -85,7 +83,6 @@ static uint32_t rkclk_pll_get_rate(struct rk3368_cru *cru,\n> \t}\n> }\n> \n> -#if IS_ENABLED(CONFIG_SPL_BUILD) || IS_ENABLED(CONFIG_TPL_BUILD)\n> static int rkclk_set_pll(struct rk3368_cru *cru, enum rk3368_pll_id pll_id,\n> \t\t\t const struct pll_div *div)\n> {\n> @@ -125,9 +122,7 @@ static int rkclk_set_pll(struct rk3368_cru *cru, enum rk3368_pll_id pll_id,\n> \n> \treturn 0;\n> }\n> -#endif\n> \n> -#if IS_ENABLED(CONFIG_SPL_BUILD) || IS_ENABLED(CONFIG_TPL_BUILD)\n> static void rkclk_init(struct rk3368_cru *cru)\n> {\n> \tu32 apllb, aplll, dpll, cpll, gpll;\n> @@ -152,7 +147,7 @@ static void rkclk_init(struct rk3368_cru *cru)\n> \tdebug(\"%s apllb(%d) apll(%d) dpll(%d) cpll(%d) gpll(%d)\\n\",\n> \t       __func__, apllb, aplll, dpll, cpll, gpll);\n> }\n> -#endif\n> +\n> \n> #if !IS_ENABLED(CONFIG_SPL_BUILD) || CONFIG_IS_ENABLED(MMC_SUPPORT)\n> static ulong rk3368_mmc_get_clk(struct rk3368_cru *cru, uint clk_id)\n> @@ -473,9 +468,8 @@ static int rk3368_clk_probe(struct udevice *dev)\n> \n> \tpriv->cru = map_sysmem(plat->dtd.reg[1], plat->dtd.reg[3]);\n> #endif\n> -#if IS_ENABLED(CONFIG_SPL_BUILD) || IS_ENABLED(CONFIG_TPL_BUILD)\n> +\n> \trkclk_init(priv->cru);\n> -#endif\n> \n> \treturn 0;\n> }\n> -- \n> 2.7.4\n> \n>","headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)","Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xgRNt6vyGz9sD5\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 28 Aug 2017 06:30:38 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid C541AC222E3; Sun, 27 Aug 2017 20:27:04 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id A5C3BC2231F;\n\tSun, 27 Aug 2017 20:27:01 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid 748DAC22316; Sun, 27 Aug 2017 20:21:10 +0000 (UTC)","from mail.theobroma-systems.com (vegas.theobroma-systems.com\n\t[144.76.126.164])\n\tby lists.denx.de (Postfix) with ESMTPS id 62A25C222BB\n\tfor <u-boot@lists.denx.de>; Sun, 27 Aug 2017 20:21:10 +0000 (UTC)","from 89-104-28-141.customer.bnet.at ([89.104.28.141]:56541\n\thelo=[192.168.2.129]) by mail.theobroma-systems.com with esmtpsa\n\t(TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80)\n\t(envelope-from <philipp.tomsich@theobroma-systems.com>)\n\tid 1dm43P-0003ll-0e; Sun, 27 Aug 2017 22:21:07 +0200"],"X-Spam-Checker-Version":"SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de","X-Spam-Level":"*","X-Spam-Status":"No, score=1.0 required=5.0 tests=HK_NAME_DR autolearn=no\n\tautolearn_force=no version=3.4.0","Mime-Version":"1.0 (Mac OS X Mail 8.2 \\(2104\\))","From":"\"Dr. Philipp Tomsich\" <philipp.tomsich@theobroma-systems.com>","In-Reply-To":"<1503473218-16773-1-git-send-email-andy.yan@rock-chips.com>","Date":"Sun, 27 Aug 2017 22:21:06 +0200","Message-Id":"<70B4A699-CEE9-4403-8D30-2FD5CD512190@theobroma-systems.com>","References":"<1503473218-16773-1-git-send-email-andy.yan@rock-chips.com>","To":"Andy Yan <andy.yan@rock-chips.com>","X-Mailer":"Apple Mail (2.2104)","Cc":"u-boot@lists.denx.de","Subject":"Re: [U-Boot] [PATCH] rockchip: clk: rk3368: always run rkclk_init\n\twhen driver probe","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.18","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<http://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>"}},{"id":1760812,"web_url":"http://patchwork.ozlabs.org/comment/1760812/","msgid":"<301399da-925c-3648-5380-49f9989237be@rock-chips.com>","list_archive_url":null,"date":"2017-08-31T10:25:15","subject":"Re: [U-Boot] [PATCH] rockchip: clk: rk3368: always run rkclk_init\n\twhen driver probe","submitter":{"id":65124,"url":"http://patchwork.ozlabs.org/api/people/65124/","name":"Andy Yan","email":"andy.yan@rock-chips.com"},"content":"Hi Philipp:\n\n\nOn 2017年08月28日 04:21, Dr. Philipp Tomsich wrote:\n>> On 23 Aug 2017, at 09:26, Andy Yan <andy.yan@rock-chips.com> wrote:\n>>\n>> commit 4bebf94e8544(\"rockchip: clk: rk3368: do not change\n>> CPLL/GPLL before returning to BROM\") limits the pll can only\n>> be setup in SPL stage, but there are still some rk3368 based\n>> boards have not use SPL yet, so they need run rkclk_init to\n>> setup the pll in full u-boot stage, otherwise the clk_set_rate\n>> function will run into wrong logic, because it assume that all\n>> the pll have been set to the desired frequency.\n> If SPL is enabled, rkclk_init should not be called from the full\n> U-Boot, though.  I.e. we’ll need an appropriate conditional\n> test to check whether SPL is enabled or not...\n\n     Do you have any ideas here?\n\n\n>\n>> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>\n>> ---\n>>\n>> drivers/clk/rockchip/clk_rk3368.c | 10 ++--------\n>> 1 file changed, 2 insertions(+), 8 deletions(-)\n>>\n>> diff --git a/drivers/clk/rockchip/clk_rk3368.c b/drivers/clk/rockchip/clk_rk3368.c\n>> index 2be1f57..ee754f0 100644\n>> --- a/drivers/clk/rockchip/clk_rk3368.c\n>> +++ b/drivers/clk/rockchip/clk_rk3368.c\n>> @@ -47,14 +47,12 @@ struct pll_div {\n>> \t\t       (_nr * _no) == hz, #hz \"Hz cannot be hit with PLL \" \\\n>> \t\t       \"divisors on line \" __stringify(__LINE__));\n>>\n>> -#if IS_ENABLED(CONFIG_SPL_BUILD) || IS_ENABLED(CONFIG_TPL_BUILD)\n>> static const struct pll_div apll_l_init_cfg = PLL_DIVISORS(APLL_L_HZ, 12, 2);\n>> static const struct pll_div apll_b_init_cfg = PLL_DIVISORS(APLL_B_HZ, 1, 2);\n>> #if !defined(CONFIG_TPL_BUILD)\n>> static const struct pll_div gpll_init_cfg = PLL_DIVISORS(GPLL_HZ, 1, 2);\n>> static const struct pll_div cpll_init_cfg = PLL_DIVISORS(CPLL_HZ, 1, 6);\n>> #endif\n>> -#endif\n>>\n>> static ulong rk3368_clk_get_rate(struct clk *clk);\n>>\n>> @@ -85,7 +83,6 @@ static uint32_t rkclk_pll_get_rate(struct rk3368_cru *cru,\n>> \t}\n>> }\n>>\n>> -#if IS_ENABLED(CONFIG_SPL_BUILD) || IS_ENABLED(CONFIG_TPL_BUILD)\n>> static int rkclk_set_pll(struct rk3368_cru *cru, enum rk3368_pll_id pll_id,\n>> \t\t\t const struct pll_div *div)\n>> {\n>> @@ -125,9 +122,7 @@ static int rkclk_set_pll(struct rk3368_cru *cru, enum rk3368_pll_id pll_id,\n>> seamless\n>> \treturn 0;\n>> }\n>> -#endif\n>>\n>> -#if IS_ENABLED(CONFIG_SPL_BUILD) || IS_ENABLED(CONFIG_TPL_BUILD)\n>> static void rkclk_init(struct rk3368_cru *cru)\n>> {\n>> \tu32 apllb, aplll, dpll, cpll, gpll;\n>> @@ -152,7 +147,7 @@ static void rkclk_init(struct rk3368_cru *cru)\n>> \tdebug(\"%s apllb(%d) apll(%d) dpll(%d) cpll(%d) gpll(%d)\\n\",\n>> \t       __func__, apllb, aplll, dpll, cpll, gpll);\n>> }\n>> -#endif\n>> +\n>>\n>> #if !IS_ENABLED(CONFIG_SPL_BUILD) || CONFIG_IS_ENABLED(MMC_SUPPORT)\n>> static ulong rk3368_mmc_get_clk(struct rk3368_cru *cru, uint clk_id)\n>> @@ -473,9 +468,8 @@ static int rk3368_clk_probe(struct udevice *dev)\n>>\n>> \tpriv->cru = map_sysmem(plat->dtd.reg[1], plat->dtd.reg[3]);\n>> #endif\n>> -#if IS_ENABLED(CONFIG_SPL_BUILD) || IS_ENABLED(CONFIG_TPL_BUILD)\n>> +\n>> \trkclk_init(priv->cru);\n>> -#endif\n>>\n>> \treturn 0;\n>> }\n>> -- \n>> 2.7.4\n>>\n>>\n>\n>\n>","headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)","Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xjdmr5bXwz9sPt\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 31 Aug 2017 20:25:31 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid 7B8F9C21D7B; Thu, 31 Aug 2017 10:25:25 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 9B753C21C59;\n\tThu, 31 Aug 2017 10:25:23 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid AA62DC21C59; Thu, 31 Aug 2017 10:25:21 +0000 (UTC)","from regular1.263xmail.com (regular1.263xmail.com [211.150.99.139])\n\tby lists.denx.de (Postfix) with ESMTPS id 92F40C21C51\n\tfor <u-boot@lists.denx.de>; Thu, 31 Aug 2017 10:25:20 +0000 (UTC)","from andy.yan?rock-chips.com (unknown [192.168.167.153])\n\tby regular1.263xmail.com (Postfix) with ESMTP id 89A8254A9\n\tfor <u-boot@lists.denx.de>; Thu, 31 Aug 2017 18:25:14 +0800 (CST)","from [172.16.12.215] (localhost [127.0.0.1])\n\tby smtp.263.net (Postfix) with ESMTPA id BE7F73BE;\n\tThu, 31 Aug 2017 18:25:15 +0800 (CST)","from [172.16.12.215] (unknown [58.22.7.114])\n\tby smtp.263.net (Postfix) whith ESMTP id 3126455C790;\n\tThu, 31 Aug 2017 18:25:16 +0800 (CST)"],"X-Spam-Checker-Version":"SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=0.6 required=5.0 tests=RCVD_IN_DNSWL_NONE,\n\tRCVD_IN_SORBS_WEB autolearn=no autolearn_force=no version=3.4.0","X-263anti-spam":"KSV:0;","X-MAIL-GRAY":"0","X-MAIL-DELIVERY":"1","X-KSVirus-check":"0","X-ABS-CHECKED":"4","X-RL-SENDER":"andy.yan@rock-chips.com","X-FST-TO":"u-boot@lists.denx.de","X-SENDER-IP":"58.22.7.114","X-LOGIN-NAME":"andy.yan@rock-chips.com","X-UNIQUE-TAG":"<c9081be756becaa8474d568c00db5f01>","X-ATTACHMENT-NUM":"0","X-SENDER":"yxj@rock-chips.com","X-DNS-TYPE":"0","To":"\"Dr. Philipp Tomsich\" <philipp.tomsich@theobroma-systems.com>","References":"<1503473218-16773-1-git-send-email-andy.yan@rock-chips.com>\n\t<70B4A699-CEE9-4403-8D30-2FD5CD512190@theobroma-systems.com>","From":"Andy Yan <andy.yan@rock-chips.com>","Message-ID":"<301399da-925c-3648-5380-49f9989237be@rock-chips.com>","Date":"Thu, 31 Aug 2017 18:25:15 +0800","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.2.1","MIME-Version":"1.0","In-Reply-To":"<70B4A699-CEE9-4403-8D30-2FD5CD512190@theobroma-systems.com>","Content-Language":"en-US","Cc":"u-boot@lists.denx.de","Subject":"Re: [U-Boot] [PATCH] rockchip: clk: rk3368: always run rkclk_init\n\twhen driver probe","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.18","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<http://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>","Content-Transfer-Encoding":"base64","Content-Type":"text/plain; charset=\"utf-8\"; Format=\"flowed\"","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>"}},{"id":1776103,"web_url":"http://patchwork.ozlabs.org/comment/1776103/","msgid":"<7df2f350-cd2a-71d7-1ff2-451d3060c6e5@rock-chips.com>","list_archive_url":null,"date":"2017-09-27T07:54:51","subject":"Re: [U-Boot] [PATCH] rockchip: clk: rk3368: always run rkclk_init\n\twhen driver probe","submitter":{"id":64532,"url":"http://patchwork.ozlabs.org/api/people/64532/","name":"Kever Yang","email":"kever.yang@rock-chips.com"},"content":"Hi Philipp,\n\n\nOn 08/31/2017 06:25 PM, Andy Yan wrote:\n> Hi Philipp:\n>\n>\n> On 2017年08月28日 04:21, Dr. Philipp Tomsich wrote:\n>>> On 23 Aug 2017, at 09:26, Andy Yan <andy.yan@rock-chips.com> wrote:\n>>>\n>>> commit 4bebf94e8544(\"rockchip: clk: rk3368: do not change\n>>> CPLL/GPLL before returning to BROM\") limits the pll can only\n>>> be setup in SPL stage, but there are still some rk3368 based\n>>> boards have not use SPL yet, so they need run rkclk_init to\n>>> setup the pll in full u-boot stage, otherwise the clk_set_rate\n>>> function will run into wrong logic, because it assume that all\n>>> the pll have been set to the desired frequency.\n>> If SPL is enabled, rkclk_init should not be called from the full\n>> U-Boot, though.  I.e. we’ll need an appropriate conditional\n>> test to check whether SPL is enabled or not...\n>\n>     Do you have any ideas here?\n\nThere should have some memory could be pass from SPL (optionally via \nATF/OPTEE)\nto U-Boot, may including information like this,\n- hardware module info/status already known in previous stage, like dram \ncap in sysreg,\n- the boot device, boot rom boot from SD card, then U-Boot prefer to \nboot from SD card,\n- Android O, there is a A/B slot select, if we detect it in SPL, then we \ncan pass it to U-Boot\nand etc.\n\nMaybe we can have a vendor defined structure locate in a reserved memory \nlike boot0hook?\n\nThanks,\n- Kever\n>\n>\n>>\n>>> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>\n>>> ---\n>>>\n>>> drivers/clk/rockchip/clk_rk3368.c | 10 ++--------\n>>> 1 file changed, 2 insertions(+), 8 deletions(-)\n>>>\n>>> diff --git a/drivers/clk/rockchip/clk_rk3368.c \n>>> b/drivers/clk/rockchip/clk_rk3368.c\n>>> index 2be1f57..ee754f0 100644\n>>> --- a/drivers/clk/rockchip/clk_rk3368.c\n>>> +++ b/drivers/clk/rockchip/clk_rk3368.c\n>>> @@ -47,14 +47,12 @@ struct pll_div {\n>>>                (_nr * _no) == hz, #hz \"Hz cannot be hit with PLL \" \\\n>>>                \"divisors on line \" __stringify(__LINE__));\n>>>\n>>> -#if IS_ENABLED(CONFIG_SPL_BUILD) || IS_ENABLED(CONFIG_TPL_BUILD)\n>>> static const struct pll_div apll_l_init_cfg = \n>>> PLL_DIVISORS(APLL_L_HZ, 12, 2);\n>>> static const struct pll_div apll_b_init_cfg = \n>>> PLL_DIVISORS(APLL_B_HZ, 1, 2);\n>>> #if !defined(CONFIG_TPL_BUILD)\n>>> static const struct pll_div gpll_init_cfg = PLL_DIVISORS(GPLL_HZ, 1, \n>>> 2);\n>>> static const struct pll_div cpll_init_cfg = PLL_DIVISORS(CPLL_HZ, 1, \n>>> 6);\n>>> #endif\n>>> -#endif\n>>>\n>>> static ulong rk3368_clk_get_rate(struct clk *clk);\n>>>\n>>> @@ -85,7 +83,6 @@ static uint32_t rkclk_pll_get_rate(struct \n>>> rk3368_cru *cru,\n>>>     }\n>>> }\n>>>\n>>> -#if IS_ENABLED(CONFIG_SPL_BUILD) || IS_ENABLED(CONFIG_TPL_BUILD)\n>>> static int rkclk_set_pll(struct rk3368_cru *cru, enum rk3368_pll_id \n>>> pll_id,\n>>>              const struct pll_div *div)\n>>> {\n>>> @@ -125,9 +122,7 @@ static int rkclk_set_pll(struct rk3368_cru *cru, \n>>> enum rk3368_pll_id pll_id,\n>>> seamless\n>>>     return 0;\n>>> }\n>>> -#endif\n>>>\n>>> -#if IS_ENABLED(CONFIG_SPL_BUILD) || IS_ENABLED(CONFIG_TPL_BUILD)\n>>> static void rkclk_init(struct rk3368_cru *cru)\n>>> {\n>>>     u32 apllb, aplll, dpll, cpll, gpll;\n>>> @@ -152,7 +147,7 @@ static void rkclk_init(struct rk3368_cru *cru)\n>>>     debug(\"%s apllb(%d) apll(%d) dpll(%d) cpll(%d) gpll(%d)\\n\",\n>>>            __func__, apllb, aplll, dpll, cpll, gpll);\n>>> }\n>>> -#endif\n>>> +\n>>>\n>>> #if !IS_ENABLED(CONFIG_SPL_BUILD) || CONFIG_IS_ENABLED(MMC_SUPPORT)\n>>> static ulong rk3368_mmc_get_clk(struct rk3368_cru *cru, uint clk_id)\n>>> @@ -473,9 +468,8 @@ static int rk3368_clk_probe(struct udevice *dev)\n>>>\n>>>     priv->cru = map_sysmem(plat->dtd.reg[1], plat->dtd.reg[3]);\n>>> #endif\n>>> -#if IS_ENABLED(CONFIG_SPL_BUILD) || IS_ENABLED(CONFIG_TPL_BUILD)\n>>> +\n>>>     rkclk_init(priv->cru);\n>>> -#endif\n>>>\n>>>     return 0;\n>>> }\n>>> -- \n>>> 2.7.4\n>>>\n>>>\n>>\n>>\n>>\n>\n>","headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)","Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3y299201lMz9t1G\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 27 Sep 2017 17:55:17 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid AB922C21D99; Wed, 27 Sep 2017 07:55:14 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id B7CBEC21C73;\n\tWed, 27 Sep 2017 07:55:09 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid A8FAEC21C4F; Wed, 27 Sep 2017 07:55:07 +0000 (UTC)","from regular1.263xmail.com (regular1.263xmail.com [211.150.99.130])\n\tby lists.denx.de (Postfix) with ESMTPS id 6A658C21E33\n\tfor <u-boot@lists.denx.de>; Wed, 27 Sep 2017 07:55:04 +0000 (UTC)","from kever.yang?rock-chips.com (unknown [192.168.165.103])\n\tby regular1.263xmail.com (Postfix) with ESMTP id 8E45DB3A5;\n\tWed, 27 Sep 2017 15:54:58 +0800 (CST)","from [192.168.60.65] (localhost [127.0.0.1])\n\tby smtp.263.net (Postfix) with ESMTPA id ACD5443B;\n\tWed, 27 Sep 2017 15:54:55 +0800 (CST)","from [192.168.60.65] (unknown [103.29.142.67])\n\tby smtp.263.net (Postfix) whith ESMTP id 6256HHIT6G;\n\tWed, 27 Sep 2017 15:54:58 +0800 (CST)"],"X-Spam-Checker-Version":"SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE\n\tautolearn=unavailable autolearn_force=no version=3.4.0","X-263anti-spam":"KSV:0;","X-MAIL-GRAY":"0","X-MAIL-DELIVERY":"1","X-KSVirus-check":"0","X-ABS-CHECKED":"4","X-RL-SENDER":"kever.yang@rock-chips.com","X-FST-TO":"u-boot@lists.denx.de","X-SENDER-IP":"103.29.142.67","X-LOGIN-NAME":"kever.yang@rock-chips.com","X-UNIQUE-TAG":"<762894af64fe21a260495ef71034d702>","X-ATTACHMENT-NUM":"0","X-SENDER":"yk@rock-chips.com","X-DNS-TYPE":"0","To":"Andy Yan <andy.yan@rock-chips.com>,\n\t\"Dr. Philipp Tomsich\" <philipp.tomsich@theobroma-systems.com>","References":"<1503473218-16773-1-git-send-email-andy.yan@rock-chips.com>\n\t<70B4A699-CEE9-4403-8D30-2FD5CD512190@theobroma-systems.com>\n\t<301399da-925c-3648-5380-49f9989237be@rock-chips.com>","From":"Kever Yang <kever.yang@rock-chips.com>","Message-ID":"<7df2f350-cd2a-71d7-1ff2-451d3060c6e5@rock-chips.com>","Date":"Wed, 27 Sep 2017 15:54:51 +0800","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101\n\tThunderbird/45.8.0","MIME-Version":"1.0","In-Reply-To":"<301399da-925c-3648-5380-49f9989237be@rock-chips.com>","Cc":"u-boot@lists.denx.de","Subject":"Re: [U-Boot] [PATCH] rockchip: clk: rk3368: always run rkclk_init\n\twhen driver probe","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.18","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<http://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>","Content-Transfer-Encoding":"base64","Content-Type":"text/plain; charset=\"utf-8\"; Format=\"flowed\"","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>"}}]