Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp454128pxb; Wed, 25 Aug 2021 07:10:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw+jHDs8kYXzw3XQ+vVPYzt2qi3WJc0J2+6wclyUF1VutJp1Hip6DHw9P9p1NMYBkVkbklP X-Received: by 2002:a5d:9693:: with SMTP id m19mr23806920ion.72.1629900601862; Wed, 25 Aug 2021 07:10:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629900601; cv=none; d=google.com; s=arc-20160816; b=SZboeGqV88M2avK/LritZdrvcsSUzSpQpl42RaBySe+VVZSraRl57T8ekdvsO2+Qic 7e4cgdt5jbzu7votx6AaR140Hnx1nf8+Kz3iMHWwy25Sgg+6+DTadEXEiFc6HS3eGxzQ r6Eq/BQkMFtclS3qGkBUpg3Qtw+fKEQxTT9+hq2vOTIoKqsou+u5coP093TcjT7fJ2XJ Fo2RL3trvax8fWZYXY/Vy1tMdI98do5/B/4Yf4PqmarF5ZqnbjkFzd6aj8lw2ZD3H17a kMOztpir1ETz9z+I8127kjYHqL3Fy9M40/A3W8Yui8rPOd8RG7kze1T/NaCaRwj5n/YM LM/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=VQMLTVikzSuk1GWqoYKb9CQEhIEBrcrpp56ck4PkS3c=; b=L3KxmGefRGWfzKh0s3BMaapbt2V2rR2kR+P/sq3XFCqX4nrzMw9rukiJA4g5oGxafi UqPCh9wyoTpduI1K6rG4ykSosOo608Ch9E9CiysCiXkZarefrtNUtj2ZwA6qWaEiNE+3 ByhU6dWC7f6bXfGwpPwVJmv34P2KkmXraebPug/umngyTuPVIR+ZxiBzcOj2vlZnfFmc KrpbaQwQ2aqsPGxXhQGfFidKRLKUFGb5pt/NoVUmaiJ8yapQwFV59EbA4YXN9JGSL/ex b+AELNha+hCtP2xV04oZYN/DM55OI5Na6qEZ7h5kevslgOnStbZCK1TO+Um6u27Me+NF WFtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ZA4HCaRM; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v16si21131583jal.55.2021.08.25.07.09.49; Wed, 25 Aug 2021 07:10:01 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ZA4HCaRM; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240704AbhHYOID (ORCPT + 99 others); Wed, 25 Aug 2021 10:08:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229760AbhHYOID (ORCPT ); Wed, 25 Aug 2021 10:08:03 -0400 Received: from mail-qk1-x732.google.com (mail-qk1-x732.google.com [IPv6:2607:f8b0:4864:20::732]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68B81C061757 for ; Wed, 25 Aug 2021 07:07:17 -0700 (PDT) Received: by mail-qk1-x732.google.com with SMTP id c10so24645663qko.11 for ; Wed, 25 Aug 2021 07:07:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=VQMLTVikzSuk1GWqoYKb9CQEhIEBrcrpp56ck4PkS3c=; b=ZA4HCaRMncysEcfJQD3bXKZ54crDRH4ogCec2N2BXl0QFL7VmEDnTUl6m+bx7zthnZ vSdeJrElfQtt4X0U/fzV1c9/3yh6DP/J1UCwSQ2iPLLOkLMle8ARpn0TSXhUqJVeT6S3 mzNukF8bbANu4k1QD98P9+MppKEArtsXMzqiGi9UsR4Mpy/2mfRCeTkFyz3eoyPPOk0l WzofgZ+47mUeqVrzh/RB8xmCJAJd8xGL+/76F1Cgslc80NE7FkyF3wycO3wXKkXcrxY5 5LVRCzQCGKQ37fAyrqBkU77HFgJSK5f1GtUMTLk1Y6bnjzLOA7V30ry39mrcOE2mEIq2 iQKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=VQMLTVikzSuk1GWqoYKb9CQEhIEBrcrpp56ck4PkS3c=; b=JVzvnDUxA6dEoJPoQbgHo8sLHHKiMHfsbVTnaoXUJgPd/h7bSMkJNtqtpIBlysVbrW Vh9PZJcZh5gob34cLc7wJ0p39emKRdje1zd9cKABmLqpYbDvyuVZbCcUbidzuD7NJZlA wjfuxeK2P8QmRe4fcXHyJf4GmfUYCef+IaepckMO3a8+KXcP0g6ZZqAqueAlb0szFMFi gUO5koHrttcxMce8aRaVWmuQXOE7m0qWxlYUjxRyUtS3NqGkTo/8xu7cMTWB4wyo3mSa LxWNpBS1/7AQlfNXMNN7TTP4sSBbJC5lP4U8vIg/EoZvsQp06FQKMOP78vGsyq6bIR2x DWTA== X-Gm-Message-State: AOAM531o6PCvyduLOsvxU4fafVF1hpl8FpaVk9qOSbU08JCFQS23FPOc kHShi1HSf31qZjNyBOdXaiuVxWZLpeWckqTCts0= X-Received: by 2002:ae9:e915:: with SMTP id x21mr31917263qkf.183.1629900436612; Wed, 25 Aug 2021 07:07:16 -0700 (PDT) MIME-Version: 1.0 References: <20210808072643.GA5084@ubuntu> <20210816093126.442f74a1@xps13> <20210819100334.6af2d86e@xps13> <20210823172413.0bc4ab3a@xps13> <20210824192203.076df55e@xps13> <20210825105126.4c1c15cb@xps13> In-Reply-To: <20210825105126.4c1c15cb@xps13> From: Kestrel seventyfour Date: Wed, 25 Aug 2021 16:07:05 +0200 Message-ID: Subject: Re: [PATCH v2] mtd: rawnand: xway: No hardcoded ECC engine, use device tree setting To: Miquel Raynal Cc: Richard Weinberger , Vignesh Raghavendra , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Miqu=C3=A8l, Am Mi., 25. Aug. 2021 um 10:51 Uhr schrieb Miquel Raynal : > > > Kestrel seventyfour wrote on Wed, 25 Aug > 2021 10:47:40 +0200: > > > Hi Miqu=C3=A8l, > > > > Am Di., 24. Aug. 2021 um 19:22 Uhr schrieb Miquel Raynal > > : > > > > > > Hello, > > > > > > Kestrel seventyfour wrote on Tue, 24 A= ug > > > 2021 09:15:49 +0200: > > > > > > > Hi Miqu=C3=A8l, > > > > > > > > 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=C3=A8l, > > > > > > > > > > > > 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 pos= sible, > > > > > > 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 it= s > > > > > > 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 us= ers, > > > > > 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=C3=A8l > > > > > > > > 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 =3D nand_scan(&data->chip, 1); > > > > if (err /* && of_property_read_bool(np, "lantiq,retry-on-di= e") */) { > > > > data->chip.ecc.engine_type =3D NAND_ECC_ENGINE_TYPE= _ON_DIE; > > > > err =3D 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=C3=A8l > > > > Its for Openwrt, I would like to add support for 3 more devices > > AVM fritzbox 3490/5490 and 7490. They all have varying NAND chips. > > I have initially created a PR to have my initial patch tested: > > https://github.com/openwrt/openwrt/pull/4426 > > There is already one device supported which has two DTBs one for > > Micron and one for non Micron (3370), but its not very straight forward= . > > Without having this issue solved, flashing those devices would be > > possibly having issues depending on NAND chip or the awkward > > workaround of flashing one image and if it does not boot, boot the > > other one. Without self soldered serial console, it would not very > > easy to figure out the NAND manufacturer. > > The AVM stock firmware is old kernel and does not use device > > tree for NAND, they just query all possible manufacturers and set > > up NAND based on manufacturer query. > > But in this case can't you check the 'root' compatible against certain > values and and some kind of quirk in the ->attach() hook to update the > ECC engine to the right one? > > Thanks, > Miqu=C3=A8l maybe I wrote the wrong thing, but what do you mean with root compatible. The controller is always NAND xway and I think there are 4 different NAND chip types. But the stock firmware just queries the NAND manufacturer name, not a date or type/model of the devices. E.g. 7490 can have Micron or Macronix NAND, but querying the Micron id or Macronix id requires a change to the xway driver? Do you mean something like in the first patch do query the manufacturer but just for all the 4? Thanks, Daniel.