From patchwork Tue Jun 9 14:01:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1351 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-oo1-f71.google.com (mail-oo1-f71.google.com [209.85.161.71]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id AA7173F08B for ; Tue, 9 Jun 2020 16:01:54 +0200 (CEST) Received: by mail-oo1-f71.google.com with SMTP id e12sf6422458oob.10 for ; Tue, 09 Jun 2020 07:01:54 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1591711313; cv=pass; d=google.com; s=arc-20160816; b=vEF8pKJaJbV9F/Kwa5dVxxa85K214G1PqKLanpKqswI1NIXIQ8BNmtTSX//JQoR+g6 TgCAWcRl0g2s4rnIZo0fJ5qLoxRw+EKwAS3okYgGDZRo8MlNIufnDKE/i+Ib2fu9ph0J j7gbTi8GXnTsgbHR+GQ8oavXKAjdLsiS2QXOf4Zc2CBXEPns+lquaZ4v4q1+C8plCUcJ Mjedt8PVz2uk6XPXHU+pMTU9IpQe4TI06Z2Qf11dczq8j1/0FMGXuoBDVrIQIpAaYh2U HtKQVtz5YiM4HALs+mjk3MxTSSZ+4IrfgMVCXWTLqnh6CDromZc1J6WEKqT0PuaBdZZk NcDg== 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=nvQH/boMBB8xlyEeNrEOcbNbVpV3kY0AOlqrfFIKApg=; b=MJ6R2YyBV6IODTgilYZ1r6VP6od6j0LhbAXBt/p5qjXA4ArNa0ELURm0MVLaZvFHwA SzkADhZ69uKYZ6QrHcNKo8D0cqOM6nIO34jdYDtc92xNGINzfdENNRB3+8ojNgKbbGag yY7b2ViJC1SL4ZMdQnyeOx8VATDfFzMsdFvI8rSpM2jYpO6ev3gJmyJK1S60GDcruj+7 W/XHfLidizBzFmRYZu8ex38qwWdySaQXpSpD1K4qluMXKwNqxUvCwhz/KvNi0+D86ZL+ EWu4nXGL2pUe2TbErm1Bz7Z8jLseZEhj1n6gJQep+tScknAxJvXin75K1/hqRWb4gO4e S8Ew== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="i4kVO/f+"; 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=nvQH/boMBB8xlyEeNrEOcbNbVpV3kY0AOlqrfFIKApg=; b=QA4/EjSEBFIqrQ14YEVMQlR4Vt0caKI65Wr0UBN4TyCPCsgRYa20FBDKItrglJq4aw ebTb5PlQbuFy/7gwDfYZ2dju8dECOi21Gh9QqpYxJRs8VZbJsk51NjrMMg4tyW55+/wN 3UhmFyBVNKg/0UTCex1KAAxrLlINjf2awQtqk= 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=nvQH/boMBB8xlyEeNrEOcbNbVpV3kY0AOlqrfFIKApg=; b=hEz2v/+0YaqoYxyKpPukL/2+LUVYqZ6hdf8MB6rMUIASkVA/rY3pZhuW83YvQ6lQf7 fs1Oe+ND9tjDwpabB/N/KItj8SMjOcpoUvGjktVCcuw3h28AWlQNYu4IGkSDPhM9IvZZ pKBOYE6Kvpg5zfHO0zktjrGb2WIEeH8nmUFOwbpwGhFtpR2KwOtzpzcGWcypLkWXHupw aEwLnyHrFOSWgHRgrpEp/cImS2kqhknqq2xRLVNFP1OY0sh78gXapBtjiCfS+YtPBs/n OpTg53UI1WlmazzTZTxj3/zGGd5e1/kmvo+6MBepvLbuBP3R7Asv9X+LrVXBsPkA89mA cFaA== X-Gm-Message-State: AOAM533OF6bU7AkFtqLuYN/7ZHlbW/CkWciCC2r92dnQpVERnjobAprX dxuWbc+zbJJBhgx4WvBaPlIqaoBd X-Google-Smtp-Source: ABdhPJwXMVfKcFBd5jCXwrxmrA8BzpyxSbejfkFI2bXKq30tyJE8yJkbjaiSP3QP6jXguSQd39U0FA== X-Received: by 2002:aca:e041:: with SMTP id x62mr839284oig.167.1591711312695; Tue, 09 Jun 2020 07:01:52 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:aca:5788:: with SMTP id l130ls3902149oib.2.gmail; Tue, 09 Jun 2020 07:01:52 -0700 (PDT) X-Received: by 2002:a54:4d85:: with SMTP id y5mr3519986oix.130.1591711311958; Tue, 09 Jun 2020 07:01:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591711311; cv=none; d=google.com; s=arc-20160816; b=mB8dhV5wN6frhMWebW3lz6o0kqBilSUriRkihV6onywMbcUG/9zAXBTS2924rqhweC M+fB7d3j+0gaJUn+Q1WRpooUxkABetlywA2txvd50xStyTLRnyjrK2X4dbpq0fOQGdN7 mtA0HVufrpomHKOL5FZxzH6aMoubxkuoZE7RmTvAZCgpq8mi/W7ZEFaAZS2IxfxUa1qp XZpSoWiLjFMgE3oSQs9Ek2MhP/ESgtDI6+VVoQsr9kC0vbubPx4aCyIBunGM1eQhDkoY 4Ahbd052Ab1NuA0WHE7kKg0d+Y8AC1zD3zLeZzrKrUDS21gCobk0pJQGC+S3n71cqEW3 H3cg== 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=+syYf3Iu8KI6vyzKsTtZsCb86l6VKxYSmzVMN6y0iz8=; b=sZxL3Ndb8oYs0s78GMSUbDA+vW4XzIS9zhnFYMvT39MPcX0zFzZpx4UXKirlP8H0ow +IoXZxhpYMZuy3VRfqcoXk+F5DoEvGjbzNi7AHo5YWstfo5S9X9F9I4ZSTowI8ataAxB FqV3lOELJc/k1HqpL649E/HQAWe3zOG2ghX200GnH9fV+lXttodhDaUH+3UiQalATqL9 PQ29FipLIliv3nA2UfiP9K0qHbnUxy/lUHvFsYp9q17hsHYD36ibtdoIEbNxu1Pf+KXr pFLa8BvTmzi2VvQoxqSlPMy0CCHK6WeWMVf2Gn7sm8EqdlEx0rK9JOumrHXtwJj0TdQf ogZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="i4kVO/f+"; 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 u13sor2007381ybp.76.2020.06.09.07.01.51 for (Google Transport Security); Tue, 09 Jun 2020 07:01: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:a17:90b:46ca:: with SMTP id jx10mr5233852pjb.3.1591711310362; Tue, 09 Jun 2020 07:01:50 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c809:c7d5:6575:fcd2:e4d4:715a]) by smtp.gmail.com with ESMTPSA id u5sm2703776pjv.54.2020.06.09.07.01.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jun 2020 07:01:49 -0700 (PDT) From: Jagan Teki To: Peng Fan , Jaehoon Chung , Kever Yang Cc: sunil@amarulasolutions.com, u-boot@lists.denx.de, linux-rockchip@lists.infradead.org, linux-amarula@amarulasolutions.com, Jagan Teki Subject: [PATCH v2] mmc: sdhci: Fix HISPD bit handling Date: Tue, 9 Jun 2020 19:31:35 +0530 Message-Id: <20200609140135.131887-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="i4kVO/f+"; 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 Reviewed-by: Jaehoon Chung Signed-off-by: Jagan Teki Tested-by: Marc Zyngier --- Changes for v2: - collect Jaehoon R-b 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);