Received: by 10.213.65.68 with SMTP id h4csp3408670imn; Tue, 3 Apr 2018 04:33:14 -0700 (PDT) X-Google-Smtp-Source: AIpwx482eWl10fvElGOiu4IzsNxtbWY8qEZtOqivplkS8xEPIfa2MBqvetX0slI4p/00ZM0lZhc6 X-Received: by 10.101.78.131 with SMTP id b3mr8934275pgs.8.1522755194871; Tue, 03 Apr 2018 04:33:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522755194; cv=none; d=google.com; s=arc-20160816; b=iKlpMT0oP1y5iNngA6l2DdHTpxyYgEjPj/C9eydVqzRzdN3w+Oaw4QE31QVWJX9oLq 1r8YcwplQlhUKE3DOP3Zx2i7G6GxObJao49kvueXtc+ExXoOb4PuNqb43FPyvL2hXFCf nU6HDWChB9ZJRMgOGw+TugnMW613zqtmfSPrmDEa/FZ2tHJHoYiEmxKYXDwPFz+rMdqQ l/SVhqpJPkjZzYTjwACJB3XLKvYUIoHEmh1GrIPDYgTArcm12P0so+oLzm1B/6vTnssH SbfKA1PMCf+k5Oso9e6s+D5BPtmkPlg/XUQgY7u5vm7qdbQryJdwh2TCf5CUAqdIH9GD M3CQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:to:subject :cc:arc-authentication-results; bh=fprWzQTJxF62/QZ1LCCxjACun51PMlVbD0tz5/uvDFA=; b=RM4hsCioJC+GjQfiTinE4EyKd0URbHfBMI8QjSWCrykIMfGKpkJjXqPI0PChPWUP7z stc5eZAv6XFUJNZAycBaANbBtR2h6p5ku/JBuhN/NhFysqsGpA8vbpp4bUGXkkQcPHIu xQTTyoyQcTuLqRraSB22M6L26/fQXXurVG+EL6KBrWOYAt+oVpwAb8oQCb2Qh5JPe+xf RE1wIdu7+0/XEbCyy+f/oMSVl2jxPBYQUbEOKj28UOK/UX6jXsublj9fOcaIrG9JiTSA CrQeJ7cI9/MrrXsjqt5ruAKqF+YsAcLE9edkCBnP2amx7kARU31b+dgQcNpJsdNJ2j7e Xcqw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f3-v6si307530plf.446.2018.04.03.04.33.01; Tue, 03 Apr 2018 04:33:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932137AbeDCLbs (ORCPT + 99 others); Tue, 3 Apr 2018 07:31:48 -0400 Received: from lucky1.263xmail.com ([211.157.147.130]:45070 "EHLO lucky1.263xmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932066AbeDCLbo (ORCPT ); Tue, 3 Apr 2018 07:31:44 -0400 Received: from shawn.lin?rock-chips.com (unknown [192.168.167.76]) by lucky1.263xmail.com (Postfix) with ESMTP id 0586D1F590D; Tue, 3 Apr 2018 19:31:21 +0800 (CST) X-263anti-spam: KSV:0; X-MAIL-GRAY: 1 X-MAIL-DELIVERY: 0 X-KSVirus-check: 0 X-ABS-CHECKED: 4 Received: from [172.16.12.51] (localhost [127.0.0.1]) by smtp.263.net (Postfix) with ESMTPA id EB6D4308; Tue, 3 Apr 2018 19:31:21 +0800 (CST) X-RL-SENDER: shawn.lin@rock-chips.com X-FST-TO: linux-kernel@vger.kernel.org X-SENDER-IP: 58.22.7.114 X-LOGIN-NAME: shawn.lin@rock-chips.com X-UNIQUE-TAG: <8cb01b0dda2855c68856409c8b947b39> X-ATTACHMENT-NUM: 0 X-SENDER: lintao@rock-chips.com X-DNS-TYPE: 0 Received: from [172.16.12.51] (unknown [58.22.7.114]) by smtp.263.net (Postfix) whith ESMTP id 14381RB038B; Tue, 03 Apr 2018 19:31:22 +0800 (CST) Cc: shawn.lin@rock-chips.com, Jaehoon Chung , Ulf Hansson , linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mmc: dw_mmc-k3: Fix DDR52 mode by setting required clock divisor To: oscardagrach References: <20180329182423.21201-1-ryan@edited.us> From: Shawn Lin Message-ID: Date: Tue, 3 Apr 2018 19:31:24 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180329182423.21201-1-ryan@edited.us> Content-Type: text/plain; charset=gbk; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018/3/30 2:24, oscardagrach wrote: Need at least one line commit body. > Signed-off-by: oscardagrach > --- > drivers/mmc/host/dw_mmc-k3.c | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > > diff --git a/drivers/mmc/host/dw_mmc-k3.c b/drivers/mmc/host/dw_mmc-k3.c > index 89cdb3d533bb..efc546cb4db8 100644 > --- a/drivers/mmc/host/dw_mmc-k3.c > +++ b/drivers/mmc/host/dw_mmc-k3.c > @@ -194,8 +194,14 @@ static void dw_mci_hi6220_set_ios(struct dw_mci *host, struct mmc_ios *ios) > int ret; > unsigned int clock; > > - clock = (ios->clock <= 25000000) ? 25000000 : ios->clock; > - > + /* CLKDIV must be 1 for DDR52/8-bit mode */ > + if (ios->bus_width == MMC_BUS_WIDTH_8 && > + ios->timing == MMC_TIMING_MMC_DDR52) { > + mci_writel(host, CLKDIV, 0x1); > + clock = ios->clock; > + } else { > + clock = (ios->clock <= 25000000) ? 25000000 : ios->clock; > + } I undertand DDR52/8-bit need CLKDIV fixed 1, but shouldn't the following change is more sensible? if (ios->bus_width == MMC_BUS_WIDTH_8 && ios->timing == MMC_TIMING_MMC_DDR52) clock = ios->clock * 2; else clock = (ios->clock <= 25000000) ? 25000000 : ios->clock; The reason is ios->clock is 52MHz and you could claim 104MHz from the clock provider and let dw_mmc core take care of the divder to be 1. Otherwise, you just force it to be DDR52/8-bit with a clk rate of 26MHz. > ret = clk_set_rate(host->biu_clk, clock); > if (ret) > dev_warn(host->dev, "failed to set rate %uHz\n", clock); >