From patchwork Fri Feb 25 11:52:07 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh KUMAR X-Patchwork-Id: 84534 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 26656B70AE for ; Fri, 25 Feb 2011 22:53:44 +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 1PswDp-0005cv-NN; Fri, 25 Feb 2011 11:52:33 +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 1PswDm-0003M4-KH; Fri, 25 Feb 2011 11:52:30 +0000 Received: from eu1sys200aog111.obsmtp.com ([207.126.144.131]) by canuck.infradead.org with smtps (Exim 4.72 #1 (Red Hat Linux)) id 1PswDk-0003Ld-7q for linux-mtd@lists.infradead.org; Fri, 25 Feb 2011 11:52:29 +0000 Received: from source ([138.198.100.35]) (using TLSv1) by eu1sys200aob111.postini.com ([207.126.147.11]) with SMTP ID DSNKTWeX9ePsRJP86qgHhcUpWyr8zGyySR9B@postini.com; Fri, 25 Feb 2011 11:52:27 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 62B86D3; Fri, 25 Feb 2011 11:52:18 +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 4E9EAC47; Fri, 25 Feb 2011 11:52:18 +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; Fri, 25 Feb 2011 19:52:15 +0800 From: Viresh Kumar To: , , , Subject: [PATCH V2] fsmc-nand: Add fsmc_nand_set_plat_data in linux/mtd/fsmc.h Date: Fri, 25 Feb 2011 17:22:07 +0530 Message-ID: <954e52aaae5014c2d72ac76f603f288186d67fa1.1298634044.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-20110225_065228_519432_50125EDE X-CRM114-Status: GOOD ( 19.03 ) 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.131 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 | 5 +++++ 2 files changed, 23 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..29e039b 100644 --- a/include/linux/mtd/fsmc.h +++ b/include/linux/mtd/fsmc.h @@ -160,4 +160,9 @@ extern void __init fsmc_init_board_info(struct platform_device *pdev, struct mtd_partition *partitions, unsigned int nr_partitions, unsigned int width); +/* 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); + #endif /* __MTD_FSMC_H */