[resend] fsmc-nand: Add fsmc_nand_set_plat_data in linux/mtd/fsmc.h

Submitted by Viresh KUMAR on Feb. 25, 2011, 11:17 a.m.

Details

Message ID 8e22b9ab2d4ade0607fe530d818b2a951227de8e.1298632523.git.viresh.kumar@st.com
State New, archived
Headers show

Commit Message

Viresh KUMAR Feb. 25, 2011, 11:17 a.m.
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 <linus.walleij@linaro.org>
Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
Signed-off-by: Vipin Kumar <vipin.kumar@st.com>
---
 include/linux/mtd/fsmc.h |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

Patch hide | download patch | download mbox

diff --git a/include/linux/mtd/fsmc.h b/include/linux/mtd/fsmc.h
index 6987995..0cba324 100644
--- a/include/linux/mtd/fsmc.h
+++ b/include/linux/mtd/fsmc.h
@@ -160,4 +160,21 @@  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 */
+static inline 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;
+}
+
 #endif /* __MTD_FSMC_H */