linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v7 0/9] omap: dmtimer: Move driver out of plat-omap
@ 2018-01-09  6:22 Keerthy
  2018-01-09  6:22 ` [PATCH v7 1/9] clocksource: dmtimer: Remove all the exports Keerthy
                   ` (8 more replies)
  0 siblings, 9 replies; 21+ messages in thread
From: Keerthy @ 2018-01-09  6:22 UTC (permalink / raw)
  To: daniel.lezcano, thierry.reding, tony, aaro.koskinen
  Cc: j-keerthy, Claudiu.Beznea, narmstrong, linux-pwm, ladis,
	linux-kernel, linux-arm-kernel, sebastian.reichel, linux-omap,
	robh+dt, t-kristo, grygorii.strashko

The series moves dmtimer out of plat-omap to drivers/clocksource.
The series also does a bunch of changes to pwm-omap-dmtimer code
to adapt to the driver migration and clean up plat specific
pdata-quirks and use the dmtimer platform data.

Boot tested on DRA7-EVM and AM437X-GP-EVM.
Compile tested omap1_defconfig.

This is based on top of linux-next branch.

This is tested on on IGEPv2 (OMAP3430 based) by Ladis.

Changes from V6:

  * Fixed error checking for pwm driver patch.
  * Removed one of the fixes from Ladis as per request.

Changes from V5:

  * Added couple of fixes from Ladis for  pwm-dmtimer.

Changes from v4:

  * Made OMAP_DM_TIMER config option silent.
  * Changed the driver name to timer-dm.c

Changes from v3:

  * Reverted to v2 approach of using dev_get_platdata to fetch dmtimer ops.

Changes from V2:

  * Wrapped the inline functions in header file under OMAP2PLUS
  * Added a new of helper function to fetch plat_data from of node. 

Keerthy (8):
  clocksource: dmtimer: Remove all the exports
  arm: omap: timer: Wrap the inline functions under OMAP2PLUS define
  arm: omap: Move dmtimer.h out of plat-omap
  arm: OMAP: Move dmtimer driver out of plat-omap to drivers under
    clocksource
  dmtimer: Add timer ops to the platform data structure
  clocksource: dmtimer: Populate the timer ops to the pdata
  pwm: pwm-omap-dmtimer: Adapt driver to utilize dmtimer pdata ops
  arm: omap: pdata-quirks: Remove unused timer pdata

Ladislav Michl (1):
  clocksource: timer-dm: Hook device platform data if not already
    assigned

 arch/arm/mach-omap1/pm.c                           |  2 +-
 arch/arm/mach-omap1/timer.c                        |  2 +-
 arch/arm/mach-omap2/omap_hwmod_2420_data.c         |  2 +-
 arch/arm/mach-omap2/omap_hwmod_2430_data.c         |  2 +-
 arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c |  2 +-
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c         |  2 +-
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c         |  2 +-
 arch/arm/mach-omap2/omap_hwmod_54xx_data.c         |  2 +-
 arch/arm/mach-omap2/omap_hwmod_7xx_data.c          |  2 +-
 arch/arm/mach-omap2/omap_hwmod_81xx_data.c         |  2 +-
 arch/arm/mach-omap2/pdata-quirks.c                 | 32 ----------
 arch/arm/mach-omap2/timer.c                        |  2 +-
 arch/arm/plat-omap/Kconfig                         |  6 --
 arch/arm/plat-omap/Makefile                        |  1 -
 drivers/clocksource/Kconfig                        |  3 +
 drivers/clocksource/Makefile                       |  1 +
 .../dmtimer.c => drivers/clocksource/timer-dm.c    | 64 ++++++++++----------
 drivers/pwm/pwm-omap-dmtimer.c                     | 68 +++++++++++++---------
 .../include/plat => include/clocksource}/dmtimer.h |  8 ++-
 include/linux/platform_data/dmtimer-omap.h         | 38 ++++++++++++
 20 files changed, 134 insertions(+), 109 deletions(-)
 rename arch/arm/plat-omap/dmtimer.c => drivers/clocksource/timer-dm.c (94%)
 rename {arch/arm/plat-omap/include/plat => include/clocksource}/dmtimer.h (97%)

-- 
1.9.1

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

* [PATCH v7 1/9] clocksource: dmtimer: Remove all the exports
  2018-01-09  6:22 [PATCH v7 0/9] omap: dmtimer: Move driver out of plat-omap Keerthy
@ 2018-01-09  6:22 ` Keerthy
  2018-01-09  6:23 ` [PATCH v7 2/9] arm: omap: timer: Wrap the inline functions under OMAP2PLUS define Keerthy
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 21+ messages in thread
From: Keerthy @ 2018-01-09  6:22 UTC (permalink / raw)
  To: daniel.lezcano, thierry.reding, tony, aaro.koskinen
  Cc: j-keerthy, Claudiu.Beznea, narmstrong, linux-pwm, ladis,
	linux-kernel, linux-arm-kernel, sebastian.reichel, linux-omap,
	robh+dt, t-kristo, grygorii.strashko

Remove all the unwanted exports from the driver

Signed-off-by: Keerthy <j-keerthy@ti.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Tested-by: Ladislav Michl <ladis@linux-mips.org>
---
 arch/arm/plat-omap/dmtimer.c | 27 ---------------------------
 1 file changed, 27 deletions(-)

diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
index d443e48..72565fc 100644
--- a/arch/arm/plat-omap/dmtimer.c
+++ b/arch/arm/plat-omap/dmtimer.c
@@ -302,7 +302,6 @@ struct omap_dm_timer *omap_dm_timer_request(void)
 {
 	return _omap_dm_timer_request(REQUEST_ANY, NULL);
 }
-EXPORT_SYMBOL_GPL(omap_dm_timer_request);
 
 struct omap_dm_timer *omap_dm_timer_request_specific(int id)
 {
@@ -315,7 +314,6 @@ struct omap_dm_timer *omap_dm_timer_request_specific(int id)
 
 	return _omap_dm_timer_request(REQUEST_BY_ID, &id);
 }
