[PATCH qemu 12/12] ast2400: add a FTGMAC100 nic
Andrew Jeffery
andrew at aj.id.au
Tue Jun 7 17:26:32 AEST 2016
On Sun, 2016-05-29 at 23:20 +0200, Cédric Le Goater wrote:
> Only the first nic, but the second shouldn't be too complex to add if
> needed.
What was this patch based on? The GEM NIC is in the openbmc/qemu repo,
but this patch doesn't remove it - Was it based on upstream?
>
> Signed-off-by: Cédric Le Goater <clg at kaod.org>
Regardless, looks good to me, we can massage it to apply wherever we
need, eg. by first backing out the GEM NIC as a separate commit.
Reviewed-by: Andrew Jeffery <andrew at aj.id.au>
> ---
> hw/arm/ast2400.c | 18 ++++++++++++++++++
> include/hw/arm/ast2400.h | 2 ++
> 2 files changed, 20 insertions(+)
>
> diff --git a/hw/arm/ast2400.c b/hw/arm/ast2400.c
> index a4a7c10e4361..67ae91f5f977 100644
> --- a/hw/arm/ast2400.c
> +++ b/hw/arm/ast2400.c
> @@ -19,6 +19,7 @@
> #include "hw/char/serial.h"
> #include "hw/boards.h"
> #include "hw/i2c/aspeed_i2c.h"
> +#include "net/net.h"
>
> #define AST2400_UART_5_BASE 0x00184000
> #define AST2400_IOMEM_SIZE 0x00200000
> @@ -32,6 +33,8 @@
> #define AST2400_LPC_BASE 0x1E789000
> #define AST2400_IBT_BASE (AST2400_LPC_BASE + 0x140)
> #define AST2400_I2C_BASE 0x1E78A000
> +#define AST2400_ETH1_BASE 0x1E660000
> +#define AST2400_ETH2_BASE 0x1E680000
>
> static const int uart_irqs[] = { 9, 32, 33, 34, 10 };
> static const int timer_irqs[] = { 16, 17, 18, 35, 36, 37, 38, 39, };
> @@ -95,6 +98,10 @@ static void ast2400_init(Object *obj)
> object_initialize(&s->bt, sizeof(s->bt), TYPE_ASPEED_BT);
> object_property_add_child(obj, "bt", OBJECT(&s->bt), NULL);
> qdev_set_parent_bus(DEVICE(&s->bt), sysbus_get_default());
> +
> + object_initialize(&s->ftgmac100, sizeof(s->ftgmac100), TYPE_FTGMAC100);
> + object_property_add_child(obj, "ftgmac100", OBJECT(&s->ftgmac100), NULL);
> + qdev_set_parent_bus(DEVICE(&s->ftgmac100), sysbus_get_default());
> }
>
> static void ast2400_realize(DeviceState *dev, Error **errp)
> @@ -221,6 +228,17 @@ static void ast2400_realize(DeviceState *dev, Error **errp)
> sysbus_mmio_map(SYS_BUS_DEVICE(&s->bt), 0, AST2400_IBT_BASE);
> sysbus_connect_irq(SYS_BUS_DEVICE(&s->bt), 0,
> qdev_get_gpio_in(DEVICE(&s->vic), 10));
> +
> + /* Net */
> + qdev_set_nic_properties(DEVICE(&s->ftgmac100), &nd_table[0]);
> + object_property_set_bool(OBJECT(&s->ftgmac100), true, "realized", &err);
> + if (err) {
> + error_propagate(errp, err);
> + return;
> + }
> + sysbus_mmio_map(SYS_BUS_DEVICE(&s->ftgmac100), 0, AST2400_ETH1_BASE);
> + sysbus_connect_irq(SYS_BUS_DEVICE(&s->ftgmac100), 0,
> + qdev_get_gpio_in(DEVICE(&s->vic), 2));
> }
>
> static void ast2400_class_init(ObjectClass *oc, void *data)
> diff --git a/include/hw/arm/ast2400.h b/include/hw/arm/ast2400.h
> index 2b517e89eeea..bb221734c7b1 100644
> --- a/include/hw/arm/ast2400.h
> +++ b/include/hw/arm/ast2400.h
> @@ -19,6 +19,7 @@
> #include "hw/i2c/aspeed_i2c.h"
> #include "hw/ssi/aspeed_smc.h"
> #include "hw/misc/aspeed_bt.h"
> +#include "hw/net/ftgmac100.h"
>
> typedef struct AST2400State {
> /*< private >*/
> @@ -35,6 +36,7 @@ typedef struct AST2400State {
> AspeedSMCState smc;
> AspeedSMCState spi;
> AspeedBTState bt;
> + Ftgmac100State ftgmac100;
> } AST2400State;
>
> #define TYPE_AST2400 "ast2400"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20160607/d3a51bc3/attachment-0001.sig>
More information about the openbmc
mailing list