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 38CA6C433F5 for ; Sat, 23 Apr 2022 08:12:21 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4F3C883A79; Sat, 23 Apr 2022 10:12:13 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.b="AlFlafHn"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1497383DB8; Sat, 23 Apr 2022 10:12:07 +0200 (CEST) Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id D68D483D89 for ; Sat, 23 Apr 2022 10:12:00 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=michael@amarulasolutions.com Received: by mail-wr1-x42f.google.com with SMTP id d22so210442wrc.13 for ; Sat, 23 Apr 2022 01:12:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=OdqZ5NjFrbvgxIOVJBoVHjLzQz0FDkhRr0+6ARuAXAU=; b=AlFlafHnweWpJLStyy/IucpMIubKdO6Q/AHr5dnhqbyCJBn45U2ubvwZP60XMgthO6 I7KRa8trIsp9A3qB3+R9oKUoCZao6fGDt8qGOROd3KjO9gWkCBtkytF9+9YBpqZsGLKG 93T764wtd8eF2ctrQFhB6udmch/B+zTCbvQdI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OdqZ5NjFrbvgxIOVJBoVHjLzQz0FDkhRr0+6ARuAXAU=; b=thJMiVX9+ou4khrZiDgxTJve4KD7VKRm8Ev13EGretKvjJtpu7iNcheQ4YzgEUsfgR BTHF1MwlmYjrTSjPtKhQSLLA54VpZ8T2TJhlveCsP3qNVOSuxNAnTR4wsSwlc3pAXCUa VsfJY0VQsW11V09LCVBQLETtOVmJ/jAAMNQ7PatDao3maQMnMCoyEcZYbC21YqtRIspa rnBbiOgx44UF2NGm9dWrmmDqzTHgdsN6FP0F24iCKzmvuum5kTxZzTIuH8Ki4aaCjVCL F1i5e+QAjfdi5QtEKj+bQbGmsze8BRAw9BddltxbEJqevldCgooVSVC3SEf+tDf4jw7P X2Vw== X-Gm-Message-State: AOAM531BzSDyKoMidohN5SkNCQw5aMVSApc2q65igL0F2uv8+WN2KnVA F9VB4E8rb+ZGwxdlPEpwn9A6HA== X-Google-Smtp-Source: ABdhPJxlS30LHYsThxG6abeqLQj21XZkB7iBuLHnIIlcmJFESEfSkRCAArr+dx27/XyP/8pAHKkrAA== X-Received: by 2002:adf:f747:0:b0:20a:d30a:5f08 with SMTP id z7-20020adff747000000b0020ad30a5f08mr1343503wrp.278.1650701520328; Sat, 23 Apr 2022 01:12:00 -0700 (PDT) Received: from localhost.localdomain ([5.171.215.34]) by smtp.gmail.com with ESMTPSA id m7-20020adfe0c7000000b002060e7bbe49sm4181319wri.45.2022.04.23.01.11.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Apr 2022 01:11:59 -0700 (PDT) From: Michael Trimarchi To: Ye Li Cc: Miquel Raynal , u-boot@lists.denx.de, Fabio Estevam , Dario Binacchi , Sean Anderson Subject: [PATCH 1/2] nand: raw: mxs_nand: Fix specific hook registration Date: Sat, 23 Apr 2022 10:11:54 +0200 Message-Id: <20220423081155.27687-2-michael@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220423081155.27687-1-michael@amarulasolutions.com> References: <20220423081155.27687-1-michael@amarulasolutions.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Move the hook after nand_scan_tail is called. The hook must be replaced to the mxs specific one but those must to be assignment later in the probe function. With this fix markbad is working Signed-off-by: Michael Trimarchi --- drivers/mtd/nand/raw/mxs_nand.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/drivers/mtd/nand/raw/mxs_nand.c b/drivers/mtd/nand/raw/mxs_nand.c index ee5d7fde9c..53f24b9c4b 100644 --- a/drivers/mtd/nand/raw/mxs_nand.c +++ b/drivers/mtd/nand/raw/mxs_nand.c @@ -1246,22 +1246,6 @@ int mxs_nand_setup_ecc(struct mtd_info *mtd) /* Enable BCH complete interrupt */ writel(BCH_CTRL_COMPLETE_IRQ_EN, &bch_regs->hw_bch_ctrl_set); - /* Hook some operations at the MTD level. */ - if (mtd->_read_oob != mxs_nand_hook_read_oob) { - nand_info->hooked_read_oob = mtd->_read_oob; - mtd->_read_oob = mxs_nand_hook_read_oob; - } - - if (mtd->_write_oob != mxs_nand_hook_write_oob) { - nand_info->hooked_write_oob = mtd->_write_oob; - mtd->_write_oob = mxs_nand_hook_write_oob; - } - - if (mtd->_block_markbad != mxs_nand_hook_block_markbad) { - nand_info->hooked_block_markbad = mtd->_block_markbad; - mtd->_block_markbad = mxs_nand_hook_block_markbad; - } - return 0; } @@ -1467,6 +1451,22 @@ int mxs_nand_init_ctrl(struct mxs_nand_info *nand_info) if (err) goto err_free_buffers; + /* Hook some operations at the MTD level. */ + if (mtd->_read_oob != mxs_nand_hook_read_oob) { + nand_info->hooked_read_oob = mtd->_read_oob; + mtd->_read_oob = mxs_nand_hook_read_oob; + } + + if (mtd->_write_oob != mxs_nand_hook_write_oob) { + nand_info->hooked_write_oob = mtd->_write_oob; + mtd->_write_oob = mxs_nand_hook_write_oob; + } + + if (mtd->_block_markbad != mxs_nand_hook_block_markbad) { + nand_info->hooked_block_markbad = mtd->_block_markbad; + mtd->_block_markbad = mxs_nand_hook_block_markbad; + } + err = nand_register(0, mtd); if (err) goto err_free_buffers; -- 2.25.1