From nobody Thu Nov 14 17:42:33 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1708305822; cv=none; d=zohomail.com; s=zohoarc; b=k8/Td4fT7ONgnOpIqtzoZE+7y1Lbul8o2duoroPtLzlFJmNfnoxnaQpDz/cNtX1skBkF+Bn2afqm9t7Gx9c/fSJDtxnl4FO35AE/Irp8ak6c5VeULLojN0BupX+EBJx+cHSv1LLFLdWzGnmJ5YQyM8NO0uL9hDhu3huWrOA6Eow= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1708305822; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=2gsvHLNCQvfkug1zf5NVRuusgRVHYQRRLVgJPLo1W0k=; b=Mtm4P7mAoNQTl/twc0Hit5t7wcFnBOySb6h9qIC5AGjfwqfC5Wfxo2DZnDFeZEgL7wX+8WCLifC95CNRo3zjAkrT4+buv/e0L9/k/iHiCNF+InKk9VNaKLZN1782mdVH9Zyvp411+IOE/XyKMxE+WmLbCmN4bCx8vO6WM2z2s9o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1708305822563412.0942752310701; Sun, 18 Feb 2024 17:23:42 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rbsJM-0004lM-Hf; Sun, 18 Feb 2024 20:19:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rbsIe-0003YE-LP; Sun, 18 Feb 2024 20:18:29 -0500 Received: from mail-yb1-xb32.google.com ([2607:f8b0:4864:20::b32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rbsIY-0004Jo-5Z; Sun, 18 Feb 2024 20:18:24 -0500 Received: by mail-yb1-xb32.google.com with SMTP id 3f1490d57ef6-dc236729a2bso3617543276.0; Sun, 18 Feb 2024 17:18:19 -0800 (PST) Received: from localhost.localdomain ([201.203.117.224]) by smtp.gmail.com with ESMTPSA id m12-20020a819e0c000000b00607ff905ed3sm1204704ywj.58.2024.02.18.17.18.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 17:18:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708305498; x=1708910298; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2gsvHLNCQvfkug1zf5NVRuusgRVHYQRRLVgJPLo1W0k=; b=iim3kFfx5nT8SUYRhQFXL5ReBZkUEk4R9MQdnooU2mAeJZaQHqmkTyGKtES9ClldNx A+UpOKSTjz3m+VuOw/qECxELRat+VvICEKnw4/HrGFvQKXakyPhlXJXZW5WL9v749qZb lDMjwmPMeZPWk/sag8Glc01F61nBKRjW/d7krN3UICDkNTS0uibFWQ7xmaz+omlhywod zctI3F/vH7s2bfeCSOPt9F62MxA95IXS8YRCH2mnGLFTZGrexyhE/Aawn0aHKvnVHg0S YTeAS/Eo5ct5ES0SYzm3e+VrsKdCrlE4cHKI+y/o9uadKxXur2vhY+8BFjqvAuMpMl94 qthw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708305498; x=1708910298; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2gsvHLNCQvfkug1zf5NVRuusgRVHYQRRLVgJPLo1W0k=; b=iinD8MYHAE0+f0/rjgj2sXtyHjgmmuBMm49Rpxf4m4JradfoGtxUUMe00wkjNN6SFU qkFX1QVM478WygC0RNfqYd92zhfcdAg+JyMNwJMH4jDkjRSy+vVMxcGTakWGyuDnAOoa u36PUNF/AQhFsyNBOzY0m0ycCCkXaus1FZkKH2+XNWONgRLZMw+8JUcOfcdAejqggapw edh9I9hMXV3fJU3iSRyllJYhNEUiAARcjcdMfSxPALhPgDELp4MmhKFFFYySWUarveKu B1ku93BoAwL27q3iire/dHp2pK/lTQMEPF1IIyauhqk7d1ew9nnPASmOa+RmDaNOESCA YutQ== X-Gm-Message-State: AOJu0YwfR1wZEMru7YAwwmbnj/tLLUMGrzy2LqydjOLNGiOU7jNNV54g iZsivY3CCQuN4rfECffRVUo6JU515QVk/sDp60rqeMV95NAMGXe22KHEu9nB6yU= X-Google-Smtp-Source: AGHT+IFvgoPDxsSVwXIHt5tNJv1oIoSPwuhL8RPMbbNS75Ly5EwZEp83ZIYjXq2DXUi296dljb5baQ== X-Received: by 2002:a0d:d911:0:b0:607:d047:985e with SMTP id b17-20020a0dd911000000b00607d047985emr12301538ywe.40.1708305498521; Sun, 18 Feb 2024 17:18:18 -0800 (PST) From: Sergey Kambalin X-Google-Original-From: Sergey Kambalin To: qemu-arm@nongnu.org Cc: qemu-devel@nongnu.org, Sergey Kambalin Subject: [PATCH v5 29/41] Enable BCM2838 GENET controller Date: Sun, 18 Feb 2024 19:17:27 -0600 Message-Id: <20240219011739.2316619-30-sergey.kambalin@auriga.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240219011739.2316619-1-sergey.kambalin@auriga.com> References: <20240219011739.2316619-1-sergey.kambalin@auriga.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::b32; envelope-from=serg.oker@gmail.com; helo=mail-yb1-xb32.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1708305823324100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Sergey Kambalin --- hw/arm/bcm2838.c | 6 ++++++ hw/arm/bcm2838_peripherals.c | 11 +++++++++++ hw/arm/raspi4b.c | 20 +------------------- include/hw/arm/bcm2838_peripherals.h | 2 ++ 4 files changed, 20 insertions(+), 19 deletions(-) diff --git a/hw/arm/bcm2838.c b/hw/arm/bcm2838.c index c330322bd5..a873162f09 100644 --- a/hw/arm/bcm2838.c +++ b/hw/arm/bcm2838.c @@ -239,6 +239,12 @@ static void bcm2838_realize(DeviceState *dev, Error **= errp) int_n); } =20 + /* Connect Gigabit Ethernet controller to the interrupt controller */ + sysbus_connect_irq(SYS_BUS_DEVICE(&ps->genet), 0, + qdev_get_gpio_in(gicdev, GIC_SPI_INTERRUPT_GENET_A)= ); + sysbus_connect_irq(SYS_BUS_DEVICE(&ps->genet), 1, + qdev_get_gpio_in(gicdev, GIC_SPI_INTERRUPT_GENET_B)= ); + /* Pass through inbound GPIO lines to the GIC */ qdev_init_gpio_in(dev, bcm2838_gic_set_irq, GIC_NUM_IRQS); =20 diff --git a/hw/arm/bcm2838_peripherals.c b/hw/arm/bcm2838_peripherals.c index 35366386ca..d3e2ea7b09 100644 --- a/hw/arm/bcm2838_peripherals.c +++ b/hw/arm/bcm2838_peripherals.c @@ -47,6 +47,10 @@ static void bcm2838_peripherals_init(Object *obj) object_initialize_child(obj, "pcie-host", &s->pcie_host, TYPE_BCM2838_PCIE_HOST); =20 + /* Gigabit Ethernet */ + object_initialize_child(obj, "genet", &s->genet, TYPE_BCM2838_GENET); + qemu_configure_nic_device(DEVICE(&s->genet), true, NULL); + /* Extended Mass Media Controller 2 */ object_initialize_child(obj, "emmc2", &s->emmc2, TYPE_SYSBUS_SDHCI); =20 @@ -231,6 +235,13 @@ static void bcm2838_peripherals_realize(DeviceState *d= ev, Error **errp) memory_region_add_subregion(get_system_memory(), PCIE_MMIO_ARM_OFFSET, mmio_mr); =20 + /* Gigabit Ethernet */ + if (!sysbus_realize(SYS_BUS_DEVICE(&s->genet), errp)) { + return; + } + regs_mr =3D 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); =20 diff --git a/hw/arm/raspi4b.c b/hw/arm/raspi4b.c index 175fd2c4fa..d498bc6215 100644 --- a/hw/arm/raspi4b.c +++ b/hw/arm/raspi4b.c @@ -63,25 +63,7 @@ static int raspi_add_memory_node(void *fdt, hwaddr mem_b= ase, hwaddr mem_len) =20 static void raspi4_modify_dtb(const struct arm_boot_info *info, void *fdt) { - uint64_t ram_size; - - /* Temporarily disable following devices until they are implemented */ - const char *nodes_to_remove[] =3D { - "brcm,bcm2711-genet-v5", - }; - - for (int i =3D 0; i < ARRAY_SIZE(nodes_to_remove); i++) { - const char *dev_str =3D nodes_to_remove[i]; - - int offset =3D fdt_node_offset_by_compatible(fdt, -1, dev_str); - if (offset >=3D 0) { - if (!fdt_nop_node(fdt, offset)) { - warn_report("bcm2711 dtc: %s has been disabled!", dev_str); - } - } - } - - ram_size =3D board_ram_size(info->board_id); + uint64_t ram_size =3D board_ram_size(info->board_id); =20 if (info->ram_size > UPPER_RAM_BASE) { raspi_add_memory_node(fdt, UPPER_RAM_BASE, ram_size - UPPER_RAM_BA= SE); diff --git a/include/hw/arm/bcm2838_peripherals.h b/include/hw/arm/bcm2838_= peripherals.h index 555d3a393f..5588b99098 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" =20 @@ -73,6 +74,7 @@ struct BCM2838PeripheralState { SDHCIState emmc2; BCM2838PcieHostState pcie_host; BCM2838GpioState gpio; + BCM2838GenetState genet; =20 OrIRQState mmc_irq_orgate; OrIRQState dma_7_8_irq_orgate; --=20 2.34.1