* [PATCH V2] fsmc-nand: Add fsmc_nand_set_plat_data in linux/mtd/fsmc.h
@ 2011-02-25 11:52 Viresh Kumar
2011-02-25 12:14 ` Artem Bityutskiy
0 siblings, 1 reply; 2+ messages in thread
From: Viresh Kumar @ 2011-02-25 11:52 UTC (permalink / raw)
To: dwmw2, linux-mtd, Artem.Bityutskiy, linus.walleij
Cc: Vipin Kumar, Viresh Kumar
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>
---
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 */
--
1.7.2.2
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH V2] fsmc-nand: Add fsmc_nand_set_plat_data in linux/mtd/fsmc.h
2011-02-25 11:52 [PATCH V2] fsmc-nand: Add fsmc_nand_set_plat_data in linux/mtd/fsmc.h Viresh Kumar
@ 2011-02-25 12:14 ` Artem Bityutskiy
0 siblings, 0 replies; 2+ messages in thread
From: Artem Bityutskiy @ 2011-02-25 12:14 UTC (permalink / raw)
To: Viresh Kumar; +Cc: Vipin Kumar, linux-mtd, dwmw2, linus.walleij
On Fri, 2011-02-25 at 17:22 +0530, Viresh Kumar wrote:
> +/* 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 */
Sorry for nit-picking, but having 2 copies of the same comment is prone
to inconsistency :-) I think the general linux way is to put the comment
above the function body and leave the prototype declarations without any
comments.
--
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-02-25 12:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-25 11:52 [PATCH V2] fsmc-nand: Add fsmc_nand_set_plat_data in linux/mtd/fsmc.h Viresh Kumar
2011-02-25 12:14 ` Artem Bityutskiy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox