Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp3254068imm; Sun, 24 Jun 2018 15:47:27 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKUJM1z6hOc0NKn/agSI5TK/wWiFGb43yPFs2LRMwFsiox9t8ctS+DBD2gDNoH7WHokRr4U X-Received: by 2002:a17:902:ba97:: with SMTP id k23-v6mr10030877pls.259.1529880447017; Sun, 24 Jun 2018 15:47:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529880446; cv=none; d=google.com; s=arc-20160816; b=mLGf9lRUTVkx1azefstmnMKlQeBvigE1/pJky/Q+hej0en6FekTH4CchOn+zzAy8Jk Xy/gzE2syPex/D9f7CjHTNOCIEfb6JzmqEEhB+/ik96oYibwI3oxCM58zh+CjttUDrqF IfejNKwW2ScGCn30UQrc3e1ms7Zw31eRNd5vjD20mVptYop2KxCDMSnVHTY2PJVsKMk7 W9sExdM/Z7y0h1FCe526qxdgmz+PXCgXXieYnSHRS+rgqPMDI4aXqE7vbFqxAEVTMFSz 5DSlfcFMsxUUdP0VJqJ36C2WazqdMB/GouR+wzYEtMeZo9qeL5B0YXiZnsuyLmE9IYHZ sinQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=ZUQi09JnsYs0EIb6IhpuYL5TBptPy7Kb6rjaHPfJo/Y=; b=v7n86v6f8OA++NqtlOlubCG2ayGnHERwyRaaaxTSrkokYotVJlmBmT4h8JO0DVxUqj E4RoN9rqOprcx8jWlN6Hup20L4zMUx94Iu6EL+xu1pkmmjtpYnQPeMW2E0B+2Q2KJ6xz KKgwfBNmOZp5Fy3MutqgGxstVXcXn9vcn5+g7iNhOluaWhyyC48UEPTV6Pa0QXhWak8f 1lo4XPlQnaiyvwL1Mkl0T3NJMl0JjQwMNGaFe7aJFy9w9W+s686Hlkk8HC47fUjLYdXq +n9gPXQkm9m+OMa/Tz4Zawwp48hWfVVkSC9cnSTKJ73MaOTC6XOnN5w0LDVJii/HMGoZ wz9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alliedtelesis.co.nz header.s=mail header.b=NlaMxeiQ; 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=pass (p=NONE sp=NONE dis=NONE) header.from=alliedtelesis.co.nz Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c13-v6si10430412pgq.316.2018.06.24.15.47.12; Sun, 24 Jun 2018 15:47:26 -0700 (PDT) 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=pass header.i=@alliedtelesis.co.nz header.s=mail header.b=NlaMxeiQ; 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=pass (p=NONE sp=NONE dis=NONE) header.from=alliedtelesis.co.nz Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752479AbeFXWqJ (ORCPT + 99 others); Sun, 24 Jun 2018 18:46:09 -0400 Received: from gate2.alliedtelesis.co.nz ([202.36.163.20]:56277 "EHLO gate2.alliedtelesis.co.nz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751966AbeFXWpD (ORCPT ); Sun, 24 Jun 2018 18:45:03 -0400 Received: from mmarshal3.atlnz.lc (mmarshal3.atlnz.lc [10.32.18.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by gate2.alliedtelesis.co.nz (Postfix) with ESMTPS id E283C8448C; Mon, 25 Jun 2018 10:45:01 +1200 (NZST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alliedtelesis.co.nz; s=mail; t=1529880301; bh=ZUQi09JnsYs0EIb6IhpuYL5TBptPy7Kb6rjaHPfJo/Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=NlaMxeiQ5RqinsnqKtUtzPbt6vcyAI6Yp+8Mh7DNoLXONTBAzhCCq4FaVZTTnSJPj 4FH6cxqHJt7/7U40YyfN2e0Eg4GZw3SCCb19vjasaNHC5S7MbGd2rSrhSjUwIJT5/Z ZWLrFhyWKdnAntYvgtaXehlqv9U9IS9ojkyy1d64= Received: from smtp (Not Verified[10.32.16.33]) by mmarshal3.atlnz.lc with Trustwave SEG (v7,5,8,10121) id ; Mon, 25 Jun 2018 10:45:01 +1200 Received: from chrisp-dl.ws.atlnz.lc (chrisp-dl.ws.atlnz.lc [10.33.22.30]) by smtp (Postfix) with ESMTP id 1F2FD13EFAE; Mon, 25 Jun 2018 10:45:00 +1200 (NZST) Received: by chrisp-dl.ws.atlnz.lc (Postfix, from userid 1030) id B050D1E2626; Mon, 25 Jun 2018 10:44:56 +1200 (NZST) From: Chris Packham To: miquel.raynal@bootlin.com, boris.brezillon@bootlin.com, dwmw2@infradead.org, computersforpeace@gmail.com, linux-mtd@lists.infradead.org Cc: linux-kernel@vger.kernel.org, Chris Packham , Richard Weinberger , Marek Vasut Subject: [PATCH v6 2/6] mtd: rawnand: add manufacturer fixup for ONFI parameter page Date: Mon, 25 Jun 2018 10:44:44 +1200 Message-Id: <20180624224448.21872-3-chris.packham@alliedtelesis.co.nz> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180624224448.21872-1-chris.packham@alliedtelesis.co.nz> References: <20180624224448.21872-1-chris.packham@alliedtelesis.co.nz> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is called after the ONFI parameter page checksum is verified and allows us to override the contents of the parameter page. Suggested-by: Boris Brezillon Signed-off-by: Chris Packham Reviewed-by: Boris Brezillon --- Changes in v2: - New Changes in v3: - Add doc comment and review from Boris Changes in v4: - None Changes in v5: - None Changes in v6: - None drivers/mtd/nand/raw/nand_base.c | 4 ++++ include/linux/mtd/rawnand.h | 3 +++ 2 files changed, 7 insertions(+) diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c index 0cd3e216b95c..65250308c82d 100644 --- a/drivers/mtd/nand/raw/nand_base.c +++ b/drivers/mtd/nand/raw/nand_base.c @@ -5172,6 +5172,10 @@ static int nand_flash_detect_onfi(struct nand_chip *chip) } } + if (chip->manufacturer.desc && chip->manufacturer.desc->ops && + chip->manufacturer.desc->ops->fixup_onfi_param_page) + chip->manufacturer.desc->ops->fixup_onfi_param_page(chip, p); + /* Check version */ val = le16_to_cpu(p->revision); if (val & (1 << 5)) diff --git a/include/linux/mtd/rawnand.h b/include/linux/mtd/rawnand.h index 3e8ec3b8a39c..ef7e3b4e91ea 100644 --- a/include/linux/mtd/rawnand.h +++ b/include/linux/mtd/rawnand.h @@ -778,11 +778,14 @@ nand_get_sdr_timings(const struct nand_data_interface *conf) * implementation) if any. * @cleanup: the ->init() function may have allocated resources, ->cleanup() * is here to let vendor specific code release those resources. + * @fixup_onfi_param_page: apply vendor specific fixups to the ONFI + * parameter page. This is called after the checksum is verified. */ struct nand_manufacturer_ops { void (*detect)(struct nand_chip *chip); int (*init)(struct nand_chip *chip); void (*cleanup)(struct nand_chip *chip); + void (*fixup_onfi_param_page)(struct nand_chip *chip, struct nand_onfi_params *p); }; /** -- 2.18.0