From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 25CEA39B4A2 for ; Mon, 16 Mar 2026 14:04:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773669866; cv=none; b=LA/4ApUyIbLlT39dgkZ2YgvXg7I5vlx8chbpjfDq6Gy9lTiqz8ooNFwntJWfXxscUO2Ybj4AseoBFmJ54IgeGojM/YSrG+cESyq0McK9bp1aN4Vx2od7PIeChPHPlohBqsYdZp2KUINd7b2lFNDop8ss0CIm6/z65U8C4yB6jpc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773669866; c=relaxed/simple; bh=bBmnapbFZhNl1hExaX6Y6v+emhhgEDggwTauM/OowSQ=; h=From:Subject:Date:Message-Id:MIME-Version:Content-Type:To:Cc; b=dS2TfRBuZsvCau2/8GbSfFF2kSbDAjqFfYrZo/ckp3ciLaGmG3D+thvJAdc7t8aFoqFtOf564N/iq+09kGidR7uiInbfdZcWo3bUE4Rq0QIWuxn1ruAjkZkePU5gaIbdOWlrUbTwrCT/h1Qj/WSJffb4U0aGKNZ5X0ySkOfpe28= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=RIPsEEa2; arc=none smtp.client-ip=209.85.128.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="RIPsEEa2" Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-4852f8ac7e9so55275675e9.1 for ; Mon, 16 Mar 2026 07:04:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773669863; x=1774274663; darn=vger.kernel.org; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:from:to:cc:subject:date:message-id:reply-to; bh=OdoEqGGjgbvJGV3XvDqNqAu8aItRm8RFqY326SKUvHs=; b=RIPsEEa23RUR/jUqpEqzIp2rrpfYkHzeVKCy0H4SfIBUNgrRa/qyXHZsUhssbM2ITS 8+CSLW5fSevJweiV31/nfBZ+xhCLR9NngntV1mvPZJnReF7SXNNtOfBMC8dXbnflXSDO b2fHJF58iqaYOhVrajoocuss2kPEduzgmk8Iy42v5j3V4FrXwJJRobnah76xCWCSR+XY 56qRBDaffa3lBvr22AIfOX2kGuoIpn8mUCq6dAXS2qvx+nBXnTlE45uhI2G3LD/x272v K8qfp+TEKNBv1pRm/rMtr8VWnDWj+p5bucHMVG1zpVq6bldt5QoFkQKp0QRv08b5EWeb NxuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773669863; x=1774274663; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=OdoEqGGjgbvJGV3XvDqNqAu8aItRm8RFqY326SKUvHs=; b=hwcF+VSKUFcqmZDWGT5MzRbG/UpQcmf5W3Kd6xleOqUIhDil9lfOguVCIlYBvqTiyQ zKUUdPWPIXv6tLFI/oCq6JffNjw91+TIPoSKGbQcRBt5eNFCg9v19eecG/Hx2mGHzZIE EQg5f4xold8cIYOYPHT+58tnYm6uZNNeMtCXvV0oE/+xVPgzcAH34uj+wAOWPBltfM/9 22iKe0hQakmCrJS7ib7bSXngxjz0kyqVACF8moJAs0p0zu8BW/GED6JUXi5QDkP+TLiF 1B8rpXCeHfWSzcJJL/nWVYqwvidNNz7+xkt1O1HnMlMMR7+2CMlClE7lj5WkplOSXjV1 peuA== X-Forwarded-Encrypted: i=1; AJvYcCU4X3y/gorlUIdWERlA+qYwzns0nnR7jX5Ew+CXPbWOfed54LcKMfAVoYmGI5ch+JQDZiAAbdckZs6GgmY=@vger.kernel.org X-Gm-Message-State: AOJu0YxoDfIDpEUDuKvh8ZLCUW7po7rlbNwgBJwaUOl3NMckyELPAZUq W+BLH6JwkVbeqyMw7y53tP8219gc8aV7IPNxoP5lUkkTqH0Q1Vwv8auF X-Gm-Gg: ATEYQzyVnChFrqCi1sVEB3g9yQ/jSLjKUdFjQGodk2i8+MtJDy63iBSplx1x00v2nXh VPu47XHQY2xQNJdfJw9Ar4Go1c+U1F7halntsgMk4uVSHFnw+zZ31VP/Bmelk7sPcVbAchlQFS5 /s1yIkvqzx1i5lh9sVC6vVX97Qb2UBme1dkG7H/+tneEVlLRAGftrmF6cUIttTOxcBFLe5v2yTs JzwniYXiLPgN2ZbMwQONu4KQ8+iF5Z3m94aoawfQjgN8BSoK+YiUSqCtJ/ty5PYqQQX6cjvtmjY 5+bxSjiAdV2bYfXEWnfN1rGoDZXZLciMDnVliX4elYrzqqtFq4MIQ44QTH//ljQTUfA1rxxRnXU vnqTA5w9dxghZ+EYtAVMdUzicp6+JVBJMHXdWD9Di235/W0Cyl088CGCymmkf8P4hgAK+PPamy0 7rnmFmYO4kw1bwzsrJ8hKdpjO166QDbrJLn7sIVrE0MFYxC8NLE5UucQrAM5fJHDLd X-Received: by 2002:a05:600c:1988:b0:485:3f58:d84 with SMTP id 5b1f17b1804b1-4855a8d6fd7mr204197625e9.32.1773669863067; Mon, 16 Mar 2026 07:04:23 -0700 (PDT) Received: from ipedrosa-thinkpadx1carbongen12.rmtes.csb ([67.218.234.31]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43b3a09e453sm20698725f8f.0.2026.03.16.07.04.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Mar 2026 07:04:21 -0700 (PDT) From: Iker Pedrosa Subject: [PATCH v3 0/7] riscv: spacemit: enable SD card support with UHS modes for OrangePi RV2 Date: Mon, 16 Mar 2026 15:03:28 +0100 Message-Id: <20260316-orangepi-sd-card-uhs-v3-0-aefd3b7832df@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIAAAAAAAC/3XNyw6CMBCF4VchXVszTOVSV76HcUEvwCRCSauNh vDuFtyw0OV/kvlmZsF6soGds5l5GymQG1OIQ8Z034yd5WRSMwQsAbHkzq/rRDwYrhtv+LMPHKx WUNRCKtAsnU7etvTa2OstdU/h4fx7+xLzdf2CAvA3GHMOvJYacykroUFfuqGh+1G7ga1gxD0i/ yCYkEIpVEV1Mm1h9siyLB/zujKG/QAAAA== X-Change-ID: 20260226-orangepi-sd-card-uhs-0ecb05839b0c To: Ulf Hansson , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Adrian Hunter , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Yixun Lan , Yixun Lan Cc: Michael Opdenacker , Javier Martinez Canillas , linux-mmc@vger.kernel.org, devicetree@vger.kernel.org, linux-riscv@lists.infradead.org, spacemit@lists.linux.dev, linux-kernel@vger.kernel.org, Iker Pedrosa , Anand Moon , Trevor Gamblin X-Mailer: b4 0.14.2 This series enables complete SD card support for the Spacemit K1-based OrangePi RV2 board, including UHS (Ultra High Speed) modes for high-performance SD card operation. Background The Spacemit K1 SoC includes an SDHCI controller capable of supporting SD cards up to UHS-I speeds (SDR104 at 208MHz). However, mainline currently lacks basic SD controller configuration, SDHCI driver enhancements for voltage switching and tuning, and power management infrastructure. Implementation The series enables SD card support through coordinated layers: - Hardware infrastructure (patches 1-2): Device tree bindings for voltage switching hardware and essential clock infrastructure. - SDHCI driver enhancements (patches 3-7): Regulator framework integration, pinctrl state switching for voltage domains, AIB register programming, and comprehensive SDR tuning support for reliable UHS operation. - SoC and board integration (patches 8-10): Complete K1 SoC controller definitions, PMIC power infrastructure, and OrangePi RV2 board enablement with full UHS support. This transforms the OrangePi RV2 from having no SD card support to full UHS-I capability, enabling high-performance storage up to 208MHz. Signed-off-by: Iker Pedrosa --- Changes in v3: - Rebase on mmc.git/next to resolve conflicts with "mmc: sdhci-of-k1: add reset support" patch. - Squash tuning infrastructure and implementation patches (3 and 4) together to form complete functionality and avoid unused function warnings. - Reduce code nesting: implemented an early return sanity check in spacemit_sdhci_voltage_switch() to reduce indentation and improve logic flow. - Refactor pinctrl initialization: moved pinctrl resource acquisition and state lookup into a dedicated helper function, spacemit_sdhci_get_pins(). - Use generic regulator node names (buck4, aldo1) instead of device-specific aliases (sd_vmmc, sd_vqmmc) to better reflect that these PMIC outputs serve multiple devices. - Remove dead code handling 3.3V voltage switching from spacemit_sdhci_voltage_switch(). - Optimize tuning algorithm to use single-pass window detection instead of storing results in array, reducing memory usage and complexity. - Remove unnecessary card detect check in execute_tuning() - rely on MMC core. - Clarify commit message to mention both SD (UHS-I) and eMMC (HS200) tuning support. - Add SD card support for Banana Pi BPI-F3 board with UHS-I capabilities following the same pattern as OrangePi RV2. - Link to v2: https://lore.kernel.org/r/20260309-orangepi-sd-card-uhs-v2-0-5bb2b574df5d@gmail.com Changes in v2: - Removed custom AIB voltage switching code per maintainer feedback. The existing pinctrl driver already handles AIB voltage switching automatically via power-source property changes during UHS mode transitions. This eliminates code duplication. - Squashed regulator and pinctrl commits into single voltage switching implementation. - Moved voltage switching callback from dynamic probe assignment to static sdhci_ops declaration. Removed redundant SDHCI core call since the framework handles standard voltage switching automatically. - Made clock override (SDHC_OVRRD_CLK_OEN | SDHC_FORCE_CLK_ON) conditional for SD/SDIO cards only. This follows vendor driver pattern of differentiating SD and eMMC card handling. - Include no-mmc property for SD card. - Link to v1: https://lore.kernel.org/r/20260302-orangepi-sd-card-uhs-v1-0-89c219973c0c@gmail.com --- Iker Pedrosa (7): mmc: sdhci-of-k1: enable essential clock infrastructure for SD operation mmc: sdhci-of-k1: add regulator and pinctrl voltage switching support mmc: sdhci-of-k1: add comprehensive SDR tuning support riscv: dts: spacemit: k1: add SD card controller and pinctrl support riscv: dts: spacemit: k1-orangepi-rv2: add PMIC and power infrastructure riscv: dts: spacemit: k1-orangepi-rv2: add SD card support with UHS modes riscv: dts: spacemit: k1-bananapi-f3: add SD card support with UHS modes arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts | 23 ++- arch/riscv/boot/dts/spacemit/k1-orangepi-rv2.dts | 67 +++++++ arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi | 40 ++++ arch/riscv/boot/dts/spacemit/k1.dtsi | 13 ++ drivers/mmc/host/sdhci-of-k1.c | 243 +++++++++++++++++++++++ 5 files changed, 384 insertions(+), 2 deletions(-) --- base-commit: f38f518dda1f1decc7a39556fe3231b0d1b84e1e change-id: 20260226-orangepi-sd-card-uhs-0ecb05839b0c Best regards, -- Iker Pedrosa