From: "Arnd Bergmann" <arnd@arndb.de>
To: "yangzh0906@thundersoft.com" <yangzh0906@thundersoft.com>,
"Rob Herring" <robh@kernel.org>,
krzk+dt@kernel.org, "Krzysztof Kozlowski" <krzk@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"gordon.ge" <gordon.ge@bst.ai>,
"Catalin Marinas" <catalin.marinas@arm.com>,
"Geert Uytterhoeven" <geert.uytterhoeven@gmail.com>,
"Will Deacon" <will@kernel.org>,
"Ulf Hansson" <ulf.hansson@linaro.org>,
"Adrian Hunter" <adrian.hunter@intel.com>
Cc: linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
"linux-mmc @ vger . kernel . org" <linux-mmc@vger.kernel.org>,
soc@lists.linux.dev, bst-upstream <bst-upstream@bstai.top>,
"Neil Armstrong" <neil.armstrong@linaro.org>,
"Jonathan Cameron" <jonathan.cameron@huawei.com>,
bigfoot@classfun.cn, kever.yang@rock-chips.com,
"Manivannan Sadhasivam" <mani@kernel.org>,
"Geert Uytterhoeven" <geert+renesas@glider.be>,
"Bjorn Andersson" <andersson@kernel.org>,
"Nishanth Menon" <nm@ti.com>,
"Nícolas F. R. A. Prado" <nfraprado@collabora.com>,
"Taniya Das" <quic_tdas@quicinc.com>,
"Eric Biggers" <ebiggers@google.com>,
"Victor Shih" <victor.shih@genesyslogic.com.tw>,
"Shan-Chun Hung" <shanchun1218@gmail.com>,
"Ben Chuang" <ben.chuang@genesyslogic.com.tw>
Subject: Re: [PATCH v2 5/8] mmc: sdhci: add Black Sesame Technologies BST C1200 controller driver
Date: Wed, 02 Jul 2025 12:40:31 +0200 [thread overview]
Message-ID: <53ba18c1-4554-4d77-84fd-d921febb7559@app.fastmail.com> (raw)
In-Reply-To: <20250702094444.3523973-6-yangzh0906@thundersoft.com>
On Wed, Jul 2, 2025, at 11:44, Albert Yang wrote:
> +
> +config MMC_SDHCI_BST
> + tristate "SDHCI OF support for the BST DWC MSHC"
> + depends on ARCH_BST || COMPILE_TEST
> + depends on MMC_SDHCI_PLTFM
> + depends on OF
> + help
> + This selects Synopsys DesignWare Cores Mobile Storage Controller
> + support.
The description does not mention the actual device it's for
but only DesignWare.
Try to keep this sorted alphabetically between the other
CONFIG_MMC_SDHCI_* backends
> +
> +struct dwcmshc_priv {
> + void __iomem *crm_reg_base;
> + u32 phy_crm_reg_base;
> + u32 phy_crm_reg_size;
> +};
You are only using the first member here, the phy_crm_reg_base
and phy_crm_reg_size are assigned during probe but not referenced
later. devm_platform_ioremap_resource() should help simplify
that code further.
> +
> +static void bst_write_phys_bst(void __iomem *addr, u32 value)
> +{
> + iowrite32(value, addr);
> +}
You always pass priv->crm_reg_base into this helper, so
it would be simpler to make it take the sdhci_pltfm_host
pointer and the offset instead of the address.
> +static int bst_sdhci_reallocate_bounce_buffer(struct sdhci_host *host)
> +{
> + struct mmc_host *mmc = host->mmc;
> + unsigned int max_blocks;
> + unsigned int bounce_size;
> + int ret;
> +
> + /*
> + * Cap the bounce buffer at 64KB. Using a bigger bounce buffer
> + * has diminishing returns, this is probably because SD/MMC
> + * cards are usually optimized to handle this size of requests.
> + */
> + bounce_size = SZ_32K;
The comment says 64K, but the size you use is 32K.
> + /* Get CRM registers from the second reg entry */
> + crm_res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
devm_platform_ioremap_resource()
> + /*
> + * Hardware limitation workaround:
> + *
> + * Our platform supports 64-bit physical addressing, but the eMMC
> + * controller's SRAM-based DMA engine is constrained to a 32-bit
> + * address space. When using the standard SDHCI interface, which
> + * allocates DDR-based DMA buffers with 64-bit addresses, the
> + * dma_map_single() operation fails because the DMA engine cannot
> + * handle addresses beyond 32 bits.
> + *
> + * To resolve this hardware limitation, we implement a bounce buffer
> + * allocated via dma_alloc_coherent() to satisfy DMA addressing
> + * constraints.
> + */
> + err = bst_sdhci_reallocate_bounce_buffer(host);
Having an explanation here makes sense, but I don't think this
captures what is actually going on, in particular:
- dma_alloc_coherent() being backed by an SRAM that is under
the 4GB boundary
- the problem that the SoC is configured that all of DRAM
is outside of ZONE_DMA32
- The type of hardware bug that leads to 64-bit DMA being
broken in this SoC.
I still have some hope that the hardware is not actually
that broken and you can get it working normally, in one
of these ways:
- enabling 64-bit addressing in the parent bus
- enabling SMMU translation for the parent bus
- configuring the parent bus or the sdhci itself to
access the first 4GB of RAM, and describing the
offset in dma-ranges
- moving the start of RAM in a global SoC config
It is rather unlikely that the SoC designer chose to
integrate a 32-bit-only device without adding some
way to configure it to access RAM.
Arnd
next prev parent reply other threads:[~2025-07-02 10:40 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-28 8:54 [PATCH v1 0/9] arm64: Introduce Black Sesame Technologies C1200 SoC and CDCU1.0 board Albert Yang
2025-07-02 9:44 ` [PATCH v2 0/8] " Albert Yang
2025-07-02 9:44 ` [PATCH v2 1/8] dt-bindings: vendor-prefixes: Add Black Sesame Technologies Co., Ltd Albert Yang
2025-07-02 10:24 ` Krzysztof Kozlowski
2025-07-03 5:02 ` Albert Yang
2025-07-02 9:44 ` [PATCH v2 2/8] dt-bindings: arm: add Black Sesame Technologies (bst) SoC Albert Yang
2025-07-02 9:44 ` [PATCH v2 3/8] arm64: Kconfig: add ARCH_BST for bst silicons Albert Yang
2025-07-02 12:21 ` Krzysztof Kozlowski
2025-07-03 9:22 ` Albert Yang
2025-07-02 9:44 ` [PATCH v2 4/8] dt-bindings: mmc: add binding for BST DWCMSHC SDHCI controller Albert Yang
2025-07-02 13:28 ` Rob Herring (Arm)
2025-07-03 4:36 ` Albert Yang
2025-07-02 14:23 ` Rob Herring
2025-07-03 3:27 ` Albert Yang
2025-07-02 9:44 ` [PATCH v2 5/8] mmc: sdhci: add Black Sesame Technologies BST C1200 controller driver Albert Yang
2025-07-02 10:40 ` Arnd Bergmann [this message]
2025-07-11 5:55 ` Albert Yang
2025-07-11 6:55 ` Arnd Bergmann
2025-08-08 8:39 ` Albert Yang
2025-08-08 9:35 ` Arnd Bergmann
2025-07-02 10:47 ` Krzysztof Kozlowski
2025-07-02 9:44 ` [PATCH v2 6/8] arm64: dts: bst: add support for Black Sesame Technologies C1200 CDCU1.0 board and defconfig Albert Yang
2025-07-02 10:30 ` Krzysztof Kozlowski
2025-07-02 12:31 ` [PATCH v2 6/8] arm64: dts: bst: add support for Black Sesame Technologies C1200 CDCU1.0 board Albert Yang
2025-07-02 14:19 ` Rob Herring
2025-08-12 9:47 ` Albert Yang
2025-08-12 11:01 ` [PATCH v2 6/8] arm64: dts: bst: add support for Black Sesame Technologies C1200 CDCU1.0 board and defconfig Albert Yang
2025-07-02 12:15 ` Robin Murphy
2025-07-02 9:44 ` [PATCH v2 7/8] arm64: defconfig: enable BST C1200 DWCMSHC SDHCI controller Albert Yang
2025-07-02 10:25 ` Krzysztof Kozlowski
2025-07-02 9:44 ` [PATCH v2 8/8] MAINTAINERS: add and consolidate Black Sesame Technologies (BST) ARM SoC support Albert Yang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53ba18c1-4554-4d77-84fd-d921febb7559@app.fastmail.com \
--to=arnd@arndb.de \
--cc=adrian.hunter@intel.com \
--cc=andersson@kernel.org \
--cc=ben.chuang@genesyslogic.com.tw \
--cc=bigfoot@classfun.cn \
--cc=bst-upstream@bstai.top \
--cc=catalin.marinas@arm.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=ebiggers@google.com \
--cc=geert+renesas@glider.be \
--cc=geert.uytterhoeven@gmail.com \
--cc=gordon.ge@bst.ai \
--cc=jonathan.cameron@huawei.com \
--cc=kever.yang@rock-chips.com \
--cc=krzk+dt@kernel.org \
--cc=krzk@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=mani@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=nfraprado@collabora.com \
--cc=nm@ti.com \
--cc=quic_tdas@quicinc.com \
--cc=robh@kernel.org \
--cc=shanchun1218@gmail.com \
--cc=soc@lists.linux.dev \
--cc=ulf.hansson@linaro.org \
--cc=victor.shih@genesyslogic.com.tw \
--cc=will@kernel.org \
--cc=yangzh0906@thundersoft.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®