qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: KONRAD Frederic <fred.konrad@greensocs.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Edgar Iglesias <edgar.iglesias@xilinx.com>,
	Mark Burton <mark.burton@greensocs.com>,
	QEMU Developers <qemu-devel@nongnu.org>,
	Alistair Francis <alistair.francis@xilinx.com>
Subject: Re: [Qemu-devel] [RFC PATCH 09/11] zynqmp_crf: add the clock mechanism
Date: Wed, 3 Aug 2016 09:38:24 +0200	[thread overview]
Message-ID: <056dd013-ea59-557b-3a23-cdd9ae9ca251@greensocs.com> (raw)
In-Reply-To: <CAFEAcA-vZvGbhkAgCmrBauLVrLbthyLSvC+4o4BV7ZTyd6w1Mw@mail.gmail.com>



Le 29/07/2016 à 15:51, Peter Maydell a écrit :
> On 13 June 2016 at 17:27,  <fred.konrad@greensocs.com> wrote:
>> From: KONRAD Frederic <fred.konrad@greensocs.com>
>>
>> This adds the pll to the zynqmp_crf and the dp_video clock output.
>>
>> Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
>> ---
>>  hw/misc/xilinx_zynqmp_crf.c | 440 ++++++++++++++++++++++++++++++++++++++++++++
>>  1 file changed, 440 insertions(+)
>>
>> diff --git a/hw/misc/xilinx_zynqmp_crf.c b/hw/misc/xilinx_zynqmp_crf.c
>> index 4c670a0..2097534 100644
>> --- a/hw/misc/xilinx_zynqmp_crf.c
>> +++ b/hw/misc/xilinx_zynqmp_crf.c
>> @@ -30,6 +30,7 @@
>>  #include "hw/register.h"
>>  #include "qemu/bitops.h"
>>  #include "qemu/log.h"
>> +#include "qemu/qemu-clock.h"
>>
>>  #ifndef XILINX_CRF_APB_ERR_DEBUG
>>  #define XILINX_CRF_APB_ERR_DEBUG 0
>> @@ -281,6 +282,38 @@ typedef struct CRF_APB {
>>
>>      uint32_t regs[R_MAX];
>>      RegisterInfo regs_info[R_MAX];
>> +
>> +    /* input clocks */
>> +    qemu_clk pss_ref_clk;
>> +    qemu_clk video_clk;
>> +    qemu_clk pss_alt_ref_clk;
>> +    qemu_clk aux_refclk;
>> +    qemu_clk gt_crx_ref_clk;
>> +
>> +    /* internal clocks */
>> +    qemu_clk apll_clk;
>> +    qemu_clk dpll_clk;
>> +    qemu_clk vpll_clk;
>> +
>> +    /* output clocks */
>> +    qemu_clk acpu_clk;
>> +    qemu_clk dbg_trace;
>> +    qemu_clk dbg_fdp;
>> +    qemu_clk dp_video_ref;
>> +    qemu_clk dp_audio_ref;
>> +    qemu_clk dp_stc_ref;
>> +    qemu_clk ddr;
>> +    qemu_clk gpu_ref;
>> +    qemu_clk sata_ref;
>> +    qemu_clk pcie_ref;
>> +    qemu_clk gdma_ref;
>> +    qemu_clk dpdma_ref;
>> +    qemu_clk topsw_main;
>> +    qemu_clk topsw_lsbus;
>> +    qemu_clk dbg_tstmp;
>> +    qemu_clk apll_to_lpd;
>> +    qemu_clk dpll_to_lpd;
>> +    qemu_clk vpll_to_lpd;
>>  } CRF_APB;
>
> This looks a bit weird. Why are the input clocks and the output
> clocks the same type? I was expecting that an output clock would
> be "owned" by this device (and so a qemu_clk), whereas an input
> clock would just be a reference to a clock owned by the device
> on the other end of it.
>

Hi Peter,

Yes this is a choice I had to make.
Basically there is nothing different between what we call output and 
input: They both allow to set a callback before the frequency is 
transported to the next clock in the clock tree.
And I use a name to get the clock, eg: for a simple clock divider:

       ----------------
