Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp1584320rdh; Fri, 24 Nov 2023 17:25:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IE7dfRYKw2uIk6UP+Gd2gbwVqqntA7spQ8b5RNHb2u+TAe62Jti64sUv3lIH/xV8YcjZZRs X-Received: by 2002:a05:6808:2227:b0:3b8:39d9:90fd with SMTP id bd39-20020a056808222700b003b839d990fdmr6234754oib.39.1700875533696; Fri, 24 Nov 2023 17:25:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700875533; cv=none; d=google.com; s=arc-20160816; b=lgsELasKy5yEqI1mapym/JE1DpYea3kAQT+Vx6+cgkOzsSF/MrpYC0DKlPFmYGZ27b mvrcz27akn5DKW9bHEJ58RnuJUOm7iI8y5gHBbOXmxoHvgO5/wjEymmLxphMLjB/rxKP lGi2uZ0oMDUczQBPsYqxGUn4MjvrwCikMhe7Q6W+u/8eGZp/4Q1bzezAIgEI9bdisDyV VyJtR3gTuqFVNhy8qlkImE3tPU7fQfvqdYwRMYDk7bsBFnkIQFtwwhuSpTJ8bUuvbnQT LDEdxc7qrTJXaC2Cfjoq/p8FxHJ6JBv6mABqLwAQfuBpMtnwk+e+QqramtrbPQLm5/WM 14yg== 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 :references:in-reply-to:message-id:date:subject:to:from :dkim-signature:dkim-filter; bh=k4Wd/dns6Fv4x6cNgVElRhTkEXTex7Dhcnj5h65rCG4=; fh=D0xTDT8JZUJUGz1XFB7l99IKFp7kT1GUVSOnE/fHaPw=; b=w9ClZnMyf1NDjRX4tVniNkd1d0XmgS9V2sWYyI3XTcSKAbSnHlF3a94HMqVFhDnva9 h6ylaZ1DZCRm0hbdATtVDs5acfQAUc4jb7f5jaQ13eCnnhxjuEoBosl2o3RiLfgWXyNN egvh4m/h2DwrAe++IBLrdanu3WMCy0LWJaDwMq9lDDSFP8CA1b3WIRoHgtOWtlq6QTw0 iP4Ip13icLobxlL+dCHHPnRfUrjbZSkBzi8fENu9zJVs29FdiD0ptnfIxX6ay6hLQSHg 1I6K/YxRgqBGol07UjTDR4mPJhLYRZA4p4CzGuwMw2uoy2ybA/Nz/I8XdSM/qusQId4A SWAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=dkimrelay header.b=EP7uWK4R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id g28-20020a63201c000000b005aad5164a40si4615113pgg.246.2023.11.24.17.25.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Nov 2023 17:25:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@broadcom.com header.s=dkimrelay header.b=EP7uWK4R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 97874824E525; Fri, 24 Nov 2023 17:25:28 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231642AbjKYBZK (ORCPT + 99 others); Fri, 24 Nov 2023 20:25:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231636AbjKYBZI (ORCPT ); Fri, 24 Nov 2023 20:25:08 -0500 Received: from relay.smtp-ext.broadcom.com (lpdvsmtp09.broadcom.com [192.19.166.228]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A65719B2 for ; Fri, 24 Nov 2023 17:25:13 -0800 (PST) Received: from bld-lvn-bcawlan-34.lvn.broadcom.net (bld-lvn-bcawlan-34.lvn.broadcom.net [10.75.138.137]) by relay.smtp-ext.broadcom.com (Postfix) with ESMTP id A18B7C00DAD9; Fri, 24 Nov 2023 17:25:12 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 relay.smtp-ext.broadcom.com A18B7C00DAD9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1700875512; bh=Mt/A8IXzoCUJXLU+oYc8jniqtMmbYYaDH7bW1ntuJLk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=EP7uWK4RMuiicMetAht0MIdD3Ov8ZRcE0URbHq9Y3juMu4Gf/3Zlm5N3Dikz6lLHG CHXxec/bVss0Q6CGukabk+BNEiWjicFQL1ixl3S8HAQRSrA2iGYJdmJNyi+O2x8RmE u1lWAwdfL2Td6rUZp2WbW7+QFb453KxBrBfyDC/M= Received: from bcacpedev-irv-3.lvn.broadcom.net (bcacpedev-irv-3.lvn.broadcom.net [10.75.138.105]) by bld-lvn-bcawlan-34.lvn.broadcom.net (Postfix) with ESMTPSA id 9552E18728D; Fri, 24 Nov 2023 17:25:12 -0800 (PST) From: dregan@broadcom.com To: dregan@broadcom.com, miquel.raynal@bootlin.com, bcm-kernel-feedback-list@broadcom.com, linux-mtd@lists.infradead.org, f.fainelli@gmail.com, rafal@milecki.pl, joel.peshkin@broadcom.com, computersforpeace@gmail.com, dan.beygelman@broadcom.com, william.zhang@broadcom.com, frieder.schrempf@kontron.de, linux-kernel@vger.kernel.org, vigneshr@ti.com, richard@nod.at, bbrezillon@kernel.org, kdasu.kdev@gmail.com, JaimeLiao , Adam Borowski Subject: [PATCH v5 3/4] mtd: rawnand: brcmnand: pass host struct to bcmnand_ctrl_poll_status Date: Fri, 24 Nov 2023 17:24:37 -0800 Message-Id: <20231125012438.15191-3-dregan@broadcom.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20231125012438.15191-1-dregan@broadcom.com> References: <20231125012438.15191-1-dregan@broadcom.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Fri, 24 Nov 2023 17:25:28 -0800 (PST) From: David Regan Pass host struct to bcmnand_ctrl_poll_status instead of ctrl struct since real time status requires host, and ctrl is a member of host. Real time status is required for low level commands vs cached status since the NAND controller will not do an automatic status read at the end of a low level command as it would with a high level command. Signed-off-by: David Regan --- Changes in v5: none Changes in v4: none Changes in v3: none Changes in v2: added this patch in series --- drivers/mtd/nand/raw/brcmnand/brcmnand.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c index 440bef477930..8d429eb3b72a 100644 --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c @@ -1061,10 +1061,11 @@ enum { CS_SELECT_AUTO_DEVICE_ID_CFG = BIT(30), }; -static int bcmnand_ctrl_poll_status(struct brcmnand_controller *ctrl, +static int bcmnand_ctrl_poll_status(struct brcmnand_host *host, u32 mask, u32 expected_val, unsigned long timeout_ms) { + struct brcmnand_controller *ctrl = host->ctrl; unsigned long limit; u32 val; @@ -1379,7 +1380,7 @@ static void brcmnand_wp(struct mtd_info *mtd, int wp) * make sure ctrl/flash ready before and after * changing state of #WP pin */ - ret = bcmnand_ctrl_poll_status(ctrl, NAND_CTRL_RDY | + ret = bcmnand_ctrl_poll_status(host, NAND_CTRL_RDY | NAND_STATUS_READY, NAND_CTRL_RDY | NAND_STATUS_READY, 0); @@ -1389,7 +1390,7 @@ static void brcmnand_wp(struct mtd_info *mtd, int wp) brcmnand_set_wp(ctrl, wp); nand_status_op(chip, NULL); /* NAND_STATUS_WP 0x00 = protected, 0x80 = not protected */ - ret = bcmnand_ctrl_poll_status(ctrl, + ret = bcmnand_ctrl_poll_status(host, NAND_CTRL_RDY | NAND_STATUS_READY | NAND_STATUS_WP, @@ -1629,13 +1630,13 @@ static void brcmnand_send_cmd(struct brcmnand_host *host, int cmd) */ if (oops_in_progress) { if (ctrl->cmd_pending && - bcmnand_ctrl_poll_status(ctrl, NAND_CTRL_RDY, NAND_CTRL_RDY, 0)) + bcmnand_ctrl_poll_status(host, NAND_CTRL_RDY, NAND_CTRL_RDY, 0)) return; } else BUG_ON(ctrl->cmd_pending != 0); ctrl->cmd_pending = cmd; - ret = bcmnand_ctrl_poll_status(ctrl, NAND_CTRL_RDY, NAND_CTRL_RDY, 0); + ret = bcmnand_ctrl_poll_status(host, NAND_CTRL_RDY, NAND_CTRL_RDY, 0); WARN_ON(ret); mb(); /* flush previous writes */ @@ -1664,7 +1665,7 @@ static bool brcmstb_nand_wait_for_completion(struct nand_chip *chip) if (mtd->oops_panic_write || ctrl->irq < 0) { /* switch to interrupt polling and PIO mode */ disable_ctrl_irqs(ctrl); - sts = bcmnand_ctrl_poll_status(ctrl, NAND_CTRL_RDY, + sts = bcmnand_ctrl_poll_status(host, NAND_CTRL_RDY, NAND_CTRL_RDY, 0); err = sts < 0; } else { -- 2.37.3