Received: from eggs.gnu.org ([2001:4830:134:3::10]:52414) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZYhLG-0004Nh-Dy for qemu-devel@nongnu.org; Sun, 06 Sep 2015 17:19:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZYhLD-0006qs-2s for qemu-devel@nongnu.org; Sun, 06 Sep 2015 17:19:14 -0400 Received: from zose-mta03.web4all.fr ([185.49.20.44]:42083) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZYhLC-0006qN-QZ for qemu-devel@nongnu.org; Sun, 06 Sep 2015 17:19:11 -0400 References: <55EC37C3.7020204@tribudubois.net> From: Jean-Christophe DUBOIS Message-ID: <55ECADC8.5050606@tribudubois.net> Date: Sun, 6 Sep 2015 23:19:04 +0200 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v1 1/3] i.MX: Add GPIO device List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Crosthwaite Cc: "qemu-devel@nongnu.org Developers" Le 06/09/2015 20:23, Peter Crosthwaite a =C3=A9crit : > On Sun, Sep 6, 2015 at 5:55 AM, Jean-Christophe DUBOIS > wrote: >> Le 05/09/2015 11:03, Peter Crosthwaite a =C3=A9crit : >>> On Sat, Sep 5, 2015 at 1:17 AM, Jean-Christophe Dubois >>> wrote: >>>> Signed-off-by: Jean-Christophe Dubois >>>> --- >>>> hw/gpio/Makefile.objs | 1 + >>>> hw/gpio/imx_gpio.c | 358 >>>> +++++++++++++++++++++++++++++++++++++++++++++ >>>> include/hw/gpio/imx_gpio.h | 60 ++++++++ >>>> 3 files changed, 419 insertions(+) >>>> create mode 100644 hw/gpio/imx_gpio.c >>>> create mode 100644 include/hw/gpio/imx_gpio.h >>>> >>>> diff --git a/hw/gpio/Makefile.objs b/hw/gpio/Makefile.objs >>>> index 1abcf17..52233f7 100644 >>>> --- a/hw/gpio/Makefile.objs >>>> +++ b/hw/gpio/Makefile.objs >>>> @@ -5,3 +5,4 @@ common-obj-$(CONFIG_ZAURUS) +=3D zaurus.o >>>> common-obj-$(CONFIG_E500) +=3D mpc8xxx.o >>>> >>>> obj-$(CONFIG_OMAP) +=3D omap_gpio.o >>>> +obj-$(CONFIG_IMX) +=3D imx_gpio.o >>>> diff --git a/hw/gpio/imx_gpio.c b/hw/gpio/imx_gpio.c >>>> new file mode 100644 >>>> index 0000000..8ec1d4c >>>> --- /dev/null >>>> +++ b/hw/gpio/imx_gpio.c >>>> @@ -0,0 +1,358 @@ >>>> +/* >>>> + * i.MX processors GPIO emulation. >>>> + * >>>> + * Copyright (C) 2015 Jean-Christophe Dubois >>>> + * >>>> + * 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. >>>> + * >>>> + * 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 Licens= e >>>> along >>>> + * with this program; if not, see . >>>> + */ >>>> + >>>> +#include "hw/gpio/imx_gpio.h" >>>> + >>>> +#ifndef IMX_GPIO_DEBUG >>>> +#define IMX_GPIO_DEBUG 0 >>>> +#endif >>>> + >>>> +#if IMX_GPIO_DEBUG >>>> +# define DPRINTF(fmt, args...) \ >>>> + do { fprintf(stder, "%s: " fmt , __func__, ##args); } whi= le >>>> (0) >>>> + >>> Use a regular if for debug conditional. This is so the debug code is >>> always compiled. >> Not sure what you mean here ... Most files in qemu have DEBUG function= s >> compiled out in the normal case ... >> > We are trying to slowly change that. > >> Is there a change in "politic" on this topic? >> > No this has been the policy for a while now. > >> Could you point to an implementation doing things right? >> > hw/dma/pl330.c Not sure, I understand. It is still compiled out as PL330_ERR_DEBUG is 0=20 in the "normal" case. JC > > Regards, > Peter > >>>> +static char const *imx_gpio_reg_name(uint32_t reg) >>>> +{ >>>> + switch (reg) { >>>> + case DR_ADDR: >>>> + return "DR"; >>>> + case GDIR_ADDR: