From patchwork Tue Oct 18 21:01:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 13011065 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 DF1A3C433FE for ; Tue, 18 Oct 2022 21:21:56 +0000 (UTC) Received: from localhost ([::1]:44042 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oku26-0001Aw-L1 for qemu-devel@archiver.kernel.org; Tue, 18 Oct 2022 17:21:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36194) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oktjW-00022D-HX; Tue, 18 Oct 2022 17:02:51 -0400 Received: from mail-ej1-x636.google.com ([2a00:1450:4864:20::636]:39667) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oktjS-0003un-GN; Tue, 18 Oct 2022 17:02:41 -0400 Received: by mail-ej1-x636.google.com with SMTP id b2so35396219eja.6; Tue, 18 Oct 2022 14:02:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=iOmB+xoTEaRaOIdbCKCBrtSMoKomoXO9ygIphsjM/7g=; b=GBHjcUehhWInfIZLMHzCyP1MYWZN2aMfTnwWuY/7IoO1KFpcPqfCAXV9PBuqzVZ4iM BMIv0XMe7otEQOBnCnCaV9KVd5SUlF0vaZAeTV5fBJXmOqOxKFJfHzILTPgc+Jhl20OL Tmd++d1j4YKDF6HuCBScqXes3Pt43mrJyP4YrlL4pT/nvW0hlB2EeiCK0Apu3C7MM4rF qDNxfVjDCuYCxBLHbdYRATYA8FHpeAW8T/ko4pxjaBlxadcNJdYnX/PorA/YHRDMZUyB K2XFa405sbiq1q21tpIcf5YZPpBxp19ZzhbfHIJEFs8yFWLQjeRVphnP4VY/8AKo4rva /kPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=iOmB+xoTEaRaOIdbCKCBrtSMoKomoXO9ygIphsjM/7g=; b=QUlR8jYXVzb9QyL5MCcSIb53MwG9laBYPBkYROZ2GKqOtuwGdsMNAXoPuvvxAj2zKg abk2oMzWdCNghW2L/RuKmkjttcsoifIrUJaITS8JkIFXjXWGJ3NxYJ2sP0d6ZIVWJdoM NJ6ZMthpQJz1dRTDB4UVt7EAsaDm0wr8MDjfINIaNS7vJ+oqAYuVSQjWm236APDTi9tU lpuNVzQAu/6vUTUxcrDx8U1IRKoKX5IAgmRq4eNBmM5L0QavcImA6M9Lin5N6mM/lHdk zN+JMc5CHjsqgZF5g1E2rNFCHiC/JJ5ZAvrD9FV204h8/PJsMDnpy3S3Oe02znGNXBwo Az1w== X-Gm-Message-State: ACrzQf2AYe/hfY3HYMWoNOtgX8R7ssB9cwReOs5mSXv2hbyRzHQa6BAI ufVVNQCuaKZwhC9bz9n49O5LM21xZP0= X-Google-Smtp-Source: AMsMyM5oe6RNRGryZioLiMwic86r81Ydk2MPyHz/ArWbw6Loj4xwaerOADBpqRKPOZBsFdFwM4QYog== X-Received: by 2002:a17:907:3ea9:b0:78d:fdf0:88fe with SMTP id hs41-20020a1709073ea900b0078dfdf088femr4116844ejc.667.1666126954317; Tue, 18 Oct 2022 14:02:34 -0700 (PDT) Received: from localhost.localdomain (dynamic-078-054-012-048.78.54.pool.telefonica.de. [78.54.12.48]) by smtp.gmail.com with ESMTPSA id fe7-20020a056402390700b004587c2b5048sm9407951edb.52.2022.10.18.14.02.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Oct 2022 14:02:33 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-ppc@nongnu.org, Aurelien Jarno , Yoshinori Sato , Antony Pavlov , BALATON Zoltan , Alistair Francis , Bin Meng , Kevin Wolf , Peter Maydell , Jan Kiszka , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Hanna Reitz , qemu-arm@nongnu.org, Magnus Damm , "Edgar E. Iglesias" , qemu-block@nongnu.org, Bernhard Beschow Subject: [PATCH v4 0/7] ppc/e500: Add support for two types of flash, cleanup Date: Tue, 18 Oct 2022 23:01:39 +0200 Message-Id: <20221018210146.193159-1-shentey@gmail.com> X-Mailer: git-send-email 2.38.0 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::636; envelope-from=shentey@gmail.com; helo=mail-ej1-x636.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" Cover letter: ~~~~~~~~~~~~~ This series adds support for -pflash and direct SD card access to the PPC e500 boards. The idea is to increase compatibility with "real" firmware images where only the bare minimum of drivers is compiled in. The series is structured as follows: Patches 1-4 perform some general cleanup which paves the way for the rest of the series. Patch 5 adds -pflash handling where memory-mapped flash can be added on user's behalf. That is, the flash memory region in the eLBC is only added if the -pflash argument is supplied. Note that the cfi01 device model becomes stricter in checking the size of the emulated flash space. Patches 6 and 7 add a new device model - the Freescale eSDHC - to the e500 boards which was missing so far. User documentation is also added as the new features become available. Tesing done: * `qemu-system-ppc -M ppce500 -cpu e500mc -m 256 -kernel uImage -append "console=ttyS0 rootwait root=/dev/mtdblock0 nokaslr" -drive if=pflash,file=rootfs.ext2,format=raw` * `qemu-system-ppc -M ppce500 -cpu e500mc -m 256 -kernel uImage -append "console=ttyS0 rootwait root=/dev/mmcblk0" -device sd-card,drive=mydrive -drive id=mydrive,if=none,file=rootfs.ext2,format=raw` The load was created using latest Buildroot with `make qemu_ppc_e500mc_defconfig` where the rootfs was configured to be of ext2 type. In both cases it was possible to log in and explore the root file system. v4: ~~~ Zoltan: - Don't suggest presence of qemu-system-ppc32 in documentation Bin: - New patch: docs/system/ppc/ppce500: Use qemu-system-ppc64 across the board(s) Peter: - Inline pflash_cfi01_register() rather than modify it (similar to v2) v3: ~~~ Phil: - Also add power-of-2 fix to pflash_cfi02 - Resolve cfi01-specific assertion in e500 code - Resolve unused define in eSDHC device model - Resolve redundant alignment checks in eSDHC device model Bin: - Add dedicated flash chapter to documentation Bernhard: - Use is_power_of_2() instead of ctpop64() for better readability - Only instantiate eSDHC device model in ppce500 (not used in MPC8544DS) - Rebase onto gitlab.com/danielhb/qemu/tree/ppc-next v2: ~~~ Bin: - Add source for MPC8544DS platform bus' memory map in commit message. - Keep "ESDHC" in comment referring to Linux driver. - Use "qemu-system-ppc{64|32} in documentation. - Use g_autofree in device tree code. - Remove unneeded device tree properties. - Error out if pflash size doesn't fit into eLBC memory window. - Remove unused ESDHC defines. - Define macro ESDHC_WML for register offset with magic constant. - Fix some whitespace issues when adding eSDHC device to e500. Phil: - Fix tense in commit message. Bernhard Beschow (7): docs/system/ppc/ppce500: Use qemu-system-ppc64 across the board(s) hw/block/pflash_cfi0{1,2}: Error out if device length isn't a power of two hw/sd/sdhci-internal: Unexport ESDHC defines hw/sd/sdhci: Rename ESDHC_* defines to USDHC_* hw/ppc/e500: Implement pflash handling hw/sd/sdhci: Implement Freescale eSDHC device model hw/ppc/e500: Add Freescale eSDHC to e500plat docs/system/ppc/ppce500.rst | 38 +++++++- hw/block/pflash_cfi01.c | 8 +- hw/block/pflash_cfi02.c | 5 + hw/ppc/Kconfig | 2 + hw/ppc/e500.c | 114 +++++++++++++++++++++- hw/ppc/e500.h | 1 + hw/ppc/e500plat.c | 1 + hw/sd/sdhci-internal.h | 20 ---- hw/sd/sdhci.c | 183 +++++++++++++++++++++++++++++++----- include/hw/sd/sdhci.h | 3 + 10 files changed, 324 insertions(+), 51 deletions(-)