All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/11] Remove unused omap legacy code
@ 2017-05-31 22:51 ` Tony Lindgren
  0 siblings, 0 replies; 56+ messages in thread
From: Tony Lindgren @ 2017-05-31 22:51 UTC (permalink / raw)
  To: linux-omap; +Cc: linux-arm-kernel

Hi all,

We can now remove quite a bit of clutter with legacy booting
gone. Basically anything with of_have_populated_dt() not set
can now go.

Regards,

Tony

Tony Lindgren (11):
  ARM: OMAP2+: Remove unused legacy code for opp
  ARM: OMAP2+: Remove unused legacy code for timer
  ARM: OMAP2+: Remove unused legacy code for PMU
  ARM: OMAP2+: Remove unused legacy code for device init
  ARM: OMAP2+: Remove unused legacy code for McBSP
  ARM: OMAP2+: Remove unused legacy code for io.c
  ARM: OMAP2+: Remove unused legacy code for DMA
  ARM: OMAP2+: Remove unused legacy code for PRM
  ARM: OMAP2+: Remove unused legacy code for interconnects
  ARM: OMAP2+: Remove unused legacy code for watchdog
  ARM: OMAP2+: Remove unused legacy code for n8x0

 arch/arm/mach-omap2/Makefile               |   4 -
 arch/arm/mach-omap2/board-n8x0.c           |  14 +--
 arch/arm/mach-omap2/devices.c              | 163 ---------------------------
 arch/arm/mach-omap2/dma.c                  |  30 +----
 arch/arm/mach-omap2/io.c                   |  59 +++-------
 arch/arm/mach-omap2/mcbsp.c                |  70 ------------
 arch/arm/mach-omap2/omap_device.c          |   5 +-
 arch/arm/mach-omap2/omap_hwmod.c           |  23 ++--
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |   3 +-
 arch/arm/mach-omap2/opp.c                  | 104 -----------------
 arch/arm/mach-omap2/opp3xxx_data.c         |  86 ---------------
 arch/arm/mach-omap2/opp4xxx_data.c         |  79 -------------
 arch/arm/mach-omap2/pmu.c                  |  97 ----------------
 arch/arm/mach-omap2/prm3xxx.c              |  17 ++-
 arch/arm/mach-omap2/prm44xx.c              |  59 ----------
 arch/arm/mach-omap2/prm_common.c           |   9 +-
 arch/arm/mach-omap2/timer.c                | 172 ++++-------------------------
 arch/arm/mach-omap2/wd_timer.c             |  28 -----
 18 files changed, 63 insertions(+), 959 deletions(-)
 delete mode 100644 arch/arm/mach-omap2/opp.c
 delete mode 100644 arch/arm/mach-omap2/pmu.c

-- 
2.13.0

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 00/11] Remove unused omap legacy code
@ 2017-05-31 22:51 ` Tony Lindgren
  0 siblings, 0 replies; 56+ messages in thread
From: Tony Lindgren @ 2017-05-31 22:51 UTC (permalink / raw)
  To: linux-arm-kernel

Hi all,

We can now remove quite a bit of clutter with legacy booting
gone. Basically anything with of_have_populated_dt() not set
can now go.

Regards,

Tony

Tony Lindgren (11):
  ARM: OMAP2+: Remove unused legacy code for opp
  ARM: OMAP2+: Remove unused legacy code for timer
  ARM: OMAP2+: Remove unused legacy code for PMU
  ARM: OMAP2+: Remove unused legacy code for device init
  ARM: OMAP2+: Remove unused legacy code for McBSP
  ARM: OMAP2+: Remove unused legacy code for io.c
  ARM: OMAP2+: Remove unused legacy code for DMA
  ARM: OMAP2+: Remove unused legacy code for PRM
  ARM: OMAP2+: Remove unused legacy code for interconnects
  ARM: OMAP2+: Remove unused legacy code for watchdog
  ARM: OMAP2+: Remove unused legacy code for n8x0

 arch/arm/mach-omap2/Makefile               |   4 -
 arch/arm/mach-omap2/board-n8x0.c           |  14 +--
 arch/arm/mach-omap2/devices.c              | 163 ---------------------------
 arch/arm/mach-omap2/dma.c                  |  30 +----
 arch/arm/mach-omap2/io.c                   |  59 +++-------
 arch/arm/mach-omap2/mcbsp.c                |  70 ------------
 arch/arm/mach-omap2/omap_device.c          |   5 +-
 arch/arm/mach-omap2/omap_hwmod.c           |  23 ++--
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |   3 +-
 arch/arm/mach-omap2/opp.c                  | 104 -----------------
 arch/arm/mach-omap2/opp3xxx_data.c         |  86 ---------------
 arch/arm/mach-omap2/opp4xxx_data.c         |  79 -------------
 arch/arm/mach-omap2/pmu.c                  |  97 ----------------
 arch/arm/mach-omap2/prm3xxx.c              |  17 ++-
 arch/arm/mach-omap2/prm44xx.c              |  59 ----------
 arch/arm/mach-omap2/prm_common.c           |   9 +-
 arch/arm/mach-omap2/timer.c                | 172 ++++-------------------------
 arch/arm/mach-omap2/wd_timer.c             |  28 -----
 18 files changed, 63 insertions(+), 959 deletions(-)
 delete mode 100644 arch/arm/mach-omap2/opp.c
 delete mode 100644 arch/arm/mach-omap2/pmu.c

-- 
2.13.0

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 01/11] ARM: OMAP2+: Remove unused legacy code for opp
  2017-05-31 22:51 ` Tony Lindgren
@ 2017-05-31 22:51   ` Tony Lindgren
  -1 siblings, 0 replies; 56+ messages in thread
From: Tony Lindgren @ 2017-05-31 22:51 UTC (permalink / raw)
  To: linux-omap; +Cc: linux-arm-kernel

We are now booting all mach-omap2 in device tree only mode.
Any code that is only called in legacy boot mode where
of_have_populated_dt() is not set is safe to remove now.

Note that the volt_data is still being used.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/Makefile       |   1 -
 arch/arm/mach-omap2/opp.c          | 104 -------------------------------------
 arch/arm/mach-omap2/opp3xxx_data.c |  86 ------------------------------
 arch/arm/mach-omap2/opp4xxx_data.c |  79 ----------------------------
 4 files changed, 270 deletions(-)
 delete mode 100644 arch/arm/mach-omap2/opp.c

diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -69,7 +69,6 @@ obj-$(CONFIG_ARCH_OMAP2)		+= sdrc2xxx.o
 
 # OPP table initialization
 ifeq ($(CONFIG_PM_OPP),y)
-obj-y					+= opp.o
 obj-$(CONFIG_ARCH_OMAP3)		+= opp3xxx_data.o
 obj-$(CONFIG_ARCH_OMAP4)		+= opp4xxx_data.o
 endif
diff --git a/arch/arm/mach-omap2/opp.c b/arch/arm/mach-omap2/opp.c
deleted file mode 100644
--- a/arch/arm/mach-omap2/opp.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * OMAP SoC specific OPP wrapper function
- *
- * Copyright (C) 2009-2010 Texas Instruments Incorporated - http://www.ti.com/
- *	Nishanth Menon
- *	Kevin Hilman
- * Copyright (C) 2010 Nokia Corporation.
- *      Eduardo Valentin
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- * kind, whether express or implied; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-#include <linux/module.h>
-#include <linux/of.h>
-#include <linux/pm_opp.h>
-#include <linux/cpu.h>
-
-#include "omap_device.h"
-
-#include "omap_opp_data.h"
-
-/* Temp variable to allow multiple calls */
-static u8 __initdata omap_table_init;
-
-/**
- * omap_init_opp_table() - Initialize opp table as per the CPU type
- * @opp_def:		opp default list for this silicon
- * @opp_def_size:	number of opp entries for this silicon
- *
- * Register the initial OPP table with the OPP library based on the CPU
- * type. This is meant to be used only by SoC specific registration.
- */
-int __init omap_init_opp_table(struct omap_opp_def *opp_def,
-		u32 opp_def_size)
-{
-	int i, r;
-
-	if (of_have_populated_dt())
-		return -EINVAL;
-
-	if (!opp_def || !opp_def_size) {
-		pr_err("%s: invalid params!\n", __func__);
-		return -EINVAL;
-	}
-
-	/*
-	 * Initialize only if not already initialized even if the previous
-	 * call failed, because, no reason we'd succeed again.
-	 */
-	if (omap_table_init)
-		return -EEXIST;
-	omap_table_init = 1;
-
-	/* Lets now register with OPP library */
-	for (i = 0; i < opp_def_size; i++, opp_def++) {
-		struct omap_hwmod *oh;
-		struct device *dev;
-
-		if (!opp_def->hwmod_name) {
-			pr_err("%s: NULL name of omap_hwmod, failing [%d].\n",
-				__func__, i);
-			return -EINVAL;
-		}
-
-		if (!strncmp(opp_def->hwmod_name, "mpu", 3)) {
-			/* 
-			 * All current OMAPs share voltage rail and
-			 * clock source, so CPU0 is used to represent
-			 * the MPU-SS.
-			 */
-			dev = get_cpu_device(0);
-		} else {
-			oh = omap_hwmod_lookup(opp_def->hwmod_name);
-			if (!oh || !oh->od) {
-				pr_debug("%s: no hwmod or odev for %s, [%d] cannot add OPPs.\n",
-					 __func__, opp_def->hwmod_name, i);
-				continue;
-			}
-			dev = &oh->od->pdev->dev;
-		}
-
-		r = dev_pm_opp_add(dev, opp_def->freq, opp_def->u_volt);
-		if (r) {
-			dev_err(dev, "%s: add OPP %ld failed for %s [%d] result=%d\n",
-				__func__, opp_def->freq,
-				opp_def->hwmod_name, i, r);
-		} else {
-			if (!opp_def->default_available)
-				r = dev_pm_opp_disable(dev, opp_def->freq);
-			if (r)
-				dev_err(dev, "%s: disable %ld failed for %s [%d] result=%d\n",
-					__func__, opp_def->freq,
-					opp_def->hwmod_name, i, r);
-		}
-	}
-
-	return 0;
-}
diff --git a/arch/arm/mach-omap2/opp3xxx_data.c b/arch/arm/mach-omap2/opp3xxx_data.c
--- a/arch/arm/mach-omap2/opp3xxx_data.c
+++ b/arch/arm/mach-omap2/opp3xxx_data.c
@@ -83,89 +83,3 @@ struct omap_volt_data omap36xx_vddcore_volt_data[] = {
 	VOLT_DATA_DEFINE(OMAP3630_VDD_CORE_OPP100_UV, OMAP3630_CONTROL_FUSE_OPP100_VDD2, 0xf9, 0x16),
 	VOLT_DATA_DEFINE(0, 0, 0, 0),
 };
-
-/* OPP data */
-
-static struct omap_opp_def __initdata omap34xx_opp_def_list[] = {
-	/* MPU OPP1 */
-	OPP_INITIALIZER("mpu", true, 125000000, OMAP3430_VDD_MPU_OPP1_UV),
-	/* MPU OPP2 */
-	OPP_INITIALIZER("mpu", true, 250000000, OMAP3430_VDD_MPU_OPP2_UV),
-	/* MPU OPP3 */
-	OPP_INITIALIZER("mpu", true, 500000000, OMAP3430_VDD_MPU_OPP3_UV),
-	/* MPU OPP4 */
-	OPP_INITIALIZER("mpu", true, 550000000, OMAP3430_VDD_MPU_OPP4_UV),
-	/* MPU OPP5 */
-	OPP_INITIALIZER("mpu", true, 600000000, OMAP3430_VDD_MPU_OPP5_UV),
-
-	/*
-	 * L3 OPP1 - 41.5 MHz is disabled because: The voltage for that OPP is
-	 * almost the same than the one at 83MHz thus providing very little
-	 * gain for the power point of view. In term of energy it will even
-	 * increase the consumption due to the very negative performance
-	 * impact that frequency will do to the MPU and the whole system in
-	 * general.
-	 */
-	OPP_INITIALIZER("l3_main", false, 41500000, OMAP3430_VDD_CORE_OPP1_UV),
-	/* L3 OPP2 */
-	OPP_INITIALIZER("l3_main", true, 83000000, OMAP3430_VDD_CORE_OPP2_UV),
-	/* L3 OPP3 */
-	OPP_INITIALIZER("l3_main", true, 166000000, OMAP3430_VDD_CORE_OPP3_UV),
-
-	/* DSP OPP1 */
-	OPP_INITIALIZER("iva", true, 90000000, OMAP3430_VDD_MPU_OPP1_UV),
-	/* DSP OPP2 */
-	OPP_INITIALIZER("iva", true, 180000000, OMAP3430_VDD_MPU_OPP2_UV),
-	/* DSP OPP3 */
-	OPP_INITIALIZER("iva", true, 360000000, OMAP3430_VDD_MPU_OPP3_UV),
-	/* DSP OPP4 */
-	OPP_INITIALIZER("iva", true, 400000000, OMAP3430_VDD_MPU_OPP4_UV),
-	/* DSP OPP5 */
-	OPP_INITIALIZER("iva", true, 430000000, OMAP3430_VDD_MPU_OPP5_UV),
-};
-
-static struct omap_opp_def __initdata omap36xx_opp_def_list[] = {
-	/* MPU OPP1 - OPP50 */
-	OPP_INITIALIZER("mpu", true,  300000000, OMAP3630_VDD_MPU_OPP50_UV),
-	/* MPU OPP2 - OPP100 */
-	OPP_INITIALIZER("mpu", true,  600000000, OMAP3630_VDD_MPU_OPP100_UV),
-	/* MPU OPP3 - OPP-Turbo */
-	OPP_INITIALIZER("mpu", false, 800000000, OMAP3630_VDD_MPU_OPP120_UV),
-	/* MPU OPP4 - OPP-SB */
-	OPP_INITIALIZER("mpu", false, 1000000000, OMAP3630_VDD_MPU_OPP1G_UV),
-
-	/* L3 OPP1 - OPP50 */
-	OPP_INITIALIZER("l3_main", true, 100000000, OMAP3630_VDD_CORE_OPP50_UV),
-	/* L3 OPP2 - OPP100, OPP-Turbo, OPP-SB */
-	OPP_INITIALIZER("l3_main", true, 200000000, OMAP3630_VDD_CORE_OPP100_UV),
-
-	/* DSP OPP1 - OPP50 */
-	OPP_INITIALIZER("iva", true,  260000000, OMAP3630_VDD_MPU_OPP50_UV),
-	/* DSP OPP2 - OPP100 */
-	OPP_INITIALIZER("iva", true,  520000000, OMAP3630_VDD_MPU_OPP100_UV),
-	/* DSP OPP3 - OPP-Turbo */
-	OPP_INITIALIZER("iva", false, 660000000, OMAP3630_VDD_MPU_OPP120_UV),
-	/* DSP OPP4 - OPP-SB */
-	OPP_INITIALIZER("iva", false, 800000000, OMAP3630_VDD_MPU_OPP1G_UV),
-};
-
-/**
- * omap3_opp_init() - initialize omap3 opp table
- */
-int __init omap3_opp_init(void)
-{
-	int r = -ENODEV;
-
-	if (!cpu_is_omap34xx())
-		return r;
-
-	if (cpu_is_omap3630())
-		r = omap_init_opp_table(omap36xx_opp_def_list,
-			ARRAY_SIZE(omap36xx_opp_def_list));
-	else
-		r = omap_init_opp_table(omap34xx_opp_def_list,
-			ARRAY_SIZE(omap34xx_opp_def_list));
-
-	return r;
-}
-omap_device_initcall(omap3_opp_init);
diff --git a/arch/arm/mach-omap2/opp4xxx_data.c b/arch/arm/mach-omap2/opp4xxx_data.c
--- a/arch/arm/mach-omap2/opp4xxx_data.c
+++ b/arch/arm/mach-omap2/opp4xxx_data.c
@@ -63,29 +63,6 @@ struct omap_volt_data omap443x_vdd_core_volt_data[] = {
 	VOLT_DATA_DEFINE(0, 0, 0, 0),
 };
 
-
-static struct omap_opp_def __initdata omap443x_opp_def_list[] = {
-	/* MPU OPP1 - OPP50 */
-	OPP_INITIALIZER("mpu", true, 300000000, OMAP4430_VDD_MPU_OPP50_UV),
-	/* MPU OPP2 - OPP100 */
-	OPP_INITIALIZER("mpu", true, 600000000, OMAP4430_VDD_MPU_OPP100_UV),
-	/* MPU OPP3 - OPP-Turbo */
-	OPP_INITIALIZER("mpu", true, 800000000, OMAP4430_VDD_MPU_OPPTURBO_UV),
-	/* MPU OPP4 - OPP-SB */
-	OPP_INITIALIZER("mpu", true, 1008000000, OMAP4430_VDD_MPU_OPPNITRO_UV),
-	/* L3 OPP1 - OPP50 */
-	OPP_INITIALIZER("l3_main_1", true, 100000000, OMAP4430_VDD_CORE_OPP50_UV),
-	/* L3 OPP2 - OPP100, OPP-Turbo, OPP-SB */
-	OPP_INITIALIZER("l3_main_1", true, 200000000, OMAP4430_VDD_CORE_OPP100_UV),
-	/* IVA OPP1 - OPP50 */
-	OPP_INITIALIZER("iva", true, 133000000, OMAP4430_VDD_IVA_OPP50_UV),
-	/* IVA OPP2 - OPP100 */
-	OPP_INITIALIZER("iva", true, 266100000, OMAP4430_VDD_IVA_OPP100_UV),
-	/* IVA OPP3 - OPP-Turbo */
-	OPP_INITIALIZER("iva", false, 332000000, OMAP4430_VDD_IVA_OPPTURBO_UV),
-	/* TODO: add DSP, aess, fdif, gpu */
-};
-
 #define OMAP4460_VDD_MPU_OPP50_UV		1025000
 #define OMAP4460_VDD_MPU_OPP100_UV		1200000
 #define OMAP4460_VDD_MPU_OPPTURBO_UV		1313000
@@ -122,59 +99,3 @@ struct omap_volt_data omap446x_vdd_core_volt_data[] = {
 	VOLT_DATA_DEFINE(OMAP4460_VDD_CORE_OPP100_OV_UV, OMAP44XX_CONTROL_FUSE_CORE_OPP100OV, 0xf9, 0x16),
 	VOLT_DATA_DEFINE(0, 0, 0, 0),
 };
-
-static struct omap_opp_def __initdata omap446x_opp_def_list[] = {
-	/* MPU OPP1 - OPP50 */
-	OPP_INITIALIZER("mpu", true, 350000000, OMAP4460_VDD_MPU_OPP50_UV),
-	/* MPU OPP2 - OPP100 */
-	OPP_INITIALIZER("mpu", true, 700000000, OMAP4460_VDD_MPU_OPP100_UV),
-	/* MPU OPP3 - OPP-Turbo */
-	OPP_INITIALIZER("mpu", true, 920000000, OMAP4460_VDD_MPU_OPPTURBO_UV),
-	/*
-	 * MPU OPP4 - OPP-Nitro + Disabled as the reference schematics
-	 * recommends TPS623631 - confirm and enable the opp in board file
-	 * XXX: May be we should enable these based on mpu capability and
-	 * Exception board files disable it...
-	 */
-	OPP_INITIALIZER("mpu", false, 1200000000, OMAP4460_VDD_MPU_OPPNITRO_UV),
-	/* MPU OPP4 - OPP-Nitro SpeedBin */
-	OPP_INITIALIZER("mpu", false, 1500000000, OMAP4460_VDD_MPU_OPPNITRO_UV),
-	/* L3 OPP1 - OPP50 */
-	OPP_INITIALIZER("l3_main_1", true, 100000000, OMAP4460_VDD_CORE_OPP50_UV),
-	/* L3 OPP2 - OPP100 */
-	OPP_INITIALIZER("l3_main_1", true, 200000000, OMAP4460_VDD_CORE_OPP100_UV),
-	/* IVA OPP1 - OPP50 */
-	OPP_INITIALIZER("iva", true, 133000000, OMAP4460_VDD_IVA_OPP50_UV),
-	/* IVA OPP2 - OPP100 */
-	OPP_INITIALIZER("iva", true, 266100000, OMAP4460_VDD_IVA_OPP100_UV),
-	/*
-	 * IVA OPP3 - OPP-Turbo + Disabled as the reference schematics
-	 * recommends Phoenix VCORE2 which can supply only 600mA - so the ones
-	 * above this OPP frequency, even though OMAP is capable, should be
-	 * enabled by board file which is sure of the chip power capability
-	 */
-	OPP_INITIALIZER("iva", false, 332000000, OMAP4460_VDD_IVA_OPPTURBO_UV),
-	/* IVA OPP4 - OPP-Nitro */
-	OPP_INITIALIZER("iva", false, 430000000, OMAP4460_VDD_IVA_OPPNITRO_UV),
-	/* IVA OPP5 - OPP-Nitro SpeedBin*/
-	OPP_INITIALIZER("iva", false, 500000000, OMAP4460_VDD_IVA_OPPNITRO_UV),
-
-	/* TODO: add DSP, aess, fdif, gpu */
-};
-
-/**
- * omap4_opp_init() - initialize omap4 opp table
- */
-int __init omap4_opp_init(void)
-{
-	int r = -ENODEV;
-
-	if (cpu_is_omap443x())
-		r = omap_init_opp_table(omap443x_opp_def_list,
-			ARRAY_SIZE(omap443x_opp_def_list));
-	else if (cpu_is_omap446x())
-		r = omap_init_opp_table(omap446x_opp_def_list,
-			ARRAY_SIZE(omap446x_opp_def_list));
-	return r;
-}
-omap_device_initcall(omap4_opp_init);
-- 
2.13.0

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 01/11] ARM: OMAP2+: Remove unused legacy code for opp
@ 2017-05-31 22:51   ` Tony Lindgren
  0 siblings, 0 replies; 56+ messages in thread
From: Tony Lindgren @ 2017-05-31 22:51 UTC (permalink / raw)
  To: linux-arm-kernel

We are now booting all mach-omap2 in device tree only mode.
Any code that is only called in legacy boot mode where
of_have_populated_dt() is not set is safe to remove now.

Note that the volt_data is still being used.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/Makefile       |   1 -
 arch/arm/mach-omap2/opp.c          | 104 -------------------------------------
 arch/arm/mach-omap2/opp3xxx_data.c |  86 ------------------------------
 arch/arm/mach-omap2/opp4xxx_data.c |  79 ----------------------------
 4 files changed, 270 deletions(-)
 delete mode 100644 arch/arm/mach-omap2/opp.c

diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -69,7 +69,6 @@ obj-$(CONFIG_ARCH_OMAP2)		+= sdrc2xxx.o
 
 # OPP table initialization
 ifeq ($(CONFIG_PM_OPP),y)
-obj-y					+= opp.o
 obj-$(CONFIG_ARCH_OMAP3)		+= opp3xxx_data.o
 obj-$(CONFIG_ARCH_OMAP4)		+= opp4xxx_data.o
 endif
diff --git a/arch/arm/mach-omap2/opp.c b/arch/arm/mach-omap2/opp.c
deleted file mode 100644
--- a/arch/arm/mach-omap2/opp.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * OMAP SoC specific OPP wrapper function
- *
- * Copyright (C) 2009-2010 Texas Instruments Incorporated - http://www.ti.com/
- *	Nishanth Menon
- *	Kevin Hilman
- * Copyright (C) 2010 Nokia Corporation.
- *      Eduardo Valentin
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- * kind, whether express or implied; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-#include <linux/module.h>
-#include <linux/of.h>
-#include <linux/pm_opp.h>
-#include <linux/cpu.h>
-
-#include "omap_device.h"
-
-#include "omap_opp_data.h"
-
-/* Temp variable to allow multiple calls */
-static u8 __initdata omap_table_init;
-
-/**
- * omap_init_opp_table() - Initialize opp table as per the CPU type
- * @opp_def:		opp default list for this silicon
- * @opp_def_size:	number of opp entries for this silicon
- *
- * Register the initial OPP table with the OPP library based on the CPU
- * type. This is meant to be used only by SoC specific registration.
- */
-int __init omap_init_opp_table(struct omap_opp_def *opp_def,
-		u32 opp_def_size)
-{
-	int i, r;
-
-	if (of_have_populated_dt())
-		return -EINVAL;
-
-	if (!opp_def || !opp_def_size) {
-		pr_err("%s: invalid params!\n", __func__);
-		return -EINVAL;
-	}
-
-	/*
-	 * Initialize only if not already initialized even if the previous
-	 * call failed, because, no reason we'd succeed again.
-	 */
-	if (omap_table_init)
-		return -EEXIST;
-	omap_table_init = 1;
-
-	/* Lets now register with OPP library */
-	for (i = 0; i < opp_def_size; i++, opp_def++) {
-		struct omap_hwmod *oh;
-		struct device *dev;
-
-		if (!opp_def->hwmod_name) {
-			pr_err("%s: NULL name of omap_hwmod, failing [%d].\n",
-				__func__, i);
-			return -EINVAL;
-		}
-
-		if (!strncmp(opp_def->hwmod_name, "mpu", 3)) {
-			/* 
-			 * All current OMAPs share voltage rail and
-			 * clock source, so CPU0 is used to represent
-			 * the MPU-SS.
-			 */
-			dev = get_cpu_device(0);
-		} else {
-			oh = omap_hwmod_lookup(opp_def->hwmod_name);
-			if (!oh || !oh->od) {
-				pr_debug("%s: no hwmod or odev for %s, [%d] cannot add OPPs.\n",
-					 __func__, opp_def->hwmod_name, i);
-				continue;
-			}
-			dev = &oh->od->pdev->dev;
-		}
-
-		r = dev_pm_opp_add(dev, opp_def->freq, opp_def->u_volt);
-		if (r) {
-			dev_err(dev, "%s: add OPP %ld failed for %s [%d] result=%d\n",
-				__func__, opp_def->freq,
-				opp_def->hwmod_name, i, r);
-		} else {
-			if (!opp_def->default_available)
-				r = dev_pm_opp_disable(dev, opp_def->freq);
-			if (r)
-				dev_err(dev, "%s: disable %ld failed for %s [%d] result=%d\n",
-					__func__, opp_def->freq,
-					opp_def->hwmod_name, i, r);
-		}
-	}
-
-	return 0;
-}
diff --git a/arch/arm/mach-omap2/opp3xxx_data.c b/arch/arm/mach-omap2/opp3xxx_data.c
--- a/arch/arm/mach-omap2/opp3xxx_data.c
+++ b/arch/arm/mach-omap2/opp3xxx_data.c
@@ -83,89 +83,3 @@ struct omap_volt_data omap36xx_vddcore_volt_data[] = {
 	VOLT_DATA_DEFINE(OMAP3630_VDD_CORE_OPP100_UV, OMAP3630_CONTROL_FUSE_OPP100_VDD2, 0xf9, 0x16),
 	VOLT_DATA_DEFINE(0, 0, 0, 0),
 };
-
-/* OPP data */
-
-static struct omap_opp_def __initdata omap34xx_opp_def_list[] = {
-	/* MPU OPP1 */
-	OPP_INITIALIZER("mpu", true, 125000000, OMAP3430_VDD_MPU_OPP1_UV),
-	/* MPU OPP2 */
-	OPP_INITIALIZER("mpu", true, 250000000, OMAP3430_VDD_MPU_OPP2_UV),
-	/* MPU OPP3 */
-	OPP_INITIALIZER("mpu", true, 500000000, OMAP3430_VDD_MPU_OPP3_UV),
-	/* MPU OPP4 */
-	OPP_INITIALIZER("mpu", true, 550000000, OMAP3430_VDD_MPU_OPP4_UV),
-	/* MPU OPP5 */
-	OPP_INITIALIZER("mpu", true, 600000000, OMAP3430_VDD_MPU_OPP5_UV),
-
-	/*
-	 * L3 OPP1 - 41.5 MHz is disabled because: The voltage for that OPP is
-	 * almost the same than the one at 83MHz thus providing very little
-	 * gain for the power point of view. In term of energy it will even
-	 * increase the consumption due to the very negative performance
-	 * impact that frequency will do to the MPU and the whole system in
-	 * general.
-	 */
-	OPP_INITIALIZER("l3_main", false, 41500000, OMAP3430_VDD_CORE_OPP1_UV),
-	/* L3 OPP2 */
-	OPP_INITIALIZER("l3_main", true, 83000000, OMAP3430_VDD_CORE_OPP2_UV),
-	/* L3 OPP3 */
-	OPP_INITIALIZER("l3_main", true, 166000000, OMAP3430_VDD_CORE_OPP3_UV),
-
-	/* DSP OPP1 */
-	OPP_INITIALIZER("iva", true, 90000000, OMAP3430_VDD_MPU_OPP1_UV),
-	/* DSP OPP2 */
-	OPP_INITIALIZER("iva", true, 180000000, OMAP3430_VDD_MPU_OPP2_UV),
-	/* DSP OPP3 */
-	OPP_INITIALIZER("iva", true, 360000000, OMAP3430_VDD_MPU_OPP3_UV),
-	/* DSP OPP4 */
-	OPP_INITIALIZER("iva", true, 400000000, OMAP3430_VDD_MPU_OPP4_UV),
-	/* DSP OPP5 */
-	OPP_INITIALIZER("iva", true, 430000000, OMAP3430_VDD_MPU_OPP5_UV),
-};
-
-static struct omap_opp_def __initdata omap36xx_opp_def_list[] = {
-	/* MPU OPP1 - OPP50 */
-	OPP_INITIALIZER("mpu", true,  300000000, OMAP3630_VDD_MPU_OPP50_UV),
-	/* MPU OPP2 - OPP100 */
-	OPP_INITIALIZER("mpu", true,  600000000, OMAP3630_VDD_MPU_OPP100_UV),
-	/* MPU OPP3 - OPP-Turbo */
-	OPP_INITIALIZER("mpu", false, 800000000, OMAP3630_VDD_MPU_OPP120_UV),
-	/* MPU OPP4 - OPP-SB */
-	OPP_INITIALIZER("mpu", false, 1000000000, OMAP3630_VDD_MPU_OPP1G_UV),
-
-	/* L3 OPP1 - OPP50 */
-	OPP_INITIALIZER("l3_main", true, 100000000, OMAP3630_VDD_CORE_OPP50_UV),
-	/* L3 OPP2 - OPP100, OPP-Turbo, OPP-SB */
-	OPP_INITIALIZER("l3_main", true, 200000000, OMAP3630_VDD_CORE_OPP100_UV),
-
-	/* DSP OPP1 - OPP50 */
-	OPP_INITIALIZER("iva", true,  260000000, OMAP3630_VDD_MPU_OPP50_UV),
-	/* DSP OPP2 - OPP100 */
-	OPP_INITIALIZER("iva", true,  520000000, OMAP3630_VDD_MPU_OPP100_UV),
-	/* DSP OPP3 - OPP-Turbo */
-	OPP_INITIALIZER("iva", false, 660000000, OMAP3630_VDD_MPU_OPP120_UV),
-	/* DSP OPP4 - OPP-SB */
-	OPP_INITIALIZER("iva", false, 800000000, OMAP3630_VDD_MPU_OPP1G_UV),
-};
-
-/**
- * omap3_opp_init() - initialize omap3 opp table
- */
-int __init omap3_opp_init(void)
-{
-	int r = -ENODEV;
-
-	if (!cpu_is_omap34xx())
-		return r;
-
-	if (cpu_is_omap3630())
-		r = omap_init_opp_table(omap36xx_opp_def_list,
-			ARRAY_SIZE(omap36xx_opp_def_list));
-	else
-		r = omap_init_opp_table(omap34xx_opp_def_list,
-			ARRAY_SIZE(omap34xx_opp_def_list));
-
-	return r;
-}
-omap_device_initcall(omap3_opp_init);
diff --git a/arch/arm/mach-omap2/opp4xxx_data.c b/arch/arm/mach-omap2/opp4xxx_data.c
--- a/arch/arm/mach-omap2/opp4xxx_data.c
+++ b/arch/arm/mach-omap2/opp4xxx_data.c
@@ -63,29 +63,6 @@ struct omap_volt_data omap443x_vdd_core_volt_data[] = {
 	VOLT_DATA_DEFINE(0, 0, 0, 0),
 };
 
-
-static struct omap_opp_def __initdata omap443x_opp_def_list[] = {
-	/* MPU OPP1 - OPP50 */
-	OPP_INITIALIZER("mpu", true, 300000000, OMAP4430_VDD_MPU_OPP50_UV),
-	/* MPU OPP2 - OPP100 */
-	OPP_INITIALIZER("mpu", true, 600000000, OMAP4430_VDD_MPU_OPP100_UV),
-	/* MPU OPP3 - OPP-Turbo */
-	OPP_INITIALIZER("mpu", true, 800000000, OMAP4430_VDD_MPU_OPPTURBO_UV),
-	/* MPU OPP4 - OPP-SB */
-	OPP_INITIALIZER("mpu", true, 1008000000, OMAP4430_VDD_MPU_OPPNITRO_UV),
-	/* L3 OPP1 - OPP50 */
-	OPP_INITIALIZER("l3_main_1", true, 100000000, OMAP4430_VDD_CORE_OPP50_UV),
-	/* L3 OPP2 - OPP100, OPP-Turbo, OPP-SB */
-	OPP_INITIALIZER("l3_main_1", true, 200000000, OMAP4430_VDD_CORE_OPP100_UV),
-	/* IVA OPP1 - OPP50 */
-	OPP_INITIALIZER("iva", true, 133000000, OMAP4430_VDD_IVA_OPP50_UV),
-	/* IVA OPP2 - OPP100 */
-	OPP_INITIALIZER("iva", true, 266100000, OMAP4430_VDD_IVA_OPP100_UV),
-	/* IVA OPP3 - OPP-Turbo */
-	OPP_INITIALIZER("iva", false, 332000000, OMAP4430_VDD_IVA_OPPTURBO_UV),
-	/* TODO: add DSP, aess, fdif, gpu */
-};
-
 #define OMAP4460_VDD_MPU_OPP50_UV		1025000
 #define OMAP4460_VDD_MPU_OPP100_UV		1200000
 #define OMAP4460_VDD_MPU_OPPTURBO_UV		1313000
@@ -122,59 +99,3 @@ struct omap_volt_data omap446x_vdd_core_volt_data[] = {
 	VOLT_DATA_DEFINE(OMAP4460_VDD_CORE_OPP100_OV_UV, OMAP44XX_CONTROL_FUSE_CORE_OPP100OV, 0xf9, 0x16),
 	VOLT_DATA_DEFINE(0, 0, 0, 0),
 };
-
-static struct omap_opp_def __initdata omap446x_opp_def_list[] = {
-	/* MPU OPP1 - OPP50 */
-	OPP_INITIALIZER("mpu", true, 350000000, OMAP4460_VDD_MPU_OPP50_UV),
-	/* MPU OPP2 - OPP100 */
-	OPP_INITIALIZER("mpu", true, 700000000, OMAP4460_VDD_MPU_OPP100_UV),
-	/* MPU OPP3 - OPP-Turbo */
-	OPP_INITIALIZER("mpu", true, 920000000, OMAP4460_VDD_MPU_OPPTURBO_UV),
-	/*
-	 * MPU OPP4 - OPP-Nitro + Disabled as the reference schematics
-	 * recommends TPS623631 - confirm and enable the opp in board file
-	 * XXX: May be we should enable these based on mpu capability and
-	 * Exception board files disable it...
-	 */
-	OPP_INITIALIZER("mpu", false, 1200000000, OMAP4460_VDD_MPU_OPPNITRO_UV),
-	/* MPU OPP4 - OPP-Nitro SpeedBin */
-	OPP_INITIALIZER("mpu", false, 1500000000, OMAP4460_VDD_MPU_OPPNITRO_UV),
-	/* L3 OPP1 - OPP50 */
-	OPP_INITIALIZER("l3_main_1", true, 100000000, OMAP4460_VDD_CORE_OPP50_UV),
-	/* L3 OPP2 - OPP100 */
-	OPP_INITIALIZER("l3_main_1", true, 200000000, OMAP4460_VDD_CORE_OPP100_UV),
-	/* IVA OPP1 - OPP50 */
-	OPP_INITIALIZER("iva", true, 133000000, OMAP4460_VDD_IVA_OPP50_UV),
-	/* IVA OPP2 - OPP100 */
-	OPP_INITIALIZER("iva", true, 266100000, OMAP4460_VDD_IVA_OPP100_UV),
-	/*
-	 * IVA OPP3 - OPP-Turbo + Disabled as the reference schematics
-	 * recommends Phoenix VCORE2 which can supply only 600mA - so the ones
-	 * above this OPP frequency, even though OMAP is capable, should be
-	 * enabled by board file which is sure of the chip power capability
-	 */
-	OPP_INITIALIZER("iva", false, 332000000, OMAP4460_VDD_IVA_OPPTURBO_UV),
-	/* IVA OPP4 - OPP-Nitro */
-	OPP_INITIALIZER("iva", false, 430000000, OMAP4460_VDD_IVA_OPPNITRO_UV),
-	/* IVA OPP5 - OPP-Nitro SpeedBin*/
-	OPP_INITIALIZER("iva", false, 500000000, OMAP4460_VDD_IVA_OPPNITRO_UV),
-
-	/* TODO: add DSP, aess, fdif, gpu */
-};
-
-/**
- * omap4_opp_init() - initialize omap4 opp table
- */
-int __init omap4_opp_init(void)
-{
-	int r = -ENODEV;
-
-	if (cpu_is_omap443x())
-		r = omap_init_opp_table(omap443x_opp_def_list,
-			ARRAY_SIZE(omap443x_opp_def_list));
-	else if (cpu_is_omap446x())
-		r = omap_init_opp_table(omap446x_opp_def_list,
-			ARRAY_SIZE(omap446x_opp_def_list));
-	return r;
-}
-omap_device_initcall(omap4_opp_init);
-- 
2.13.0

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 02/11] ARM: OMAP2+: Remove unused legacy code for timer
  2017-05-31 22:51 ` Tony Lindgren
