From patchwork Sun May 15 09:25:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 1944 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id E21733F18B for ; Sun, 15 May 2022 11:25:46 +0200 (CEST) Received: by mail-ed1-f71.google.com with SMTP id s29-20020a50ab1d000000b00427e495f00csf7761057edc.14 for ; Sun, 15 May 2022 02:25:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1652606746; cv=pass; d=google.com; s=arc-20160816; b=VGXM0QBcqe1knFyH8VzfcFwfv4XW8Lc2Sf/TtvKv3J9MV5/0+9D+macSt0b43cGQj7 OuYNaFYl/17TFlkI+UcZCiipcrYFbbd9VSq9L/TqL9Ra1feIu7CNqXtzWvJJ/TG3o3uu S0uA0wEJotDHR0+x7o0jP0d0TQ4gwC4NX/o/fzkWtK4/RMq7EoQ22pSHIKklcX6rikRj u9+y+uu7ok3CESGnm+CE9U5saItecVRjMm3jDm2hVCfqXyH8QUwhDjsQSGIowRDtWdxp IRWShHlvhVWcZH0r/2T3G3cuV3lP4WgXk2v+sspdzoA4foKyUJ7bh4rQOX1KN+1Y4LCz bnCA== 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=IEyW5/jR/tsoOGbO5MM4PJF3dbcttBOAblnyO4gtoxI=; b=0eNDkcDNZPViM/gtqrB7LvbgN4fiiFt1sNcw7hDw5xL/jAp5f1US/S03td7Rnxo9ft TaDpyaswBAUHHe8KEHC2NA9POEICkfNpOiVt78/Ifi98odI3JNgdoPZ9hMWzsfKoVoUE ybUoLY/HfJLtiLMjbxiGLsRL9BGTeaSWRFQU3YMV/g3KheV32/NGyTvXxslqPKjfnEs6 XnSetH9PWB+PsN9Q1myYBKmI4bjTB1p3hl2oiFmwzoN3MuHQlIaty1BcytnI1yuGJsr9 3YRIkzWrLHr59X350qJ2Gh9Vn9aD5aYwIiWTAcugs1CSd7ys9hnC3Z6ah38JCgs6ZgmT G5QA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=IjzYrGSd; 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=IEyW5/jR/tsoOGbO5MM4PJF3dbcttBOAblnyO4gtoxI=; b=aCsB00UuAozksiZffwG3KubmIDLtEzNbcZ5Rk7Mpa35hfOjs1K0syqoArxLYT9X9Md Ru9/9DiLLQLMA7gp8Ro4WH2Qp1D6f9/6Frj2w6IG3qmx5d3w225+xCSWxBSc1XZaXJJ2 1gYNsEL7Q9HfVqkBRubu3v13xhbwE2nTrduSc= 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=IEyW5/jR/tsoOGbO5MM4PJF3dbcttBOAblnyO4gtoxI=; b=0V8DdFczC1kvp+82A4qJbunJSN06cK2SQfdMcTUH1bl+UKhL1ehYzkPIB1OgtVr41v QhkEmp8vDBNv7DXbTYc1+U9Suv2NAHuCZpbfZ7ZS8FZtnwjXlv24TNyKKmvjDsxtKo4n agGQz4kSjnnrd7lnwfhPXESL56dTF8VgD5n77oper0pq9otQ5+uSQuAhxmahgZmZYHmD exM7uGKwBtyzN2ZhfuXP17amjE/g0E6udYdIuF0t6hI5uL4+lGwsK6XWfLxwXBjDbXNd 41unQafhaxcLlVV+7tLAQQo+bN++rkXxnqFWV9UGWXrZTM1/myIR5dc4+ACjxAwAsIGE O/8A== X-Gm-Message-State: AOAM531CXh6iGsWyHATdMQEDGW+6CJlYJH9Q6fRY/vKjiSew4X4X7uUR VOwHtNqrZvRw3/6yIE/VCXTUmX7y X-Google-Smtp-Source: ABdhPJwyiE+zrcA8J0Gwj8k0hHYNWcztJQs+a3A62dHF7rtfSp8lPNQk/hy11tI/8Bb3pc8cn2cbcQ== X-Received: by 2002:a05:6402:84a:b0:426:262d:967e with SMTP id b10-20020a056402084a00b00426262d967emr7571445edz.286.1652606746224; Sun, 15 May 2022 02:25:46 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:26d2:b0:428:f87:ccd8 with SMTP id x18-20020a05640226d200b004280f87ccd8ls3091847edd.1.gmail; Sun, 15 May 2022 02:25:45 -0700 (PDT) X-Received: by 2002:a05:6402:d0a:b0:425:d455:452 with SMTP id eb10-20020a0564020d0a00b00425d4550452mr7391078edb.259.1652606744879; Sun, 15 May 2022 02:25:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652606744; cv=none; d=google.com; s=arc-20160816; b=wdusAvyh3feqhSdaKWTfDJo7im2gLL5d9QVgDpH8J8uuB0FfR294kcwKc68cwWVqAp 3TKkWgn7zngjPrOWNZOPPywnTFXdOnkwC/JoMmbtVg09EKEdZh/Zpn5vuBpi6uRICm9P hNOTZDKv7byKJFei44xh9fHPY7p1OTkDARmS6Cf4NCtTHgoiNUDukE+wjO8wSpOurLxS HwhU0gYYPRQUsFsgFjc+ciRrSLpdS9qh+f0b3juPjDUpCZA77vpyq/B3AaUPm+117TYh wwVVHxNZ1v+CObyefaQvkwmOeQTL/HG2zVMrWeJ1JCwQefzaS6ZNs+HS856aq31O0gVU 8cCg== 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=LfiQWwLJyJZvkgKutBx9y9teVnkqTwppDmZ2w6mM5A8=; b=LGN+v1AW3Qxu+N0I3aVVBvHK4q0Ur+WCImfWG/S4ldlMd1XTFKQKt+KbS4zEqJdVJD NBfoOV2arxQHfVyTaQyQrcts4KsrS2Pdq/VQAzDIaUH6iQrHB78/Vsk4JdCxRYWEQhNX BpvkK21cRxy2R7Ab8blRU9eOs+wEMwofR8fIp8FtKFFng26jQOYeVUtOWwURouoWtQ12 FrbjJwkNKmYjCy5TzRmACZMVcv/JIH4n7fzs7iytNceMoIGfeRIAHnkC9gS9ayg1L+/5 xpUwaMpsUhLpww3+vylT/JRU+/bp7LLEoT+qNWf4RkyXyaMDQd6A7OCpbTHvO7tVFO6+ DYFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=IjzYrGSd; 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 oz33-20020a1709077da100b006fde63acc81sor2587559ejc.94.2022.05.15.02.25.44 for (Google Transport Security); Sun, 15 May 2022 02:25:44 -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:a17:907:761c:b0:6d6:e553:7bd1 with SMTP id jx28-20020a170907761c00b006d6e5537bd1mr10623607ejc.5.1652606744604; Sun, 15 May 2022 02:25:44 -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 m17-20020a17090677d100b006f3ef214dc5sm2509888ejn.43.2022.05.15.02.25.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 May 2022 02:25:43 -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 V3 1/5] nand: raw: mxs_nand: Fix specific hook registration Date: Sun, 15 May 2022 11:25:34 +0200 Message-Id: <20220515092538.1736154-2-michael@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220515092538.1736154-1-michael@amarulasolutions.com> References: <20220515092538.1736154-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=IjzYrGSd; 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 --- 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;