Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2868015rwb; Mon, 15 Aug 2022 12:58:16 -0700 (PDT) X-Google-Smtp-Source: AA6agR5SycEte0SQgZeuRTV0N2tixRb4XFl0oxQi/Br8M636EheIDBaif1B6PZpkEuBjHLRgQSOf X-Received: by 2002:a17:907:7f24:b0:731:535e:b709 with SMTP id qf36-20020a1709077f2400b00731535eb709mr11327036ejc.160.1660593496276; Mon, 15 Aug 2022 12:58:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660593496; cv=none; d=google.com; s=arc-20160816; b=yRZPs4QNMvKkwNRGF/wiO/8951TSNuhK7YYDJaVv20ICVYPbQR0o1eZrTyaeYRhocn LYOKAlK6JlMm1w+yZbCkNwcYKXAX4YR2gIjXCPg+JZMU+EI8evAA0KSPU4RoYh14kEMH z0t1dZC32BeZWwRTJ6o2EfkKfMPEQDHMvWXxUpRSsgrnCN893Hiwsg8niYAnoGVuMYfc ruD0ceBEb9AtSGcxmuCqZ22GrwF02Df0KCezg/LI8hN9hyaZxZLEM10V3UX90iHuCBfH EneoDFaIijgBUnclR/67V7ck5ipt7USF27Ku88r6fdexIs1iwVsKPEfBPalOhIKsbwMH w3yQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=fnqxeNV8lTNIlRLkrYpG5H+L3yIqgxrBMjXeLl5IWlQ=; b=xjrLHSLv/OiZcrbkkL7ZNho2xLhbfVeW1Ijep6fWLn6R8heHG+TCZC1FvPbAt9hSxn ZjboyUEc59J8QJV9GF2a97rzKfRLjWuOnVUV9zfzE1cpPJal6wIC1r0EYI5lxBu1oOP1 c8iwSp/f3OQkTBQXI77mGk1Kdi5nQmuNBMe7J9isFsFeQmQjc+dZlNeP9X80Bm2Nahpc 4+gQNQyNSBN7OVCVsn6Gxa00NCx+eiK1EH1VBfEa1z0eGAtEXYJsQY8DxxFxq86zSdC9 LXmLx6bCQ0nCWGfU+Rxajkpb7Da6Ee96GOTS/5QovRDEY+8E8OHCp5VKCFF+GhFjNrtT Tjtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="XzFX/bgn"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y7-20020a056402270700b0043beaa7f1b3si9168259edd.247.2022.08.15.12.57.49; Mon, 15 Aug 2022 12:58:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="XzFX/bgn"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240599AbiHOSVX (ORCPT + 99 others); Mon, 15 Aug 2022 14:21:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240467AbiHOSUM (ORCPT ); Mon, 15 Aug 2022 14:20:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 430712C138; Mon, 15 Aug 2022 11:16:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 61C8A612B1; Mon, 15 Aug 2022 18:16:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 69E8EC43141; Mon, 15 Aug 2022 18:16:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587394; bh=/ETDo4V7GPQUwRsVjK5Nh+gt4dXLrxqWmPgcWmO53ls=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XzFX/bgnhFbcUCkUfhymcc0hHFNdS1n3DrU6UV/lBYVKpV88WfDWOrmWJOWqvUFG+ NeSwsThjkhOzI7/6mCZGXZB2tVg02dvABDkGtNtXfkEWDxSXOLUgayN/wuDW2VeOND /DQmHx5Af/RMQst8R4rN8ldysM34F30qS77pa2q8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Olga Kitaina , Amit Kumar Mahapatra , Miquel Raynal Subject: [PATCH 5.15 072/779] mtd: rawnand: arasan: Fix clock rate in NV-DDR Date: Mon, 15 Aug 2022 19:55:16 +0200 Message-Id: <20220815180340.367412598@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Olga Kitaina commit e16eceea863b417fd328588b1be1a79de0bc937f upstream. According to the Arasan NAND controller spec, the flash clock rate for SDR must be <= 100 MHz, while for NV-DDR it must be the same as the rate of the CLK line for the mode. The driver previously always set 100 MHz for NV-DDR, which would result in incorrect behavior for NV-DDR modes 0-4. The appropriate clock rate can be calculated from the NV-DDR timing parameters as 1/tCK, or for rates measured in picoseconds, 10^12 / nand_nvddr_timings->tCK_min. Fixes: 197b88fecc50 ("mtd: rawnand: arasan: Add new Arasan NAND controller") CC: stable@vger.kernel.org # 5.8+ Signed-off-by: Olga Kitaina Signed-off-by: Amit Kumar Mahapatra Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20220628154824.12222-3-amit.kumar-mahapatra@xilinx.com Signed-off-by: Greg Kroah-Hartman --- drivers/mtd/nand/raw/arasan-nand-controller.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) --- a/drivers/mtd/nand/raw/arasan-nand-controller.c +++ b/drivers/mtd/nand/raw/arasan-nand-controller.c @@ -1043,7 +1043,13 @@ static int anfc_setup_interface(struct n DQS_BUFF_SEL_OUT(dqs_mode); } - anand->clk = ANFC_XLNX_SDR_DFLT_CORE_CLK; + if (nand_interface_is_sdr(conf)) { + anand->clk = ANFC_XLNX_SDR_DFLT_CORE_CLK; + } else { + /* ONFI timings are defined in picoseconds */ + anand->clk = div_u64((u64)NSEC_PER_SEC * 1000, + conf->timings.nvddr.tCK_min); + } /* * Due to a hardware bug in the ZynqMP SoC, SDR timing modes 0-1 work