@ 2017-05-31 22:51   ` Tony Lindgren
  -1 siblings, 0 replies; 56+ messages in thread
From: Tony Lindgren @ 2017-05-31 22:51 UTC (permalink / raw)
  To: linux-omap; +Cc: linux-arm-kernel

We are now booting all mach-omap2 in device tree only mode.
Any code that is only called in legacy boot mode where
of_have_populated_dt() is not set is safe to remove now.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/timer.c | 172 ++++++--------------------------------------
 1 file changed, 20 insertions(+), 152 deletions(-)

diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@ -252,37 +252,27 @@ static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer,
 					 const char **timer_name,
 					 int posted)
 {
-	char name[10]; /* 10 = sizeof("gptXX_Xck0") */
 	const char *oh_name = NULL;
 	struct device_node *np;
 	struct omap_hwmod *oh;
-	struct resource irq, mem;
 	struct clk *src;
 	int r = 0;
 
-	if (of_have_populated_dt()) {
-		np = omap_get_timer_dt(omap_timer_match, property);
-		if (!np)
-			return -ENODEV;
+	np = omap_get_timer_dt(omap_timer_match, property);
+	if (!np)
+		return -ENODEV;
 
-		of_property_read_string_index(np, "ti,hwmods", 0, &oh_name);
-		if (!oh_name)
-			return -ENODEV;
+	of_property_read_string_index(np, "ti,hwmods", 0, &oh_name);
+	if (!oh_name)
+		return -ENODEV;
 
-		timer->irq = irq_of_parse_and_map(np, 0);
-		if (!timer->irq)
-			return -ENXIO;
+	timer->irq = irq_of_parse_and_map(np, 0);
+	if (!timer->irq)
+		return -ENXIO;
 
-		timer->io_base = of_iomap(np, 0);
+	timer->io_base = of_iomap(np, 0);
 
-		of_node_put(np);
-	} else {
-		if (omap_dm_timer_reserve_systimer(timer->id))
-			return -ENODEV;
-
-		sprintf(name, "timer%d", timer->id);
-		oh_name = name;
-	}
+	of_node_put(np);
 
 	oh = omap_hwmod_lookup(oh_name);
 	if (!oh)
@@ -290,22 +280,6 @@ static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer,
 
 	*timer_name = oh->name;
 
-	if (!of_have_populated_dt()) {
-		r = omap_hwmod_get_resource_byname(oh, IORESOURCE_IRQ, NULL,
-						   &irq);
-		if (r)
-			return -ENXIO;
-		timer->irq = irq.start;
-
-		r = omap_hwmod_get_resource_byname(oh, IORESOURCE_MEM, NULL,
-						   &mem);
-		if (r)
-			return -ENXIO;
-
-		/* Static mapping, never released */
-		timer->io_base = ioremap(mem.start, mem.end - mem.start);
-	}
-
 	if (!timer->io_base)
 		return -ENXIO;
 
@@ -433,18 +407,15 @@ static int __init __maybe_unused omap2_sync32k_clocksource_init(void)
 	const char *oh_name = "counter_32k";
 
 	/*
-	 * If device-tree is present, then search the DT blob
-	 * to see if the 32kHz counter is supported.
+	 * See if the 32kHz counter is supported.
 	 */
-	if (of_have_populated_dt()) {
-		np = omap_get_timer_dt(omap_counter_match, NULL);
-		if (!np)
-			return -ENODEV;
-
-		of_property_read_string_index(np, "ti,hwmods", 0, &oh_name);
-		if (!oh_name)
-			return -ENODEV;
-	}
+	np = omap_get_timer_dt(omap_counter_match, NULL);
+	if (!np)
+		return -ENODEV;
+
+	of_property_read_string_index(np, "ti,hwmods", 0, &oh_name);
+	if (!oh_name)
+		return -ENODEV;
 
 	/*
 	 * First check hwmod data is available for sync32k counter
@@ -462,18 +433,6 @@ static int __init __maybe_unused omap2_sync32k_clocksource_init(void)
 		return ret;
 	}
 
-	if (!of_have_populated_dt()) {
-		void __iomem *vbase;
-
-		vbase = omap_hwmod_get_mpu_rt_va(oh);
-
-		ret = omap_init_clocksource_32k(vbase);
-		if (ret) {
-			pr_warn("%s: failed to initialize counter_32k as a clocksource (%d)\n",
-					__func__, ret);
-			omap_hwmod_idle(oh);
-		}
-	}
 	return ret;
 }
 
@@ -544,8 +503,7 @@ void __init omap3_gptimer_timer_init(void)
 {
 	__omap_sync32k_timer_init(2, "timer_sys_ck", NULL,
 			1, "timer_sys_ck", "ti,timer-alwon", true);
-	if (of_have_populated_dt())
-		clocksource_probe();
+	clocksource_probe();
 }
 #endif
 
@@ -689,96 +647,6 @@ void __init omap5_realtime_timer_init(void)
 #endif /* CONFIG_SOC_OMAP5 || CONFIG_SOC_DRA7XX */
 
 /**
- * omap_timer_init - build and register timer device with an
- * associated timer hwmod
- * @oh:	timer hwmod pointer to be used to build timer device
- * @user:	parameter that can be passed from calling hwmod API
- *
- * Called by omap_hwmod_for_each_by_class to register each of the timer
- * devices present in the system. The number of timer devices is known
- * by parsing through the hwmod database for a given class name. At the
- * end of function call memory is allocated for timer device and it is
- * registered to the framework ready to be proved by the driver.
- */
-static int __init omap_timer_init(struct omap_hwmod *oh, void *unused)
-{
-	int id;
-	int ret = 0;
-	char *name = "omap_timer";
-	struct dmtimer_platform_data *pdata;
-	struct platform_device *pdev;
-	struct omap_timer_capability_dev_attr *timer_dev_attr;
-
-	pr_debug("%s: %s\n", __func__, oh->name);
-
-	/* on secure device, do not register secure timer */
-	timer_dev_attr = oh->dev_attr;
-	if (omap_type() != OMAP2_DEVICE_TYPE_GP && timer_dev_attr)
-		if (timer_dev_attr->timer_capability == OMAP_TIMER_SECURE)
-			return ret;
-
-	pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
-	if (!pdata) {
-		pr_err("%s: No memory for [%s]\n", __func__, oh->name);
-		return -ENOMEM;
-	}
-
-	/*
-	 * Extract the IDs from name field in hwmod database
-	 * and use the same for constructing ids' for the
-	 * timer devices. In a way, we are avoiding usage of
-	 * static variable witin the function to do the same.
-	 * CAUTION: We have to be careful and make sure the
-	 * name in hwmod database does not change in which case
-	 * we might either make corresponding change here or
-	 * switch back static variable mechanism.
-	 */
-	sscanf(oh->name, "timer%2d", &id);
-
-	if (timer_dev_attr)
-		pdata->timer_capability = timer_dev_attr->timer_capability;
-
-	pdata->timer_errata = omap_dm_timer_get_errata();
-	pdata->get_context_loss_count = omap_pm_get_dev_context_loss_count;
-
-	pdev = omap_device_build(name, id, oh, pdata, sizeof(*pdata));
-
-	if (IS_ERR(pdev)) {
-		pr_err("%s: Can't build omap_device for %s: %s.\n",
-			__func__, name, oh->name);
-		ret = -EINVAL;
-	}
-
-	kfree(pdata);
-
-	return ret;
-}
-
-/**
- * omap2_dm_timer_init - top level regular device initialization
- *
- * Uses dedicated hwmod api to parse through hwmod database for
- * given class name and then build and register the timer device.
- */
-static int __init omap2_dm_timer_init(void)
-{
-	int ret;
-
-	/* If dtb is there, the devices will be created dynamically */
-	if (of_have_populated_dt())
-		return -ENODEV;
-
-	ret = omap_hwmod_for_each_by_class("timer", omap_timer_init, NULL);
-	if (unlikely(ret)) {
-		pr_err("%s: device registration failed.\n", __func__);
-		return -EINVAL;
-	}
-
-	return 0;
-}
-omap_arch_initcall(omap2_dm_timer_init);
-
-/**
  * omap2_override_clocksource - clocksource override with user configuration
  *
  * Allows user to override default clocksource, using kernel parameter
-- 
2.13.0

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 02/11] ARM: OMAP2+: Remove unused legacy code for timer
@ 2017-05-31 22:51   ` Tony Lindgren
  0 siblings, 0 replies; 56+ messages in thread
From: Tony Lindgren @ 2017-05-31 22:51 UTC (permalink / raw)
  To: linux-arm-kernel

We are now booting all mach-omap2 in device tree only mode.
Any code that is only called in legacy boot mode where
of_have_populated_dt() is not set is safe to remove now.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/timer.c | 172 ++++++--------------------------------------
 1 file changed, 20 insertions(+), 152 deletions(-)

diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@ -252,37 +252,27 @@ static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer,
 					 const char **timer_name,
 					 int posted)
 {
-	char name[10]; /* 10 = sizeof("gptXX_Xck0") */
 	const char *oh_name = NULL;
 	struct device_node *np;
 	struct omap_hwmod *oh;
-	struct resource irq, mem;
 	struct clk *src;
 	int r = 0;
 
-	if (of_have_populated_dt()) {
-		np = omap_get_timer_dt(omap_timer_match, property);
-		if (!np)
-			return -ENODEV;
+	np = omap_get_timer_dt(omap_timer_match, property);
+	if (!np)
+		return -ENODEV;
 
-		of_property_read_string_index(np, "ti,hwmods", 0, &oh_name);
-		if (!oh_name)
-			return -ENODEV;
+	of_property_read_string_index(np, "ti,hwmods", 0, &oh_name);
+	if (!oh_name)
+		return -ENODEV;
 
-		timer->irq = irq_of_parse_and_map(np, 0);
-		if (!timer->irq)
-			return -ENXIO;
+	timer->irq = irq_of_parse_and_map(np, 0);
+	if (!timer->irq)
+		return -ENXIO;
 
-		timer->io_base = of_iomap(np, 0);
+	timer->io_base = of_iomap(np, 0);
 
-		of_node_put(np);
-	} else {
-		if (omap_dm_timer_reserve_systimer(timer->id))
-			return -ENODEV;
-
-		sprintf(name, "timer%d", timer->id);
-		oh_name = name;
-	}
+	of_node_put(np);
 
 	oh = omap_hwmod_lookup(oh_name);
 	if (!oh)
@@ -290,22 +280,6 @@ static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer,
 
 	*timer_name = oh->name;
 
-	if (!of_have_populated_dt()) {
-		r = omap_hwmod_get_resource_byname(oh, IORESOURCE_IRQ, NULL,
-						   &irq);
-		if (r)
-			return -ENXIO;
-		timer->irq = irq.start;
-
-		r = omap_hwmod_get_resource_byname(oh, IORESOURCE_MEM, NULL,
-						   &mem);
-		if (r)
-			return -ENXIO;
-
-		/* Static mapping, never released */
-		timer->io_base = ioremap(mem.start, mem.end - mem.start);
-	}
-
 	if (!timer->io_base)
 		return -ENXIO;
 
@@ -433,18 +407,15 @@ static int __init __maybe_unused omap2_sync32k_clocksource_init(void)
 	const char *oh_name = "counter_32k";
 
 	/*
-	 * If device-tree is present, then search the DT blob
-	 * to see if the 32kHz counter is supported.
+	 * See if the 32kHz counter is supported.
 	 */
-	if (of_have_populated_dt()) {
-		np = omap_get_timer_dt(omap_counter_match, NULL);
-		if (!np)
-			return -ENODEV;
-
-		of_property_read_string_index(np, "ti,hwmods", 0, &oh_name);
-		if (!oh_name)
-			return -ENODEV;
-	}
+	np = omap_get_timer_dt(omap_counter_match, NULL);
+	if (!np)
+		return -ENODEV;
+
+	of_property_read_string_index(np, "ti,hwmods", 0, &oh_name);
+	if (!oh_name)
+		return -ENODEV;
 
 	/*
 	 * First check hwmod data is available for sync32k counter
@@ -462,18 +433,6 @@ static int __init __maybe_unused omap2_sync32k_clocksource_init(void)
 		return ret;
 	}
 
-	if (!of_have_populated_dt()) {
-		void __iomem *vbase;
-
-		vbase = omap_hwmod_get_mpu_rt_va(oh);
-
-		ret = omap_init_clocksource_32k(vbase);
-		if (ret) {
-			pr_warn("%s: failed to initialize counter_32k as a clocksource (%d)\n",
-					__func__, ret);
-			omap_hwmod_idle(oh);
-		}
-	}
 	return ret;
 }
 
@@ -544,8 +503,7 @@ void __init omap3_gptimer_timer_init(void)
 {
 	__omap_sync32k_timer_init(2, "timer_sys_ck", NULL,
 			1, "timer_sys_ck", "ti,timer-alwon", true);
-	if (of_have_populated_dt())
-		clocksource_probe();
+	clocksource_probe();
 }
 #endif
 
@@ -689,96 +647,6 @@ void __init omap5_realtime_timer_init(void)
 #endif /* CONFIG_SOC_OMAP5 || CONFIG_SOC_DRA7XX */
 
 /**
- * omap_timer_init - build and register timer device with an
- * associated timer hwmod
- * @oh:	timer hwmod pointer to be used to build timer device
- * @user:	parameter that can be passed from calling hwmod API
- *
- * Called by omap_hwmod_for_each_by_class to register each of the timer
- * devices present in the system. The number of timer devices is known
- * by parsing through the hwmod database for a given class name. At the
- * end of function call memory is allocated for timer device and it is
- * registered to the framework ready to be proved by the driver.
- */
-static int __init omap_timer_init(struct omap_hwmod *oh, void *unused)
-{
-	int id;
-	int ret = 0;
-	char *name = "omap_timer";
-	struct dmtimer_platform_data *pdata;
-	struct platform_device *pdev;
-	struct omap_timer_capability_dev_attr *timer_dev_attr;
-
-	pr_debug("%s: %s\n", __func__, oh->name);
-
-	/* on secure device, do not register secure timer */
-	timer_dev_attr = oh->dev_attr;
-	if (omap_type() != OMAP2_DEVICE_TYPE_GP && timer_dev_attr)
-		if (timer_dev_attr->timer_capability == OMAP_TIMER_SECURE)
-			return ret;
-
-	pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
-	if (!pdata) {
-		pr_err("%s: No memory for [%s]\n", __func__, oh->name);
-		return -ENOMEM;
-	}
-
-	/*
-	 * Extract the IDs from name field in hwmod database
-	 * and use the same for constructing ids' for the
-	 * timer devices. In a way, we are avoiding usage of
-	 * static variable witin the function to do the same.
-	 * CAUTION: We have to be careful and make sure the
-	 * name in hwmod database does not change in which case
-	 * we might either make corresponding change here or
-	 * switch back static variable mechanism.
-	 */
-	sscanf(oh->name, "timer%2d", &id);
-
-	if (timer_dev_attr)
-		pdata->timer_capability = timer_dev_attr->timer_capability;
-
-	pdata->timer_errata = omap_dm_timer_get_errata();
-	pdata->get_context_loss_count = omap_pm_get_dev_context_loss_count;
-
-	pdev = omap_device_build(name, id, oh, pdata, sizeof(*pdata));
-
-	if (IS_ERR(pdev)) {
-		pr_err("%s: Can't build omap_device for %s: %s.\n",
-			__func__, name, oh->name);
-		ret = -EINVAL;
-	}
-
-	kfree(pdata);
-
-	return ret;
-}
-
-/**
- * omap2_dm_timer_init - top level regular device initialization
- *
- * Uses dedicated hwmod api to parse through hwmod database for
- * given class name and then build and register the timer device.
- */
-static int __init omap2_dm_timer_init(void)
-{
-	int ret;
-
-	/* If dtb is there, the devices will be created dynamically */
-	if (of_have_populated_dt())
-		return -ENODEV;
-
-	ret = omap_hwmod_for_each_by_class("timer", omap_timer_init, NULL);
-	if (unlikely(ret)) {
-		pr_err("%s: device registration failed.\n", __func__);
-		return -EINVAL;
-	}
-
-	return 0;
-}
-omap_arch_initcall(omap2_dm_timer_init);
-
-/**
  * omap2_override_clocksource - clocksource override with user configuration
  *
  * Allows user to override default clocksource, using kernel parameter
-- 
2.13.0

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 03/11] ARM: OMAP2+: Remove unused legacy code for PMU
  2017-05-31 22:51 ` Tony Lindgren
@ 2017-05-31 22:51   ` Tony Lindgren
  -1 siblings, 0 replies; 56+ messages in thread
From: Tony Lindgren @ 2017-05-31 22:51 UTC (permalink / raw)
  To: linux-omap; +Cc: linux-arm-kernel

We are now booting all mach-omap2 in device tree only mode.
Any code that is only called in legacy boot mode where
of_have_populated_dt() is not set is safe to remove now.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/Makefile |  3 --
 arch/arm/mach-omap2/pmu.c    | 97 --------------------------------------------
 2 files changed, 100 deletions(-)
 delete mode 100644 arch/arm/mach-omap2/pmu.c

diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -219,9 +219,6 @@ obj-$(CONFIG_ARCH_OMAP4)		+= omap_hwmod_44xx_data.o
 obj-$(CONFIG_SOC_OMAP5)			+= omap_hwmod_54xx_data.o
 obj-$(CONFIG_SOC_DRA7XX)		+= omap_hwmod_7xx_data.o
 
-# EMU peripherals
-obj-$(CONFIG_HW_PERF_EVENTS)		+= pmu.o
-
 # OMAP2420 MSDI controller integration support ("MMC")
 obj-$(CONFIG_SOC_OMAP2420)		+= msdi.o
 
diff --git a/arch/arm/mach-omap2/pmu.c b/arch/arm/mach-omap2/pmu.c
deleted file mode 100644
--- a/arch/arm/mach-omap2/pmu.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * OMAP2 ARM Performance Monitoring Unit (PMU) Support
- *
- * Copyright (C) 2012 Texas Instruments, Inc.
- *
- * Contacts:
- * Jon Hunter <jon-hunter@ti.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- */
-#include <linux/of.h>
-
-#include <asm/system_info.h>
-
-#include "soc.h"
-#include "omap_hwmod.h"
-#include "omap_device.h"
-
-static char *omap2_pmu_oh_names[] = {"mpu"};
-static char *omap3_pmu_oh_names[] = {"mpu", "debugss"};
-static char *omap4430_pmu_oh_names[] = {"l3_main_3", "l3_instr", "debugss"};
-static struct platform_device *omap_pmu_dev;
-
-/**
- * omap2_init_pmu - creates and registers PMU platform device
- * @oh_num:	Number of OMAP HWMODs required to create PMU device
- * @oh_names:	Array of OMAP HWMODS names required to create PMU device
- *
- * Uses OMAP HWMOD framework to create and register an ARM PMU device
- * from a list of HWMOD names passed. Currently supports OMAP2, OMAP3
- * and OMAP4 devices.
- */
-static int __init omap2_init_pmu(unsigned oh_num, char *oh_names[])
-{
-	int i;
-	struct omap_hwmod *oh[3];
-	char *dev_name = cpu_architecture() == CPU_ARCH_ARMv6 ?
-			 "armv6-pmu" : "armv7-pmu";
-
-	if ((!oh_num) || (oh_num > 3))
-		return -EINVAL;
-
-	for (i = 0; i < oh_num; i++) {
-		oh[i] = omap_hwmod_lookup(oh_names[i]);
-		if (!oh[i]) {
-			pr_err("Could not look up %s hwmod\n", oh_names[i]);
-			return -ENODEV;
-		}
-	}
-
-	omap_pmu_dev = omap_device_build_ss(dev_name, -1, oh, oh_num, NULL, 0);
-	WARN(IS_ERR(omap_pmu_dev), "Can't build omap_device for %s.\n",
-	     dev_name);
-
-	return PTR_ERR_OR_ZERO(omap_pmu_dev);
-}
-
-static int __init omap_init_pmu(void)
-{
-	unsigned oh_num;
-	char **oh_names;
-
-	/* XXX Remove this check when the CTI driver is available */
-	if (cpu_is_omap443x()) {
-		pr_info("ARM PMU: not yet supported on OMAP4430 due to missing CTI driver\n");
-		return 0;
-	}
-
-	if (of_have_populated_dt())
-		return 0;
-
-	/*
-	 * To create an ARM-PMU device the following HWMODs
-	 * are required for the various OMAP2+ devices.
-	 *
-	 * OMAP24xx:	mpu
-	 * OMAP3xxx:	mpu, debugss
-	 * OMAP4430:	l3_main_3, l3_instr, debugss
-	 * OMAP4460/70:	mpu, debugss
-	 */
-	if (cpu_is_omap443x()) {
-		oh_num = ARRAY_SIZE(omap4430_pmu_oh_names);
-		oh_names = omap4430_pmu_oh_names;
-	} else if (cpu_is_omap34xx() || cpu_is_omap44xx()) {
-		oh_num = ARRAY_SIZE(omap3_pmu_oh_names);
-		oh_names = omap3_pmu_oh_names;
-	} else {
-		oh_num = ARRAY_SIZE(omap2_pmu_oh_names);
-		oh_names = omap2_pmu_oh_names;
-	}
-
-	return omap2_init_pmu(oh_num, oh_names);
-}
-omap_subsys_initcall(omap_init_pmu);
-- 
2.13.0

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 03/11] ARM: OMAP2+: Remove unused legacy code for PMU
@ 2017-05-31 22:51   ` Tony Lindgren
  0 siblings, 0 replies; 56+ messages in thread
From: Tony Lindgren @ 2017-05-31 22:51 UTC (permalink / raw)
  To: linux-arm-kernel

We are now booting all mach-omap2 in device tree only mode.
Any code that is only called in legacy boot mode where
of_have_populated_dt() is not set is safe to remove now.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/Makefile |  3 --
 arch/arm/mach-omap2/pmu.c    | 97 --------------------------------------------
 2 files changed, 100 deletions(-)
 delete mode 100644 arch/arm/mach-omap2/pmu.c

diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -219,9 +219,6 @@ obj-$(CONFIG_ARCH_OMAP4)		+= omap_hwmod_44xx_data.o
 obj-$(CONFIG_SOC_OMAP5)			+= omap_hwmod_54xx_data.o
 obj-$(CONFIG_SOC_DRA7XX)		+= omap_hwmod_7xx_data.o
 
-# EMU peripherals
-obj-$(CONFIG_HW_PERF_EVENTS)		+= pmu.o
-
 # OMAP2420 MSDI controller integration support ("MMC")
 obj-$(CONFIG_SOC_OMAP2420)		+= msdi.o
 
diff --git a/arch/arm/mach-omap2/pmu.c b/arch/arm/mach-omap2/pmu.c
deleted file mode 100644
--- a/arch/arm/mach-omap2/pmu.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * OMAP2 ARM Performance Monitoring Unit (PMU) Support
- *
- * Copyright (C) 2012 Texas Instruments, Inc.
- *
- * Contacts:
- * Jon Hunter <jon-hunter@ti.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- */
-#include <linux/of.h>
-
-#include <asm/system_info.h>
-
-#include "soc.h"
-#include "omap_hwmod.h"
-#include "omap_device.h"
-
-static char *omap2_pmu_oh_names[] = {"mpu"};
-static char *omap3_pmu_oh_names[] = {"mpu", "debugss"};
-static char *omap4430_pmu_oh_names[] = {"l3_main_3", "l3_instr", "debugss"};
-static struct platform_device *omap_pmu_dev;
-
-/**
- * omap2_init_pmu - creates and registers PMU platform device
- * @oh_num:	Number of OMAP HWMODs required to create PMU device
- * @oh_names:	Array of OMAP HWMODS names required to create PMU device
- *
- * Uses OMAP HWMOD framework to create and register an ARM PMU device
- * from a list of HWMOD names passed. Currently supports OMAP2, OMAP3
- * and OMAP4 devices.
- */
-static int __init omap2_init_pmu(unsigned oh_num, char *oh_names[])
-{
-	int i;
-	struct omap_hwmod *oh[3];
-	char *dev_name = cpu_architecture() == CPU_ARCH_ARMv6 ?
-			 "armv6-pmu" : "armv7-pmu";
-
-	if ((!oh_num) || (oh_num > 3))
-		return -EINVAL;
-
-	for (i = 0; i < oh_num; i++) {
-		oh[i] = omap_hwmod_lookup(oh_names[i]);
-		if (!oh[i]) {
-			pr_err("Could not look up %s hwmod\n", oh_names[i]);
-			return -ENODEV;
-		}
-	}
-
-	omap_pmu_dev = omap_device_build_ss(dev_name, -1, oh, oh_num, NULL, 0);
-	WARN(IS_ERR(omap_pmu_dev), "Can't build omap_device for %s.\n",
-	     dev_name);
-
-	return PTR_ERR_OR_ZERO(omap_pmu_dev);
-}
-
-static int __init omap_init_pmu(void)
-{
-	unsigned oh_num;
-	char **oh_names;
-
-	/* XXX Remove this check when the CTI driver is available */
-	if (cpu_is_omap443x()) {
-		pr_info("ARM PMU: not yet supported on OMAP4430 due to missing CTI driver\n");
-		return 0;
-	}
-
-	if (of_have_populated_dt())
-		return 0;
-
-	/*
-	 * To create an ARM-PMU device the following HWMODs
-	 * are required for the various OMAP2+ devices.
-	 *
-	 * OMAP24xx:	mpu
-	 * OMAP3xxx:	mpu, debugss
-	 * OMAP4430:	l3_main_3, l3_instr, debugss
-	 * OMAP4460/70:	mpu, debugss
-	 */
-	if (cpu_is_omap443x()) {
-		oh_num = ARRAY_SIZE(omap4430_pmu_oh_names);
-		oh_names = omap4430_pmu_oh_names;
-	} else if (cpu_is_omap34xx() || cpu_is_omap44xx()) {
-		oh_num = ARRAY_SIZE(omap3_pmu_oh_names);
-		oh_names = omap3_pmu_oh_names;
-	} else {
-		oh_num = ARRAY_SIZE(omap2_pmu_oh_names);
-		oh_names = omap2_pmu_oh_names;
-	}
-
-	return omap2_init_pmu(oh_num, oh_names);
-}
-omap_subsys_initcall(omap_init_pmu);
-- 
2.13.0

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 04/11] ARM: OMAP2+: Remove unused legacy code for device init
  2017-05-31 22:51 ` Tony Lindgren
@ 2017-05-31 22:51   ` Tony Lindgren
  -1 siblings, 0 replies; 56+ messages in thread
From: Tony Lindgren @ 2017-05-31 22:51 UTC (permalink / raw)
  To: linux-omap; +Cc: linux-arm-kernel

We are now booting all mach-omap2 in device tree only mode.
Any code that is only called in legacy boot mode where
of_have_populated_dt() is not set is safe to remove now.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/devices.c | 163 ------------------------------------------
 1 file changed, 163 deletions(-)

diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -36,130 +36,8 @@
 #define L3_MODULES_MAX_LEN 12
 #define L3_MODULES 3
 
-static int __init omap3_l3_init(void)
-{
-	struct omap_hwmod *oh;
-	struct platform_device *pdev;
-	char oh_name[L3_MODULES_MAX_LEN];
-
-	/*
-	 * To avoid code running on other OMAPs in
-	 * multi-omap builds
-	 */
-	if (!(cpu_is_omap34xx()) || of_have_populated_dt())
-		return -ENODEV;
-
-	snprintf(oh_name, L3_MODULES_MAX_LEN, "l3_main");
-
-	oh = omap_hwmod_lookup(oh_name);
-
-	if (!oh)
-		pr_err("could not look up %s\n", oh_name);
-
-	pdev = omap_device_build("omap_l3_smx", 0, oh, NULL, 0);
-
-	WARN(IS_ERR(pdev), "could not build omap_device for %s\n", oh_name);
-
-	return PTR_ERR_OR_ZERO(pdev);
-}
-omap_postcore_initcall(omap3_l3_init);
-
 static inline void omap_init_sti(void) {}
 
-#if IS_ENABLED(CONFIG_SPI_OMAP24XX)
-
-#include <linux/platform_data/spi-omap2-mcspi.h>
-
-static int __init omap_mcspi_init(struct omap_hwmod *oh, void *unused)
-{
-	struct platform_device *pdev;
-	char *name = "omap2_mcspi";
-	struct omap2_mcspi_platform_config *pdata;
-	static int spi_num;
-	struct omap2_mcspi_dev_attr *mcspi_attrib = oh->dev_attr;
-
-	pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
-	if (!pdata) {
-		pr_err("Memory allocation for McSPI device failed\n");
-		return -ENOMEM;
-	}
-
-	pdata->num_cs = mcspi_attrib->num_chipselect;
-	switch (oh->class->rev) {
-	case OMAP2_MCSPI_REV:
-	case OMAP3_MCSPI_REV:
-			pdata->regs_offset = 0;
-			break;
-	case OMAP4_MCSPI_REV:
-			pdata->regs_offset = OMAP4_MCSPI_REG_OFFSET;
-			break;
-	default:
-			pr_err("Invalid McSPI Revision value\n");
-			kfree(pdata);
-			return -EINVAL;
-	}
-
-	spi_num++;
-	pdev = omap_device_build(name, spi_num, oh, pdata, sizeof(*pdata));
-	WARN(IS_ERR(pdev), "Can't build omap_device for %s:%s\n",
-				name, oh->name);
-	kfree(pdata);
-	return 0;
-}
-
-static void omap_init_mcspi(void)
-{
-	omap_hwmod_for_each_by_class("mcspi", omap_mcspi_init, NULL);
-}
-
-#else
-static inline void omap_init_mcspi(void) {}
-#endif
-
-/**
- * omap_init_rng - bind the RNG hwmod to the RNG omap_device
- *
- * Bind the RNG hwmod to the RNG omap_device.  No return value.
- */
-static void __init omap_init_rng(void)
-{
-	struct omap_hwmod *oh;
-	struct platform_device *pdev;
-
-	oh = omap_hwmod_lookup("rng");
-	if (!oh)
-		return;
-
-	pdev = omap_device_build("omap_rng", -1, oh, NULL, 0);
-	WARN(IS_ERR(pdev), "Can't build omap_device for omap_rng\n");
-}
-
-static void __init omap_init_sham(void)
-{
-	struct omap_hwmod *oh;
-	struct platform_device *pdev;
-
-	oh = omap_hwmod_lookup("sham");
-	if (!oh)
-		return;
-
-	pdev = omap_device_build("omap-sham", -1, oh, NULL, 0);
-	WARN(IS_ERR(pdev), "Can't build omap_device for omap-sham\n");
-}
-
-static void __init omap_init_aes(void)
-{
-	struct omap_hwmod *oh;
-	struct platform_device *pdev;
-
-	oh = omap_hwmod_lookup("aes");
-	if (!oh)
-		return;
-
-	pdev = omap_device_build("omap-aes", -1, oh, NULL, 0);
-	WARN(IS_ERR(pdev), "Can't build omap_device for omap-aes\n");
-}
-
 /*-------------------------------------------------------------------------*/
 
 #if IS_ENABLED(CONFIG_VIDEO_OMAP2_VOUT)
@@ -190,49 +68,8 @@ int __init omap_init_vout(void) { return 0; }
 
 static int __init omap2_init_devices(void)
 {
-	/* Enable dummy states for those platforms without pinctrl support */
-	if (!of_have_populated_dt())
-		pinctrl_provide_dummies();
-
-	/* If dtb is there, the devices will be created dynamically */
-	if (!of_have_populated_dt()) {
-		/*
-		 * please keep these calls, and their implementations above,
-		 * in alphabetical order so they're easier to sort through.
-		 */
-		omap_init_mcspi();
-		omap_init_sham();
-		omap_init_aes();
-		omap_init_rng();
-	}
 	omap_init_sti();
 
 	return 0;
 }
 omap_arch_initcall(omap2_init_devices);
-
-static int __init omap_gpmc_init(void)
-{
-	struct omap_hwmod *oh;
-	struct platform_device *pdev;
-	char *oh_name = "gpmc";
-
-	/*
-	 * if the board boots up with a populated DT, do not
-	 * manually add the device from this initcall
-	 */
-	if (of_have_populated_dt())
-		return -ENODEV;
-
-	oh = omap_hwmod_lookup(oh_name);
-	if (!oh) {
-		pr_err("Could not look up %s\n", oh_name);
-		return -ENODEV;
-	}
-
-	pdev = omap_device_build("omap-gpmc", -1, oh, NULL, 0);
-	WARN(IS_ERR(pdev), "could not build omap_device for %s\n", oh_name);
-
-	return PTR_ERR_OR_ZERO(pdev);
-}
-omap_postcore_initcall(omap_gpmc_init);
-- 
2.13.0

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 04/11] ARM: OMAP2+: Remove unused legacy code for device init
@ 2017-05-31 22:51   ` Tony Lindgren
  0 siblings, 0 replies; 56+ messages in thread
