From patchwork Sun Feb 23 11:46:50 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 13986964 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C975EC021B2 for ; Sun, 23 Feb 2025 11:49:35 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tmASC-0008Of-2p; Sun, 23 Feb 2025 06:47:24 -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 1tmASA-0008O8-ND; Sun, 23 Feb 2025 06:47:22 -0500 Received: from mail-ed1-x52d.google.com ([2a00:1450:4864:20::52d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tmAS8-0005v9-NV; Sun, 23 Feb 2025 06:47:22 -0500 Received: by mail-ed1-x52d.google.com with SMTP id 4fb4d7f45d1cf-5ded6c31344so4979450a12.1; Sun, 23 Feb 2025 03:47:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1740311238; x=1740916038; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=tgSld8Qjv3h9JqKQUf+Zp1b7lgUyHl7hk037kh0cBVk=; b=m4ZMETY05028irDh5YyLO1M1jUD+L9HsPBwyYpjf0O7vArge2acW4hdm2JQl3wdADy OjwUM395eoE4ylHi3ng03Lju9KfB1n+ixDT+LED7I6ajxS06vN49V20ILamCFpzhyul0 E/30ExWs5KF2+5UWo6qVz2FCBerqaRX6A/NBmwcmoC7MHxzAwCppha+T/FP9eTPVtq/d nSRFBR6xC42UfoH5K4w4dgPJJZQLgVXG65p+JzSm1hf3ZMwBGgF03mWa7a1Nc2FKUh5k 2+1d1Y/v0GSM8cbjgB0wgGBxIw2kJzUiZNfUBZKtN05knFN8rg3P/m+CFB/i7rrsAr85 Q2ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740311238; x=1740916038; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=tgSld8Qjv3h9JqKQUf+Zp1b7lgUyHl7hk037kh0cBVk=; b=Y0mt22xHDF/DQ+qiHtlQbSjs4PAq5Z5sz4ZGbPT/2BvJU+ldBLovFjZHOVLN5O2nNI YNtipGrTtA93IWerZ08WjLPNHpRrpe6jgr/spWgzRYbKSBzQYESoq4wTMNABrYJvHAcH Cmv3/lMhaWADIb4uj+2NI9oDADWp2I6YY/gAp1E6X38PNQ4tNRwqyTCqObo1ZMop6rmm gwzrCdyqLvuhxyTQ/zdcyecoG83/H3EgCRB4b89GiCnltWvaiYksNC26czoSj5LBh6Ee E2RqJ9Ovbbh+0LIXyleFewBdrGdxBmxrhFL93kC9q7XDZ43I1MaoJtcKOHzJ8NbKuzmd 1CNw== X-Forwarded-Encrypted: i=1; AJvYcCVrprm42kqupgAWOmYfT9XDH6p+FFI8OuH/JKBMmVwfiTRBWUv6clL/9jlnmbFhFx4p0XFqFhic0w==@nongnu.org X-Gm-Message-State: AOJu0YyONWYgouIhKqIgVCKjNeo0Oj5guL3C7xTSjnsOpGJAujZWCKas hyDKGW8dFfHzGYrdP5B0RFZwU9+llR3KXChxnP/gd83c4UtqMl2bKfxRXA== X-Gm-Gg: ASbGnctY84s2YqDbhYvQtvRX7a4rtvA6J7vtx1SR7Pcn9oSYkx0ZFqyfFY2PN878bLG fZRCQVQ55OKX+jYOHD94kSbuci1/KUx9C66jycnfrwSch4dnA/3PeX0e5a5Vs4kClGlU3BdUbns SZZfWQaghylNTDOCYENu5anHxsenU+2vl0KOvos2kwY8pw9HyOtSu8l2IxKZn6JsQ0A4PUkeYfn 62xtYKBkbThaCHFTUgHOsGIXcATkOGG8GcwByZyKUJeRsD9SkoB16a6VORa79WAXgZy9OEJIC8V azuJkxVi5Z6Qv4QGmwfxmHzHx4qWeoW3YGuFUOu0Ba+ZygHKclVjhSCZ0tJ1tl3wbPkiixfpS5P Sk/VtEI5wNv1+ X-Google-Smtp-Source: AGHT+IEhh/xPlkrmBYDZZr133WBfa33BeCBec+O15IUvTSFw03EWWprGqRwKlZAu3YlMXJxMbMwCBQ== X-Received: by 2002:a05:6402:540c:b0:5dc:74fd:abf1 with SMTP id 4fb4d7f45d1cf-5e0b7107adbmr19801955a12.15.1740311237623; Sun, 23 Feb 2025 03:47:17 -0800 (PST) Received: from Provence.localdomain (dynamic-077-011-167-038.77.11.pool.telefonica.de. [77.11.167.38]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-abba4b9ee98sm1240515466b.167.2025.02.23.03.47.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Feb 2025 03:47:17 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Jean-Christophe Dubois , qemu-arm@nongnu.org, Peter Maydell , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Laurent Vivier , Andrey Smirnov , Bernhard Beschow , Fabiano Rosas , Alistair Francis , "Edgar E. Iglesias" , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= Subject: [PATCH v2 00/18] Add i.MX 8M Plus EVK machine Date: Sun, 23 Feb 2025 12:46:50 +0100 Message-ID: <20250223114708.1780-1-shentey@gmail.com> X-Mailer: git-send-email 2.48.1 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::52d; envelope-from=shentey@gmail.com; helo=mail-ed1-x52d.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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org This series adds a new aarch64 machine to QEMU: i.MX 8M Plus EVK [1]. It allows for running Linux distributions such as Buildroot (freescale_imx8mpevk_defconfig) and Arch Linux [2] via direct kernel boot. U-Boot does not work yet. I plan to use this machine in CI and I also want to make it available to a bigger audience, so I propose to add it to QEMU. My goal would be to have it added for 10.0. For this, a Changelog entry could be added under https://wiki.qemu.org/ChangeLog/10.0 such as: * New board model "imx8mp-evk": i.MX 8M Plus Evaluation Kit The series is structured as follows: The first three patches fix some issues in device models reused by the new machine. Patches 4-17 add the machine step by step which includes documentation. The last patch adds an I²C RTC which I'd like to use along with the new machine. I've based some code on existing one (see "Based on" in file headers) and I'm unsure how to handle the licensing and attribution correctly -- advice welcome. v3: * Pick up R-b tags * Add QTest testcase for the RS5C372 RTC (Phil) * Rephrase machine description (Peter) * Fix typos and confused sentence in machine documentation (Peter) * Use g_autofree for object names (Peter) * Clarify source of "cntfrq" CPU property (Peter) * Fix typo "g[e]neral purpose timers" in commit message (Peter) * Don't `default y if I2C_DEVICES` for hw/gpio/pca955* (Peter) * TYPE_FSL_IMX8M_PCIE_PHY: * Implement reset method (Peter) * Use named constant rather than risking undefined behavior (Peter) * Fix copy'n'paste typo in imx8mp_analog.c Open questions: * How to generate all zero boot rom file in a portable way (Peter) v2: * Rebase onto master, eliminating some patches from the series * Initialize ROM with memory_region_init_rom() (Zoltan) * Mark the machine as "Maintained" (Peter) * Do not select TEST_DEVICES (Peter) * Have separate sources for the two clock tree modules (Peter) * Make PCI devices attach to the correct bus (Peter) * Avoid adding documentation that is removed later (Zoltan) Instead, document Buildroot process in the first place and change it slightly. * Drop TCA6416 device model (Phil, Dmitrii) * Add pca955* Kconfig cleanup patch [1] https://www.nxp.com/design/design-center/development-boards-and-designs/8MPLUSLPD4-EVK [2] https://archlinuxarm.org/platforms/armv8/generic Bernhard Beschow (18): hw/usb/hcd-dwc3: Align global registers size with Linux hw/pci-host/designware: Prevent device attachment on internal PCIe root bus hw/gpio/pca955*: Move Kconfig switches next to implementations hw/arm: Add i.MX 8M Plus EVK board hw/arm/fsl-imx8mp: Implement clock tree hw/arm/fsl-imx8mp: Add SNVS hw/arm/fsl-imx8mp: Add USDHC storage controllers hw/arm/fsl-imx8mp: Add PCIe support hw/arm/fsl-imx8mp: Add GPIO controllers hw/arm/fsl-imx8mp: Add I2C controllers hw/arm/fsl-imx8mp: Add SPI controllers hw/arm/fsl-imx8mp: Add watchdog support hw/arm/fsl-imx8mp: Implement general purpose timers hw/arm/fsl-imx8mp: Add Ethernet controller hw/arm/fsl-imx8mp: Add USB support hw/arm/fsl-imx8mp: Add boot ROM hw/arm/fsl-imx8mp: Add on-chip RAM hw/rtc: Add Ricoh RS5C372 RTC emulation MAINTAINERS | 16 + docs/system/arm/imx8mp-evk.rst | 70 +++ docs/system/target-arm.rst | 1 + include/hw/arm/fsl-imx8mp.h | 285 +++++++++++ include/hw/misc/imx8mp_analog.h | 81 +++ include/hw/misc/imx8mp_ccm.h | 30 ++ include/hw/pci-host/designware.h | 7 + include/hw/pci-host/fsl_imx8m_phy.h | 28 ++ include/hw/timer/imx_gpt.h | 1 + include/hw/usb/hcd-dwc3.h | 2 +- hw/arm/fsl-imx8mp.c | 732 ++++++++++++++++++++++++++++ hw/arm/imx8mp-evk.c | 74 +++ hw/misc/imx8mp_analog.c | 160 ++++++ hw/misc/imx8mp_ccm.c | 175 +++++++ hw/pci-host/designware.c | 18 +- hw/pci-host/fsl_imx8m_phy.c | 98 ++++ hw/rtc/rs5c372.c | 236 +++++++++ hw/timer/imx_gpt.c | 25 + hw/usb/hcd-dwc3.c | 5 + tests/qtest/rs5c372-test.c | 43 ++ hw/arm/Kconfig | 24 + hw/arm/meson.build | 2 + hw/gpio/Kconfig | 8 + hw/misc/Kconfig | 14 +- hw/misc/meson.build | 2 + hw/pci-host/Kconfig | 3 + hw/pci-host/meson.build | 1 + hw/rtc/Kconfig | 5 + hw/rtc/meson.build | 1 + hw/rtc/trace-events | 4 + pc-bios/imx8mp-boot.rom | Bin 0 -> 258048 bytes pc-bios/meson.build | 1 + tests/qtest/meson.build | 1 + 33 files changed, 2143 insertions(+), 10 deletions(-) create mode 100644 docs/system/arm/imx8mp-evk.rst create mode 100644 include/hw/arm/fsl-imx8mp.h create mode 100644 include/hw/misc/imx8mp_analog.h create mode 100644 include/hw/misc/imx8mp_ccm.h create mode 100644 include/hw/pci-host/fsl_imx8m_phy.h create mode 100644 hw/arm/fsl-imx8mp.c create mode 100644 hw/arm/imx8mp-evk.c create mode 100644 hw/misc/imx8mp_analog.c create mode 100644 hw/misc/imx8mp_ccm.c create mode 100644 hw/pci-host/fsl_imx8m_phy.c create mode 100644 hw/rtc/rs5c372.c create mode 100644 tests/qtest/rs5c372-test.c create mode 100644 pc-bios/imx8mp-boot.rom