From patchwork Wed Dec 30 17:39:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Ford X-Patchwork-Id: 1421433 X-Patchwork-Delegate: sbabic@denx.de 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=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=D6JtCMI6; dkim-atps=neutral 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 4D5dpC6KDCz9sVM for ; Thu, 31 Dec 2020 04:39:41 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 850BD824DE; Wed, 30 Dec 2020 18:39:29 +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="D6JtCMI6"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8705482540; Wed, 30 Dec 2020 18:39:27 +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=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd35.google.com (mail-io1-xd35.google.com [IPv6:2607:f8b0:4864:20::d35]) (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 7DC9E82496 for ; Wed, 30 Dec 2020 18:39:24 +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=aford173@gmail.com Received: by mail-io1-xd35.google.com with SMTP id y5so15281860iow.5 for ; Wed, 30 Dec 2020 09:39:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=2Fj8wk/WX3XUnaLKDMIOyonytt8XYvE5TMuoWHeKq44=; b=D6JtCMI6OVpseZAXkIct+DKn+Y+4gDRKFrP2/rbJC1Y5YtfeZd4P3q+8AxZxgWvASG CNRtBKNwMPOCyeHMZoJK/hDOTuaeQx23MYZGna/LGSNKYr4ZUbGcdgDHTBEzyV4LMgRV 1M5HehMIKK3RjXCeE9Zt5H9dh4Ni5Ru5b/w/MLDIpUzhI97AhsxbiRThfYbN9AeM683/ rrkGWPymgEnqTikVrrUygV3Y0yI/K04uLTKYi2pDkagwSWhfxsWmmNMqDFVyTEPk91gy MSimiPM1JQAgRQVrdoXfPqpih/usZgUV0rZS2AkAPsQeWttLRk9si4V6u2UH1p/En6IN NDyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=2Fj8wk/WX3XUnaLKDMIOyonytt8XYvE5TMuoWHeKq44=; b=Y9vToJH6UEpMji335BMPhP0kIuusWFtuNUUzKcZmjvujnhxpeC6vpeQe4iMjgqBH/C xVIhWqUNhof7iJI8PRrc1kqSFhT5N3x+ivJX6n5s/SljtdIiHwuQ+OYhQ/eMu11zfdZX RNyB2Emx86ZWyr/ojB6H8RAv8rP6++teasHcSXMfzalToFOUKH5UG9xd/6B8UspNqJ8f zkjvhewuA1Z7nfbyk+t9lA+sVL2zVw5Us+eE4Iotzy42JFBM1dwgd/gGndGCgUtyh56A /yaDLH4jlym8bpQCakD1RpR4e0gBwrWdaLk3fwgOn/dsLKwevfZmplPLbcfBBIg6xiO1 wkFA== X-Gm-Message-State: AOAM532bUcEakGsIS4og6zdsQcHGCB6daiBKknQsYXWHpkAY5lbrqWCy vVj5tLnBstU/CW2+64fxOiHNZCeWb0CJ6g== X-Google-Smtp-Source: ABdhPJw0Cz8x/mJznzsgEViNIBwGiS85hIgwAW+eUc3DFjdwN8GByaUn5eECnKe3cn9+oJ6ZgI1j1w== X-Received: by 2002:a05:6602:1d4:: with SMTP id w20mr44662136iot.25.1609349962731; Wed, 30 Dec 2020 09:39:22 -0800 (PST) Received: from aford-IdeaCentre-A730.lan ([2601:448:8400:9e8:f45d:df49:9a4c:4914]) by smtp.gmail.com with ESMTPSA id j65sm32609938ilg.53.2020.12.30.09.39.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Dec 2020 09:39:22 -0800 (PST) From: Adam Ford To: u-boot@lists.denx.de Cc: jh80.chung@samsung.com, aford@beaconembedded.com, andrey.zhizhikin@leica-geosystems.com, Adam Ford , Fabio Estevam , Peng Fan Subject: [RFC] mmc: fsl_esdhc_imx: Use esdhc_soc_data flags to set host caps Date: Wed, 30 Dec 2020 11:39:07 -0600 Message-Id: <20201230173907.2891555-1-aford173@gmail.com> X-Mailer: git-send-email 2.25.1 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 The Linux driver automatically can detect and enable UHS, HS200, HS400 and HS400_ES automatically without extra flags being placed into the device tree. Right now, for U-Boot to use UHS, HS200 or HS400, the extra flags are needed. Let's go through the esdhc_soc_data flags and enable the host caps where applicable. Suggested-by: Fabio Estevam Signed-off-by: Adam Ford --- I am not an expert on the SD/MMC standards, but I used the Linux driver as a model, and made the assumption that the USDHC flag needs to be set in order to use the extra speeds. diff --git a/drivers/mmc/fsl_esdhc_imx.c b/drivers/mmc/fsl_esdhc_imx.c index e5409ade1b..3f1774551a 100644 --- a/drivers/mmc/fsl_esdhc_imx.c +++ b/drivers/mmc/fsl_esdhc_imx.c @@ -1293,8 +1293,30 @@ static int fsl_esdhc_init(struct fsl_esdhc_priv *priv, val |= ESDHC_TUNING_CMD_CRC_CHECK_DISABLE; esdhc_write32(®s->tuning_ctrl, val); } - } + if (CONFIG_IS_ENABLED(MMC_UHS_SUPPORT)) { + cfg->host_caps |= MMC_CAP(UHS_SDR12); + cfg->host_caps |= MMC_CAP(UHS_SDR25); + cfg->host_caps |= MMC_CAP(UHS_SDR50); + cfg->host_caps |= MMC_CAP(UHS_SDR104); + cfg->host_caps |= MMC_CAP(UHS_DDR50); + } + + if (CONFIG_IS_ENABLED(MMC_HS200_SUPPORT)) { + if (priv->flags & ESDHC_FLAG_HS200) + cfg->host_caps |= MMC_CAP(MMC_HS_200); + } + + if (CONFIG_IS_ENABLED(MMC_HS400_SUPPORT)) { + if (priv->flags & ESDHC_FLAG_HS400) + cfg->host_caps |= MMC_CAP(MMC_HS_400); + } + + if (CONFIG_IS_ENABLED(MMC_HS400_ES_SUPPORT)) { + if (priv->flags & ESDHC_FLAG_HS400_ES) + cfg->host_caps |= MMC_CAP(MMC_HS_400_ES); + } + } return 0; }