From patchwork Mon Feb 28 04:09:28 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh KUMAR X-Patchwork-Id: 84722 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 ozlabs.org (Postfix) with ESMTPS id 30C2AB7123 for ; Mon, 28 Feb 2011 15:11:24 +1100 (EST) Received: from canuck.infradead.org ([2001:4978:20e::1]) by bombadil.infradead.org with esmtps (Exim 4.72 #1 (Red Hat Linux)) id 1PtuR0-0000QD-JI; Mon, 28 Feb 2011 04:10:10 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.72 #1 (Red Hat Linux)) id 1PtuQx-0006MS-BY; Mon, 28 Feb 2011 04:10:07 +0000 Received: from eu1sys200aog110.obsmtp.com ([207.126.144.129]) by canuck.infradead.org with smtps (Exim 4.72 #1 (Red Hat Linux)) id 1PtuQt-0006M4-FO for linux-mtd@lists.infradead.org; Mon, 28 Feb 2011 04:10:04 +0000 Received: from source ([138.198.100.35]) (using TLSv1) by eu1sys200aob110.postini.com ([207.126.147.11]) with SMTP ID DSNKTWsgECA6WW5IcyNc9YET5ZAaEFR8qxR8@postini.com; Mon, 28 Feb 2011 04:10:03 UTC Received: from zeta.dmz-ap.st.com (ns6.st.com [138.198.234.13]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 3DE20A0; Mon, 28 Feb 2011 04:09:30 +0000 (GMT) Received: from Webmail-ap.st.com (eapex1hubcas1.st.com [10.80.176.8]) by zeta.dmz-ap.st.com (STMicroelectronics) with ESMTP id CF068701; Mon, 28 Feb 2011 04:09:30 +0000 (GMT) Received: from localhost (10.199.7.86) by Webmail-ap.st.com (10.80.176.7) with Microsoft SMTP Server (TLS) id 8.2.234.1; Mon, 28 Feb 2011 12:09:29 +0800 From: Viresh Kumar To: , , , Subject: [PATCH V2 resend] fsmc-nand: Add fsmc_nand_set_plat_data in drivers/mtd/nand/fsmc_nand.c Date: Mon, 28 Feb 2011 09:39:28 +0530 Message-ID: <8b8879499520ac641f7e38ac0e40182eb7f32f85.1298866118.git.viresh.kumar@st.com> X-Mailer: git-send-email 1.7.2.2 MIME-Version: 1.0 X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110227_231003_748939_C94FB561 X-CRM114-Status: GOOD ( 18.48 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [207.126.144.129 listed in list.dnswl.org] Cc: Vipin Kumar , Viresh Kumar 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: , Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org In most of the cases partitions info, width, etc comes from board files. And device structure may be defined in machine files, common to all board files. Thus, we need to set platform data from board file, for which fsmc_nand_set_plat_data routine is required. This routine will be used in SPEAr fsmc patches which are sent in a different patchset. Acked-by: Linus Walleij Signed-off-by: Viresh Kumar Signed-off-by: Vipin Kumar --- drivers/mtd/nand/fsmc_nand.c | 18 ++++++++++++++++++ include/linux/mtd/fsmc.h | 4 ++++ 2 files changed, 22 insertions(+), 0 deletions(-) diff --git a/drivers/mtd/nand/fsmc_nand.c b/drivers/mtd/nand/fsmc_nand.c index 205b10b..8f56caa 100644 --- a/drivers/mtd/nand/fsmc_nand.c +++ b/drivers/mtd/nand/fsmc_nand.c @@ -226,6 +226,24 @@ struct fsmc_nand_data { void (*select_chip)(uint32_t bank, uint32_t busw); }; +/* This function is used to set platform data field of pdev->dev */ +void fsmc_nand_set_plat_data(struct platform_device *pdev, + struct mtd_partition *partitions, unsigned int nr_partitions, + unsigned int options, unsigned int width) +{ + struct fsmc_nand_platform_data *plat_data; + plat_data = dev_get_platdata(&pdev->dev); + + if (partitions) { + plat_data->partitions = partitions; + plat_data->nr_partitions = nr_partitions; + } + + plat_data->options = options; + plat_data->width = width; +} +EXPORT_SYMBOL_GPL(fsmc_nand_set_plat_data); + /* Assert CS signal based on chipnr */ static void fsmc_select_chip(struct mtd_info *mtd, int chipnr) { diff --git a/include/linux/mtd/fsmc.h b/include/linux/mtd/fsmc.h index 6987995..d071db4 100644 --- a/include/linux/mtd/fsmc.h +++ b/include/linux/mtd/fsmc.h @@ -160,4 +160,8 @@ extern void __init fsmc_init_board_info(struct platform_device *pdev, struct mtd_partition *partitions, unsigned int nr_partitions, unsigned int width); +void fsmc_nand_set_plat_data(struct platform_device *pdev, + struct mtd_partition *partitions, unsigned int nr_partitions, + unsigned int options, unsigned int width); + #endif /* __MTD_FSMC_H */