[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] hw/misc: Add code to emulate PFUZE3000 PMIC
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [PATCH] hw/misc: Add code to emulate PFUZE3000 PMIC |
Date: |
Fri, 15 Dec 2017 14:56:54 +0000 |
On 14 December 2017 at 15:19, Andrey Smirnov <address@hidden> wrote:
> Add trivial code to emulate PFUZE3000 PMIC.
>
> Cc: address@hidden
> Cc: address@hidden
> Cc: address@hidden
> Cc: Peter Maydell <address@hidden>
> Signed-off-by: Andrey Smirnov <address@hidden>
> ---
>
> Integrating this into a build system via "obj-y" might not be the best
> way. Does this code need a dedicated CONFIG_ symbol?
Yes, it ought to have a CONFIG_something symbol and be enabled
via the whatever.mak for whatever guest architecture needs this
device.
Is there a board which needs this device? We usually
only add devices together with whatever's using them.
> diff --git a/hw/misc/pfuze3000.c b/hw/misc/pfuze3000.c
> new file mode 100644
> index 0000000000..f414b7c0ba
> --- /dev/null
> +++ b/hw/misc/pfuze3000.c
> @@ -0,0 +1,212 @@
> +/*
> + *
> + * Copyright (c) 2017, Impinj, Inc.
> + *
> + * Author: Andrey Smirnov <address@hidden>
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License as
> + * published by the Free Software Foundation; either version 2 or
> + * (at your option) version 3 of the License.
The .h file is "v2 or later", but the .c file is "v2 or v3".
Is that an intentional difference? Generally we go with "v2 or later".
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License along
> + * with this program; if not, see <http://www.gnu.org/licenses/>.
> + */
> +static void pfuze3000_reset(DeviceState *ds)
> +{
> + PFuze3000State *s = PFUZE3000(ds);
> +
> + s->reg = PFUZE100_INVAL;
This function needs to reset all the device state
(all the fields that the guest can modify).
Code looks OK otherwise.
thanks
-- PMM