From: Tony Lindgren @ 2017-05-31 22:51 UTC (permalink / raw)
  To: linux-arm-kernel

We are now booting all mach-omap2 in device tree only mode.
Any code that is only called in legacy boot mode where
of_have_populated_dt() is not set is safe to remove now.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/devices.c | 163 ------------------------------------------
 1 file changed, 163 deletions(-)

diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -36,130 +36,8 @@
 #define L3_MODULES_MAX_LEN 12
 #define L3_MODULES 3
 
-static int __init omap3_l3_init(void)
-{
-	struct omap_hwmod *oh;
-	struct platform_device *pdev;
-	char oh_name[L3_MODULES_MAX_LEN];
-
-	/*
-	 * To avoid code running on other OMAPs in
-	 * multi-omap builds
-	 */
-	if (!(cpu_is_omap34xx()) || of_have_populated_dt())
-		return -ENODEV;
-
-	snprintf(oh_name, L3_MODULES_MAX_LEN, "l3_main");
-
-	oh = omap_hwmod_lookup(oh_name);
-
-	if (!oh)
-		pr_err("could not look up %s\n", oh_name);
-
-	pdev = omap_device_build("omap_l3_smx", 0, oh, NULL, 0);
-
-	WARN(IS_ERR(pdev), "could not build omap_device for %s\n", oh_name);
-
-	return PTR_ERR_OR_ZERO(pdev);
-}
-omap_postcore_initcall(omap3_l3_init);
-
 static inline void omap_init_sti(void) {}
 
-#if IS_ENABLED(CONFIG_SPI_OMAP24XX)
-
-#include <linux/platform_data/spi-omap2-mcspi.h>
-
-static int __init omap_mcspi_init(struct omap_hwmod *oh, void *unused)
-{
-	struct platform_device *pdev;
-	char *name = "omap2_mcspi";
-	struct omap2_mcspi_platform_config *pdata;
-	static int spi_num;
-	struct omap2_mcspi_dev_attr *mcspi_attrib = oh->dev_attr;
-
-	pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
-	if (!pdata) {
-		pr_err("Memory allocation for McSPI device failed\n");
-		return -ENOMEM;
-	}
-
-	pdata->num_cs = mcspi_attrib->num_chipselect;
-	switch (oh->class->rev) {
-	case OMAP2_MCSPI_REV:
-	case OMAP3_MCSPI_REV:
-			pdata->regs_offset = 0;
-			break;
-	case OMAP4_MCSPI_REV:
-			pdata->regs_offset = OMAP4_MCSPI_REG_OFFSET;
-			break;
-	default:
-			pr_err("Invalid McSPI Revision value\n");
-			kfree(pdata);
-			return -EINVAL;
-	}
-
-	spi_num++;
-	pdev = omap_device_build(name, spi_num, oh, pdata, sizeof(*pdata));
-	WARN(IS_ERR(pdev), "Can't build omap_device for %s:%s\n",
-				name, oh->name);
-	kfree(pdata);
-	return 0;
-}
-
-static void omap_init_mcspi(void)
-{
-	omap_hwmod_for_each_by_class("mcspi", omap_mcspi_init, NULL);
-}
-
-#else
-static inline void omap_init_mcspi(void) {}
-#endif
-
-/**
- * omap_init_rng - bind the RNG hwmod to the RNG omap_device
- *
- * Bind the RNG hwmod to the RNG omap_device.  No return value.
- */
-static void __init omap_init_rng(void)
-{
-	struct omap_hwmod *oh;
-	struct platform_device *pdev;
-
-	oh = omap_hwmod_lookup("rng");
-	if (!oh)
-		return;
-
-	pdev = omap_device_build("omap_rng", -1, oh, NULL, 0);
-	WARN(IS_ERR(pdev), "Can't build omap_device for omap_rng\n");
-}
-
-static void __init omap_init_sham(void)
-{
-	struct omap_hwmod *oh;
-	struct platform_device *pdev;
-
-	oh = omap_hwmod_lookup("sham");
-	if (!oh)
-		return;
-
-	pdev = omap_device_build("omap-sham", -1, oh, NULL, 0);
-	WARN(IS_ERR(pdev), "Can't build omap_device for omap-sham\n");
-}
-
-static void __init omap_init_aes(void)
-{
-	struct omap_hwmod *oh;
-	struct platform_device *pdev;
-
-	oh = omap_hwmod_lookup("aes");
-	if (!oh)
-		return;
-
-	pdev = omap_device_build("omap-aes", -1, oh, NULL, 0);
-	WARN(IS_ERR(pdev), "Can't build omap_device for omap-aes\n");
-}
-
 /*-------------------------------------------------------------------------*/
 
 #if IS_ENABLED(CONFIG_VIDEO_OMAP2_VOUT)
@@ -190,49 +68,8 @@ int __init omap_init_vout(void) { return 0; }
 
 static int __init omap2_init_devices(void)
 {
-	/* Enable dummy states for those platforms without pinctrl support */
-	if (!of_have_populated_dt())
-		pinctrl_provide_dummies();
-
-	/* If dtb is there, the devices will be created dynamically */
-	if (!of_have_populated_dt()) {
-		/*
-		 * please keep these calls, and their implementations above,
-		 * in alphabetical order so they're easier to sort through.
-		 */
-		omap_init_mcspi();
-		omap_init_sham();
-		omap_init_aes();
-		omap_init_rng();
-	}
 	omap_init_sti();
 
 	return 0;
 }
 omap_arch_initcall(omap2_init_devices);
-
-static int __init omap_gpmc_init(void)
-{
-	struct omap_hwmod *oh;
-	struct platform_device *pdev;
-	char *oh_name = "gpmc";
-
-	/*
-	 * if the board boots up with a populated DT, do not
-	 * manually add the device from this initcall
-	 */
-	if (of_have_populated_dt())
-		return -ENODEV;
-
-	oh = omap_hwmod_lookup(oh_name);
-	if (!oh) {
-		pr_err("Could not look up %s\n", oh_name);
-		return -ENODEV;
-	}
-
-	pdev = omap_device_build("omap-gpmc", -1, oh, NULL, 0);
-	WARN(IS_ERR(pdev), "could not build omap_device for %s\n", oh_name);
-
-	return PTR_ERR_OR_ZERO(pdev);
-}
-omap_postcore_initcall(omap_gpmc_init);
-- 
2.13.0

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 05/11] ARM: OMAP2+: Remove unused legacy code for McBSP
  2017-05-31 22:51 ` Tony Lindgren
@ 2017-05-31 22:51   ` Tony Lindgren
  -1 siblings, 0 replies; 56+ messages in thread
From: Tony Lindgren @ 2017-05-31 22:51 UTC (permalink / raw)
  To: linux-omap; +Cc: linux-arm-kernel

We are now booting all mach-omap2 in device tree only mode.
Any code that is only called in legacy boot mode where
of_have_populated_dt() is not set is safe to remove now.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/mcbsp.c | 70 ---------------------------------------------
 1 file changed, 70 deletions(-)

diff --git a/arch/arm/mach-omap2/mcbsp.c b/arch/arm/mach-omap2/mcbsp.c
--- a/arch/arm/mach-omap2/mcbsp.c
+++ b/arch/arm/mach-omap2/mcbsp.c
@@ -53,73 +53,3 @@ void __init omap3_mcbsp_init_pdata_callback(
 
 	pdata->force_ick_on = omap3_mcbsp_force_ick_on;
 }
-
-static int __init omap_init_mcbsp(struct omap_hwmod *oh, void *unused)
-{
-	int id, count = 1;
-	char *name = "omap-mcbsp";
-	struct omap_hwmod *oh_device[2];
-	struct omap_mcbsp_platform_data *pdata = NULL;
-	struct platform_device *pdev;
-
-	sscanf(oh->name, "mcbsp%d", &id);
-
-	pdata = kzalloc(sizeof(struct omap_mcbsp_platform_data), GFP_KERNEL);
-	if (!pdata) {
-		pr_err("%s: No memory for mcbsp\n", __func__);
-		return -ENOMEM;
-	}
-
-	pdata->reg_step = 4;
-	if (oh->class->rev < MCBSP_CONFIG_TYPE2) {
-		pdata->reg_size = 2;
-	} else {
-		pdata->reg_size = 4;
-		pdata->has_ccr = true;
-	}
-
-	if (oh->class->rev == MCBSP_CONFIG_TYPE2) {
-		/* The FIFO has 128 locations */
-		pdata->buffer_size = 0x80;
-	} else if (oh->class->rev == MCBSP_CONFIG_TYPE3) {
-		if (id == 2)
-			/* The FIFO has 1024 + 256 locations */
-			pdata->buffer_size = 0x500;
-		else
-			/* The FIFO has 128 locations */
-			pdata->buffer_size = 0x80;
-	} else if (oh->class->rev == MCBSP_CONFIG_TYPE4) {
-		/* The FIFO has 128 locations for all instances */
-		pdata->buffer_size = 0x80;
-	}
-
-	if (oh->class->rev >= MCBSP_CONFIG_TYPE3)
-		pdata->has_wakeup = true;
-
-	oh_device[0] = oh;
-
-	if (oh->dev_attr) {
-		oh_device[1] = omap_hwmod_lookup((
-		(struct omap_mcbsp_dev_attr *)(oh->dev_attr))->sidetone);
-		pdata->force_ick_on = omap3_mcbsp_force_ick_on;
-		count++;
-	}
-	pdev = omap_device_build_ss(name, id, oh_device, count, pdata,
-				    sizeof(*pdata));
-	kfree(pdata);
-	if (IS_ERR(pdev))  {
-		pr_err("%s: Can't build omap_device for %s:%s.\n", __func__,
-					name, oh->name);
-		return PTR_ERR(pdev);
-	}
-	return 0;
-}
-
-static int __init omap2_mcbsp_init(void)
-{
-	if (!of_have_populated_dt())
-		omap_hwmod_for_each_by_class("mcbsp", omap_init_mcbsp, NULL);
-
-	return 0;
-}
-omap_arch_initcall(omap2_mcbsp_init);
-- 
2.13.0

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 05/11] ARM: OMAP2+: Remove unused legacy code for McBSP
@ 2017-05-31 22:51   ` Tony Lindgren
  0 siblings, 0 replies; 56+ messages in thread
From: Tony Lindgren @ 2017-05-31 22:51 UTC (permalink / raw)
  To: linux-arm-kernel

We are now booting all mach-omap2 in device tree only mode.
Any code that is only called in legacy boot mode where
of_have_populated_dt() is not set is safe to remove now.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/mcbsp.c | 70 ---------------------------------------------
 1 file changed, 70 deletions(-)

diff --git a/arch/arm/mach-omap2/mcbsp.c b/arch/arm/mach-omap2/mcbsp.c
--- a/arch/arm/mach-omap2/mcbsp.c
+++ b/arch/arm/mach-omap2/mcbsp.c
@@ -53,73 +53,3 @@ void __init omap3_mcbsp_init_pdata_callback(
 
 	pdata->force_ick_on = omap3_mcbsp_force_ick_on;
 }
-
-static int __init omap_init_mcbsp(struct omap_hwmod *oh, void *unused)
-{
-	int id, count = 1;
-	char *name = "omap-mcbsp";
-	struct omap_hwmod *oh_device[2];
-	struct omap_mcbsp_platform_data *pdata = NULL;
-	struct platform_device *pdev;
-
-	sscanf(oh->name, "mcbsp%d", &id);
-
-	pdata = kzalloc(sizeof(struct omap_mcbsp_platform_data), GFP_KERNEL);
-	if (!pdata) {
-		pr_err("%s: No memory for mcbsp\n", __func__);
-		return -ENOMEM;
-	}
-
-	pdata->reg_step = 4;
-	if (oh->class->rev < MCBSP_CONFIG_TYPE2) {
-		pdata->reg_size = 2;
-	} else {
-		pdata->reg_size = 4;
-		pdata->has_ccr = true;
-	}
-
-	if (oh->class->rev == MCBSP_CONFIG_TYPE2) {
-		/* The FIFO has 128 locations */
-		pdata->buffer_size = 0x80;
-	} else if (oh->class->rev == MCBSP_CONFIG_TYPE3) {
-		if (id == 2)
-			/* The FIFO has 1024 + 256 locations */
-			pdata->buffer_size = 0x500;
-		else
-			/* The FIFO has 128 locations */
-			pdata->buffer_size = 0x80;
-	} else if (oh->class->rev == MCBSP_CONFIG_TYPE4) {
-		/* The FIFO has 128 locations for all instances */
-		pdata->buffer_size = 0x80;
-	}
-
-	if (oh->class->rev >= MCBSP_CONFIG_TYPE3)
-		pdata->has_wakeup = true;
-
-	oh_device[0] = oh;
-
-	if (oh->dev_attr) {
-		oh_device[1] = omap_hwmod_lookup((
-		(struct omap_mcbsp_dev_attr *)(oh->dev_attr))->sidetone);
-		pdata->force_ick_on = omap3_mcbsp_force_ick_on;
-		count++;
-	}
-	pdev = omap_device_build_ss(name, id, oh_device, count, pdata,
-				    sizeof(*pdata));
-	kfree(pdata);
-	if (IS_ERR(pdev))  {
-		pr_err("%s: Can't build omap_device for %s:%s.\n", __func__,
-					name, oh->name);
-		return PTR_ERR(pdev);
-	}
-	return 0;
-}
-
-static int __init omap2_mcbsp_init(void)
-{
-	if (!of_have_populated_dt())
-		omap_hwmod_for_each_by_class("mcbsp", omap_init_mcbsp, NULL);
-
-	return 0;
-}
-omap_arch_initcall(omap2_mcbsp_init);
-- 
2.13.0

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 06/11] ARM: OMAP2+: Remove unused legacy code for io.c
  2017-05-31 22:51 ` Tony Lindgren
@ 2017-05-31 22:51   ` Tony Lindgren
  -1 siblings, 0 replies; 56+ messages in thread
From: Tony Lindgren @ 2017-05-31 22:51 UTC (permalink / raw)
  To: linux-omap; +Cc: linux-arm-kernel

We are now booting all mach-omap2 in device tree only mode.
Any code that is only called in legacy boot mode where
of_have_populated_dt() is not set is safe to remove now.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/io.c | 59 ++++++++++++------------------------------------
 1 file changed, 14 insertions(+), 45 deletions(-)

diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -493,67 +493,39 @@ void __init omap3_init_early(void)
 	omap2_set_globals_tap(OMAP343X_CLASS, OMAP2_L4_IO_ADDRESS(0x4830A000));
 	omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP343X_SDRC_BASE),
 			       OMAP2_L3_IO_ADDRESS(OMAP343X_SMS_BASE));
-	/* XXX: remove these once OMAP3 is DT only */
-	if (!of_have_populated_dt()) {
-		omap2_set_globals_control(
-			OMAP2_L4_IO_ADDRESS(OMAP343X_CTRL_BASE));
-		omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE));
-		omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE),
-				     NULL);
-	}
 	omap2_control_base_init();
 	omap3xxx_check_revision();
 	omap3xxx_check_features();
 	omap2_prcm_base_init();
-	/* XXX: remove these once OMAP3 is DT only */
-	if (!of_have_populated_dt()) {
-		omap3xxx_prm_init(NULL);
-		omap3xxx_cm_init(NULL);
-	}
 	omap3xxx_voltagedomains_init();
 	omap3xxx_powerdomains_init();
 	omap3xxx_clockdomains_init();
 	omap3xxx_hwmod_init();
 	omap_hwmod_init_postsetup();
-	if (!of_have_populated_dt()) {
-		omap3_control_legacy_iomap_init();
-		if (soc_is_am35xx())
-			omap_clk_soc_init = am35xx_clk_legacy_init;
-		else if (cpu_is_omap3630())
-			omap_clk_soc_init = omap36xx_clk_legacy_init;
-		else if (omap_rev() == OMAP3430_REV_ES1_0)
-			omap_clk_soc_init = omap3430es1_clk_legacy_init;
-		else
-			omap_clk_soc_init = omap3430_clk_legacy_init;
-	}
 }
 
 void __init omap3430_init_early(void)
 {
 	omap3_init_early();
-	if (of_have_populated_dt())
-		omap_clk_soc_init = omap3430_dt_clk_init;
+	omap_clk_soc_init = omap3430_dt_clk_init;
 }
 
 void __init omap35xx_init_early(void)
 {
 	omap3_init_early();
-	if (of_have_populated_dt())
-		omap_clk_soc_init = omap3430_dt_clk_init;
+	omap_clk_soc_init = omap3430_dt_clk_init;
 }
 
 void __init omap3630_init_early(void)
 {
 	omap3_init_early();
-	if (of_have_populated_dt())
-		omap_clk_soc_init = omap3630_dt_clk_init;
+	omap_clk_soc_init = omap3630_dt_clk_init;
 }
 
 void __init am35xx_init_early(void)
 {
 	omap3_init_early();
-	if (of_have_populated_dt())
-		omap_clk_soc_init = am35xx_dt_clk_init;
+	omap_clk_soc_init = am35xx_dt_clk_init;
 }
 
 void __init omap3_init_late(void)
@@ -628,8 +600,7 @@ void __init ti816x_init_early(void)
 	ti816x_clockdomains_init();
 	dm816x_hwmod_init();
 	omap_hwmod_init_postsetup();
-	if (of_have_populated_dt())
-		omap_clk_soc_init = dm816x_dt_clk_init;
+	omap_clk_soc_init = dm816x_dt_clk_init;
 }
 #endif
 
@@ -785,21 +756,19 @@ int __init omap_clk_init(void)
 
 	omap2_clk_setup_ll_ops();
 
-	if (of_have_populated_dt()) {
-		ret = omap_control_init();
-		if (ret)
-			return ret;
+	ret = omap_control_init();
+	if (ret)
+		return ret;
 
-		ret = omap_prcm_init();
-		if (ret)
-			return ret;
+	ret = omap_prcm_init();
+	if (ret)
+		return ret;
 
-		of_clk_init(NULL);
+	of_clk_init(NULL);
 
-		ti_dt_clk_init_retry_clks();
+	ti_dt_clk_init_retry_clks();
 
-		ti_dt_clockdomains_setup();
-	}
+	ti_dt_clockdomains_setup();
 
 	ret = omap_clk_soc_init();
 
-- 
2.13.0

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 06/11] ARM: OMAP2+: Remove unused legacy code for io.c
@ 2017-05-31 22:51   ` Tony Lindgren
  0 siblings, 0 replies; 56+ messages in thread
From: Tony Lindgren @ 2017-05-31 22:51 UTC (permalink / raw)
  To: linux-arm-kernel

We are now booting all mach-omap2 in device tree only mode.
Any code that is only called in legacy boot mode where
of_have_populated_dt() is not set is safe to remove now.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/io.c | 59 ++++++++++++------------------------------------
 1 file changed, 14 insertions(+), 45 deletions(-)

diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -493,67 +493,39 @@ void __init omap3_init_early(void)
 	omap2_set_globals_tap(OMAP343X_CLASS, OMAP2_L4_IO_ADDRESS(0x4830A000));
 	omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP343X_SDRC_BASE),
 			       OMAP2_L3_IO_ADDRESS(OMAP343X_SMS_BASE));
-	/* XXX: remove these once OMAP3 is DT only */
-	if (!of_have_populated_dt()) {
-		omap2_set_globals_control(
-			OMAP2_L4_IO_ADDRESS(OMAP343X_CTRL_BASE));
-		omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE));
-		omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE),
-				     NULL);
-	}
 	omap2_control_base_init();
 	omap3xxx_check_revision();
 	omap3xxx_check_features();
 	omap2_prcm_base_init();
-	/* XXX: remove these once OMAP3 is DT only */
-	if (!of_have_populated_dt()) {
-		omap3xxx_prm_init(NULL);
-		omap3xxx_cm_init(NULL);
-	}
 	omap3xxx_voltagedomains_init();
 	omap3xxx_powerdomains_init();
 	omap3xxx_clockdomains_init();
 	omap3xxx_hwmod_init();
 	omap_hwmod_init_postsetup();
-	if (!of_have_populated_dt()) {
-		omap3_control_legacy_iomap_init();
-		if (soc_is_am35xx())
-			omap_clk_soc_init = am35xx_clk_legacy_init;
-		else if (cpu_is_omap3630())
-			omap_clk_soc_init = omap36xx_clk_legacy_init;
-		else if (omap_rev() == OMAP3430_REV_ES1_0)
-			omap_clk_soc_init = omap3430es1_clk_legacy_init;
-		else
-			omap_clk_soc_init = omap3430_clk_legacy_init;
-	}
 }
 
 void __init omap3430_init_early(void)
 {
 	omap3_init_early();
-	if (of_have_populated_dt())
-		omap_clk_soc_init = omap3430_dt_clk_init;
+	omap_clk_soc_init = omap3430_dt_clk_init;
 }
 
 void __init omap35xx_init_early(void)
 {
 	omap3_init_early();
-	if (of_have_populated_dt())
-		omap_clk_soc_init = omap3430_dt_clk_init;
+	omap_clk_soc_init = omap3430_dt_clk_init;
 }
 
 void __init omap3630_init_early(void)
 {
 	omap3_init_early();
-	if (of_have_populated_dt())
-		omap_clk_soc_init = omap3630_dt_clk_init;
+	omap_clk_soc_init = omap3630_dt_clk_init;
 }
 
 void __init am35xx_init_early(void)
 {
 	omap3_init_early();
-	if (of_have_populated_dt())
-		omap_clk_soc_init = am35xx_dt_clk_init;
+	omap_clk_soc_init = am35xx_dt_clk_init;
 }
 
 void __init omap3_init_late(void)
@@ -628,8 +600,7 @@ void __init ti816x_init_early(void)
 	ti816x_clockdomains_init();
 	dm816x_hwmod_init();
 	omap_hwmod_init_postsetup();
-	if (of_have_populated_dt())
-		omap_clk_soc_init = dm816x_dt_clk_init;
+	omap_clk_soc_init = dm816x_dt_clk_init;
 }
 #endif
 
@@ -785,21 +756,19 @@ int __init omap_clk_init(void)
 
 	omap2_clk_setup_ll_ops();
 
-	if (of_have_populated_dt()) {
-		ret = omap_control_init();
-		if (ret)
-			return ret;
+	ret = omap_control_init();
+	if (ret)
+		return ret;
 
-		ret = omap_prcm_init();
-		if (ret)
-			return ret;
+	ret = omap_prcm_init();
+	if (ret)
+		return ret;
 
-		of_clk_init(NULL);
+	of_clk_init(NULL);
 
-		ti_dt_clk_init_retry_clks();
+	ti_dt_clk_init_retry_clks();
 
-		ti_dt_clockdomains_setup();
-	}
+	ti_dt_clockdomains_setup();
 
 	ret = omap_clk_soc_init();
 
-- 
2.13.0

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 07/11] ARM: OMAP2+: Remove unused legacy code for DMA
  2017-05-31 22:51 ` Tony Lindgren
@ 2017-05-31 22:51   ` Tony Lindgren
  -1 siblings, 0 replies; 56+ messages in thread
From: Tony Lindgren @ 2017-05-31 22:51 UTC (permalink / raw)
  To: linux-omap; +Cc: linux-arm-kernel

We are now booting all mach-omap2 in device tree only mode.
Any code that is only called in legacy boot mode where
of_have_populated_dt() is not set is safe to remove now.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/dma.c | 30 +-----------------------------
 1 file changed, 1 insertion(+), 29 deletions(-)

diff --git a/arch/arm/mach-omap2/dma.c b/arch/arm/mach-omap2/dma.c
--- a/arch/arm/mach-omap2/dma.c
+++ b/arch/arm/mach-omap2/dma.c
@@ -334,20 +334,6 @@ static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused)
 	p.dma_attr = (struct omap_dma_dev_attr *)oh->dev_attr;
 	p.errata = configure_dma_errata();
 
