From patchwork Tue Jan 12 12:55:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Saenz Julienne X-Patchwork-Id: 1425207 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.de Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DFVtx2NWcz9sXN for ; Tue, 12 Jan 2021 23:56:09 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 18379827FF; Tue, 12 Jan 2021 13:55:57 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id A8FCF82807; Tue, 12 Jan 2021 13:55:46 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 5B44682711 for ; Tue, 12 Jan 2021 13:55:42 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=nsaenzjulienne@suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 19428AC8F; Tue, 12 Jan 2021 12:55:42 +0000 (UTC) From: Nicolas Saenz Julienne To: mbrugger@suse.com, u-boot@lists.denx.de, bmeng.cn@gmail.com, sjg@chromium.org, marex@denx.de Cc: m.szyprowski@samsung.com, s.nawrocki@samsung.com, swarren@wwwdotorg.org, peng.fan@nxp.com, sr@denx.de, pbrobinson@gmail.com, Nicolas Saenz Julienne Subject: [PATCH v6 00/13] Raspberry Pi 400/Compute Module 4 support Date: Tue, 12 Jan 2021 13:55:18 +0100 Message-Id: <20210112125531.26547-1-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean This series could be split into at least two or even three parts, but I kept it as is for now as it contains all the changes needed in order to have u-boot working on the new Raspberry Pi 400 and Raspberry Pi Compute Module 4. There are core changes, specifically with regard to cpu to bus address space translations. So far we had relied on hard-coded values but RPi needs per device translations as it has at least three distinct bus address spaces with different offsets. So it's a good opportunity to implement bus translations the right way by parsing DT's dma-ranges. Here's a more concrete example of what we're dealing with: - On a RPi4, SoC version BCM2711C0 with 8GB of memory [0x0 0x200000000] [0x200000000 0x400000000] [0xc0000000 0x100000000] [0x00000000 0x100000000] phys/cpu address PCIe bus address Legacy peripheral emmc2 address space space address space space - On a RPi4, SoC version BCM2711C0 with 4GB of memory [0x0 0x100000000] [0x100000000 0x200000000] [0xc0000000 0x100000000] [0x00000000 0x100000000] phys/cpu address PCIe bus address Legacy peripheral emmc2 address space space address space space - On a RPi4, SoC version BCM2711B0 with 8GB of memory (bus can only access the lower 3GB of memory because of a SoC routing bug) [0x0 0x200000000] [0x00000000 0xC0000000] [0xc0000000 0x100000000] phys/cpu address PCIe bus address Legacy peripheral space space address space --- Changes since v5: - Fix xhci patch - Rebase fixes Changes since v4: - Get rid of #ifs all over the place Changes since v3: - Add commit "video: arm: rpi: Add brcm,bcm2711-hdmi0 compatible", it's pretty harmless - Get rid of non-device based phys2bus call in xhci & mmc - Simon's review changes in tests - Comment some of the APIs Changes since v2: - Test builds not broken with buildman - Add tests to all DM changes - Make code conditional with config option - Correct OF refcount - Add config changes - Address small changes as per reviews Changes since v1: - Fix some issues in 'dm: Introduce xxx_get_dma_range()' - Fix some typos in commit messages - Change DTB file name for RPi400 - Address Matthias' comments Nicolas Saenz Julienne (13): rpi: Add identifier for the new RPi400 rpi: Add identifier for the new CM4 pci: pcie-brcmstb: Fix inbound window configurations dm: Introduce xxx_get_dma_range() dm: test: Add test case for dev_get_dma_ranges() dm: Introduce DMA constraints into the core device model dm: test: Add test case for dev->dma_offset dm: Introduce dev_phys_to_bus()/dev_bus_to_phys() dm: test: Add test case for dev_phys_to_bus()/dev_bus_to_phys() xhci: translate virtual addresses into the bus's address space mmc: Introduce mmc_phys_to_bus()/mmc_bus_to_phys() configs: rpi4: Enable DM_DMA across all RPi4 configurations video: arm: rpi: Add brcm,bcm2711-hdmi0 compatible arch/sandbox/dts/test.dts | 21 ++++++++ board/raspberrypi/rpi/rpi.c | 10 ++++ common/fdt_support.c | 73 ++++++++++++++++++++++++++++ configs/rpi_4_32b_defconfig | 1 + configs/rpi_4_defconfig | 1 + configs/rpi_arm64_defconfig | 1 + configs/sandbox64_defconfig | 1 + configs/sandbox_defconfig | 1 + configs/sandbox_flattree_defconfig | 1 + configs/sandbox_spl_defconfig | 1 + drivers/core/Kconfig | 10 ++++ drivers/core/device.c | 41 ++++++++++++++++ drivers/core/of_addr.c | 78 ++++++++++++++++++++++++++++++ drivers/core/ofnode.c | 9 ++++ drivers/core/read.c | 6 +++ drivers/mmc/sdhci.c | 12 +++-- drivers/pci/pcie_brcmstb.c | 12 ++--- drivers/usb/host/xhci-mem.c | 45 +++++++++-------- drivers/usb/host/xhci-ring.c | 13 +++-- drivers/usb/host/xhci.c | 4 +- drivers/video/bcm2835.c | 1 + include/dm/device.h | 13 +++++ include/dm/of_addr.h | 17 +++++++ include/dm/ofnode.h | 16 ++++++ include/dm/read.h | 21 ++++++++ include/fdt_support.h | 14 ++++++ include/mmc.h | 6 +++ include/phys2bus.h | 17 +++++++ include/usb/xhci.h | 20 +++++++- test/dm/Makefile | 2 + test/dm/core.c | 30 ++++++++++++ test/dm/phys2bus.c | 37 ++++++++++++++ test/dm/read.c | 49 +++++++++++++++++++ 33 files changed, 543 insertions(+), 41 deletions(-) create mode 100644 test/dm/phys2bus.c create mode 100644 test/dm/read.c