-EXPORT_SYMBOL_GPL(omap_dm_timer_request_specific);
 
 /**
  * omap_dm_timer_request_by_cap - Request a timer by capability
@@ -330,7 +328,6 @@ struct omap_dm_timer *omap_dm_timer_request_by_cap(u32 cap)
 {
 	return _omap_dm_timer_request(REQUEST_BY_CAP, &cap);
 }
-EXPORT_SYMBOL_GPL(omap_dm_timer_request_by_cap);
 
 /**
  * omap_dm_timer_request_by_node - Request a timer by device-tree node
@@ -346,7 +343,6 @@ struct omap_dm_timer *omap_dm_timer_request_by_node(struct device_node *np)
 
 	return _omap_dm_timer_request(REQUEST_BY_NODE, np);
 }
-EXPORT_SYMBOL_GPL(omap_dm_timer_request_by_node);
 
 int omap_dm_timer_free(struct omap_dm_timer *timer)
 {
@@ -359,7 +355,6 @@ int omap_dm_timer_free(struct omap_dm_timer *timer)
 	timer->reserved = 0;
 	return 0;
 }
-EXPORT_SYMBOL_GPL(omap_dm_timer_free);
 
 void omap_dm_timer_enable(struct omap_dm_timer *timer)
 {
@@ -379,13 +374,11 @@ void omap_dm_timer_enable(struct omap_dm_timer *timer)
 		}
 	}
 }
-EXPORT_SYMBOL_GPL(omap_dm_timer_enable);
 
 void omap_dm_timer_disable(struct omap_dm_timer *timer)
 {
 	pm_runtime_put_sync(&timer->pdev->dev);
 }
-EXPORT_SYMBOL_GPL(omap_dm_timer_disable);
 
 int omap_dm_timer_get_irq(struct omap_dm_timer *timer)
 {
@@ -393,7 +386,6 @@ int omap_dm_timer_get_irq(struct omap_dm_timer *timer)
 		return timer->irq;
 	return -EINVAL;
 }
-EXPORT_SYMBOL_GPL(omap_dm_timer_get_irq);
 
 #if defined(CONFIG_ARCH_OMAP1)
 #include <mach/hardware.h>
@@ -429,7 +421,6 @@ __u32 omap_dm_timer_modify_idlect_mask(__u32 inputmask)
 
 	return inputmask;
 }
-EXPORT_SYMBOL_GPL(omap_dm_timer_modify_idlect_mask);
 
 #else
 
@@ -439,7 +430,6 @@ struct clk *omap_dm_timer_get_fclk(struct omap_dm_timer *timer)
 		return timer->fclk;
 	return NULL;
 }
-EXPORT_SYMBOL_GPL(omap_dm_timer_get_fclk);
 
 __u32 omap_dm_timer_modify_idlect_mask(__u32 inputmask)
 {
@@ -447,7 +437,6 @@ __u32 omap_dm_timer_modify_idlect_mask(__u32 inputmask)
 
 	return 0;
 }
-EXPORT_SYMBOL_GPL(omap_dm_timer_modify_idlect_mask);
 
 #endif
 
@@ -461,7 +450,6 @@ int omap_dm_timer_trigger(struct omap_dm_timer *timer)
 	omap_dm_timer_write_reg(timer, OMAP_TIMER_TRIGGER_REG, 0);
 	return 0;
 }
-EXPORT_SYMBOL_GPL(omap_dm_timer_trigger);
 
 int omap_dm_timer_start(struct omap_dm_timer *timer)
 {
@@ -482,7 +470,6 @@ int omap_dm_timer_start(struct omap_dm_timer *timer)
 	timer->context.tclr = l;
 	return 0;
 }
-EXPORT_SYMBOL_GPL(omap_dm_timer_start);
 
 int omap_dm_timer_stop(struct omap_dm_timer *timer)
 {
@@ -506,7 +493,6 @@ int omap_dm_timer_stop(struct omap_dm_timer *timer)
 	omap_dm_timer_disable(timer);
 	return 0;
 }
-EXPORT_SYMBOL_GPL(omap_dm_timer_stop);
 
 int omap_dm_timer_set_source(struct omap_dm_timer *timer, int source)
 {
@@ -569,7 +555,6 @@ int omap_dm_timer_set_source(struct omap_dm_timer *timer, int source)
 
 	return ret;
 }
-EXPORT_SYMBOL_GPL(omap_dm_timer_set_source);
 
 int omap_dm_timer_set_load(struct omap_dm_timer *timer, int autoreload,
 			    unsigned int load)
@@ -595,7 +580,6 @@ int omap_dm_timer_set_load(struct omap_dm_timer *timer, int autoreload,
 	omap_dm_timer_disable(timer);
 	return 0;
 }
-EXPORT_SYMBOL_GPL(omap_dm_timer_set_load);
 
 /* Optimized set_load which removes costly spin wait in timer_start */
 int omap_dm_timer_set_load_start(struct omap_dm_timer *timer, int autoreload,
@@ -625,7 +609,6 @@ int omap_dm_timer_set_load_start(struct omap_dm_timer *timer, int autoreload,
 	timer->context.tcrr = load;
 	return 0;
 }
-EXPORT_SYMBOL_GPL(omap_dm_timer_set_load_start);
 
 int omap_dm_timer_set_match(struct omap_dm_timer *timer, int enable,
 			     unsigned int match)
@@ -650,7 +633,6 @@ int omap_dm_timer_set_match(struct omap_dm_timer *timer, int enable,
 	omap_dm_timer_disable(timer);
 	return 0;
 }
-EXPORT_SYMBOL_GPL(omap_dm_timer_set_match);
 
 int omap_dm_timer_set_pwm(struct omap_dm_timer *timer, int def_on,
 			   int toggle, int trigger)
@@ -676,7 +658,6 @@ int omap_dm_timer_set_pwm(struct omap_dm_timer *timer, int def_on,
 	omap_dm_timer_disable(timer);
 	return 0;
 }
-EXPORT_SYMBOL_GPL(omap_dm_timer_set_pwm);
 
 int omap_dm_timer_set_prescaler(struct omap_dm_timer *timer, int prescaler)
 {
@@ -699,7 +680,6 @@ int omap_dm_timer_set_prescaler(struct omap_dm_timer *timer, int prescaler)
 	omap_dm_timer_disable(timer);
 	return 0;
 }
-EXPORT_SYMBOL_GPL(omap_dm_timer_set_prescaler);
 
 int omap_dm_timer_set_int_enable(struct omap_dm_timer *timer,
 				  unsigned int value)
@@ -716,7 +696,6 @@ int omap_dm_timer_set_int_enable(struct omap_dm_timer *timer,
 	omap_dm_timer_disable(timer);
 	return 0;
 }
-EXPORT_SYMBOL_GPL(omap_dm_timer_set_int_enable);
 
 /**
  * omap_dm_timer_set_int_disable - disable timer interrupts
@@ -747,7 +726,6 @@ int omap_dm_timer_set_int_disable(struct omap_dm_timer *timer, u32 mask)
 	omap_dm_timer_disable(timer);
 	return 0;
 }
-EXPORT_SYMBOL_GPL(omap_dm_timer_set_int_disable);
 
 unsigned int omap_dm_timer_read_status(struct omap_dm_timer *timer)
 {
@@ -762,7 +740,6 @@ unsigned int omap_dm_timer_read_status(struct omap_dm_timer *timer)
 
 	return l;
 }
-EXPORT_SYMBOL_GPL(omap_dm_timer_read_status);
 
 int omap_dm_timer_write_status(struct omap_dm_timer *timer, unsigned int value)
 {
@@ -773,7 +750,6 @@ int omap_dm_timer_write_status(struct omap_dm_timer *timer, unsigned int value)
 
 	return 0;
 }
-EXPORT_SYMBOL_GPL(omap_dm_timer_write_status);
 
 unsigned int omap_dm_timer_read_counter(struct omap_dm_timer *timer)
 {
@@ -784,7 +760,6 @@ unsigned int omap_dm_timer_read_counter(struct omap_dm_timer *timer)
 
 	return __omap_dm_timer_read_counter(timer, timer->posted);
 }
-EXPORT_SYMBOL_GPL(omap_dm_timer_read_counter);
 
 int omap_dm_timer_write_counter(struct omap_dm_timer *timer, unsigned int value)
 {
@@ -799,7 +774,6 @@ int omap_dm_timer_write_counter(struct omap_dm_timer *timer, unsigned int value)
 	timer->context.tcrr = value;
 	return 0;
 }
-EXPORT_SYMBOL_GPL(omap_dm_timer_write_counter);
 
 int omap_dm_timers_active(void)
 {
@@ -816,7 +790,6 @@ int omap_dm_timers_active(void)
 	}
 	return 0;
 }
-EXPORT_SYMBOL_GPL(omap_dm_timers_active);
 
 static const struct of_device_id omap_timer_match[];
 
-- 
1.9.1

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

* [PATCH v7 2/9] arm: omap: timer: Wrap the inline functions under OMAP2PLUS define
  2018-01-09  6:22 [PATCH v7 0/9] omap: dmtimer: Move driver out of plat-omap Keerthy
  2018-01-09  6:22 ` [PATCH v7 1/9] clocksource: dmtimer: Remove all the exports Keerthy
@ 2018-01-09  6:23 ` Keerthy
  2018-01-09  9:19   ` Sebastian Reichel
  2018-01-09  6:23 ` [PATCH v7 3/9] arm: omap: Move dmtimer.h out of plat-omap Keerthy
                   ` (6 subsequent siblings)
  8 siblings, 1 reply; 21+ messages in thread
From: Keerthy @ 2018-01-09  6:23 UTC (permalink / raw)
  To: daniel.lezcano, thierry.reding, tony, aaro.koskinen
  Cc: j-keerthy, Claudiu.Beznea, narmstrong, linux-pwm, ladis,
	linux-kernel, linux-arm-kernel, sebastian.reichel, linux-omap,
	robh+dt, t-kristo, grygorii.strashko

Wrap the inline functions under OMAP2PLUS/OMAP1 defines.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Tested-by: Ladislav Michl <ladis@linux-mips.org>
---
 arch/arm/plat-omap/include/plat/dmtimer.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/arch/arm/plat-omap/include/plat/dmtimer.h b/arch/arm/plat-omap/include/plat/dmtimer.h
index dd79f30..862ad62 100644
--- a/arch/arm/plat-omap/include/plat/dmtimer.h
+++ b/arch/arm/plat-omap/include/plat/dmtimer.h
@@ -276,6 +276,12 @@ struct omap_dm_timer {
 #define OMAP_TIMER_TICK_INT_MASK_COUNT_REG				\
 		(_OMAP_TIMER_TICK_INT_MASK_COUNT_OFFSET | (WP_TOWR << WPSHIFT))
 
+/*
+ * The below are inlined to optimize code size for system timers. Other code
+ * should not need these at all, see
+ * include/linux/platform_data/pwm_omap_dmtimer.h
+ */
+#if defined(CONFIG_ARCH_OMAP1) || defined(CONFIG_ARCH_OMAP2PLUS)
 static inline u32 __omap_dm_timer_read(struct omap_dm_timer *timer, u32 reg,
 						int posted)
 {
@@ -414,5 +420,5 @@ static inline void __omap_dm_timer_write_status(struct omap_dm_timer *timer,
 {
 	writel_relaxed(value, timer->irq_stat);
 }
-
+#endif /* CONFIG_ARCH_OMAP1 || CONFIG_ARCH_OMAP2PLUS */
 #endif /* __ASM_ARCH_DMTIMER_H */
-- 
1.9.1

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

* [PATCH v7 3/9] arm: omap: Move dmtimer.h out of plat-omap
  2018-01-09  6:22 [PATCH v7 0/9] omap: dmtimer: Move driver out of plat-omap Keerthy
  2018-01-09  6:22 ` [PATCH v7 1/9] clocksource: dmtimer: Remove all the exports Keerthy
  2018-01-09  6:23 ` [PATCH v7 2/9] arm: omap: timer: Wrap the inline functions under OMAP2PLUS define Keerthy
@ 2018-01-09  6:23 ` Keerthy
  2018-02-13  2:06   ` Suman Anna
  2018-01-09  6:23 ` [PATCH v7 4/9] arm: OMAP: Move dmtimer driver out of plat-omap to drivers under clocksource Keerthy
                   ` (5 subsequent siblings)
  8 siblings, 1 reply; 21+ messages in thread
From: Keerthy @ 2018-01-09  6:23 UTC (permalink / raw)
  To: daniel.lezcano, thierry.reding, tony, aaro.koskinen
  Cc: j-keerthy, Claudiu.Beznea, narmstrong, linux-pwm, ladis,
	linux-kernel, linux-arm-kernel, sebastian.reichel, linux-omap,
	robh+dt, t-kristo, grygorii.strashko

The header file is currently under plat-omap directory
under arch/omap. Move this out to an accessible place.

No Code changes done to the header file.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Tested-by: Ladislav Michl <ladis@linux-mips.org>
---
 arch/arm/mach-omap1/pm.c                                           | 2 +-
 arch/arm/mach-omap1/timer.c                                        | 2 +-
 arch/arm/mach-omap2/omap_hwmod_2420_data.c                         | 2 +-
 arch/arm/mach-omap2/omap_hwmod_2430_data.c                         | 2 +-
 arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c                 | 2 +-
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c                         | 2 +-
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c                         | 2 +-
 arch/arm/mach-omap2/omap_hwmod_54xx_data.c                         | 2 +-
 arch/arm/mach-omap2/omap_hwmod_7xx_data.c                          | 2 +-
 arch/arm/mach-omap2/omap_hwmod_81xx_data.c                         | 2 +-
 arch/arm/mach-omap2/pdata-quirks.c                                 | 2 +-
 arch/arm/mach-omap2/timer.c                                        | 2 +-
 arch/arm/plat-omap/dmtimer.c                                       | 2 +-
 {arch/arm/plat-omap/include/plat => include/clocksource}/dmtimer.h | 0
 14 files changed, 13 insertions(+), 13 deletions(-)
 rename {arch/arm/plat-omap/include/plat => include/clocksource}/dmtimer.h (100%)

diff --git a/arch/arm/mach-omap1/pm.c b/arch/arm/mach-omap1/pm.c
index f1135bf..a07d47cf 100644
--- a/arch/arm/mach-omap1/pm.c
+++ b/arch/arm/mach-omap1/pm.c
@@ -55,7 +55,7 @@
 #include <mach/tc.h>
 #include <mach/mux.h>
 #include <linux/omap-dma.h>
-#include <plat/dmtimer.h>
+#include <clocksource/dmtimer.h>
 
 #include <mach/irqs.h>
 
diff --git a/arch/arm/mach-omap1/timer.c b/arch/arm/mach-omap1/timer.c
index 8fb1ec6..7c057ab 100644
--- a/arch/arm/mach-omap1/timer.c
+++ b/arch/arm/mach-omap1/timer.c
@@ -27,7 +27,7 @@
 #include <linux/platform_device.h>
 #include <linux/platform_data/dmtimer-omap.h>
 
-#include <plat/dmtimer.h>
+#include <clocksource/dmtimer.h>
 
 #include "soc.h"
 
diff --git a/arch/arm/mach-omap2/omap_hwmod_2420_data.c b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
index 0afb014..0a8b95f 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2420_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
@@ -16,7 +16,7 @@
 #include <linux/i2c-omap.h>
 #include <linux/platform_data/spi-omap2-mcspi.h>
 #include <linux/omap-dma.h>
-#include <plat/dmtimer.h>
+#include <clocksource/dmtimer.h>
 
 #include "omap_hwmod.h"
 #include "l3_2xxx.h"
diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
index 013b26b..16e3d8c 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
@@ -18,7 +18,7 @@
 #include <linux/platform_data/hsmmc-omap.h>
 #include <linux/platform_data/spi-omap2-mcspi.h>
 #include <linux/omap-dma.h>
-#include <plat/dmtimer.h>
+#include <clocksource/dmtimer.h>
 
 #include "omap_hwmod.h"
 #include "l3_2xxx.h"
diff --git a/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c b/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c
index 4b094cb..8a65f70 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c
@@ -11,7 +11,7 @@
 
 #include <linux/platform_data/gpio-omap.h>
 #include <linux/omap-dma.h>
-#include <plat/dmtimer.h>
+#include <clocksource/dmtimer.h>
 #include <linux/platform_data/spi-omap2-mcspi.h>
 
 #include "omap_hwmod.h"
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
index 1a2f224..b030137 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -25,7 +25,7 @@
 #include "l4_3xxx.h"
 #include <linux/platform_data/asoc-ti-mcbsp.h>
 #include <linux/platform_data/spi-omap2-mcspi.h>
-#include <plat/dmtimer.h>
+#include <clocksource/dmtimer.h>
 
 #include "soc.h"
 #include "omap_hwmod.h"
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index a1901c2..51c7d62 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -30,7 +30,7 @@
 
 #include <linux/platform_data/spi-omap2-mcspi.h>
 #include <linux/platform_data/asoc-ti-mcbsp.h>
-#include <plat/dmtimer.h>
+#include <clocksource/dmtimer.h>
 
 #include "omap_hwmod.h"
 #include "omap_hwmod_common_data.h"
diff --git a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c
index 988e7ea..530334e 100644
--- a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c
@@ -26,7 +26,7 @@
 #include <linux/omap-dma.h>
 #include <linux/platform_data/spi-omap2-mcspi.h>
 #include <linux/platform_data/asoc-ti-mcbsp.h>
-#include <plat/dmtimer.h>
+#include <clocksource/dmtimer.h>
 
 #include "omap_hwmod.h"
 #include "omap_hwmod_common_data.h"
diff --git a/arch/arm/mach-omap2/omap_hwmod_7xx_data.c b/arch/arm/mach-omap2/omap_hwmod_7xx_data.c
index 4c2a05b..2452649 100644
--- a/arch/arm/mach-omap2/omap_hwmod_7xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_7xx_data.c
@@ -26,7 +26,7 @@
 #include <linux/omap-dma.h>
 #include <linux/platform_data/spi-omap2-mcspi.h>
 #include <linux/platform_data/asoc-ti-mcbsp.h>
-#include <plat/dmtimer.h>
+#include <clocksource/dmtimer.h>
 
 #include "omap_hwmod.h"
 #include "omap_hwmod_common_data.h"
diff --git a/arch/arm/mach-omap2/omap_hwmod_81xx_data.c b/arch/arm/mach-omap2/omap_hwmod_81xx_data.c
index 84f1182..94f3bb1 100644
--- a/arch/arm/mach-omap2/omap_hwmod_81xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_81xx_data.c
@@ -18,7 +18,7 @@
 #include <linux/platform_data/gpio-omap.h>
 #include <linux/platform_data/hsmmc-omap.h>
 #include <linux/platform_data/spi-omap2-mcspi.h>
-#include <plat/dmtimer.h>
+#include <clocksource/dmtimer.h>
 
 #include "omap_hwmod_common_data.h"
 #include "cm81xx.h"
diff --git a/arch/arm/mach-omap2/pdata-quirks.c b/arch/arm/mach-omap2/pdata-quirks.c
index 6b433fc..ad9df86 100644
--- a/arch/arm/mach-omap2/pdata-quirks.c
+++ b/arch/arm/mach-omap2/pdata-quirks.c
@@ -27,7 +27,7 @@
 #include <linux/platform_data/pwm_omap_dmtimer.h>
 #include <linux/platform_data/media/ir-rx51.h>
 #include <linux/platform_data/asoc-ti-mcbsp.h>
-#include <plat/dmtimer.h>
+#include <clocksource/dmtimer.h>
 
 #include "common.h"
 #include "common-board-devices.h"
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
index ece09c9..31c1b01 100644
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@ -26,6 +26,7 @@
  * License. See the file "COPYING" in the main directory of this archive
  * for more details.
  */
+#include <clocksource/dmtimer.h>
 #include <linux/init.h>
 #include <linux/time.h>
 #include <linux/interrupt.h>
@@ -49,7 +50,6 @@
 #include "omap_hwmod.h"
 #include "omap_device.h"
 #include <plat/counter-32k.h>
-#include <plat/dmtimer.h>
 #include "omap-pm.h"
 
 #include "soc.h"
diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
index 72565fc..afe1dc9 100644
--- a/arch/arm/plat-omap/dmtimer.c
+++ b/arch/arm/plat-omap/dmtimer.c
@@ -47,7 +47,7 @@
 #include <linux/platform_device.h>
 #include <linux/platform_data/dmtimer-omap.h>
 
-#include <plat/dmtimer.h>
+#include <clocksource/dmtimer.h>
 
 static u32 omap_reserved_systimers;
 static LIST_HEAD(omap_timer_list);
diff --git a/arch/arm/plat-omap/include/plat/dmtimer.h b/include/clocksource/dmtimer.h
similarity index 100%
rename from arch/arm/plat-omap/include/plat/dmtimer.h
rename to include/clocksource/dmtimer.h
-- 
1.9.1

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

* [PATCH v7 4/9] arm: OMAP: Move dmtimer driver out of plat-omap to drivers under clocksource
  2018-01-09  6:22 [PATCH v7 0/9] omap: dmtimer: Move driver out of plat-omap Keerthy
                   ` (2 preceding siblings ...)
  2018-01-09  6:23 ` [PATCH v7 3/9] arm: omap: Move dmtimer.h out of plat-omap Keerthy
@ 2018-01-09  6:23 ` Keerthy
  2018-02-13  2:24   ` Suman Anna
  2018-01-09  6:23 ` [PATCH v7 5/9] dmtimer: Add timer ops to the platform data structure Keerthy
                   ` (4 subsequent siblings)
  8 siblings, 1 reply; 21+ messages in thread
From: Keerthy @ 2018-01-09  6:23 UTC (permalink / raw)
  To: daniel.lezcano, thierry.reding, tony, aaro.koskinen
  Cc: j-keerthy, Claudiu.Beznea, narmstrong, linux-pwm, ladis,
	linux-kernel, linux-arm-kernel, sebastian.reichel, linux-omap,
	robh+dt, t-kristo, grygorii.strashko

Move the dmtimer driver out of plat-omap to clocksource.
So that non-omap devices also could use this.

No Code changes done to the driver file only renamed to timer-dm.c.
Also removed the config dependencies for OMAP_DM_TIMER.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Tested-by: Ladislav Michl <ladis@linux-mips.org>
---
 arch/arm/plat-omap/Kconfig                                     | 6 ------
 arch/arm/plat-omap/Makefile                                    | 1 -
 drivers/clocksource/Kconfig                                    | 3 +++
 drivers/clocksource/Makefile                                   | 1 +
 arch/arm/plat-omap/dmtimer.c => drivers/clocksource/timer-dm.c | 0
 5 files changed, 4 insertions(+), 7 deletions(-)
 rename arch/arm/plat-omap/dmtimer.c => drivers/clocksource/timer-dm.c (100%)

diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig
index 7276afe..afc1a1d 100644
--- a/arch/arm/plat-omap/Kconfig
+++ b/arch/arm/plat-omap/Kconfig
@@ -106,12 +106,6 @@ config OMAP3_L2_AUX_SECURE_SERVICE_SET_ID
 	help
 	  PPA routine service ID for setting L2 auxiliary control register.
 
-config OMAP_DM_TIMER
-	bool "Use dual-mode timer"
-	depends on ARCH_OMAP16XX || ARCH_OMAP2PLUS
-	help
-	 Select this option if you want to use OMAP Dual-Mode timers.
-
 config OMAP_SERIAL_WAKE
 	bool "Enable wake-up events for serial ports"
 	depends on ARCH_OMAP1 && OMAP_MUX
diff --git a/arch/arm/plat-omap/Makefile b/arch/arm/plat-omap/Makefile
index 47e1867..7215ada 100644
--- a/arch/arm/plat-omap/Makefile
+++ b/arch/arm/plat-omap/Makefile
@@ -9,5 +9,4 @@ obj-y := sram.o dma.o counter_32k.o
 
 # omap_device support (OMAP2+ only at the moment)
 
-obj-$(CONFIG_OMAP_DM_TIMER) += dmtimer.o
 obj-$(CONFIG_OMAP_DEBUG_LEDS) += debug-leds.o
diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index c729a88..3f799b2 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -21,6 +21,9 @@ config CLKEVT_I8253
 config I8253_LOCK
 	bool
 
+config OMAP_DM_TIMER
+	bool
+
 config CLKBLD_I8253
 	def_bool y if CLKSRC_I8253 || CLKEVT_I8253 || I8253_LOCK
 
diff --git a/drivers/clocksource/Makefile b/drivers/clocksource/Makefile
index 72711f1..27b5497 100644
--- a/drivers/clocksource/Makefile
+++ b/drivers/clocksource/Makefile
@@ -16,6 +16,7 @@ obj-$(CONFIG_EM_TIMER_STI)	+= em_sti.o
 obj-$(CONFIG_CLKBLD_I8253)	+= i8253.o
 obj-$(CONFIG_CLKSRC_MMIO)	+= mmio.o
 obj-$(CONFIG_DIGICOLOR_TIMER)	+= timer-digicolor.o
+obj-$(CONFIG_OMAP_DM_TIMER)	+= timer-dm.o
 obj-$(CONFIG_DW_APB_TIMER)	+= dw_apb_timer.o
 obj-$(CONFIG_DW_APB_TIMER_OF)	+= dw_apb_timer_of.o
 obj-$(CONFIG_FTTMR010_TIMER)	+= timer-fttmr010.o
diff --git a/arch/arm/plat-omap/dmtimer.c b/drivers/clocksource/timer-dm.c
similarity index 100%
rename from arch/arm/plat-omap/dmtimer.c
rename to drivers/clocksource/timer-dm.c
-- 
1.9.1

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

* [PATCH v7 5/9] dmtimer: Add timer ops to the platform data structure
  2018-01-09  6:22 [PATCH v7 0/9] omap: dmtimer: Move driver out of plat-omap Keerthy
                   ` (3 preceding siblings ...)
  2018-01-09  6:23 ` [PATCH v7 4/9] arm: OMAP: Move dmtimer driver out of plat-omap to drivers under clocksource Keerthy
@ 2018-01-09  6:23 ` Keerthy
  2018-02-13  2:46   ` Suman Anna
  2018-01-09  6:23 ` [PATCH v7 6/9] clocksource: dmtimer: Populate the timer ops to the pdata Keerthy
                   ` (3 subsequent siblings)
  8 siblings, 1 reply; 21+ messages in thread
From: Keerthy @ 2018-01-09  6:23 UTC (permalink / raw)
  To: daniel.lezcano, thierry.reding, tony, aaro.koskinen
  Cc: j-keerthy, Claudiu.Beznea, narmstrong, linux-pwm, ladis,
	linux-kernel, linux-arm-kernel, sebastian.reichel, linux-omap,
	robh+dt, t-kristo, grygorii.strashko

Add timer ops to the platform data structure

Signed-off-by: Keerthy <j-keerthy@ti.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Tested-by: Ladislav Michl <ladis@linux-mips.org>
---
 include/linux/platform_data/dmtimer-omap.h | 38 ++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/include/linux/platform_data/dmtimer-omap.h b/include/linux/platform_data/dmtimer-omap.h
index a19b78d..a3e1794 100644
--- a/include/linux/platform_data/dmtimer-omap.h
+++ b/include/linux/platform_data/dmtimer-omap.h
@@ -20,12 +20,50 @@
 #ifndef __PLATFORM_DATA_DMTIMER_OMAP_H__
 #define __PLATFORM_DATA_DMTIMER_OMAP_H__
 
+struct omap_dm_timer_ops {
+	struct omap_dm_timer *(*request_by_node)(struct device_node *np);
+	struct omap_dm_timer *(*request_specific)(int timer_id);
+	struct omap_dm_timer *(*request)(void);
+
+	int	(*free)(struct omap_dm_timer *timer);
+
+	void	(*enable)(struct omap_dm_timer *timer);
+	void	(*disable)(struct omap_dm_timer *timer);
+
+	int	(*get_irq)(struct omap_dm_timer *timer);
+	int	(*set_int_enable)(struct omap_dm_timer *timer,
+				  unsigned int value);
+	int	(*set_int_disable)(struct omap_dm_timer *timer, u32 mask);
+
+	struct clk *(*get_fclk)(struct omap_dm_timer *timer);
+
+	int	(*start)(struct omap_dm_timer *timer);
+	int	(*stop)(struct omap_dm_timer *timer);
+	int	(*set_source)(struct omap_dm_timer *timer, int source);
+
+	int	(*set_load)(struct omap_dm_timer *timer, int autoreload,
+			    unsigned int value);
+	int	(*set_match)(struct omap_dm_timer *timer, int enable,
+			     unsigned int match);
+	int	(*set_pwm)(struct omap_dm_timer *timer, int def_on,
+			   int toggle, int trigger);
+	int	(*set_prescaler)(struct omap_dm_timer *timer, int prescaler);
+
+	unsigned int (*read_counter)(struct omap_dm_timer *timer);
+	int	(*write_counter)(struct omap_dm_timer *timer,
+				 unsigned int value);
+	unsigned int (*read_status)(struct omap_dm_timer *timer);
+	int	(*write_status)(struct omap_dm_timer *timer,
+				unsigned int value);
+};
+
 struct dmtimer_platform_data {
 	/* set_timer_src - Only used for OMAP1 devices */
 	int (*set_timer_src)(struct platform_device *pdev, int source);
 	u32 timer_capability;
 	u32 timer_errata;
 	int (*get_context_loss_count)(struct device *);
+	struct omap_dm_timer_ops *timer_ops;
 };
 
 #endif /* __PLATFORM_DATA_DMTIMER_OMAP_H__ */
-- 
1.9.1

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

* [PATCH v7 6/9] clocksource: dmtimer: Populate the timer ops to the pdata
  2018-01-09  6:22 [PATCH v7 0/9] omap: dmtimer: Move driver out of plat-omap Keerthy
                   ` (4 preceding siblings ...)
  2018-01-09  6:23 ` [PATCH v7 5/9] dmtimer: Add timer ops to the platform data structure Keerthy
@ 2018-01-09  6:23 ` Keerthy
  2018-01-09  6:23 ` [PATCH v7 7/9] clocksource: timer-dm: Hook device platform data if not already assigned Keerthy
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 21+ messages in thread
From: Keerthy @ 2018-01-09  6:23 UTC (permalink / raw)
  To: daniel.lezcano, thierry.reding, tony, aaro.koskinen
  Cc: j-keerthy, Claudiu.Beznea, narmstrong, linux-pwm, ladis,
	linux-kernel, linux-arm-kernel, sebastian.reichel, linux-omap,
	robh+dt, t-kristo, grygorii.strashko

Add the timer ops to the platform data

Signed-off-by: Keerthy <j-keerthy@ti.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Tested-by: Ladislav Michl <ladis@linux-mips.org>
---
 drivers/clocksource/timer-dm.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/drivers/clocksource/timer-dm.c b/drivers/clocksource/timer-dm.c
index afe1dc9..1cbd954 100644
--- a/drivers/clocksource/timer-dm.c
+++ b/drivers/clocksource/timer-dm.c
@@ -922,8 +922,33 @@ static int omap_dm_timer_remove(struct platform_device *pdev)
 	return ret;
 }
 
+static struct omap_dm_timer_ops dmtimer_ops = {
+	.request_by_node = omap_dm_timer_request_by_node,
+	.request_specific = omap_dm_timer_request_specific,
+	.request = omap_dm_timer_request,
+	.set_source = omap_dm_timer_set_source,
+	.get_irq = omap_dm_timer_get_irq,
+	.set_int_enable = omap_dm_timer_set_int_enable,
+	.set_int_disable = omap_dm_timer_set_int_disable,
+	.free = omap_dm_timer_free,
+	.enable = omap_dm_timer_enable,
+	.disable = omap_dm_timer_disable,
+	.get_fclk = omap_dm_timer_get_fclk,
+	.start = omap_dm_timer_start,
+	.stop = omap_dm_timer_stop,
+	.set_load = omap_dm_timer_set_load,
+	.set_match = omap_dm_timer_set_match,
+	.set_pwm = omap_dm_timer_set_pwm,
+	.set_prescaler = omap_dm_timer_set_prescaler,
+	.read_counter = omap_dm_timer_read_counter,
+	.write_counter = omap_dm_timer_write_counter,
+	.read_status = omap_dm_timer_read_status,
+	.write_status = omap_dm_timer_write_status,
+};
+
 static const struct dmtimer_platform_data omap3plus_pdata = {
 	.timer_errata = OMAP_TIMER_ERRATA_I103_I767,
+	.timer_ops = &dmtimer_ops,
 };
 
 static const struct of_device_id omap_timer_match[] = {
-- 
1.9.1

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

* [PATCH v7 7/9] clocksource: timer-dm: Hook device platform data if not already assigned
  2018-01-09  6:22 [PATCH v7 0/9] omap: dmtimer: Move driver out of plat-omap Keerthy
                   ` (5 preceding siblings ...)
  2018-01-09  6:23 ` [PATCH v7 6/9] clocksource: dmtimer: Populate the timer ops to the pdata Keerthy
@ 2018-01-09  6:23 ` Keerthy
  2018-01-09  9:19   ` Sebastian Reichel
  2018-01-09  6:23 ` [PATCH v7 8/9] pwm: pwm-omap-dmtimer: Adapt driver to utilize dmtimer pdata ops Keerthy
  2018-01-09  6:23 ` [PATCH v7 9/9] arm: omap: pdata-quirks: Remove unused timer pdata Keerthy
  8 siblings, 1 reply; 21+ messages in thread
From: Keerthy @ 2018-01-09  6:23 UTC (permalink / raw)
  To: daniel.lezcano, thierry.reding, tony, aaro.koskinen
  Cc: j-keerthy, Claudiu.Beznea, narmstrong, linux-pwm, ladis,
	linux-kernel, linux-arm-kernel, sebastian.reichel, linux-omap,
	robh+dt, t-kristo, grygorii.strashko

From: Ladislav Michl <ladis@linux-mips.org>

In the case of device tree boot the device platform data is usually
NULL so hook the platform data obtained from the match.
As part of un-constify the platform_data pointer.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Signed-off-by: Keerthy <j-keerthy@ti.com>
---
 drivers/clocksource/timer-dm.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/clocksource/timer-dm.c b/drivers/clocksource/timer-dm.c
index 1cbd954..60db173 100644
--- a/drivers/clocksource/timer-dm.c
+++ b/drivers/clocksource/timer-dm.c
@@ -806,14 +806,16 @@ static int omap_dm_timer_probe(struct platform_device *pdev)
 	struct omap_dm_timer *timer;
 	struct resource *mem, *irq;
 	struct device *dev = &pdev->dev;
-	const struct of_device_id *match;
 	const struct dmtimer_platform_data *pdata;
 	int ret;
 
-	match = of_match_device(of_match_ptr(omap_timer_match), dev);
-	pdata = match ? match->data : dev->platform_data;
+	pdata = of_device_get_match_data(dev);
+	if (!pdata)
+		pdata = dev_get_platdata(dev);
+	else
+		dev->platform_data = (void *)pdata;
 
-	if (!pdata && !dev->of_node) {
+	if (!pdata) {
 		dev_err(dev, "%s: no platform data.\n", __func__);
 		return -ENODEV;
 	}
-- 
1.9.1

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

* [PATCH v7 8/9] pwm: pwm-omap-dmtimer: Adapt driver to utilize dmtimer pdata ops
  2018-01-09  6:22 [PATCH v7 0/9] omap: dmtimer: Move driver out of plat-omap Keerthy
                   ` (6 preceding siblings ...)
  2018-01-09  6:23 ` [PATCH v7 7/9] clocksource: timer-dm: Hook device platform data if not already assigned Keerthy
@ 2018-01-09  6:23 ` Keerthy
  2018-01-09  6:23 ` [PATCH v7 9/9] arm: omap: pdata-quirks: Remove unused timer pdata Keerthy
  8 siblings, 0 replies; 21+ messages in thread
From: Keerthy @ 2018-01-09  6:23 UTC (permalink / raw)
  To: daniel.lezcano, thierry.reding, tony, aaro.koskinen
  Cc: j-keerthy, Claudiu.Beznea, narmstrong, linux-pwm, ladis,
	linux-kernel, linux-arm-kernel, sebastian.reichel, linux-omap,
	robh+dt, t-kristo, grygorii.strashko

Adapt driver to utilize dmtimer pdata ops instead of pdata-quirks.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Acked-by: Neil Armstrong <narmstrong@baylibre.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
 drivers/pwm/pwm-omap-dmtimer.c | 68 ++++++++++++++++++++++++++----------------
 1 file changed, 43 insertions(+), 25 deletions(-)

diff --git a/drivers/pwm/pwm-omap-dmtimer.c b/drivers/pwm/pwm-omap-dmtimer.c
index 5ad42f3..cc485d9 100644
--- a/drivers/pwm/pwm-omap-dmtimer.c
+++ b/drivers/pwm/pwm-omap-dmtimer.c
@@ -23,6 +23,7 @@
 #include <linux/mutex.h>
 #include <linux/of.h>
 #include <linux/of_platform.h>
+#include <linux/platform_data/dmtimer-omap.h>
 #include <linux/platform_data/pwm_omap_dmtimer.h>
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
@@ -37,7 +38,7 @@ struct pwm_omap_dmtimer_chip {
 	struct pwm_chip chip;
 	struct mutex mutex;
 	pwm_omap_dmtimer *dm_timer;
-	struct pwm_omap_dmtimer_pdata *pdata;
+	struct omap_dm_timer_ops *pdata;
 	struct platform_device *dm_timer_pdev;
 };
 
@@ -242,19 +243,35 @@ static int pwm_omap_dmtimer_probe(struct platform_device *pdev)
 {
 	struct device_node *np = pdev->dev.of_node;
 	struct device_node *timer;
+	struct platform_device *timer_pdev;
 	struct pwm_omap_dmtimer_chip *omap;
-	struct pwm_omap_dmtimer_pdata *pdata;
+	struct dmtimer_platform_data *timer_pdata;
+	struct omap_dm_timer_ops *pdata;
 	pwm_omap_dmtimer *dm_timer;
 	u32 v;
-	int status;
+	int status, ret;
 
-	pdata = dev_get_platdata(&pdev->dev);
-	if (!pdata) {
-		dev_err(&pdev->dev, "Missing dmtimer platform data\n");
-		return -EINVAL;
+	timer = of_parse_phandle(np, "ti,timers", 0);
+	if (!timer)
+		return -ENODEV;
+
+	timer_pdev = of_find_device_by_node(timer);
+	if (!timer_pdev) {
+		dev_err(&pdev->dev, "Unable to find Timer pdev\n");
+		ret = -ENODEV;
+		goto put;
 	}
 
-	if (!pdata->request_by_node ||
+	timer_pdata = dev_get_platdata(&timer_pdev->dev);
+	if (!timer_pdata) {
+		dev_err(&pdev->dev, "dmtimer pdata structure NULL\n");
+		ret = -EINVAL;
+		goto put;
+	}
+
+	pdata = timer_pdata->timer_ops;
+
+	if (!pdata || !pdata->request_by_node ||
 	    !pdata->free ||
 	    !pdata->enable ||
 	    !pdata->disable ||
@@ -267,37 +284,32 @@ static int pwm_omap_dmtimer_probe(struct platform_device *pdev)
 	    !pdata->set_prescaler ||
 	    !pdata->write_counter) {
 		dev_err(&pdev->dev, "Incomplete dmtimer pdata structure\n");
-		return -EINVAL;
+		ret = -EINVAL;
+		goto put;
 	}
 
-	timer = of_parse_phandle(np, "ti,timers", 0);
-	if (!timer)
-		return -ENODEV;
-
 	if (!of_get_property(timer, "ti,timer-pwm", NULL)) {
 		dev_err(&pdev->dev, "Missing ti,timer-pwm capability\n");
-		return -ENODEV;
+		ret = -ENODEV;
+		goto put;
 	}
 
 	dm_timer = pdata->request_by_node(timer);
-	if (!dm_timer)
-		return -EPROBE_DEFER;
+	if (!dm_timer) {
+		ret = -EPROBE_DEFER;
+		goto put;
+	}
 
 	omap = devm_kzalloc(&pdev->dev, sizeof(*omap), GFP_KERNEL);
 	if (!omap) {
 		pdata->free(dm_timer);
-		return -ENOMEM;
+		ret = -ENOMEM;
+		goto put;
 	}
 
 	omap->pdata = pdata;
 	omap->dm_timer = dm_timer;
-
-	omap->dm_timer_pdev = of_find_device_by_node(timer);
-	if (!omap->dm_timer_pdev) {
-		dev_err(&pdev->dev, "Unable to find timer pdev\n");
-		omap->pdata->free(dm_timer);
-		return -EINVAL;
-	}
+	omap->dm_timer_pdev = timer_pdev;
 
 	/*
 	 * Ensure that the timer is stopped before we allow PWM core to call
@@ -326,12 +338,18 @@ static int pwm_omap_dmtimer_probe(struct platform_device *pdev)
 	if (status < 0) {
 		dev_err(&pdev->dev, "failed to register PWM\n");
 		omap->pdata->free(omap->dm_timer);
-		return status;
+		ret = status;
+		goto put;
 	}
 
 	platform_set_drvdata(pdev, omap);
 
 	return 0;
+
+put:
+	of_node_put(timer);
+
+	return ret;
 }
 
 static int pwm_omap_dmtimer_remove(struct platform_device *pdev)
-- 
1.9.1

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

* [PATCH v7 9/9] arm: omap: pdata-quirks: Remove unused timer pdata
  2018-01-09  6:22 [PATCH v7 0/9] omap: dmtimer: Move driver out of plat-omap Keerthy
                   ` (7 preceding siblings ...)
  2018-01-09  6:23 ` [PATCH v7 8/9] pwm: pwm-omap-dmtimer: Adapt driver to utilize dmtimer pdata ops Keerthy
@ 2018-01-09  6:23 ` Keerthy
  8 siblings, 0 replies; 21+ messages in thread
From: Keerthy @ 2018-01-09  6:23 UTC (permalink / raw)
  To: daniel.lezcano, thierry.reding, tony, aaro.koskinen
  Cc: j-keerthy, Claudiu.Beznea, narmstrong, linux-pwm, ladis,
	linux-kernel, linux-arm-kernel, sebastian.reichel, linux-omap,
	robh+dt, t-kristo, grygorii.strashko

Remove unused timer pdata.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Tested-by: Ladislav Michl <ladis@linux-mips.org>
---
 arch/arm/mach-omap2/pdata-quirks.c | 32 --------------------------------
 1 file changed, 32 deletions(-)

diff --git a/arch/arm/mach-omap2/pdata-quirks.c b/arch/arm/mach-omap2/pdata-quirks.c
index ad9df86..e7d7fc7 100644
--- a/arch/arm/mach-omap2/pdata-quirks.c
+++ b/arch/arm/mach-omap2/pdata-quirks.c
@@ -24,10 +24,8 @@
 #include <linux/platform_data/hsmmc-omap.h>
 #include <linux/platform_data/iommu-omap.h>
 #include <linux/platform_data/wkup_m3.h>
-#include <linux/platform_data/pwm_omap_dmtimer.h>
 #include <linux/platform_data/media/ir-rx51.h>
 #include <linux/platform_data/asoc-ti-mcbsp.h>
-#include <clocksource/dmtimer.h>
 
 #include "common.h"
 #include "common-board-devices.h"
@@ -477,33 +475,6 @@ void omap_auxdata_legacy_init(struct device *dev)
 	dev->platform_data = &twl_gpio_auxdata;
 }
 
-/* Dual mode timer PWM callbacks platdata */
-#if IS_ENABLED(CONFIG_OMAP_DM_TIMER)
-static struct pwm_omap_dmtimer_pdata pwm_dmtimer_pdata = {
-	.request_by_node = omap_dm_timer_request_by_node,
-	.request_specific = omap_dm_timer_request_specific,
-	.request = omap_dm_timer_request,
-	.set_source = omap_dm_timer_set_source,
-	.get_irq = omap_dm_timer_get_irq,
-	.set_int_enable = omap_dm_timer_set_int_enable,
-	.set_int_disable = omap_dm_timer_set_int_disable,
-	.free = omap_dm_timer_free,
-	.enable = omap_dm_timer_enable,
-	.disable = omap_dm_timer_disable,
-	.get_fclk = omap_dm_timer_get_fclk,
-	.start = omap_dm_timer_start,
-	.stop = omap_dm_timer_stop,
-	.set_load = omap_dm_timer_set_load,
-	.set_match = omap_dm_timer_set_match,
-	.set_pwm = omap_dm_timer_set_pwm,
-	.set_prescaler = omap_dm_timer_set_prescaler,
-	.read_counter = omap_dm_timer_read_counter,
-	.write_counter = omap_dm_timer_write_counter,
-	.read_status = omap_dm_timer_read_status,
-	.write_status = omap_dm_timer_write_status,
-};
-#endif
-
 static struct ir_rx51_platform_data __maybe_unused rx51_ir_data = {
 	.set_max_mpu_wakeup_lat = omap_pm_set_max_mpu_wakeup_lat,
 };
@@ -572,9 +543,6 @@ static void __init omap3_mcbsp_init(void) {}
 	OF_DEV_AUXDATA("ti,am4372-wkup-m3", 0x44d00000, "44d00000.wkup_m3",
 		       &wkup_m3_data),
 #endif
-#if IS_ENABLED(CONFIG_OMAP_DM_TIMER)
-	OF_DEV_AUXDATA("ti,omap-dmtimer-pwm", 0, NULL, &pwm_dmtimer_pdata),
-#endif
 #if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5)
 	OF_DEV_AUXDATA("ti,omap4-iommu", 0x4a066000, "4a066000.mmu",
 		       &omap4_iommu_pdata),
-- 
1.9.1

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

* Re: [PATCH v7 2/9] arm: omap: timer: Wrap the inline functions under OMAP2PLUS define
  2018-01-09  6:23 ` [PATCH v7 2/9] arm: omap: timer: Wrap the inline functions under OMAP2PLUS define Keerthy
@ 2018-01-09  9:19   ` Sebastian Reichel
  0 siblings, 0 replies; 21+ messages in thread
From: Sebastian Reichel @ 2018-01-09  9:19 UTC (permalink / raw)
  To: Keerthy
  Cc: daniel.lezcano, thierry.reding, tony, aaro.koskinen,
	Claudiu.Beznea, narmstrong, linux-pwm, ladis, linux-kernel,
	linux-arm-kernel, linux-omap, robh+dt, t-kristo,
	grygorii.strashko

[-- Attachment #1: Type: text/plain, Size: 1495 bytes --]

Hi,

On Tue, Jan 09, 2018 at 11:53:00AM +0530, Keerthy wrote:
> Wrap the inline functions under OMAP2PLUS/OMAP1 defines.
> 
> Signed-off-by: Keerthy <j-keerthy@ti.com>
> Tested-by: Ladislav Michl <ladis@linux-mips.org>

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

-- Sebastian

> ---
>  arch/arm/plat-omap/include/plat/dmtimer.h | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/plat-omap/include/plat/dmtimer.h b/arch/arm/plat-omap/include/plat/dmtimer.h
> index dd79f30..862ad62 100644
> --- a/arch/arm/plat-omap/include/plat/dmtimer.h
> +++ b/arch/arm/plat-omap/include/plat/dmtimer.h
> @@ -276,6 +276,12 @@ struct omap_dm_timer {
>  #define OMAP_TIMER_TICK_INT_MASK_COUNT_REG				\
>  		(_OMAP_TIMER_TICK_INT_MASK_COUNT_OFFSET | (WP_TOWR << WPSHIFT))
>  
> +/*
> + * The below are inlined to optimize code size for system timers. Other code
> + * should not need these at all, see
> + * include/linux/platform_data/pwm_omap_dmtimer.h
> + */
> +#if defined(CONFIG_ARCH_OMAP1) || defined(CONFIG_ARCH_OMAP2PLUS)
>  static inline u32 __omap_dm_timer_read(struct omap_dm_timer *timer, u32 reg,
>  						int posted)
>  {
> @@ -414,5 +420,5 @@ static inline void __omap_dm_timer_write_status(struct omap_dm_timer *timer,
>  {
>  	writel_relaxed(value, timer->irq_stat);
>  }
> -
> +#endif /* CONFIG_ARCH_OMAP1 || CONFIG_ARCH_OMAP2PLUS */
>  #endif /* __ASM_ARCH_DMTIMER_H */
> -- 
> 1.9.1
> 

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

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

* Re: [PATCH v7 7/9] clocksource: timer-dm: Hook device platform data if not already assigned
  2018-01-09  6:23 ` [PATCH v7 7/9] clocksource: timer-dm: Hook device platform data if not already assigned Keerthy
@ 2018-01-09  9:19   ` Sebastian Reichel
  0 siblings, 0 replies; 21+ messages in thread
From: Sebastian Reichel @ 2018-01-09  9:19 UTC (permalink / raw)
  To: Keerthy
  Cc: daniel.lezcano, thierry.reding, tony, aaro.koskinen,
	Claudiu.Beznea, narmstrong, linux-pwm, ladis, linux-kernel,
	linux-arm-kernel, linux-omap, robh+dt, t-kristo,
	grygorii.strashko

[-- Attachment #1: Type: text/plain, Size: 1740 bytes --]

Hi,

On Tue, Jan 09, 2018 at 11:53:05AM +0530, Keerthy wrote:
> From: Ladislav Michl <ladis@linux-mips.org>
> 
> In the case of device tree boot the device platform data is usually
> NULL so hook the platform data obtained from the match.
> As part of un-constify the platform_data pointer.
> 
> Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
> Signed-off-by: Keerthy <j-keerthy@ti.com>

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

-- Sebastian

> ---
>  drivers/clocksource/timer-dm.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/clocksource/timer-dm.c b/drivers/clocksource/timer-dm.c
> index 1cbd954..60db173 100644
> --- a/drivers/clocksource/timer-dm.c
> +++ b/drivers/clocksource/timer-dm.c
> @@ -806,14 +806,16 @@ static int omap_dm_timer_probe(struct platform_device *pdev)
>  	struct omap_dm_timer *timer;
>  	struct resource *mem, *irq;
>  	struct device *dev = &pdev->dev;
> -	const struct of_device_id *match;
>  	const struct dmtimer_platform_data *pdata;
>  	int ret;
>  
> -	match = of_match_device(of_match_ptr(omap_timer_match), dev);
> -	pdata = match ? match->data : dev->platform_data;
> +	pdata = of_device_get_match_data(dev);
> +	if (!pdata)
> +		pdata = dev_get_platdata(dev);
> +	else
> +		dev->platform_data = (void *)pdata;
>  
> -	if (!pdata && !dev->of_node) {
> +	if (!pdata) {
>  		dev_err(dev, "%s: no platform data.\n", __func__);
>  		return -ENODEV;
>  	}
> -- 
> 1.9.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

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

* Re: [PATCH v7 3/9] arm: omap: Move dmtimer.h out of plat-omap
  2018-01-09  6:23 ` [PATCH v7 3/9] arm: omap: Move dmtimer.h out of plat-omap Keerthy
@ 2018-02-13  2:06   ` Suman Anna
  2018-02-13 15:09     ` Tony Lindgren
  2018-02-14  4:50     ` Keerthy
  0 siblings, 2 replies; 21+ messages in thread
From: Suman Anna @ 2018-02-13  2:06 UTC (permalink / raw)
  To: J, KEERTHY, daniel.lezcano, thierry.reding, tony, aaro.koskinen
  Cc: Claudiu.Beznea, narmstrong, linux-pwm, ladis, linux-kernel,
	linux-arm-kernel, sebastian.reichel, linux-omap, robh+dt, Kristo,
	Tero, Strashko, Grygorii

Hi Keerthy,

On 01/09/2018 12:23 AM, J, KEERTHY wrote:
> The header file is currently under plat-omap directory
> under arch/omap. Move this out to an accessible place.
> 
> No Code changes done to the header file.
> 
> Signed-off-by: Keerthy <j-keerthy@ti.com>
> Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
> Tested-by: Ladislav Michl <ladis@linux-mips.org>
> ---
>   arch/arm/mach-omap1/pm.c                                           | 2 +-
>   arch/arm/mach-omap1/timer.c                                        | 2 +-
>   arch/arm/mach-omap2/omap_hwmod_2420_data.c                         | 2 +-
>   arch/arm/mach-omap2/omap_hwmod_2430_data.c                         | 2 +-
>   arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c                 | 2 +-
>   arch/arm/mach-omap2/omap_hwmod_3xxx_data.c                         | 2 +-
>   arch/arm/mach-omap2/omap_hwmod_44xx_data.c                         | 2 +-
>   arch/arm/mach-omap2/omap_hwmod_54xx_data.c                         | 2 +-
>   arch/arm/mach-omap2/omap_hwmod_7xx_data.c                          | 2 +-
>   arch/arm/mach-omap2/omap_hwmod_81xx_data.c                         | 2 +-
>   arch/arm/mach-omap2/pdata-quirks.c                                 | 2 +-
>   arch/arm/mach-omap2/timer.c                                        | 2 +-
>   arch/arm/plat-omap/dmtimer.c                                       | 2 +-
>   {arch/arm/plat-omap/include/plat => include/clocksource}/dmtimer.h | 0
>   14 files changed, 13 insertions(+), 13 deletions(-)
>   rename {arch/arm/plat-omap/include/plat => include/clocksource}/dmtimer.h (100%)
> 
> diff --git a/arch/arm/mach-omap1/pm.c b/arch/arm/mach-omap1/pm.c
> index f1135bf..a07d47cf 100644
> --- a/arch/arm/mach-omap1/pm.c
> +++ b/arch/arm/mach-omap1/pm.c
> @@ -55,7 +55,7 @@
>   #include <mach/tc.h>
>   #include <mach/mux.h>
>   #include <linux/omap-dma.h>
> -#include <plat/dmtimer.h>
> +#include <clocksource/dmtimer.h>
> 
>   #include <mach/irqs.h>
> 
> diff --git a/arch/arm/mach-omap1/timer.c b/arch/arm/mach-omap1/timer.c
> index 8fb1ec6..7c057ab 100644
> --- a/arch/arm/mach-omap1/timer.c
> +++ b/arch/arm/mach-omap1/timer.c
> @@ -27,7 +27,7 @@
>   #include <linux/platform_device.h>
>   #include <linux/platform_data/dmtimer-omap.h>
> 
> -#include <plat/dmtimer.h>
> +#include <clocksource/dmtimer.h>
> 
>   #include "soc.h"
> 
> diff --git a/arch/arm/mach-omap2/omap_hwmod_2420_data.c 
> b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
> index 0afb014..0a8b95f 100644
> --- a/arch/arm/mach-omap2/omap_hwmod_2420_data.c
> +++ b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
> @@ -16,7 +16,7 @@
>   #include <linux/i2c-omap.h>
>   #include <linux/platform_data/spi-omap2-mcspi.h>
>   #include <linux/omap-dma.h>
> -#include <plat/dmtimer.h>
> +#include <clocksource/dmtimer.h>
> 
>   #include "omap_hwmod.h"
>   #include "l3_2xxx.h"
> diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c 
> b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
> index 013b26b..16e3d8c 100644
> --- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c
> +++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
> @@ -18,7 +18,7 @@
>   #include <linux/platform_data/hsmmc-omap.h>
>   #include <linux/platform_data/spi-omap2-mcspi.h>
>   #include <linux/omap-dma.h>
> -#include <plat/dmtimer.h>
> +#include <clocksource/dmtimer.h>

These headers are actually not needed in the first-place since we no
longer create any non-DT timer devices. I have submitted a series to
cleanup the presence of this header file, as part of a larger hwmod data
cleanup series.

> 
>   #include "omap_hwmod.h"
>   #include "l3_2xxx.h"
> diff --git a/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c 
> b/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c
> index 4b094cb..8a65f70 100644
> --- a/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c
> +++ b/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c
> @@ -11,7 +11,7 @@
> 
>   #include <linux/platform_data/gpio-omap.h>
>   #include <linux/omap-dma.h>
> -#include <plat/dmtimer.h>
> +#include <clocksource/dmtimer.h>
>   #include <linux/platform_data/spi-omap2-mcspi.h>
> 
>   #include "omap_hwmod.h"
> diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c 
> b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
> index 1a2f224..b030137 100644
> --- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
> +++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
> @@ -25,7 +25,7 @@
>   #include "l4_3xxx.h"
>   #include <linux/platform_data/asoc-ti-mcbsp.h>
>   #include <linux/platform_data/spi-omap2-mcspi.h>
> -#include <plat/dmtimer.h>
> +#include <clocksource/dmtimer.h>
> 
>   #include "soc.h"
>   #include "omap_hwmod.h"
> diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c 
> b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
> index a1901c2..51c7d62 100644
> --- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
> +++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
> @@ -30,7 +30,7 @@
> 
>   #include <linux/platform_data/spi-omap2-mcspi.h>
>   #include <linux/platform_data/asoc-ti-mcbsp.h>
> -#include <plat/dmtimer.h>
> +#include <clocksource/dmtimer.h>
> 
>   #include "omap_hwmod.h"
>   #include "omap_hwmod_common_data.h"
> diff --git a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c 
> b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c
> index 988e7ea..530334e 100644
> --- a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c
> +++ b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c
> @@ -26,7 +26,7 @@
>   #include <linux/omap-dma.h>
>   #include <linux/platform_data/spi-omap2-mcspi.h>
>   #include <linux/platform_data/asoc-ti-mcbsp.h>
> -#include <plat/dmtimer.h>
> +#include <clocksource/dmtimer.h>
> 
>   #include "omap_hwmod.h"
>   #include "omap_hwmod_common_data.h"
> diff --git a/arch/arm/mach-omap2/omap_hwmod_7xx_data.c 
> b/arch/arm/mach-omap2/omap_hwmod_7xx_data.c
> index 4c2a05b..2452649 100644
> --- a/arch/arm/mach-omap2/omap_hwmod_7xx_data.c
> +++ b/arch/arm/mach-omap2/omap_hwmod_7xx_data.c
> @@ -26,7 +26,7 @@
>   #include <linux/omap-dma.h>
>   #include <linux/platform_data/spi-omap2-mcspi.h>
>   #include <linux/platform_data/asoc-ti-mcbsp.h>
> -#include <plat/dmtimer.h>
> +#include <clocksource/dmtimer.h>
> 
>   #include "omap_hwmod.h"
>   #include "omap_hwmod_common_data.h"
> diff --git a/arch/arm/mach-omap2/omap_hwmod_81xx_data.c 
> b/arch/arm/mach-omap2/omap_hwmod_81xx_data.c
> index 84f1182..94f3bb1 100644
> --- a/arch/arm/mach-omap2/omap_hwmod_81xx_data.c
> +++ b/arch/arm/mach-omap2/omap_hwmod_81xx_data.c
> @@ -18,7 +18,7 @@
>   #include <linux/platform_data/gpio-omap.h>
>   #include <linux/platform_data/hsmmc-omap.h>
>   #include <linux/platform_data/spi-omap2-mcspi.h>
> -#include <plat/dmtimer.h>
> +#include <clocksource/dmtimer.h>
> 
>   #include "omap_hwmod_common_data.h"
>   #include "cm81xx.h"
> diff --git a/arch/arm/mach-omap2/pdata-quirks.c b/arch/arm/mach-omap2/pdata-quirks.c
> index 6b433fc..ad9df86 100644
> --- a/arch/arm/mach-omap2/pdata-quirks.c
> +++ b/arch/arm/mach-omap2/pdata-quirks.c
> @@ -27,7 +27,7 @@
>   #include <linux/platform_data/pwm_omap_dmtimer.h>
>   #include <linux/platform_data/media/ir-rx51.h>
>   #include <linux/platform_data/asoc-ti-mcbsp.h>
> -#include <plat/dmtimer.h>
> +#include <clocksource/dmtimer.h>
> 
>   #include "common.h"
>   #include "common-board-devices.h"
> diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
> index ece09c9..31c1b01 100644
> --- a/arch/arm/mach-omap2/timer.c
> +++ b/arch/arm/mach-omap2/timer.c
> @@ -26,6 +26,7 @@
>    * License. See the file "COPYING" in the main directory of this archive
>    * for more details.
>    */
> +#include <clocksource/dmtimer.h>
>   #include <linux/init.h>
>   #include <linux/time.h>
>   #include <linux/interrupt.h>
> @@ -49,7 +50,6 @@
>   #include "omap_hwmod.h"
>   #include "omap_device.h"
>   #include <plat/counter-32k.h>
> -#include <plat/dmtimer.h>
>   #include "omap-pm.h"
> 
>   #include "soc.h"
> diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
> index 72565fc..afe1dc9 100644
> --- a/arch/arm/plat-omap/dmtimer.c
> +++ b/arch/arm/plat-omap/dmtimer.c
> @@ -47,7 +47,7 @@
>   #include <linux/platform_device.h>
>   #include <linux/platform_data/dmtimer-omap.h>
> 
> -#include <plat/dmtimer.h>
> +#include <clocksource/dmtimer.h>
> 
>   static u32 omap_reserved_systimers;
>   static LIST_HEAD(omap_timer_list);
> diff --git a/arch/arm/plat-omap/include/plat/dmtimer.h 
> b/include/clocksource/dmtimer.h
> similarity index 100%
> rename from arch/arm/plat-omap/include/plat/dmtimer.h
> rename to include/clocksource/dmtimer.h

Can you fix up the file name and the header guard to appropriate names
as per the include/clocksource folder convention.

arch/arm/plat-omap/include/plat/dmtimer.h => include/clocksource/dmtimer.h
and
__ASM_ARCH_DMTIMER_H => __CLOCKSOURCE_DMTIMER_H

I still see this file as OMAP-specific, so should this be renamed to
dmtimer-omap.h instead of a generic dmtimer.h name?

regards
Suman

> -- 
> 1.9.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> 

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

* Re: [PATCH v7 4/9] arm: OMAP: Move dmtimer driver out of plat-omap to drivers under clocksource
  2018-01-09  6:23 ` [PATCH v7 4/9] arm: OMAP: Move dmtimer driver out of plat-omap to drivers under clocksource Keerthy
@ 2018-02-13  2:24   ` Suman Anna
  2018-02-14  5:09     ` Keerthy
  0 siblings, 1 reply; 21+ messages in thread
From: Suman Anna @ 2018-02-13  2:24 UTC (permalink / raw)
  To: J, KEERTHY, daniel.lezcano, thierry.reding, tony, aaro.koskinen
  Cc: Claudiu.Beznea, narmstrong, linux-pwm, ladis, linux-kernel,
	linux-arm-kernel, sebastian.reichel, linux-omap, robh+dt, Kristo,
	Tero, Strashko, Grygorii

Hi Keerthy,

On 01/09/2018 12:23 AM, J, KEERTHY wrote:
> Move the dmtimer driver out of plat-omap to clocksource.
> So that non-omap devices also could use this.

What non-omap devices do you have in mind? I don't think this driver is
ready for that yet. It still has a lot of OMAP dependencies. So you
should defer this for later along with the rest of the cleanup and when
the driver is ready for that.

> 
> No Code changes done to the driver file only renamed to timer-dm.c.
> Also removed the config dependencies for OMAP_DM_TIMER.
> 
> Signed-off-by: Keerthy <j-keerthy@ti.com>
> Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
> Tested-by: Ladislav Michl <ladis@linux-mips.org>
> ---
>   arch/arm/plat-omap/Kconfig                                     | 6 ------
>   arch/arm/plat-omap/Makefile                                    | 1 -
>   drivers/clocksource/Kconfig                                    | 3 +++
>   drivers/clocksource/Makefile                                   | 1 +
>   arch/arm/plat-omap/dmtimer.c => drivers/clocksource/timer-dm.c | 0
>   5 files changed, 4 insertions(+), 7 deletions(-)
>   rename arch/arm/plat-omap/dmtimer.c => drivers/clocksource/timer-dm.c (100%)
> 
> diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig
> index 7276afe..afc1a1d 100644
> --- a/arch/arm/plat-omap/Kconfig
> +++ b/arch/arm/plat-omap/Kconfig
> @@ -106,12 +106,6 @@ config OMAP3_L2_AUX_SECURE_SERVICE_SET_ID
>           help
>             PPA routine service ID for setting L2 auxiliary control register.
> 
> -config OMAP_DM_TIMER
> -       bool "Use dual-mode timer"
> -       depends on ARCH_OMAP16XX || ARCH_OMAP2PLUS
> -       help
> -        Select this option if you want to use OMAP Dual-Mode timers.
> -
>   config OMAP_SERIAL_WAKE
>           bool "Enable wake-up events for serial ports"
>           depends on ARCH_OMAP1 && OMAP_MUX
> diff --git a/arch/arm/plat-omap/Makefile b/arch/arm/plat-omap/Makefile
> index 47e1867..7215ada 100644
> --- a/arch/arm/plat-omap/Makefile
> +++ b/arch/arm/plat-omap/Makefile
> @@ -9,5 +9,4 @@ obj-y := sram.o dma.o counter_32k.o
> 
>   # omap_device support (OMAP2+ only at the moment)
> 
> -obj-$(CONFIG_OMAP_DM_TIMER) += dmtimer.o
>   obj-$(CONFIG_OMAP_DEBUG_LEDS) += debug-leds.o
> diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
> index c729a88..3f799b2 100644
> --- a/drivers/clocksource/Kconfig
> +++ b/drivers/clocksource/Kconfig
> @@ -21,6 +21,9 @@ config CLKEVT_I8253
>   config I8253_LOCK
>           bool
> 
> +config OMAP_DM_TIMER
> +       bool
> +
>   config CLKBLD_I8253
>           def_bool y if CLKSRC_I8253 || CLKEVT_I8253 || I8253_LOCK
> 
> diff --git a/drivers/clocksource/Makefile b/drivers/clocksource/Makefile
> index 72711f1..27b5497 100644
> --- a/drivers/clocksource/Makefile
> +++ b/drivers/clocksource/Makefile
> @@ -16,6 +16,7 @@ obj-$(CONFIG_EM_TIMER_STI)    += em_sti.o
>   obj-$(CONFIG_CLKBLD_I8253)      += i8253.o
>   obj-$(CONFIG_CLKSRC_MMIO)       += mmio.o
>   obj-$(CONFIG_DIGICOLOR_TIMER)   += timer-digicolor.o
> +obj-$(CONFIG_OMAP_DM_TIMER)    += timer-dm.o
>   obj-$(CONFIG_DW_APB_TIMER)      += dw_apb_timer.o
>   obj-$(CONFIG_DW_APB_TIMER_OF)   += dw_apb_timer_of.o
>   obj-$(CONFIG_FTTMR010_TIMER)    += timer-fttmr010.o
> diff --git a/arch/arm/plat-omap/dmtimer.c b/drivers/clocksource/timer-dm.c
> similarity index 100%
> rename from arch/arm/plat-omap/dmtimer.c
> rename to drivers/clocksource/timer-dm.c

Similar comments as in patch 3 about the file name at the top, and the
question about adding omap to the file name.

Also, I see that omap_dm_timer_get_fclk() is only defined for
!CONFIG_ARCH_OMAP1, but currently the function is declared in the header
file for both OMAP1 and OMAP2. You would want to inline that for OMAP1
in the header file (we currently get away with it because no one uses it).

regards
Suman

> -- 
> 1.9.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> 

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

* Re: [PATCH v7 5/9] dmtimer: Add timer ops to the platform data structure
  2018-01-09  6:23 ` [PATCH v7 5/9] dmtimer: Add timer ops to the platform data structure Keerthy
@ 2018-02-13  2:46   ` Suman Anna
  2018-02-14  5:21     ` Keerthy
  0 siblings, 1 reply; 21+ messages in thread
From: Suman Anna @ 2018-02-13  2:46 UTC (permalink / raw)
  To: J, KEERTHY, daniel.lezcano, thierry.reding, tony, aaro.koskinen
  Cc: linux-pwm, ladis, narmstrong, linux-kernel, Kristo, Tero,
	robh+dt, sebastian.reichel, Strashko, Grygorii, linux-omap,
	Claudiu.Beznea, linux-arm-kernel

On 01/09/2018 12:23 AM, J, KEERTHY wrote:
> Add timer ops to the platform data structure
> 
> Signed-off-by: Keerthy <j-keerthy@ti.com>
> Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
> Tested-by: Ladislav Michl <ladis@linux-mips.org>
> ---
>   include/linux/platform_data/dmtimer-omap.h | 38 ++++++++++++++++++++++++++++++
>   1 file changed, 38 insertions(+)
> 
> diff --git a/include/linux/platform_data/dmtimer-omap.h 
> b/include/linux/platform_data/dmtimer-omap.h
> index a19b78d..a3e1794 100644
> --- a/include/linux/platform_data/dmtimer-omap.h
> +++ b/include/linux/platform_data/dmtimer-omap.h
> @@ -20,12 +20,50 @@
>   #ifndef __PLATFORM_DATA_DMTIMER_OMAP_H__
>   #define __PLATFORM_DATA_DMTIMER_OMAP_H__
> 
> +struct omap_dm_timer_ops {
> +       struct omap_dm_timer *(*request_by_node)(struct device_node *np);
> +       struct omap_dm_timer *(*request_specific)(int timer_id);
> +       struct omap_dm_timer *(*request)(void);
> +
> +       int     (*free)(struct omap_dm_timer *timer);
> +
> +       void    (*enable)(struct omap_dm_timer *timer);
> +       void    (*disable)(struct omap_dm_timer *timer);
> +
> +       int     (*get_irq)(struct omap_dm_timer *timer);
> +       int     (*set_int_enable)(struct omap_dm_timer *timer,
> +                                 unsigned int value);
> +       int     (*set_int_disable)(struct omap_dm_timer *timer, u32 mask);
> +
> +       struct clk *(*get_fclk)(struct omap_dm_timer *timer);
> +
> +       int     (*start)(struct omap_dm_timer *timer);
> +       int     (*stop)(struct omap_dm_timer *timer);
> +       int     (*set_source)(struct omap_dm_timer *timer, int source);
> +
> +       int     (*set_load)(struct omap_dm_timer *timer, int autoreload,
> +                           unsigned int value);
> +       int     (*set_match)(struct omap_dm_timer *timer, int enable,
> +                            unsigned int match);
> +       int     (*set_pwm)(struct omap_dm_timer *timer, int def_on,
> +                          int toggle, int trigger);
> +       int     (*set_prescaler)(struct omap_dm_timer *timer, int prescaler);
> +
> +       unsigned int (*read_counter)(struct omap_dm_timer *timer);
> +       int     (*write_counter)(struct omap_dm_timer *timer,
> +                                unsigned int value);
> +       unsigned int (*read_status)(struct omap_dm_timer *timer);
> +       int     (*write_status)(struct omap_dm_timer *timer,
> +                               unsigned int value);
> +};
> +
>   struct dmtimer_platform_data {
>           /* set_timer_src - Only used for OMAP1 devices */
>           int (*set_timer_src)(struct platform_device *pdev, int source);
Have you looked into collapsing this into the set_source() option above
for OMAP1? Looks like the only reason the pdev is needed is for
retrieving the pdev id, which is also stored in the omap_dm_timer structure?

>           u32 timer_capability;
>           u32 timer_errata;
>           int (*get_context_loss_count)(struct device *);
> +       struct omap_dm_timer_ops *timer_ops;

Any reason why this is not a const? We don't expect this to change right.

regards
Suman

>   };
> 
>   #endif /* __PLATFORM_DATA_DMTIMER_OMAP_H__ */
> -- 
> 1.9.1
> 
> 
> _______________________________________________
> 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] 21+ messages in thread

* Re: [PATCH v7 3/9] arm: omap: Move dmtimer.h out of plat-omap
  2018-02-13  2:06   ` Suman Anna
@ 2018-02-13 15:09     ` Tony Lindgren
  2018-02-14  4:11       ` Keerthy
  2018-02-14  4:50     ` Keerthy
  1 sibling, 1 reply; 21+ messages in thread
From: Tony Lindgren @ 2018-02-13 15:09 UTC (permalink / raw)
  To: Suman Anna
  Cc: J, KEERTHY, daniel.lezcano, thierry.reding, aaro.koskinen,
	Claudiu.Beznea, narmstrong, linux-pwm, ladis, linux-kernel,
	linux-arm-kernel, sebastian.reichel, linux-omap, robh+dt, Kristo,
	Tero, Strashko, Grygorii

* Suman Anna <s-anna@ti.com> [180213 02:07]:
> On 01/09/2018 12:23 AM, J, KEERTHY wrote:
> > The header file is currently under plat-omap directory
> > under arch/omap. Move this out to an accessible place.
> > @@ -18,7 +18,7 @@
> >   #include <linux/platform_data/hsmmc-omap.h>
> >   #include <linux/platform_data/spi-omap2-mcspi.h>
> >   #include <linux/omap-dma.h>
> > -#include <plat/dmtimer.h>
> > +#include <clocksource/dmtimer.h>
> 
> These headers are actually not needed in the first-place since we no
> longer create any non-DT timer devices. I have submitted a series to
> cleanup the presence of this header file, as part of a larger hwmod data
> cleanup series.

OK great. Keerthy, care to take a look? Seems like it
simplifies things a bit.

Regards,

Tony

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

* Re: [PATCH v7 3/9] arm: omap: Move dmtimer.h out of plat-omap
  2018-02-13 15:09     ` Tony Lindgren
@ 2018-02-14  4:11       ` Keerthy
  0 siblings, 0 replies; 21+ messages in thread
From: Keerthy @ 2018-02-14  4:11 UTC (permalink / raw)
  To: Tony Lindgren, Suman Anna
  Cc: daniel.lezcano, thierry.reding, aaro.koskinen, Claudiu.Beznea,
	narmstrong, linux-pwm, ladis, linux-kernel, linux-arm-kernel,
	sebastian.reichel, linux-omap, robh+dt, Kristo, Tero, Strashko,
	Grygorii



On Tuesday 13 February 2018 08:39 PM, Tony Lindgren wrote:
> * Suman Anna <s-anna@ti.com> [180213 02:07]:
>> On 01/09/2018 12:23 AM, J, KEERTHY wrote:
>>> The header file is currently under plat-omap directory
>>> under arch/omap. Move this out to an accessible place.
>>> @@ -18,7 +18,7 @@
>>>   #include <linux/platform_data/hsmmc-omap.h>
>>>   #include <linux/platform_data/spi-omap2-mcspi.h>
>>>   #include <linux/omap-dma.h>
>>> -#include <plat/dmtimer.h>
>>> +#include <clocksource/dmtimer.h>
>>
>> These headers are actually not needed in the first-place since we no
>> longer create any non-DT timer devices. I have submitted a series to
>> cleanup the presence of this header file, as part of a larger hwmod data
>> cleanup series.
> 
> OK great. Keerthy, care to take a look? Seems like it
> simplifies things a bit.

Sure Tony. I will look into this.

> 
> Regards,
> 
> Tony
> 

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

* Re: [PATCH v7 3/9] arm: omap: Move dmtimer.h out of plat-omap
  2018-02-13  2:06   ` Suman Anna
  2018-02-13 15:09     ` Tony Lindgren
@ 2018-02-14  4:50     ` Keerthy
  2018-02-14 18:59       ` Tony Lindgren
  1 sibling, 1 reply; 21+ messages in thread
From: Keerthy @ 2018-02-14  4:50 UTC (permalink / raw)
  To: Suman Anna, daniel.lezcano, thierry.reding, tony, aaro.koskinen
  Cc: Claudiu.Beznea, narmstrong, linux-pwm, ladis, linux-kernel,
	linux-arm-kernel, sebastian.reichel, linux-omap, robh+dt, Kristo,
	Tero, Strashko, Grygorii



On Tuesday 13 February 2018 07:36 AM, Suman Anna wrote:
> Hi Keerthy,
> 
> On 01/09/2018 12:23 AM, J, KEERTHY wrote:
>> The header file is currently under plat-omap directory
>> under arch/omap. Move this out to an accessible place.
>>
>> No Code changes done to the header file.
>>
>> Signed-off-by: Keerthy <j-keerthy@ti.com>
>> Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
>> Tested-by: Ladislav Michl <ladis@linux-mips.org>
>> ---
>>   arch/arm/mach-omap1/pm.c                                           | 2 +-
>>   arch/arm/mach-omap1/timer.c                                        | 2 +-
>>   arch/arm/mach-omap2/omap_hwmod_2420_data.c                         | 2 +-
>>   arch/arm/mach-omap2/omap_hwmod_2430_data.c                         | 2 +-
>>   arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c                 | 2 +-
>>   arch/arm/mach-omap2/omap_hwmod_3xxx_data.c                         | 2 +-
>>   arch/arm/mach-omap2/omap_hwmod_44xx_data.c                         | 2 +-
>>   arch/arm/mach-omap2/omap_hwmod_54xx_data.c                         | 2 +-
>>   arch/arm/mach-omap2/omap_hwmod_7xx_data.c                          | 2 +-
>>   arch/arm/mach-omap2/omap_hwmod_81xx_data.c                         | 2 +-
>>   arch/arm/mach-omap2/pdata-quirks.c                                 | 2 +-
>>   arch/arm/mach-omap2/timer.c                                        | 2 +-
>>   arch/arm/plat-omap/dmtimer.c                                       | 2 +-
>>   {arch/arm/plat-omap/include/plat => include/clocksource}/dmtimer.h | 0
>>   14 files changed, 13 insertions(+), 13 deletions(-)
>>   rename {arch/arm/plat-omap/include/plat => include/clocksource}/dmtimer.h (100%)
>>
>> diff --git a/arch/arm/mach-omap1/pm.c b/arch/arm/mach-omap1/pm.c
>> index f1135bf..a07d47cf 100644
>> --- a/arch/arm/mach-omap1/pm.c
>> +++ b/arch/arm/mach-omap1/pm.c
>> @@ -55,7 +55,7 @@
>>   #include <mach/tc.h>
>>   #include <mach/mux.h>
>>   #include <linux/omap-dma.h>
>> -#include <plat/dmtimer.h>
>> +#include <clocksource/dmtimer.h>
>>
>>   #include <mach/irqs.h>
>>
>> diff --git a/arch/arm/mach-omap1/timer.c b/arch/arm/mach-omap1/timer.c
>> index 8fb1ec6..7c057ab 100644
>> --- a/arch/arm/mach-omap1/timer.c
>> +++ b/arch/arm/mach-omap1/timer.c
>> @@ -27,7 +27,7 @@
>>   #include <linux/platform_device.h>
>>   #include <linux/platform_data/dmtimer-omap.h>
>>
>> -#include <plat/dmtimer.h>
>> +#include <clocksource/dmtimer.h>
>>
>>   #include "soc.h"
>>
>> diff --git a/arch/arm/mach-omap2/omap_hwmod_2420_data.c 
>> b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
>> index 0afb014..0a8b95f 100644
>> --- a/arch/arm/mach-omap2/omap_hwmod_2420_data.c
>> +++ b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
>> @@ -16,7 +16,7 @@
>>   #include <linux/i2c-omap.h>
>>   #include <linux/platform_data/spi-omap2-mcspi.h>
>>   #include <linux/omap-dma.h>
>> -#include <plat/dmtimer.h>
>> +#include <clocksource/dmtimer.h>
>>
>>   #include "omap_hwmod.h"
>>   #include "l3_2xxx.h"
>> diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c 
>> b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
>> index 013b26b..16e3d8c 100644
>> --- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c
>> +++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
>> @@ -18,7 +18,7 @@
>>   #include <linux/platform_data/hsmmc-omap.h>
>>   #include <linux/platform_data/spi-omap2-mcspi.h>
>>   #include <linux/omap-dma.h>
>> -#include <plat/dmtimer.h>
>> +#include <clocksource/dmtimer.h>
> 
> These headers are actually not needed in the first-place since we no
> longer create any non-DT timer devices. I have submitted a series to
> cleanup the presence of this header file, as part of a larger hwmod data
> cleanup series.

I will rebase my series on top of your clean up series. Thanks for clean
ups.

> 
>>
>>   #include "omap_hwmod.h"
>>   #include "l3_2xxx.h"
>> diff --git a/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c 
>> b/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c
>> index 4b094cb..8a65f70 100644
>> --- a/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c
>> +++ b/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c
>> @@ -11,7 +11,7 @@
>>
>>   #include <linux/platform_data/gpio-omap.h>
>>   #include <linux/omap-dma.h>
>> -#include <plat/dmtimer.h>
>> +#include <clocksource/dmtimer.h>
>>   #include <linux/platform_data/spi-omap2-mcspi.h>
>>
>>   #include "omap_hwmod.h"
>> diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c 
>> b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
>> index 1a2f224..b030137 100644
>> --- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
>> +++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
>> @@ -25,7 +25,7 @@
>>   #include "l4_3xxx.h"
>>   #include <linux/platform_data/asoc-ti-mcbsp.h>
>>   #include <linux/platform_data/spi-omap2-mcspi.h>
>> -#include <plat/dmtimer.h>
>> +#include <clocksource/dmtimer.h>
>>
>>   #include "soc.h"
>>   #include "omap_hwmod.h"
>> diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c 
>> b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
>> index a1901c2..51c7d62 100644
>> --- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
>> +++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
>> @@ -30,7 +30,7 @@
>>
>>   #include <linux/platform_data/spi-omap2-mcspi.h>
>>   #include <linux/platform_data/asoc-ti-mcbsp.h>
>> -#include <plat/dmtimer.h>
>> +#include <clocksource/dmtimer.h>
>>
>>   #include "omap_hwmod.h"
>>   #include "omap_hwmod_common_data.h"
>> diff --git a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c 
>> b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c
>> index 988e7ea..530334e 100644
>> --- a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c
>> +++ b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c
>> @@ -26,7 +26,7 @@
>>   #include <linux/omap-dma.h>
>>   #include <linux/platform_data/spi-omap2-mcspi.h>
>>   #include <linux/platform_data/asoc-ti-mcbsp.h>
>> -#include <plat/dmtimer.h>
>> +#include <clocksource/dmtimer.h>
>>
>>   #include "omap_hwmod.h"
>>   #include "omap_hwmod_common_data.h"
>> diff --git a/arch/arm/mach-omap2/omap_hwmod_7xx_data.c 
>> b/arch/arm/mach-omap2/omap_hwmod_7xx_data.c
>> index 4c2a05b..2452649 100644
>> --- a/arch/arm/mach-omap2/omap_hwmod_7xx_data.c
>> +++ b/arch/arm/mach-omap2/omap_hwmod_7xx_data.c
>> @@ -26,7 +26,7 @@
>>   #include <linux/omap-dma.h>
>>   #include <linux/platform_data/spi-omap2-mcspi.h>
>>   #include <linux/platform_data/asoc-ti-mcbsp.h>
>> -#include <plat/dmtimer.h>
>> +#include <clocksource/dmtimer.h>
>>
>>   #include "omap_hwmod.h"
>>   #include "omap_hwmod_common_data.h"
>> diff --git a/arch/arm/mach-omap2/omap_hwmod_81xx_data.c 
>> b/arch/arm/mach-omap2/omap_hwmod_81xx_data.c
>> index 84f1182..94f3bb1 100644
>> --- a/arch/arm/mach-omap2/omap_hwmod_81xx_data.c
>> +++ b/arch/arm/mach-omap2/omap_hwmod_81xx_data.c
>> @@ -18,7 +18,7 @@
>>   #include <linux/platform_data/gpio-omap.h>
>>   #include <linux/platform_data/hsmmc-omap.h>
>>   #include <linux/platform_data/spi-omap2-mcspi.h>
>> -#include <plat/dmtimer.h>
>> +#include <clocksource/dmtimer.h>
>>
>>   #include "omap_hwmod_common_data.h"
>>   #include "cm81xx.h"
>> diff --git a/arch/arm/mach-omap2/pdata-quirks.c b/arch/arm/mach-omap2/pdata-quirks.c
>> index 6b433fc..ad9df86 100644
>> --- a/arch/arm/mach-omap2/pdata-quirks.c
>> +++ b/arch/arm/mach-omap2/pdata-quirks.c
>> @@ -27,7 +27,7 @@
>>   #include <linux/platform_data/pwm_omap_dmtimer.h>
>>   #include <linux/platform_data/media/ir-rx51.h>
>>   #include <linux/platform_data/asoc-ti-mcbsp.h>
>> -#include <plat/dmtimer.h>
>> +#include <clocksource/dmtimer.h>
>>
>>   #include "common.h"
>>   #include "common-board-devices.h"
>> diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
>> index ece09c9..31c1b01 100644
>> --- a/arch/arm/mach-omap2/timer.c
>> +++ b/arch/arm/mach-omap2/timer.c
>> @@ -26,6 +26,7 @@
>>    * License. See the file "COPYING" in the main directory of this archive
>>    * for more details.
>>    */
>> +#include <clocksource/dmtimer.h>
>>   #include <linux/init.h>
>>   #include <linux/time.h>
>>   #include <linux/interrupt.h>
>> @@ -49,7 +50,6 @@
>>   #include "omap_hwmod.h"
>>   #include "omap_device.h"
>>   #include <plat/counter-32k.h>
>> -#include <plat/dmtimer.h>
>>   #include "omap-pm.h"
>>
>>   #include "soc.h"
>> diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
>> index 72565fc..afe1dc9 100644
>> --- a/arch/arm/plat-omap/dmtimer.c
>> +++ b/arch/arm/plat-omap/dmtimer.c
>> @@ -47,7 +47,7 @@
>>   #include <linux/platform_device.h>
>>   #include <linux/platform_data/dmtimer-omap.h>
>>
>> -#include <plat/dmtimer.h>
>> +#include <clocksource/dmtimer.h>
>>
>>   static u32 omap_reserved_systimers;
>>   static LIST_HEAD(omap_timer_list);
>> diff --git a/arch/arm/plat-omap/include/plat/dmtimer.h 
>> b/include/clocksource/dmtimer.h
>> similarity index 100%
>> rename from arch/arm/plat-omap/include/plat/dmtimer.h
>> rename to include/clocksource/dmtimer.h
> 
> Can you fix up the file name and the header guard to appropriate names
> as per the include/clocksource folder convention.
> 
> arch/arm/plat-omap/include/plat/dmtimer.h => include/clocksource/dmtimer.h
> and
> __ASM_ARCH_DMTIMER_H => __CLOCKSOURCE_DMTIMER_H

Sure.

> 
> I still see this file as OMAP-specific, so should this be renamed to
> dmtimer-omap.h instead of a generic dmtimer.h name?

I will go with ti-dmtimer.c.

> 
> regards
> Suman
> 
>> -- 
>> 1.9.1
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>
> 

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

* Re: [PATCH v7 4/9] arm: OMAP: Move dmtimer driver out of plat-omap to drivers under clocksource
  2018-02-13  2:24   ` Suman Anna
@ 2018-02-14  5:09     ` Keerthy
  0 siblings, 0 replies; 21+ messages in thread
From: Keerthy @ 2018-02-14  5:09 UTC (permalink / raw)
  To: Suman Anna, daniel.lezcano, thierry.reding, tony, aaro.koskinen
  Cc: Claudiu.Beznea, narmstrong, linux-pwm, ladis, linux-kernel,
	linux-arm-kernel, sebastian.reichel, linux-omap, robh+dt, Kristo,
	Tero, Strashko, Grygorii



On Tuesday 13 February 2018 07:54 AM, Suman Anna wrote:
> Hi Keerthy,
> 
> On 01/09/2018 12:23 AM, J, KEERTHY wrote:
>> Move the dmtimer driver out of plat-omap to clocksource.
>> So that non-omap devices also could use this.
> 
> What non-omap devices do you have in mind? I don't think this driver is
> ready for that yet. It still has a lot of OMAP dependencies. So you
> should defer this for later along with the rest of the cleanup and when
> the driver is ready for that.

I mean non-omap TI devices. Not totally generic one.

> 
>>
>> No Code changes done to the driver file only renamed to timer-dm.c.
>> Also removed the config dependencies for OMAP_DM_TIMER.
>>
>> Signed-off-by: Keerthy <j-keerthy@ti.com>
>> Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
>> Tested-by: Ladislav Michl <ladis@linux-mips.org>
>> ---
>>   arch/arm/plat-omap/Kconfig                                     | 6 ------
>>   arch/arm/plat-omap/Makefile                                    | 1 -
>>   drivers/clocksource/Kconfig                                    | 3 +++
>>   drivers/clocksource/Makefile                                   | 1 +
>>   arch/arm/plat-omap/dmtimer.c => drivers/clocksource/timer-dm.c | 0
>>   5 files changed, 4 insertions(+), 7 deletions(-)
>>   rename arch/arm/plat-omap/dmtimer.c => drivers/clocksource/timer-dm.c (100%)
>>
>> diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig
>> index 7276afe..afc1a1d 100644
>> --- a/arch/arm/plat-omap/Kconfig
>> +++ b/arch/arm/plat-omap/Kconfig
>> @@ -106,12 +106,6 @@ config OMAP3_L2_AUX_SECURE_SERVICE_SET_ID
>>           help
>>             PPA routine service ID for setting L2 auxiliary control register.
>>
>> -config OMAP_DM_TIMER
>> -       bool "Use dual-mode timer"
>> -       depends on ARCH_OMAP16XX || ARCH_OMAP2PLUS
>> -       help
>> -        Select this option if you want to use OMAP Dual-Mode timers.
>> -
>>   config OMAP_SERIAL_WAKE
>>           bool "Enable wake-up events for serial ports"
>>           depends on ARCH_OMAP1 && OMAP_MUX
>> diff --git a/arch/arm/plat-omap/Makefile b/arch/arm/plat-omap/Makefile
>> index 47e1867..7215ada 100644
>> --- a/arch/arm/plat-omap/Makefile
>> +++ b/arch/arm/plat-omap/Makefile
>> @@ -9,5 +9,4 @@ obj-y := sram.o dma.o counter_32k.o
>>
>>   # omap_device support (OMAP2+ only at the moment)
>>
>> -obj-$(CONFIG_OMAP_DM_TIMER) += dmtimer.o
>>   obj-$(CONFIG_OMAP_DEBUG_LEDS) += debug-leds.o
>> diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
>> index c729a88..3f799b2 100644
>> --- a/drivers/clocksource/Kconfig
>> +++ b/drivers/clocksource/Kconfig
>> @@ -21,6 +21,9 @@ config CLKEVT_I8253
>>   config I8253_LOCK
>>           bool
>>
>> +config OMAP_DM_TIMER
>> +       bool
>> +
>>   config CLKBLD_I8253
>>           def_bool y if CLKSRC_I8253 || CLKEVT_I8253 || I8253_LOCK
>>
>> diff --git a/drivers/clocksource/Makefile b/drivers/clocksource/Makefile
>> index 72711f1..27b5497 100644
>> --- a/drivers/clocksource/Makefile
>> +++ b/drivers/clocksource/Makefile
>> @@ -16,6 +16,7 @@ obj-$(CONFIG_EM_TIMER_STI)    += em_sti.o
>>   obj-$(CONFIG_CLKBLD_I8253)      += i8253.o
>>   obj-$(CONFIG_CLKSRC_MMIO)       += mmio.o
>>   obj-$(CONFIG_DIGICOLOR_TIMER)   += timer-digicolor.o
>> +obj-$(CONFIG_OMAP_DM_TIMER)    += timer-dm.o
>>   obj-$(CONFIG_DW_APB_TIMER)      += dw_apb_timer.o
>>   obj-$(CONFIG_DW_APB_TIMER_OF)   += dw_apb_timer_of.o
>>   obj-$(CONFIG_FTTMR010_TIMER)    += timer-fttmr010.o
>> diff --git a/arch/arm/plat-omap/dmtimer.c b/drivers/clocksource/timer-dm.c
>> similarity index 100%
>> rename from arch/arm/plat-omap/dmtimer.c
>> rename to drivers/clocksource/timer-dm.c
> 
> Similar comments as in patch 3 about the file name at the top, and the
> question about adding omap to the file name.

I will go with timer-ti-dm.c following timer-ti-32k.c
Hope that is okay.

> 
> Also, I see that omap_dm_timer_get_fclk() is only defined for
> !CONFIG_ARCH_OMAP1, but currently the function is declared in the header
> file for both OMAP1 and OMAP2. You would want to inline that for OMAP1
> in the header file (we currently get away with it because no one uses it).

Sure.

> 
> regards
> Suman
> 
>> -- 
>> 1.9.1
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>
> 

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

* Re: [PATCH v7 5/9] dmtimer: Add timer ops to the platform data structure
  2018-02-13  2:46   ` Suman Anna
@ 2018-02-14  5:21     ` Keerthy
  0 siblings, 0 replies; 21+ messages in thread
From: Keerthy @ 2018-02-14  5:21 UTC (permalink / raw)
  To: Suman Anna, daniel.lezcano, thierry.reding, tony, aaro.koskinen
  Cc: linux-pwm, ladis, narmstrong, linux-kernel, Kristo, Tero,
	robh+dt, sebastian.reichel, Strashko, Grygorii, linux-omap,
	Claudiu.Beznea, linux-arm-kernel



On Tuesday 13 February 2018 08:16 AM, Suman Anna wrote:
> On 01/09/2018 12:23 AM, J, KEERTHY wrote:
>> Add timer ops to the platform data structure
>>
>> Signed-off-by: Keerthy <j-keerthy@ti.com>
>> Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
>> Tested-by: Ladislav Michl <ladis@linux-mips.org>
>> ---
>>   include/linux/platform_data/dmtimer-omap.h | 38 ++++++++++++++++++++++++++++++
>>   1 file changed, 38 insertions(+)
>>
>> diff --git a/include/linux/platform_data/dmtimer-omap.h 
>> b/include/linux/platform_data/dmtimer-omap.h
>> index a19b78d..a3e1794 100644
>> --- a/include/linux/platform_data/dmtimer-omap.h
>> +++ b/include/linux/platform_data/dmtimer-omap.h
>> @@ -20,12 +20,50 @@
>>   #ifndef __PLATFORM_DATA_DMTIMER_OMAP_H__
>>   #define __PLATFORM_DATA_DMTIMER_OMAP_H__
>>
>> +struct omap_dm_timer_ops {
>> +       struct omap_dm_timer *(*request_by_node)(struct device_node *np);
>> +       struct omap_dm_timer *(*request_specific)(int timer_id);
>> +       struct omap_dm_timer *(*request)(void);
>> +
>> +       int     (*free)(struct omap_dm_timer *timer);
>> +
>> +       void    (*enable)(struct omap_dm_timer *timer);
>> +       void    (*disable)(struct omap_dm_timer *timer);
>> +
>> +       int     (*get_irq)(struct omap_dm_timer *timer);
>> +       int     (*set_int_enable)(struct omap_dm_timer *timer,
>> +                                 unsigned int value);
>> +       int     (*set_int_disable)(struct omap_dm_timer *timer, u32 mask);
>> +
>> +       struct clk *(*get_fclk)(struct omap_dm_timer *timer);
>> +
>> +       int     (*start)(struct omap_dm_timer *timer);
>> +       int     (*stop)(struct omap_dm_timer *timer);
>> +       int     (*set_source)(struct omap_dm_timer *timer, int source);
>> +
>> +       int     (*set_load)(struct omap_dm_timer *timer, int autoreload,
>> +                           unsigned int value);
>> +       int     (*set_match)(struct omap_dm_timer *timer, int enable,
>> +                            unsigned int match);
>> +       int     (*set_pwm)(struct omap_dm_timer *timer, int def_on,
>> +                          int toggle, int trigger);
>> +       int     (*set_prescaler)(struct omap_dm_timer *timer, int prescaler);
>> +
>> +       unsigned int (*read_counter)(struct omap_dm_timer *timer);
>> +       int     (*write_counter)(struct omap_dm_timer *timer,
>> +                                unsigned int value);
>> +       unsigned int (*read_status)(struct omap_dm_timer *timer);
>> +       int     (*write_status)(struct omap_dm_timer *timer,
>> +                               unsigned int value);
>> +};
>> +
>>   struct dmtimer_platform_data {
>>           /* set_timer_src - Only used for OMAP1 devices */
>>           int (*set_timer_src)(struct platform_device *pdev, int source);
> Have you looked into collapsing this into the set_source() option above
> for OMAP1? Looks like the only reason the pdev is needed is for
> retrieving the pdev id, which is also stored in the omap_dm_timer structure?

I would prefer not to touch the mach-omap1 part as part of this
migration series. I will revisit this once the migration is done.

> 
>>           u32 timer_capability;
>>           u32 timer_errata;
>>           int (*get_context_loss_count)(struct device *);
>> +       struct omap_dm_timer_ops *timer_ops;
> 
> Any reason why this is not a const? We don't expect this to change right.

Yes this can be.

> 
> regards
> Suman
> 
>>   };
>>
>>   #endif /* __PLATFORM_DATA_DMTIMER_OMAP_H__ */
>> -- 
>> 1.9.1
>>
>>
>> _______________________________________________
>> 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] 21+ messages in thread

* Re: [PATCH v7 3/9] arm: omap: Move dmtimer.h out of plat-omap
  2018-02-14  4:50     ` Keerthy
@ 2018-02-14 18:59       ` Tony Lindgren
  0 siblings, 0 replies; 21+ messages in thread
From: Tony Lindgren @ 2018-02-14 18:59 UTC (permalink / raw)
  To: Keerthy
  Cc: Suman Anna, daniel.lezcano, thierry.reding, aaro.koskinen,
	Claudiu.Beznea, narmstrong, linux-pwm, ladis, linux-kernel,
	linux-arm-kernel, sebastian.reichel, linux-omap, robh+dt, Kristo,
	Tero, Strashko, Grygorii

* Keerthy <j-keerthy@ti.com> [180214 04:51]:
> On Tuesday 13 February 2018 07:36 AM, Suman Anna wrote:
> > These headers are actually not needed in the first-place since we no
> > longer create any non-DT timer devices. I have submitted a series to
> > cleanup the presence of this header file, as part of a larger hwmod data
> > cleanup series.
> 
> I will rebase my series on top of your clean up series. Thanks for clean
> ups.

I've now pushed Suman's series into omap-for-v4.17/soc and
merged it into my for-next. So please rebase your updated
patches against omap-for-v4.17/soc.

Thanks,

Tony

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

end of thread, other threads:[~2018-02-14 18:59 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-09  6:22 [PATCH v7 0/9] omap: dmtimer: Move driver out of plat-omap Keerthy
2018-01-09  6:22 ` [PATCH v7 1/9] clocksource: dmtimer: Remove all the exports Keerthy
2018-01-09  6:23 ` [PATCH v7 2/9] arm: omap: timer: Wrap the inline functions under OMAP2PLUS define Keerthy
2018-01-09  9:19   ` Sebastian Reichel
2018-01-09  6:23 ` [PATCH v7 3/9] arm: omap: Move dmtimer.h out of plat-omap Keerthy
2018-02-13  2:06   ` Suman Anna
2018-02-13 15:09     ` Tony Lindgren
2018-02-14  4:11       ` Keerthy
2018-02-14  4:50     ` Keerthy
2018-02-14 18:59       ` Tony Lindgren
2018-01-09  6:23 ` [PATCH v7 4/9] arm: OMAP: Move dmtimer driver out of plat-omap to drivers under clocksource Keerthy
2018-02-13  2:24   ` Suman Anna
2018-02-14  5:09     ` Keerthy
2018-01-09  6:23 ` [PATCH v7 5/9] dmtimer: Add timer ops to the platform data structure Keerthy
2018-02-13  2:46   ` Suman Anna
2018-02-14  5:21     ` Keerthy
2018-01-09  6:23 ` [PATCH v7 6/9] clocksource: dmtimer: Populate the timer ops to the pdata Keerthy
2018-01-09  6:23 ` [PATCH v7 7/9] clocksource: timer-dm: Hook device platform data if not already assigned Keerthy
2018-01-09  9:19   ` Sebastian Reichel
2018-01-09  6:23 ` [PATCH v7 8/9] pwm: pwm-omap-dmtimer: Adapt driver to utilize dmtimer pdata ops Keerthy
2018-01-09  6:23 ` [PATCH v7 9/9] arm: omap: pdata-quirks: Remove unused timer pdata Keerthy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).