All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bin Meng <bmeng.cn@gmail.com>
To: u-boot@lists.denx.de
Subject: [PATCH v5 08/14] clk: sifive: fu540-prci: Add clock enable and disable ops
Date: Fri, 13 Mar 2020 15:57:05 +0800	[thread overview]
Message-ID: <CAEUhbmV=SPpf9Rym3eefVXdv9BhKGQmJRCsc5mdrW=epHnBGfQ@mail.gmail.com> (raw)
In-Reply-To: <20200311070320.21323-9-pragnesh.patel@sifive.com>

On Wed, Mar 11, 2020 at 3:04 PM Pragnesh Patel
<pragnesh.patel@sifive.com> wrote:
>
> Added clock enable and disable functions in prci ops
>
> Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
> ---
>  drivers/clk/sifive/fu540-prci.c | 75 +++++++++++++++++++++++++++++++--
>  1 file changed, 72 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/clk/sifive/fu540-prci.c b/drivers/clk/sifive/fu540-prci.c
> index 8847178001..c02c0466a8 100644
> --- a/drivers/clk/sifive/fu540-prci.c
> +++ b/drivers/clk/sifive/fu540-prci.c
> @@ -68,6 +68,11 @@
>  #define PRCI_COREPLLCFG0_LOCK_SHIFT    31
>  #define PRCI_COREPLLCFG0_LOCK_MASK     (0x1 << PRCI_COREPLLCFG0_LOCK_SHIFT)
>
> +/* COREPLLCFG1 */
> +#define PRCI_COREPLLCFG1_OFFSET                0x8
> +#define PRCI_COREPLLCFG1_CKE_SHIFT     31
> +#define PRCI_COREPLLCFG1_CKE_MASK      (0x1 << PRCI_COREPLLCFG1_CKE_SHIFT)
> +
>  /* DDRPLLCFG0 */
>  #define PRCI_DDRPLLCFG0_OFFSET         0xc
>  #define PRCI_DDRPLLCFG0_DIVR_SHIFT     0
> @@ -87,7 +92,7 @@
>
>  /* DDRPLLCFG1 */
>  #define PRCI_DDRPLLCFG1_OFFSET         0x10
> -#define PRCI_DDRPLLCFG1_CKE_SHIFT      24
> +#define PRCI_DDRPLLCFG1_CKE_SHIFT      31
>  #define PRCI_DDRPLLCFG1_CKE_MASK       (0x1 << PRCI_DDRPLLCFG1_CKE_SHIFT)
>
>  /* GEMGXLPLLCFG0 */
> @@ -114,7 +119,7 @@
>
>  /* GEMGXLPLLCFG1 */
>  #define PRCI_GEMGXLPLLCFG1_OFFSET      0x20
> -#define PRCI_GEMGXLPLLCFG1_CKE_SHIFT   24
> +#define PRCI_GEMGXLPLLCFG1_CKE_SHIFT   31
>  #define PRCI_GEMGXLPLLCFG1_CKE_MASK    (0x1 << PRCI_GEMGXLPLLCFG1_CKE_SHIFT)
>
>  /* CORECLKSEL */
> @@ -142,7 +147,7 @@
>                         (0x1 << PRCI_DEVICESRESETREG_GEMGXL_RST_N_SHIFT)
>
>  /* CLKMUXSTATUSREG */
> -#define PRCI_CLKMUXSTATUSREG_OFFSET            0x2c
> +#define PRCI_CLKMUXSTATUSREG_OFFSET    0x2c
>  #define PRCI_CLKMUXSTATUSREG_TLCLKSEL_STATUS_SHIFT 1
>  #define PRCI_CLKMUXSTATUSREG_TLCLKSEL_STATUS_MASK \
>                         (0x1 << PRCI_CLKMUXSTATUSREG_TLCLKSEL_STATUS_SHIFT)
> @@ -170,6 +175,7 @@ struct __prci_data {
>   * @enable_bypass: fn ptr to code to bypass the WRPLL (if applicable; else NULL)
>   * @disable_bypass: fn ptr to code to not bypass the WRPLL (or NULL)
>   * @cfg0_offs: WRPLL CFG0 register offset (in bytes) from the PRCI base address
> + * @cfg1_offs: WRPLL CFG1 register offset (in bytes) from the PRCI base address
>   *
>   * @enable_bypass and @disable_bypass are used for WRPLL instances
>   * that contain a separate external glitchless clock mux downstream
> @@ -180,6 +186,7 @@ struct __prci_wrpll_data {
>         void (*enable_bypass)(struct __prci_data *pd);
>         void (*disable_bypass)(struct __prci_data *pd);
>         u8 cfg0_offs;
> +       u8 cfg1_offs;
>  };
>
>  struct __prci_clock;
> @@ -194,6 +201,7 @@ struct __prci_clock_ops {
>                                     unsigned long *parent_rate);
>         unsigned long (*recalc_rate)(struct __prci_clock *pc,
>                                      unsigned long parent_rate);
> +       int (*enable_clk)(struct __prci_clock *pc, bool enable);
>  };
>
>  /**
> @@ -356,6 +364,13 @@ static void __prci_wrpll_write_cfg(struct __prci_data *pd,
>         memcpy(&pwd->c, c, sizeof(*c));
>  }
>
> +static void __prci_wrpll_write_cfg1(struct __prci_data *pd,

nits: we should also rename the existing function
__prci_wrpll_write_cfg() to __prci_wrpll_write_cfg0()

> +                                   struct __prci_wrpll_data *pwd,
> +                                   u32 enable)
> +{
> +       __prci_writel(enable, pwd->cfg1_offs, pd);
> +}
> +

[snip]

Regards,
Bin

  reply	other threads:[~2020-03-13  7:57 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-11  7:03 [PATCH v5 00/14] RISC-V SiFive FU540 support SPL Pragnesh Patel
2020-03-11  7:03 ` [PATCH v5 01/14] misc: add driver for the SiFive otp controller Pragnesh Patel
2020-03-11 10:25   ` Bin Meng
2020-03-17 17:30     ` Pragnesh Patel
2020-03-11  7:03 ` [PATCH v5 02/14] riscv: sifive: fu540: Use OTP DM driver for serial environment variable Pragnesh Patel
2020-03-11 13:32   ` Bin Meng
2020-03-11 14:52     ` Bin Meng
2020-03-17 15:45       ` Pragnesh Patel
2020-03-11 15:00   ` Bin Meng
2020-03-17 17:36     ` Pragnesh Patel
2020-03-11  7:03 ` [PATCH v5 03/14] riscv: Add _image_binary_end for SPL Pragnesh Patel
2020-03-11  7:03 ` [PATCH v5 04/14] lib: Makefile: build crc7.c when CONFIG_MMC_SPI Pragnesh Patel
2020-03-11 13:52   ` Bin Meng
2020-03-17 16:47     ` Pragnesh Patel
2020-03-11  7:03 ` [PATCH v5 05/14] riscv: sifive: dts: fu540: Add board -u-boot.dtsi files Pragnesh Patel
2020-03-11 14:51   ` Bin Meng
2020-03-17 16:44     ` Pragnesh Patel
2020-03-11  7:03 ` [PATCH v5 06/14] sifive: fu540: add ddr driver Pragnesh Patel
2020-03-13  7:48   ` Bin Meng
2020-03-17 13:00     ` Pragnesh Patel
2020-03-13 11:56   ` Giulio Benetti
2020-03-17 13:05     ` Pragnesh Patel
2020-03-11  7:03 ` [PATCH v5 07/14] sifive: dts: fu540: Add DDR controller and phy register settings Pragnesh Patel
2020-03-13  7:51   ` Bin Meng
2020-03-17 15:35     ` Pragnesh Patel
2020-03-11  7:03 ` [PATCH v5 08/14] clk: sifive: fu540-prci: Add clock enable and disable ops Pragnesh Patel
2020-03-13  7:57   ` Bin Meng [this message]
2020-03-13  8:15     ` Pragnesh Patel
2020-03-11  7:03 ` [PATCH v5 09/14] clk: sifive: fu540-prci: Add clock initialization for SPL Pragnesh Patel
2020-03-13  8:11   ` Bin Meng
2020-03-17 17:47     ` Pragnesh Patel
2020-03-11  7:03 ` [PATCH v5 10/14] riscv: sifive: fu540: add SPL configuration Pragnesh Patel
2020-03-13  8:28   ` Bin Meng
2020-03-17  7:41     ` Pragnesh Patel
2020-03-13 13:59   ` Bin Meng
2020-03-17  8:04     ` Pragnesh Patel
2020-03-11  7:03 ` [PATCH v5 11/14] configs: fu540: Add config options for U-boot SPL Pragnesh Patel
2020-03-13  8:48   ` Bin Meng
2020-03-17 14:45     ` Pragnesh Patel
2020-03-11  7:03 ` [PATCH v5 12/14] riscv: sifive: fu540: enable all cache ways from u-boot proper Pragnesh Patel
2020-03-13  9:01   ` Bin Meng
2020-03-13 10:02     ` Anup Patel
2020-03-13 10:22       ` Bin Meng
2020-03-13 10:49         ` Anup Patel
2020-03-13 13:49           ` Bin Meng
2020-03-17  9:52             ` Pragnesh Patel
     [not found]               ` <752D002CFF5D0F4FA35C0100F1D73F3FA46E7F97@ATCPCS16.andestech.com>
2020-03-18  2:27                 ` Rick Chen
2020-03-13 10:54         ` Anup Patel
2020-03-11  7:03 ` [PATCH v5 13/14] sifive: fix palmer's email address Pragnesh Patel
2020-03-13  9:01   ` Bin Meng
2020-03-11  7:03 ` [PATCH v5 14/14] doc: update FU540 RISC-V documentation Pragnesh Patel
2020-03-13  9:22   ` Bin Meng
2020-03-17 14:31     ` Pragnesh Patel

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='CAEUhbmV=SPpf9Rym3eefVXdv9BhKGQmJRCsc5mdrW=epHnBGfQ@mail.gmail.com' \
    --to=bmeng.cn@gmail.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 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.