From: Roger Quadros <rogerq@ti.com>
To: <tony@atomide.com>, <computersforpeace@gmail.com>
Cc: <pekon@ti.com>, <ezequiel.garcia@free-electrons.com>,
<robertcnelson@gmail.com>, <jg1.han@samsung.com>,
<dwmw2@infradead.org>, <javier@dowhile0.org>, <nsekhar@ti.com>,
<linux-omap@vger.kernel.org>, <linux-mtd@lists.infradead.org>,
<devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
Roger Quadros <rogerq@ti.com>
Subject: [RFC PATCH 03/16] ARM: OMAP2+: gmpc: add gpmc_generic_init()
Date: Wed, 21 May 2014 14:20:51 +0300 [thread overview]
Message-ID: <1400671264-10702-4-git-send-email-rogerq@ti.com> (raw)
In-Reply-To: <1400671264-10702-1-git-send-email-rogerq@ti.com>
This function populates platform data for the specified Chip Select.
It should be called by board init code.
Signed-off-by: Roger Quadros <rogerq@ti.com>
---
arch/arm/mach-omap2/gpmc.c | 69 ++++++++++++++++++++++++++++++++++++++++++++++
arch/arm/mach-omap2/gpmc.h | 6 ++++
2 files changed, 75 insertions(+)
diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
index 9fe8c94..6b4a322 100644
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
@@ -115,6 +115,8 @@
*/
#define GPMC_NR_IRQ 2
+static struct gpmc_omap_platform_data gpmc_pdata;
+
struct gpmc_client_irq {
unsigned irq;
u32 bitmask;
@@ -1787,6 +1789,73 @@ static int __init omap_gpmc_init(void)
}
omap_postcore_initcall(omap_gpmc_init);
+/**
+ * gpmc_generic_init - Initialize platform data for a Chip Select
+ *
+ * @cs chip select number
+ * @type GPMC_OMAP_TYPE
+ * @settings GPMC settings
+ * @device_timings device timings for device on this CS
+ * @gpmc_timings GPMC timings
+ * @pdev platform device for the device on this CS
+ * @pdata_size platform data size for the platform device
+ */
+int gpmc_generic_init(int cs, enum gpmc_omap_type type,
+ struct gpmc_settings *settings,
+ struct gpmc_device_timings *device_timings,
+ struct gpmc_timings *gpmc_timings,
+ struct platform_device *pdev, unsigned pdata_size)
+{
+ struct gpmc_settings *gpmc_s;
+ struct gpmc_device_timings *gpmc_dev_t;
+ struct gpmc_timings *gpmc_t;
+
+ if (cs >= GPMC_CS_NUM) {
+ pr_err("%s: Invalid cs specified. Max CS = %d\n",
+ __func__, GPMC_CS_NUM);
+ return -EINVAL;
+ }
+
+ if (gpmc_pdata.cs[cs].valid) {
+ pr_err("%s: cs %d already requested, ignoring new request\n",
+ __func__, cs);
+ return -EINVAL;
+ }
+
+ if (settings) {
+ gpmc_s = kmemdup(settings, sizeof(*settings), GFP_KERNEL);
+ if (!gpmc_s)
+ return -ENOMEM;
+
+ gpmc_pdata.cs[cs].settings = gpmc_s;
+ }
+
+ if (device_timings) {
+ gpmc_dev_t = kmemdup(device_timings, sizeof(*device_timings),
+ GFP_KERNEL);
+ if (!gpmc_dev_t)
+ return -ENOMEM;
+
+ gpmc_pdata.cs[cs].device_timings = gpmc_dev_t;
+ }
+
+ if (gpmc_timings) {
+ gpmc_t = kmemdup(gpmc_timings, sizeof(*gpmc_timings),
+ GFP_KERNEL);
+ if (!gpmc_t)
+ return -ENOMEM;
+
+ gpmc_pdata.cs[cs].gpmc_timings = gpmc_t;
+ }
+
+ gpmc_pdata.cs[cs].type = type;
+ gpmc_pdata.cs[cs].pdev = pdev;
+ gpmc_pdata.cs[cs].pdata_size = pdata_size;
+ gpmc_pdata.cs[cs].valid = true;
+
+ return 0;
+}
+
static irqreturn_t gpmc_handle_irq(int irq, void *dev)
{
int i;
diff --git a/arch/arm/mach-omap2/gpmc.h b/arch/arm/mach-omap2/gpmc.h
index 681977f..c18b022 100644
--- a/arch/arm/mach-omap2/gpmc.h
+++ b/arch/arm/mach-omap2/gpmc.h
@@ -100,5 +100,11 @@ extern void omap3_gpmc_restore_context(void);
extern int gpmc_configure(int cmd, int wval);
extern void gpmc_read_settings_dt(struct device_node *np,
struct gpmc_settings *p);
+extern int gpmc_generic_init(int cs, enum gpmc_omap_type type,
+ struct gpmc_settings *settings,
+ struct gpmc_device_timings *device_timings,
+ struct gpmc_timings *gpmc_timings,
+ struct platform_device *pdev,
+ unsigned pdata_size);
#endif
--
1.8.3.2
next prev parent reply other threads:[~2014-05-21 11:22 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-21 11:20 [RFC PATCH 00/16] OMAP: GPMC: Restructure OMAP GPMC driver (NAND) Roger Quadros
2014-05-21 11:20 ` [RFC PATCH 01/16] ARM: OMAP2+: gpmc: Add platform data Roger Quadros
2014-05-21 11:20 ` [RFC PATCH 02/16] ARM: OMAP2+: gpmc: Add gpmc timings and settings to " Roger Quadros
2014-05-21 11:20 ` Roger Quadros [this message]
2014-05-21 11:20 ` [RFC PATCH 04/16] ARM: OMAP2+: gpmc: use platform data to configure CS space and poplulate device Roger Quadros
2014-05-21 11:20 ` [RFC PATCH 05/16] ARM: OMAP2+: gpmc: Use low level read/write for context save/restore Roger Quadros
2014-05-21 11:20 ` [RFC PATCH 06/16] ARM: OMAP2+: gpmc: add NAND specific setup Roger Quadros
2014-05-21 11:20 ` [RFC PATCH 07/16] ARM: OMAP2+: nand: Update gpmc_nand_init() to use generic_gpmc_init() Roger Quadros
2014-05-21 11:20 ` [RFC PATCH 08/16] mtd: nand: omap: Fix build warning Roger Quadros
2014-05-22 0:54 ` Jingoo Han
2014-05-22 8:17 ` Roger Quadros
2014-05-21 11:20 ` [RFC PATCH 09/16] mtd: nand: omap: Move IRQ handling from GPMC to NAND driver Roger Quadros
2014-05-21 11:20 ` [RFC PATCH 10/16] mtd: nand: omap: Move gpmc_update_nand_reg to nand driver Roger Quadros
2014-05-21 11:20 ` [RFC PATCH 11/16] mtd: nand: omap: Move NAND write protect code from GPMC to NAND driver Roger Quadros
2014-05-21 11:21 ` [RFC PATCH 12/16] mtd: nand: omap: Copy platform data parameters to omap_nand_info data Roger Quadros
2014-05-21 11:21 ` [RFC PATCH 13/16] mtd: nand: omap: True device tree support Roger Quadros
2014-05-21 11:21 ` [RFC PATCH 14/16] ARM: OMAP: gpmc: Update DT binding documentation Roger Quadros
2014-05-21 11:21 ` [RFC PATCH 15/16] mtd: nand: omap: " Roger Quadros
2014-05-21 11:21 ` [RFC PATCH 16/16] ARM: dts: omap3-beagle: Add NAND device Roger Quadros
2014-05-21 16:08 ` [RFC PATCH 00/16] OMAP: GPMC: Restructure OMAP GPMC driver (NAND) Ezequiel Garcia
2014-05-22 8:12 ` [RFC PATCH 00/16] OMAP: GPMC: Restructure OMAP GPMC driver (NAND) : DT binding change proposal Roger Quadros
2014-05-22 11:51 ` Javier Martinez Canillas
2014-05-22 14:46 ` Ezequiel Garcia
2014-05-23 8:16 ` Roger Quadros
2014-05-23 9:40 ` Javier Martinez Canillas
2014-05-26 7:23 ` Roger Quadros
2014-05-23 14:53 ` Tony Lindgren
2014-05-26 7:33 ` Roger Quadros
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1400671264-10702-4-git-send-email-rogerq@ti.com \
--to=rogerq@ti.com \
--cc=computersforpeace@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=dwmw2@infradead.org \
--cc=ezequiel.garcia@free-electrons.com \
--cc=javier@dowhile0.org \
--cc=jg1.han@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=linux-omap@vger.kernel.org \
--cc=nsekhar@ti.com \
--cc=pekon@ti.com \
--cc=robertcnelson@gmail.com \
--cc=tony@atomide.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome