Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3077356rwb; Mon, 15 Aug 2022 17:33:54 -0700 (PDT) X-Google-Smtp-Source: AA6agR6EgtQXky2LTXVFZGHnI03cWyqIj8lTyxryVRzOjy5/cOXlXjZIXBlXksK2V7QAi4iOOps3 X-Received: by 2002:a17:906:216:b0:711:f623:8bb0 with SMTP id 22-20020a170906021600b00711f6238bb0mr12257869ejd.174.1660610034504; Mon, 15 Aug 2022 17:33:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660610034; cv=none; d=google.com; s=arc-20160816; b=I2fy9Sxothk6aYwpUBEqeELgjbeDasFoBCpMXuPPk8xaEiGNWGPGvBPgdzKxFqaSe1 ZUm2Hjx59PsSJKl3ixW9om7s+YKSE4XuHbM4eiyyF5UK3kJWjjp/r4owgyBncZbT1eLq ec86FODR+IF7fOEUMEc8WdxnPxfYTqcm0Lv+DjJLAJ0Bj4RKGG1SKNT6OADjP1C/A/NQ Gw060tqm0I67J0e7M8eHThPFt4eBeu93wsTOBYiAX9bN9QzUkytiOGc0epbZM3MQQ7B2 qw4d1DYiGOFf4vbNClHMoOb/86IkSztwR3QpUkjlYAudUp2i/xTc96B0dMvf0fjBVzos evUA== 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=VfMA5j7vUzwUCI5KHpAgUmQcGCqHqUJdcSutWWcYmoQIAK4eAPJbFNnpgK4OVyVZjm v5S2Z0DoIh/YuBmSGz+haztx/3KgW0GZSBiReU7aUv6silRqhaXDWr7wmpJxuvWOg0gl xOS3uYcrWKgQRJ43u25urU7qelvjFOPVcOp55X2gaS4Hxq2c2EG+luenC+rhOaEJEAVc oeQezsibAS8uk6j2kiCvexZoJqSR7gRRfo2B5LU6EKP0cUJH6nTdBgZpAK2XEotSlgdM ty7n1vg1fas4WS/twDQqNGELuRfpkF/+P3cf1ZVo/mnui0vsEo41nV4F7ndY9H29o1Bb B2UQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PmD8KJYL; 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 gn29-20020a1709070d1d00b007341ad4b028si9464211ejc.642.2022.08.15.17.33.28; Mon, 15 Aug 2022 17:33:54 -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=PmD8KJYL; 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 S1344153AbiHOWPf (ORCPT + 99 others); Mon, 15 Aug 2022 18:15:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345293AbiHOWOO (ORCPT ); Mon, 15 Aug 2022 18:14:14 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6C6C11C95D; Mon, 15 Aug 2022 12:39:22 -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 ams.source.kernel.org (Postfix) with ESMTPS id A7F88B80EA8; Mon, 15 Aug 2022 19:39:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E66C5C433C1; Mon, 15 Aug 2022 19:39:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592347; bh=/ETDo4V7GPQUwRsVjK5Nh+gt4dXLrxqWmPgcWmO53ls=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PmD8KJYLsItxQpWWlQoX9PXwlCYkzV0OLpTv9TBJVNNDkMXXTWtt2kFsNBc+Hhlyc KHhYkfjXdTzAze53rf8c8JmBBAiIxJQVoPRvLf8rNQ6kRF9a+6dkKTitaUZYRT2zrr banKzdCBYk3bvB0XSUNQedIcDvxo5dn4rotOI8us= 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.19 0097/1157] mtd: rawnand: arasan: Fix clock rate in NV-DDR Date: Mon, 15 Aug 2022 19:50:53 +0200 Message-Id: <20220815180443.493266864@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@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