qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Crosthwaite <crosthwaitepeter@gmail.com>
To: Jean-Christophe Dubois <jcd@tribudubois.net>
Cc: Peter Maydell <peter.maydell@linaro.org>,
	"qemu-devel@nongnu.org Developers" <qemu-devel@nongnu.org>,
	Peter Crosthwaite <crosthwaite.peter@gmail.com>
Subject: Re: [Qemu-devel] [PATCH v3 1/3] i.MX: rename i.MX CCM get_clock() function and CLK ID enum names
Date: Fri, 20 Nov 2015 00:32:16 -0800	[thread overview]
Message-ID: <CAPokK=pkDLAOHvZvGkh1vM4TypBmGjo_g0gGOduH=ppYB5kiVQ@mail.gmail.com> (raw)
In-Reply-To: <b4edcab48c321f07512c47241a2a8266f5f4b812.1447964804.git.jcd@tribudubois.net>

On Thu, Nov 19, 2015 at 12:40 PM, Jean-Christophe Dubois
<jcd@tribudubois.net> wrote:
> This is to prepare for CCM code refactoring.
>
> This is just a bit of function and enum values renaming.
>
> We also remove some useless intermediate variables.
>
> Signed-off-by: Jean-Christophe Dubois <jcd@tribudubois.net>

Reviewed-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>

