Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2912849pxb; Tue, 24 Aug 2021 10:27:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy23qQhwls/s6OLZTtTkKgLuTFtCMAKEPdrPGbnBbhALc2U4KHVJF2eKICnYR89wBGP/VaL X-Received: by 2002:a02:cd32:: with SMTP id h18mr35321607jaq.101.1629826032618; Tue, 24 Aug 2021 10:27:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629826032; cv=none; d=google.com; s=arc-20160816; b=BkWiykAfE2T5pvIl+b1Jl4fLVCS/sN0qNwJQVo3XYHkxPnP3wd2oWYibituKmUQjMl +DrUELrkrBhhjKWYMKY07Szer/FA6FRJ02c/MakUHRn3QPppcEH0EBu8pEwaanS9+UuJ OQ1Sk2n+2aDEYnAYxFL9Y99MTJIdc9LA2cOdU7sWRqozvJ1PhlUU+bulrzOrXNX9m9zp dXkUrOx2FbY2BmIxXLoQROwG5Yg3stMafDVBVqsO6ekEGmEO2BTbffeKpUsyBaE2LVgY fpw3a+Tx+4MfFm1FOvqVKDy6jWxZ07YCXF0onaEfOucEdKzvqxU3bWxF+Xx+VHZoPjFQ o4Rg== 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 :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=uNrVJ19HpBc5ib044X7SBxbpC8RR8Ee+4UG1XaaOmGI=; b=GYpROp9WD8aBd2z8Km0TaZqcQd4g+GisqtGSvYdS38oO3LSEfWvP5uOamFSqIFA08r yTQ77QL0Hgq18xNdTEMebjlcZTIdWWCgDI6jdEzbnKCEOTCnTe4vmde1F+Xty6DhBTlD OZJ2aTde3e4EFlKVYmQQzUYjUp58Q8KVdQYwaOACPI7xzkonCf5fl7Ty7phFCqbY0uB5 2mNvVOMQYNOcP+vgSBNgw8uN1T15ikTm/CFXp925d+GobPBnVamYx9aNt8u1Vtummtzg fwI5XBZdQYDjoviLDhzKjYuPdgaMEJ4v8I+3OdPYaDSkiyLZs5kZqopvneV7NPGKrAUv iGfw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u9si16924953jat.76.2021.08.24.10.27.00; Tue, 24 Aug 2021 10:27:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239635AbhHXR1D convert rfc822-to-8bit (ORCPT + 99 others); Tue, 24 Aug 2021 13:27:03 -0400 Received: from relay12.mail.gandi.net ([217.70.178.232]:58603 "EHLO relay12.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240774AbhHXRWw (ORCPT ); Tue, 24 Aug 2021 13:22:52 -0400 Received: (Authenticated sender: miquel.raynal@bootlin.com) by relay12.mail.gandi.net (Postfix) with ESMTPSA id 0A9BF200003; Tue, 24 Aug 2021 17:22:04 +0000 (UTC) Date: Tue, 24 Aug 2021 19:22:03 +0200 From: Miquel Raynal To: Kestrel seventyfour Cc: Richard Weinberger , Vignesh Raghavendra , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] mtd: rawnand: xway: No hardcoded ECC engine, use device tree setting Message-ID: <20210824192203.076df55e@xps13> In-Reply-To: References: <20210808072643.GA5084@ubuntu> <20210816093126.442f74a1@xps13> <20210819100334.6af2d86e@xps13> <20210823172413.0bc4ab3a@xps13> Organization: Bootlin X-Mailer: Claws Mail 3.17.7 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, Kestrel seventyfour wrote on Tue, 24 Aug 2021 09:15:49 +0200: > Hi Miquèl, > > Am Mo., 23. Aug. 2021 um 17:24 Uhr schrieb Miquel Raynal > : > > > > Hi Kestrel, > > > > Kestrel seventyfour wrote on Mon, 23 Aug > > 2021 13:19:43 +0200: > > > > > Hi Miquèl, > > > > > > Am Do., 19. Aug. 2021 um 10:03 Uhr schrieb Miquel Raynal > > > : > ... > > > > > > thank you for your response. > > > If I remove the nand-ecc-xxx properties in the device tree, the device with > > > the Toshiba NAND chip is working. However, the device with the Micron > > > NAND fails with NO ECC functions supplied; hardware ECC not possible, > > > seems to be at line 5367 or equivalent. > > > https://elixir.bootlin.com/linux/latest/source/drivers/mtd/nand/raw/nand_base.c#L5367 > > > > > > It looks like the micron nand driver supports on die only if its > > > specified int the > > > Device tree: > > > https://elixir.bootlin.com/linux/latest/source/drivers/mtd/nand/raw/nand_micron.c#L511 > > > The Micron NAND driver probably needs to set the ECC type to ON DIE if the > > > variable ondie contains the supported attribute?! > > > > You're right but I don't see any easy upstream-able solution here. > > Changing the behavior in the Xway driver would certainly break users, > > changing the behavior in the Micron driver would certainly break even > > more users. The root cause being an absence of proper description (the > > integration changed). Honestly I feel stuck, maybe you can try to > > register your device, if it fails, change the integration in the driver > > (to an ondie ecc engine) then retry? > > > > Thanks, > > Miquèl > > Do you think adding something like below at the following location > https://elixir.bootlin.com/linux/latest/source/drivers/mtd/nand/raw/xway_nand.c#L223 > would be upstreamable (with or without device tree property?)? > > err = nand_scan(&data->chip, 1); > if (err /* && of_property_read_bool(np, "lantiq,retry-on-die") */) { > data->chip.ecc.engine_type = NAND_ECC_ENGINE_TYPE_ON_DIE; > err = nand_scan(&data->chip, 1); > if (err) return err; > } > > It still throws the kernel warning on first try, but the second try then works. Can you please remind me what is xway/lantiq/your setup/how public it is/who's using this driver? Thanks, Miquèl