From patchwork Fri Jun 3 10:17:17 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jamie Iles X-Patchwork-Id: 98541 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 0BD37B6FB0 for ; Fri, 3 Jun 2011 20:19:02 +1000 (EST) Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QSRSO-000316-RA; Fri, 03 Jun 2011 10:18:21 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QSRSO-0002KZ-0H; Fri, 03 Jun 2011 10:18:20 +0000 Received: from mail-ww0-f41.google.com ([74.125.82.41]) by canuck.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QSRRm-0002Bx-H7 for linux-mtd@lists.infradead.org; Fri, 03 Jun 2011 10:17:44 +0000 Received: by wwi18 with SMTP id 18so5001452wwi.0 for ; Fri, 03 Jun 2011 03:17:40 -0700 (PDT) Received: by 10.216.255.206 with SMTP id j56mr622182wes.39.1307096260440; Fri, 03 Jun 2011 03:17:40 -0700 (PDT) Received: from localhost (cpc3-chap8-2-0-cust205.aztw.cable.virginmedia.com [94.171.253.206]) by mx.google.com with ESMTPS id 74sm752188wem.17.2011.06.03.03.17.38 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 03 Jun 2011 03:17:39 -0700 (PDT) From: Jamie Iles To: linux-mtd@lists.infradead.org Subject: [PATCH 5/6] nand/denali: support MTD partitioning Date: Fri, 3 Jun 2011 11:17:17 +0100 Message-Id: <1307096238-25751-6-git-send-email-jamie@jamieiles.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1307096238-25751-1-git-send-email-jamie@jamieiles.com> References: <1307096238-25751-1-git-send-email-jamie@jamieiles.com> X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110603_061742_726491_D6135E27 X-CRM114-Status: GOOD ( 15.71 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [74.125.82.41 listed in list.dnswl.org] Cc: Jamie Iles , Artem Bityutskiy , David Woodhouse , Chuanxiao Dong X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.12 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-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Allow the platform to specify partitions through platform data. If there are no partitions specified then the whole device will be registered. Cc: David Woodhouse Cc: Chuanxiao Dong Cc: Artem Bityutskiy Signed-off-by: Jamie Iles --- drivers/mtd/nand/denali.c | 8 +++++++- include/linux/platform_data/denali.h | 8 ++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/nand/denali.c b/drivers/mtd/nand/denali.c index fb8e49e..19998ed 100644 --- a/drivers/mtd/nand/denali.c +++ b/drivers/mtd/nand/denali.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -1644,7 +1645,12 @@ static int denali_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) goto failed_req_irq; } - ret = mtd_device_register(&denali->mtd, NULL, 0); + if (pdata && pdata->parts) + ret = mtd_device_register(&denali->mtd, pdata->parts, + pdata->nr_parts); + else + ret = mtd_device_register(&denali->mtd, NULL, 0); + if (ret) { dev_err(denali->dev, "Spectra: Failed to register MTD: %d\n", ret); diff --git a/include/linux/platform_data/denali.h b/include/linux/platform_data/denali.h index 3767333..141da35 100644 --- a/include/linux/platform_data/denali.h +++ b/include/linux/platform_data/denali.h @@ -14,9 +14,13 @@ #ifndef __DENALI_PDATA_H__ #define __DENALI_PDATA_H__ +struct mtd_partition; + struct denali_nand_pdata { - int nr_ecc_bits; - bool have_hw_ecc_fixup; + int nr_ecc_bits; + bool have_hw_ecc_fixup; + const struct mtd_partition *parts; + unsigned int nr_parts; }; #endif /* __DENALI_PDATA_H__ */