From: Guenter Roeck <linux@roeck-us.net>
To: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
Cc: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
Peter Crosthwaite <peter.crosthwaite@xilinx.com>,
alistair.francis@xilinx.com, qemu-devel@nongnu.org,
Peter Maydell <peter.maydell@linaro.org>
Subject: Re: [Qemu-devel] [PATCH] hw/misc: Add support for ADC controller in Xilinx Zynq 7000
Date: Wed, 09 Sep 2015 06:51:09 -0700 [thread overview]
Message-ID: <55F0394D.8030907@roeck-us.net> (raw)
In-Reply-To: <20150908183901.GJ12618@toto>
Hi Edgar,
On 09/08/2015 11:39 AM, Edgar E. Iglesias wrote:
> On Wed, Aug 12, 2015 at 02:33:47PM -0700, Guenter Roeck wrote:
>> Add support for the Xilinx XADC core used in Zynq 7000.
>>
>> References:
>> - Zynq-7000 All Programmable SoC Technical Reference Manual
>> - 7 Series FPGAs and Zynq-7000 All Programmable SoC XADC
>> Dual 12-Bit 1 MSPS Analog-to-Digital Converter
>>
>> Tested with Linux using qemu machine xilinx-zynq-a9 with devicetree
>> files zynq-zc702.dtb and zynq-zc706.dtb, and kernel configuration
>> multi_v7_defconfig.
>
>
> Adding Alistair to CC.
> A few comments inline.
>
>
>>
>> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
>> ---
>> hw/arm/xilinx_zynq.c | 5 +
>> hw/misc/Makefile.objs | 1 +
>> hw/misc/zynq_xadc.c | 305 ++++++++++++++++++++++++++++++++++++++++++++++++++
>> 3 files changed, 311 insertions(+)
>> create mode 100644 hw/misc/zynq_xadc.c
>>
[ ... ]
>> +
>> +static void zynq_xadc_reset(DeviceState *d)
>> +{
>> + _zynq_xadc_reset(ZYNQ_XADC(d));
>
> Historically we've tried to avoid symbolnames starting with _.
> You could rename or maybe stick to one reset func?
>
Turns out using one function was easy, after figuring out how to use
the available macros.
>> +
>> + switch (reg) {
>> + case CFG:
>> + s->regs[CFG] = val;
>> + break;
>> + case INTSTS:
>> + s->regs[INTSTS] &= ~val;
>> + zynq_xadc_update_ints(s);
>> + break;
>> + case INTMSK:
>> + s->regs[INTMSK] = val & 0x003ff;
>> + zynq_xadc_update_ints(s);
>> + break;
>> + case CFIFO:
>> + xadc_reg = (val >> 16) & 0x007f;
>> + xadc_cmd = (val >> 26) & 0x0f;
>> + xadc_data = val & 0xffff;
>
> We have extract* functions to make these field extractions a bit more
> readable. For example see extract32 in include/qemu/bitops.h.
>
Done, thanks for the hint.
Should I wait for more feedback or resubmit ?
Thanks,
Guenter
next prev parent reply other threads:[~2015-09-09 13:51 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-12 21:33 [Qemu-devel] [PATCH] hw/misc: Add support for ADC controller in Xilinx Zynq 7000 Guenter Roeck
2015-09-08 18:39 ` Edgar E. Iglesias
2015-09-09 13:51 ` Guenter Roeck [this message]
2015-09-09 20:46 ` 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=55F0394D.8030907@roeck-us.net \
--to=linux@roeck-us.net \
--cc=alistair.francis@xilinx.com \
--cc=edgar.iglesias@gmail.com \
--cc=edgar.iglesias@xilinx.com \
--cc=peter.crosthwaite@xilinx.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).