From patchwork Sun May 15 09:35:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 1951 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 5F6663F18B for ; Sun, 15 May 2022 11:35:44 +0200 (CEST) Received: by mail-ed1-f70.google.com with SMTP id bc17-20020a056402205100b0042aa0e072d3sf1414747edb.17 for ; Sun, 15 May 2022 02:35:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1652607343; cv=pass; d=google.com; s=arc-20160816; b=Q8UW1CanIphZMecLaHkeFRK/f4FjhLMzfSuUu0NmXUxx0bWdm+dc9KGwAd/MT3kGtx Ln5ZY+l27A2pmcpv4HLzSgtkYNxWRz9Ojj//CeUdBygJSdSpTKLHpa5/YAq/21eJj9eX a+VIbkLehjENzr9Y7n1eYtOWsbIZcEPxTite3WIUIdxFaKjOn2MyNfMnyeyqhlO9jmUy YdhYj9dOag0d/URXsOkXEMTiYj/OUX1OJQyChvzKiPigxroWWU7BSLrvAQq6CkIvr6rE Wz1e0d2ixr9wIfOXT9Cc5w4aeMVKBAfzEEXb1UO32NI8ypr5I0tuOT7aB0iGnivxjP3o Qn9w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=dVToxQKoZp6lXFsKB3E2lrhRlsSdzs0C5buEpOBmP7g=; b=sCeG3k+odqIRXMxQcxvLdxgBS3O8ybRQCcIr9xTVs6DMKryyO7pZ6gqQj6bDN/+Cj+ AFbJUdT/F3R4w9WtJZ96u04D4TC+u+bDwaFpefaObpvE4hOwbVpr+IY2QFXMYbUuyUxs x8Es7H6vNpPrYe5qDEYrVOuoMywcUuWmA03+4rWx5O3UEZGpBqwXmLn8z3I5AkekE9BJ KAyChEpGSVXRHRqe6GxtOOJUZAbLX3utRTCo5/UnoT2+qaOpTi+uAhTpf4bA47aj/3K6 K3dIVuRttSw3wPV0ggxzOaQrg1OW5Aozk6PAJ/jabvHBRaWqYcfx1FLtXScr/MPIFYOH +O4w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=XmqEpzgl; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com 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:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=dVToxQKoZp6lXFsKB3E2lrhRlsSdzs0C5buEpOBmP7g=; b=rEET1U1sdhID2NRnjlNsvqcyY4dorHJ8R7P2U9DKhPB++kjWd9+bruKjMx7EyMaBrI ZHQm2JOnSHdRw0KqZ6Sr8CbDuBkPvn24KApWTBPXXG5yVFWFCPcnThlB5rTvjvfImQYU Kc/VBrLPSBPUb+d8HnvnUVuAPW1f/jp8XUAto= 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:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=dVToxQKoZp6lXFsKB3E2lrhRlsSdzs0C5buEpOBmP7g=; b=USaJlPiGKPWxA+R2yBkVmo0lc1iup5zWcd4zBPRaaCJQ+3QZcn4pZ1oieFmkMQxsek mbJVr/Ic9wxg4LVttA0SM4feqmZhAv4CtNmr6TTAtTu8xkn8pKnQhTIF2BbinV3QxRFs YzvIU1DmJFOJr/UEV9soQ4J/sFvU0UNavyFhKXjciHUe96YfNVQ2piQvothBO86YbcNb CcNBwJ/DYqB3um1MQMi7t+lgddQuGO1Lb/TfIO5m4dzqtD+IPLpJEjHMpJKtUN2t8g7C hUXR6f+mm1TAFE7LbIgylpauN6MWFrMqEQBnOKrIFltq6aEDgjvubWMohwxQEkVWYhGp e6FQ== X-Gm-Message-State: AOAM531ry3yh9RCnrnjm9I0ueVvKjkrB++VFmXZZ/Ar2HoyVA33p354k j0wMf43tpJPdzbbwbFaQeqNYIMl/ X-Google-Smtp-Source: ABdhPJzWPeQ4uAVzXbBvN2kFKiMp+IHUC/PXq6pcSx/N7nMXUvEHDr7j4vczfoxj98VvPr/3pdEkDw== X-Received: by 2002:a17:907:1622:b0:6fe:22bb:7f8 with SMTP id hb34-20020a170907162200b006fe22bb07f8mr3822273ejc.767.1652607343680; Sun, 15 May 2022 02:35:43 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:907:6e09:b0:6f3:ead4:abc6 with SMTP id sd9-20020a1709076e0900b006f3ead4abc6ls5999332ejc.5.gmail; Sun, 15 May 2022 02:35:42 -0700 (PDT) X-Received: by 2002:a17:907:6d84:b0:6f4:94e2:e708 with SMTP id sb4-20020a1709076d8400b006f494e2e708mr10618969ejc.199.1652607342499; Sun, 15 May 2022 02:35:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652607342; cv=none; d=google.com; s=arc-20160816; b=tbtrclJOESigWtxwC4olcmP0ZgAAwufZ1ggZ+2m26zCddCfzzm0PQ/TH9Q80znKkKW 4gbIRrq0KVS9++5fjJx0ffKSG94dX7FNi5LWakVrFk++Rt0HNM5ohx8QPZD6qvwfAFKY sDjIs1jf5V0E/e0AgOQIF4O9RCJi189cY6GLxi2WXOqeQXZfmnCzBkhtqJtD+SkS0lHi kEmffuu3k37u6Pa/4WJXdXOfVKDvYOoxfUx9P/xLSH58X7wXklPGOEX/zxr4TRbHekTq y/NK55CFj9MqwDGhcLa++SvYJ6B2NRCfzAOvJYX75/V0sqhFqQV1XNHQ1EQAIa1k0vg1 rCkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=3xnZ7oBQcAokRqXY4/fVenyG6mtAt/FB/4GOkpfAvAA=; b=OAVRLqsURXof+uZldgistOeoSosGn0Grljm9L8MO3fgSowuREUpftCk9NvjkOw5VI5 408Tsvt86/dxcylbWJTpuU4qS8EHdNEtlJFRINBQsOHxq1bCz6IlKCbCymJ/yfUnRBUq osaU6MT65iTuDyzmLkPtesisTTWYGWzmbDuG+mzhI3UUHAnQlXl72xmt1KvcMDGWIkDd 6XCsfL2VaBXr44fU8rpTvaxC+rtT3FStPvSHzApLBvhJ/6k1XcHoHi0XkMC0BmMWsTX3 rUHMnkFoZW6o+bhOHAlyM4ppjKGxD7Gh3D7u2a3bybunTzRKWHuB3tp2oSM2Y/T/LeEQ mOVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=XmqEpzgl; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id v7-20020a056402184700b00425e27f0595sor3545547edy.13.2022.05.15.02.35.42 for (Google Transport Security); Sun, 15 May 2022 02:35:42 -0700 (PDT) Received-SPF: pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a05:6402:3484:b0:428:1a5e:3d48 with SMTP id v4-20020a056402348400b004281a5e3d48mr7530235edc.401.1652607342255; Sun, 15 May 2022 02:35:42 -0700 (PDT) Received: from localhost.localdomain (mob-109-118-140-232.net.vodafone.it. [109.118.140.232]) by smtp.gmail.com with ESMTPSA id p6-20020a17090664c600b006f3ef214de8sm2516582ejn.78.2022.05.15.02.35.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 May 2022 02:35:40 -0700 (PDT) From: Michael Trimarchi To: Han Xu , U-Boot-Denx Cc: Ye Li , Stefano Babic , Miquel Raynal , Fabio Estevam , Dario Binacchi , Sean Anderson , linux-amarula@amarulasolutions.com, Jagan Teki , Ariel D'Alessandro , Tom Rini , Fabio Estevam , Tim Harvey Subject: [PATCH V4 1/5] nand: raw: mxs_nand: Fix specific hook registration Date: Sun, 15 May 2022 11:35:30 +0200 Message-Id: <20220515093534.1737172-2-michael@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220515093534.1737172-1-michael@amarulasolutions.com> References: <20220515093534.1737172-1-michael@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: michael@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=XmqEpzgl; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 again. Before this change: nand markbad 0xDEC00 NXS NAND: Writing OOB isn't supported NXS NAND: Writing OOB isn't supported block 0x000dec00 NOT marked as bad! ERROR 0 Cc: Han Xu Cc: Fabio Estevam Acked-by: Han Xu Tested-By: Tim Harvey Signed-off-by: Michael Trimarchi --- V3->V4: - none V2->V3: - Add tested-by from Tim - Add ack from Han Xu V1->V2: - Adjust the commit message - Add Cc Han Xu and Fabio --- 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;