> ---
>
> Changes since v1:
>  * Not present
>
> Changes since v2:
>  * Not present
>
>  hw/misc/imx_ccm.c         |  8 ++++----
>  hw/timer/imx_epit.c       | 20 +++++++++-----------
>  hw/timer/imx_gpt.c        | 16 ++++++++--------
>  include/hw/misc/imx_ccm.h |  8 ++++----
>  4 files changed, 25 insertions(+), 27 deletions(-)
>
> diff --git a/hw/misc/imx_ccm.c b/hw/misc/imx_ccm.c
> index 4cc2bbc..415937f 100644
> --- a/hw/misc/imx_ccm.c
> +++ b/hw/misc/imx_ccm.c
> @@ -49,18 +49,18 @@ static const VMStateDescription vmstate_imx_ccm = {
>      .post_load = imx_ccm_post_load,
>  };
>
> -uint32_t imx_clock_frequency(DeviceState *dev, IMXClk clock)
> +uint32_t imx_ccm_get_clock_frequency(DeviceState *dev, IMXClk clock)
>  {
>      IMXCCMState *s = IMX_CCM(dev);
>
>      switch (clock) {
>      case NOCLK:
>          return 0;
> -    case MCU:
> +    case CLK_MCU:
>          return s->mcu_clk_freq;
> -    case HSP:
> +    case CLK_HSP:
>          return s->hsp_clk_freq;
> -    case IPG:
> +    case CLK_IPG:
>          return s->ipg_clk_freq;
>      case CLK_32k:
>          return CKIL_FREQ;
> diff --git a/hw/timer/imx_epit.c b/hw/timer/imx_epit.c
> index 967be4a..50bf83c 100644
> --- a/hw/timer/imx_epit.c
> +++ b/hw/timer/imx_epit.c
> @@ -51,9 +51,9 @@ static char const *imx_epit_reg_name(uint32_t reg)
>   * These are typical.
>   */
>  static const IMXClk imx_epit_clocks[] =  {
> -    0,        /* 00 disabled */
> -    IPG,      /* 01 ipg_clk, ~532MHz */
> -    IPG,      /* 10 ipg_clk_highfreq */
> +    NOCLK,    /* 00 disabled */
> +    CLK_IPG,  /* 01 ipg_clk, ~532MHz */
> +    CLK_IPG,  /* 10 ipg_clk_highfreq */
>      CLK_32k,  /* 11 ipg_clk_32k -- ~32kHz */
>  };
>
> @@ -73,20 +73,18 @@ static void imx_epit_set_freq(IMXEPITState *s)
>  {
>      uint32_t clksrc;
>      uint32_t prescaler;
> -    uint32_t freq;
>
>      clksrc = extract32(s->cr, CR_CLKSRC_SHIFT, 2);
>      prescaler = 1 + extract32(s->cr, CR_PRESCALE_SHIFT, 12);
>
> -    freq = imx_clock_frequency(s->ccm, imx_epit_clocks[clksrc]) / prescaler;
> +    s->freq = imx_ccm_get_clock_frequency(s->ccm,
> +                                imx_epit_clocks[clksrc]) / prescaler;
>
> -    s->freq = freq;
> +    DPRINTF("Setting ptimer frequency to %u\n", s->freq);
>
> -    DPRINTF("Setting ptimer frequency to %u\n", freq);
> -
> -    if (freq) {
> -        ptimer_set_freq(s->timer_reload, freq);
> -        ptimer_set_freq(s->timer_cmp, freq);
> +    if (s->freq) {
> +        ptimer_set_freq(s->timer_reload, s->freq);
> +        ptimer_set_freq(s->timer_cmp, s->freq);
>      }
>  }
>
> diff --git a/hw/timer/imx_gpt.c b/hw/timer/imx_gpt.c
> index 7257f42..b1893b8 100644
> --- a/hw/timer/imx_gpt.c
> +++ b/hw/timer/imx_gpt.c
> @@ -81,8 +81,8 @@ static const VMStateDescription vmstate_imx_timer_gpt = {
>
>  static const IMXClk imx_gpt_clocks[] = {
>      NOCLK,    /* 000 No clock source */
> -    IPG,      /* 001 ipg_clk, 532MHz*/
> -    IPG,      /* 010 ipg_clk_highfreq */
> +    CLK_IPG,  /* 001 ipg_clk, 532MHz*/
> +    CLK_IPG,  /* 010 ipg_clk_highfreq */
>      NOCLK,    /* 011 not defined */
>      CLK_32k,  /* 100 ipg_clk_32k */
>      NOCLK,    /* 101 not defined */
> @@ -93,14 +93,14 @@ static const IMXClk imx_gpt_clocks[] = {
>  static void imx_gpt_set_freq(IMXGPTState *s)
>  {
>      uint32_t clksrc = extract32(s->cr, GPT_CR_CLKSRC_SHIFT, 3);
> -    uint32_t freq = imx_clock_frequency(s->ccm, imx_gpt_clocks[clksrc])
> -                    / (1 + s->pr);
> -    s->freq = freq;
>
> -    DPRINTF("Setting clksrc %d to frequency %d\n", clksrc, freq);
> +    s->freq = imx_ccm_get_clock_frequency(s->ccm,
> +                                imx_gpt_clocks[clksrc]) / (1 + s->pr);
>
> -    if (freq) {
> -        ptimer_set_freq(s->timer, freq);
> +    DPRINTF("Setting clksrc %d to frequency %d\n", clksrc, s->freq);
> +
> +    if (s->freq) {
> +        ptimer_set_freq(s->timer, s->freq);
>      }
>  }
>
> diff --git a/include/hw/misc/imx_ccm.h b/include/hw/misc/imx_ccm.h
> index 0f2e469..09f6248 100644
> --- a/include/hw/misc/imx_ccm.h
> +++ b/include/hw/misc/imx_ccm.h
> @@ -80,12 +80,12 @@ typedef struct IMXCCMState {
>
>  typedef enum  {
>      NOCLK,
> -    MCU,
> -    HSP,
> -    IPG,
> +    CLK_MCU,
> +    CLK_HSP,
> +    CLK_IPG,
>      CLK_32k
>  } IMXClk;
>
> -uint32_t imx_clock_frequency(DeviceState *s, IMXClk clock);
> +uint32_t imx_ccm_get_clock_frequency(DeviceState *s, IMXClk clock);
>
>  #endif /* IMX_CCM_H */
> --
> 2.5.0
>

  reply	other threads:[~2015-11-20  8:32 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-19 20:39 [Qemu-devel] [PATCH v3 0/3] Add an i.MX25 specific CCM driver Jean-Christophe Dubois
2015-11-19 20:40 ` [Qemu-devel] [PATCH v3 1/3] i.MX: rename i.MX CCM get_clock() function and CLK ID enum names Jean-Christophe Dubois
2015-11-20  8:32   ` Peter Crosthwaite [this message]
2015-11-19 20:40 ` [Qemu-devel] [PATCH v3 2/3] i.MX: Split the CCM class into an abstact base class and a concrete class Jean-Christophe Dubois
2015-11-24 22:04   ` Peter Crosthwaite
2015-11-24 23:17     ` Jean-Christophe DUBOIS
2015-11-24 23:31       ` Peter Crosthwaite
2015-11-19 20:40 ` [Qemu-devel] [PATCH v3 3/3] i.MX: Add an i.MX25 specific CCM class/instance Jean-Christophe Dubois
2015-11-25  5:51   ` Peter Crosthwaite
2015-11-26  7:14     ` Jean-Christophe DUBOIS
2015-11-27  2:33       ` Peter Crosthwaite

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='CAPokK=pkDLAOHvZvGkh1vM4TypBmGjo_g0gGOduH=ppYB5kiVQ@mail.gmail.com' \
    --to=crosthwaitepeter@gmail.com \
    --cc=crosthwaite.peter@gmail.com \
    --cc=jcd@tribudubois.net \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.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 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).