-	if (!of_have_populated_dt()) {
-		if (soc_is_omap24xx()) {
-			p.slave_map = omap24xx_sdma_map;
-			p.slavecnt = ARRAY_SIZE(omap24xx_sdma_map);
-		} else if (soc_is_omap34xx() || soc_is_omap3630()) {
-			p.slave_map = omap3xxx_sdma_map;
-			p.slavecnt = ARRAY_SIZE(omap3xxx_sdma_map);
-		} else {
-			pr_err("%s: The legacy DMA map is not provided!\n",
-			       __func__);
-			return -ENODEV;
-		}
-	}
-
 	pdev = omap_device_build(name, 0, oh, &p, sizeof(p));
 	if (IS_ERR(pdev)) {
 		pr_err("%s: Can't build omap_device for %s:%s.\n",
@@ -389,21 +375,7 @@ static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused)
 
 static int __init omap2_system_dma_init(void)
 {
-	struct platform_device *pdev;
-	int res;
-
-	res = omap_hwmod_for_each_by_class("dma",
+	return omap_hwmod_for_each_by_class("dma",
 			omap2_system_dma_init_dev, NULL);
-	if (res)
-		return res;
-
-	if (of_have_populated_dt())
-		return res;
-
-	pdev = platform_device_register_full(&omap_dma_dev_info);
-	if (IS_ERR(pdev))
-		return PTR_ERR(pdev);
-
-	return res;
 }
 omap_arch_initcall(omap2_system_dma_init);
-- 
2.13.0

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 07/11] ARM: OMAP2+: Remove unused legacy code for DMA
@ 2017-05-31 22:51   ` Tony Lindgren
  0 siblings, 0 replies; 56+ messages in thread
From: Tony Lindgren @ 2017-05-31 22:51 UTC (permalink / raw)
  To: linux-arm-kernel

We are now booting all mach-omap2 in device tree only mode.
Any code that is only called in legacy boot mode where
of_have_populated_dt() is not set is safe to remove now.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/dma.c | 30 +-----------------------------
 1 file changed, 1 insertion(+), 29 deletions(-)

diff --git a/arch/arm/mach-omap2/dma.c b/arch/arm/mach-omap2/dma.c
--- a/arch/arm/mach-omap2/dma.c
+++ b/arch/arm/mach-omap2/dma.c
@@ -334,20 +334,6 @@ static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused)
 	p.dma_attr = (struct omap_dma_dev_attr *)oh->dev_attr;
 	p.errata = configure_dma_errata();
 
-	if (!of_have_populated_dt()) {
-		if (soc_is_omap24xx()) {
-			p.slave_map = omap24xx_sdma_map;
-			p.slavecnt = ARRAY_SIZE(omap24xx_sdma_map);
-		} else if (soc_is_omap34xx() || soc_is_omap3630()) {
-			p.slave_map = omap3xxx_sdma_map;
-			p.slavecnt = ARRAY_SIZE(omap3xxx_sdma_map);
-		} else {
-			pr_err("%s: The legacy DMA map is not provided!\n",
-			       __func__);
-			return -ENODEV;
-		}
-	}
-
 	pdev = omap_device_build(name, 0, oh, &p, sizeof(p));
 	if (IS_ERR(pdev)) {
 		pr_err("%s: Can't build omap_device for %s:%s.\n",
@@ -389,21 +375,7 @@ static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused)
 
 static int __init omap2_system_dma_init(void)
 {
-	struct platform_device *pdev;
-	int res;
-
-	res = omap_hwmod_for_each_by_class("dma",
+	return omap_hwmod_for_each_by_class("dma",
 			omap2_system_dma_init_dev, NULL);
-	if (res)
-		return res;
-
-	if (of_have_populated_dt())
-		return res;
-
-	pdev = platform_device_register_full(&omap_dma_dev_info);
-	if (IS_ERR(pdev))
-		return PTR_ERR(pdev);
-
-	return res;
 }
 omap_arch_initcall(omap2_system_dma_init);
-- 
2.13.0

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 08/11] ARM: OMAP2+: Remove unused legacy code for PRM
  2017-05-31 22:51 ` Tony Lindgren
@ 2017-05-31 22:51   ` Tony Lindgren
  -1 siblings, 0 replies; 56+ messages in thread
From: Tony Lindgren @ 2017-05-31 22:51 UTC (permalink / raw)
  To: linux-omap; +Cc: linux-arm-kernel

We are now booting all mach-omap2 in device tree only mode.
Any code that is only called in legacy boot mode where
of_have_populated_dt() is not set is safe to remove now.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/prm3xxx.c    | 17 +++++-------
 arch/arm/mach-omap2/prm44xx.c    | 59 ----------------------------------------
 arch/arm/mach-omap2/prm_common.c |  9 ++----
 3 files changed, 10 insertions(+), 75 deletions(-)

diff --git a/arch/arm/mach-omap2/prm3xxx.c b/arch/arm/mach-omap2/prm3xxx.c
--- a/arch/arm/mach-omap2/prm3xxx.c
+++ b/arch/arm/mach-omap2/prm3xxx.c
@@ -690,6 +690,8 @@ static const struct of_device_id omap3_prm_dt_match_table[] = {
 
 static int omap3xxx_prm_late_init(void)
 {
+	struct device_node *np;
+	int irq_num;
 	int ret;
 
 	if (!(prm_features & PRM_HAS_IO_WAKEUP))
@@ -702,16 +704,11 @@ static int omap3xxx_prm_late_init(void)
 		omap3_prcm_irq_setup.reconfigure_io_chain =
 			omap3430_pre_es3_1_reconfigure_io_chain;
 
-	if (of_have_populated_dt()) {
-		struct device_node *np;
-		int irq_num;
-
-		np = of_find_matching_node(NULL, omap3_prm_dt_match_table);
-		if (np) {
-			irq_num = of_irq_get(np, 0);
-			if (irq_num >= 0)
-				omap3_prcm_irq_setup.irq = irq_num;
-		}
+	np = of_find_matching_node(NULL, omap3_prm_dt_match_table);
+	if (np) {
+		irq_num = of_irq_get(np, 0);
+		if (irq_num >= 0)
+			omap3_prcm_irq_setup.irq = irq_num;
 	}
 
 	omap3xxx_prm_enable_io_wakeup();
diff --git a/arch/arm/mach-omap2/prm44xx.c b/arch/arm/mach-omap2/prm44xx.c
--- a/arch/arm/mach-omap2/prm44xx.c
+++ b/arch/arm/mach-omap2/prm44xx.c
@@ -337,27 +337,6 @@ static void omap44xx_prm_reconfigure_io_chain(void)
 }
 
 /**
- * omap44xx_prm_enable_io_wakeup - enable wakeup events from I/O wakeup latches
- *
- * Activates the I/O wakeup event latches and allows events logged by
- * those latches to signal a wakeup event to the PRCM.  For I/O wakeups
- * to occur, WAKEUPENABLE bits must be set in the pad mux registers, and
- * omap44xx_prm_reconfigure_io_chain() must be called.  No return value.
- */
-static void __init omap44xx_prm_enable_io_wakeup(void)
-{
-	s32 inst = omap4_prmst_get_prm_dev_inst();
-
-	if (inst == PRM_INSTANCE_UNKNOWN)
-		return;
-
-	omap4_prm_rmw_inst_reg_bits(OMAP4430_GLOBAL_WUEN_MASK,
-				    OMAP4430_GLOBAL_WUEN_MASK,
-				    inst,
-				    omap4_prcm_irq_setup.pm_ctrl);
-}
-
-/**
  * omap44xx_prm_read_reset_sources - return the last SoC reset source
  *
  * Return a u32 representing the last reset sources of the SoC.  The
@@ -689,8 +668,6 @@ struct pwrdm_ops omap4_pwrdm_operations = {
 	.pwrdm_has_voltdm	= omap4_check_vcvp,
 };
 
-static int omap44xx_prm_late_init(void);
-
 /*
  * XXX document
  */
@@ -698,7 +675,6 @@ static struct prm_ll_data omap44xx_prm_ll_data = {
 	.read_reset_sources = &omap44xx_prm_read_reset_sources,
 	.was_any_context_lost_old = &omap44xx_prm_was_any_context_lost_old,
 	.clear_context_loss_flags_old = &omap44xx_prm_clear_context_loss_flags_old,
-	.late_init = &omap44xx_prm_late_init,
 	.assert_hardreset	= omap4_prminst_assert_hardreset,
 	.deassert_hardreset	= omap4_prminst_deassert_hardreset,
 	.is_hardreset_asserted	= omap4_prminst_is_hardreset_asserted,
@@ -735,41 +711,6 @@ int __init omap44xx_prm_init(const struct omap_prcm_init_data *data)
 	return prm_register(&omap44xx_prm_ll_data);
 }
 
-static int omap44xx_prm_late_init(void)
-{
-	int irq_num;
-
-	if (!(prm_features & PRM_HAS_IO_WAKEUP))
-		return 0;
-
-	/* OMAP4+ is DT only now */
-	if (!of_have_populated_dt())
-		return 0;
-
-	irq_num = of_irq_get(prm_init_data->np, 0);
-	/*
-	 * Already have OMAP4 IRQ num. For all other platforms, we need
-	 * IRQ numbers from DT
-	 */
-	if (irq_num < 0 && !(prm_init_data->flags & PRM_IRQ_DEFAULT)) {
-		if (irq_num == -EPROBE_DEFER)
-			return irq_num;
-
-		/* Have nothing to do */
-		return 0;
-	}
-
-	/* Once OMAP4 DT is filled as well */
-	if (irq_num >= 0) {
-		omap4_prcm_irq_setup.irq = irq_num;
-		omap4_prcm_irq_setup.xlate_irq = NULL;
-	}
-
-	omap44xx_prm_enable_io_wakeup();
-
-	return omap_prcm_register_chain_handler(&omap4_prcm_irq_setup);
-}
-
 static void __exit omap44xx_prm_exit(void)
 {
 	prm_unregister(&omap44xx_prm_ll_data);
diff --git a/arch/arm/mach-omap2/prm_common.c b/arch/arm/mach-omap2/prm_common.c
--- a/arch/arm/mach-omap2/prm_common.c
+++ b/arch/arm/mach-omap2/prm_common.c
@@ -267,10 +267,9 @@ int omap_prcm_register_chain_handler(struct omap_prcm_irq_setup *irq_setup)
 {
 	int nr_regs;
 	u32 mask[OMAP_PRCM_MAX_NR_PENDING_REG];
-	int offset, i;
+	int offset, i, irq;
 	struct irq_chip_generic *gc;
 	struct irq_chip_type *ct;
-	unsigned int irq;
 
 	if (!irq_setup)
 		return -EINVAL;
@@ -344,10 +343,8 @@ int omap_prcm_register_chain_handler(struct omap_prcm_irq_setup *irq_setup)
 		prcm_irq_chips[i] = gc;
 	}
 
-	if (of_have_populated_dt()) {
-		int irq = omap_prcm_event_to_irq("io");
-		omap_pcs_legacy_init(irq, irq_setup->reconfigure_io_chain);
-	}
+	irq = omap_prcm_event_to_irq("io");
+	omap_pcs_legacy_init(irq, irq_setup->reconfigure_io_chain);
 
 	return 0;
 
-- 
2.13.0

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 08/11] ARM: OMAP2+: Remove unused legacy code for PRM
@ 2017-05-31 22:51   ` Tony Lindgren
  0 siblings, 0 replies; 56+ messages in thread
From: Tony Lindgren @ 2017-05-31 22:51 UTC (permalink / raw)
  To: linux-arm-kernel

We are now booting all mach-omap2 in device tree only mode.
Any code that is only called in legacy boot mode where
of_have_populated_dt() is not set is safe to remove now.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/prm3xxx.c    | 17 +++++-------
 arch/arm/mach-omap2/prm44xx.c    | 59 ----------------------------------------
 arch/arm/mach-omap2/prm_common.c |  9 ++----
 3 files changed, 10 insertions(+), 75 deletions(-)

diff --git a/arch/arm/mach-omap2/prm3xxx.c b/arch/arm/mach-omap2/prm3xxx.c
--- a/arch/arm/mach-omap2/prm3xxx.c
+++ b/arch/arm/mach-omap2/prm3xxx.c
@@ -690,6 +690,8 @@ static const struct of_device_id omap3_prm_dt_match_table[] = {
 
 static int omap3xxx_prm_late_init(void)
 {
+	struct device_node *np;
+	int irq_num;
 	int ret;
 
 	if (!(prm_features & PRM_HAS_IO_WAKEUP))
@@ -702,16 +704,11 @@ static int omap3xxx_prm_late_init(void)
 		omap3_prcm_irq_setup.reconfigure_io_chain =
 			omap3430_pre_es3_1_reconfigure_io_chain;
 
-	if (of_have_populated_dt()) {
-		struct device_node *np;
-		int irq_num;
-
-		np = of_find_matching_node(NULL, omap3_prm_dt_match_table);
-		if (np) {
-			irq_num = of_irq_get(np, 0);
-			if (irq_num >= 0)
-				omap3_prcm_irq_setup.irq = irq_num;
-		}
+	np = of_find_matching_node(NULL, omap3_prm_dt_match_table);
+	if (np) {
+		irq_num = of_irq_get(np, 0);
+		if (irq_num >= 0)
+			omap3_prcm_irq_setup.irq = irq_num;
 	}
 
 	omap3xxx_prm_enable_io_wakeup();
diff --git a/arch/arm/mach-omap2/prm44xx.c b/arch/arm/mach-omap2/prm44xx.c
--- a/arch/arm/mach-omap2/prm44xx.c
+++ b/arch/arm/mach-omap2/prm44xx.c
@@ -337,27 +337,6 @@ static void omap44xx_prm_reconfigure_io_chain(void)
 }
 
 /**
- * omap44xx_prm_enable_io_wakeup - enable wakeup events from I/O wakeup latches
- *
- * Activates the I/O wakeup event latches and allows events logged by
- * those latches to signal a wakeup event to the PRCM.  For I/O wakeups
- * to occur, WAKEUPENABLE bits must be set in the pad mux registers, and
- * omap44xx_prm_reconfigure_io_chain() must be called.  No return value.
- */
-static void __init omap44xx_prm_enable_io_wakeup(void)
-{
-	s32 inst = omap4_prmst_get_prm_dev_inst();
-
-	if (inst == PRM_INSTANCE_UNKNOWN)
-		return;
-
-	omap4_prm_rmw_inst_reg_bits(OMAP4430_GLOBAL_WUEN_MASK,
-				    OMAP4430_GLOBAL_WUEN_MASK,
-				    inst,
-				    omap4_prcm_irq_setup.pm_ctrl);
-}
-
-/**
  * omap44xx_prm_read_reset_sources - return the last SoC reset source
  *
  * Return a u32 representing the last reset sources of the SoC.  The
@@ -689,8 +668,6 @@ struct pwrdm_ops omap4_pwrdm_operations = {
 	.pwrdm_has_voltdm	= omap4_check_vcvp,
 };
 
-static int omap44xx_prm_late_init(void);
-
 /*
  * XXX document
  */
@@ -698,7 +675,6 @@ static struct prm_ll_data omap44xx_prm_ll_data = {
 	.read_reset_sources = &omap44xx_prm_read_reset_sources,
 	.was_any_context_lost_old = &omap44xx_prm_was_any_context_lost_old,
 	.clear_context_loss_flags_old = &omap44xx_prm_clear_context_loss_flags_old,
-	.late_init = &omap44xx_prm_late_init,
 	.assert_hardreset	= omap4_prminst_assert_hardreset,
 	.deassert_hardreset	= omap4_prminst_deassert_hardreset,
 	.is_hardreset_asserted	= omap4_prminst_is_hardreset_asserted,
@@ -735,41 +711,6 @@ int __init omap44xx_prm_init(const struct omap_prcm_init_data *data)
 	return prm_register(&omap44xx_prm_ll_data);
 }
 
-static int omap44xx_prm_late_init(void)
-{
-	int irq_num;
-
-	if (!(prm_features & PRM_HAS_IO_WAKEUP))
-		return 0;
-
-	/* OMAP4+ is DT only now */
-	if (!of_have_populated_dt())
-		return 0;
-
-	irq_num = of_irq_get(prm_init_data->np, 0);
-	/*
-	 * Already have OMAP4 IRQ num. For all other platforms, we need
-	 * IRQ numbers from DT
-	 */
-	if (irq_num < 0 && !(prm_init_data->flags & PRM_IRQ_DEFAULT)) {
-		if (irq_num == -EPROBE_DEFER)
-			return irq_num;
-
-		/* Have nothing to do */
-		return 0;
-	}
-
-	/* Once OMAP4 DT is filled as well */
-	if (irq_num >= 0) {
-		omap4_prcm_irq_setup.irq = irq_num;
-		omap4_prcm_irq_setup.xlate_irq = NULL;
-	}
-
-	omap44xx_prm_enable_io_wakeup();
-
-	return omap_prcm_register_chain_handler(&omap4_prcm_irq_setup);
-}
-
 static void __exit omap44xx_prm_exit(void)
 {
 	prm_unregister(&omap44xx_prm_ll_data);
diff --git a/arch/arm/mach-omap2/prm_common.c b/arch/arm/mach-omap2/prm_common.c
--- a/arch/arm/mach-omap2/prm_common.c
+++ b/arch/arm/mach-omap2/prm_common.c
@@ -267,10 +267,9 @@ int omap_prcm_register_chain_handler(struct omap_prcm_irq_setup *irq_setup)
 {
 	int nr_regs;
 	u32 mask[OMAP_PRCM_MAX_NR_PENDING_REG];
-	int offset, i;
+	int offset, i, irq;
 	struct irq_chip_generic *gc;
 	struct irq_chip_type *ct;
-	unsigned int irq;
 
 	if (!irq_setup)
 		return -EINVAL;
@@ -344,10 +343,8 @@ int omap_prcm_register_chain_handler(struct omap_prcm_irq_setup *irq_setup)
 		prcm_irq_chips[i] = gc;
 	}
 
-	if (of_have_populated_dt()) {
-		int irq = omap_prcm_event_to_irq("io");
-		omap_pcs_legacy_init(irq, irq_setup->reconfigure_io_chain);
-	}
+	irq = omap_prcm_event_to_irq("io");
+	omap_pcs_legacy_init(irq, irq_setup->reconfigure_io_chain);
 
 	return 0;
 
-- 
2.13.0

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 09/11] ARM: OMAP2+: Remove unused legacy code for interconnects
  2017-05-31 22:51 ` Tony Lindgren
@ 2017-05-31 22:51   ` Tony Lindgren
  -1 siblings, 0 replies; 56+ messages in thread
From: Tony Lindgren @ 2017-05-31 22:51 UTC (permalink / raw)
  To: linux-omap; +Cc: linux-arm-kernel

We are now booting all mach-omap2 in device tree only mode.
Any code that is only called in legacy boot mode where
of_have_populated_dt() is not set is safe to remove now.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/omap_device.c          |  5 +----
 arch/arm/mach-omap2/omap_hwmod.c           | 23 ++++++++++-------------
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |  3 +--
 3 files changed, 12 insertions(+), 19 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_device.c b/arch/arm/mach-omap2/omap_device.c
--- a/arch/arm/mach-omap2/omap_device.c
+++ b/arch/arm/mach-omap2/omap_device.c
@@ -65,7 +65,7 @@ static void _add_clkdev(struct omap_device *od, const char *clk_alias,
 
 	r = clk_get_sys(NULL, clk_name);
 
-	if (IS_ERR(r) && of_have_populated_dt()) {
+	if (IS_ERR(r)) {
 		struct of_phandle_args clkspec;
 
 		clkspec.np = of_find_node_by_name(NULL, clk_name);
@@ -953,9 +953,6 @@ static int __init omap_device_late_init(void)
 {
 	bus_for_each_dev(&platform_bus_type, NULL, NULL, omap_device_late_idle);
 
-	WARN(!of_have_populated_dt(),
-		"legacy booting deprecated, please update to boot with .dts\n");
-
 	return 0;
 }
 omap_late_initcall_sync(omap_device_late_init);
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -2336,24 +2336,21 @@ static int __init _init(struct omap_hwmod *oh, void *data)
 {
 	int r, index;
 	struct device_node *np = NULL;
+	struct device_node *bus;
 
 	if (oh->_state != _HWMOD_STATE_REGISTERED)
 		return 0;
 
-	if (of_have_populated_dt()) {
-		struct device_node *bus;
-
-		bus = of_find_node_by_name(NULL, "ocp");
-		if (!bus)
-			return -ENODEV;
+	bus = of_find_node_by_name(NULL, "ocp");
+	if (!bus)
+		return -ENODEV;
 
-		r = of_dev_hwmod_lookup(bus, oh, &index, &np);
-		if (r)
-			pr_debug("omap_hwmod: %s missing dt data\n", oh->name);
-		else if (np && index)
-			pr_warn("omap_hwmod: %s using broken dt data from %s\n",
-				oh->name, np->name);
-	}
+	r = of_dev_hwmod_lookup(bus, oh, &index, &np);
+	if (r)
+		pr_debug("omap_hwmod: %s missing dt data\n", oh->name);
+	else if (np && index)
+		pr_warn("omap_hwmod: %s using broken dt data from %s\n",
+			oh->name, np->name);
 
 	r = _init_mpu_rt_base(oh, NULL, index, np);
 	if (r < 0) {
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -3204,8 +3204,7 @@ int __init omap3xxx_hwmod_init(void)
 	 * If DT information is missing, enable them only for GP devices.
 	 */
 
-	if (of_have_populated_dt())
-		bus = of_find_node_by_name(NULL, "ocp");
+	bus = of_find_node_by_name(NULL, "ocp");
 
 	if (h_sham && omap3xxx_hwmod_is_hs_ip_block_usable(bus, "sham")) {
 		r = omap_hwmod_register_links(h_sham);
-- 
2.13.0

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 09/11] ARM: OMAP2+: Remove unused legacy code for interconnects
@ 2017-05-31 22:51   ` Tony Lindgren
  0 siblings, 0 replies; 56+ messages in thread
From: Tony Lindgren @ 2017-05-31 22:51 UTC (permalink / raw)
  To: linux-arm-kernel

We are now booting all mach-omap2 in device tree only mode.
Any code that is only called in legacy boot mode where
of_have_populated_dt() is not set is safe to remove now.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/omap_device.c          |  5 +----
 arch/arm/mach-omap2/omap_hwmod.c           | 23 ++++++++++-------------
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |  3 +--
 3 files changed, 12 insertions(+), 19 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_device.c b/arch/arm/mach-omap2/omap_device.c
--- a/arch/arm/mach-omap2/omap_device.c
+++ b/arch/arm/mach-omap2/omap_device.c
@@ -65,7 +65,7 @@ static void _add_clkdev(struct omap_device *od, const char *clk_alias,
 
 	r = clk_get_sys(NULL, clk_name);
 
-	if (IS_ERR(r) && of_have_populated_dt()) {
+	if (IS_ERR(r)) {
 		struct of_phandle_args clkspec;
 
 		clkspec.np = of_find_node_by_name(NULL, clk_name);
@@ -953,9 +953,6 @@ static int __init omap_device_late_init(void)
 {
 	bus_for_each_dev(&platform_bus_type, NULL, NULL, omap_device_late_idle);
 
-	WARN(!of_have_populated_dt(),
-		"legacy booting deprecated, please update to boot with .dts\n");
-
 	return 0;
 }
 omap_late_initcall_sync(omap_device_late_init);
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -2336,24 +2336,21 @@ static int __init _init(struct omap_hwmod *oh, void *data)
 {
 	int r, index;
 	struct device_node *np = NULL;
+	struct device_node *bus;
 
 	if (oh->_state != _HWMOD_STATE_REGISTERED)
 		return 0;
 
-	if (of_have_populated_dt()) {
-		struct device_node *bus;
-
-		bus = of_find_node_by_name(NULL, "ocp");
-		if (!bus)
-			return -ENODEV;
+	bus = of_find_node_by_name(NULL, "ocp");
+	if (!bus)
+		return -ENODEV;
 
-		r = of_dev_hwmod_lookup(bus, oh, &index, &np);
-		if (r)
-			pr_debug("omap_hwmod: %s missing dt data\n", oh->name);
-		else if (np && index)
-			pr_warn("omap_hwmod: %s using broken dt data from %s\n",
-				oh->name, np->name);
-	}
+	r = of_dev_hwmod_lookup(bus, oh, &index, &np);
+	if (r)
+		pr_debug("omap_hwmod: %s missing dt data\n", oh->name);
+	else if (np && index)
+		pr_warn("omap_hwmod: %s using broken dt data from %s\n",
+			oh->name, np->name);
 
 	r = _init_mpu_rt_base(oh, NULL, index, np);
 	if (r < 0) {
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -3204,8 +3204,7 @@ int __init omap3xxx_hwmod_init(void)
 	 * If DT information is missing, enable them only for GP devices.
 	 */
 
-	if (of_have_populated_dt())
-		bus = of_find_node_by_name(NULL, "ocp");
+	bus = of_find_node_by_name(NULL, "ocp");
 
 	if (h_sham && omap3xxx_hwmod_is_hs_ip_block_usable(bus, "sham")) {
 		r = omap_hwmod_register_links(h_sham);
-- 
2.13.0

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 10/11] ARM: OMAP2+: Remove unused legacy code for watchdog
  2017-05-31 22:51 ` Tony Lindgren
@ 2017-05-31 22:51   ` Tony Lindgren
  -1 siblings, 0 replies; 56+ messages in thread
From: Tony Lindgren @ 2017-05-31 22:51 UTC (permalink / raw)
  To: linux-omap; +Cc: linux-arm-kernel

We are now booting all mach-omap2 in device tree only mode.
Any code that is only called in legacy boot mode where
of_have_populated_dt() is not set is safe to remove now.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/wd_timer.c | 28 ----------------------------
 1 file changed, 28 deletions(-)

diff --git a/arch/arm/mach-omap2/wd_timer.c b/arch/arm/mach-omap2/wd_timer.c
--- a/arch/arm/mach-omap2/wd_timer.c
+++ b/arch/arm/mach-omap2/wd_timer.c
@@ -102,31 +102,3 @@ int omap2_wd_timer_reset(struct omap_hwmod *oh)
 	return (c == MAX_MODULE_SOFTRESET_WAIT) ? -ETIMEDOUT :
 		omap2_wd_timer_disable(oh);
 }
-
-static int __init omap_init_wdt(void)
-{
-	int id = -1;
-	struct platform_device *pdev;
-	struct omap_hwmod *oh;
-	char *oh_name = "wd_timer2";
-	char *dev_name = "omap_wdt";
-	struct omap_wd_timer_platform_data pdata;
-
-	if (!cpu_class_is_omap2() || of_have_populated_dt())
-		return 0;
-
-	oh = omap_hwmod_lookup(oh_name);
-	if (!oh) {
-		pr_err("Could not look up wd_timer%d hwmod\n", id);
-		return -EINVAL;
-	}
-
-	pdata.read_reset_sources = prm_read_reset_sources;
-
-	pdev = omap_device_build(dev_name, id, oh, &pdata,
-				 sizeof(struct omap_wd_timer_platform_data));
-	WARN(IS_ERR(pdev), "Can't build omap_device for %s:%s.\n",
-	     dev_name, oh->name);
-	return 0;
-}
-omap_subsys_initcall(omap_init_wdt);
-- 
2.13.0

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 10/11] ARM: OMAP2+: Remove unused legacy code for watchdog
@ 2017-05-31 22:51   ` Tony Lindgren
  0 siblings, 0 replies; 56+ messages in thread
From: Tony Lindgren @ 2017-05-31 22:51 UTC (permalink / raw)
  To: linux-arm-kernel

We are now booting all mach-omap2 in device tree only mode.
Any code that is only called in legacy boot mode where
of_have_populated_dt() is not set is safe to remove now.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/wd_timer.c | 28 ----------------------------
 1 file changed, 28 deletions(-)

diff --git a/arch/arm/mach-omap2/wd_timer.c b/arch/arm/mach-omap2/wd_timer.c
--- a/arch/arm/mach-omap2/wd_timer.c
+++ b/arch/arm/mach-omap2/wd_timer.c
@@ -102,31 +102,3 @@ int omap2_wd_timer_reset(struct omap_hwmod *oh)
 	return (c == MAX_MODULE_SOFTRESET_WAIT) ? -ETIMEDOUT :
 		omap2_wd_timer_disable(oh);
 }
-
-static int __init omap_init_wdt(void)
-{
-	int id = -1;
-	struct platform_device *pdev;
-	struct omap_hwmod *oh;
-	char *oh_name = "wd_timer2";
-	char *dev_name = "omap_wdt";
-	struct omap_wd_timer_platform_data pdata;
-
-	if (!cpu_class_is_omap2() || of_have_populated_dt())
-		return 0;
-
-	oh = omap_hwmod_lookup(oh_name);
-	if (!oh) {
-		pr_err("Could not look up wd_timer%d hwmod\n", id);
-		return -EINVAL;
-	}
-
-	pdata.read_reset_sources = prm_read_reset_sources;
-
-	pdev = omap_device_build(dev_name, id, oh, &pdata,
-				 sizeof(struct omap_wd_timer_platform_data));
-	WARN(IS_ERR(pdev), "Can't build omap_device for %s:%s.\n",
-	     dev_name, oh->name);
-	return 0;
-}
-omap_subsys_initcall(omap_init_wdt);
-- 
2.13.0

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 11/11] ARM: OMAP2+: Remove unused legacy code for n8x0
  2017-05-31 22:51 ` Tony Lindgren
@ 2017-05-31 22:51   ` Tony Lindgren
  -1 siblings, 0 replies; 56+ messages in thread
From: Tony Lindgren @ 2017-05-31 22:51 UTC (permalink / raw)
  To: linux-omap; +Cc: linux-arm-kernel

We are now booting all mach-omap2 in device tree only mode.
Any code that is only called in legacy boot mode where
of_have_populated_dt() is not set is safe to remove now.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/board-n8x0.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c
--- a/arch/arm/mach-omap2/board-n8x0.c
+++ b/arch/arm/mach-omap2/board-n8x0.c
@@ -47,14 +47,12 @@ static u32 board_caps;
 
 static void board_check_revision(void)
 {
-	if (of_have_populated_dt()) {
-		if (of_machine_is_compatible("nokia,n800"))
-			board_caps = NOKIA_N800;
-		else if (of_machine_is_compatible("nokia,n810"))
-			board_caps = NOKIA_N810;
-		else if (of_machine_is_compatible("nokia,n810-wimax"))
-			board_caps = NOKIA_N810_WIMAX;
-	}
+	if (of_machine_is_compatible("nokia,n800"))
+		board_caps = NOKIA_N800;
+	else if (of_machine_is_compatible("nokia,n810"))
+		board_caps = NOKIA_N810;
+	else if (of_machine_is_compatible("nokia,n810-wimax"))
+		board_caps = NOKIA_N810_WIMAX;
 
 	if (!board_caps)
 		pr_err("Unknown board\n");
-- 
2.13.0

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 11/11] ARM: OMAP2+: Remove unused legacy code for n8x0
@ 2017-05-31 22:51   ` Tony Lindgren
  0 siblings, 0 replies; 56+ messages in thread
From: Tony Lindgren @ 2017-05-31 22:51 UTC (permalink / raw)
  To: linux-arm-kernel

We are now booting all mach-omap2 in device tree only mode.
Any code that is only called in legacy boot mode where
of_have_populated_dt() is not set is safe to remove now.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/board-n8x0.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c
--- a/arch/arm/mach-omap2/board-n8x0.c
+++ b/arch/arm/mach-omap2/board-n8x0.c
@@ -47,14 +47,12 @@ static u32 board_caps;
 
 static void board_check_revision(void)
 {
-	if (of_have_populated_dt()) {
-		if (of_machine_is_compatible("nokia,n800"))
-			board_caps = NOKIA_N800;
-		else if (of_machine_is_compatible("nokia,n810"))
-			board_caps = NOKIA_N810;
-		else if (of_machine_is_compatible("nokia,n810-wimax"))
-			board_caps = NOKIA_N810_WIMAX;
-	}
+	if (of_machine_is_compatible("nokia,n800"))
+		board_caps = NOKIA_N800;
+	else if (of_machine_is_compatible("nokia,n810"))
+		board_caps = NOKIA_N810;
+	else if (of_machine_is_compatible("nokia,n810-wimax"))
+		board_caps = NOKIA_N810_WIMAX;
 
 	if (!board_caps)
 		pr_err("Unknown board\n");
-- 
2.13.0

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 04/11] ARM: OMAP2+: Remove unused legacy code for device init
  2017-05-31 22:51   ` Tony Lindgren
@ 2017-06-07 22:27     ` Sebastian Reichel
  -1 siblings, 0 replies; 56+ messages in thread
From: Sebastian Reichel @ 2017-06-07 22:27 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: linux-omap, linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 955 bytes --]

Hi,

On Wed, May 31, 2017 at 03:51:32PM -0700, Tony Lindgren wrote:
> [...]
> -
>  static inline void omap_init_sti(void) {}
>  
> [...]
> @@ -190,49 +68,8 @@ int __init omap_init_vout(void) { return 0; }
>  
>  static int __init omap2_init_devices(void)
>  {
> -	/* Enable dummy states for those platforms without pinctrl support */
> -	if (!of_have_populated_dt())
> -		pinctrl_provide_dummies();
> -
> -	/* If dtb is there, the devices will be created dynamically */
> -	if (!of_have_populated_dt()) {
> -		/*
> -		 * please keep these calls, and their implementations above,
> -		 * in alphabetical order so they're easier to sort through.
> -		 */
> -		omap_init_mcspi();
> -		omap_init_sham();
> -		omap_init_aes();
> -		omap_init_rng();
> -	}
>  	omap_init_sti();
>  
>  	return 0;
>  }
>  omap_arch_initcall(omap2_init_devices);
> -
> [...]

I guess you can drop omap2_init_devices() completly?

-- Sebastian

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 04/11] ARM: OMAP2+: Remove unused legacy code for device init
@ 2017-06-07 22:27     ` Sebastian Reichel
  0 siblings, 0 replies; 56+ messages in thread
From: Sebastian Reichel @ 2017-06-07 22:27 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Wed, May 31, 2017 at 03:51:32PM -0700, Tony Lindgren wrote:
> [...]
> -
>  static inline void omap_init_sti(void) {}
>  
> [...]
> @@ -190,49 +68,8 @@ int __init omap_init_vout(void) { return 0; }
>  
>  static int __init omap2_init_devices(void)
>  {
> -	/* Enable dummy states for those platforms without pinctrl support */
> -	if (!of_have_populated_dt())
> -		pinctrl_provide_dummies();
> -
> -	/* If dtb is there, the devices will be created dynamically */
> -	if (!of_have_populated_dt()) {
> -		/*
> -		 * please keep these calls, and their implementations above,
> -		 * in alphabetical order so they're easier to sort through.
> -		 */
> -		omap_init_mcspi();
> -		omap_init_sham();
> -		omap_init_aes();
> -		omap_init_rng();
> -	}
>  	omap_init_sti();
>  
>  	return 0;
>  }
>  omap_arch_initcall(omap2_init_devices);
> -
> [...]

I guess you can drop omap2_init_devices() completly?

-- Sebastian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170608/1e42be47/attachment-0001.sig>

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 05/11] ARM: OMAP2+: Remove unused legacy code for McBSP
  2017-05-31 22:51   ` Tony Lindgren
@ 2017-06-08  6:20     ` Peter Ujfalusi
  -1 siblings, 0 replies; 56+ messages in thread
From: Peter Ujfalusi @ 2017-06-08  6:20 UTC (permalink / raw)
  To: Tony Lindgren, linux-omap; +Cc: linux-arm-kernel

On 2017-06-01 01:51, Tony Lindgren wrote:
> We are now booting all mach-omap2 in device tree only mode.
> Any code that is only called in legacy boot mode where
> of_have_populated_dt() is not set is safe to remove now.
> 
> Signed-off-by: Tony Lindgren <tony@atomide.com>

Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>

> ---
>  arch/arm/mach-omap2/mcbsp.c | 70 ---------------------------------------------
>  1 file changed, 70 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/mcbsp.c b/arch/arm/mach-omap2/mcbsp.c
> --- a/arch/arm/mach-omap2/mcbsp.c
> +++ b/arch/arm/mach-omap2/mcbsp.c
> @@ -53,73 +53,3 @@ void __init omap3_mcbsp_init_pdata_callback(
>  
>  	pdata->force_ick_on = omap3_mcbsp_force_ick_on;
>  }
> -
> -static int __init omap_init_mcbsp(struct omap_hwmod *oh, void *unused)
> -{
> -	int id, count = 1;
> -	char *name = "omap-mcbsp";
> -	struct omap_hwmod *oh_device[2];
> -	struct omap_mcbsp_platform_data *pdata = NULL;
> -	struct platform_device *pdev;
> -
> -	sscanf(oh->name, "mcbsp%d", &id);
> -
> -	pdata = kzalloc(sizeof(struct omap_mcbsp_platform_data), GFP_KERNEL);
> -	if (!pdata) {
> -		pr_err("%s: No memory for mcbsp\n", __func__);
> -		return -ENOMEM;
> -	}
> -
> -	pdata->reg_step = 4;
> -	if (oh->class->rev < MCBSP_CONFIG_TYPE2) {
> -		pdata->reg_size = 2;
> -	} else {
> -		pdata->reg_size = 4;
> -		pdata->has_ccr = true;
> -	}
> -
> -	if (oh->class->rev == MCBSP_CONFIG_TYPE2) {
> -		/* The FIFO has 128 locations */
> -		pdata->buffer_size = 0x80;
> -	} else if (oh->class->rev == MCBSP_CONFIG_TYPE3) {
> -		if (id == 2)
> -			/* The FIFO has 1024 + 256 locations */
> -			pdata->buffer_size = 0x500;
> -		else
> -			/* The FIFO has 128 locations */
> -			pdata->buffer_size = 0x80;
> -	} else if (oh->class->rev == MCBSP_CONFIG_TYPE4) {
> -		/* The FIFO has 128 locations for all instances */
> -		pdata->buffer_size = 0x80;
> -	}
> -
> -	if (oh->class->rev >= MCBSP_CONFIG_TYPE3)
> -		pdata->has_wakeup = true;
> -
> -	oh_device[0] = oh;
> -
> -	if (oh->dev_attr) {
> -		oh_device[1] = omap_hwmod_lookup((
> -		(struct omap_mcbsp_dev_attr *)(oh->dev_attr))->sidetone);
> -		pdata->force_ick_on = omap3_mcbsp_force_ick_on;
> -		count++;
> -	}
> -	pdev = omap_device_build_ss(name, id, oh_device, count, pdata,
> -				    sizeof(*pdata));
> -	kfree(pdata);
> -	if (IS_ERR(pdev))  {
> -		pr_err("%s: Can't build omap_device for %s:%s.\n", __func__,
> -					name, oh->name);
> -		return PTR_ERR(pdev);
> -	}
> -	return 0;
> -}
> -
> -static int __init omap2_mcbsp_init(void)
> -{
> -	if (!of_have_populated_dt())
> -		omap_hwmod_for_each_by_class("mcbsp", omap_init_mcbsp, NULL);
> -
> -	return 0;
> -}
> -omap_arch_initcall(omap2_mcbsp_init);
> 

- Péter

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 05/11] ARM: OMAP2+: Remove unused legacy code for McBSP
@ 2017-06-08  6:20     ` Peter Ujfalusi
  0 siblings, 0 replies; 56+ messages in thread
From: Peter Ujfalusi @ 2017-06-08  6:20 UTC (permalink / raw)
  To: linux-arm-kernel

On 2017-06-01 01:51, Tony Lindgren wrote:
> We are now booting all mach-omap2 in device tree only mode.
> Any code that is only called in legacy boot mode where
> of_have_populated_dt() is not set is safe to remove now.
> 
> Signed-off-by: Tony Lindgren <tony@atomide.com>

Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>

> ---
>  arch/arm/mach-omap2/mcbsp.c | 70 ---------------------------------------------
>  1 file changed, 70 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/mcbsp.c b/arch/arm/mach-omap2/mcbsp.c
> --- a/arch/arm/mach-omap2/mcbsp.c
> +++ b/arch/arm/mach-omap2/mcbsp.c
> @@ -53,73 +53,3 @@ void __init omap3_mcbsp_init_pdata_callback(
>  
>  	pdata->force_ick_on = omap3_mcbsp_force_ick_on;
>  }
> -
> -static int __init omap_init_mcbsp(struct omap_hwmod *oh, void *unused)
> -{
> -	int id, count = 1;
> -	char *name = "omap-mcbsp";
> -	struct omap_hwmod *oh_device[2];
> -	struct omap_mcbsp_platform_data *pdata = NULL;
> -	struct platform_device *pdev;
> -
> -	sscanf(oh->name, "mcbsp%d", &id);
> -
> -	pdata = kzalloc(sizeof(struct omap_mcbsp_platform_data), GFP_KERNEL);
> -	if (!pdata) {
> -		pr_err("%s: No memory for mcbsp\n", __func__);
> -		return -ENOMEM;
> -	}
> -
> -	pdata->reg_step = 4;
> -	if (oh->class->rev < MCBSP_CONFIG_TYPE2) {
> -		pdata->reg_size = 2;
> -	} else {
> -		pdata->reg_size = 4;
> -		pdata->has_ccr = true;
> -	}
> -
> -	if (oh->class->rev == MCBSP_CONFIG_TYPE2) {
> -		/* The FIFO has 128 locations */
> -		pdata->buffer_size = 0x80;
> -	} else if (oh->class->rev == MCBSP_CONFIG_TYPE3) {
> -		if (id == 2)
> -			/* The FIFO has 1024 + 256 locations */
> -			pdata->buffer_size = 0x500;
> -		else
> -			/* The FIFO has 128 locations */
> -			pdata->buffer_size = 0x80;
> -	} else if (oh->class->rev == MCBSP_CONFIG_TYPE4) {
> -		/* The FIFO has 128 locations for all instances */
> -		pdata->buffer_size = 0x80;
> -	}
> -
> -	if (oh->class->rev >= MCBSP_CONFIG_TYPE3)
> -		pdata->has_wakeup = true;
> -
> -	oh_device[0] = oh;
> -
> -	if (oh->dev_attr) {
> -		oh_device[1] = omap_hwmod_lookup((
> -		(struct omap_mcbsp_dev_attr *)(oh->dev_attr))->sidetone);
> -		pdata->force_ick_on = omap3_mcbsp_force_ick_on;
> -		count++;
> -	}
> -	pdev = omap_device_build_ss(name, id, oh_device, count, pdata,
> -				    sizeof(*pdata));
> -	kfree(pdata);
> -	if (IS_ERR(pdev))  {
> -		pr_err("%s: Can't build omap_device for %s:%s.\n", __func__,
> -					name, oh->name);
> -		return PTR_ERR(pdev);
> -	}
> -	return 0;
> -}
> -
> -static int __init omap2_mcbsp_init(void)
> -{
> -	if (!of_have_populated_dt())
> -		omap_hwmod_for_each_by_class("mcbsp", omap_init_mcbsp, NULL);
> -
> -	return 0;
> -}
> -omap_arch_initcall(omap2_mcbsp_init);
> 

- P?ter

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 07/11] ARM: OMAP2+: Remove unused legacy code for DMA
  2017-05-31 22:51   ` Tony Lindgren
@ 2017-06-08  6:25     ` Peter Ujfalusi
  -1 siblings, 0 replies; 56+ messages in thread
From: Peter Ujfalusi @ 2017-06-08  6:25 UTC (permalink / raw)
  To: Tony Lindgren, linux-omap; +Cc: linux-arm-kernel

Tony,

On 2017-06-01 01:51, Tony Lindgren wrote:
> We are now booting all mach-omap2 in device tree only mode.
> Any code that is only called in legacy boot mode where
> of_have_populated_dt() is not set is safe to remove now.
> 
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> ---
>  arch/arm/mach-omap2/dma.c | 30 +-----------------------------
>  1 file changed, 1 insertion(+), 29 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/dma.c b/arch/arm/mach-omap2/dma.c
> --- a/arch/arm/mach-omap2/dma.c
> +++ b/arch/arm/mach-omap2/dma.c
> @@ -334,20 +334,6 @@ static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused)
>  	p.dma_attr = (struct omap_dma_dev_attr *)oh->dev_attr;
>  	p.errata = configure_dma_errata();
>  
> -	if (!of_have_populated_dt()) {
> -		if (soc_is_omap24xx()) {
> -			p.slave_map = omap24xx_sdma_map;
> -			p.slavecnt = ARRAY_SIZE(omap24xx_sdma_map);
> -		} else if (soc_is_omap34xx() || soc_is_omap3630()) {
> -			p.slave_map = omap3xxx_sdma_map;
> -			p.slavecnt = ARRAY_SIZE(omap3xxx_sdma_map);
> -		} else {
> -			pr_err("%s: The legacy DMA map is not provided!\n",
> -			       __func__);
> -			return -ENODEV;
> -		}
> -	}
> -

This will conflict with the changes introduced by the tusb6010 DMAengine
conversion:
https://patchwork.kernel.org/patch/9734219/

with this patch I think the omap24xx_sdma_map and omap3xxx_sdma_map can
also be removed, but we need to keep the omap24xx_sdma_dt_map for now
till we have proper DT support for tusb.

>  	pdev = omap_device_build(name, 0, oh, &p, sizeof(p));
>  	if (IS_ERR(pdev)) {
>  		pr_err("%s: Can't build omap_device for %s:%s.\n",
> @@ -389,21 +375,7 @@ static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused)
>  
>  static int __init omap2_system_dma_init(void)
>  {
> -	struct platform_device *pdev;
> -	int res;
> -
> -	res = omap_hwmod_for_each_by_class("dma",
> +	return omap_hwmod_for_each_by_class("dma",
>  			omap2_system_dma_init_dev, NULL);
> -	if (res)
> -		return res;
> -
> -	if (of_have_populated_dt())
> -		return res;
> -
> -	pdev = platform_device_register_full(&omap_dma_dev_info);
> -	if (IS_ERR(pdev))
> -		return PTR_ERR(pdev);
> -
> -	return res;
>  }
>  omap_arch_initcall(omap2_system_dma_init);
> 

- Péter

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 07/11] ARM: OMAP2+: Remove unused legacy code for DMA
@ 2017-06-08  6:25     ` Peter Ujfalusi
  0 siblings, 0 replies; 56+ messages in thread
From: Peter Ujfalusi @ 2017-06-08  6:25 UTC (permalink / raw)
  To: linux-arm-kernel

Tony,

On 2017-06-01 01:51, Tony Lindgren wrote:
> We are now booting all mach-omap2 in device tree only mode.
> Any code that is only called in legacy boot mode where
> of_have_populated_dt() is not set is safe to remove now.
> 
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> ---
>  arch/arm/mach-omap2/dma.c | 30 +-----------------------------
>  1 file changed, 1 insertion(+), 29 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/dma.c b/arch/arm/mach-omap2/dma.c
> --- a/arch/arm/mach-omap2/dma.c
> +++ b/arch/arm/mach-omap2/dma.c
> @@ -334,20 +334,6 @@ static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused)
>  	p.dma_attr = (struct omap_dma_dev_attr *)oh->dev_attr;
>  	p.errata = configure_dma_errata();
>  
> -	if (!of_have_populated_dt()) {
> -		if (soc_is_omap24xx()) {
> -			p.slave_map = omap24xx_sdma_map;
> -			p.slavecnt = ARRAY_SIZE(omap24xx_sdma_map);
> -		} else if (soc_is_omap34xx() || soc_is_omap3630()) {
> -			p.slave_map = omap3xxx_sdma_map;
> -			p.slavecnt = ARRAY_SIZE(omap3xxx_sdma_map);
> -		} else {
> -			pr_err("%s: The legacy DMA map is not provided!\n",
> -			       __func__);
> -			return -ENODEV;
> -		}
> -	}
> -

This will conflict with the changes introduced by the tusb6010 DMAengine
conversion:
https://patchwork.kernel.org/patch/9734219/

with this patch I think the omap24xx_sdma_map and omap3xxx_sdma_map can
also be removed, but we need to keep the omap24xx_sdma_dt_map for now
till we have proper DT support for tusb.

>  	pdev = omap_device_build(name, 0, oh, &p, sizeof(p));
>  	if (IS_ERR(pdev)) {
>  		pr_err("%s: Can't build omap_device for %s:%s.\n",
> @@ -389,21 +375,7 @@ static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused)
>  
>  static int __init omap2_system_dma_init(void)
>  {
> -	struct platform_device *pdev;
> -	int res;
> -
> -	res = omap_hwmod_for_each_by_class("dma",
> +	return omap_hwmod_for_each_by_class("dma",
>  			omap2_system_dma_init_dev, NULL);
> -	if (res)
> -		return res;
> -
> -	if (of_have_populated_dt())
> -		return res;
> -
> -	pdev = platform_device_register_full(&omap_dma_dev_info);
> -	if (IS_ERR(pdev))
> -		return PTR_ERR(pdev);
> -
> -	return res;
>  }
>  omap_arch_initcall(omap2_system_dma_init);
> 

- P?ter

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 00/11] Remove unused omap legacy code
  2017-05-31 22:51 ` Tony Lindgren
@ 2017-06-08  8:13   ` Sebastian Reichel
  -1 siblings, 0 replies; 56+ messages in thread
From: Sebastian Reichel @ 2017-06-08  8:13 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: linux-omap, linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 2284 bytes --]

Hi,

On Wed, May 31, 2017 at 03:51:28PM -0700, Tony Lindgren wrote:
> We can now remove quite a bit of clutter with legacy booting
> gone. Basically anything with of_have_populated_dt() not set
> can now go.

Except for the comment on patch 4 the series is

Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>

-- Sebastian

> Tony Lindgren (11):
>   ARM: OMAP2+: Remove unused legacy code for opp
>   ARM: OMAP2+: Remove unused legacy code for timer
>   ARM: OMAP2+: Remove unused legacy code for PMU
>   ARM: OMAP2+: Remove unused legacy code for device init
>   ARM: OMAP2+: Remove unused legacy code for McBSP
>   ARM: OMAP2+: Remove unused legacy code for io.c
>   ARM: OMAP2+: Remove unused legacy code for DMA
>   ARM: OMAP2+: Remove unused legacy code for PRM
>   ARM: OMAP2+: Remove unused legacy code for interconnects
>   ARM: OMAP2+: Remove unused legacy code for watchdog
>   ARM: OMAP2+: Remove unused legacy code for n8x0
> 
>  arch/arm/mach-omap2/Makefile               |   4 -
>  arch/arm/mach-omap2/board-n8x0.c           |  14 +--
>  arch/arm/mach-omap2/devices.c              | 163 ---------------------------
>  arch/arm/mach-omap2/dma.c                  |  30 +----
>  arch/arm/mach-omap2/io.c                   |  59 +++-------
>  arch/arm/mach-omap2/mcbsp.c                |  70 ------------
>  arch/arm/mach-omap2/omap_device.c          |   5 +-
>  arch/arm/mach-omap2/omap_hwmod.c           |  23 ++--
>  arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |   3 +-
>  arch/arm/mach-omap2/opp.c                  | 104 -----------------
>  arch/arm/mach-omap2/opp3xxx_data.c         |  86 ---------------
>  arch/arm/mach-omap2/opp4xxx_data.c         |  79 -------------
>  arch/arm/mach-omap2/pmu.c                  |  97 ----------------
>  arch/arm/mach-omap2/prm3xxx.c              |  17 ++-
>  arch/arm/mach-omap2/prm44xx.c              |  59 ----------
>  arch/arm/mach-omap2/prm_common.c           |   9 +-
>  arch/arm/mach-omap2/timer.c                | 172 ++++-------------------------
>  arch/arm/mach-omap2/wd_timer.c             |  28 -----
>  18 files changed, 63 insertions(+), 959 deletions(-)
>  delete mode 100644 arch/arm/mach-omap2/opp.c
>  delete mode 100644 arch/arm/mach-omap2/pmu.c

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 00/11] Remove unused omap legacy code
@ 2017-06-08  8:13   ` Sebastian Reichel
  0 siblings, 0 replies; 56+ messages in thread
From: Sebastian Reichel @ 2017-06-08  8:13 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Wed, May 31, 2017 at 03:51:28PM -0700, Tony Lindgren wrote:
> We can now remove quite a bit of clutter with legacy booting
> gone. Basically anything with of_have_populated_dt() not set
> can now go.

Except for the comment on patch 4 the series is

Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>

-- Sebastian

> Tony Lindgren (11):
>   ARM: OMAP2+: Remove unused legacy code for opp
>   ARM: OMAP2+: Remove unused legacy code for timer
>   ARM: OMAP2+: Remove unused legacy code for PMU
>   ARM: OMAP2+: Remove unused legacy code for device init
>   ARM: OMAP2+: Remove unused legacy code for McBSP
>   ARM: OMAP2+: Remove unused legacy code for io.c
>   ARM: OMAP2+: Remove unused legacy code for DMA
>   ARM: OMAP2+: Remove unused legacy code for PRM
>   ARM: OMAP2+: Remove unused legacy code for interconnects
>   ARM: OMAP2+: Remove unused legacy code for watchdog
>   ARM: OMAP2+: Remove unused legacy code for n8x0
> 
>  arch/arm/mach-omap2/Makefile               |   4 -
>  arch/arm/mach-omap2/board-n8x0.c           |  14 +--
>  arch/arm/mach-omap2/devices.c              | 163 ---------------------------
>  arch/arm/mach-omap2/dma.c                  |  30 +----
>  arch/arm/mach-omap2/io.c                   |  59 +++-------
>  arch/arm/mach-omap2/mcbsp.c                |  70 ------------
>  arch/arm/mach-omap2/omap_device.c          |   5 +-
>  arch/arm/mach-omap2/omap_hwmod.c           |  23 ++--
>  arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |   3 +-
>  arch/arm/mach-omap2/opp.c                  | 104 -----------------
>  arch/arm/mach-omap2/opp3xxx_data.c         |  86 ---------------
>  arch/arm/mach-omap2/opp4xxx_data.c         |  79 -------------
>  arch/arm/mach-omap2/pmu.c                  |  97 ----------------
>  arch/arm/mach-omap2/prm3xxx.c              |  17 ++-
>  arch/arm/mach-omap2/prm44xx.c              |  59 ----------
>  arch/arm/mach-omap2/prm_common.c           |   9 +-
>  arch/arm/mach-omap2/timer.c                | 172 ++++-------------------------
>  arch/arm/mach-omap2/wd_timer.c             |  28 -----
>  18 files changed, 63 insertions(+), 959 deletions(-)
>  delete mode 100644 arch/arm/mach-omap2/opp.c
>  delete mode 100644 arch/arm/mach-omap2/pmu.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170608/2c037f41/attachment-0001.sig>

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 07/11] ARM: OMAP2+: Remove unused legacy code for DMA
  2017-06-08  6:25     ` Peter Ujfalusi
@ 2017-06-08  8:24       ` Tony Lindgren
  -1 siblings, 0 replies; 56+ messages in thread
From: Tony Lindgren @ 2017-06-08  8:24 UTC (permalink / raw)
  To: Peter Ujfalusi; +Cc: linux-omap, linux-arm-kernel

* Peter Ujfalusi <peter.ujfalusi@ti.com> [170607 23:29]:
> On 2017-06-01 01:51, Tony Lindgren wrote:
> > --- a/arch/arm/mach-omap2/dma.c
> > +++ b/arch/arm/mach-omap2/dma.c
> > @@ -334,20 +334,6 @@ static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused)
> >  	p.dma_attr = (struct omap_dma_dev_attr *)oh->dev_attr;
> >  	p.errata = configure_dma_errata();
> >  
> > -	if (!of_have_populated_dt()) {
> > -		if (soc_is_omap24xx()) {
> > -			p.slave_map = omap24xx_sdma_map;
> > -			p.slavecnt = ARRAY_SIZE(omap24xx_sdma_map);
> > -		} else if (soc_is_omap34xx() || soc_is_omap3630()) {
> > -			p.slave_map = omap3xxx_sdma_map;
> > -			p.slavecnt = ARRAY_SIZE(omap3xxx_sdma_map);
> > -		} else {
> > -			pr_err("%s: The legacy DMA map is not provided!\n",
> > -			       __func__);
> > -			return -ENODEV;
> > -		}
> > -	}
> > -
> 
> This will conflict with the changes introduced by the tusb6010 DMAengine
> conversion:
> https://patchwork.kernel.org/patch/9734219/

Oops forgot about that one. I'll take a look if it makes sense
to leave the braces for now to avoid a merge conflict.

> with this patch I think the omap24xx_sdma_map and omap3xxx_sdma_map can
> also be removed, but we need to keep the omap24xx_sdma_dt_map for now
> till we have proper DT support for tusb.

OK good point, will check.

Regards,

Tony

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 07/11] ARM: OMAP2+: Remove unused legacy code for DMA
@ 2017-06-08  8:24       ` Tony Lindgren
  0 siblings, 0 replies; 56+ messages in thread
From: Tony Lindgren @ 2017-06-08  8:24 UTC (permalink / raw)
  To: linux-arm-kernel

* Peter Ujfalusi <peter.ujfalusi@ti.com> [170607 23:29]:
> On 2017-06-01 01:51, Tony Lindgren wrote:
> > --- a/arch/arm/mach-omap2/dma.c
> > +++ b/arch/arm/mach-omap2/dma.c
> > @@ -334,20 +334,6 @@ static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused)
> >  	p.dma_attr = (struct omap_dma_dev_attr *)oh->dev_attr;
> >  	p.errata = configure_dma_errata();
> >  
> > -	if (!of_have_populated_dt()) {
> > -		if (soc_is_omap24xx()) {
> > -			p.slave_map = omap24xx_sdma_map;
> > -			p.slavecnt = ARRAY_SIZE(omap24xx_sdma_map);
> > -		} else if (soc_is_omap34xx() || soc_is_omap3630()) {
> > -			p.slave_map = omap3xxx_sdma_map;
> > -			p.slavecnt = ARRAY_SIZE(omap3xxx_sdma_map);
> > -		} else {
> > -			pr_err("%s: The legacy DMA map is not provided!\n",
> > -			       __func__);
> > -			return -ENODEV;
> > -		}
> > -	}
> > -
> 
> This will conflict with the changes introduced by the tusb6010 DMAengine
> conversion:
> https://patchwork.kernel.org/patch/9734219/

Oops forgot about that one. I'll take a look if it makes sense
to leave the braces for now to avoid a merge conflict.

> with this patch I think the omap24xx_sdma_map and omap3xxx_sdma_map can
> also be removed, but we need to keep the omap24xx_sdma_dt_map for now
> till we have proper DT support for tusb.

OK good point, will check.

Regards,

Tony

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 04/11] ARM: OMAP2+: Remove unused legacy code for device init
  2017-06-07 22:27     ` Sebastian Reichel
@ 2017-06-08  8:28       ` Tony Lindgren
  -1 siblings, 0 replies; 56+ messages in thread
