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 phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 553E0C433EF for ; Sun, 16 Jan 2022 20:18:36 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8DC4D8355A; Sun, 16 Jan 2022 21:18:33 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="EN8lZYZk"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D1E7283559; Sun, 16 Jan 2022 21:18:31 +0100 (CET) Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 7B5A581982 for ; Sun, 16 Jan 2022 21:18:28 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=alpernebiyasak@gmail.com Received: by mail-ed1-x536.google.com with SMTP id 15so23705417edx.9 for ; Sun, 16 Jan 2022 12:18:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ywX0hQ6rhx3YgLMRyCrUQU2Ctnntfu9wv053w7odVvI=; b=EN8lZYZktrUjMONe9iwmwS2S3BHS3+gjZ/GDl54k38QnIgc33h6Alia7op1At1pV+b dYpmUV4rFcJFA630vGTS3FdAyFNZXFfJiQXrm2NbuyTD2uwLqh64gkUPvaSvIYQ4xpsq StRoIMmEYCTM//bu+I+O211Om7lVkSOFMRW/bxnHCdo/9GUguitcrBc804UY3uRCxhl7 +6+1n3MocxwekLV61j8svJFKVviBhMicAsGXvS9er0FD/tBuvj7ZLGWdJRDstv0ECN8I /0FFt39oBBLY+kCqxLD9g3Jf4mlPEvaGIxMupgm/zuw5ub8zrPc2bNGQI8/c9DGXNRRD Fg3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ywX0hQ6rhx3YgLMRyCrUQU2Ctnntfu9wv053w7odVvI=; b=jf37hnbGZ2cnxkGFVzocoS2nYSF4vEQK2lkLbqRXB4ze1HK75a1LbqvhbyQVeL0xO0 aP+/O8pfY6aSTXNbz1KNKRPGdC0D4epjHk/MH0tOpqHiZNNFSRaS7ySY/n12RR7Mm31t GpgO6Le2QV5F7bt3bgyWyCbURd4tQoLsL2swGjydcZYaVXgH6ftfY3zY04Mtw/EpBz9D mKDaFb/KgCDz25fKU99/eanrmWjZeRKpmwvn0pKiwoUy/lPEMGn0phWiFpYCzJmU3QaV guf0r0/ExEBasxHb0o+4YpAn91yNaOMhakVXqoSi0HG8fs9K63LXsc0atbaNeXrTvSxf Sd3A== X-Gm-Message-State: AOAM531fxZd7Vs8w+UvlyYxarBnp2eq6byKX+fH/qnnqtobhKnJFTzDs xF1J4tivwi45RjILQsGlDauVWR3ISgc= X-Google-Smtp-Source: ABdhPJwhr/hK9bHixNG+fDH9H7edAVopi9bSydTYD5b8om2gj6NP8gCHMlQbAgOWJLimK7woQQKmWg== X-Received: by 2002:aa7:c6d7:: with SMTP id b23mr16720878eds.277.1642364308091; Sun, 16 Jan 2022 12:18:28 -0800 (PST) Received: from localhost.localdomain ([178.233.26.119]) by smtp.gmail.com with ESMTPSA id b10sm4872469edu.42.2022.01.16.12.18.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 Jan 2022 12:18:27 -0800 (PST) From: Alper Nebi Yasak To: u-boot@lists.denx.de Cc: Aswath Govindraju , Kever Yang , Philipp Tomsich , Samuel Dionne-Riel , Stephen Carlson , Peter Robinson , Faiz Abbas , Jack Mitchell , Simon Glass , Jaehoon Chung , Ashok Reddy Soma , Michal Simek , Peng Fan , Yifeng Zhao , Jagan Teki , Alper Nebi Yasak Subject: [PATCH v3 0/4] rockchip: sdhci: Fix reinit and add HS400 Enhanced Strobe support Date: Sun, 16 Jan 2022 23:18:09 +0300 Message-Id: <20220116201814.11672-1-alpernebiyasak@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.103.2 at phobos.denx.de X-Virus-Status: Clean My rk3399-gru-kevin has some problems with the eMMC. The board can boot to U-Boot proper with the eMMC working at a low speed, but trying to reinitialize it with "mmc dev 0" or "mmc rescan" makes it unusable. If the HS400 mode is enabled, it times out while executing tuning and doesn't even start at a working state. To work around these errors, I had implemented support for the HS400 Enhanced Strobe mode as the first version of this series. I have also managed the fix the issue above (related to power-cycling the eMMC PHY), which exposed another one with this series: reinitialization at lower speeds fail if the ES bit is set. Since fixing that needed changes to this series I decided to send the previous fix as part of this instead of as an independent patch. To test, I'm building with the following configs enabled: +CONFIG_MMC_SPEED_MODE_SET=y [...] CONFIG_MMC_PWRSEQ=y +CONFIG_MMC_IO_VOLTAGE=y +CONFIG_MMC_UHS_SUPPORT=y +CONFIG_MMC_HS400_ES_SUPPORT=y +CONFIG_MMC_HS400_SUPPORT=y CONFIG_MMC_DW=y CONFIG_MMC_DW_ROCKCHIP=y CONFIG_MMC_SDHCI=y +CONFIG_MMC_SDHCI_SDMA=y CONFIG_MMC_SDHCI_ROCKCHIP=y and running roughly: $ mmc rescan [0|1|3|10|11|12] $ mmc info $ mmc part $ load mmc 0:1 0xd0000000 256MiB.bin $ load mmc 0:1 0xd0000000 16MiB.bin $ load mmc 0:1 0xd0000000 8MiB.bin I used to test by loading different sizes from a very big file (~7GiB), but that's slower than reading fixed-size files for some reason I don't know. I thought loading full files would be a better test so I switched to those. Here's the differences in info and speeds I get with this: Mode | Bus Speed | Bus Width -----------------------+--------------+-------------- MMC Legacy | 25000000 | 8-bit MMC High Speed (26MHz) | 26000000 | 8-bit MMC High Speed (52MHz) | 52000000 | 8-bit HS200 (200MHz) | 200000000 | 8-bit HS400 (200MHz) | 200000000 | 8-bit DDR HS400ES (200MHz) | 200000000 | 8-bit DDR Mode | 256 MiB Load | 16 MiB Load | 8 MiB Load -----------------------+--------------+--------------+-------------- MMC Legacy | ~22.1 MiB/s | ~21.9 MiB/s | ~21.6 MiB/s MMC High Speed (26MHz) | ~22.1 MiB/s | ~21.9 MiB/s | ~21.6 MiB/s MMC High Speed (52MHz) | ~43.7 MiB/s | ~42.8 MiB/s | ~41.7 MiB/s HS200 (200MHz) | ~161.2 MiB/s | ~149.5 MiB/s | ~137.9 MiB/s HS400 (200MHz) | ~254.5 MiB/s | ~235.3 MiB/s | ~216.2 MiB/s HS400ES (200MHz) | ~254.7 MiB/s | ~238.8 MiB/s | ~216.2 MiB/s Hope I haven't missed anything. Enabling the configs above for each board is left to board maintainers as I can't test on those boards. As an aside, I want to further clean up this driver when I have the time (it's a weird combination of what could be three different drivers), but wanted to send this as it at least gets the driver to a working state. Changes in v3: - Set DWCMSHC_CARD_IS_EMMC bit in rk3568_emmc_phy_init() v2: https://patchwork.ozlabs.org/project/uboot/list/?series=280494 Changes in v2: - Add patch to fix PHY power cycling at higher speeds - Unset ES bit in rk3399 set_control_reg() to fix a reinit issue - Don't use unnecessary & for function pointer in ops struct - Rename rk3399_set_enhanced_strobe -> rk3399_sdhci_set_enhanced_strobe - Rename rk3568_set_enhanced_strobe -> rk3568_sdhci_set_enhanced_strobe - Let set_enhanced_strobe() unset the ES bit if mode is not HS400_ES - Rewrote cover letter v1: https://patchwork.ozlabs.org/project/uboot/list/?series=269768 Alper Nebi Yasak (4): mmc: sdhci: Add HS400 Enhanced Strobe support rockchip: sdhci: Fix RK3399 eMMC PHY power cycling rockchip: sdhci: Add HS400 Enhanced Strobe support for RK3399 rockchip: sdhci: Add HS400 Enhanced Strobe support for RK3568 drivers/mmc/rockchip_sdhci.c | 136 ++++++++++++++++++++++++++++++++--- drivers/mmc/sdhci.c | 18 +++++ include/sdhci.h | 1 + 3 files changed, 145 insertions(+), 10 deletions(-) -- 2.34.1