mirror of
https://github.com/qemu/qemu.git
synced 2025-01-19 12:03:51 +08:00
aspeed: add a FTGMAC100 nic
There is a second NIC but we do not use it for the moment. We use the 'aspeed' property to tune the definition of the end of ring buffer bit for the Aspeed SoCs. Signed-off-by: Cédric Le Goater <clg@kaod.org> Signed-off-by: Jason Wang <jasowang@redhat.com>
This commit is contained in:
parent
1335fe3eb2
commit
ea337c6549
@ -19,6 +19,7 @@
|
||||
#include "hw/char/serial.h"
|
||||
#include "qemu/log.h"
|
||||
#include "hw/i2c/aspeed_i2c.h"
|
||||
#include "net/net.h"
|
||||
|
||||
#define ASPEED_SOC_UART_5_BASE 0x00184000
|
||||
#define ASPEED_SOC_IOMEM_SIZE 0x00200000
|
||||
@ -33,6 +34,8 @@
|
||||
#define ASPEED_SOC_TIMER_BASE 0x1E782000
|
||||
#define ASPEED_SOC_WDT_BASE 0x1E785000
|
||||
#define ASPEED_SOC_I2C_BASE 0x1E78A000
|
||||
#define ASPEED_SOC_ETH1_BASE 0x1E660000
|
||||
#define ASPEED_SOC_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, };
|
||||
@ -175,6 +178,10 @@ static void aspeed_soc_init(Object *obj)
|
||||
object_initialize(&s->wdt, sizeof(s->wdt), TYPE_ASPEED_WDT);
|
||||
object_property_add_child(obj, "wdt", OBJECT(&s->wdt), NULL);
|
||||
qdev_set_parent_bus(DEVICE(&s->wdt), 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 aspeed_soc_realize(DeviceState *dev, Error **errp)
|
||||
@ -299,6 +306,20 @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)
|
||||
return;
|
||||
}
|
||||
sysbus_mmio_map(SYS_BUS_DEVICE(&s->wdt), 0, ASPEED_SOC_WDT_BASE);
|
||||
|
||||
/* Net */
|
||||
qdev_set_nic_properties(DEVICE(&s->ftgmac100), &nd_table[0]);
|
||||
object_property_set_bool(OBJECT(&s->ftgmac100), true, "aspeed", &err);
|
||||
object_property_set_bool(OBJECT(&s->ftgmac100), true, "realized",
|
||||
&local_err);
|
||||
error_propagate(&err, local_err);
|
||||
if (err) {
|
||||
error_propagate(errp, err);
|
||||
return;
|
||||
}
|
||||
sysbus_mmio_map(SYS_BUS_DEVICE(&s->ftgmac100), 0, ASPEED_SOC_ETH1_BASE);
|
||||
sysbus_connect_irq(SYS_BUS_DEVICE(&s->ftgmac100), 0,
|
||||
qdev_get_gpio_in(DEVICE(&s->vic), 2));
|
||||
}
|
||||
|
||||
static void aspeed_soc_class_init(ObjectClass *oc, void *data)
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "hw/i2c/aspeed_i2c.h"
|
||||
#include "hw/ssi/aspeed_smc.h"
|
||||
#include "hw/watchdog/wdt_aspeed.h"
|
||||
#include "hw/net/ftgmac100.h"
|
||||
|
||||
#define ASPEED_SPIS_NUM 2
|
||||
|
||||
@ -39,6 +40,7 @@ typedef struct AspeedSoCState {
|
||||
AspeedSMCState spi[ASPEED_SPIS_NUM];
|
||||
AspeedSDMCState sdmc;
|
||||
AspeedWDTState wdt;
|
||||
FTGMAC100State ftgmac100;
|
||||
} AspeedSoCState;
|
||||
|
||||
#define TYPE_ASPEED_SOC "aspeed-soc"
|
||||
|
Loading…
Reference in New Issue
Block a user