From mboxrd@z Thu Jan 1 00:00:00 1970 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 9A93DC433F5 for ; Mon, 14 Mar 2022 08:53:52 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5E67083B9E; Mon, 14 Mar 2022 09:53:50 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=rock-chips.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id A1CE583BBA; Mon, 14 Mar 2022 09:53:48 +0100 (CET) Received: from mail-m17662.qiye.163.com (mail-m17662.qiye.163.com [59.111.176.62]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 976BF83B7C for ; Mon, 14 Mar 2022 09:53:45 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=rock-chips.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=kever.yang@rock-chips.com Received: from [192.168.60.65] (unknown [103.29.142.67]) by mail-m17662.qiye.163.com (Hmail) with ESMTPA id B529714038B; Mon, 14 Mar 2022 16:53:32 +0800 (CST) Message-ID: Date: Mon, 14 Mar 2022 16:53:32 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH v1 04/11] spi: rockchip-sfc: sanity check minimum freq Content-Language: en-US To: Peter Geis , Jagan Teki Cc: u-boot@lists.denx.de, "jon.lin@rock-chips.com" References: <20220222013131.3114990-1-pgwipeout@gmail.com> <20220222013131.3114990-5-pgwipeout@gmail.com> From: Kever Yang In-Reply-To: <20220222013131.3114990-5-pgwipeout@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-HM-Spam-Status: e1kfGhgUHx5ZQUtXWQgPGg8OCBgUHx5ZQUlOS1dZCBgUCR5ZQVlLVUtZV1 kWDxoPAgseWUFZKDYvK1lXWShZQUhPN1dZLVlBSVdZDwkaFQgSH1lBWUJMT0tWTk1NQ0tISRlIS0 hDVRMBExYaEhckFA4PWVdZFhoPEhUdFFlBWU9LSFVKSktISkxVS1kG X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6Mww6FRw6DD4BFSgtAQ0WTDQw MEkaCgpVSlVKTU9MSU9DS0pISEhCVTMWGhIXVRAeDR4JVQIaFRw7CRQYEFYYExILCFUYFBZFWVdZ EgtZQVlKS0hVSUJVSk9JVU1MWVdZCAFZQUlMS0k3Bg++ X-HM-Tid: 0a7f87a1f6c5da2ckuwsb529714038b 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.5 at phobos.denx.de X-Virus-Status: Clean + Jon Lin, Hi Jon,     Please help to review this patch. Thanks, - Kever On 2022/2/22 09:31, Peter Geis wrote: > The rockchip-sfc driver sanity checks the maximum frequency, but not the > minimum frequency. > This causes the probe to fail when a frequency isn't defined, such as > with `sf probe 0`. > Clamp the minimum frequency to the rockchip default clock rate. > > Signed-off-by: Peter Geis > --- > drivers/spi/rockchip_sfc.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/drivers/spi/rockchip_sfc.c b/drivers/spi/rockchip_sfc.c > index 851a6482985b..d0d2dc70a417 100644 > --- a/drivers/spi/rockchip_sfc.c > +++ b/drivers/spi/rockchip_sfc.c > @@ -164,6 +164,8 @@ > /* DMA is only enabled for large data transmission */ > #define SFC_DMA_TRANS_THRETHOLD (0x40) > > +#define SFC_MIN_SPEED (24 * 1000 * 1000) > + > /* Maximum clock values from datasheet suggest keeping clock value under > * 150MHz. No minimum or average value is suggested. > */ > @@ -596,6 +598,9 @@ static int rockchip_sfc_set_speed(struct udevice *bus, uint speed) > if (speed > sfc->max_freq) > speed = sfc->max_freq; > > + if (speed < SFC_MIN_SPEED) > + speed = SFC_MIN_SPEED; > + > if (speed == sfc->speed) > return 0; >