From: Tony Lindgren @ 2017-06-08  8:28 UTC (permalink / raw)
  To: Sebastian Reichel; +Cc: linux-omap, linux-arm-kernel

* Sebastian Reichel <sre@kernel.org> [170607 15:30]:
> I guess you can drop omap2_init_devices() completly?

We still have omap_init_sti() left there, but it's
just static inline void omap_init_sti(void) {} :)

So yeah will remove that too.

Regards,

Tony

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 04/11] ARM: OMAP2+: Remove unused legacy code for device init
@ 2017-06-08  8:28       ` Tony Lindgren
  0 siblings, 0 replies; 56+ messages in thread
From: Tony Lindgren @ 2017-06-08  8:28 UTC (permalink / raw)
  To: linux-arm-kernel

* Sebastian Reichel <sre@kernel.org> [170607 15:30]:
> I guess you can drop omap2_init_devices() completly?

We still have omap_init_sti() left there, but it's
just static inline void omap_init_sti(void) {} :)

So yeah will remove that too.

Regards,

Tony

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 04/11] ARM: OMAP2+: Remove unused legacy code for device init
  2017-06-08  8:28       ` Tony Lindgren
@ 2017-06-08  9:47         ` Tony Lindgren
  -1 siblings, 0 replies; 56+ messages in thread
From: Tony Lindgren @ 2017-06-08  9:47 UTC (permalink / raw)
  To: Sebastian Reichel; +Cc: linux-omap, linux-arm-kernel

* Tony Lindgren <tony@atomide.com> [170608 01:32]:
> * Sebastian Reichel <sre@kernel.org> [170607 15:30]:
> > I guess you can drop omap2_init_devices() completly?
> 
> We still have omap_init_sti() left there, but it's
> just static inline void omap_init_sti(void) {} :)
> 
> So yeah will remove that too.

Here's this one updated.

Regards,

Tony

8< -----------------
>From tony Mon Sep 17 00:00:00 2001
From: Tony Lindgren <tony@atomide.com>
Date: Wed, 31 May 2017 15:51:32 -0700
Subject: [PATCH] ARM: OMAP2+: Remove unused legacy code for device init

We are now booting all mach-omap2 in device tree only mode.
Any code that is only called in legacy boot mode where
of_have_populated_dt() is not set is safe to remove now.

Note that omap_init_sti() won't do anything so we can
remove omap2_init_devices() as pointed out by Sebastian
Reichel <sebastian.reichel@collabora.co.uk>.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/devices.c | 175 ------------------------------------------
 1 file changed, 175 deletions(-)

diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -36,130 +36,6 @@
 #define L3_MODULES_MAX_LEN 12
 #define L3_MODULES 3
 
-static int __init omap3_l3_init(void)
-{
-	struct omap_hwmod *oh;
-	struct platform_device *pdev;
-	char oh_name[L3_MODULES_MAX_LEN];
-
-	/*
-	 * To avoid code running on other OMAPs in
-	 * multi-omap builds
-	 */
-	if (!(cpu_is_omap34xx()) || of_have_populated_dt())
-		return -ENODEV;
-
-	snprintf(oh_name, L3_MODULES_MAX_LEN, "l3_main");
-
-	oh = omap_hwmod_lookup(oh_name);
-
-	if (!oh)
-		pr_err("could not look up %s\n", oh_name);
-
-	pdev = omap_device_build("omap_l3_smx", 0, oh, NULL, 0);
-
-	WARN(IS_ERR(pdev), "could not build omap_device for %s\n", oh_name);
-
-	return PTR_ERR_OR_ZERO(pdev);
-}
-omap_postcore_initcall(omap3_l3_init);
-
-static inline void omap_init_sti(void) {}
-
-#if IS_ENABLED(CONFIG_SPI_OMAP24XX)
-
-#include <linux/platform_data/spi-omap2-mcspi.h>
-
-static int __init omap_mcspi_init(struct omap_hwmod *oh, void *unused)
-{
-	struct platform_device *pdev;
-	char *name = "omap2_mcspi";
-	struct omap2_mcspi_platform_config *pdata;
-	static int spi_num;
-	struct omap2_mcspi_dev_attr *mcspi_attrib = oh->dev_attr;
-
-	pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
-	if (!pdata) {
-		pr_err("Memory allocation for McSPI device failed\n");
-		return -ENOMEM;
-	}
-
-	pdata->num_cs = mcspi_attrib->num_chipselect;
-	switch (oh->class->rev) {
-	case OMAP2_MCSPI_REV:
-	case OMAP3_MCSPI_REV:
-			pdata->regs_offset = 0;
-			break;
-	case OMAP4_MCSPI_REV:
-			pdata->regs_offset = OMAP4_MCSPI_REG_OFFSET;
-			break;
-	default:
-			pr_err("Invalid McSPI Revision value\n");
-			kfree(pdata);
-			return -EINVAL;
-	}
-
-	spi_num++;
-	pdev = omap_device_build(name, spi_num, oh, pdata, sizeof(*pdata));
-	WARN(IS_ERR(pdev), "Can't build omap_device for %s:%s\n",
-				name, oh->name);
-	kfree(pdata);
-	return 0;
-}
-
-static void omap_init_mcspi(void)
-{
-	omap_hwmod_for_each_by_class("mcspi", omap_mcspi_init, NULL);
-}
-
-#else
-static inline void omap_init_mcspi(void) {}
-#endif
-
-/**
- * omap_init_rng - bind the RNG hwmod to the RNG omap_device
- *
- * Bind the RNG hwmod to the RNG omap_device.  No return value.
- */
-static void __init omap_init_rng(void)
-{
-	struct omap_hwmod *oh;
-	struct platform_device *pdev;
-
-	oh = omap_hwmod_lookup("rng");
-	if (!oh)
-		return;
-
-	pdev = omap_device_build("omap_rng", -1, oh, NULL, 0);
-	WARN(IS_ERR(pdev), "Can't build omap_device for omap_rng\n");
-}
-
-static void __init omap_init_sham(void)
-{
-	struct omap_hwmod *oh;
-	struct platform_device *pdev;
-
-	oh = omap_hwmod_lookup("sham");
-	if (!oh)
-		return;
-
-	pdev = omap_device_build("omap-sham", -1, oh, NULL, 0);
-	WARN(IS_ERR(pdev), "Can't build omap_device for omap-sham\n");
-}
-
-static void __init omap_init_aes(void)
-{
-	struct omap_hwmod *oh;
-	struct platform_device *pdev;
-
-	oh = omap_hwmod_lookup("aes");
-	if (!oh)
-		return;
-
-	pdev = omap_device_build("omap-aes", -1, oh, NULL, 0);
-	WARN(IS_ERR(pdev), "Can't build omap_device for omap-aes\n");
-}
-
 /*-------------------------------------------------------------------------*/
 
 #if IS_ENABLED(CONFIG_VIDEO_OMAP2_VOUT)
@@ -185,54 +61,3 @@ int __init omap_init_vout(void)
 #else
 int __init omap_init_vout(void) { return 0; }
 #endif
-
-/*-------------------------------------------------------------------------*/
-
-static int __init omap2_init_devices(void)
-{
-	/* Enable dummy states for those platforms without pinctrl support */
-	if (!of_have_populated_dt())
-		pinctrl_provide_dummies();
-
-	/* If dtb is there, the devices will be created dynamically */
-	if (!of_have_populated_dt()) {
-		/*
-		 * please keep these calls, and their implementations above,
-		 * in alphabetical order so they're easier to sort through.
-		 */
-		omap_init_mcspi();
-		omap_init_sham();
-		omap_init_aes();
-		omap_init_rng();
-	}
-	omap_init_sti();
-
-	return 0;
-}
-omap_arch_initcall(omap2_init_devices);
-
-static int __init omap_gpmc_init(void)
-{
-	struct omap_hwmod *oh;
-	struct platform_device *pdev;
-	char *oh_name = "gpmc";
-
-	/*
-	 * if the board boots up with a populated DT, do not
-	 * manually add the device from this initcall
-	 */
-	if (of_have_populated_dt())
-		return -ENODEV;
-
-	oh = omap_hwmod_lookup(oh_name);
-	if (!oh) {
-		pr_err("Could not look up %s\n", oh_name);
-		return -ENODEV;
-	}
-
-	pdev = omap_device_build("omap-gpmc", -1, oh, NULL, 0);
-	WARN(IS_ERR(pdev), "could not build omap_device for %s\n", oh_name);
-
-	return PTR_ERR_OR_ZERO(pdev);
-}
-omap_postcore_initcall(omap_gpmc_init);
-- 
2.13.0

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 04/11] ARM: OMAP2+: Remove unused legacy code for device init
@ 2017-06-08  9:47         ` Tony Lindgren
  0 siblings, 0 replies; 56+ messages in thread
From: Tony Lindgren @ 2017-06-08  9:47 UTC (permalink / raw)
  To: linux-arm-kernel

* Tony Lindgren <tony@atomide.com> [170608 01:32]:
> * Sebastian Reichel <sre@kernel.org> [170607 15:30]:
> > I guess you can drop omap2_init_devices() completly?
> 
> We still have omap_init_sti() left there, but it's
> just static inline void omap_init_sti(void) {} :)
> 
> So yeah will remove that too.

Here's this one updated.

Regards,

Tony

8< -----------------
>From tony Mon Sep 17 00:00:00 2001
From: Tony Lindgren <tony@atomide.com>
Date: Wed, 31 May 2017 15:51:32 -0700
Subject: [PATCH] ARM: OMAP2+: Remove unused legacy code for device init

We are now booting all mach-omap2 in device tree only mode.
Any code that is only called in legacy boot mode where
of_have_populated_dt() is not set is safe to remove now.

Note that omap_init_sti() won't do anything so we can
remove omap2_init_devices() as pointed out by Sebastian
Reichel <sebastian.reichel@collabora.co.uk>.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/devices.c | 175 ------------------------------------------
 1 file changed, 175 deletions(-)

diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -36,130 +36,6 @@
 #define L3_MODULES_MAX_LEN 12
 #define L3_MODULES 3
 
-static int __init omap3_l3_init(void)
-{
-	struct omap_hwmod *oh;
-	struct platform_device *pdev;
-	char oh_name[L3_MODULES_MAX_LEN];
-
-	/*
-	 * To avoid code running on other OMAPs in
-	 * multi-omap builds
-	 */
-	if (!(cpu_is_omap34xx()) || of_have_populated_dt())
-		return -ENODEV;
-
-	snprintf(oh_name, L3_MODULES_MAX_LEN, "l3_main");
-
-	oh = omap_hwmod_lookup(oh_name);
-
-	if (!oh)
-		pr_err("could not look up %s\n", oh_name);
-
-	pdev = omap_device_build("omap_l3_smx", 0, oh, NULL, 0);
-
-	WARN(IS_ERR(pdev), "could not build omap_device for %s\n", oh_name);
-
-	return PTR_ERR_OR_ZERO(pdev);
-}
-omap_postcore_initcall(omap3_l3_init);
-
-static inline void omap_init_sti(void) {}
-
-#if IS_ENABLED(CONFIG_SPI_OMAP24XX)
-
-#include <linux/platform_data/spi-omap2-mcspi.h>
-
-static int __init omap_mcspi_init(struct omap_hwmod *oh, void *unused)
-{
-	struct platform_device *pdev;
-	char *name = "omap2_mcspi";
-	struct omap2_mcspi_platform_config *pdata;
-	static int spi_num;
-	struct omap2_mcspi_dev_attr *mcspi_attrib = oh->dev_attr;
-
-	pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
-	if (!pdata) {
-		pr_err("Memory allocation for McSPI device failed\n");
-		return -ENOMEM;
-	}
-
-	pdata->num_cs = mcspi_attrib->num_chipselect;
-	switch (oh->class->rev) {
-	case OMAP2_MCSPI_REV:
-	case OMAP3_MCSPI_REV:
-			pdata->regs_offset = 0;
-			break;
-	case OMAP4_MCSPI_REV:
-			pdata->regs_offset = OMAP4_MCSPI_REG_OFFSET;
-			break;
-	default:
-			pr_err("Invalid McSPI Revision value\n");
-			kfree(pdata);
-			return -EINVAL;
-	}
-
-	spi_num++;
-	pdev = omap_device_build(name, spi_num, oh, pdata, sizeof(*pdata));
-	WARN(IS_ERR(pdev), "Can't build omap_device for %s:%s\n",
-				name, oh->name);
-	kfree(pdata);
-	return 0;
-}
-
-static void omap_init_mcspi(void)
-{
-	omap_hwmod_for_each_by_class("mcspi", omap_mcspi_init, NULL);
-}
-
-#else
-static inline void omap_init_mcspi(void) {}
-#endif
-
-/**
- * omap_init_rng - bind the RNG hwmod to the RNG omap_device
- *
- * Bind the RNG hwmod to the RNG omap_device.  No return value.
- */
-static void __init omap_init_rng(void)
-{
-	struct omap_hwmod *oh;
-	struct platform_device *pdev;
-
-	oh = omap_hwmod_lookup("rng");
-	if (!oh)
-		return;
-
-	pdev = omap_device_build("omap_rng", -1, oh, NULL, 0);
-	WARN(IS_ERR(pdev), "Can't build omap_device for omap_rng\n");
-}
-
-static void __init omap_init_sham(void)
-{
-	struct omap_hwmod *oh;
-	struct platform_device *pdev;
-
-	oh = omap_hwmod_lookup("sham");
-	if (!oh)
-		return;
-
-	pdev = omap_device_build("omap-sham", -1, oh, NULL, 0);
-	WARN(IS_ERR(pdev), "Can't build omap_device for omap-sham\n");
-}
-
-static void __init omap_init_aes(void)
-{
-	struct omap_hwmod *oh;
-	struct platform_device *pdev;
-
-	oh = omap_hwmod_lookup("aes");
-	if (!oh)
-		return;
-
-	pdev = omap_device_build("omap-aes", -1, oh, NULL, 0);
-	WARN(IS_ERR(pdev), "Can't build omap_device for omap-aes\n");
-}
-
 /*-------------------------------------------------------------------------*/
 
 #if IS_ENABLED(CONFIG_VIDEO_OMAP2_VOUT)
@@ -185,54 +61,3 @@ int __init omap_init_vout(void)
 #else
 int __init omap_init_vout(void) { return 0; }
 #endif
-
-/*-------------------------------------------------------------------------*/
-
-static int __init omap2_init_devices(void)
-{
-	/* Enable dummy states for those platforms without pinctrl support */
-	if (!of_have_populated_dt())
-		pinctrl_provide_dummies();
-
-	/* If dtb is there, the devices will be created dynamically */
-	if (!of_have_populated_dt()) {
-		/*
-		 * please keep these calls, and their implementations above,
-		 * in alphabetical order so they're easier to sort through.
-		 */
-		omap_init_mcspi();
-		omap_init_sham();
-		omap_init_aes();
-		omap_init_rng();
-	}
-	omap_init_sti();
-
-	return 0;
-}
-omap_arch_initcall(omap2_init_devices);
-
-static int __init omap_gpmc_init(void)
-{
-	struct omap_hwmod *oh;
-	struct platform_device *pdev;
-	char *oh_name = "gpmc";
-
-	/*
-	 * if the board boots up with a populated DT, do not
-	 * manually add the device from this initcall
-	 */
-	if (of_have_populated_dt())
-		return -ENODEV;
-
-	oh = omap_hwmod_lookup(oh_name);
-	if (!oh) {
-		pr_err("Could not look up %s\n", oh_name);
-		return -ENODEV;
-	}
-
-	pdev = omap_device_build("omap-gpmc", -1, oh, NULL, 0);
-	WARN(IS_ERR(pdev), "could not build omap_device for %s\n", oh_name);
-
-	return PTR_ERR_OR_ZERO(pdev);
-}
-omap_postcore_initcall(omap_gpmc_init);
-- 
2.13.0

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 07/11] ARM: OMAP2+: Remove unused legacy code for DMA
  2017-06-08  8:24       ` Tony Lindgren
@ 2017-06-08  9:56         ` Tony Lindgren
  -1 siblings, 0 replies; 56+ messages in thread
From: Tony Lindgren @ 2017-06-08  9:56 UTC (permalink / raw)
  To: Peter Ujfalusi; +Cc: linux-omap, linux-arm-kernel

* Tony Lindgren <tony@atomide.com> [170608 01:28]:
> * Peter Ujfalusi <peter.ujfalusi@ti.com> [170607 23:29]:
> > 
> > This will conflict with the changes introduced by the tusb6010 DMAengine
> > conversion:
> > https://patchwork.kernel.org/patch/9734219/
> 
> Oops forgot about that one. I'll take a look if it makes sense
> to leave the braces for now to avoid a merge conflict.
> 
> > with this patch I think the omap24xx_sdma_map and omap3xxx_sdma_map can
> > also be removed, but we need to keep the omap24xx_sdma_dt_map for now
> > till we have proper DT support for tusb.
> 
> OK good point, will check.

Here's this one updated.

Regards,

Tony

8< ------------------
>From tony Mon Sep 17 00:00:00 2001
From: Tony Lindgren <tony@atomide.com>
Date: Wed, 31 May 2017 15:51:35 -0700
Subject: [PATCH] ARM: OMAP2+: Remove unused legacy code for DMA

We are now booting all mach-omap2 in device tree only mode.
Any code that is only called in legacy boot mode where
of_have_populated_dt() is not set is safe to remove now.

Let's leave the dummy omap2_system_dma_init_dev() check
in place for now to avoid a pointless merge conflict with
tusb6010 dmaengine conversion as pointed out by Peter
Ujfalusi <peter.ujfalusi@ti.com>.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/dma.c | 125 +---------------------------------------------
 1 file changed, 2 insertions(+), 123 deletions(-)

diff --git a/arch/arm/mach-omap2/dma.c b/arch/arm/mach-omap2/dma.c
--- a/arch/arm/mach-omap2/dma.c
+++ b/arch/arm/mach-omap2/dma.c
@@ -204,108 +204,6 @@ static unsigned configure_dma_errata(void)
 	return errata;
 }
 
