Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp2890209ima; Sun, 3 Feb 2019 08:51:06 -0800 (PST) X-Google-Smtp-Source: AHgI3IYl7NMc/2TDRxEU+GlazJfHZztnZHuSzQd0sdqxJSjaRbPcNgW3VL5T29jrGTELVpitNpfs X-Received: by 2002:a63:5359:: with SMTP id t25mr4802268pgl.99.1549212665954; Sun, 03 Feb 2019 08:51:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549212665; cv=none; d=google.com; s=arc-20160816; b=KNHC2HX9833mwqp+gLteQrV5U9KdDfVRzMKbPxcLPf9oHK9tDflCoJ52Li1YI7374d /eEc1BDxx+qtbfYZdDgFZDjGHTm2DKVU2SNse4MIJSUma64LB8X8RV+TYj/uQop9n7Uh OnzSVIDtraljZsdjgz3V/Gtk79/FrVLp8yRI3eNh12gNa/6u2p72VSRqZe+jFrgf7oHH 4hb/snYVLxA5pQ3YmaD4myi8mQ2ui/Fgx4mMPWimC1DV4rsX6lS5XTRx8bR/o+CyygEG 6RWiaeO7ETQpYcKfSvWBdcN+WkqxjHsbJQrIOTIQT6syVJD5Yfwx1/ZpID83tUEL0dGB F8Ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:cc:to:subject:from:date :dkim-signature; bh=cxGqXpC15cN9qReCJvF1w7F/vVYzPLdTdA/x6plKpns=; b=nV2o+a/ahQD8B4ZbWWgWvki7k0OX/7TCfPJ3bcJFuHuJGwplClvLHAEevFWAWaR88v bZpQnvlz2aHje5jEfcoZpecA+NdrGjA9B4XQtFfANK7yHxauEOl8WEVxVM+VANKEVhYI chGUBPQEZ1YwsOyKE178ShrpUnkWWFDKFTnogYx0YvghoTKNz6Dq81bFGZlDxRT63PDW i6B85F56CtTvwZ63t9vObzna6sUNR+pYJAtAaSzoM2VnuN66tfSC+DbWwmoC4P/Q4D3m /1mb4awXhODnR25UfGnB4dPLIGrza4e4uUGWddqnAmnY1twZJx7rx4meIDIu9RFgiYgn yo5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@crapouillou.net header.s=mail header.b=TIbNGkcP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t3si12624701pgg.403.2019.02.03.08.50.50; Sun, 03 Feb 2019 08:51:05 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@crapouillou.net header.s=mail header.b=TIbNGkcP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728789AbfBCPlr (ORCPT + 99 others); Sun, 3 Feb 2019 10:41:47 -0500 Received: from outils.crapouillou.net ([89.234.176.41]:58946 "EHLO crapouillou.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727583AbfBCPlr (ORCPT ); Sun, 3 Feb 2019 10:41:47 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1549208504; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cxGqXpC15cN9qReCJvF1w7F/vVYzPLdTdA/x6plKpns=; b=TIbNGkcPzEkP24OAg1Han7HkdFyf1txRGmgtSPipsh2BGcqcyPGk6G3qJ1k/VOL7RU6wXY mijlurskzDNaQLSK6FgTP2myYH9onS1q+TBINXOO6NZuMpixDoBCA1Arz+atRWLgANIO1c IWFsOAamV3Xl0KU5RqyGdWX5Cx92fA4= Date: Sun, 03 Feb 2019 12:41:30 -0300 From: Paul Cercueil Subject: Re: [PATCH v2 9/9] mtd: rawnand: jz4780-bch: Add support for the JZ4740 To: Boris Brezillon Cc: Miquel Raynal , David Woodhouse , Brian Norris , Marek Vasut , Richard Weinberger , Rob Herring , Mark Rutland , Harvey Hunt , Mathieu Malaterre , linux-mtd@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Message-Id: <1549208490.1588.1@crapouillou.net> In-Reply-To: <20190203160709.29d7d721@bbrezillon> References: <20190202231926.2444-1-paul@crapouillou.net> <20190202231926.2444-10-paul@crapouillou.net> <20190203083505.4dc52278@bbrezillon> <1549202293.1950.2@crapouillou.net> <20190203151604.23061e2a@bbrezillon> <1549205792.1588.0@crapouillou.net> <20190203160709.29d7d721@bbrezillon> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le dim. 3 f=E9vr. 2019 =E0 12:07, Boris Brezillon =20 a =E9crit : > On Sun, 03 Feb 2019 11:56:32 -0300 > Paul Cercueil wrote: >=20 >> Le dim. 3 f=E9vr. 2019 =E0 11:16, Boris Brezillon=20 >> >> a =E9crit : >> > On Sun, 03 Feb 2019 10:58:13 -0300 >> > Paul Cercueil wrote: >> > >> >> Le dim. 3 f=E9vr. 2019 =E0 4:35, Boris Brezillon >> >> >> >> a =E9crit : >> >> > On Sat, 2 Feb 2019 20:19:26 -0300 >> >> > Paul Cercueil wrote: >> >> > >> >> >> Add the backend code for the jz4780-bch driver to support=20 >> the >> >> JZ4740 >> >> >> SoC from Ingenic. >> >> >> >> >> >> Signed-off-by: Paul Cercueil >> >> >> --- >> >> >> >> >> >> Changes: >> >> >> >> >> >> v2: New patch >> >> >> >> >> >> drivers/mtd/nand/raw/ingenic/Makefile | 2 +- >> >> >> drivers/mtd/nand/raw/ingenic/jz4740_bch.c | 173 >> >> >> ++++++++++++++++++ >> >> >> .../mtd/nand/raw/ingenic/jz4780_bch_common.c | 1 + >> >> >> .../nand/raw/ingenic/jz4780_bch_internal.h | 1 + >> >> >> 4 files changed, 176 insertions(+), 1 deletion(-) >> >> >> create mode 100644=20 >> drivers/mtd/nand/raw/ingenic/jz4740_bch.c >> >> >> >> >> >> diff --git a/drivers/mtd/nand/raw/ingenic/Makefile >> >> >> b/drivers/mtd/nand/raw/ingenic/Makefile >> >> >> index f38b467490cf..d16c96113a93 100644 >> >> >> --- a/drivers/mtd/nand/raw/ingenic/Makefile >> >> >> +++ b/drivers/mtd/nand/raw/ingenic/Makefile >> >> >> @@ -1,3 +1,3 @@ >> >> >> obj-$(CONFIG_MTD_NAND_JZ4740) +=3D jz4740_nand.o >> >> >> obj-$(CONFIG_MTD_NAND_JZ4780) +=3D jz4780_nand.o >> >> jz4780_bch_common.o >> >> >> \ >> >> >> - jz4780_bch.o jz4725b_bch.o >> >> >> + jz4780_bch.o jz4725b_bch.o jz4740_bch.o >> >> > >> >> > I still don't see the point of the=20 >> jz4780_bch_common/jz47xxx_bch >> >> > separation. You seem to always embed all objects anyway, so=20 >> you >> >> can >> >> > just put the code for both engines in the same source file and >> >> decide >> >> > which one to use based on the compat (which you already do >> >> anyway). >> >> >> >> Each SoC has a different set of registers for the BCH hardware.=20 >> I >> >> can >> >> try to >> >> cram everything into one file, but it won't be that much=20 >> cleaner. >> > >> > Then maybe they deserve separate drivers/modules. >> > >> > BTW, didn't you say that one IP uses Reed-Salomon instead of BCH.=20 >> I'd >> > suggest prefixing structs and functions with jz47xx_ecc instead of >> > jz47xx_bch and naming the common part jz47xx_ecc.c to reflect=20 >> that. >>=20 >> Would it be a good idea to make a generic ECC API that the=20 >> jz47xx_nand >> driver could use? Then the three jz47xx BCH codepaths could be=20 >> separate >> drivers that register with the generic ECC core. >=20 > Definitely. Actually, Miquel is already working on that, but I don't > think it's a good idea to wait for this new framework to be finished=20 > to > get your changes merged. So I'd recommend having a jz specific ECC API > (pretty much the one you have in the common file expect it would be > prefixed with _ecc instead of _bch) and convert it to the generic > approach afterwards. Given the size of the common.c file, you can even > put everything in jz47xx_ecc.h as inline funcs to avoid having yet > another module. Ok, perfect, I'll do that. Thank you for your input! =