in --o| ClockDivider |o-- out
       ----------------

will be modeled like this in terms of qemu_clock:

     freq_update_cb()
       return rate/4;
           |
           |
          \_/
     ------------                ------------
  --o| qemu_clk |o-- bindings --o| qemu_clk |o--
     |    in    |                |    out   |
     ------------                ------------

Then to bind that to a fixed clock we have in the machine model:
   qemu_clk_bind_clock(
     qemu_clk_get_pin(FixedClock, "out"),
     qemu_clk_get_pin(ClockDivider, "in"));

Thanks,
Fred

> thanks
> -- PMM
>

  reply	other threads:[~2016-08-03  7:37 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-13 16:27 [Qemu-devel] [RFC PATCH 00/11] Clock framework API fred.konrad
2016-06-13 16:27 ` [Qemu-devel] [RFC PATCH 01/11] qemu-clk: introduce qemu-clk qom object fred.konrad
2016-06-29  0:15   ` Alistair Francis
2016-06-13 16:27 ` [Qemu-devel] [RFC PATCH 02/11] qemu-clk: allow to attach a clock to a device fred.konrad
2016-06-29  0:15   ` Alistair Francis
2016-08-02  7:47     ` KONRAD Frederic
2016-08-04  0:26       ` Alistair Francis
2016-06-13 16:27 ` [Qemu-devel] [RFC PATCH 03/11] qemu-clk: allow to bound two clocks together fred.konrad
2016-06-29  0:30   ` Alistair Francis
2016-07-29 13:39   ` Peter Maydell
2016-08-02 12:29     ` KONRAD Frederic
2016-06-13 16:27 ` [Qemu-devel] [RFC PATCH 04/11] qdev-monitor: print the device's clock with info qtree fred.konrad
2016-06-29  0:33   ` Alistair Francis
2016-06-13 16:27 ` [Qemu-devel] [RFC PATCH 05/11] docs: add qemu-clock documentation fred.konrad
2016-06-29  0:38   ` Alistair Francis
2016-08-02  9:29     ` KONRAD Frederic
2016-08-04  0:28       ` Alistair Francis
2016-07-29 13:47   ` Peter Maydell
2016-06-13 16:27 ` [Qemu-devel] [RFC PATCH 06/11] introduce fixed-clock fred.konrad
2016-07-01 23:07   ` Alistair Francis
2016-08-02 11:56     ` KONRAD Frederic
2016-08-04  0:29       ` Alistair Francis
2016-06-13 16:27 ` [Qemu-devel] [RFC PATCH 07/11] introduce zynqmp_crf fred.konrad
2016-06-29  0:41   ` Alistair Francis
2016-06-13 16:27 ` [Qemu-devel] [RFC PATCH 08/11] zynqmp_crf: fix against AF_EX32 changes fred.konrad
2016-07-29 13:48   ` Peter Maydell
2016-08-02 12:34     ` KONRAD Frederic
2016-06-13 16:27 ` [Qemu-devel] [RFC PATCH 09/11] zynqmp_crf: add the clock mechanism fred.konrad
2016-07-01 23:23   ` Alistair Francis
2016-08-02 12:26     ` KONRAD Frederic
2016-07-29 13:51   ` Peter Maydell
2016-08-03  7:38     ` KONRAD Frederic [this message]
2016-06-13 16:27 ` [Qemu-devel] [RFC PATCH 10/11] zynqmp: add the zynqmp_crf to the platform fred.konrad
2016-07-01 23:11   ` Alistair Francis
2016-08-02 12:36     ` KONRAD Frederic
2016-06-13 16:27 ` [Qemu-devel] [RFC PATCH 11/11] zynqmp: add reference clock fred.konrad
2016-07-29 13:59 ` [Qemu-devel] [RFC PATCH 00/11] Clock framework API Peter Maydell
2016-08-02  6:28   ` KONRAD Frederic

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=056dd013-ea59-557b-3a23-cdd9ae9ca251@greensocs.com \
    --to=fred.konrad@greensocs.com \
    --cc=alistair.francis@xilinx.com \
    --cc=edgar.iglesias@xilinx.com \
    --cc=mark.burton@greensocs.com \
    --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).