mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 18:23:57 -06:00
hw/arm: Add GMAC devices to NPCM8XX SoC
The GMAC was originally created for the 8xx machine. During upstreaming both the GMAC and the 8XX we removed it so they would not depend on each other for the process, that connection should be added back in. Signed-off-by: Hao Wu <wuhaotsh@google.com> Signed-off-by: Nabih Estefan <nabihestefan@google.com> Message-id: 20250508220718.735415-2-nabihestefan@google.com Reviewed-by: Tyrone Ting <kfting@nuvoton.com> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
d2e9b78162
commit
638422f5bc
2 changed files with 53 additions and 6 deletions
|
@ -67,6 +67,9 @@
|
|||
/* SDHCI Modules */
|
||||
#define NPCM8XX_MMC_BA 0xf0842000
|
||||
|
||||
/* PCS Module */
|
||||
#define NPCM8XX_PCS_BA 0xf0780000
|
||||
|
||||
/* PSPI Modules */
|
||||
#define NPCM8XX_PSPI_BA 0xf0201000
|
||||
|
||||
|
@ -85,6 +88,10 @@ enum NPCM8xxInterrupt {
|
|||
NPCM8XX_ADC_IRQ = 0,
|
||||
NPCM8XX_PECI_IRQ = 6,
|
||||
NPCM8XX_KCS_HIB_IRQ = 9,
|
||||
NPCM8XX_GMAC1_IRQ = 14,
|
||||
NPCM8XX_GMAC2_IRQ,
|
||||
NPCM8XX_GMAC3_IRQ,
|
||||
NPCM8XX_GMAC4_IRQ,
|
||||
NPCM8XX_MMC_IRQ = 26,
|
||||
NPCM8XX_PSPI_IRQ = 28,
|
||||
NPCM8XX_TIMER0_IRQ = 32, /* Timer Module 0 */
|
||||
|
@ -260,6 +267,14 @@ static const hwaddr npcm8xx_smbus_addr[] = {
|
|||
0xfff0a000,
|
||||
};
|
||||
|
||||
/* Register base address for each GMAC Module */
|
||||
static const hwaddr npcm8xx_gmac_addr[] = {
|
||||
0xf0802000,
|
||||
0xf0804000,
|
||||
0xf0806000,
|
||||
0xf0808000,
|
||||
};
|
||||
|
||||
/* Register base address for each USB host EHCI registers */
|
||||
static const hwaddr npcm8xx_ehci_addr[] = {
|
||||
0xf0828100,
|
||||
|
@ -444,6 +459,11 @@ static void npcm8xx_init(Object *obj)
|
|||
object_initialize_child(obj, "mft[*]", &s->mft[i], TYPE_NPCM7XX_MFT);
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(s->gmac); i++) {
|
||||
object_initialize_child(obj, "gmac[*]", &s->gmac[i], TYPE_NPCM_GMAC);
|
||||
}
|
||||
object_initialize_child(obj, "pcs", &s->pcs, TYPE_NPCM_PCS);
|
||||
|
||||
object_initialize_child(obj, "mmc", &s->mmc, TYPE_NPCM7XX_SDHCI);
|
||||
object_initialize_child(obj, "pspi", &s->pspi, TYPE_NPCM_PSPI);
|
||||
}
|
||||
|
@ -668,6 +688,35 @@ static void npcm8xx_realize(DeviceState *dev, Error **errp)
|
|||
sysbus_connect_irq(sbd, 0, npcm8xx_irq(s, NPCM8XX_MFT0_IRQ + i));
|
||||
}
|
||||
|
||||
/*
|
||||
* GMAC Modules. Cannot fail.
|
||||
*/
|
||||
QEMU_BUILD_BUG_ON(ARRAY_SIZE(npcm8xx_gmac_addr) != ARRAY_SIZE(s->gmac));
|
||||
for (i = 0; i < ARRAY_SIZE(s->gmac); i++) {
|
||||
SysBusDevice *sbd = SYS_BUS_DEVICE(&s->gmac[i]);
|
||||
|
||||
/* This is used to make sure that the NIC can create the device */
|
||||
qemu_configure_nic_device(DEVICE(sbd), false, NULL);
|
||||
|
||||
/*
|
||||
* The device exists regardless of whether it's connected to a QEMU
|
||||
* netdev backend. So always instantiate it even if there is no
|
||||
* backend.
|
||||
*/
|
||||
sysbus_realize(sbd, &error_abort);
|
||||
sysbus_mmio_map(sbd, 0, npcm8xx_gmac_addr[i]);
|
||||
/*
|
||||
* N.B. The values for the second argument sysbus_connect_irq are
|
||||
* chosen to match the registration order in npcm7xx_emc_realize.
|
||||
*/
|
||||
sysbus_connect_irq(sbd, 0, npcm8xx_irq(s, NPCM8XX_GMAC1_IRQ + i));
|
||||
}
|
||||
/*
|
||||
* GMAC Physical Coding Sublayer(PCS) Module. Cannot fail.
|
||||
*/
|
||||
sysbus_realize(SYS_BUS_DEVICE(&s->pcs), &error_abort);
|
||||
sysbus_mmio_map(SYS_BUS_DEVICE(&s->pcs), 0, NPCM8XX_PCS_BA);
|
||||
|
||||
/*
|
||||
* Flash Interface Unit (FIU). Can fail if incorrect number of chip selects
|
||||
* specified, but this is a programming error.
|
||||
|
@ -741,12 +790,7 @@ static void npcm8xx_realize(DeviceState *dev, Error **errp)
|
|||
create_unimplemented_device("npcm8xx.ahbpci", 0xf0400000, 1 * MiB);
|
||||
create_unimplemented_device("npcm8xx.dap", 0xf0500000, 960 * KiB);
|
||||
create_unimplemented_device("npcm8xx.mcphy", 0xf05f0000, 64 * KiB);
|
||||
create_unimplemented_device("npcm8xx.pcs", 0xf0780000, 256 * KiB);
|
||||
create_unimplemented_device("npcm8xx.tsgen", 0xf07fc000, 8 * KiB);
|
||||
create_unimplemented_device("npcm8xx.gmac1", 0xf0802000, 8 * KiB);
|
||||
create_unimplemented_device("npcm8xx.gmac2", 0xf0804000, 8 * KiB);
|
||||
create_unimplemented_device("npcm8xx.gmac3", 0xf0806000, 8 * KiB);
|
||||
create_unimplemented_device("npcm8xx.gmac4", 0xf0808000, 8 * KiB);
|
||||
create_unimplemented_device("npcm8xx.copctl", 0xf080c000, 4 * KiB);
|
||||
create_unimplemented_device("npcm8xx.tipctl", 0xf080d000, 4 * KiB);
|
||||
create_unimplemented_device("npcm8xx.rst", 0xf080e000, 4 * KiB);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue