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 28DD9C636CC for ; Tue, 31 Jan 2023 12:45:55 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3C937859EF; Tue, 31 Jan 2023 13:45:53 +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="PL7seVaX"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 415B985635; Tue, 31 Jan 2023 13:45:35 +0100 (CET) Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) (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 B2C57859EF for ; Tue, 31 Jan 2023 13:44:45 +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=jh80.chung@gmail.com Received: by mail-pj1-x102a.google.com with SMTP id ha3-20020a17090af3c300b00230222051a6so642947pjb.2 for ; Tue, 31 Jan 2023 04:44:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=rh4uVAnCJcewWnnrQELLGXrfJ8t5OdAVauN2dRy2UZw=; b=PL7seVaXEz+JsdTsH+kxk5xsPFBofqjs76OahmSC4PGx5yQplUCKXhnDE5kwuh0Na4 4hWsOlZ1gAMxcPSBOKkv2s+TRWYy7K5/0y0mA/mpz9HDuoSLgjlK+VQilXIFwAqcVQNh qZVSUTW17wUqtiqf/P7yWnSPRAxe45RaS/bjDj8ujhM90TnwQ41IIwvgw9Qm8LH3bnUg rwCvQYE9WluqaaamHu660H1ndsNxxsOKOIbk66fi+O/VdBAa3POvuyweFZ3Wq69SnVxv m/Bk/IhepGW07sTCi5hOeA8gmXz8db7X8NJokKO5soowxSymhxgR57OxnyxxIQjuNRH+ dgww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=rh4uVAnCJcewWnnrQELLGXrfJ8t5OdAVauN2dRy2UZw=; b=bpbaXvp74QFIpIRTt3KL50T9oH10nPoCgT4t/M66wSHik8dKLbWm6UrIA0eVDkASBB ocdkABzpBNwcyKYuSyRcbioIxTCeMok7WuS72NusBgP6QLo6V6QXaJkJ5FGA9iH15Mt0 d3+rewhiQKfHJDcrpX22xESmszpKG2FgtDqcvs+F8k9sHVQYSF/abzBG2m9r5THn6JkN wIJfUq5eUAMscdWC9xDASTBKbwmK3o4Rde0rvJHHKr70c4coHkYTzA2nJ+yBDCLSBtkX UON7VCrNmaf2G+4+XW5krtBStk09Lz6xMr5JEIJYSae67BP0JSPE0M3KObssGH3yWMGA JzCw== X-Gm-Message-State: AO0yUKUNJAHfG8o/egS4GRaAik3JFY+LAxwy1jyIVsNIsuzTApfq42tB RU8Sfrp33TIEF835eboSd2z18LIiZ2bsFw== X-Google-Smtp-Source: AK7set82QA+SWLMeZ8/AUzINof4IyiPgpfO6REUnoqDD9DrweKKolyyXXHMt1c5ncUvEVA7sGdp3UA== X-Received: by 2002:a05:6a21:3288:b0:bc:5262:318e with SMTP id yt8-20020a056a21328800b000bc5262318emr17842912pzb.47.1675169084093; Tue, 31 Jan 2023 04:44:44 -0800 (PST) Received: from [192.168.0.19] ([183.99.112.216]) by smtp.gmail.com with ESMTPSA id w15-20020a1709027b8f00b001892af9472esm9655192pll.261.2023.01.31.04.44.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 31 Jan 2023 04:44:43 -0800 (PST) Message-ID: <838c417c-612f-3abb-39fd-00431fc996c6@gmail.com> Date: Tue, 31 Jan 2023 21:44:40 +0900 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: [PATCH] mmc: rockchip_dw_mmc: fix DDR52 8-bit mode handling Content-Language: en-US To: John Keeping , u-boot@lists.denx.de Cc: Peng Fan , Jaehoon Chung , Simon Glass , Philipp Tomsich , Kever Yang References: <20230117170748.1575441-1-john@metanate.com> From: Jaehoon Chung In-Reply-To: <20230117170748.1575441-1-john@metanate.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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.6 at phobos.denx.de X-Virus-Status: Clean Hi, On 1/18/23 02:07, John Keeping wrote: > The RK3288 TRM states that, for 8-bit DDR modes: > > The CLKDIV register should always be programmed with a value > higher than zero (0); that is, a clock divider should always be > used for 8-bit DDR mode. > > In Linux, the driver applies this logic for all SoCs using the driver > and does not distinguish RK3288, so presumably this requirement is the > same for all other Rockchip SoCs using this IP. > > Add the necessary code to double the clock frequency when 8-bit DDR is > selected. The dw_mmc core already handles setting CLKDIV correctly > given the input clock and desired bus clock. > > Signed-off-by: John Keeping Reviewed-by: Jaehoon Chung Best Regards, Jaehoon Chung > --- > drivers/mmc/rockchip_dw_mmc.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/drivers/mmc/rockchip_dw_mmc.c b/drivers/mmc/rockchip_dw_mmc.c > index 573bf16c87..3661ce3314 100644 > --- a/drivers/mmc/rockchip_dw_mmc.c > +++ b/drivers/mmc/rockchip_dw_mmc.c > @@ -41,6 +41,14 @@ static uint rockchip_dwmmc_get_mmc_clk(struct dwmci_host *host, uint freq) > struct rockchip_dwmmc_priv *priv = dev_get_priv(dev); > int ret; > > + /* > + * The clock frequency chosen here affects CLKDIV in the dw_mmc core. > + * That can be either 0 or 1, but it must be set to 1 for eMMC DDR52 > + * 8-bit mode. It will be set to 0 for all other modes. > + */ > + if (host->mmc->selected_mode == MMC_DDR_52 && host->mmc->bus_width == 8) > + freq *= 2; > + > ret = clk_set_rate(&priv->clk, freq); > if (ret < 0) { > debug("%s: err=%d\n", __func__, ret);