From patchwork Sun May 24 17:25:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1223 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 05B263F0D6 for ; Sun, 24 May 2020 19:25:55 +0200 (CEST) Received: by mail-pf1-f199.google.com with SMTP id a85sf12580471pfa.7 for ; Sun, 24 May 2020 10:25:54 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1590341153; cv=pass; d=google.com; s=arc-20160816; b=fun23Lv3/H1QBo5eng09jjDaUgd4uenHv90uUSgB+mVMkPtmZa0wg25BydbvPTYTpU R0OxnVffxX1Iugal7ss6IgrN9149c+uaY54AsuPoZIlB9c3x0W2ojes24GxPxH5u871z UfQBkpuItCvWcPzNXIEMxe2zIPs2wXXwejHinBDDFDecyC0L0Aggeee2tHyI2pHham4J KtOn5ge9tDyWCbvYrbMX3EgHlSRGFg4fiRPFnYGj3YhupcxIPDid1mS9GjaxwCBP3fau ZkUqyvYAY+4HapzOggwe+FtkFmb3N5hUOMNTuSmIZQsAHrRF5i70j3jOoy3dHKyohkXw Jjtw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:message-id:date:subject:cc:to :from:dkim-signature; bh=9VeAWHXxweH9xw9AmDnYUzHyF9/Dhs6ONqOETLaTQg4=; b=DDuueI+TppgXHuIuWQtZ4f60ffdPbSfM8djv574FtHTnHFVlWGEPnbvrKOaK3qQw4f EEtPremR7bBOgnW/0uR3Ddjoyh9vrNBvUMZEbrdMQwshYum0wigtt2KZ43ICfAue3eRr B8otrIDGYdUcWoGxtvfYPB55E7fM5CszZIPh6Cl9vqM5eRhdJHIp311xsI7CRClscFHv rpeNwY9nKgPfog+EPKsZRElEyhdt3BRszcYqcbaiYO23PW7wsU5oilHy1pE2uiL8ceCM PcGsIK+j8zBeDXOzJIrlKTvT3+jEZvX2HGWR94c5dMYU3kS/okXP/+cLRJyZnZ/vWAv9 0dxw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=WQ7SX5TB; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=9VeAWHXxweH9xw9AmDnYUzHyF9/Dhs6ONqOETLaTQg4=; b=pRmeGeJYCSdepNf8GgAwHipzC1MzUCJOdIpKbQOHh1+uwOagUsIGBm0pVFp+gGfBpz Yq5ILl6DSu3/BiFyBPxfy9UYzA4nZcWOJMeaCweXXCdaameMbc5yLIf7vytNMTP/1R/2 VLJCu4Bl1rZlBHei3SIm9MhDTqXpDXnPbx8QU= 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 :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:x-spam-checked-in-group:list-post:list-help :list-archive:list-unsubscribe; bh=9VeAWHXxweH9xw9AmDnYUzHyF9/Dhs6ONqOETLaTQg4=; b=m+OXlNXq/DH19oyB7fNIYZfrSjaxaluCLYszfYs7rXhsDvRQTj7JW4SGPc7I4Qs7TG 0kkjHAD+Im+ShWCL4Dno8LX1PxJQec53emD/Zq69DDbJWqlz8wz4hFk8MF7AJ8aqXZW/ EmICYP2d2F5XeEVNU7iwixjr/cwfqKXNgy6LfeXPk7tUC+KFglfNuwRksPBxMaEiJ5qY Ojba2uDSyoa+WGtB84YD0z4/Qm7xFOq+6nzitOpC7WgLl5nNo7FbB9Wd0x1WU8QtzkrB q3FGROuZyi5lv2jrv6dC4Lcwt9KNvHaOb8T6dxHozRujHACww7E84GiH+LOVySZnJlvn wMvA== X-Gm-Message-State: AOAM530iMVeu0jXU7vaA/+uYYSt1u0oCyrbedyUCnhV4TgAbnYMwtv4U eISXckwCqtnH3H0qEY0k2R2JxCW5 X-Google-Smtp-Source: ABdhPJwDZLjkrHTN9NnGo0g4JDdHIw4vmGfyAN/9BCqFlwCo27eUIRto2NDKOK2iIGuSn4VafbZ4Iw== X-Received: by 2002:a63:ae44:: with SMTP id e4mr23236445pgp.428.1590341152926; Sun, 24 May 2020 10:25:52 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:d684:: with SMTP id v4ls2896426ply.11.gmail; Sun, 24 May 2020 10:25:52 -0700 (PDT) X-Received: by 2002:a17:902:23:: with SMTP id 32mr24330083pla.40.1590341152390; Sun, 24 May 2020 10:25:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590341152; cv=none; d=google.com; s=arc-20160816; b=DK1ypO5e7i1IPpg7xAAIQmLGK3ktUrmRV6Z7RoYGwkgaSxRSmfxK7zN2nM3aYcT6q/ yR0xP/+tQqfGQJUgYnZ9fp3lvkQic0BBtp0g1mixlCIN1LBywGrWsvLWQ0vOK/8FYkYe gnKe9cGdnS3FxIzxK066Q9w2y7UVtH8RPF1DcRiDblrLkmx1Az0Pc5BiSRHJnGolmnd0 U8QIXSbEYxwPK2mfXLcABafO+o6y5cjrje8aGm8UkXUAY3v29SStfgE+Y7ABhtXxbV6O akeHir7n4iLQIZbDLTyEoWkf8cVRV/YU+VVw0q4+cxpS8BFSGm3qvKiozrNibn/izBNg 4fAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=LH+j/67x/4dIo71GPtjk4zKaZjV6SuPULRXWrG4j6pc=; b=saQRa5tAoT6Vx8alK+kIgLozeG7rlTvOgoWra2dQPmxAV53hvkbFriEBwje2vYaBeP +L75u4O6uxCIjRXWbta5OaiQhqLJmX2eqjrE4Lq6PkWvWOJrK8rj67vq9REuasFVsQlq 30fT4gg/4TJPkc3hmMB1gJcjiCCtWlLy3L6vjPJ2x4gXzfTXDBu8dJDy7JQ1xGyRhNUn IymTpGlP1tMF4BQ1YdtGUQQDhmMNw263otgnes1Z77aW5Q4gFazbWVPoU/pI4btS3nqc 6U5LYPkcGtcS29BQeSv6HBTh0w0fpFk68NHXQZZWCK/H1DyUDgKUn/0zcZbHsCjlFFes UEAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=WQ7SX5TB; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id x133sor19567313pfd.30.2020.05.24.10.25.51 for (Google Transport Security); Sun, 24 May 2020 10:25:51 -0700 (PDT) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; X-Received: by 2002:a62:1702:: with SMTP id 2mr13705712pfx.243.1590341151215; Sun, 24 May 2020 10:25:51 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c809:c7d5:9b1:856c:6c2b:bde7]) by smtp.gmail.com with ESMTPSA id i3sm11279525pfe.44.2020.05.24.10.25.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 May 2020 10:25:50 -0700 (PDT) From: Jagan Teki To: u-boot@lists.denx.de Cc: sunil@amarulasolutions.com, linux-rockchip@lists.infradead.org, linux-amarula@amarulasolutions.com, Jagan Teki , Kever Yang , Peng Fan Subject: [PATCH] mmc: sdhci: Fix HISPD bit handling Date: Sun, 24 May 2020 22:55:13 +0530 Message-Id: <20200524172513.199962-1-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=WQ7SX5TB; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , SDHCI HISPD bits need to be configured based on desired mmc timings mode and some HISPD quirks. So, handle the HISPD bit based on the mmc computed selected mode(timing parameter) rather than fixed mmc card clock frequency. Linux handle the HISPD similar like this in below commit, commit <501639bf2173> ("mmc: sdhci: fix SDHCI_QUIRK_NO_HISPD_BIT handling") This eventually fixed the mmc write issue observed in rk3399 sdhci controller. Bug log for refernece, => gpt write mmc 0 $partitions Writing GPT: mmc write failed ** Can't write to device 0 ** ** Can't write to device 0 ** error! Cc: Kever Yang Cc: Peng Fan Signed-off-by: Jagan Teki Reviewed-by: Jaehoon Chung --- drivers/mmc/sdhci.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c index 92cc8434af..280b8c88eb 100644 --- a/drivers/mmc/sdhci.c +++ b/drivers/mmc/sdhci.c @@ -594,14 +594,21 @@ static int sdhci_set_ios(struct mmc *mmc) ctrl &= ~SDHCI_CTRL_4BITBUS; } - if (mmc->clock > 26000000) - ctrl |= SDHCI_CTRL_HISPD; - else - ctrl &= ~SDHCI_CTRL_HISPD; - - if ((host->quirks & SDHCI_QUIRK_NO_HISPD_BIT) || - (host->quirks & SDHCI_QUIRK_BROKEN_HISPD_MODE)) - ctrl &= ~SDHCI_CTRL_HISPD; + if (!(host->quirks & SDHCI_QUIRK_NO_HISPD_BIT) || + !(host->quirks & SDHCI_QUIRK_BROKEN_HISPD_MODE)) { + if (mmc->selected_mode == MMC_HS || + mmc->selected_mode == SD_HS || + mmc->selected_mode == MMC_DDR_52 || + mmc->selected_mode == MMC_HS_200 || + mmc->selected_mode == MMC_HS_400 || + mmc->selected_mode == UHS_SDR25 || + mmc->selected_mode == UHS_SDR50 || + mmc->selected_mode == UHS_SDR104 || + mmc->selected_mode == UHS_DDR50) + ctrl |= SDHCI_CTRL_HISPD; + else + ctrl &= ~SDHCI_CTRL_HISPD; + } sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL);