[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 32/44] Enable BCM2838 GENET controller
From: |
Sergey Kambalin |
Subject: |
[PATCH 32/44] Enable BCM2838 GENET controller |
Date: |
Wed, 26 Jul 2023 16:25:00 +0300 |
Signed-off-by: Sergey Kambalin <sergey.kambalin@auriga.com>
---
hw/arm/bcm2838_peripherals.c | 16 ++++++++++++++++
hw/arm/raspi4b.c | 17 -----------------
include/hw/arm/bcm2838_peripherals.h | 2 ++
3 files changed, 18 insertions(+), 17 deletions(-)
diff --git a/hw/arm/bcm2838_peripherals.c b/hw/arm/bcm2838_peripherals.c
index 60ed535673..e4ad8927fc 100644
--- a/hw/arm/bcm2838_peripherals.c
+++ b/hw/arm/bcm2838_peripherals.c
@@ -47,6 +47,15 @@ static void bcm2838_peripherals_init(Object *obj)
object_initialize_child(obj, "pcie-host", &s->pcie_host,
TYPE_BCM2838_PCIE_HOST);
+ /* Gigabit Ethernet */
+ object_initialize_child(obj, "genet", &s->genet, TYPE_BCM2838_GENET);
+ for (int i = 0; i < nb_nics; i++) {
+ if ((nd_table[i].used && nd_table[i].model) &&
!strcmp(nd_table[i].model, "bcmgenet")) {
+ qdev_set_nic_properties(DEVICE(&s->genet), &nd_table[i]);
+ break;
+ }
+ }
+
/* Extended Mass Media Controller 2 */
object_initialize_child(obj, "emmc2", &s->emmc2, TYPE_SYSBUS_SDHCI);
@@ -227,6 +236,13 @@ static void bcm2838_peripherals_realize(DeviceState *dev,
Error **errp)
memory_region_add_subregion(get_system_memory(), PCIE_MMIO_ARM_OFFSET,
&s->pcie_mmio_alias);
+ /* Gigabit Ethernet */
+ if (!sysbus_realize(SYS_BUS_DEVICE(&s->genet), errp)) {
+ return;
+ }
+ regs_mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->genet), 0);
+ memory_region_add_subregion(&s->peri_low_mr, GENET_OFFSET, regs_mr);
+
create_unimp(s_base, &s->clkisp, "bcm2835-clkisp", CLOCK_ISP_OFFSET,
CLOCK_ISP_SIZE);
diff --git a/hw/arm/raspi4b.c b/hw/arm/raspi4b.c
index c7fdf791d5..9a35e939f6 100644
--- a/hw/arm/raspi4b.c
+++ b/hw/arm/raspi4b.c
@@ -63,23 +63,6 @@ static int raspi_add_memory_node(void *fdt, hwaddr mem_base,
hwaddr mem_len)
static void raspi4_modify_dtb(const struct arm_boot_info *info, void *fdt)
{
-
- /* Temporary disable following devices until they are implemented*/
- const char *to_be_removed_from_dt_as_wa[] = {
- "brcm,bcm2711-genet-v5",
- };
-
- for (int i = 0; i < ARRAY_SIZE(to_be_removed_from_dt_as_wa); i++) {
- const char *dev_str = to_be_removed_from_dt_as_wa[i];
-
- int offset = fdt_node_offset_by_compatible(fdt, -1, dev_str);
- if (offset >= 0) {
- if (!fdt_nop_node(fdt, offset)) {
- warn_report("bcm2711 dtc: %s has been disabled!", dev_str);
- }
- }
- }
-
uint64_t ram_size = board_ram_size(info->board_id);
if (ram_size > UPPER_RAM_BASE) {
diff --git a/include/hw/arm/bcm2838_peripherals.h
b/include/hw/arm/bcm2838_peripherals.h
index be4fc20f11..2cd405efc8 100644
--- a/include/hw/arm/bcm2838_peripherals.h
+++ b/include/hw/arm/bcm2838_peripherals.h
@@ -13,6 +13,7 @@
#include "hw/misc/bcm2838_rng200.h"
#include "hw/misc/bcm2838_thermal.h"
#include "hw/arm/bcm2838_pcie.h"
+#include "hw/net/bcm2838_genet.h"
#include "hw/sd/sdhci.h"
#include "hw/gpio/bcm2838_gpio.h"
@@ -75,6 +76,7 @@ struct BCM2838PeripheralState {
UnimplementedDeviceState clkisp;
BCM2838PcieHostState pcie_host;
BCM2838GpioState gpio;
+ BCM2838GenetState genet;
OrIRQState mmc_irq_orgate;
OrIRQState dma_7_8_irq_orgate;
--
2.34.1
- [PATCH 21/44] Add clock_isp stub, (continued)
- [PATCH 21/44] Add clock_isp stub, Sergey Kambalin, 2023/07/26
- [PATCH 24/44] Add GENET register structs. Part 2, Sergey Kambalin, 2023/07/26
- [PATCH 09/44] Add GPIO and SD to BCM2838 periph, Sergey Kambalin, 2023/07/26
- [PATCH 11/44] Introduce Raspberry PI 4 machine, Sergey Kambalin, 2023/07/26
- [PATCH 29/44] Impl GENET MDIO, Sergey Kambalin, 2023/07/26
- [PATCH 35/44] Add mailbox test stub, Sergey Kambalin, 2023/07/26
- [PATCH 38/44] Add mailbox tests tags. Part 2, Sergey Kambalin, 2023/07/26
- [PATCH 26/44] Add GENET register structs. Part 4, Sergey Kambalin, 2023/07/26
- [PATCH 19/44] Add RNG200 timer, Sergey Kambalin, 2023/07/26
- [PATCH 28/44] Impl GENET register ops., Sergey Kambalin, 2023/07/26
- [PATCH 32/44] Enable BCM2838 GENET controller,
Sergey Kambalin <=
- [PATCH 31/44] Impl GENET RX path, Sergey Kambalin, 2023/07/26
- [PATCH 33/44] Connect RNG200, PCIE and GENET to GIC, Sergey Kambalin, 2023/07/26
- [PATCH 37/44] Add mailbox tests tags. Part 1, Sergey Kambalin, 2023/07/26
- [PATCH 36/44] Add mailbox test constants, Sergey Kambalin, 2023/07/26
- [PATCH 39/44] Add mailbox tests tags. Part 3, Sergey Kambalin, 2023/07/26
- [PATCH 40/44] Add mailbox property tests. Part 1, Sergey Kambalin, 2023/07/26
- [PATCH 41/44] Add mailbox property tests. Part 2, Sergey Kambalin, 2023/07/26
- [PATCH 42/44] Add mailbox property tests. Part 3, Sergey Kambalin, 2023/07/26
- [PATCH 43/44] Add missed BCM2835 properties, Sergey Kambalin, 2023/07/26
- [PATCH 17/44] Add RNG200 skeleton, Sergey Kambalin, 2023/07/26