All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Turquette <mturquette-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Cc: linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Kukjin Kim <kgene.kim-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
	Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>,
	Olof Johansson <olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org>,
	stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz@public.gmane.org,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org,
	linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Tomasz Figa <tomasz.figa-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: Re: [PATCH 1/7] clk: samsung: pll: Add support for PLL6552 and PLL6553
Date: Tue, 11 Jun 2013 19:53:05 -0700	[thread overview]
Message-ID: <20130612025305.8816.27929@quantum> (raw)
In-Reply-To: <1370476651-6743-2-git-send-email-tomasz.figa-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

Quoting Tomasz Figa (2013-06-05 16:57:25)
> This patch adds support for PLL6552 and PLL6553 PLLs present on Samsung
> S3C64xx SoCs.
> 
> Signed-off-by: Tomasz Figa <tomasz.figa-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

Acked-by: Mike Turquette <mturquette-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>

or I can take it into clk-next.

> ---
>  drivers/clk/samsung/clk-pll.c | 160 ++++++++++++++++++++++++++++++++++++++++++
>  drivers/clk/samsung/clk-pll.h |   4 ++
>  2 files changed, 164 insertions(+)
> 
> diff --git a/drivers/clk/samsung/clk-pll.c b/drivers/clk/samsung/clk-pll.c
> index 89135f6..cef0bb9 100644
> --- a/drivers/clk/samsung/clk-pll.c
> +++ b/drivers/clk/samsung/clk-pll.c
> @@ -336,6 +336,166 @@ struct clk * __init samsung_clk_register_pll46xx(const char *name,
>  }
>  
>  /*
> + * PLL6552 Clock Type
> + */
> +
> +#define PLL6552_LOCK_REG       0x00
> +#define PLL6552_CON_REG                0x0c
> +
> +#define PLL6552_MDIV_MASK      0x3ff
> +#define PLL6552_PDIV_MASK      0x3f
> +#define PLL6552_SDIV_MASK      0x7
> +#define PLL6552_MDIV_SHIFT     16
> +#define PLL6552_PDIV_SHIFT     8
> +#define PLL6552_SDIV_SHIFT     0
> +
> +struct samsung_clk_pll6552 {
> +       struct clk_hw hw;
> +       void __iomem *reg_base;
> +};
> +
> +#define to_clk_pll6552(_hw) container_of(_hw, struct samsung_clk_pll6552, hw)
> +
> +static unsigned long samsung_pll6552_recalc_rate(struct clk_hw *hw,
> +                                               unsigned long parent_rate)
> +{
> +       struct samsung_clk_pll6552 *pll = to_clk_pll6552(hw);
> +       u32 mdiv, pdiv, sdiv, pll_con;
> +       u64 fvco = parent_rate;
> +
> +       pll_con = __raw_readl(pll->reg_base + PLL6552_CON_REG);
> +       mdiv = (pll_con >> PLL6552_MDIV_SHIFT) & PLL6552_MDIV_MASK;
> +       pdiv = (pll_con >> PLL6552_PDIV_SHIFT) & PLL6552_PDIV_MASK;
> +       sdiv = (pll_con >> PLL6552_SDIV_SHIFT) & PLL6552_SDIV_MASK;
> +
> +       fvco *= mdiv;
> +       do_div(fvco, (pdiv << sdiv));
> +
> +       return (unsigned long)fvco;
> +}
> +
> +static const struct clk_ops samsung_pll6552_clk_ops = {
> +       .recalc_rate = samsung_pll6552_recalc_rate,
> +};
> +
> +struct clk * __init samsung_clk_register_pll6552(const char *name,
> +                                       const char *pname, void __iomem *base)
> +{
> +       struct samsung_clk_pll6552 *pll;
> +       struct clk *clk;
> +       struct clk_init_data init;
> +
> +       pll = kzalloc(sizeof(*pll), GFP_KERNEL);
> +       if (!pll) {
> +               pr_err("%s: could not allocate pll clk %s\n", __func__, name);
> +               return NULL;
> +       }
> +
> +       init.name = name;
> +       init.ops = &samsung_pll6552_clk_ops;
> +       init.parent_names = &pname;
> +       init.num_parents = 1;
> +
> +       pll->hw.init = &init;
> +       pll->reg_base = base;
> +
> +       clk = clk_register(NULL, &pll->hw);
> +       if (IS_ERR(clk)) {
> +               pr_err("%s: failed to register pll clock %s\n", __func__,
> +                               name);
> +               kfree(pll);
> +       }
> +
> +       if (clk_register_clkdev(clk, name, NULL))
> +               pr_err("%s: failed to register lookup for %s", __func__, name);
> +
> +       return clk;
> +}
> +
> +/*
> + * PLL6553 Clock Type
> + */
> +
> +#define PLL6553_LOCK_REG       0x00
> +#define PLL6553_CON0_REG       0x0c
> +#define PLL6553_CON1_REG       0x10
> +
> +#define PLL6553_MDIV_MASK      0xff
> +#define PLL6553_PDIV_MASK      0x3f
> +#define PLL6553_SDIV_MASK      0x7
> +#define PLL6553_KDIV_MASK      0xffff
> +#define PLL6553_MDIV_SHIFT     16
> +#define PLL6553_PDIV_SHIFT     8
> +#define PLL6553_SDIV_SHIFT     0
> +#define PLL6553_KDIV_SHIFT     0
> +
> +struct samsung_clk_pll6553 {
> +       struct clk_hw hw;
> +       void __iomem *reg_base;
> +};
> +
> +#define to_clk_pll6553(_hw) container_of(_hw, struct samsung_clk_pll6553, hw)
> +
> +static unsigned long samsung_pll6553_recalc_rate(struct clk_hw *hw,
> +                                               unsigned long parent_rate)
> +{
> +       struct samsung_clk_pll6553 *pll = to_clk_pll6553(hw);
> +       u32 mdiv, pdiv, sdiv, kdiv, pll_con0, pll_con1;
> +       u64 fvco = parent_rate;
> +
> +       pll_con0 = __raw_readl(pll->reg_base + PLL6553_CON0_REG);
> +       pll_con1 = __raw_readl(pll->reg_base + PLL6553_CON1_REG);
> +       mdiv = (pll_con0 >> PLL6553_MDIV_SHIFT) & PLL6553_MDIV_MASK;
> +       pdiv = (pll_con0 >> PLL6553_PDIV_SHIFT) & PLL6553_PDIV_MASK;
> +       sdiv = (pll_con0 >> PLL6553_SDIV_SHIFT) & PLL6553_SDIV_MASK;
> +       kdiv = (pll_con1 >> PLL6553_KDIV_SHIFT) & PLL6553_KDIV_MASK;
> +
> +       fvco *= (mdiv << 16) + kdiv;
> +       do_div(fvco, (pdiv << sdiv));
> +       fvco >>= 16;
> +
> +       return (unsigned long)fvco;
> +}
> +
> +static const struct clk_ops samsung_pll6553_clk_ops = {
> +       .recalc_rate = samsung_pll6553_recalc_rate,
> +};
> +
> +struct clk * __init samsung_clk_register_pll6553(const char *name,
> +                                       const char *pname, void __iomem *base)
> +{
> +       struct samsung_clk_pll6553 *pll;
> +       struct clk *clk;
> +       struct clk_init_data init;
> +
> +       pll = kzalloc(sizeof(*pll), GFP_KERNEL);
> +       if (!pll) {
> +               pr_err("%s: could not allocate pll clk %s\n", __func__, name);
> +               return NULL;
> +       }
> +
> +       init.name = name;
> +       init.ops = &samsung_pll6553_clk_ops;
> +       init.parent_names = &pname;
> +       init.num_parents = 1;
> +
> +       pll->hw.init = &init;
> +       pll->reg_base = base;
> +
> +       clk = clk_register(NULL, &pll->hw);
> +       if (IS_ERR(clk)) {
> +               pr_err("%s: failed to register pll clock %s\n", __func__,
> +                               name);
> +               kfree(pll);
> +       }
> +
> +       if (clk_register_clkdev(clk, name, NULL))
> +               pr_err("%s: failed to register lookup for %s", __func__, name);
> +
> +       return clk;
> +}
> +
> +/*
>   * PLL2550x Clock Type
>   */
>  
> diff --git a/drivers/clk/samsung/clk-pll.h b/drivers/clk/samsung/clk-pll.h
> index f33786e..1d68a68 100644
> --- a/drivers/clk/samsung/clk-pll.h
> +++ b/drivers/clk/samsung/clk-pll.h
> @@ -34,6 +34,10 @@ extern struct clk * __init samsung_clk_register_pll45xx(const char *name,
>  extern struct clk * __init samsung_clk_register_pll46xx(const char *name,
>                         const char *pname, const void __iomem *con_reg,
>                         enum pll46xx_type type);
> +extern struct clk *samsung_clk_register_pll6552(const char *name,
> +                       const char *pname, void __iomem *base);
> +extern struct clk *samsung_clk_register_pll6553(const char *name,
> +                       const char *pname, void __iomem *base);
>  extern struct clk * __init samsung_clk_register_pll2550x(const char *name,
>                         const char *pname, const void __iomem *reg_base,
>                         const unsigned long offset);
> -- 
> 1.8.2.1
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: mturquette@linaro.org (Mike Turquette)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/7] clk: samsung: pll: Add support for PLL6552 and PLL6553
Date: Tue, 11 Jun 2013 19:53:05 -0700	[thread overview]
Message-ID: <20130612025305.8816.27929@quantum> (raw)
In-Reply-To: <1370476651-6743-2-git-send-email-tomasz.figa@gmail.com>

Quoting Tomasz Figa (2013-06-05 16:57:25)
> This patch adds support for PLL6552 and PLL6553 PLLs present on Samsung
> S3C64xx SoCs.
> 
> Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>

Acked-by: Mike Turquette <mturquette@linaro.org>

or I can take it into clk-next.

> ---
>  drivers/clk/samsung/clk-pll.c | 160 ++++++++++++++++++++++++++++++++++++++++++
>  drivers/clk/samsung/clk-pll.h |   4 ++
>  2 files changed, 164 insertions(+)
> 
> diff --git a/drivers/clk/samsung/clk-pll.c b/drivers/clk/samsung/clk-pll.c
> index 89135f6..cef0bb9 100644
> --- a/drivers/clk/samsung/clk-pll.c
> +++ b/drivers/clk/samsung/clk-pll.c
> @@ -336,6 +336,166 @@ struct clk * __init samsung_clk_register_pll46xx(const char *name,
>  }
>  
>  /*
> + * PLL6552 Clock Type
> + */
> +
> +#define PLL6552_LOCK_REG       0x00
> +#define PLL6552_CON_REG                0x0c
> +
> +#define PLL6552_MDIV_MASK      0x3ff
> +#define PLL6552_PDIV_MASK      0x3f
> +#define PLL6552_SDIV_MASK      0x7
> +#define PLL6552_MDIV_SHIFT     16
> +#define PLL6552_PDIV_SHIFT     8
> +#define PLL6552_SDIV_SHIFT     0
> +
> +struct samsung_clk_pll6552 {
> +       struct clk_hw hw;
> +       void __iomem *reg_base;
> +};
> +
> +#define to_clk_pll6552(_hw) container_of(_hw, struct samsung_clk_pll6552, hw)
> +
> +static unsigned long samsung_pll6552_recalc_rate(struct clk_hw *hw,
> +                                               unsigned long parent_rate)
> +{
> +       struct samsung_clk_pll6552 *pll = to_clk_pll6552(hw);
> +       u32 mdiv, pdiv, sdiv, pll_con;
> +       u64 fvco = parent_rate;
> +
> +       pll_con = __raw_readl(pll->reg_base + PLL6552_CON_REG);
> +       mdiv = (pll_con >> PLL6552_MDIV_SHIFT) & PLL6552_MDIV_MASK;
> +       pdiv = (pll_con >> PLL6552_PDIV_SHIFT) & PLL6552_PDIV_MASK;
> +       sdiv = (pll_con >> PLL6552_SDIV_SHIFT) & PLL6552_SDIV_MASK;
> +
> +       fvco *= mdiv;
> +       do_div(fvco, (pdiv << sdiv));
> +
> +       return (unsigned long)fvco;
> +}
> +
> +static const struct clk_ops samsung_pll6552_clk_ops = {
> +       .recalc_rate = samsung_pll6552_recalc_rate,
> +};
> +
> +struct clk * __init samsung_clk_register_pll6552(const char *name,
> +                                       const char *pname, void __iomem *base)
> +{
> +       struct samsung_clk_pll6552 *pll;
> +       struct clk *clk;
> +       struct clk_init_data init;
> +
> +       pll = kzalloc(sizeof(*pll), GFP_KERNEL);
> +       if (!pll) {
> +               pr_err("%s: could not allocate pll clk %s\n", __func__, name);
> +               return NULL;
> +       }
> +
> +       init.name = name;
> +       init.ops = &samsung_pll6552_clk_ops;
> +       init.parent_names = &pname;
> +       init.num_parents = 1;
> +
> +       pll->hw.init = &init;
> +       pll->reg_base = base;
> +
> +       clk = clk_register(NULL, &pll->hw);
> +       if (IS_ERR(clk)) {
> +               pr_err("%s: failed to register pll clock %s\n", __func__,
> +                               name);
> +               kfree(pll);
> +       }
> +
> +       if (clk_register_clkdev(clk, name, NULL))
> +               pr_err("%s: failed to register lookup for %s", __func__, name);
> +
> +       return clk;
> +}
> +
> +/*
> + * PLL6553 Clock Type
> + */
> +
> +#define PLL6553_LOCK_REG       0x00
> +#define PLL6553_CON0_REG       0x0c
> +#define PLL6553_CON1_REG       0x10
> +
> +#define PLL6553_MDIV_MASK      0xff
> +#define PLL6553_PDIV_MASK      0x3f
> +#define PLL6553_SDIV_MASK      0x7
> +#define PLL6553_KDIV_MASK      0xffff
> +#define PLL6553_MDIV_SHIFT     16
> +#define PLL6553_PDIV_SHIFT     8
> +#define PLL6553_SDIV_SHIFT     0
> +#define PLL6553_KDIV_SHIFT     0
> +
> +struct samsung_clk_pll6553 {
> +       struct clk_hw hw;
> +       void __iomem *reg_base;
> +};
> +
> +#define to_clk_pll6553(_hw) container_of(_hw, struct samsung_clk_pll6553, hw)
> +
> +static unsigned long samsung_pll6553_recalc_rate(struct clk_hw *hw,
> +                                               unsigned long parent_rate)
> +{
> +       struct samsung_clk_pll6553 *pll = to_clk_pll6553(hw);
> +       u32 mdiv, pdiv, sdiv, kdiv, pll_con0, pll_con1;
> +       u64 fvco = parent_rate;
> +
> +       pll_con0 = __raw_readl(pll->reg_base + PLL6553_CON0_REG);
> +       pll_con1 = __raw_readl(pll->reg_base + PLL6553_CON1_REG);
> +       mdiv = (pll_con0 >> PLL6553_MDIV_SHIFT) & PLL6553_MDIV_MASK;
> +       pdiv = (pll_con0 >> PLL6553_PDIV_SHIFT) & PLL6553_PDIV_MASK;
> +       sdiv = (pll_con0 >> PLL6553_SDIV_SHIFT) & PLL6553_SDIV_MASK;
> +       kdiv = (pll_con1 >> PLL6553_KDIV_SHIFT) & PLL6553_KDIV_MASK;
> +
> +       fvco *= (mdiv << 16) + kdiv;
> +       do_div(fvco, (pdiv << sdiv));
> +       fvco >>= 16;
> +
> +       return (unsigned long)fvco;
> +}
> +
> +static const struct clk_ops samsung_pll6553_clk_ops = {
> +       .recalc_rate = samsung_pll6553_recalc_rate,
> +};
> +
> +struct clk * __init samsung_clk_register_pll6553(const char *name,
> +                                       const char *pname, void __iomem *base)
> +{
> +       struct samsung_clk_pll6553 *pll;
> +       struct clk *clk;
> +       struct clk_init_data init;
> +
> +       pll = kzalloc(sizeof(*pll), GFP_KERNEL);
> +       if (!pll) {
> +               pr_err("%s: could not allocate pll clk %s\n", __func__, name);
> +               return NULL;
> +       }
> +
> +       init.name = name;
> +       init.ops = &samsung_pll6553_clk_ops;
> +       init.parent_names = &pname;
> +       init.num_parents = 1;
> +
> +       pll->hw.init = &init;
> +       pll->reg_base = base;
> +
> +       clk = clk_register(NULL, &pll->hw);
> +       if (IS_ERR(clk)) {
> +               pr_err("%s: failed to register pll clock %s\n", __func__,
> +                               name);
> +               kfree(pll);
> +       }
> +
> +       if (clk_register_clkdev(clk, name, NULL))
> +               pr_err("%s: failed to register lookup for %s", __func__, name);
> +
> +       return clk;
> +}
> +
> +/*
>   * PLL2550x Clock Type
>   */
>  
> diff --git a/drivers/clk/samsung/clk-pll.h b/drivers/clk/samsung/clk-pll.h
> index f33786e..1d68a68 100644
> --- a/drivers/clk/samsung/clk-pll.h
> +++ b/drivers/clk/samsung/clk-pll.h
> @@ -34,6 +34,10 @@ extern struct clk * __init samsung_clk_register_pll45xx(const char *name,
>  extern struct clk * __init samsung_clk_register_pll46xx(const char *name,
>                         const char *pname, const void __iomem *con_reg,
>                         enum pll46xx_type type);
> +extern struct clk *samsung_clk_register_pll6552(const char *name,
> +                       const char *pname, void __iomem *base);
> +extern struct clk *samsung_clk_register_pll6553(const char *name,
> +                       const char *pname, void __iomem *base);
>  extern struct clk * __init samsung_clk_register_pll2550x(const char *name,
>                         const char *pname, const void __iomem *reg_base,
>                         const unsigned long offset);
> -- 
> 1.8.2.1

  parent reply	other threads:[~2013-06-12  2:53 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-05 23:57 [PATCH 0/7] Common Clock Framework support for Samsung S3C64xx Tomasz Figa
2013-06-05 23:57 ` Tomasz Figa
2013-06-05 23:57 ` [PATCH 1/7] clk: samsung: pll: Add support for PLL6552 and PLL6553 Tomasz Figa
2013-06-05 23:57   ` Tomasz Figa
     [not found]   ` <1370476651-6743-2-git-send-email-tomasz.figa-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-06-12  2:53     ` Mike Turquette [this message]
2013-06-12  2:53       ` Mike Turquette
2013-06-05 23:57 ` [PATCH 3/7] ARM: SAMSUNG: Add soc_is_s3c6400/s3c6410 macros Tomasz Figa
2013-06-05 23:57   ` Tomasz Figa
     [not found] ` <1370476651-6743-1-git-send-email-tomasz.figa-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-06-05 23:57   ` [PATCH 2/7] clk: samsung: Add clock driver for S3C64xx SoCs Tomasz Figa
2013-06-05 23:57     ` Tomasz Figa
     [not found]     ` <1370476651-6743-3-git-send-email-tomasz.figa-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-06-12  2:54       ` Mike Turquette
2013-06-12  2:54         ` Mike Turquette
2013-06-12  6:26         ` Tomasz Figa
2013-06-12  6:26           ` Tomasz Figa
2013-06-12 16:51           ` Mike Turquette
2013-06-12 16:51             ` Mike Turquette
2013-06-12 21:38             ` Tomasz Figa
2013-06-12 21:38               ` Tomasz Figa
2013-06-19 14:18               ` Kukjin Kim
2013-06-19 14:18                 ` Kukjin Kim
2013-06-05 23:57   ` [PATCH 4/7] ARM: s3c64xx: dma: Use clk_prepare_enable/clk_disable_unprepare Tomasz Figa
2013-06-05 23:57     ` Tomasz Figa
2013-06-05 23:57   ` [PATCH 6/7] ARM: s3c64xx: Migrate clock handling to Common Clock Framework Tomasz Figa
2013-06-05 23:57     ` Tomasz Figa
2013-06-05 23:57 ` [PATCH 5/7] usb: host: ohci-s3c2410 Use clk_prepare_enable/clk_disable_unprepare Tomasz Figa
2013-06-05 23:57   ` Tomasz Figa
2013-06-05 23:57 ` [PATCH 7/7] ARM: s3c64xx: Remove old clock management code Tomasz Figa
2013-06-05 23:57   ` Tomasz Figa
2013-06-19 14:17 ` [PATCH 0/7] Common Clock Framework support for Samsung S3C64xx Kukjin Kim
2013-06-19 14:17   ` Kukjin Kim
     [not found]   ` <51C1BD62.8050007-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2013-06-19 14:23     ` Tomasz Figa
2013-06-19 14:23       ` Tomasz Figa

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=20130612025305.8816.27929@quantum \
    --to=mturquette-qsej5fyqhm4dnm+yrofe0a@public.gmane.org \
    --cc=arnd-r2nGTMty4D4@public.gmane.org \
    --cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org \
    --cc=kgene.kim-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org \
    --cc=stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz@public.gmane.org \
    --cc=tomasz.figa-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.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 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.