From patchwork Sat Apr 25 08:27:59 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gaurav Singh X-Patchwork-Id: 26436 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by bilbo.ozlabs.org (Postfix) with ESMTPS id 7922AB707C for ; Sat, 25 Apr 2009 18:29:57 +1000 (EST) Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1LxdF4-0001Ob-FN; Sat, 25 Apr 2009 08:28:10 +0000 Received: from mail-qy0-f108.google.com ([209.85.221.108]) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1LxdEu-00019q-Oc for linux-mtd@lists.infradead.org; Sat, 25 Apr 2009 08:28:07 +0000 Received: by qyk6 with SMTP id 6so2698028qyk.28 for ; Sat, 25 Apr 2009 01:27:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type:content-transfer-encoding; bh=963JIhHanBpjxkkkOUAQNDRnG+wkdlWYsGiyLe4NVtY=; b=J1RXYbGJPYSRi4+tfPnsRnJ5YZ/9FIf7KFU3g8+JuPP95/Ej6xarJq+fAVxpoN+0GX MUCYWhwhLHbzxJcT18cXtXCfAjpNuSZ2brUdA60yujU8hlu4IaodACqUd8OPE4uyL95m oWiu7NV2ZhpN2wnEK91Frld7+HeqQP+aTa56w= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type :content-transfer-encoding; b=Pz1G0ahsL5am7iP5xjr53lgBrj6LPSm01hXRLszeh2bvhUtXCR2v8VS8htpuAHOWjT xhWNU0BCnZmqIkn4Xrh3z+3Nsta2jBKQpi0CUUGp97tek71XBxQbNwB0YSGu5voLOGIX fNnoC3v4tC0Hg7avvxy1g9cQG2s6FNVTLm9YE= MIME-Version: 1.0 Received: by 10.220.93.1 with SMTP id t1mr6588222vcm.3.1240648079500; Sat, 25 Apr 2009 01:27:59 -0700 (PDT) Date: Sat, 25 Apr 2009 13:57:59 +0530 Message-ID: <3cc7a0df0904250127y3f2dbb65t50f349c3e9dfb969@mail.gmail.com> Subject: [PATCH] Onenand Reset IOBE bit in SYS_CFG register in onenand_release From: Gaurav Singh To: Linux mtd group X-Spam-Score: 0.0 (/) X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Hi all, I am a Linux enthusiast and was using ONENAND device of an embedded ARM device (Nomadik board - made and distributed by STMicroelectronics). The device is Muxed OneNAND 128MB 1.8V 16-bit (0x30) OneNAND version = 0x0221 according to the probe prints. Looks like a 1Gb Mux Onenand flash. The driver for this device is using the interrupt mode operation. Interestingly the GPIO interrupt pin of ONENAND is shared with a pin of the NAND device. I was trying to use both NAND and ONENAND drivers as modules and found that after inserting the ONENAND driver and removing it I could not work with the NAND driver. This is inspite of the fact all pins used by the ONENAND driver have been freed including the interrupt pin. The NAND driver is able to acquire the common pin but cannot write to this pin. Infact the ONENAND interrupt GPIO pin is unusable even after the ONENAND driver is removed from the system. I noticed that before the interrupt pin is acquired by the ONENAND driver we are setting the IOBE bit in the SYS_CFG register as high. At remove time this bit has not been reset. Resetting this bit and repeating my test I found that the fix worked and the pin could now be used by the NAND driver. Proposed PATCH is as given below: Will this proposed patch also help saving some power lost due to output leakage current as IOBE is still enabled and the INT pin is connected to the ONENAND instead of in High impedence state ? Regards Gaurav Singh diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c index 0e168d8..9b2f9aa 100644 --- a/drivers/mtd/onenand/onenand_base.c +++ b/drivers/mtd/onenand/onenand_base.c @@ -2728,6 +2728,13 @@ void onenand_release(struct mtd_info *mtd) /* Deregister partitions */ del_mtd_partitions (mtd); #endif + /* Reset the IOBE bit in SYS_CFG Register */ + if ( this->wait == onenand_interrupt_wait ) + { + int syscfg = this->read_word(this->base + ONENAND_REG_SYS_CFG1); + syscfg &= ~ONENAND_SYS_CFG1_IOBE; + this->write_word(syscfg, this->base + ONENAND_REG_SYS_CFG1); + } /* Deregister the device */ del_mtd_device (mtd);