-static const struct dma_slave_map omap24xx_sdma_map[] = {
-	{ "omap-gpmc", "rxtx", SDMA_FILTER_PARAM(4) },
-	{ "omap-aes", "tx", SDMA_FILTER_PARAM(9) },
-	{ "omap-aes", "rx", SDMA_FILTER_PARAM(10) },
-	{ "omap-sham", "rx", SDMA_FILTER_PARAM(13) },
-	{ "omap2_mcspi.2", "tx0", SDMA_FILTER_PARAM(15) },
-	{ "omap2_mcspi.2", "rx0", SDMA_FILTER_PARAM(16) },
-	{ "omap-mcbsp.3", "tx", SDMA_FILTER_PARAM(17) },
-	{ "omap-mcbsp.3", "rx", SDMA_FILTER_PARAM(18) },
-	{ "omap-mcbsp.4", "tx", SDMA_FILTER_PARAM(19) },
-	{ "omap-mcbsp.4", "rx", SDMA_FILTER_PARAM(20) },
-	{ "omap-mcbsp.5", "tx", SDMA_FILTER_PARAM(21) },
-	{ "omap-mcbsp.5", "rx", SDMA_FILTER_PARAM(22) },
-	{ "omap2_mcspi.2", "tx1", SDMA_FILTER_PARAM(23) },
-	{ "omap2_mcspi.2", "rx1", SDMA_FILTER_PARAM(24) },
-	{ "omap_i2c.1", "tx", SDMA_FILTER_PARAM(27) },
-	{ "omap_i2c.1", "rx", SDMA_FILTER_PARAM(28) },
-	{ "omap_i2c.2", "tx", SDMA_FILTER_PARAM(29) },
-	{ "omap_i2c.2", "rx", SDMA_FILTER_PARAM(30) },
-	{ "omap-mcbsp.1", "tx", SDMA_FILTER_PARAM(31) },
-	{ "omap-mcbsp.1", "rx", SDMA_FILTER_PARAM(32) },
-	{ "omap-mcbsp.2", "tx", SDMA_FILTER_PARAM(33) },
-	{ "omap-mcbsp.2", "rx", SDMA_FILTER_PARAM(34) },
-	{ "omap2_mcspi.0", "tx0", SDMA_FILTER_PARAM(35) },
-	{ "omap2_mcspi.0", "rx0", SDMA_FILTER_PARAM(36) },
-	{ "omap2_mcspi.0", "tx1", SDMA_FILTER_PARAM(37) },
-	{ "omap2_mcspi.0", "rx1", SDMA_FILTER_PARAM(38) },
-	{ "omap2_mcspi.0", "tx2", SDMA_FILTER_PARAM(39) },
-	{ "omap2_mcspi.0", "rx2", SDMA_FILTER_PARAM(40) },
-	{ "omap2_mcspi.0", "tx3", SDMA_FILTER_PARAM(41) },
-	{ "omap2_mcspi.0", "rx3", SDMA_FILTER_PARAM(42) },
-	{ "omap2_mcspi.1", "tx0", SDMA_FILTER_PARAM(43) },
-	{ "omap2_mcspi.1", "rx0", SDMA_FILTER_PARAM(44) },
-	{ "omap2_mcspi.1", "tx1", SDMA_FILTER_PARAM(45) },
-	{ "omap2_mcspi.1", "rx1", SDMA_FILTER_PARAM(46) },
-	{ "omap_hsmmc.1", "tx", SDMA_FILTER_PARAM(47) },
-	{ "omap_hsmmc.1", "rx", SDMA_FILTER_PARAM(48) },
-	{ "omap_uart.0", "tx", SDMA_FILTER_PARAM(49) },
-	{ "omap_uart.0", "rx", SDMA_FILTER_PARAM(50) },
-	{ "omap_uart.1", "tx", SDMA_FILTER_PARAM(51) },
-	{ "omap_uart.1", "rx", SDMA_FILTER_PARAM(52) },
-	{ "omap_uart.2", "tx", SDMA_FILTER_PARAM(53) },
-	{ "omap_uart.2", "rx", SDMA_FILTER_PARAM(54) },
-	{ "omap_hsmmc.0", "tx", SDMA_FILTER_PARAM(61) },
-	{ "omap_hsmmc.0", "rx", SDMA_FILTER_PARAM(62) },
-};
-
-static const struct dma_slave_map omap3xxx_sdma_map[] = {
-	{ "omap-gpmc", "rxtx", SDMA_FILTER_PARAM(4) },
-	{ "omap2_mcspi.2", "tx0", SDMA_FILTER_PARAM(15) },
-	{ "omap2_mcspi.2", "rx0", SDMA_FILTER_PARAM(16) },
-	{ "omap-mcbsp.3", "tx", SDMA_FILTER_PARAM(17) },
-	{ "omap-mcbsp.3", "rx", SDMA_FILTER_PARAM(18) },
-	{ "omap-mcbsp.4", "tx", SDMA_FILTER_PARAM(19) },
-	{ "omap-mcbsp.4", "rx", SDMA_FILTER_PARAM(20) },
-	{ "omap-mcbsp.5", "tx", SDMA_FILTER_PARAM(21) },
-	{ "omap-mcbsp.5", "rx", SDMA_FILTER_PARAM(22) },
-	{ "omap2_mcspi.2", "tx1", SDMA_FILTER_PARAM(23) },
-	{ "omap2_mcspi.2", "rx1", SDMA_FILTER_PARAM(24) },
-	{ "omap_i2c.3", "tx", SDMA_FILTER_PARAM(25) },
-	{ "omap_i2c.3", "rx", SDMA_FILTER_PARAM(26) },
-	{ "omap_i2c.1", "tx", SDMA_FILTER_PARAM(27) },
-	{ "omap_i2c.1", "rx", SDMA_FILTER_PARAM(28) },
-	{ "omap_i2c.2", "tx", SDMA_FILTER_PARAM(29) },
-	{ "omap_i2c.2", "rx", SDMA_FILTER_PARAM(30) },
-	{ "omap-mcbsp.1", "tx", SDMA_FILTER_PARAM(31) },
-	{ "omap-mcbsp.1", "rx", SDMA_FILTER_PARAM(32) },
-	{ "omap-mcbsp.2", "tx", SDMA_FILTER_PARAM(33) },
-	{ "omap-mcbsp.2", "rx", SDMA_FILTER_PARAM(34) },
-	{ "omap2_mcspi.0", "tx0", SDMA_FILTER_PARAM(35) },
-	{ "omap2_mcspi.0", "rx0", SDMA_FILTER_PARAM(36) },
-	{ "omap2_mcspi.0", "tx1", SDMA_FILTER_PARAM(37) },
-	{ "omap2_mcspi.0", "rx1", SDMA_FILTER_PARAM(38) },
-	{ "omap2_mcspi.0", "tx2", SDMA_FILTER_PARAM(39) },
-	{ "omap2_mcspi.0", "rx2", SDMA_FILTER_PARAM(40) },
-	{ "omap2_mcspi.0", "tx3", SDMA_FILTER_PARAM(41) },
-	{ "omap2_mcspi.0", "rx3", SDMA_FILTER_PARAM(42) },
-	{ "omap2_mcspi.1", "tx0", SDMA_FILTER_PARAM(43) },
-	{ "omap2_mcspi.1", "rx0", SDMA_FILTER_PARAM(44) },
-	{ "omap2_mcspi.1", "tx1", SDMA_FILTER_PARAM(45) },
-	{ "omap2_mcspi.1", "rx1", SDMA_FILTER_PARAM(46) },
-	{ "omap_hsmmc.1", "tx", SDMA_FILTER_PARAM(47) },
-	{ "omap_hsmmc.1", "rx", SDMA_FILTER_PARAM(48) },
-	{ "omap_uart.0", "tx", SDMA_FILTER_PARAM(49) },
-	{ "omap_uart.0", "rx", SDMA_FILTER_PARAM(50) },
-	{ "omap_uart.1", "tx", SDMA_FILTER_PARAM(51) },
-	{ "omap_uart.1", "rx", SDMA_FILTER_PARAM(52) },
-	{ "omap_uart.2", "tx", SDMA_FILTER_PARAM(53) },
-	{ "omap_uart.2", "rx", SDMA_FILTER_PARAM(54) },
-	{ "omap_hsmmc.0", "tx", SDMA_FILTER_PARAM(61) },
-	{ "omap_hsmmc.0", "rx", SDMA_FILTER_PARAM(62) },
-	{ "omap-aes", "tx", SDMA_FILTER_PARAM(65) },
-	{ "omap-aes", "rx", SDMA_FILTER_PARAM(66) },
-	{ "omap-sham", "rx", SDMA_FILTER_PARAM(69) },
-	{ "omap2_mcspi.3", "tx0", SDMA_FILTER_PARAM(70) },
-	{ "omap2_mcspi.3", "rx0", SDMA_FILTER_PARAM(71) },
-	{ "omap_hsmmc.2", "tx", SDMA_FILTER_PARAM(77) },
-	{ "omap_hsmmc.2", "rx", SDMA_FILTER_PARAM(78) },
-	{ "omap_uart.3", "tx", SDMA_FILTER_PARAM(81) },
-	{ "omap_uart.3", "rx", SDMA_FILTER_PARAM(82) },
-};
-
 static struct omap_system_dma_plat_info dma_plat_info __initdata = {
 	.reg_map	= reg_map,
 	.channel_stride	= 0x60,
@@ -334,14 +232,9 @@ static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused)
 	p.dma_attr = (struct omap_dma_dev_attr *)oh->dev_attr;
 	p.errata = configure_dma_errata();
 
+	/* REVISIT: Remove after v4.13 with a follow-up patch */
 	if (!of_have_populated_dt()) {
 		if (soc_is_omap24xx()) {
-			p.slave_map = omap24xx_sdma_map;
-			p.slavecnt = ARRAY_SIZE(omap24xx_sdma_map);
-		} else if (soc_is_omap34xx() || soc_is_omap3630()) {
-			p.slave_map = omap3xxx_sdma_map;
-			p.slavecnt = ARRAY_SIZE(omap3xxx_sdma_map);
-		} else {
 			pr_err("%s: The legacy DMA map is not provided!\n",
 			       __func__);
 			return -ENODEV;
@@ -389,21 +282,7 @@ static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused)
 
 static int __init omap2_system_dma_init(void)
 {
-	struct platform_device *pdev;
-	int res;
-
-	res = omap_hwmod_for_each_by_class("dma",
+	return omap_hwmod_for_each_by_class("dma",
 			omap2_system_dma_init_dev, NULL);
-	if (res)
-		return res;
-
-	if (of_have_populated_dt())
-		return res;
-
-	pdev = platform_device_register_full(&omap_dma_dev_info);
-	if (IS_ERR(pdev))
-		return PTR_ERR(pdev);
-
-	return res;
 }
 omap_arch_initcall(omap2_system_dma_init);
-- 
2.13.0

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 07/11] ARM: OMAP2+: Remove unused legacy code for DMA
@ 2017-06-08  9:56         ` Tony Lindgren
  0 siblings, 0 replies; 56+ messages in thread
From: Tony Lindgren @ 2017-06-08  9:56 UTC (permalink / raw)
  To: linux-arm-kernel

* Tony Lindgren <tony@atomide.com> [170608 01:28]:
> * Peter Ujfalusi <peter.ujfalusi@ti.com> [170607 23:29]:
> > 
> > This will conflict with the changes introduced by the tusb6010 DMAengine
> > conversion:
> > https://patchwork.kernel.org/patch/9734219/
> 
> Oops forgot about that one. I'll take a look if it makes sense
> to leave the braces for now to avoid a merge conflict.
> 
> > with this patch I think the omap24xx_sdma_map and omap3xxx_sdma_map can
> > also be removed, but we need to keep the omap24xx_sdma_dt_map for now
> > till we have proper DT support for tusb.
> 
> OK good point, will check.

Here's this one updated.

Regards,

Tony

8< ------------------
>From tony Mon Sep 17 00:00:00 2001
From: Tony Lindgren <tony@atomide.com>
Date: Wed, 31 May 2017 15:51:35 -0700
Subject: [PATCH] ARM: OMAP2+: Remove unused legacy code for DMA

We are now booting all mach-omap2 in device tree only mode.
Any code that is only called in legacy boot mode where
of_have_populated_dt() is not set is safe to remove now.

Let's leave the dummy omap2_system_dma_init_dev() check
in place for now to avoid a pointless merge conflict with
tusb6010 dmaengine conversion as pointed out by Peter
Ujfalusi <peter.ujfalusi@ti.com>.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/dma.c | 125 +---------------------------------------------
 1 file changed, 2 insertions(+), 123 deletions(-)

diff --git a/arch/arm/mach-omap2/dma.c b/arch/arm/mach-omap2/dma.c
--- a/arch/arm/mach-omap2/dma.c
+++ b/arch/arm/mach-omap2/dma.c
@@ -204,108 +204,6 @@ static unsigned configure_dma_errata(void)
 	return errata;
 }
 
-static const struct dma_slave_map omap24xx_sdma_map[] = {
-	{ "omap-gpmc", "rxtx", SDMA_FILTER_PARAM(4) },
-	{ "omap-aes", "tx", SDMA_FILTER_PARAM(9) },
-	{ "omap-aes", "rx", SDMA_FILTER_PARAM(10) },
-	{ "omap-sham", "rx", SDMA_FILTER_PARAM(13) },
-	{ "omap2_mcspi.2", "tx0", SDMA_FILTER_PARAM(15) },
-	{ "omap2_mcspi.2", "rx0", SDMA_FILTER_PARAM(16) },
-	{ "omap-mcbsp.3", "tx", SDMA_FILTER_PARAM(17) },
-	{ "omap-mcbsp.3", "rx", SDMA_FILTER_PARAM(18) },
-	{ "omap-mcbsp.4", "tx", SDMA_FILTER_PARAM(19) },
-	{ "omap-mcbsp.4", "rx", SDMA_FILTER_PARAM(20) },
-	{ "omap-mcbsp.5", "tx", SDMA_FILTER_PARAM(21) },
-	{ "omap-mcbsp.5", "rx", SDMA_FILTER_PARAM(22) },
-	{ "omap2_mcspi.2", "tx1", SDMA_FILTER_PARAM(23) },
-	{ "omap2_mcspi.2", "rx1", SDMA_FILTER_PARAM(24) },
-	{ "omap_i2c.1", "tx", SDMA_FILTER_PARAM(27) },
-	{ "omap_i2c.1", "rx", SDMA_FILTER_PARAM(28) },
-	{ "omap_i2c.2", "tx", SDMA_FILTER_PARAM(29) },
-	{ "omap_i2c.2", "rx", SDMA_FILTER_PARAM(30) },
-	{ "omap-mcbsp.1", "tx", SDMA_FILTER_PARAM(31) },
-	{ "omap-mcbsp.1", "rx", SDMA_FILTER_PARAM(32) },
-	{ "omap-mcbsp.2", "tx", SDMA_FILTER_PARAM(33) },
-	{ "omap-mcbsp.2", "rx", SDMA_FILTER_PARAM(34) },
-	{ "omap2_mcspi.0", "tx0", SDMA_FILTER_PARAM(35) },
-	{ "omap2_mcspi.0", "rx0", SDMA_FILTER_PARAM(36) },
-	{ "omap2_mcspi.0", "tx1", SDMA_FILTER_PARAM(37) },
-	{ "omap2_mcspi.0", "rx1", SDMA_FILTER_PARAM(38) },
-	{ "omap2_mcspi.0", "tx2", SDMA_FILTER_PARAM(39) },
-	{ "omap2_mcspi.0", "rx2", SDMA_FILTER_PARAM(40) },
-	{ "omap2_mcspi.0", "tx3", SDMA_FILTER_PARAM(41) },
-	{ "omap2_mcspi.0", "rx3", SDMA_FILTER_PARAM(42) },
-	{ "omap2_mcspi.1", "tx0", SDMA_FILTER_PARAM(43) },
-	{ "omap2_mcspi.1", "rx0", SDMA_FILTER_PARAM(44) },
-	{ "omap2_mcspi.1", "tx1", SDMA_FILTER_PARAM(45) },
-	{ "omap2_mcspi.1", "rx1", SDMA_FILTER_PARAM(46) },
-	{ "omap_hsmmc.1", "tx", SDMA_FILTER_PARAM(47) },
-	{ "omap_hsmmc.1", "rx", SDMA_FILTER_PARAM(48) },
-	{ "omap_uart.0", "tx", SDMA_FILTER_PARAM(49) },
-	{ "omap_uart.0", "rx", SDMA_FILTER_PARAM(50) },
-	{ "omap_uart.1", "tx", SDMA_FILTER_PARAM(51) },
-	{ "omap_uart.1", "rx", SDMA_FILTER_PARAM(52) },
-	{ "omap_uart.2", "tx", SDMA_FILTER_PARAM(53) },
-	{ "omap_uart.2", "rx", SDMA_FILTER_PARAM(54) },
-	{ "omap_hsmmc.0", "tx", SDMA_FILTER_PARAM(61) },
-	{ "omap_hsmmc.0", "rx", SDMA_FILTER_PARAM(62) },
-};
-
-static const struct dma_slave_map omap3xxx_sdma_map[] = {
-	{ "omap-gpmc", "rxtx", SDMA_FILTER_PARAM(4) },
-	{ "omap2_mcspi.2", "tx0", SDMA_FILTER_PARAM(15) },
-	{ "omap2_mcspi.2", "rx0", SDMA_FILTER_PARAM(16) },
-	{ "omap-mcbsp.3", "tx", SDMA_FILTER_PARAM(17) },
-	{ "omap-mcbsp.3", "rx", SDMA_FILTER_PARAM(18) },
-	{ "omap-mcbsp.4", "tx", SDMA_FILTER_PARAM(19) },
-	{ "omap-mcbsp.4", "rx", SDMA_FILTER_PARAM(20) },
-	{ "omap-mcbsp.5", "tx", SDMA_FILTER_PARAM(21) },
-	{ "omap-mcbsp.5", "rx", SDMA_FILTER_PARAM(22) },
-	{ "omap2_mcspi.2", "tx1", SDMA_FILTER_PARAM(23) },
-	{ "omap2_mcspi.2", "rx1", SDMA_FILTER_PARAM(24) },
-	{ "omap_i2c.3", "tx", SDMA_FILTER_PARAM(25) },
-	{ "omap_i2c.3", "rx", SDMA_FILTER_PARAM(26) },
-	{ "omap_i2c.1", "tx", SDMA_FILTER_PARAM(27) },
-	{ "omap_i2c.1", "rx", SDMA_FILTER_PARAM(28) },
-	{ "omap_i2c.2", "tx", SDMA_FILTER_PARAM(29) },
-	{ "omap_i2c.2", "rx", SDMA_FILTER_PARAM(30) },
-	{ "omap-mcbsp.1", "tx", SDMA_FILTER_PARAM(31) },
-	{ "omap-mcbsp.1", "rx", SDMA_FILTER_PARAM(32) },
-	{ "omap-mcbsp.2", "tx", SDMA_FILTER_PARAM(33) },
-	{ "omap-mcbsp.2", "rx", SDMA_FILTER_PARAM(34) },
-	{ "omap2_mcspi.0", "tx0", SDMA_FILTER_PARAM(35) },
-	{ "omap2_mcspi.0", "rx0", SDMA_FILTER_PARAM(36) },
-	{ "omap2_mcspi.0", "tx1", SDMA_FILTER_PARAM(37) },
-	{ "omap2_mcspi.0", "rx1", SDMA_FILTER_PARAM(38) },
-	{ "omap2_mcspi.0", "tx2", SDMA_FILTER_PARAM(39) },
-	{ "omap2_mcspi.0", "rx2", SDMA_FILTER_PARAM(40) },
-	{ "omap2_mcspi.0", "tx3", SDMA_FILTER_PARAM(41) },
-	{ "omap2_mcspi.0", "rx3", SDMA_FILTER_PARAM(42) },
-	{ "omap2_mcspi.1", "tx0", SDMA_FILTER_PARAM(43) },
-	{ "omap2_mcspi.1", "rx0", SDMA_FILTER_PARAM(44) },
-	{ "omap2_mcspi.1", "tx1", SDMA_FILTER_PARAM(45) },
-	{ "omap2_mcspi.1", "rx1", SDMA_FILTER_PARAM(46) },
-	{ "omap_hsmmc.1", "tx", SDMA_FILTER_PARAM(47) },
-	{ "omap_hsmmc.1", "rx", SDMA_FILTER_PARAM(48) },
-	{ "omap_uart.0", "tx", SDMA_FILTER_PARAM(49) },
-	{ "omap_uart.0", "rx", SDMA_FILTER_PARAM(50) },
-	{ "omap_uart.1", "tx", SDMA_FILTER_PARAM(51) },
-	{ "omap_uart.1", "rx", SDMA_FILTER_PARAM(52) },
-	{ "omap_uart.2", "tx", SDMA_FILTER_PARAM(53) },
-	{ "omap_uart.2", "rx", SDMA_FILTER_PARAM(54) },
-	{ "omap_hsmmc.0", "tx", SDMA_FILTER_PARAM(61) },
-	{ "omap_hsmmc.0", "rx", SDMA_FILTER_PARAM(62) },
-	{ "omap-aes", "tx", SDMA_FILTER_PARAM(65) },
-	{ "omap-aes", "rx", SDMA_FILTER_PARAM(66) },
-	{ "omap-sham", "rx", SDMA_FILTER_PARAM(69) },
-	{ "omap2_mcspi.3", "tx0", SDMA_FILTER_PARAM(70) },
-	{ "omap2_mcspi.3", "rx0", SDMA_FILTER_PARAM(71) },
-	{ "omap_hsmmc.2", "tx", SDMA_FILTER_PARAM(77) },
-	{ "omap_hsmmc.2", "rx", SDMA_FILTER_PARAM(78) },
-	{ "omap_uart.3", "tx", SDMA_FILTER_PARAM(81) },
-	{ "omap_uart.3", "rx", SDMA_FILTER_PARAM(82) },
-};
-
 static struct omap_system_dma_plat_info dma_plat_info __initdata = {
 	.reg_map	= reg_map,
 	.channel_stride	= 0x60,
@@ -334,14 +232,9 @@ static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused)
 	p.dma_attr = (struct omap_dma_dev_attr *)oh->dev_attr;
 	p.errata = configure_dma_errata();
 
+	/* REVISIT: Remove after v4.13 with a follow-up patch */
 	if (!of_have_populated_dt()) {
 		if (soc_is_omap24xx()) {
-			p.slave_map = omap24xx_sdma_map;
-			p.slavecnt = ARRAY_SIZE(omap24xx_sdma_map);
-		} else if (soc_is_omap34xx() || soc_is_omap3630()) {
-			p.slave_map = omap3xxx_sdma_map;
-			p.slavecnt = ARRAY_SIZE(omap3xxx_sdma_map);
-		} else {
 			pr_err("%s: The legacy DMA map is not provided!\n",
 			       __func__);
 			return -ENODEV;
@@ -389,21 +282,7 @@ static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused)
 
 static int __init omap2_system_dma_init(void)
 {
-	struct platform_device *pdev;
-	int res;
-
-	res = omap_hwmod_for_each_by_class("dma",
+	return omap_hwmod_for_each_by_class("dma",
 			omap2_system_dma_init_dev, NULL);
-	if (res)
-		return res;
-
-	if (of_have_populated_dt())
-		return res;
-
-	pdev = platform_device_register_full(&omap_dma_dev_info);
-	if (IS_ERR(pdev))
-		return PTR_ERR(pdev);
-
-	return res;
 }
 omap_arch_initcall(omap2_system_dma_init);
-- 
2.13.0

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 07/11] ARM: OMAP2+: Remove unused legacy code for DMA
  2017-06-08  9:56         ` Tony Lindgren
@ 2017-06-08 10:37           ` Peter Ujfalusi
  -1 siblings, 0 replies; 56+ messages in thread
From: Peter Ujfalusi @ 2017-06-08 10:37 UTC (permalink / raw)
  To: Tony Lindgren, Bin Liu; +Cc: linux-omap, linux-arm-kernel

Tony,

On 2017-06-08 12:56, Tony Lindgren wrote:
> * Tony Lindgren <tony@atomide.com> [170608 01:28]:
>> * Peter Ujfalusi <peter.ujfalusi@ti.com> [170607 23:29]:
>>>
>>> This will conflict with the changes introduced by the tusb6010 DMAengine
>>> conversion:
>>> https://patchwork.kernel.org/patch/9734219/
>>
>> Oops forgot about that one. I'll take a look if it makes sense
>> to leave the braces for now to avoid a merge conflict.
>>
>>> with this patch I think the omap24xx_sdma_map and omap3xxx_sdma_map can
>>> also be removed, but we need to keep the omap24xx_sdma_dt_map for now
>>> till we have proper DT support for tusb.
>>
>> OK good point, will check.
> 
> Here's this one updated.
> 
> Regards,
> 
> Tony
> 
> 8< ------------------
> From tony Mon Sep 17 00:00:00 2001
> From: Tony Lindgren <tony@atomide.com>
> Date: Wed, 31 May 2017 15:51:35 -0700
> Subject: [PATCH] ARM: OMAP2+: Remove unused legacy code for DMA
> 
> We are now booting all mach-omap2 in device tree only mode.
> Any code that is only called in legacy boot mode where
> of_have_populated_dt() is not set is safe to remove now.
> 
> Let's leave the dummy omap2_system_dma_init_dev() check
> in place for now to avoid a pointless merge conflict with
> tusb6010 dmaengine conversion as pointed out by Peter
> Ujfalusi <peter.ujfalusi@ti.com>.

unfortunately we still have conflict as the
https://patchwork.kernel.org/patch/9734219/
adds entries to omap24xx_sdma_map[] for - back then - valid non DT boot
support.

I have rebased and reworked my patch locally on top of your v1, but
things must go in in a certain order to avoid conflict.

The tsub conversion series in not yet in linux-next, but afaik Bin
already applied it to somewhere.
Leave the mach-omap2/dma.c cleanup for -rc1?

> 
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> ---
>  arch/arm/mach-omap2/dma.c | 125 +---------------------------------------------
>  1 file changed, 2 insertions(+), 123 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/dma.c b/arch/arm/mach-omap2/dma.c
> --- a/arch/arm/mach-omap2/dma.c
> +++ b/arch/arm/mach-omap2/dma.c
> @@ -204,108 +204,6 @@ static unsigned configure_dma_errata(void)
>  	return errata;
>  }
>  
> -static const struct dma_slave_map omap24xx_sdma_map[] = {
> -	{ "omap-gpmc", "rxtx", SDMA_FILTER_PARAM(4) },
> -	{ "omap-aes", "tx", SDMA_FILTER_PARAM(9) },
> -	{ "omap-aes", "rx", SDMA_FILTER_PARAM(10) },
> -	{ "omap-sham", "rx", SDMA_FILTER_PARAM(13) },
> -	{ "omap2_mcspi.2", "tx0", SDMA_FILTER_PARAM(15) },
> -	{ "omap2_mcspi.2", "rx0", SDMA_FILTER_PARAM(16) },
> -	{ "omap-mcbsp.3", "tx", SDMA_FILTER_PARAM(17) },
> -	{ "omap-mcbsp.3", "rx", SDMA_FILTER_PARAM(18) },
> -	{ "omap-mcbsp.4", "tx", SDMA_FILTER_PARAM(19) },
> -	{ "omap-mcbsp.4", "rx", SDMA_FILTER_PARAM(20) },
> -	{ "omap-mcbsp.5", "tx", SDMA_FILTER_PARAM(21) },
> -	{ "omap-mcbsp.5", "rx", SDMA_FILTER_PARAM(22) },
> -	{ "omap2_mcspi.2", "tx1", SDMA_FILTER_PARAM(23) },
> -	{ "omap2_mcspi.2", "rx1", SDMA_FILTER_PARAM(24) },
> -	{ "omap_i2c.1", "tx", SDMA_FILTER_PARAM(27) },
> -	{ "omap_i2c.1", "rx", SDMA_FILTER_PARAM(28) },
> -	{ "omap_i2c.2", "tx", SDMA_FILTER_PARAM(29) },
> -	{ "omap_i2c.2", "rx", SDMA_FILTER_PARAM(30) },
> -	{ "omap-mcbsp.1", "tx", SDMA_FILTER_PARAM(31) },
> -	{ "omap-mcbsp.1", "rx", SDMA_FILTER_PARAM(32) },
> -	{ "omap-mcbsp.2", "tx", SDMA_FILTER_PARAM(33) },
> -	{ "omap-mcbsp.2", "rx", SDMA_FILTER_PARAM(34) },
> -	{ "omap2_mcspi.0", "tx0", SDMA_FILTER_PARAM(35) },
> -	{ "omap2_mcspi.0", "rx0", SDMA_FILTER_PARAM(36) },
> -	{ "omap2_mcspi.0", "tx1", SDMA_FILTER_PARAM(37) },
> -	{ "omap2_mcspi.0", "rx1", SDMA_FILTER_PARAM(38) },
> -	{ "omap2_mcspi.0", "tx2", SDMA_FILTER_PARAM(39) },
> -	{ "omap2_mcspi.0", "rx2", SDMA_FILTER_PARAM(40) },
> -	{ "omap2_mcspi.0", "tx3", SDMA_FILTER_PARAM(41) },
> -	{ "omap2_mcspi.0", "rx3", SDMA_FILTER_PARAM(42) },
> -	{ "omap2_mcspi.1", "tx0", SDMA_FILTER_PARAM(43) },
> -	{ "omap2_mcspi.1", "rx0", SDMA_FILTER_PARAM(44) },
> -	{ "omap2_mcspi.1", "tx1", SDMA_FILTER_PARAM(45) },
> -	{ "omap2_mcspi.1", "rx1", SDMA_FILTER_PARAM(46) },
> -	{ "omap_hsmmc.1", "tx", SDMA_FILTER_PARAM(47) },
> -	{ "omap_hsmmc.1", "rx", SDMA_FILTER_PARAM(48) },
> -	{ "omap_uart.0", "tx", SDMA_FILTER_PARAM(49) },
> -	{ "omap_uart.0", "rx", SDMA_FILTER_PARAM(50) },
> -	{ "omap_uart.1", "tx", SDMA_FILTER_PARAM(51) },
> -	{ "omap_uart.1", "rx", SDMA_FILTER_PARAM(52) },
> -	{ "omap_uart.2", "tx", SDMA_FILTER_PARAM(53) },
> -	{ "omap_uart.2", "rx", SDMA_FILTER_PARAM(54) },
> -	{ "omap_hsmmc.0", "tx", SDMA_FILTER_PARAM(61) },
> -	{ "omap_hsmmc.0", "rx", SDMA_FILTER_PARAM(62) },
> -};
> -
> -static const struct dma_slave_map omap3xxx_sdma_map[] = {
> -	{ "omap-gpmc", "rxtx", SDMA_FILTER_PARAM(4) },
> -	{ "omap2_mcspi.2", "tx0", SDMA_FILTER_PARAM(15) },
> -	{ "omap2_mcspi.2", "rx0", SDMA_FILTER_PARAM(16) },
> -	{ "omap-mcbsp.3", "tx", SDMA_FILTER_PARAM(17) },
> -	{ "omap-mcbsp.3", "rx", SDMA_FILTER_PARAM(18) },
> -	{ "omap-mcbsp.4", "tx", SDMA_FILTER_PARAM(19) },
> -	{ "omap-mcbsp.4", "rx", SDMA_FILTER_PARAM(20) },
> -	{ "omap-mcbsp.5", "tx", SDMA_FILTER_PARAM(21) },
> -	{ "omap-mcbsp.5", "rx", SDMA_FILTER_PARAM(22) },
> -	{ "omap2_mcspi.2", "tx1", SDMA_FILTER_PARAM(23) },
> -	{ "omap2_mcspi.2", "rx1", SDMA_FILTER_PARAM(24) },
> -	{ "omap_i2c.3", "tx", SDMA_FILTER_PARAM(25) },
> -	{ "omap_i2c.3", "rx", SDMA_FILTER_PARAM(26) },
> -	{ "omap_i2c.1", "tx", SDMA_FILTER_PARAM(27) },
> -	{ "omap_i2c.1", "rx", SDMA_FILTER_PARAM(28) },
> -	{ "omap_i2c.2", "tx", SDMA_FILTER_PARAM(29) },
> -	{ "omap_i2c.2", "rx", SDMA_FILTER_PARAM(30) },
> -	{ "omap-mcbsp.1", "tx", SDMA_FILTER_PARAM(31) },
> -	{ "omap-mcbsp.1", "rx", SDMA_FILTER_PARAM(32) },
> -	{ "omap-mcbsp.2", "tx", SDMA_FILTER_PARAM(33) },
> -	{ "omap-mcbsp.2", "rx", SDMA_FILTER_PARAM(34) },
> -	{ "omap2_mcspi.0", "tx0", SDMA_FILTER_PARAM(35) },
> -	{ "omap2_mcspi.0", "rx0", SDMA_FILTER_PARAM(36) },
> -	{ "omap2_mcspi.0", "tx1", SDMA_FILTER_PARAM(37) },
> -	{ "omap2_mcspi.0", "rx1", SDMA_FILTER_PARAM(38) },
> -	{ "omap2_mcspi.0", "tx2", SDMA_FILTER_PARAM(39) },
> -	{ "omap2_mcspi.0", "rx2", SDMA_FILTER_PARAM(40) },
> -	{ "omap2_mcspi.0", "tx3", SDMA_FILTER_PARAM(41) },
> -	{ "omap2_mcspi.0", "rx3", SDMA_FILTER_PARAM(42) },
> -	{ "omap2_mcspi.1", "tx0", SDMA_FILTER_PARAM(43) },
> -	{ "omap2_mcspi.1", "rx0", SDMA_FILTER_PARAM(44) },
> -	{ "omap2_mcspi.1", "tx1", SDMA_FILTER_PARAM(45) },
> -	{ "omap2_mcspi.1", "rx1", SDMA_FILTER_PARAM(46) },
> -	{ "omap_hsmmc.1", "tx", SDMA_FILTER_PARAM(47) },
> -	{ "omap_hsmmc.1", "rx", SDMA_FILTER_PARAM(48) },
> -	{ "omap_uart.0", "tx", SDMA_FILTER_PARAM(49) },
> -	{ "omap_uart.0", "rx", SDMA_FILTER_PARAM(50) },
> -	{ "omap_uart.1", "tx", SDMA_FILTER_PARAM(51) },
> -	{ "omap_uart.1", "rx", SDMA_FILTER_PARAM(52) },
> -	{ "omap_uart.2", "tx", SDMA_FILTER_PARAM(53) },
> -	{ "omap_uart.2", "rx", SDMA_FILTER_PARAM(54) },
> -	{ "omap_hsmmc.0", "tx", SDMA_FILTER_PARAM(61) },
> -	{ "omap_hsmmc.0", "rx", SDMA_FILTER_PARAM(62) },
> -	{ "omap-aes", "tx", SDMA_FILTER_PARAM(65) },
> -	{ "omap-aes", "rx", SDMA_FILTER_PARAM(66) },
> -	{ "omap-sham", "rx", SDMA_FILTER_PARAM(69) },
> -	{ "omap2_mcspi.3", "tx0", SDMA_FILTER_PARAM(70) },
> -	{ "omap2_mcspi.3", "rx0", SDMA_FILTER_PARAM(71) },
> -	{ "omap_hsmmc.2", "tx", SDMA_FILTER_PARAM(77) },
> -	{ "omap_hsmmc.2", "rx", SDMA_FILTER_PARAM(78) },
> -	{ "omap_uart.3", "tx", SDMA_FILTER_PARAM(81) },
> -	{ "omap_uart.3", "rx", SDMA_FILTER_PARAM(82) },
> -};
> -
>  static struct omap_system_dma_plat_info dma_plat_info __initdata = {
>  	.reg_map	= reg_map,
>  	.channel_stride	= 0x60,
> @@ -334,14 +232,9 @@ static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused)
>  	p.dma_attr = (struct omap_dma_dev_attr *)oh->dev_attr;
>  	p.errata = configure_dma_errata();
>  
> +	/* REVISIT: Remove after v4.13 with a follow-up patch */
>  	if (!of_have_populated_dt()) {
>  		if (soc_is_omap24xx()) {
> -			p.slave_map = omap24xx_sdma_map;
> -			p.slavecnt = ARRAY_SIZE(omap24xx_sdma_map);
> -		} else if (soc_is_omap34xx() || soc_is_omap3630()) {
> -			p.slave_map = omap3xxx_sdma_map;
> -			p.slavecnt = ARRAY_SIZE(omap3xxx_sdma_map);
> -		} else {
>  			pr_err("%s: The legacy DMA map is not provided!\n",
>  			       __func__);
>  			return -ENODEV;
> @@ -389,21 +282,7 @@ static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused)
>  
>  static int __init omap2_system_dma_init(void)
>  {
> -	struct platform_device *pdev;
> -	int res;
> -
> -	res = omap_hwmod_for_each_by_class("dma",
> +	return omap_hwmod_for_each_by_class("dma",
>  			omap2_system_dma_init_dev, NULL);
> -	if (res)
> -		return res;
> -
> -	if (of_have_populated_dt())
> -		return res;
> -
> -	pdev = platform_device_register_full(&omap_dma_dev_info);
> -	if (IS_ERR(pdev))
> -		return PTR_ERR(pdev);
> -
> -	return res;
>  }
>  omap_arch_initcall(omap2_system_dma_init);
> 

- Péter

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 07/11] ARM: OMAP2+: Remove unused legacy code for DMA
@ 2017-06-08 10:37           ` Peter Ujfalusi
  0 siblings, 0 replies; 56+ messages in thread
From: Peter Ujfalusi @ 2017-06-08 10:37 UTC (permalink / raw)
  To: linux-arm-kernel

Tony,

On 2017-06-08 12:56, Tony Lindgren wrote:
> * Tony Lindgren <tony@atomide.com> [170608 01:28]:
>> * Peter Ujfalusi <peter.ujfalusi@ti.com> [170607 23:29]:
>>>
>>> This will conflict with the changes introduced by the tusb6010 DMAengine
>>> conversion:
>>> https://patchwork.kernel.org/patch/9734219/
>>
>> Oops forgot about that one. I'll take a look if it makes sense
>> to leave the braces for now to avoid a merge conflict.
>>
>>> with this patch I think the omap24xx_sdma_map and omap3xxx_sdma_map can
>>> also be removed, but we need to keep the omap24xx_sdma_dt_map for now
>>> till we have proper DT support for tusb.
>>
>> OK good point, will check.
> 
> Here's this one updated.
> 
> Regards,
> 
> Tony
> 
> 8< ------------------
> From tony Mon Sep 17 00:00:00 2001
> From: Tony Lindgren <tony@atomide.com>
> Date: Wed, 31 May 2017 15:51:35 -0700
> Subject: [PATCH] ARM: OMAP2+: Remove unused legacy code for DMA
> 
> We are now booting all mach-omap2 in device tree only mode.
> Any code that is only called in legacy boot mode where
> of_have_populated_dt() is not set is safe to remove now.
> 
> Let's leave the dummy omap2_system_dma_init_dev() check
> in place for now to avoid a pointless merge conflict with
> tusb6010 dmaengine conversion as pointed out by Peter
> Ujfalusi <peter.ujfalusi@ti.com>.

unfortunately we still have conflict as the
https://patchwork.kernel.org/patch/9734219/
adds entries to omap24xx_sdma_map[] for - back then - valid non DT boot
support.

I have rebased and reworked my patch locally on top of your v1, but
things must go in in a certain order to avoid conflict.

The tsub conversion series in not yet in linux-next, but afaik Bin
already applied it to somewhere.
Leave the mach-omap2/dma.c cleanup for -rc1?

> 
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> ---
>  arch/arm/mach-omap2/dma.c | 125 +---------------------------------------------
>  1 file changed, 2 insertions(+), 123 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/dma.c b/arch/arm/mach-omap2/dma.c
> --- a/arch/arm/mach-omap2/dma.c
> +++ b/arch/arm/mach-omap2/dma.c
> @@ -204,108 +204,6 @@ static unsigned configure_dma_errata(void)
>  	return errata;
>  }
>  
> -static const struct dma_slave_map omap24xx_sdma_map[] = {
> -	{ "omap-gpmc", "rxtx", SDMA_FILTER_PARAM(4) },
> -	{ "omap-aes", "tx", SDMA_FILTER_PARAM(9) },
> -	{ "omap-aes", "rx", SDMA_FILTER_PARAM(10) },
> -	{ "omap-sham", "rx", SDMA_FILTER_PARAM(13) },
> -	{ "omap2_mcspi.2", "tx0", SDMA_FILTER_PARAM(15) },
> -	{ "omap2_mcspi.2", "rx0", SDMA_FILTER_PARAM(16) },
> -	{ "omap-mcbsp.3", "tx", SDMA_FILTER_PARAM(17) },
> -	{ "omap-mcbsp.3", "rx", SDMA_FILTER_PARAM(18) },
> -	{ "omap-mcbsp.4", "tx", SDMA_FILTER_PARAM(19) },
> -	{ "omap-mcbsp.4", "rx", SDMA_FILTER_PARAM(20) },
> -	{ "omap-mcbsp.5", "tx", SDMA_FILTER_PARAM(21) },
> -	{ "omap-mcbsp.5", "rx", SDMA_FILTER_PARAM(22) },
> -	{ "omap2_mcspi.2", "tx1", SDMA_FILTER_PARAM(23) },
> -	{ "omap2_mcspi.2", "rx1", SDMA_FILTER_PARAM(24) },
> -	{ "omap_i2c.1", "tx", SDMA_FILTER_PARAM(27) },
> -	{ "omap_i2c.1", "rx", SDMA_FILTER_PARAM(28) },
> -	{ "omap_i2c.2", "tx", SDMA_FILTER_PARAM(29) },
> -	{ "omap_i2c.2", "rx", SDMA_FILTER_PARAM(30) },
> -	{ "omap-mcbsp.1", "tx", SDMA_FILTER_PARAM(31) },
> -	{ "omap-mcbsp.1", "rx", SDMA_FILTER_PARAM(32) },
> -	{ "omap-mcbsp.2", "tx", SDMA_FILTER_PARAM(33) },
> -	{ "omap-mcbsp.2", "rx", SDMA_FILTER_PARAM(34) },
> -	{ "omap2_mcspi.0", "tx0", SDMA_FILTER_PARAM(35) },
> -	{ "omap2_mcspi.0", "rx0", SDMA_FILTER_PARAM(36) },
> -	{ "omap2_mcspi.0", "tx1", SDMA_FILTER_PARAM(37) },
> -	{ "omap2_mcspi.0", "rx1", SDMA_FILTER_PARAM(38) },
> -	{ "omap2_mcspi.0", "tx2", SDMA_FILTER_PARAM(39) },
> -	{ "omap2_mcspi.0", "rx2", SDMA_FILTER_PARAM(40) },
> -	{ "omap2_mcspi.0", "tx3", SDMA_FILTER_PARAM(41) },
> -	{ "omap2_mcspi.0", "rx3", SDMA_FILTER_PARAM(42) },
> -	{ "omap2_mcspi.1", "tx0", SDMA_FILTER_PARAM(43) },
> -	{ "omap2_mcspi.1", "rx0", SDMA_FILTER_PARAM(44) },
> -	{ "omap2_mcspi.1", "tx1", SDMA_FILTER_PARAM(45) },
> -	{ "omap2_mcspi.1", "rx1", SDMA_FILTER_PARAM(46) },
> -	{ "omap_hsmmc.1", "tx", SDMA_FILTER_PARAM(47) },
> -	{ "omap_hsmmc.1", "rx", SDMA_FILTER_PARAM(48) },
> -	{ "omap_uart.0", "tx", SDMA_FILTER_PARAM(49) },
> -	{ "omap_uart.0", "rx", SDMA_FILTER_PARAM(50) },
> -	{ "omap_uart.1", "tx", SDMA_FILTER_PARAM(51) },
> -	{ "omap_uart.1", "rx", SDMA_FILTER_PARAM(52) },
> -	{ "omap_uart.2", "tx", SDMA_FILTER_PARAM(53) },
> -	{ "omap_uart.2", "rx", SDMA_FILTER_PARAM(54) },
> -	{ "omap_hsmmc.0", "tx", SDMA_FILTER_PARAM(61) },
> -	{ "omap_hsmmc.0", "rx", SDMA_FILTER_PARAM(62) },
> -};
> -
> -static const struct dma_slave_map omap3xxx_sdma_map[] = {
> -	{ "omap-gpmc", "rxtx", SDMA_FILTER_PARAM(4) },
> -	{ "omap2_mcspi.2", "tx0", SDMA_FILTER_PARAM(15) },
> -	{ "omap2_mcspi.2", "rx0", SDMA_FILTER_PARAM(16) },
> -	{ "omap-mcbsp.3", "tx", SDMA_FILTER_PARAM(17) },
> -	{ "omap-mcbsp.3", "rx", SDMA_FILTER_PARAM(18) },
> -	{ "omap-mcbsp.4", "tx", SDMA_FILTER_PARAM(19) },
> -	{ "omap-mcbsp.4", "rx", SDMA_FILTER_PARAM(20) },
> -	{ "omap-mcbsp.5", "tx", SDMA_FILTER_PARAM(21) },
> -	{ "omap-mcbsp.5", "rx", SDMA_FILTER_PARAM(22) },
> -	{ "omap2_mcspi.2", "tx1", SDMA_FILTER_PARAM(23) },
> -	{ "omap2_mcspi.2", "rx1", SDMA_FILTER_PARAM(24) },
> -	{ "omap_i2c.3", "tx", SDMA_FILTER_PARAM(25) },
> -	{ "omap_i2c.3", "rx", SDMA_FILTER_PARAM(26) },
> -	{ "omap_i2c.1", "tx", SDMA_FILTER_PARAM(27) },
> -	{ "omap_i2c.1", "rx", SDMA_FILTER_PARAM(28) },
> -	{ "omap_i2c.2", "tx", SDMA_FILTER_PARAM(29) },
> -	{ "omap_i2c.2", "rx", SDMA_FILTER_PARAM(30) },
> -	{ "omap-mcbsp.1", "tx", SDMA_FILTER_PARAM(31) },
> -	{ "omap-mcbsp.1", "rx", SDMA_FILTER_PARAM(32) },
> -	{ "omap-mcbsp.2", "tx", SDMA_FILTER_PARAM(33) },
> -	{ "omap-mcbsp.2", "rx", SDMA_FILTER_PARAM(34) },
> -	{ "omap2_mcspi.0", "tx0", SDMA_FILTER_PARAM(35) },
> -	{ "omap2_mcspi.0", "rx0", SDMA_FILTER_PARAM(36) },
> -	{ "omap2_mcspi.0", "tx1", SDMA_FILTER_PARAM(37) },
> -	{ "omap2_mcspi.0", "rx1", SDMA_FILTER_PARAM(38) },
> -	{ "omap2_mcspi.0", "tx2", SDMA_FILTER_PARAM(39) },
> -	{ "omap2_mcspi.0", "rx2", SDMA_FILTER_PARAM(40) },
> -	{ "omap2_mcspi.0", "tx3", SDMA_FILTER_PARAM(41) },
> -	{ "omap2_mcspi.0", "rx3", SDMA_FILTER_PARAM(42) },
> -	{ "omap2_mcspi.1", "tx0", SDMA_FILTER_PARAM(43) },
> -	{ "omap2_mcspi.1", "rx0", SDMA_FILTER_PARAM(44) },
> -	{ "omap2_mcspi.1", "tx1", SDMA_FILTER_PARAM(45) },
> -	{ "omap2_mcspi.1", "rx1", SDMA_FILTER_PARAM(46) },
> -	{ "omap_hsmmc.1", "tx", SDMA_FILTER_PARAM(47) },
> -	{ "omap_hsmmc.1", "rx", SDMA_FILTER_PARAM(48) },
> -	{ "omap_uart.0", "tx", SDMA_FILTER_PARAM(49) },
> -	{ "omap_uart.0", "rx", SDMA_FILTER_PARAM(50) },
> -	{ "omap_uart.1", "tx", SDMA_FILTER_PARAM(51) },
> -	{ "omap_uart.1", "rx", SDMA_FILTER_PARAM(52) },
> -	{ "omap_uart.2", "tx", SDMA_FILTER_PARAM(53) },
> -	{ "omap_uart.2", "rx", SDMA_FILTER_PARAM(54) },
> -	{ "omap_hsmmc.0", "tx", SDMA_FILTER_PARAM(61) },
> -	{ "omap_hsmmc.0", "rx", SDMA_FILTER_PARAM(62) },
> -	{ "omap-aes", "tx", SDMA_FILTER_PARAM(65) },
> -	{ "omap-aes", "rx", SDMA_FILTER_PARAM(66) },
> -	{ "omap-sham", "rx", SDMA_FILTER_PARAM(69) },
> -	{ "omap2_mcspi.3", "tx0", SDMA_FILTER_PARAM(70) },
> -	{ "omap2_mcspi.3", "rx0", SDMA_FILTER_PARAM(71) },
> -	{ "omap_hsmmc.2", "tx", SDMA_FILTER_PARAM(77) },
> -	{ "omap_hsmmc.2", "rx", SDMA_FILTER_PARAM(78) },
> -	{ "omap_uart.3", "tx", SDMA_FILTER_PARAM(81) },
> -	{ "omap_uart.3", "rx", SDMA_FILTER_PARAM(82) },
> -};
> -
>  static struct omap_system_dma_plat_info dma_plat_info __initdata = {
>  	.reg_map	= reg_map,
>  	.channel_stride	= 0x60,
> @@ -334,14 +232,9 @@ static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused)
>  	p.dma_attr = (struct omap_dma_dev_attr *)oh->dev_attr;
>  	p.errata = configure_dma_errata();
>  
> +	/* REVISIT: Remove after v4.13 with a follow-up patch */
>  	if (!of_have_populated_dt()) {
>  		if (soc_is_omap24xx()) {
> -			p.slave_map = omap24xx_sdma_map;
> -			p.slavecnt = ARRAY_SIZE(omap24xx_sdma_map);
> -		} else if (soc_is_omap34xx() || soc_is_omap3630()) {
> -			p.slave_map = omap3xxx_sdma_map;
> -			p.slavecnt = ARRAY_SIZE(omap3xxx_sdma_map);
> -		} else {
>  			pr_err("%s: The legacy DMA map is not provided!\n",
>  			       __func__);
>  			return -ENODEV;
> @@ -389,21 +282,7 @@ static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused)
>  
>  static int __init omap2_system_dma_init(void)
>  {
> -	struct platform_device *pdev;
> -	int res;
> -
> -	res = omap_hwmod_for_each_by_class("dma",
> +	return omap_hwmod_for_each_by_class("dma",
>  			omap2_system_dma_init_dev, NULL);
> -	if (res)
> -		return res;
> -
> -	if (of_have_populated_dt())
> -		return res;
> -
> -	pdev = platform_device_register_full(&omap_dma_dev_info);
> -	if (IS_ERR(pdev))
> -		return PTR_ERR(pdev);
> -
> -	return res;
>  }
>  omap_arch_initcall(omap2_system_dma_init);
> 

- P?ter

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 07/11] ARM: OMAP2+: Remove unused legacy code for DMA
  2017-06-08 10:37           ` Peter Ujfalusi
@ 2017-06-08 10:45             ` Tony Lindgren
  -1 siblings, 0 replies; 56+ messages in thread
From: Tony Lindgren @ 2017-06-08 10:45 UTC (permalink / raw)
  To: Peter Ujfalusi; +Cc: linux-omap, Bin Liu, linux-arm-kernel

* Peter Ujfalusi <peter.ujfalusi@ti.com> [170608 03:40]:
> unfortunately we still have conflict as the
> https://patchwork.kernel.org/patch/9734219/
> adds entries to omap24xx_sdma_map[] for - back then - valid non DT boot
> support.
> 
> I have rebased and reworked my patch locally on top of your v1, but
> things must go in in a certain order to avoid conflict.
> 
> The tsub conversion series in not yet in linux-next, but afaik Bin
> already applied it to somewhere.
> Leave the mach-omap2/dma.c cleanup for -rc1?

OK I'll save this for later then.

Regards,

Tony

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 07/11] ARM: OMAP2+: Remove unused legacy code for DMA
@ 2017-06-08 10:45             ` Tony Lindgren
  0 siblings, 0 replies; 56+ messages in thread
From: Tony Lindgren @ 2017-06-08 10:45 UTC (permalink / raw)
  To: linux-arm-kernel

* Peter Ujfalusi <peter.ujfalusi@ti.com> [170608 03:40]:
> unfortunately we still have conflict as the
> https://patchwork.kernel.org/patch/9734219/
> adds entries to omap24xx_sdma_map[] for - back then - valid non DT boot
> support.
> 
> I have rebased and reworked my patch locally on top of your v1, but
> things must go in in a certain order to avoid conflict.
> 
> The tsub conversion series in not yet in linux-next, but afaik Bin
> already applied it to somewhere.
> Leave the mach-omap2/dma.c cleanup for -rc1?

OK I'll save this for later then.

Regards,

Tony

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 04/11] ARM: OMAP2+: Remove unused legacy code for device init
  2017-06-08  9:47         ` Tony Lindgren
