From patchwork Tue May 28 13:32:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea della Porta X-Patchwork-Id: 13676746 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 3F404C25B7C for ; Tue, 28 May 2024 13:33:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=7fXfT/FC79y6KQ4DKEvhVplXTI6O97HQrMg4vp4iUbo=; b=u9siX6ZJnHluFQ 3x2Gt9jP7b1D9lfJDLLycehxiQ8ViQw6cP8uB2kuGV+eXrYiSCDFHWuIFdCHaFr+P/jeKMPN/VEuT Bng1Gt8chw9xB6o6nx5SyEW4ANdAJSLf20AfFoaptNVTVR0YiDYXxS6x8cMeB6LdEU5jwI2gu7tt6 TjHCMyi4LfVCLUGzli6fobtGqrW2AP9P93nRXqNDVw2KgqCvt1l2z8kb0afn+vCYG1Y20mTs2l0bH lMW/R8MFSX/eFKSr1phxJbjwSOjR7chEAYum2xB1qjYoY8vTV01oZ+uMHpWyD2wfjATjfWLx8ZvQQ SZxpVq2adgxw9jfE2VYw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sBwwu-00000000oj6-3knu; Tue, 28 May 2024 13:33:09 +0000 Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sBwwn-00000000obq-0BGa for linux-arm-kernel@lists.infradead.org; Tue, 28 May 2024 13:33:03 +0000 Received: by mail-ej1-x635.google.com with SMTP id a640c23a62f3a-a626777f74eso106841466b.3 for ; Tue, 28 May 2024 06:32:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1716903177; x=1717507977; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=hV9/NpvQeVfS2FB9bvuiNpWNHm5hbztiDskWAIVLpAM=; b=RsjSoUCeumLC7bMc9gtoZrO01sQ/giYRuC48qW/mHgWa/O6ZVFXl1YD1ST8XNgDvQN Qt6mcRRPJG4/q7PNTWZhYnpcaVjD4J03779wEX3zUsIujhbZaevW16tnUl2ip4t4+dwT /jzL+ibGTPGw/ehTmU3bt5Ok553Z8N0DOv/dEcCoDDyC0yP9U/XmwOgajUEVFsu1aVKr nmZgmw1CR+EPCeNiWlbGBc+Q+bFg59j9cgnGFWW+D6xfWf71zS9ptVurKHpLB7fpzJVQ PadLMC6cj+j8FZkMGvCH/mNyq+brPFLQvOdswskcSPGhOSUpUZfU6gWqa+TcUdvVt8FZ aTGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716903177; x=1717507977; 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=hV9/NpvQeVfS2FB9bvuiNpWNHm5hbztiDskWAIVLpAM=; b=fbIoOd4IkPGD/SSe+agr94cFTL6hueRVhh4f+0PzldZrKQUcrrACKTV2z9o/DO2/EU HplPu0qaxrt/1U9owaep0tefLvpzPkVEbGMsarfquLvm4i4+xu2dy8cN2SO7eji970Yp 8/k2VTVc0yK8cU1l7yHtyY0L5mlHiMW10mazRLVHUPKG/gL4rZG8xDnSQFDwv0t2ZR+1 gJGNNunoFCirZS2Xk66ozvZIv4tGNTtKj93Rm2e6Q8fQcDKG4to12bSueZyLaAw3PJk1 gngMJIStU9Ohwy03/rSvMmO7IvmcqtaloGyOq2wzAuodwClVyhbJ5ehEt6UaQyiTqabp 8R7w== X-Forwarded-Encrypted: i=1; AJvYcCVdvCD/NyHpOpfeouZNp1sNR6wrJiyBocav8v7c3I1SLN2HMpxXDgALaAcjBOqTReN/ahTAkH8eTiySWBXA684hNNkm+ZpbuzTUiEunE9CmNj3vFNg= X-Gm-Message-State: AOJu0Yy43VbyC0gKTQS0E8YdbQMls9xik4of0gn92XBmM+eLavqHdBaD P3KBQPnAO1m7Sa1oks2/NkXdKHY4QX3+rZbyH2kUeVT5yPl3ZhJ4Fn33ONc1/QY= X-Google-Smtp-Source: AGHT+IGOSdIe/yj7VDyhduAq9zG6uCm0MDb3anjNiJD7At0A+lJ6FKt2wWjOS0aW2FrATTzekEdYAQ== X-Received: by 2002:a17:906:c106:b0:a63:598:88fd with SMTP id a640c23a62f3a-a6305989d03mr608236066b.62.1716903177354; Tue, 28 May 2024 06:32:57 -0700 (PDT) Received: from localhost (host-87-16-233-11.retail.telecomitalia.it. [87.16.233.11]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a626cc8a15esm622994666b.148.2024.05.28.06.32.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 May 2024 06:32:57 -0700 (PDT) From: Andrea della Porta To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Ray Jui , Scott Branden , Broadcom internal kernel review list , Ulf Hansson , Adrian Hunter , Kamal Dasu , Al Cooper , Stefan Wahren , devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org Cc: Andrea della Porta Subject: [PATCH v4 0/4] Add minimal boot support for Raspberry Pi 5 Date: Tue, 28 May 2024 15:32:37 +0200 Message-ID: X-Mailer: git-send-email 2.44.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240528_063301_095962_F4291C61 X-CRM114-Status: GOOD ( 24.51 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi, This patchset adds minimal support for the Broadcom BCM2712 SoC and for the on-board SDHCI controller on Broadcom BCM2712 in order to make it possible to boot (particularly) a Raspberry Pi 5 from SD card and get a console through uart. Changes to arm64/defconfig are not needed since the actual options work as they are. This work is heavily based on downstream contributions. Tested on Tumbleweed substituting the stock kernel with upstream one, either chainloading uboot+grub+kernel or directly booting the kernel from 1st stage bootloader. Steps to reproduce: - prepare an SD card from a Raspberry enabled raw image, mount the first FAT partition. - make sure the FAT partition is big enough to contain the kernel, anything bigger than 64Mb is usually enough, depending on your kernel config options. - build the kernel and dtbs making sure that the support for your root fs type is compiled as builtin. - copy the kernel image in your FAT partition overwriting the older one (e.g. kernel*.img for Raspberry Pi OS or u-boot.bin for Tumbleweed). - copy arch/arm64/boot/dts/broadcom/bcm2712-rpi-5-b.dtb on FAT partition. - make sure you have a cmdline.txt file in FAT partition with the following content: # cat /boot/efi/cmdline.txt root=/dev/mmcblk0p3 rootwait rw console=tty ignore_loglevel earlycon console=ttyAMA10,115200 - if you experience random SD issues during boot, try to set initial_turbo=0 in config.txt. Changes in V4: sdhci-brcmstb.c: - dropped the last 4 lines of sdhci_brcmstb_cfginit_2712() function to avoid setting the SDIO_CFG_CQ_CAPABILITY register. The rationale behind this can be found in [4] and subsequent comments DT-bindings: - simplified the compatible item list for 'brcm,bcm2712-sdhci' as per [5] Changes in V3: DTS: - uart0 renamed to uart10 to reflect the current indexing (ttyAMA10 and serial10) - updated the license to (GPL-2.0 OR MIT) - sd_io_1v8_reg 'states' property have second cells as decimal instead of hex. - root node has size-cells=<2> now to accommodate for the DRAM controller and the address bus mapping that goes beyond 4GB. As a consequence, memory, axi and reserved-memory nodes have also size-cells=<2> and subnodes reg and ranges properties have been updated accordingly - ranges property in 'axi' node has been fixed, reg properties of sdio1 and gicv2 subnodes have been adjusted according to the new mapping - 'interrupt-controller@7d517000' node is now enabled by default - dropped 'arm,cpu-registers-not-fw-configured' as it is no longer relevant on A76 core - l2 cache nodes moved under respective cpus, since they are per-cpu - dropped psci cpu functions properties - added the hypervisor EL2 virtual timer interrupt to the 'timer' node - splitted-lines url are now on a single line sdhci-brcmstb.c: - simplified MMC_CAP_HSE_MASK leveraging already existing definitions - MMC_CAP_UHS_MASK renamed to MMC_CAP_UHS_I_SDR_MASK to better reflect its purpose. Added also a comment. - sdhci_brcmstb_set_power() replaced with the already existing (and equivalent) sdhci_set_power_and_bus_voltage() DT-bindings: - removed the BCM2712 specific example, as per Rob's request. Changes in V2: - the patchshet has been considerably simplified, both in terms of dts and driver code. Notably, the pinctrl/pinmux driver (and associated binding) was not strictly needed to use the SD card so it has been dropped - dropped the optional SD express support patch - the patches order has been revisited - pass all checks (binding, dtb, checkpatch) Many thanks, Andrea References: [1] - Link to V1: https://lore.kernel.org/all/cover.1713036964.git.andrea.porta@suse.com/ [2] - Link to V2: https://lore.kernel.org/all/cover.1715332922.git.andrea.porta@suse.com/ [3] - Link to V3: https://lore.kernel.org/all/cover.1716277695.git.andrea.porta@suse.com/ [4] - https://lore.kernel.org/all/ZlF5dQbNpZ921e66@apocalypse/ [5] - https://lore.kernel.org/all/bc1eb98c-9d49-4424-ab89-16be6c67c3f5@gmx.net/#t Andrea della Porta (4): dt-bindings: arm: bcm: Add BCM2712 SoC support dt-bindings: mmc: Add support for BCM2712 SD host controller mmc: sdhci-brcmstb: Add BCM2712 support arm64: dts: broadcom: Add support for BCM2712 .../devicetree/bindings/arm/bcm/bcm2835.yaml | 6 + .../bindings/mmc/brcm,sdhci-brcmstb.yaml | 1 + arch/arm64/boot/dts/broadcom/Makefile | 1 + .../boot/dts/broadcom/bcm2712-rpi-5-b.dts | 64 ++++ arch/arm64/boot/dts/broadcom/bcm2712.dtsi | 292 ++++++++++++++++++ drivers/mmc/host/sdhci-brcmstb.c | 60 ++++ 6 files changed, 424 insertions(+) create mode 100644 arch/arm64/boot/dts/broadcom/bcm2712-rpi-5-b.dts create mode 100644 arch/arm64/boot/dts/broadcom/bcm2712.dtsi