Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp5509990ybp; Tue, 15 Oct 2019 00:13:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqy9jZ1b+ByxG1yD50uAWWWFBNaND7ELZBMRaXXLw2pe1+yafuT8DfWQRhm4Y64Qn80KCoCV X-Received: by 2002:a17:906:8317:: with SMTP id j23mr32029063ejx.314.1571123622107; Tue, 15 Oct 2019 00:13:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571123622; cv=none; d=google.com; s=arc-20160816; b=1BTz9p0ThWOY8Rkyj3xoYPQ91/RGcPsUC3WYWetoFhSv3S87P+m7AbeqDQZpptPCMH xQnABm0pmSjMb7lasyf7HmjrbK66trUQJfPqDpumS0NkH0hLi5rAEswiFbj2t3Y57ee7 D6WBCgyKJ/PgYu4aie7bJQdz43tdr675SVjMwaPW8ALlHsyv0F2ufhRIttzmnVYBii0O 3t/tz6Zzpgz3sLQSIq/nR/y7yl/TvXQFx3r0oGpwz5gP+sO1ygGyJeYt4oqpOsmjAQLU z0kZO1DSV2vVRwwBrVu+veT20rmVVVLbXQoUHb7jpZzSlimDx1dpsv74rjg03Bop31Af YOGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:from:message-id:mime-version:subject :cc:to:references:in-reply-to; bh=NJogXZAuQ9KZC43LJSU81S+7K2TVXgN78a0GQT8VSms=; b=MnB4DmmPUib2/Kdt87diRJVnNzbBRVWjDEg7KheTp9FNeJ0fi8GzRfw4IQIuc03PWW QMNVhZwTDFhthNpMMa4ZApMLybWKDc3YawC/4sZ254yLa+hYzJV15DEtA58zabOKCZed le9I1qz9bjPfGIP6++vE6Dnamfw3HP2HtU4lYD5wcPHpyFZhnUYq2icCdjfjwtpZWUPY Al/YlwIeHiWsdT0T+n2pOgNStSw9kBwM+GP6+rCEejNJMa2+XOW4TRfCJ2hc1kUPPBSa LJOuTK3kZpYf85K9y9CX4T6NOTwpLD0WIUbWtwTp/J4vvrbJUUk/nWh/SaGhDqa5Jf9d keFw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s4si12488498eju.265.2019.10.15.00.13.18; Tue, 15 Oct 2019 00:13:41 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727497AbfJOGrm (ORCPT + 99 others); Tue, 15 Oct 2019 02:47:42 -0400 Received: from twhmllg3.macronix.com ([211.75.127.131]:57923 "EHLO TWHMLLG3.macronix.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726052AbfJOGrm (ORCPT ); Tue, 15 Oct 2019 02:47:42 -0400 Received: from twhfmlp1.macronix.com (twhfm1p1.macronix.com [172.17.20.91]) by TWHMLLG3.macronix.com with ESMTP id x9F6lZp4062733; Tue, 15 Oct 2019 14:47:35 +0800 (GMT-8) (envelope-from masonccyang@mxic.com.tw) Received: from MXML06C.mxic.com.tw (mxml06c.mxic.com.tw [172.17.14.55]) by Forcepoint Email with ESMTP id 7FCE536401869601D56D; Tue, 15 Oct 2019 14:47:35 +0800 (CST) In-Reply-To: <20191008170249.06bd45ce@xps13> References: <1568793387-25199-1-git-send-email-masonccyang@mxic.com.tw> <1568793387-25199-2-git-send-email-masonccyang@mxic.com.tw> <20191007104511.5aa7b8f2@xps13> <20191007112442.783e4fbe@xps13> <20191008170249.06bd45ce@xps13> To: "Miquel Raynal" Cc: bbrezillon@kernel.org, computersforpeace@gmail.com, dwmw2@infradead.org, frieder.schrempf@kontron.de, gregkh@linuxfoundation.org, juliensu@mxic.com.tw, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, marcel.ziswiler@toradex.com, marek.vasut@gmail.com, richard@nod.at, tglx@linutronix.de, vigneshr@ti.com Subject: Re: [PATCH RFC 2/3] mtd: rawnand: Add support Macronix Block Protection function MIME-Version: 1.0 X-KeepSent: B4F10613:467EB346-48258494:0020403E; type=4; name=$KeepSent X-Mailer: Lotus Notes Release 8.5.3FP4 SHF90 June 10, 2013 Message-ID: From: masonccyang@mxic.com.tw Date: Tue, 15 Oct 2019 14:47:34 +0800 X-MIMETrack: Serialize by Router on MXML06C/TAIWAN/MXIC(Release 9.0.1FP10 HF265|July 25, 2018) at 2019/10/15 PM 02:47:35, Serialize complete at 2019/10/15 PM 02:47:35 Content-Type: text/plain; charset="US-ASCII" X-MAIL: TWHMLLG3.macronix.com x9F6lZp4062733 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Miquel, > > > > > > > > > Macronix AC series support using SET/GET_FEATURES to change > > > > > Block Protection and Unprotection. > > > > > > > > > > MTD default _lock/_unlock function replacement by manufacturer > > > > > postponed initialization. > > > > > > > > Why would we do that? > > > > > > > > Anyway your solution looks overkill, if we ever decide to > > > > implement these hooks for raw nand, it is better just to not > > > > overwrite them in nand_scan_tail() if they have been filled > > > > previously (ie. by the manufacturer code). > > > > > > Actually you should add two NAND hooks that do the interface with the > > > MTD hooks. In the NAND hooks, check that the request is to lock all the > > > device, otherwise return -ENOTSUPP. > > > > sorry, can't get your point. > > > > Because the NAND entire chip will be protected if PT(protection) pin > > is active high at power-on. > > In your implementation of the locking, you should check that the > locking request is over the entire device, unless you can lock a > smaller portion of course. yes, I can lock a smaller portion. And at the power-on of device with PT pin at high voltage, all blocks are locked. They have to be unlocked by set feature command. > > > > > > > > > Then fill-in these two hooks from the manufacturer code, without the > > > postponed init. > > > > > > > But in the final of nand_scan_tail(), mtd->_lock/_unlock will be > > filled by NULL, right ? > > The NAND core should set mtd->_lock/_unlock() to NAND specific hooks so > that the MTD layer is abstracted and and drivers do not see it. Then, > in the NAND helper, either there is no specific hook defined by a > manufacturer driver and you return -ENOTSUPP, or you execute the > defined hook. okay, patch specific manufacturer _lock/_unlock driver in nand_manufacturer_init(); and in the final of nand_scan_tail() if (!mtd->_lock) mtd->_lock = NULL; if (!mtd->_unlock) mtd->_unlock = NULL; thanks for your time and comments. Mason CONFIDENTIALITY NOTE: This e-mail and any attachments may contain confidential information and/or personal data, which is protected by applicable laws. Please be reminded that duplication, disclosure, distribution, or use of this e-mail (and/or its attachments) or any part thereof is prohibited. If you receive this e-mail in error, please notify us immediately and delete this mail as well as its attachment(s) from your system. In addition, please be informed that collection, processing, and/or use of personal data is prohibited unless expressly permitted by personal data protection laws. Thank you for your attention and cooperation. Macronix International Co., Ltd. ===================================================================== ============================================================================ CONFIDENTIALITY NOTE: This e-mail and any attachments may contain confidential information and/or personal data, which is protected by applicable laws. Please be reminded that duplication, disclosure, distribution, or use of this e-mail (and/or its attachments) or any part thereof is prohibited. If you receive this e-mail in error, please notify us immediately and delete this mail as well as its attachment(s) from your system. In addition, please be informed that collection, processing, and/or use of personal data is prohibited unless expressly permitted by personal data protection laws. Thank you for your attention and cooperation. Macronix International Co., Ltd. =====================================================================