From patchwork Mon Oct 3 20:31:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 1685670 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=PwdqaDqL; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MhD5j0TLHz1yqm for ; Tue, 4 Oct 2022 08:11:05 +1100 (AEDT) Received: from localhost ([::1]:51148 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ofSiM-000298-V2 for incoming@patchwork.ozlabs.org; Mon, 03 Oct 2022 17:11:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53736) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ofS6y-0001V7-Ey; Mon, 03 Oct 2022 16:32:27 -0400 Received: from mail-ej1-x636.google.com ([2a00:1450:4864:20::636]:40603) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ofS6w-0003wO-M2; Mon, 03 Oct 2022 16:32:24 -0400 Received: by mail-ej1-x636.google.com with SMTP id f1so7158268ejw.7; Mon, 03 Oct 2022 13:32:21 -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; bh=tRuCXofapoGrKWRPVlYzCza+WIgeEkPwJI2EISlGE0s=; b=PwdqaDqLWKDyMkYCHhkpV4biclLB7iS6iSmLUrv+oeZVlu8yh2777/O2yOrk2iPAp+ itFfCL4lvJxqAAegevLe5OkvLv+4CrvPav4NSSWzObx04enfYi2s0JF6Zc8OhWFkwP9E hMIERKiM8pDbKabd5dk68aOWX+hefaE6RTOjfZZHzcLE0KhXONJPlQYMLjYKqzFzSAMQ 1snXAilLKPitvx3e3LX0idruVaWj8GDbmd1jwhancvSlEhEHv94VOdPKiCfh7VpJ0iHm InRzvW2kIVgsLZ1xvFUlsNN2iJWC2U2NKUtWn0ciKMFP1ta6Nz8ONzbv8h5EKZ5+p/wp RJ5A== 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; bh=tRuCXofapoGrKWRPVlYzCza+WIgeEkPwJI2EISlGE0s=; b=p/mThMvO3roZX38bybs8GA2O8+BW/NOQXTdYeUesR9h2+hF08uhIa0015iK2GueEse 3dbImY6v3j3iyrlwnxdxLAE2eJWK44ajSnFbUdoA0l0mza7pWIfFN8REZvEpD35IbPKc hgk4+GpCjPU6LpnTb2nucVSL7ug5BSRo5RnsSx03Mgavz1OoRe4yBwZdhaQpcYm1blNV +HFdGeCIuG+y3t3wn0xiojeQdUGFPdptOujS6CrMKgHZuWdMLq46hhKeXHDJoWnSVdVO nuv48WtzHHmTZt4elQ8tiqQEobL7WAJR6dykxlSgkNk9VHyyoo15It0TXD3IC3S4GYIb ceMA== X-Gm-Message-State: ACrzQf3odhLZmAfPBhT5ywBX9BG1aUkK8UlYFd4MLBw33OKCFK3wM/ue zAbdWLdW1zzQjGgQ7NNREHjWxbHfREE= X-Google-Smtp-Source: AMsMyM56j0RWgRtaqiD9+vwHPvD8A532K5B/zceOiod/8vy1cW7/aZBh5VWqRj3ed+6TJCu87B96IQ== X-Received: by 2002:a17:906:7315:b0:782:66dc:4b76 with SMTP id di21-20020a170906731500b0078266dc4b76mr16280012ejc.751.1664829139401; Mon, 03 Oct 2022 13:32:19 -0700 (PDT) Received: from localhost.localdomain ([46.183.103.8]) by smtp.gmail.com with ESMTPSA id lb9-20020a170907784900b0073ddd36ba8csm5978087ejc.145.2022.10.03.13.32.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Oct 2022 13:32:18 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-block@nongnu.org, Hanna Reitz , Bin Meng , Kevin Wolf , Bernhard Beschow Subject: [PATCH v2 00/13] ppc/e500: Add support for two types of flash, cleanup Date: Mon, 3 Oct 2022 22:31:29 +0200 Message-Id: <20221003203142.24355-1-shentey@gmail.com> X-Mailer: git-send-email 2.37.3 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: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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+incoming=patchwork.ozlabs.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-5 perform some general cleanup which paves the way for the rest of the series. Patches 6-9 add -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 10-13 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. 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 (13): hw/ppc/meson: Allow e500 boards to be enabled separately hw/gpio/meson: Introduce dedicated config switch for hw/gpio/mpc8xxx docs/system/ppc/ppce500: Add heading for networking chapter hw/ppc/e500: Reduce usage of sysbus API hw/ppc/mpc8544ds: Rename wrongly named method hw/ppc/mpc8544ds: Add platform bus hw/ppc/e500: Remove if statement which is now always true hw/block/pflash_cfi01: Error out if device length isn't a power of two hw/ppc/e500: Implement pflash handling hw/sd/sdhci-internal: Unexport ESDHC defines hw/sd/sdhci: Rename ESDHC_* defines to USDHC_* hw/sd/sdhci: Implement Freescale eSDHC device model hw/ppc/e500: Add Freescale eSDHC to e500 boards configs/devices/ppc-softmmu/default.mak | 3 +- docs/system/ppc/ppce500.rst | 28 ++++ hw/block/pflash_cfi01.c | 8 +- hw/gpio/Kconfig | 3 + hw/gpio/meson.build | 2 +- hw/ppc/Kconfig | 11 ++ hw/ppc/e500.c | 133 +++++++++++++-- hw/ppc/e500.h | 1 - hw/ppc/e500plat.c | 1 - hw/ppc/meson.build | 6 +- hw/ppc/mpc8544ds.c | 9 +- hw/sd/sdhci-internal.h | 20 --- hw/sd/sdhci.c | 210 +++++++++++++++++++++--- include/hw/sd/sdhci.h | 3 + 14 files changed, 368 insertions(+), 70 deletions(-)