@@ -1350,6 +1350,42 @@ static int gpmc_probe_dt(struct platform_device *pdev)
}
#endif
+static int gpmc_nand_setup(struct platform_device *parent_pdev,
+ struct gpmc_omap_cs_data *cs)
+{
+ struct resource *res;
+ struct resource *res_gpmc;
+
+ if (!cs->pdev)
+ return -EINVAL;
+
+ res = cs->pdev->resource;
+
+ if (cs->pdev->num_resources < 3)
+ return -EINVAL;
+
+ if (resource_type(&res[1]) != IORESOURCE_MEM ||
+ resource_type(&res[2]) != IORESOURCE_IRQ)
+ return -EINVAL;
+
+ if (!cs->settings)
+ return -EINVAL;
+
+ /* GPMC register space */
+ res_gpmc = platform_get_resource(parent_pdev, IORESOURCE_MEM, 0);
+ if (!res_gpmc)
+ return -EINVAL;
+
+ res[1] = *res_gpmc;
+
+ /* setup IRQ resources */
+ res[2].start = gpmc_irq;
+
+ cs->settings->device_nand = true;
+
+ return 0;
+}
+
static void gpmc_probe_legacy(struct platform_device *pdev)
{
int i, rc;
@@ -1401,6 +1437,15 @@ static void gpmc_probe_legacy(struct platform_device *pdev)
/* FIXME: When do we need to call gpmc_cs_remap()? */
skip_mem:
+ /* Customized NAND setup */
+ if (cs->is_nand) {
+ if (gpmc_nand_setup(pdev, cs)) {
+ dev_err(dev, "Error setting up NAND on CS %d\n",
+ i);
+ continue;
+ }
+ }
+
if (cs->settings) {
if (gpmc_cs_program_settings(i, cs->settings)) {
dev_err(dev,
Provide NAND specific resources and platform data. Signed-off-by: Roger Quadros <rogerq@ti.com> --- arch/arm/mach-omap2/gpmc.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+)