@ 2017-06-08 10:55           ` Sebastian Reichel
  -1 siblings, 0 replies; 56+ messages in thread
From: Sebastian Reichel @ 2017-06-08 10:55 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: linux-omap, linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 6620 bytes --]

Hi,

On Thu, Jun 08, 2017 at 02:47:12AM -0700, Tony Lindgren wrote:
> * Tony Lindgren <tony@atomide.com> [170608 01:32]:
> > * Sebastian Reichel <sre@kernel.org> [170607 15:30]:
> > > I guess you can drop omap2_init_devices() completly?
> > 
> > We still have omap_init_sti() left there, but it's
> > just static inline void omap_init_sti(void) {} :)
> > 
> > So yeah will remove that too.
> 
> Here's this one updated.

Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>

Defines for L3_MODULES_MAX_LEN + L3_MODULES and most of the includes
could be dropped now.

-- Sebastian

> 8< -----------------
> From tony Mon Sep 17 00:00:00 2001
> From: Tony Lindgren <tony@atomide.com>
> Date: Wed, 31 May 2017 15:51:32 -0700
> Subject: [PATCH] ARM: OMAP2+: Remove unused legacy code for device init
> 
> We are now booting all mach-omap2 in device tree only mode.
> Any code that is only called in legacy boot mode where
> of_have_populated_dt() is not set is safe to remove now.
> 
> Note that omap_init_sti() won't do anything so we can
> remove omap2_init_devices() as pointed out by Sebastian
> Reichel <sebastian.reichel@collabora.co.uk>.
> 
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> ---
>  arch/arm/mach-omap2/devices.c | 175 ------------------------------------------
>  1 file changed, 175 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
> --- a/arch/arm/mach-omap2/devices.c
> +++ b/arch/arm/mach-omap2/devices.c
> @@ -36,130 +36,6 @@
>  #define L3_MODULES_MAX_LEN 12
>  #define L3_MODULES 3
>  
> -static int __init omap3_l3_init(void)
> -{
> -	struct omap_hwmod *oh;
> -	struct platform_device *pdev;
> -	char oh_name[L3_MODULES_MAX_LEN];
> -
> -	/*
> -	 * To avoid code running on other OMAPs in
> -	 * multi-omap builds
> -	 */
> -	if (!(cpu_is_omap34xx()) || of_have_populated_dt())
> -		return -ENODEV;
> -
> -	snprintf(oh_name, L3_MODULES_MAX_LEN, "l3_main");
> -
> -	oh = omap_hwmod_lookup(oh_name);
> -
> -	if (!oh)
> -		pr_err("could not look up %s\n", oh_name);
> -
> -	pdev = omap_device_build("omap_l3_smx", 0, oh, NULL, 0);
> -
> -	WARN(IS_ERR(pdev), "could not build omap_device for %s\n", oh_name);
> -
> -	return PTR_ERR_OR_ZERO(pdev);
> -}
> -omap_postcore_initcall(omap3_l3_init);
> -
> -static inline void omap_init_sti(void) {}
> -
> -#if IS_ENABLED(CONFIG_SPI_OMAP24XX)
> -
> -#include <linux/platform_data/spi-omap2-mcspi.h>
> -
> -static int __init omap_mcspi_init(struct omap_hwmod *oh, void *unused)
> -{
> -	struct platform_device *pdev;
> -	char *name = "omap2_mcspi";
> -	struct omap2_mcspi_platform_config *pdata;
> -	static int spi_num;
> -	struct omap2_mcspi_dev_attr *mcspi_attrib = oh->dev_attr;
> -
> -	pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
> -	if (!pdata) {
> -		pr_err("Memory allocation for McSPI device failed\n");
> -		return -ENOMEM;
> -	}
> -
> -	pdata->num_cs = mcspi_attrib->num_chipselect;
> -	switch (oh->class->rev) {
> -	case OMAP2_MCSPI_REV:
> -	case OMAP3_MCSPI_REV:
> -			pdata->regs_offset = 0;
> -			break;
> -	case OMAP4_MCSPI_REV:
> -			pdata->regs_offset = OMAP4_MCSPI_REG_OFFSET;
> -			break;
> -	default:
> -			pr_err("Invalid McSPI Revision value\n");
> -			kfree(pdata);
> -			return -EINVAL;
> -	}
> -
> -	spi_num++;
> -	pdev = omap_device_build(name, spi_num, oh, pdata, sizeof(*pdata));
> -	WARN(IS_ERR(pdev), "Can't build omap_device for %s:%s\n",
> -				name, oh->name);
> -	kfree(pdata);
> -	return 0;
> -}
> -
> -static void omap_init_mcspi(void)
> -{
> -	omap_hwmod_for_each_by_class("mcspi", omap_mcspi_init, NULL);
> -}
> -
> -#else
> -static inline void omap_init_mcspi(void) {}
> -#endif
> -
> -/**
> - * omap_init_rng - bind the RNG hwmod to the RNG omap_device
> - *
> - * Bind the RNG hwmod to the RNG omap_device.  No return value.
> - */
> -static void __init omap_init_rng(void)
> -{
> -	struct omap_hwmod *oh;
> -	struct platform_device *pdev;
> -
> -	oh = omap_hwmod_lookup("rng");
> -	if (!oh)
> -		return;
> -
> -	pdev = omap_device_build("omap_rng", -1, oh, NULL, 0);
> -	WARN(IS_ERR(pdev), "Can't build omap_device for omap_rng\n");
> -}
> -
> -static void __init omap_init_sham(void)
> -{
> -	struct omap_hwmod *oh;
> -	struct platform_device *pdev;
> -
> -	oh = omap_hwmod_lookup("sham");
> -	if (!oh)
> -		return;
> -
> -	pdev = omap_device_build("omap-sham", -1, oh, NULL, 0);
> -	WARN(IS_ERR(pdev), "Can't build omap_device for omap-sham\n");
> -}
> -
> -static void __init omap_init_aes(void)
> -{
> -	struct omap_hwmod *oh;
> -	struct platform_device *pdev;
> -
> -	oh = omap_hwmod_lookup("aes");
> -	if (!oh)
> -		return;
> -
> -	pdev = omap_device_build("omap-aes", -1, oh, NULL, 0);
> -	WARN(IS_ERR(pdev), "Can't build omap_device for omap-aes\n");
> -}
> -
>  /*-------------------------------------------------------------------------*/
>  
>  #if IS_ENABLED(CONFIG_VIDEO_OMAP2_VOUT)
> @@ -185,54 +61,3 @@ int __init omap_init_vout(void)
>  #else
>  int __init omap_init_vout(void) { return 0; }
>  #endif
> -
> -/*-------------------------------------------------------------------------*/
> -
> -static int __init omap2_init_devices(void)
> -{
> -	/* Enable dummy states for those platforms without pinctrl support */
> -	if (!of_have_populated_dt())
> -		pinctrl_provide_dummies();
> -
> -	/* If dtb is there, the devices will be created dynamically */
> -	if (!of_have_populated_dt()) {
> -		/*
> -		 * please keep these calls, and their implementations above,
> -		 * in alphabetical order so they're easier to sort through.
> -		 */
> -		omap_init_mcspi();
> -		omap_init_sham();
> -		omap_init_aes();
> -		omap_init_rng();
> -	}
> -	omap_init_sti();
> -
> -	return 0;
> -}
> -omap_arch_initcall(omap2_init_devices);
> -
> -static int __init omap_gpmc_init(void)
> -{
> -	struct omap_hwmod *oh;
> -	struct platform_device *pdev;
> -	char *oh_name = "gpmc";
> -
> -	/*
> -	 * if the board boots up with a populated DT, do not
> -	 * manually add the device from this initcall
> -	 */
> -	if (of_have_populated_dt())
> -		return -ENODEV;
> -
> -	oh = omap_hwmod_lookup(oh_name);
> -	if (!oh) {
> -		pr_err("Could not look up %s\n", oh_name);
> -		return -ENODEV;
> -	}
> -
> -	pdev = omap_device_build("omap-gpmc", -1, oh, NULL, 0);
> -	WARN(IS_ERR(pdev), "could not build omap_device for %s\n", oh_name);
> -
> -	return PTR_ERR_OR_ZERO(pdev);
> -}
> -omap_postcore_initcall(omap_gpmc_init);
> -- 
> 2.13.0

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 04/11] ARM: OMAP2+: Remove unused legacy code for device init
@ 2017-06-08 10:55           ` Sebastian Reichel
  0 siblings, 0 replies; 56+ messages in thread
From: Sebastian Reichel @ 2017-06-08 10:55 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Thu, Jun 08, 2017 at 02:47:12AM -0700, Tony Lindgren wrote:
> * Tony Lindgren <tony@atomide.com> [170608 01:32]:
> > * Sebastian Reichel <sre@kernel.org> [170607 15:30]:
> > > I guess you can drop omap2_init_devices() completly?
> > 
> > We still have omap_init_sti() left there, but it's
> > just static inline void omap_init_sti(void) {} :)
> > 
> > So yeah will remove that too.
> 
> Here's this one updated.

Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>

Defines for L3_MODULES_MAX_LEN + L3_MODULES and most of the includes
could be dropped now.

-- Sebastian

> 8< -----------------
> From tony Mon Sep 17 00:00:00 2001
> From: Tony Lindgren <tony@atomide.com>
> Date: Wed, 31 May 2017 15:51:32 -0700
> Subject: [PATCH] ARM: OMAP2+: Remove unused legacy code for device init
> 
> We are now booting all mach-omap2 in device tree only mode.
> Any code that is only called in legacy boot mode where
> of_have_populated_dt() is not set is safe to remove now.
> 
> Note that omap_init_sti() won't do anything so we can
> remove omap2_init_devices() as pointed out by Sebastian
> Reichel <sebastian.reichel@collabora.co.uk>.
> 
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> ---
>  arch/arm/mach-omap2/devices.c | 175 ------------------------------------------
>  1 file changed, 175 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
> --- a/arch/arm/mach-omap2/devices.c
> +++ b/arch/arm/mach-omap2/devices.c
> @@ -36,130 +36,6 @@
>  #define L3_MODULES_MAX_LEN 12
>  #define L3_MODULES 3
>  
> -static int __init omap3_l3_init(void)
> -{
> -	struct omap_hwmod *oh;
> -	struct platform_device *pdev;
> -	char oh_name[L3_MODULES_MAX_LEN];
> -
> -	/*
> -	 * To avoid code running on other OMAPs in
> -	 * multi-omap builds
> -	 */
> -	if (!(cpu_is_omap34xx()) || of_have_populated_dt())
> -		return -ENODEV;
> -
> -	snprintf(oh_name, L3_MODULES_MAX_LEN, "l3_main");
> -
> -	oh = omap_hwmod_lookup(oh_name);
> -
> -	if (!oh)
> -		pr_err("could not look up %s\n", oh_name);
> -
> -	pdev = omap_device_build("omap_l3_smx", 0, oh, NULL, 0);
> -
> -	WARN(IS_ERR(pdev), "could not build omap_device for %s\n", oh_name);
> -
> -	return PTR_ERR_OR_ZERO(pdev);
> -}
> -omap_postcore_initcall(omap3_l3_init);
> -
> -static inline void omap_init_sti(void) {}
> -
> -#if IS_ENABLED(CONFIG_SPI_OMAP24XX)
> -
> -#include <linux/platform_data/spi-omap2-mcspi.h>
> -
> -static int __init omap_mcspi_init(struct omap_hwmod *oh, void *unused)
> -{
> -	struct platform_device *pdev;
> -	char *name = "omap2_mcspi";
> -	struct omap2_mcspi_platform_config *pdata;
> -	static int spi_num;
> -	struct omap2_mcspi_dev_attr *mcspi_attrib = oh->dev_attr;
> -
> -	pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
> -	if (!pdata) {
> -		pr_err("Memory allocation for McSPI device failed\n");
> -		return -ENOMEM;
> -	}
> -
> -	pdata->num_cs = mcspi_attrib->num_chipselect;
> -	switch (oh->class->rev) {
> -	case OMAP2_MCSPI_REV:
> -	case OMAP3_MCSPI_REV:
> -			pdata->regs_offset = 0;
> -			break;
> -	case OMAP4_MCSPI_REV:
> -			pdata->regs_offset = OMAP4_MCSPI_REG_OFFSET;
> -			break;
> -	default:
> -			pr_err("Invalid McSPI Revision value\n");
> -			kfree(pdata);
> -			return -EINVAL;
> -	}
> -
> -	spi_num++;
> -	pdev = omap_device_build(name, spi_num, oh, pdata, sizeof(*pdata));
> -	WARN(IS_ERR(pdev), "Can't build omap_device for %s:%s\n",
> -				name, oh->name);
> -	kfree(pdata);
> -	return 0;
> -}
> -
> -static void omap_init_mcspi(void)
> -{
> -	omap_hwmod_for_each_by_class("mcspi", omap_mcspi_init, NULL);
> -}
> -
> -#else
> -static inline void omap_init_mcspi(void) {}
> -#endif
> -
> -/**
> - * omap_init_rng - bind the RNG hwmod to the RNG omap_device
> - *
> - * Bind the RNG hwmod to the RNG omap_device.  No return value.
> - */
> -static void __init omap_init_rng(void)
> -{
> -	struct omap_hwmod *oh;
> -	struct platform_device *pdev;
> -
> -	oh = omap_hwmod_lookup("rng");
> -	if (!oh)
> -		return;
> -
> -	pdev = omap_device_build("omap_rng", -1, oh, NULL, 0);
> -	WARN(IS_ERR(pdev), "Can't build omap_device for omap_rng\n");
> -}
> -
> -static void __init omap_init_sham(void)
> -{
> -	struct omap_hwmod *oh;
> -	struct platform_device *pdev;
> -
> -	oh = omap_hwmod_lookup("sham");
> -	if (!oh)
> -		return;
> -
> -	pdev = omap_device_build("omap-sham", -1, oh, NULL, 0);
> -	WARN(IS_ERR(pdev), "Can't build omap_device for omap-sham\n");
> -}
> -
> -static void __init omap_init_aes(void)
> -{
> -	struct omap_hwmod *oh;
> -	struct platform_device *pdev;
> -
> -	oh = omap_hwmod_lookup("aes");
> -	if (!oh)
> -		return;
> -
> -	pdev = omap_device_build("omap-aes", -1, oh, NULL, 0);
> -	WARN(IS_ERR(pdev), "Can't build omap_device for omap-aes\n");
> -}
> -
>  /*-------------------------------------------------------------------------*/
>  
>  #if IS_ENABLED(CONFIG_VIDEO_OMAP2_VOUT)
> @@ -185,54 +61,3 @@ int __init omap_init_vout(void)
>  #else
>  int __init omap_init_vout(void) { return 0; }
>  #endif
> -
> -/*-------------------------------------------------------------------------*/
> -
> -static int __init omap2_init_devices(void)
> -{
> -	/* Enable dummy states for those platforms without pinctrl support */
> -	if (!of_have_populated_dt())
> -		pinctrl_provide_dummies();
> -
> -	/* If dtb is there, the devices will be created dynamically */
> -	if (!of_have_populated_dt()) {
> -		/*
> -		 * please keep these calls, and their implementations above,
> -		 * in alphabetical order so they're easier to sort through.
> -		 */
> -		omap_init_mcspi();
> -		omap_init_sham();
> -		omap_init_aes();
> -		omap_init_rng();
> -	}
> -	omap_init_sti();
> -
> -	return 0;
> -}
> -omap_arch_initcall(omap2_init_devices);
> -
> -static int __init omap_gpmc_init(void)
> -{
> -	struct omap_hwmod *oh;
> -	struct platform_device *pdev;
> -	char *oh_name = "gpmc";
> -
> -	/*
> -	 * if the board boots up with a populated DT, do not
> -	 * manually add the device from this initcall
> -	 */
> -	if (of_have_populated_dt())
> -		return -ENODEV;
> -
> -	oh = omap_hwmod_lookup(oh_name);
> -	if (!oh) {
> -		pr_err("Could not look up %s\n", oh_name);
> -		return -ENODEV;
> -	}
> -
> -	pdev = omap_device_build("omap-gpmc", -1, oh, NULL, 0);
> -	WARN(IS_ERR(pdev), "could not build omap_device for %s\n", oh_name);
> -
> -	return PTR_ERR_OR_ZERO(pdev);
> -}
> -omap_postcore_initcall(omap_gpmc_init);
> -- 
> 2.13.0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170608/a39a2270/attachment.sig>

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 04/11] ARM: OMAP2+: Remove unused legacy code for device init
  2017-06-08 10:55           ` Sebastian Reichel
@ 2017-06-08 11:10             ` Tony Lindgren
  -1 siblings, 0 replies; 56+ messages in thread
From: Tony Lindgren @ 2017-06-08 11:10 UTC (permalink / raw)
  To: Sebastian Reichel; +Cc: linux-omap, linux-arm-kernel

* Sebastian Reichel <sebastian.reichel@collabora.co.uk> [170608 03:59]:
> On Thu, Jun 08, 2017 at 02:47:12AM -0700, Tony Lindgren wrote:
> > Here's this one updated.
> 
> Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>

Thanks for looking.

> Defines for L3_MODULES_MAX_LEN + L3_MODULES and most of the includes
> could be dropped now.

Yeah I bet we have tons of unused defines now. I think
I used to have some shell script to grep for those
somewhere.

Regards,

Tony

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 04/11] ARM: OMAP2+: Remove unused legacy code for device init
@ 2017-06-08 11:10             ` Tony Lindgren
  0 siblings, 0 replies; 56+ messages in thread
From: Tony Lindgren @ 2017-06-08 11:10 UTC (permalink / raw)
  To: linux-arm-kernel

* Sebastian Reichel <sebastian.reichel@collabora.co.uk> [170608 03:59]:
> On Thu, Jun 08, 2017 at 02:47:12AM -0700, Tony Lindgren wrote:
> > Here's this one updated.
> 
> Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>

Thanks for looking.

> Defines for L3_MODULES_MAX_LEN + L3_MODULES and most of the includes
> could be dropped now.

Yeah I bet we have tons of unused defines now. I think
I used to have some shell script to grep for those
somewhere.

Regards,

Tony

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 07/11] ARM: OMAP2+: Remove unused legacy code for DMA
  2017-06-08 10:45             ` Tony Lindgren
@ 2017-06-08 11:56               ` Bin Liu
  -1 siblings, 0 replies; 56+ messages in thread
From: Bin Liu @ 2017-06-08 11:56 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: linux-omap, linux-arm-kernel

On Thu, Jun 08, 2017 at 03:45:38AM -0700, Tony Lindgren wrote:
> * Peter Ujfalusi <peter.ujfalusi@ti.com> [170608 03:40]:
> > unfortunately we still have conflict as the
> > https://patchwork.kernel.org/patch/9734219/
> > adds entries to omap24xx_sdma_map[] for - back then - valid non DT boot
> > support.
> > 
> > I have rebased and reworked my patch locally on top of your v1, but
> > things must go in in a certain order to avoid conflict.
> > 
> > The tsub conversion series in not yet in linux-next, but afaik Bin
> > already applied it to somewhere.

Yes, the series is in my local tree which is not public available. I
plan to send them to GregKH next week.

> > Leave the mach-omap2/dma.c cleanup for -rc1?
> 
> OK I'll save this for later then.
> 
> Regards,
> 
> Tony

Regards,
-Bin.

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 07/11] ARM: OMAP2+: Remove unused legacy code for DMA
@ 2017-06-08 11:56               ` Bin Liu
  0 siblings, 0 replies; 56+ messages in thread
From: Bin Liu @ 2017-06-08 11:56 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Jun 08, 2017 at 03:45:38AM -0700, Tony Lindgren wrote:
> * Peter Ujfalusi <peter.ujfalusi@ti.com> [170608 03:40]:
> > unfortunately we still have conflict as the
> > https://patchwork.kernel.org/patch/9734219/
> > adds entries to omap24xx_sdma_map[] for - back then - valid non DT boot
> > support.
> > 
> > I have rebased and reworked my patch locally on top of your v1, but
> > things must go in in a certain order to avoid conflict.
> > 
> > The tsub conversion series in not yet in linux-next, but afaik Bin
> > already applied it to somewhere.

Yes, the series is in my local tree which is not public available. I
plan to send them to GregKH next week.

> > Leave the mach-omap2/dma.c cleanup for -rc1?
> 
> OK I'll save this for later then.
> 
> Regards,
> 
> Tony

Regards,
-Bin.

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 08/11] ARM: OMAP2+: Remove unused legacy code for PRM
  2017-05-31 22:51   ` Tony Lindgren
@ 2017-06-30 10:42     ` Tony Lindgren
  -1 siblings, 0 replies; 56+ messages in thread
From: Tony Lindgren @ 2017-06-30 10:42 UTC (permalink / raw)
  To: linux-omap; +Cc: linux-arm-kernel

* Tony Lindgren <tony@atomide.com> [170531 15:55]:
> We are now booting all mach-omap2 in device tree only mode.
> Any code that is only called in legacy boot mode where
> of_have_populated_dt() is not set is safe to remove now.
...

> diff --git a/arch/arm/mach-omap2/prm44xx.c b/arch/arm/mach-omap2/prm44xx.c
> --- a/arch/arm/mach-omap2/prm44xx.c
> +++ b/arch/arm/mach-omap2/prm44xx.c
...

> -static int omap44xx_prm_late_init(void)
> -{
> -	int irq_num;
> -
> -	if (!(prm_features & PRM_HAS_IO_WAKEUP))
> -		return 0;
> -
> -	/* OMAP4+ is DT only now */
> -	if (!of_have_populated_dt())
> -		return 0;

Turns out I misread the above and this code is still needed for omap4 PRM
interrupts, so applying a partial revert below to fix it.

Regards,

Tony

8< ----------------------
>From tony Mon Sep 17 00:00:00 2001
From: Tony Lindgren <tony@atomide.com>
Date: Fri, 30 Jun 2017 03:37:03 -0700
Subject: [PATCH] ARM: OMAP4: Fix legacy code clean-up regression

Commit 2a26d31b1bae ("ARM: OMAP2+: Remove unused legacy code for PRM")
removed PRM platform init code that I thought is unused. Turns out omap4
still needs this code, so let's do a partial revert to add it back.

I probably missed this earlier as the comments used to say
"OMAP4+ is DT only now" for !of_have_populated_dt() to exit early and
missed the negative test. Let's not add those lines back as they are
confusing and no longer needed as we only boot in device tree mode.

Without things things can mysterious fail for i2c, for example LM75
I2C temperature sensor can stop working as the PRM interrupts won't work.

Fixes: 2a26d31b1bae ("ARM: OMAP2+: Remove unused legacy code for PRM")
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/prm44xx.c | 55 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 55 insertions(+)

diff --git a/arch/arm/mach-omap2/prm44xx.c b/arch/arm/mach-omap2/prm44xx.c
--- a/arch/arm/mach-omap2/prm44xx.c
+++ b/arch/arm/mach-omap2/prm44xx.c
@@ -337,6 +337,27 @@ static void omap44xx_prm_reconfigure_io_chain(void)
 }
 
 /**
+ * omap44xx_prm_enable_io_wakeup - enable wakeup events from I/O wakeup latches
+ *
+ * Activates the I/O wakeup event latches and allows events logged by
+ * those latches to signal a wakeup event to the PRCM.  For I/O wakeups
+ * to occur, WAKEUPENABLE bits must be set in the pad mux registers, and
+ * omap44xx_prm_reconfigure_io_chain() must be called.  No return value.
+ */
+static void __init omap44xx_prm_enable_io_wakeup(void)
+{
+	s32 inst = omap4_prmst_get_prm_dev_inst();
+
+	if (inst == PRM_INSTANCE_UNKNOWN)
+		return;
+
+	omap4_prm_rmw_inst_reg_bits(OMAP4430_GLOBAL_WUEN_MASK,
+				    OMAP4430_GLOBAL_WUEN_MASK,
+				    inst,
+				    omap4_prcm_irq_setup.pm_ctrl);
+}
+
+/**
  * omap44xx_prm_read_reset_sources - return the last SoC reset source
  *
  * Return a u32 representing the last reset sources of the SoC.  The
@@ -668,6 +689,8 @@ struct pwrdm_ops omap4_pwrdm_operations = {
 	.pwrdm_has_voltdm	= omap4_check_vcvp,
 };
 
+static int omap44xx_prm_late_init(void);
+
 /*
  * XXX document
  */
@@ -675,6 +698,7 @@ static struct prm_ll_data omap44xx_prm_ll_data = {
 	.read_reset_sources = &omap44xx_prm_read_reset_sources,
 	.was_any_context_lost_old = &omap44xx_prm_was_any_context_lost_old,
 	.clear_context_loss_flags_old = &omap44xx_prm_clear_context_loss_flags_old,
+	.late_init = &omap44xx_prm_late_init,
 	.assert_hardreset	= omap4_prminst_assert_hardreset,
 	.deassert_hardreset	= omap4_prminst_deassert_hardreset,
 	.is_hardreset_asserted	= omap4_prminst_is_hardreset_asserted,
@@ -711,6 +735,37 @@ int __init omap44xx_prm_init(const struct omap_prcm_init_data *data)
 	return prm_register(&omap44xx_prm_ll_data);
 }
 
+static int omap44xx_prm_late_init(void)
+{
+	int irq_num;
+
+	if (!(prm_features & PRM_HAS_IO_WAKEUP))
+		return 0;
+
+	irq_num = of_irq_get(prm_init_data->np, 0);
+	/*
+	 * Already have OMAP4 IRQ num. For all other platforms, we need
+	 * IRQ numbers from DT
+	 */
+	if (irq_num < 0 && !(prm_init_data->flags & PRM_IRQ_DEFAULT)) {
+		if (irq_num == -EPROBE_DEFER)
+			return irq_num;
+
+		/* Have nothing to do */
+		return 0;
+	}
+
+	/* Once OMAP4 DT is filled as well */
+	if (irq_num >= 0) {
+		omap4_prcm_irq_setup.irq = irq_num;
+		omap4_prcm_irq_setup.xlate_irq = NULL;
+	}
+
+	omap44xx_prm_enable_io_wakeup();
+
+	return omap_prcm_register_chain_handler(&omap4_prcm_irq_setup);
+}
+
 static void __exit omap44xx_prm_exit(void)
 {
 	prm_unregister(&omap44xx_prm_ll_data);
-- 
2.13.1

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 08/11] ARM: OMAP2+: Remove unused legacy code for PRM
@ 2017-06-30 10:42     ` Tony Lindgren
  0 siblings, 0 replies; 56+ messages in thread
From: Tony Lindgren @ 2017-06-30 10:42 UTC (permalink / raw)
  To: linux-arm-kernel

* Tony Lindgren <tony@atomide.com> [170531 15:55]:
> We are now booting all mach-omap2 in device tree only mode.
> Any code that is only called in legacy boot mode where
> of_have_populated_dt() is not set is safe to remove now.
...

> diff --git a/arch/arm/mach-omap2/prm44xx.c b/arch/arm/mach-omap2/prm44xx.c
> --- a/arch/arm/mach-omap2/prm44xx.c
> +++ b/arch/arm/mach-omap2/prm44xx.c
...

> -static int omap44xx_prm_late_init(void)
> -{
> -	int irq_num;
> -
> -	if (!(prm_features & PRM_HAS_IO_WAKEUP))
> -		return 0;
> -
> -	/* OMAP4+ is DT only now */
> -	if (!of_have_populated_dt())
> -		return 0;

Turns out I misread the above and this code is still needed for omap4 PRM
interrupts, so applying a partial revert below to fix it.

Regards,

Tony

8< ----------------------
>From tony Mon Sep 17 00:00:00 2001
From: Tony Lindgren <tony@atomide.com>
Date: Fri, 30 Jun 2017 03:37:03 -0700
Subject: [PATCH] ARM: OMAP4: Fix legacy code clean-up regression

Commit 2a26d31b1bae ("ARM: OMAP2+: Remove unused legacy code for PRM")
removed PRM platform init code that I thought is unused. Turns out omap4
still needs this code, so let's do a partial revert to add it back.

I probably missed this earlier as the comments used to say
"OMAP4+ is DT only now" for !of_have_populated_dt() to exit early and
missed the negative test. Let's not add those lines back as they are
confusing and no longer needed as we only boot in device tree mode.

Without things things can mysterious fail for i2c, for example LM75
I2C temperature sensor can stop working as the PRM interrupts won't work.

Fixes: 2a26d31b1bae ("ARM: OMAP2+: Remove unused legacy code for PRM")
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/prm44xx.c | 55 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 55 insertions(+)

diff --git a/arch/arm/mach-omap2/prm44xx.c b/arch/arm/mach-omap2/prm44xx.c
--- a/arch/arm/mach-omap2/prm44xx.c
+++ b/arch/arm/mach-omap2/prm44xx.c
@@ -337,6 +337,27 @@ static void omap44xx_prm_reconfigure_io_chain(void)
 }
 
 /**
+ * omap44xx_prm_enable_io_wakeup - enable wakeup events from I/O wakeup latches
+ *
+ * Activates the I/O wakeup event latches and allows events logged by
+ * those latches to signal a wakeup event to the PRCM.  For I/O wakeups
+ * to occur, WAKEUPENABLE bits must be set in the pad mux registers, and
+ * omap44xx_prm_reconfigure_io_chain() must be called.  No return value.
+ */
+static void __init omap44xx_prm_enable_io_wakeup(void)
+{
+	s32 inst = omap4_prmst_get_prm_dev_inst();
+
+	if (inst == PRM_INSTANCE_UNKNOWN)
+		return;
+
+	omap4_prm_rmw_inst_reg_bits(OMAP4430_GLOBAL_WUEN_MASK,
+				    OMAP4430_GLOBAL_WUEN_MASK,
+				    inst,
+				    omap4_prcm_irq_setup.pm_ctrl);
+}
+
+/**
  * omap44xx_prm_read_reset_sources - return the last SoC reset source
  *
  * Return a u32 representing the last reset sources of the SoC.  The
@@ -668,6 +689,8 @@ struct pwrdm_ops omap4_pwrdm_operations = {
 	.pwrdm_has_voltdm	= omap4_check_vcvp,
 };
 
+static int omap44xx_prm_late_init(void);
+
 /*
  * XXX document
  */
@@ -675,6 +698,7 @@ static struct prm_ll_data omap44xx_prm_ll_data = {
 	.read_reset_sources = &omap44xx_prm_read_reset_sources,
 	.was_any_context_lost_old = &omap44xx_prm_was_any_context_lost_old,
 	.clear_context_loss_flags_old = &omap44xx_prm_clear_context_loss_flags_old,
+	.late_init = &omap44xx_prm_late_init,
 	.assert_hardreset	= omap4_prminst_assert_hardreset,
 	.deassert_hardreset	= omap4_prminst_deassert_hardreset,
 	.is_hardreset_asserted	= omap4_prminst_is_hardreset_asserted,
@@ -711,6 +735,37 @@ int __init omap44xx_prm_init(const struct omap_prcm_init_data *data)
 	return prm_register(&omap44xx_prm_ll_data);
 }
 
+static int omap44xx_prm_late_init(void)
+{
+	int irq_num;
+
+	if (!(prm_features & PRM_HAS_IO_WAKEUP))
+		return 0;
+
+	irq_num = of_irq_get(prm_init_data->np, 0);
+	/*
+	 * Already have OMAP4 IRQ num. For all other platforms, we need
+	 * IRQ numbers from DT
+	 */
+	if (irq_num < 0 && !(prm_init_data->flags & PRM_IRQ_DEFAULT)) {
+		if (irq_num == -EPROBE_DEFER)
+			return irq_num;
+
+		/* Have nothing to do */
+		return 0;
+	}
+
+	/* Once OMAP4 DT is filled as well */
+	if (irq_num >= 0) {
+		omap4_prcm_irq_setup.irq = irq_num;
+		omap4_prcm_irq_setup.xlate_irq = NULL;
+	}
+
+	omap44xx_prm_enable_io_wakeup();
+
+	return omap_prcm_register_chain_handler(&omap4_prcm_irq_setup);
+}
+
 static void __exit omap44xx_prm_exit(void)
 {
 	prm_unregister(&omap44xx_prm_ll_data);
-- 
2.13.1

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 08/11] ARM: OMAP2+: Remove unused legacy code for PRM
  2017-06-30 10:42     ` Tony Lindgren
@ 2017-07-20 14:45       ` Sebastian Reichel
  -1 siblings, 0 replies; 56+ messages in thread
From: Sebastian Reichel @ 2017-07-20 14:45 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: linux-omap, linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 6107 bytes --]

Hi,

On Fri, Jun 30, 2017 at 03:42:56AM -0700, Tony Lindgren wrote:
> * Tony Lindgren <tony@atomide.com> [170531 15:55]:
> > We are now booting all mach-omap2 in device tree only mode.
> > Any code that is only called in legacy boot mode where
> > of_have_populated_dt() is not set is safe to remove now.
> ...
> 
> > diff --git a/arch/arm/mach-omap2/prm44xx.c b/arch/arm/mach-omap2/prm44xx.c
> > --- a/arch/arm/mach-omap2/prm44xx.c
> > +++ b/arch/arm/mach-omap2/prm44xx.c
> ...
> 
> > -static int omap44xx_prm_late_init(void)
> > -{
> > -	int irq_num;
> > -
> > -	if (!(prm_features & PRM_HAS_IO_WAKEUP))
> > -		return 0;
> > -
> > -	/* OMAP4+ is DT only now */
> > -	if (!of_have_populated_dt())
> > -		return 0;
> 
> Turns out I misread the above and this code is still needed for omap4 PRM
> interrupts, so applying a partial revert below to fix it.

I just spent a couple of hours to tracing this and now saw, that you
already did so. Why was this not part of the pull request? :(

> 8< ----------------------
> From tony Mon Sep 17 00:00:00 2001
> From: Tony Lindgren <tony@atomide.com>
> Date: Fri, 30 Jun 2017 03:37:03 -0700
> Subject: [PATCH] ARM: OMAP4: Fix legacy code clean-up regression
> 
> Commit 2a26d31b1bae ("ARM: OMAP2+: Remove unused legacy code for PRM")
> removed PRM platform init code that I thought is unused. Turns out omap4
> still needs this code, so let's do a partial revert to add it back.
> 
> I probably missed this earlier as the comments used to say
> "OMAP4+ is DT only now" for !of_have_populated_dt() to exit early and
> missed the negative test. Let's not add those lines back as they are
> confusing and no longer needed as we only boot in device tree mode.

haha, I came up with *exactly* the same patch and then noticed
this mail when I checked for a Message-ID as reference :)

> Without things things can mysterious fail for i2c, for example LM75
> I2C temperature sensor can stop working as the PRM interrupts won't work.

Here is the demystification:

Without this fix omap4_pmx_core and omap4_pmx_wakeup will not
register themself as interrupt controller, due to missing parent
interrupt. This means, that any device referencing an interrupt
in one of those controllers will fail their probe routine with
-EPROBE_DEFER waiting for the interrupt controller to appear.
At least for i2c this happens directly in the core, even before
calling the driver's probe routine making this look quite
mysterious.

TLDR: Fix "wakeup-source;" using devices on omap4.

> Fixes: 2a26d31b1bae ("ARM: OMAP2+: Remove unused legacy code for PRM")
> Signed-off-by: Tony Lindgren <tony@atomide.com>

Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Tested-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>

-- Sebastian

> ---
>  arch/arm/mach-omap2/prm44xx.c | 55 +++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 55 insertions(+)
> 
> diff --git a/arch/arm/mach-omap2/prm44xx.c b/arch/arm/mach-omap2/prm44xx.c
> --- a/arch/arm/mach-omap2/prm44xx.c
> +++ b/arch/arm/mach-omap2/prm44xx.c
> @@ -337,6 +337,27 @@ static void omap44xx_prm_reconfigure_io_chain(void)
>  }
>  
>  /**
> + * omap44xx_prm_enable_io_wakeup - enable wakeup events from I/O wakeup latches
> + *
> + * Activates the I/O wakeup event latches and allows events logged by
> + * those latches to signal a wakeup event to the PRCM.  For I/O wakeups
> + * to occur, WAKEUPENABLE bits must be set in the pad mux registers, and
> + * omap44xx_prm_reconfigure_io_chain() must be called.  No return value.
> + */
> +static void __init omap44xx_prm_enable_io_wakeup(void)
> +{
> +	s32 inst = omap4_prmst_get_prm_dev_inst();
> +
> +	if (inst == PRM_INSTANCE_UNKNOWN)
> +		return;
> +
> +	omap4_prm_rmw_inst_reg_bits(OMAP4430_GLOBAL_WUEN_MASK,
> +				    OMAP4430_GLOBAL_WUEN_MASK,
> +				    inst,
> +				    omap4_prcm_irq_setup.pm_ctrl);
> +}
> +
> +/**
>   * omap44xx_prm_read_reset_sources - return the last SoC reset source
>   *
>   * Return a u32 representing the last reset sources of the SoC.  The
> @@ -668,6 +689,8 @@ struct pwrdm_ops omap4_pwrdm_operations = {
>  	.pwrdm_has_voltdm	= omap4_check_vcvp,
>  };
>  
> +static int omap44xx_prm_late_init(void);
> +
>  /*
>   * XXX document
>   */
> @@ -675,6 +698,7 @@ static struct prm_ll_data omap44xx_prm_ll_data = {
>  	.read_reset_sources = &omap44xx_prm_read_reset_sources,
>  	.was_any_context_lost_old = &omap44xx_prm_was_any_context_lost_old,
>  	.clear_context_loss_flags_old = &omap44xx_prm_clear_context_loss_flags_old,
> +	.late_init = &omap44xx_prm_late_init,
>  	.assert_hardreset	= omap4_prminst_assert_hardreset,
>  	.deassert_hardreset	= omap4_prminst_deassert_hardreset,
>  	.is_hardreset_asserted	= omap4_prminst_is_hardreset_asserted,
> @@ -711,6 +735,37 @@ int __init omap44xx_prm_init(const struct omap_prcm_init_data *data)
>  	return prm_register(&omap44xx_prm_ll_data);
>  }
>  
> +static int omap44xx_prm_late_init(void)
> +{
> +	int irq_num;
> +
> +	if (!(prm_features & PRM_HAS_IO_WAKEUP))
> +		return 0;
> +
> +	irq_num = of_irq_get(prm_init_data->np, 0);
> +	/*
> +	 * Already have OMAP4 IRQ num. For all other platforms, we need
> +	 * IRQ numbers from DT
> +	 */
> +	if (irq_num < 0 && !(prm_init_data->flags & PRM_IRQ_DEFAULT)) {
> +		if (irq_num == -EPROBE_DEFER)
> +			return irq_num;
> +
> +		/* Have nothing to do */
> +		return 0;
> +	}
> +
> +	/* Once OMAP4 DT is filled as well */
> +	if (irq_num >= 0) {
> +		omap4_prcm_irq_setup.irq = irq_num;
> +		omap4_prcm_irq_setup.xlate_irq = NULL;
> +	}
> +
> +	omap44xx_prm_enable_io_wakeup();
> +
> +	return omap_prcm_register_chain_handler(&omap4_prcm_irq_setup);
> +}
> +
>  static void __exit omap44xx_prm_exit(void)
>  {
>  	prm_unregister(&omap44xx_prm_ll_data);
> -- 
> 2.13.1
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 08/11] ARM: OMAP2+: Remove unused legacy code for PRM
@ 2017-07-20 14:45       ` Sebastian Reichel
  0 siblings, 0 replies; 56+ messages in thread
From: Sebastian Reichel @ 2017-07-20 14:45 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Fri, Jun 30, 2017 at 03:42:56AM -0700, Tony Lindgren wrote:
> * Tony Lindgren <tony@atomide.com> [170531 15:55]:
> > We are now booting all mach-omap2 in device tree only mode.
> > Any code that is only called in legacy boot mode where
> > of_have_populated_dt() is not set is safe to remove now.
> ...
> 
> > diff --git a/arch/arm/mach-omap2/prm44xx.c b/arch/arm/mach-omap2/prm44xx.c
> > --- a/arch/arm/mach-omap2/prm44xx.c
> > +++ b/arch/arm/mach-omap2/prm44xx.c
> ...
> 
> > -static int omap44xx_prm_late_init(void)
> > -{
> > -	int irq_num;
> > -
> > -	if (!(prm_features & PRM_HAS_IO_WAKEUP))
> > -		return 0;
> > -
> > -	/* OMAP4+ is DT only now */
> > -	if (!of_have_populated_dt())
> > -		return 0;
> 
> Turns out I misread the above and this code is still needed for omap4 PRM
> interrupts, so applying a partial revert below to fix it.

I just spent a couple of hours to tracing this and now saw, that you
already did so. Why was this not part of the pull request? :(

> 8< ----------------------
> From tony Mon Sep 17 00:00:00 2001
> From: Tony Lindgren <tony@atomide.com>
> Date: Fri, 30 Jun 2017 03:37:03 -0700
> Subject: [PATCH] ARM: OMAP4: Fix legacy code clean-up regression
> 
> Commit 2a26d31b1bae ("ARM: OMAP2+: Remove unused legacy code for PRM")
> removed PRM platform init code that I thought is unused. Turns out omap4
> still needs this code, so let's do a partial revert to add it back.
> 
> I probably missed this earlier as the comments used to say
> "OMAP4+ is DT only now" for !of_have_populated_dt() to exit early and
> missed the negative test. Let's not add those lines back as they are
> confusing and no longer needed as we only boot in device tree mode.

haha, I came up with *exactly* the same patch and then noticed
this mail when I checked for a Message-ID as reference :)

> Without things things can mysterious fail for i2c, for example LM75
> I2C temperature sensor can stop working as the PRM interrupts won't work.

Here is the demystification:

Without this fix omap4_pmx_core and omap4_pmx_wakeup will not
register themself as interrupt controller, due to missing parent
interrupt. This means, that any device referencing an interrupt
in one of those controllers will fail their probe routine with
-EPROBE_DEFER waiting for the interrupt controller to appear.
At least for i2c this happens directly in the core, even before
calling the driver's probe routine making this look quite
mysterious.

TLDR: Fix "wakeup-source;" using devices on omap4.

> Fixes: 2a26d31b1bae ("ARM: OMAP2+: Remove unused legacy code for PRM")
> Signed-off-by: Tony Lindgren <tony@atomide.com>

Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Tested-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>

-- Sebastian

> ---
>  arch/arm/mach-omap2/prm44xx.c | 55 +++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 55 insertions(+)
> 
> diff --git a/arch/arm/mach-omap2/prm44xx.c b/arch/arm/mach-omap2/prm44xx.c
> --- a/arch/arm/mach-omap2/prm44xx.c
> +++ b/arch/arm/mach-omap2/prm44xx.c
> @@ -337,6 +337,27 @@ static void omap44xx_prm_reconfigure_io_chain(void)
>  }
>  
>  /**
> + * omap44xx_prm_enable_io_wakeup - enable wakeup events from I/O wakeup latches
> + *
> + * Activates the I/O wakeup event latches and allows events logged by
> + * those latches to signal a wakeup event to the PRCM.  For I/O wakeups
> + * to occur, WAKEUPENABLE bits must be set in the pad mux registers, and
> + * omap44xx_prm_reconfigure_io_chain() must be called.  No return value.
> + */
> +static void __init omap44xx_prm_enable_io_wakeup(void)
> +{
> +	s32 inst = omap4_prmst_get_prm_dev_inst();
> +
> +	if (inst == PRM_INSTANCE_UNKNOWN)
> +		return;
> +
> +	omap4_prm_rmw_inst_reg_bits(OMAP4430_GLOBAL_WUEN_MASK,
> +				    OMAP4430_GLOBAL_WUEN_MASK,
> +				    inst,
> +				    omap4_prcm_irq_setup.pm_ctrl);
> +}
> +
> +/**
>   * omap44xx_prm_read_reset_sources - return the last SoC reset source
>   *
>   * Return a u32 representing the last reset sources of the SoC.  The
> @@ -668,6 +689,8 @@ struct pwrdm_ops omap4_pwrdm_operations = {
>  	.pwrdm_has_voltdm	= omap4_check_vcvp,
>  };
>  
> +static int omap44xx_prm_late_init(void);
> +
>  /*
>   * XXX document
>   */
> @@ -675,6 +698,7 @@ static struct prm_ll_data omap44xx_prm_ll_data = {
>  	.read_reset_sources = &omap44xx_prm_read_reset_sources,
>  	.was_any_context_lost_old = &omap44xx_prm_was_any_context_lost_old,
>  	.clear_context_loss_flags_old = &omap44xx_prm_clear_context_loss_flags_old,
> +	.late_init = &omap44xx_prm_late_init,
>  	.assert_hardreset	= omap4_prminst_assert_hardreset,
>  	.deassert_hardreset	= omap4_prminst_deassert_hardreset,
>  	.is_hardreset_asserted	= omap4_prminst_is_hardreset_asserted,
> @@ -711,6 +735,37 @@ int __init omap44xx_prm_init(const struct omap_prcm_init_data *data)
>  	return prm_register(&omap44xx_prm_ll_data);
>  }
>  
> +static int omap44xx_prm_late_init(void)
> +{
> +	int irq_num;
> +
> +	if (!(prm_features & PRM_HAS_IO_WAKEUP))
> +		return 0;
> +
> +	irq_num = of_irq_get(prm_init_data->np, 0);
> +	/*
> +	 * Already have OMAP4 IRQ num. For all other platforms, we need
> +	 * IRQ numbers from DT
> +	 */
> +	if (irq_num < 0 && !(prm_init_data->flags & PRM_IRQ_DEFAULT)) {
> +		if (irq_num == -EPROBE_DEFER)
> +			return irq_num;
> +
> +		/* Have nothing to do */
> +		return 0;
> +	}
> +
> +	/* Once OMAP4 DT is filled as well */
> +	if (irq_num >= 0) {
> +		omap4_prcm_irq_setup.irq = irq_num;
> +		omap4_prcm_irq_setup.xlate_irq = NULL;
> +	}
> +
> +	omap44xx_prm_enable_io_wakeup();
> +
> +	return omap_prcm_register_chain_handler(&omap4_prcm_irq_setup);
> +}
> +
>  static void __exit omap44xx_prm_exit(void)
>  {
>  	prm_unregister(&omap44xx_prm_ll_data);
> -- 
> 2.13.1
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170720/174866bc/attachment.sig>

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 08/11] ARM: OMAP2+: Remove unused legacy code for PRM
  2017-07-20 14:45       ` Sebastian Reichel
@ 2017-07-21  5:55         ` Tony Lindgren
  -1 siblings, 0 replies; 56+ messages in thread
From: Tony Lindgren @ 2017-07-21  5:55 UTC (permalink / raw)
  To: Sebastian Reichel; +Cc: linux-omap, linux-arm-kernel

* Sebastian Reichel <sebastian.reichel@collabora.co.uk> [170720 07:45]:
> Hi,
> 
> On Fri, Jun 30, 2017 at 03:42:56AM -0700, Tony Lindgren wrote:
> > * Tony Lindgren <tony@atomide.com> [170531 15:55]:
> > > We are now booting all mach-omap2 in device tree only mode.
> > > Any code that is only called in legacy boot mode where
> > > of_have_populated_dt() is not set is safe to remove now.
> > ...
> > 
> > > diff --git a/arch/arm/mach-omap2/prm44xx.c b/arch/arm/mach-omap2/prm44xx.c
> > > --- a/arch/arm/mach-omap2/prm44xx.c
> > > +++ b/arch/arm/mach-omap2/prm44xx.c
> > ...
> > 
> > > -static int omap44xx_prm_late_init(void)
> > > -{
> > > -	int irq_num;
> > > -
> > > -	if (!(prm_features & PRM_HAS_IO_WAKEUP))
> > > -		return 0;
> > > -
> > > -	/* OMAP4+ is DT only now */
> > > -	if (!of_have_populated_dt())
> > > -		return 0;
> > 
> > Turns out I misread the above and this code is still needed for omap4 PRM
> > interrupts, so applying a partial revert below to fix it.
> 
> I just spent a couple of hours to tracing this and now saw, that you
> already did so. Why was this not part of the pull request? :(

Sorry I did not notice until I had sent out a pull request. I did
send a pull request for this and few other fixes on the 6th that is
still pending.

> > I probably missed this earlier as the comments used to say
> > "OMAP4+ is DT only now" for !of_have_populated_dt() to exit early and
> > missed the negative test. Let's not add those lines back as they are
> > confusing and no longer needed as we only boot in device tree mode.
> 
> haha, I came up with *exactly* the same patch and then noticed
> this mail when I checked for a Message-ID as reference :)

Sorry to hear about the duplicate work.

> > Without things things can mysterious fail for i2c, for example LM75
> > I2C temperature sensor can stop working as the PRM interrupts won't work.
> 
> Here is the demystification:
> 
> Without this fix omap4_pmx_core and omap4_pmx_wakeup will not
> register themself as interrupt controller, due to missing parent
> interrupt. This means, that any device referencing an interrupt
> in one of those controllers will fail their probe routine with
> -EPROBE_DEFER waiting for the interrupt controller to appear.
> At least for i2c this happens directly in the core, even before
> calling the driver's probe routine making this look quite
> mysterious.
> 
> TLDR: Fix "wakeup-source;" using devices on omap4.

Yup.

Regards,

Tony

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 08/11] ARM: OMAP2+: Remove unused legacy code for PRM
@ 2017-07-21  5:55         ` Tony Lindgren
  0 siblings, 0 replies; 56+ messages in thread
From: Tony Lindgren @ 2017-07-21  5:55 UTC (permalink / raw)
  To: linux-arm-kernel

* Sebastian Reichel <sebastian.reichel@collabora.co.uk> [170720 07:45]:
> Hi,
> 
> On Fri, Jun 30, 2017 at 03:42:56AM -0700, Tony Lindgren wrote:
> > * Tony Lindgren <tony@atomide.com> [170531 15:55]:
> > > We are now booting all mach-omap2 in device tree only mode.
> > > Any code that is only called in legacy boot mode where
> > > of_have_populated_dt() is not set is safe to remove now.
> > ...
> > 
> > > diff --git a/arch/arm/mach-omap2/prm44xx.c b/arch/arm/mach-omap2/prm44xx.c
> > > --- a/arch/arm/mach-omap2/prm44xx.c
> > > +++ b/arch/arm/mach-omap2/prm44xx.c
> > ...
> > 
> > > -static int omap44xx_prm_late_init(void)
> > > -{
> > > -	int irq_num;
> > > -
> > > -	if (!(prm_features & PRM_HAS_IO_WAKEUP))
> > > -		return 0;
> > > -
> > > -	/* OMAP4+ is DT only now */
> > > -	if (!of_have_populated_dt())
> > > -		return 0;
> > 
> > Turns out I misread the above and this code is still needed for omap4 PRM
> > interrupts, so applying a partial revert below to fix it.
> 
> I just spent a couple of hours to tracing this and now saw, that you
> already did so. Why was this not part of the pull request? :(

Sorry I did not notice until I had sent out a pull request. I did
send a pull request for this and few other fixes on the 6th that is
still pending.

> > I probably missed this earlier as the comments used to say
> > "OMAP4+ is DT only now" for !of_have_populated_dt() to exit early and
> > missed the negative test. Let's not add those lines back as they are
> > confusing and no longer needed as we only boot in device tree mode.
> 
> haha, I came up with *exactly* the same patch and then noticed
> this mail when I checked for a Message-ID as reference :)

Sorry to hear about the duplicate work.

> > Without things things can mysterious fail for i2c, for example LM75
> > I2C temperature sensor can stop working as the PRM interrupts won't work.
> 
> Here is the demystification:
> 
> Without this fix omap4_pmx_core and omap4_pmx_wakeup will not
> register themself as interrupt controller, due to missing parent
> interrupt. This means, that any device referencing an interrupt
> in one of those controllers will fail their probe routine with
> -EPROBE_DEFER waiting for the interrupt controller to appear.
> At least for i2c this happens directly in the core, even before
> calling the driver's probe routine making this look quite
> mysterious.
> 
> TLDR: Fix "wakeup-source;" using devices on omap4.

Yup.

Regards,

Tony

^ permalink raw reply	[flat|nested] 56+ messages in thread

end of thread, other threads:[~2017-07-21  5:55 UTC | newest]

Thread overview: 56+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-31 22:51 [PATCH 00/11] Remove unused omap legacy code Tony Lindgren
2017-05-31 22:51 ` Tony Lindgren
2017-05-31 22:51 ` [PATCH 01/11] ARM: OMAP2+: Remove unused legacy code for opp Tony Lindgren
2017-05-31 22:51   ` Tony Lindgren
2017-05-31 22:51 ` [PATCH 02/11] ARM: OMAP2+: Remove unused legacy code for timer Tony Lindgren
2017-05-31 22:51   ` Tony Lindgren
2017-05-31 22:51 ` [PATCH 03/11] ARM: OMAP2+: Remove unused legacy code for PMU Tony Lindgren
2017-05-31 22:51   ` Tony Lindgren
2017-05-31 22:51 ` [PATCH 04/11] ARM: OMAP2+: Remove unused legacy code for device init Tony Lindgren
2017-05-31 22:51   ` Tony Lindgren
2017-06-07 22:27   ` Sebastian Reichel
2017-06-07 22:27     ` Sebastian Reichel
2017-06-08  8:28     ` Tony Lindgren
2017-06-08  8:28       ` Tony Lindgren
2017-06-08  9:47       ` Tony Lindgren
2017-06-08  9:47         ` Tony Lindgren
2017-06-08 10:55         ` Sebastian Reichel
2017-06-08 10:55           ` Sebastian Reichel
2017-06-08 11:10           ` Tony Lindgren
2017-06-08 11:10             ` Tony Lindgren
2017-05-31 22:51 ` [PATCH 05/11] ARM: OMAP2+: Remove unused legacy code for McBSP Tony Lindgren
2017-05-31 22:51   ` Tony Lindgren
2017-06-08  6:20   ` Peter Ujfalusi
2017-06-08  6:20     ` Peter Ujfalusi
2017-05-31 22:51 ` [PATCH 06/11] ARM: OMAP2+: Remove unused legacy code for io.c Tony Lindgren
2017-05-31 22:51   ` Tony Lindgren
2017-05-31 22:51 ` [PATCH 07/11] ARM: OMAP2+: Remove unused legacy code for DMA Tony Lindgren
2017-05-31 22:51   ` Tony Lindgren
2017-06-08  6:25   ` Peter Ujfalusi
2017-06-08  6:25     ` Peter Ujfalusi
2017-06-08  8:24     ` Tony Lindgren
2017-06-08  8:24       ` Tony Lindgren
2017-06-08  9:56       ` Tony Lindgren
2017-06-08  9:56         ` Tony Lindgren
2017-06-08 10:37         ` Peter Ujfalusi
2017-06-08 10:37           ` Peter Ujfalusi
2017-06-08 10:45           ` Tony Lindgren
2017-06-08 10:45             ` Tony Lindgren
2017-06-08 11:56             ` Bin Liu
2017-06-08 11:56               ` Bin Liu
2017-05-31 22:51 ` [PATCH 08/11] ARM: OMAP2+: Remove unused legacy code for PRM Tony Lindgren
2017-05-31 22:51   ` Tony Lindgren
2017-06-30 10:42   ` Tony Lindgren
2017-06-30 10:42     ` Tony Lindgren
2017-07-20 14:45     ` Sebastian Reichel
2017-07-20 14:45       ` Sebastian Reichel
2017-07-21  5:55       ` Tony Lindgren
2017-07-21  5:55         ` Tony Lindgren
2017-05-31 22:51 ` [PATCH 09/11] ARM: OMAP2+: Remove unused legacy code for interconnects Tony Lindgren
2017-05-31 22:51   ` Tony Lindgren
2017-05-31 22:51 ` [PATCH 10/11] ARM: OMAP2+: Remove unused legacy code for watchdog Tony Lindgren
2017-05-31 22:51   ` Tony Lindgren
2017-05-31 22:51 ` [PATCH 11/11] ARM: OMAP2+: Remove unused legacy code for n8x0 Tony Lindgren
2017-05-31 22:51   ` Tony Lindgren
2017-06-08  8:13 ` [PATCH 00/11] Remove unused omap legacy code Sebastian Reichel
2017-06-08  8:13   ` Sebastian Reichel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.