From patchwork Fri Dec 27 05:52:04 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olof Johansson X-Patchwork-Id: 305397 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:770:15f::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 10EF32C0235 for ; Fri, 27 Dec 2013 16:51:38 +1100 (EST) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VwQKb-00006q-Jo; Fri, 27 Dec 2013 05:51:33 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VwQKZ-0003dF-Tx; Fri, 27 Dec 2013 05:51:31 +0000 Received: from mail-pb0-f41.google.com ([209.85.160.41]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VwQKX-0003c7-0I for linux-mtd@lists.infradead.org; Fri, 27 Dec 2013 05:51:29 +0000 Received: by mail-pb0-f41.google.com with SMTP id jt11so8944827pbb.0 for ; Thu, 26 Dec 2013 21:51:07 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=tuUgz38KDqWPbVvQBA2/1NFvlZv5bJZaQPLAqgmgfEY=; b=XQWD3dL4Ztl2/Fc+vyCnyCaxKtUotD56GfvbvYToLC6C41Epp+XHYG2ru2xNtihlE1 e4XzFDaU7eFpbSmj6JsorKTE6SOHdW5CYi2eTvhpHqXnixzwVd1gO3zzMj3WuVLgVRr3 esi4x4f2MUW3U2kGP30xFyyT32ofsBxDAmTGTpFzR+Gu1kl9KTHDayoJnh/UDJRaPelK 8mqTqQ9W14pvvUuFY/rQAw7XjXhVZkDALSL4fPhF8G+xJFlzCUsaDIW1oEEpsvypkHlQ wV92jMC21IFhpRaTvpEYskuWk5AXw5G2OwOmWy3jeVRh2ex7zXUq6X1OOPSTcCzk0ysw FNCQ== X-Gm-Message-State: ALoCoQmtMmPvESGnCxc5ayXSPAFZyrk2MUKHimKzw22FMxwfH9oqam2TDrtdhlWZWqgtfO8NVAdA X-Received: by 10.68.244.2 with SMTP id xc2mr48811347pbc.58.1388123467381; Thu, 26 Dec 2013 21:51:07 -0800 (PST) Received: from brutus.lixom.net (173-13-129-225-sfba.hfc.comcastbusiness.net. [173.13.129.225]) by mx.google.com with ESMTPSA id wp8sm59295057pbc.26.2013.12.26.21.51.05 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Dec 2013 21:51:06 -0800 (PST) From: Olof Johansson To: David Woodhouse , Brian Norris Subject: [PATCH] mtd: nand: remove pasemi_nand driver Date: Thu, 26 Dec 2013 21:52:04 -0800 Message-Id: <1388123524-9000-1-git-send-email-olof@lixom.net> X-Mailer: git-send-email 1.7.10.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131227_005129_211182_D81D1D3C X-CRM114-Status: GOOD ( 20.39 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.160.41 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Olof Johansson , linuxppc-dev@lists.ozlabs.org, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org The PA Semi platform is sparsely used these days (with just a handful of known users out there). I'm 100% sure none of them use the MTD NAND driver -- most standard use cases include PCI-e SATA controllers for storage instead, and boot is done from LPC NOR flash. So, there's little reason to keep carrying a driver that's not used by anybody and that just gets hit by some tree-wide or tools-based changes every now and then. Signed-off-by: Olof Johansson --- drivers/mtd/nand/pasemi_nand.c | 238 ---------------------------------------- 1 file changed, 238 deletions(-) delete mode 100644 drivers/mtd/nand/pasemi_nand.c diff --git a/drivers/mtd/nand/pasemi_nand.c b/drivers/mtd/nand/pasemi_nand.c deleted file mode 100644 index 90f871a..0000000 --- a/drivers/mtd/nand/pasemi_nand.c +++ /dev/null @@ -1,238 +0,0 @@ -/* - * Copyright (C) 2006-2007 PA Semi, Inc - * - * Author: Egor Martovetsky - * Maintained by: Olof Johansson - * - * Driver for the PWRficient onchip NAND flash interface - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#undef DEBUG - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#define LBICTRL_LPCCTL_NR 0x00004000 -#define CLE_PIN_CTL 15 -#define ALE_PIN_CTL 14 - -static unsigned int lpcctl; -static struct mtd_info *pasemi_nand_mtd; -static const char driver_name[] = "pasemi-nand"; - -static void pasemi_read_buf(struct mtd_info *mtd, u_char *buf, int len) -{ - struct nand_chip *chip = mtd->priv; - - while (len > 0x800) { - memcpy_fromio(buf, chip->IO_ADDR_R, 0x800); - buf += 0x800; - len -= 0x800; - } - memcpy_fromio(buf, chip->IO_ADDR_R, len); -} - -static void pasemi_write_buf(struct mtd_info *mtd, const u_char *buf, int len) -{ - struct nand_chip *chip = mtd->priv; - - while (len > 0x800) { - memcpy_toio(chip->IO_ADDR_R, buf, 0x800); - buf += 0x800; - len -= 0x800; - } - memcpy_toio(chip->IO_ADDR_R, buf, len); -} - -static void pasemi_hwcontrol(struct mtd_info *mtd, int cmd, - unsigned int ctrl) -{ - struct nand_chip *chip = mtd->priv; - - if (cmd == NAND_CMD_NONE) - return; - - if (ctrl & NAND_CLE) - out_8(chip->IO_ADDR_W + (1 << CLE_PIN_CTL), cmd); - else - out_8(chip->IO_ADDR_W + (1 << ALE_PIN_CTL), cmd); - - /* Push out posted writes */ - eieio(); - inl(lpcctl); -} - -int pasemi_device_ready(struct mtd_info *mtd) -{ - return !!(inl(lpcctl) & LBICTRL_LPCCTL_NR); -} - -static int pasemi_nand_probe(struct platform_device *ofdev) -{ - struct pci_dev *pdev; - struct device_node *np = ofdev->dev.of_node; - struct resource res; - struct nand_chip *chip; - int err = 0; - - err = of_address_to_resource(np, 0, &res); - - if (err) - return -EINVAL; - - /* We only support one device at the moment */ - if (pasemi_nand_mtd) - return -ENODEV; - - pr_debug("pasemi_nand at %pR\n", &res); - - /* Allocate memory for MTD device structure and private data */ - pasemi_nand_mtd = kzalloc(sizeof(struct mtd_info) + - sizeof(struct nand_chip), GFP_KERNEL); - if (!pasemi_nand_mtd) { - printk(KERN_WARNING - "Unable to allocate PASEMI NAND MTD device structure\n"); - err = -ENOMEM; - goto out; - } - - /* Get pointer to private data */ - chip = (struct nand_chip *)&pasemi_nand_mtd[1]; - - /* Link the private data with the MTD structure */ - pasemi_nand_mtd->priv = chip; - pasemi_nand_mtd->owner = THIS_MODULE; - - chip->IO_ADDR_R = of_iomap(np, 0); - chip->IO_ADDR_W = chip->IO_ADDR_R; - - if (!chip->IO_ADDR_R) { - err = -EIO; - goto out_mtd; - } - - pdev = pci_get_device(PCI_VENDOR_ID_PASEMI, 0xa008, NULL); - if (!pdev) { - err = -ENODEV; - goto out_ior; - } - - lpcctl = pci_resource_start(pdev, 0); - pci_dev_put(pdev); - - if (!request_region(lpcctl, 4, driver_name)) { - err = -EBUSY; - goto out_ior; - } - - chip->cmd_ctrl = pasemi_hwcontrol; - chip->dev_ready = pasemi_device_ready; - chip->read_buf = pasemi_read_buf; - chip->write_buf = pasemi_write_buf; - chip->chip_delay = 0; - chip->ecc.mode = NAND_ECC_SOFT; - - /* Enable the following for a flash based bad block table */ - chip->bbt_options = NAND_BBT_USE_FLASH; - - /* Scan to find existence of the device */ - if (nand_scan(pasemi_nand_mtd, 1)) { - err = -ENXIO; - goto out_lpc; - } - - if (mtd_device_register(pasemi_nand_mtd, NULL, 0)) { - printk(KERN_ERR "pasemi_nand: Unable to register MTD device\n"); - err = -ENODEV; - goto out_lpc; - } - - printk(KERN_INFO "PA Semi NAND flash at %08llx, control at I/O %x\n", - res.start, lpcctl); - - return 0; - - out_lpc: - release_region(lpcctl, 4); - out_ior: - iounmap(chip->IO_ADDR_R); - out_mtd: - kfree(pasemi_nand_mtd); - out: - return err; -} - -static int pasemi_nand_remove(struct platform_device *ofdev) -{ - struct nand_chip *chip; - - if (!pasemi_nand_mtd) - return 0; - - chip = pasemi_nand_mtd->priv; - - /* Release resources, unregister device */ - nand_release(pasemi_nand_mtd); - - release_region(lpcctl, 4); - - iounmap(chip->IO_ADDR_R); - - /* Free the MTD device structure */ - kfree(pasemi_nand_mtd); - - pasemi_nand_mtd = NULL; - - return 0; -} - -static const struct of_device_id pasemi_nand_match[] = -{ - { - .compatible = "pasemi,localbus-nand", - }, - {}, -}; - -MODULE_DEVICE_TABLE(of, pasemi_nand_match); - -static struct platform_driver pasemi_nand_driver = -{ - .driver = { - .name = driver_name, - .owner = THIS_MODULE, - .of_match_table = pasemi_nand_match, - }, - .probe = pasemi_nand_probe, - .remove = pasemi_nand_remove, -}; - -module_platform_driver(pasemi_nand_driver); - -MODULE_LICENSE("GPL"); -MODULE_AUTHOR("Egor Martovetsky "); -MODULE_DESCRIPTION("NAND flash interface driver for PA Semi PWRficient");