From nobody Tue Apr 15 23:47:36 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1500295615580230.61799105691523; Mon, 17 Jul 2017 05:46:55 -0700 (PDT) Received: from localhost ([::1]:50169 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dX5QM-0000fH-7L for importer@patchew.org; Mon, 17 Jul 2017 08:46:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59036) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dX5Ob-0007qm-EA for qemu-devel@nongnu.org; Mon, 17 Jul 2017 08:45:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dX5Oa-0002D9-JA for qemu-devel@nongnu.org; Mon, 17 Jul 2017 08:45:05 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:37640) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dX5Oa-0002Ci-BV for qemu-devel@nongnu.org; Mon, 17 Jul 2017 08:45:04 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.84_2) (envelope-from ) id 1dX5OZ-0003XV-Ee for qemu-devel@nongnu.org; Mon, 17 Jul 2017 13:45:03 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Mon, 17 Jul 2017 13:44:53 +0100 Message-Id: <1500295494-8991-18-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1500295494-8991-1-git-send-email-peter.maydell@linaro.org> References: <1500295494-8991-1-git-send-email-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PULL 17/18] hw/arm/mps2: Add ethernet X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 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" X-ZohoMail: RSF_0 Z_629925259 SPT_0 The MPS2 FPGA images support ethernet via a LAN9220. We use QEMU's LAN9118 model, which is software compatible except that it is missing the checksum-offload feature. Signed-off-by: Peter Maydell Message-id: 1500029487-14822-9-git-send-email-peter.maydell@linaro.org Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/arm/mps2.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/hw/arm/mps2.c b/hw/arm/mps2.c index 80ee79e..f727b43 100644 --- a/hw/arm/mps2.c +++ b/hw/arm/mps2.c @@ -35,6 +35,8 @@ #include "hw/char/cmsdk-apb-uart.h" #include "hw/timer/cmsdk-apb-timer.h" #include "hw/misc/mps2-scc.h" +#include "hw/devices.h" +#include "net/net.h" =20 typedef enum MPS2FPGAType { FPGA_AN385, @@ -209,7 +211,6 @@ static void mps2_common_init(MachineState *machine) create_unimplemented_device("Extra peripheral region @0x40020000", 0x40020000, 0x00010000); create_unimplemented_device("RESERVED 4", 0x40030000, 0x001D0000); - create_unimplemented_device("Ethernet", 0x40200000, 0x00100000); create_unimplemented_device("VGA", 0x41000000, 0x0200000); =20 switch (mmc->fpga_type) { @@ -310,6 +311,13 @@ static void mps2_common_init(MachineState *machine) &error_fatal); sysbus_mmio_map(SYS_BUS_DEVICE(sccdev), 0, 0x4002f000); =20 + /* In hardware this is a LAN9220; the LAN9118 is software compatible + * except that it doesn't support the checksum-offload feature. + */ + lan9118_init(&nd_table[0], 0x40200000, + qdev_get_gpio_in(armv7m, + mmc->fpga_type =3D=3D FPGA_AN385 ? 13 : = 47)); + system_clock_scale =3D NANOSECONDS_PER_SECOND / SYSCLK_FRQ; =20 armv7m_load_kernel(ARM_CPU(first_cpu), machine->kernel_filename, --=20 2.7.4