From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
To: Beniamino Galvani <b.galvani@gmail.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
"qemu-devel@nongnu.org Developers" <qemu-devel@nongnu.org>,
Li Guang <lig.fnst@cn.fujitsu.com>
Subject: Re: [Qemu-devel] [PATCH 2/2] hw/arm/allwinner-a10: initialize EMAC
Date: Thu, 2 Jan 2014 20:20:12 +1000 [thread overview]
Message-ID: <CAEgOgz74KfTTZaJe0qSDni+Z2VMPdW0knvDaL5E61KuqK2z8VA@mail.gmail.com> (raw)
In-Reply-To: <1388654332-10303-3-git-send-email-b.galvani@gmail.com>
On Thu, Jan 2, 2014 at 7:18 PM, Beniamino Galvani <b.galvani@gmail.com> wrote:
> Signed-off-by: Beniamino Galvani <b.galvani@gmail.com>
> ---
> hw/arm/allwinner-a10.c | 20 ++++++++++++++++++++
> include/hw/arm/allwinner-a10.h | 4 ++++
> 2 files changed, 24 insertions(+)
>
> diff --git a/hw/arm/allwinner-a10.c b/hw/arm/allwinner-a10.c
> index 4658e19..155e026 100644
> --- a/hw/arm/allwinner-a10.c
> +++ b/hw/arm/allwinner-a10.c
> @@ -22,6 +22,7 @@
> static void aw_a10_init(Object *obj)
> {
> AwA10State *s = AW_A10(obj);
> + DeviceState *dev;
For consistency with surrounding code, you could just cast to DEVICE
include and drop the new local var.
>
> object_initialize(&s->cpu, sizeof(s->cpu), "cortex-a8-" TYPE_ARM_CPU);
> object_property_add_child(obj, "cpu", OBJECT(&s->cpu), NULL);
> @@ -31,6 +32,14 @@ static void aw_a10_init(Object *obj)
>
> object_initialize(&s->timer, sizeof(s->timer), TYPE_AW_A10_PIT);
> qdev_set_parent_bus(DEVICE(&s->timer), sysbus_get_default());
> +
> + if (nd_table[0].used) {
So with SoC MACs, they are "always there". I think this conditional
should be removed, and the MAC is always instantiated. ...
> + qemu_check_nic_model(&nd_table[0], "allwinner_emac");
> + object_initialize(&s->emac, sizeof(s->emac), TYPE_AW_EMAC);
> + dev = DEVICE(&s->emac);
> + qdev_set_nic_properties(dev, &nd_table[0]);
... and then only this is conditional on nd_table.used. The mac model
itself then of course needs to be hardened against a null netargs.
> + qdev_set_parent_bus(dev, sysbus_get_default());
> + }
> }
>
> static void aw_a10_realize(DeviceState *dev, Error **errp)
> @@ -76,6 +85,17 @@ static void aw_a10_realize(DeviceState *dev, Error **errp)
> sysbus_connect_irq(sysbusdev, 4, s->irq[67]);
> sysbus_connect_irq(sysbusdev, 5, s->irq[68]);
>
> + if (nd_table[0].used) {
> + object_property_set_bool(OBJECT(&s->emac), true, "realized", &err);
> + if (err != NULL) {
> + error_propagate(errp, err);
> + return;
> + }
> + sysbusdev = SYS_BUS_DEVICE(&s->emac);
> + sysbus_mmio_map(sysbusdev, 0, AW_A10_EMAC_BASE);
> + sysbus_connect_irq(sysbusdev, 0, s->irq[55]);
> + }
> +
> serial_mm_init(get_system_memory(), AW_A10_UART0_REG_BASE, 2, s->irq[1],
> 115200, serial_hds[0], DEVICE_NATIVE_ENDIAN);
> }
> diff --git a/include/hw/arm/allwinner-a10.h b/include/hw/arm/allwinner-a10.h
> index da36647..6ea5988 100644
> --- a/include/hw/arm/allwinner-a10.h
> +++ b/include/hw/arm/allwinner-a10.h
> @@ -6,6 +6,7 @@
> #include "hw/arm/arm.h"
> #include "hw/timer/allwinner-a10-pit.h"
> #include "hw/intc/allwinner-a10-pic.h"
> +#include "hw/net/allwinner_emac.h"
>
> #include "sysemu/sysemu.h"
> #include "exec/address-spaces.h"
> @@ -14,9 +15,11 @@
> #define AW_A10_PIC_REG_BASE 0x01c20400
> #define AW_A10_PIT_REG_BASE 0x01c20c00
> #define AW_A10_UART0_REG_BASE 0x01c28000
> +#define AW_A10_EMAC_BASE 0x01c0b000
>
> #define AW_A10_SDRAM_BASE 0x40000000
>
> +
This whitespace change intended?
Regards,
Peter
> #define TYPE_AW_A10 "allwinner-a10"
> #define AW_A10(obj) OBJECT_CHECK(AwA10State, (obj), TYPE_AW_A10)
>
> @@ -29,6 +32,7 @@ typedef struct AwA10State {
> qemu_irq irq[AW_A10_PIC_INT_NR];
> AwA10PITState timer;
> AwA10PICState intc;
> + AwEmacState emac;
> } AwA10State;
>
> #define ALLWINNER_H_
> --
> 1.7.10.4
>
>
next prev parent reply other threads:[~2014-01-02 10:20 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-02 9:18 [Qemu-devel] [PATCH 0/2] hw/arm: add ethernet support to Allwinner A10 Beniamino Galvani
2014-01-02 9:18 ` [Qemu-devel] [PATCH 1/2] hw/net: add support for Allwinner EMAC Fast Ethernet controller Beniamino Galvani
2014-01-02 10:25 ` Peter Crosthwaite
2014-01-02 14:58 ` Beniamino Galvani
2014-01-03 1:26 ` Peter Crosthwaite
2014-01-03 17:42 ` Beniamino Galvani
2014-01-06 3:27 ` Stefan Hajnoczi
2014-01-06 3:46 ` Peter Crosthwaite
2014-01-06 6:12 ` Stefan Hajnoczi
2014-01-10 21:48 ` Beniamino Galvani
2014-01-10 22:16 ` Peter Crosthwaite
2014-01-10 22:48 ` Peter Crosthwaite
2014-01-12 13:59 ` Edgar E. Iglesias
2014-01-12 22:00 ` Peter Crosthwaite
2014-01-13 4:00 ` Stefan Hajnoczi
2014-01-04 0:56 ` Peter Crosthwaite
2014-01-04 9:36 ` Beniamino Galvani
2014-01-02 9:18 ` [Qemu-devel] [PATCH 2/2] hw/arm/allwinner-a10: initialize EMAC Beniamino Galvani
2014-01-02 10:20 ` Peter Crosthwaite [this message]
2014-01-02 10:21 ` Peter Crosthwaite
2014-01-02 17:19 ` Beniamino Galvani
2014-01-02 22:32 ` Peter Crosthwaite
2014-01-06 0:49 ` Li Guang
2014-01-06 13:56 ` Beniamino Galvani
2014-01-08 7:27 ` Li Guang
2014-01-08 8:14 ` 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=CAEgOgz74KfTTZaJe0qSDni+Z2VMPdW0knvDaL5E61KuqK2z8VA@mail.gmail.com \
--to=peter.crosthwaite@xilinx.com \
--cc=b.galvani@gmail.com \
--cc=lig.fnst@cn.fujitsu.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).