* [PATCH 1/7] clocksource/drivers/timer-microchip-pit64b: remove mmio selection
2022-02-28 11:19 [PATCH 0/7] clocksource/drivers/timer-microchip-pit64b: fixes and improvements Claudiu Beznea
@ 2022-02-28 11:19 ` Claudiu Beznea
2022-02-28 11:19 ` [PATCH 2/7] clocksource/drivers/timer-microchip-pit64b: remove timer-of dependency Claudiu Beznea
` (5 subsequent siblings)
6 siblings, 0 replies; 11+ messages in thread
From: Claudiu Beznea @ 2022-02-28 11:19 UTC (permalink / raw)
To: daniel.lezcano, tglx; +Cc: linux-arm-kernel, linux-kernel, Claudiu Beznea
PIT64B timer driver doesn't depend on CLKSRC_MMIO since
commit e85c1d21b16b ("clocksource/drivers/timer-microchip-pit64b:
Add clocksource suspend/resume"). Remove the selection.
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
drivers/clocksource/Kconfig | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index cfb8ea0df3b1..1ea556e75494 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -713,7 +713,6 @@ config INGENIC_OST
config MICROCHIP_PIT64B
bool "Microchip PIT64B support"
depends on OF || COMPILE_TEST
- select CLKSRC_MMIO
select TIMER_OF
help
This option enables Microchip PIT64B timer for Atmel
--
2.32.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH 2/7] clocksource/drivers/timer-microchip-pit64b: remove timer-of dependency
2022-02-28 11:19 [PATCH 0/7] clocksource/drivers/timer-microchip-pit64b: fixes and improvements Claudiu Beznea
2022-02-28 11:19 ` [PATCH 1/7] clocksource/drivers/timer-microchip-pit64b: remove mmio selection Claudiu Beznea
@ 2022-02-28 11:19 ` Claudiu Beznea
2022-02-28 11:19 ` [PATCH 3/7] clocksource/drivers/timer-microchip-pit64b: use notrace Claudiu Beznea
` (4 subsequent siblings)
6 siblings, 0 replies; 11+ messages in thread
From: Claudiu Beznea @ 2022-02-28 11:19 UTC (permalink / raw)
To: daniel.lezcano, tglx; +Cc: linux-arm-kernel, linux-kernel, Claudiu Beznea
PIT64B driver doesn't use timer-of APIs. Thus, remove the selection.
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
drivers/clocksource/Kconfig | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index 1ea556e75494..3aee0ffad1fe 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -713,7 +713,6 @@ config INGENIC_OST
config MICROCHIP_PIT64B
bool "Microchip PIT64B support"
depends on OF || COMPILE_TEST
- select TIMER_OF
help
This option enables Microchip PIT64B timer for Atmel
based system. It supports the oneshot, the periodic
--
2.32.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH 3/7] clocksource/drivers/timer-microchip-pit64b: use notrace
2022-02-28 11:19 [PATCH 0/7] clocksource/drivers/timer-microchip-pit64b: fixes and improvements Claudiu Beznea
2022-02-28 11:19 ` [PATCH 1/7] clocksource/drivers/timer-microchip-pit64b: remove mmio selection Claudiu Beznea
2022-02-28 11:19 ` [PATCH 2/7] clocksource/drivers/timer-microchip-pit64b: remove timer-of dependency Claudiu Beznea
@ 2022-02-28 11:19 ` Claudiu Beznea
2022-02-28 11:19 ` [PATCH 4/7] clocksource/drivers/timer-microchip-pit64b: use 5MHz for clockevent Claudiu Beznea
` (3 subsequent siblings)
6 siblings, 0 replies; 11+ messages in thread
From: Claudiu Beznea @ 2022-02-28 11:19 UTC (permalink / raw)
To: daniel.lezcano, tglx; +Cc: linux-arm-kernel, linux-kernel, Claudiu Beznea
Use notrace for mchp_pit64b_sched_read_clk() to avoid recursive call of
prepare_ftrace_return() when issuing:
echo function_graph > /sys/kernel/debug/tracing/current_tracer
Fixes: 625022a5f160 ("clocksource/drivers/timer-microchip-pit64b: Add Microchip PIT64B support")
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
drivers/clocksource/timer-microchip-pit64b.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/clocksource/timer-microchip-pit64b.c b/drivers/clocksource/timer-microchip-pit64b.c
index cfa4ec7ef396..790d2c9b42a7 100644
--- a/drivers/clocksource/timer-microchip-pit64b.c
+++ b/drivers/clocksource/timer-microchip-pit64b.c
@@ -165,7 +165,7 @@ static u64 mchp_pit64b_clksrc_read(struct clocksource *cs)
return mchp_pit64b_cnt_read(mchp_pit64b_cs_base);
}
-static u64 mchp_pit64b_sched_read_clk(void)
+static u64 notrace mchp_pit64b_sched_read_clk(void)
{
return mchp_pit64b_cnt_read(mchp_pit64b_cs_base);
}
--
2.32.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH 4/7] clocksource/drivers/timer-microchip-pit64b: use 5MHz for clockevent
2022-02-28 11:19 [PATCH 0/7] clocksource/drivers/timer-microchip-pit64b: fixes and improvements Claudiu Beznea
` (2 preceding siblings ...)
2022-02-28 11:19 ` [PATCH 3/7] clocksource/drivers/timer-microchip-pit64b: use notrace Claudiu Beznea
@ 2022-02-28 11:19 ` Claudiu Beznea
2022-02-28 11:19 ` [PATCH 5/7] clocksource/drivers/timer-microchip-pit64b: add delay timer Claudiu Beznea
` (2 subsequent siblings)
6 siblings, 0 replies; 11+ messages in thread
From: Claudiu Beznea @ 2022-02-28 11:19 UTC (permalink / raw)
To: daniel.lezcano, tglx; +Cc: linux-arm-kernel, linux-kernel, Claudiu Beznea
Use 5MHz clock for clockevent timers. This increases timer's
resolution.
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
drivers/clocksource/timer-microchip-pit64b.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/clocksource/timer-microchip-pit64b.c b/drivers/clocksource/timer-microchip-pit64b.c
index 790d2c9b42a7..abce83d2f00b 100644
--- a/drivers/clocksource/timer-microchip-pit64b.c
+++ b/drivers/clocksource/timer-microchip-pit64b.c
@@ -42,8 +42,7 @@
#define MCHP_PIT64B_LSBMASK GENMASK_ULL(31, 0)
#define MCHP_PIT64B_PRES_TO_MODE(p) (MCHP_PIT64B_MR_PRES & ((p) << 8))
#define MCHP_PIT64B_MODE_TO_PRES(m) ((MCHP_PIT64B_MR_PRES & (m)) >> 8)
-#define MCHP_PIT64B_DEF_CS_FREQ 5000000UL /* 5 MHz */
-#define MCHP_PIT64B_DEF_CE_FREQ 32768 /* 32 KHz */
+#define MCHP_PIT64B_DEF_FREQ 5000000UL /* 5 MHz */
#define MCHP_PIT64B_NAME "pit64b"
@@ -418,7 +417,6 @@ static int __init mchp_pit64b_init_clkevt(struct mchp_pit64b_timer *timer,
static int __init mchp_pit64b_dt_init_timer(struct device_node *node,
bool clkevt)
{
- u32 freq = clkevt ? MCHP_PIT64B_DEF_CE_FREQ : MCHP_PIT64B_DEF_CS_FREQ;
struct mchp_pit64b_timer timer;
unsigned long clk_rate;
u32 irq = 0;
@@ -446,7 +444,7 @@ static int __init mchp_pit64b_dt_init_timer(struct device_node *node,
}
/* Initialize mode (prescaler + SGCK bit). To be used at runtime. */
- ret = mchp_pit64b_init_mode(&timer, freq);
+ ret = mchp_pit64b_init_mode(&timer, MCHP_PIT64B_DEF_FREQ);
if (ret)
goto irq_unmap;
--
2.32.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH 5/7] clocksource/drivers/timer-microchip-pit64b: add delay timer
2022-02-28 11:19 [PATCH 0/7] clocksource/drivers/timer-microchip-pit64b: fixes and improvements Claudiu Beznea
` (3 preceding siblings ...)
2022-02-28 11:19 ` [PATCH 4/7] clocksource/drivers/timer-microchip-pit64b: use 5MHz for clockevent Claudiu Beznea
@ 2022-02-28 11:19 ` Claudiu Beznea
2022-02-28 17:35 ` kernel test robot
2022-02-28 17:35 ` kernel test robot
2022-02-28 11:19 ` [PATCH 6/7] clocksource/drivers/timer-microchip-pit64b: remove suspend/resume ops for ce Claudiu Beznea
2022-02-28 11:19 ` [PATCH 7/7] clocksource/drivers/timer-microchip-pit64b: use mchp_pit64b_{suspend, resume} Claudiu Beznea
6 siblings, 2 replies; 11+ messages in thread
From: Claudiu Beznea @ 2022-02-28 11:19 UTC (permalink / raw)
To: daniel.lezcano, tglx; +Cc: linux-arm-kernel, linux-kernel, Claudiu Beznea
Add delay timer.
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
drivers/clocksource/timer-microchip-pit64b.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/clocksource/timer-microchip-pit64b.c b/drivers/clocksource/timer-microchip-pit64b.c
index abce83d2f00b..f1b211ee6312 100644
--- a/drivers/clocksource/timer-microchip-pit64b.c
+++ b/drivers/clocksource/timer-microchip-pit64b.c
@@ -9,6 +9,7 @@
#include <linux/clk.h>
#include <linux/clockchips.h>
+#include <linux/delay.h>
#include <linux/interrupt.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>
@@ -92,6 +93,8 @@ struct mchp_pit64b_clksrc {
static void __iomem *mchp_pit64b_cs_base;
/* Default cycles for clockevent timer. */
static u64 mchp_pit64b_ce_cycles;
+/* Delay timer. */
+static struct delay_timer mchp_pit64b_dt;
static inline u64 mchp_pit64b_cnt_read(void __iomem *base)
{
@@ -169,6 +172,11 @@ static u64 notrace mchp_pit64b_sched_read_clk(void)
return mchp_pit64b_cnt_read(mchp_pit64b_cs_base);
}
+static unsigned long notrace mchp_pit64b_dt_read(void)
+{
+ return mchp_pit64b_cnt_read(mchp_pit64b_cs_base);
+}
+
static int mchp_pit64b_clkevt_shutdown(struct clock_event_device *cedev)
{
struct mchp_pit64b_timer *timer = clkevt_to_mchp_pit64b_timer(cedev);
@@ -371,6 +379,10 @@ static int __init mchp_pit64b_init_clksrc(struct mchp_pit64b_timer *timer,
sched_clock_register(mchp_pit64b_sched_read_clk, 64, clk_rate);
+ mchp_pit64b_dt.read_current_timer = mchp_pit64b_dt_read;
+ mchp_pit64b_dt.freq = clk_rate;
+ register_current_timer_delay(&mchp_pit64b_dt);
+
return 0;
}
--
2.32.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 11+ messages in thread* Re: [PATCH 5/7] clocksource/drivers/timer-microchip-pit64b: add delay timer
2022-02-28 11:19 ` [PATCH 5/7] clocksource/drivers/timer-microchip-pit64b: add delay timer Claudiu Beznea
@ 2022-02-28 17:35 ` kernel test robot
2022-02-28 17:35 ` kernel test robot
1 sibling, 0 replies; 11+ messages in thread
From: kernel test robot @ 2022-02-28 17:35 UTC (permalink / raw)
To: Claudiu Beznea, daniel.lezcano, tglx
Cc: kbuild-all, linux-arm-kernel, linux-kernel, Claudiu Beznea
Hi Claudiu,
I love your patch! Yet something to improve:
[auto build test ERROR on tip/timers/core]
[also build test ERROR on soc/for-next linus/master v5.17-rc6 next-20220225]
[cannot apply to daniel-lezcano/clockevents/next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Claudiu-Beznea/clocksource-drivers-timer-microchip-pit64b-fixes-and-improvements/20220228-191933
base: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 35e13e9da9afbce13c1d36465504ece4e65f24fe
config: openrisc-randconfig-r035-20220228 (https://download.01.org/0day-ci/archive/20220228/202202282139.f38uxhKT-lkp@intel.com/config)
compiler: or1k-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/6050ca5a0af604ed2c397dcb907a9b057635a64e
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Claudiu-Beznea/clocksource-drivers-timer-microchip-pit64b-fixes-and-improvements/20220228-191933
git checkout 6050ca5a0af604ed2c397dcb907a9b057635a64e
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=openrisc SHELL=/bin/bash drivers/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
drivers/clocksource/timer-microchip-pit64b.c: In function 'mchp_pit64b_init_clksrc':
>> drivers/clocksource/timer-microchip-pit64b.c:382:23: error: invalid use of undefined type 'struct delay_timer'
382 | mchp_pit64b_dt.read_current_timer = mchp_pit64b_dt_read;
| ^
drivers/clocksource/timer-microchip-pit64b.c:383:23: error: invalid use of undefined type 'struct delay_timer'
383 | mchp_pit64b_dt.freq = clk_rate;
| ^
>> drivers/clocksource/timer-microchip-pit64b.c:384:9: error: implicit declaration of function 'register_current_timer_delay' [-Werror=implicit-function-declaration]
384 | register_current_timer_delay(&mchp_pit64b_dt);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/clocksource/timer-microchip-pit64b.c: At top level:
>> drivers/clocksource/timer-microchip-pit64b.c:97:27: error: storage size of 'mchp_pit64b_dt' isn't known
97 | static struct delay_timer mchp_pit64b_dt;
| ^~~~~~~~~~~~~~
cc1: some warnings being treated as errors
vim +382 drivers/clocksource/timer-microchip-pit64b.c
341
342 static int __init mchp_pit64b_init_clksrc(struct mchp_pit64b_timer *timer,
343 u32 clk_rate)
344 {
345 struct mchp_pit64b_clksrc *cs;
346 int ret;
347
348 cs = kzalloc(sizeof(*cs), GFP_KERNEL);
349 if (!cs)
350 return -ENOMEM;
351
352 mchp_pit64b_reset(timer, ULLONG_MAX, MCHP_PIT64B_MR_CONT, 0);
353
354 mchp_pit64b_cs_base = timer->base;
355
356 cs->timer.base = timer->base;
357 cs->timer.pclk = timer->pclk;
358 cs->timer.gclk = timer->gclk;
359 cs->timer.mode = timer->mode;
360 cs->clksrc.name = MCHP_PIT64B_NAME;
361 cs->clksrc.mask = CLOCKSOURCE_MASK(64);
362 cs->clksrc.flags = CLOCK_SOURCE_IS_CONTINUOUS;
363 cs->clksrc.rating = 210;
364 cs->clksrc.read = mchp_pit64b_clksrc_read;
365 cs->clksrc.suspend = mchp_pit64b_clksrc_suspend;
366 cs->clksrc.resume = mchp_pit64b_clksrc_resume;
367
368 ret = clocksource_register_hz(&cs->clksrc, clk_rate);
369 if (ret) {
370 pr_debug("clksrc: Failed to register PIT64B clocksource!\n");
371
372 /* Stop timer. */
373 writel_relaxed(MCHP_PIT64B_CR_SWRST,
374 timer->base + MCHP_PIT64B_CR);
375 kfree(cs);
376
377 return ret;
378 }
379
380 sched_clock_register(mchp_pit64b_sched_read_clk, 64, clk_rate);
381
> 382 mchp_pit64b_dt.read_current_timer = mchp_pit64b_dt_read;
383 mchp_pit64b_dt.freq = clk_rate;
> 384 register_current_timer_delay(&mchp_pit64b_dt);
385
386 return 0;
387 }
388
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
_______________________________________________
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] 11+ messages in thread* Re: [PATCH 5/7] clocksource/drivers/timer-microchip-pit64b: add delay timer
2022-02-28 11:19 ` [PATCH 5/7] clocksource/drivers/timer-microchip-pit64b: add delay timer Claudiu Beznea
2022-02-28 17:35 ` kernel test robot
@ 2022-02-28 17:35 ` kernel test robot
1 sibling, 0 replies; 11+ messages in thread
From: kernel test robot @ 2022-02-28 17:35 UTC (permalink / raw)
To: Claudiu Beznea, daniel.lezcano, tglx
Cc: llvm, kbuild-all, linux-arm-kernel, linux-kernel, Claudiu Beznea
Hi Claudiu,
I love your patch! Perhaps something to improve:
[auto build test WARNING on tip/timers/core]
[also build test WARNING on soc/for-next linus/master v5.17-rc6 next-20220225]
[cannot apply to daniel-lezcano/clockevents/next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Claudiu-Beznea/clocksource-drivers-timer-microchip-pit64b-fixes-and-improvements/20220228-191933
base: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 35e13e9da9afbce13c1d36465504ece4e65f24fe
config: s390-randconfig-r036-20220228 (https://download.01.org/0day-ci/archive/20220228/202202282242.zM0FjCHj-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project d271fc04d5b97b12e6b797c6067d3c96a8d7470e)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install s390 cross compiling tool for clang build
# apt-get install binutils-s390x-linux-gnu
# https://github.com/0day-ci/linux/commit/6050ca5a0af604ed2c397dcb907a9b057635a64e
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Claudiu-Beznea/clocksource-drivers-timer-microchip-pit64b-fixes-and-improvements/20220228-191933
git checkout 6050ca5a0af604ed2c397dcb907a9b057635a64e
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=s390 SHELL=/bin/bash drivers/clocksource/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
In file included from drivers/clocksource/timer-microchip-pit64b.c:11:
In file included from include/linux/clockchips.h:14:
In file included from include/linux/clocksource.h:22:
In file included from arch/s390/include/asm/io.h:75:
include/asm-generic/io.h:464:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __raw_readb(PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:477:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
~~~~~~~~~~ ^
include/uapi/linux/byteorder/big_endian.h:36:59: note: expanded from macro '__le16_to_cpu'
#define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
^
include/uapi/linux/swab.h:102:54: note: expanded from macro '__swab16'
#define __swab16(x) (__u16)__builtin_bswap16((__u16)(x))
^
In file included from drivers/clocksource/timer-microchip-pit64b.c:11:
In file included from include/linux/clockchips.h:14:
In file included from include/linux/clocksource.h:22:
In file included from arch/s390/include/asm/io.h:75:
include/asm-generic/io.h:490:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
~~~~~~~~~~ ^
include/uapi/linux/byteorder/big_endian.h:34:59: note: expanded from macro '__le32_to_cpu'
#define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
^
include/uapi/linux/swab.h:115:54: note: expanded from macro '__swab32'
#define __swab32(x) (__u32)__builtin_bswap32((__u32)(x))
^
In file included from drivers/clocksource/timer-microchip-pit64b.c:11:
In file included from include/linux/clockchips.h:14:
In file included from include/linux/clocksource.h:22:
In file included from arch/s390/include/asm/io.h:75:
include/asm-generic/io.h:501:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writeb(value, PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:511:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:521:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:609:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
readsb(PCI_IOBASE + addr, buffer, count);
~~~~~~~~~~ ^
include/asm-generic/io.h:617:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
readsw(PCI_IOBASE + addr, buffer, count);
~~~~~~~~~~ ^
include/asm-generic/io.h:625:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
readsl(PCI_IOBASE + addr, buffer, count);
~~~~~~~~~~ ^
include/asm-generic/io.h:634:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
writesb(PCI_IOBASE + addr, buffer, count);
~~~~~~~~~~ ^
include/asm-generic/io.h:643:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
writesw(PCI_IOBASE + addr, buffer, count);
~~~~~~~~~~ ^
include/asm-generic/io.h:652:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
writesl(PCI_IOBASE + addr, buffer, count);
~~~~~~~~~~ ^
>> drivers/clocksource/timer-microchip-pit64b.c:97:27: warning: tentative definition of variable with internal linkage has incomplete non-array type 'struct delay_timer' [-Wtentative-definition-incomplete-type]
static struct delay_timer mchp_pit64b_dt;
^
drivers/clocksource/timer-microchip-pit64b.c:97:15: note: forward declaration of 'struct delay_timer'
static struct delay_timer mchp_pit64b_dt;
^
drivers/clocksource/timer-microchip-pit64b.c:382:16: error: incomplete definition of type 'struct delay_timer'
mchp_pit64b_dt.read_current_timer = mchp_pit64b_dt_read;
~~~~~~~~~~~~~~^
drivers/clocksource/timer-microchip-pit64b.c:97:15: note: forward declaration of 'struct delay_timer'
static struct delay_timer mchp_pit64b_dt;
^
drivers/clocksource/timer-microchip-pit64b.c:383:16: error: incomplete definition of type 'struct delay_timer'
mchp_pit64b_dt.freq = clk_rate;
~~~~~~~~~~~~~~^
drivers/clocksource/timer-microchip-pit64b.c:97:15: note: forward declaration of 'struct delay_timer'
static struct delay_timer mchp_pit64b_dt;
^
drivers/clocksource/timer-microchip-pit64b.c:384:2: error: implicit declaration of function 'register_current_timer_delay' [-Werror,-Wimplicit-function-declaration]
register_current_timer_delay(&mchp_pit64b_dt);
^
drivers/clocksource/timer-microchip-pit64b.c:97:27: error: tentative definition has type 'struct delay_timer' that is never completed
static struct delay_timer mchp_pit64b_dt;
^
drivers/clocksource/timer-microchip-pit64b.c:97:15: note: forward declaration of 'struct delay_timer'
static struct delay_timer mchp_pit64b_dt;
^
13 warnings and 4 errors generated.
vim +97 drivers/clocksource/timer-microchip-pit64b.c
87
88 #define clksrc_to_mchp_pit64b_timer(x) \
89 ((struct mchp_pit64b_timer *)container_of(x,\
90 struct mchp_pit64b_clksrc, clksrc))
91
92 /* Base address for clocksource timer. */
93 static void __iomem *mchp_pit64b_cs_base;
94 /* Default cycles for clockevent timer. */
95 static u64 mchp_pit64b_ce_cycles;
96 /* Delay timer. */
> 97 static struct delay_timer mchp_pit64b_dt;
98
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
_______________________________________________
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] 11+ messages in thread
* [PATCH 6/7] clocksource/drivers/timer-microchip-pit64b: remove suspend/resume ops for ce
2022-02-28 11:19 [PATCH 0/7] clocksource/drivers/timer-microchip-pit64b: fixes and improvements Claudiu Beznea
` (4 preceding siblings ...)
2022-02-28 11:19 ` [PATCH 5/7] clocksource/drivers/timer-microchip-pit64b: add delay timer Claudiu Beznea
@ 2022-02-28 11:19 ` Claudiu Beznea
2022-02-28 11:19 ` [PATCH 7/7] clocksource/drivers/timer-microchip-pit64b: use mchp_pit64b_{suspend, resume} Claudiu Beznea
6 siblings, 0 replies; 11+ messages in thread
From: Claudiu Beznea @ 2022-02-28 11:19 UTC (permalink / raw)
To: daniel.lezcano, tglx; +Cc: linux-arm-kernel, linux-kernel, Claudiu Beznea
Remove suspend and resume ops for clockevent and add set_state_oneshot()
instead. Along with this mchp_pit64b_{suspend, resume}() were called on
proper function to disable/enable clocks. This will allow disabling clocks
for clockevent in case it is not selected as active clockevent.
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
drivers/clocksource/timer-microchip-pit64b.c | 30 +++++++++++---------
1 file changed, 16 insertions(+), 14 deletions(-)
diff --git a/drivers/clocksource/timer-microchip-pit64b.c b/drivers/clocksource/timer-microchip-pit64b.c
index f1b211ee6312..dd1661604966 100644
--- a/drivers/clocksource/timer-microchip-pit64b.c
+++ b/drivers/clocksource/timer-microchip-pit64b.c
@@ -181,7 +181,8 @@ static int mchp_pit64b_clkevt_shutdown(struct clock_event_device *cedev)
{
struct mchp_pit64b_timer *timer = clkevt_to_mchp_pit64b_timer(cedev);
- writel_relaxed(MCHP_PIT64B_CR_SWRST, timer->base + MCHP_PIT64B_CR);
+ if (!clockevent_state_detached(cedev))
+ mchp_pit64b_suspend(timer);
return 0;
}
@@ -190,35 +191,37 @@ static int mchp_pit64b_clkevt_set_periodic(struct clock_event_device *cedev)
{
struct mchp_pit64b_timer *timer = clkevt_to_mchp_pit64b_timer(cedev);
+ if (clockevent_state_shutdown(cedev))
+ mchp_pit64b_resume(timer);
+
mchp_pit64b_reset(timer, mchp_pit64b_ce_cycles, MCHP_PIT64B_MR_CONT,
MCHP_PIT64B_IER_PERIOD);
return 0;
}
-static int mchp_pit64b_clkevt_set_next_event(unsigned long evt,
- struct clock_event_device *cedev)
+static int mchp_pit64b_clkevt_set_oneshot(struct clock_event_device *cedev)
{
struct mchp_pit64b_timer *timer = clkevt_to_mchp_pit64b_timer(cedev);
- mchp_pit64b_reset(timer, evt, MCHP_PIT64B_MR_ONE_SHOT,
+ if (clockevent_state_shutdown(cedev))
+ mchp_pit64b_resume(timer);
+
+ mchp_pit64b_reset(timer, mchp_pit64b_ce_cycles, MCHP_PIT64B_MR_ONE_SHOT,
MCHP_PIT64B_IER_PERIOD);
return 0;
}
-static void mchp_pit64b_clkevt_suspend(struct clock_event_device *cedev)
+static int mchp_pit64b_clkevt_set_next_event(unsigned long evt,
+ struct clock_event_device *cedev)
{
struct mchp_pit64b_timer *timer = clkevt_to_mchp_pit64b_timer(cedev);
- mchp_pit64b_suspend(timer);
-}
-
-static void mchp_pit64b_clkevt_resume(struct clock_event_device *cedev)
-{
- struct mchp_pit64b_timer *timer = clkevt_to_mchp_pit64b_timer(cedev);
+ mchp_pit64b_reset(timer, evt, MCHP_PIT64B_MR_ONE_SHOT,
+ MCHP_PIT64B_IER_PERIOD);
- mchp_pit64b_resume(timer);
+ return 0;
}
static irqreturn_t mchp_pit64b_interrupt(int irq, void *dev_id)
@@ -407,9 +410,8 @@ static int __init mchp_pit64b_init_clkevt(struct mchp_pit64b_timer *timer,
ce->clkevt.rating = 150;
ce->clkevt.set_state_shutdown = mchp_pit64b_clkevt_shutdown;
ce->clkevt.set_state_periodic = mchp_pit64b_clkevt_set_periodic;
+ ce->clkevt.set_state_oneshot = mchp_pit64b_clkevt_set_oneshot;
ce->clkevt.set_next_event = mchp_pit64b_clkevt_set_next_event;
- ce->clkevt.suspend = mchp_pit64b_clkevt_suspend;
- ce->clkevt.resume = mchp_pit64b_clkevt_resume;
ce->clkevt.cpumask = cpumask_of(0);
ce->clkevt.irq = irq;
--
2.32.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH 7/7] clocksource/drivers/timer-microchip-pit64b: use mchp_pit64b_{suspend, resume}
2022-02-28 11:19 [PATCH 0/7] clocksource/drivers/timer-microchip-pit64b: fixes and improvements Claudiu Beznea
` (5 preceding siblings ...)
2022-02-28 11:19 ` [PATCH 6/7] clocksource/drivers/timer-microchip-pit64b: remove suspend/resume ops for ce Claudiu Beznea
@ 2022-02-28 11:19 ` Claudiu Beznea
2022-02-28 17:37 ` kernel test robot
6 siblings, 1 reply; 11+ messages in thread
From: Claudiu Beznea @ 2022-02-28 11:19 UTC (permalink / raw)
To: daniel.lezcano, tglx; +Cc: linux-arm-kernel, linux-kernel, Claudiu Beznea
Use mchp_pit64b_suspend() and mchp_pit64b_resume() to disable or
enable timers clocks on init and remove specific
clk_prepare_{disable, enable} calls. This is ok also for clockevent timer
as proper clock enable, disable is done on .set_state_oneshot,
.set_state_periodic, .set_state_shutdown calls.
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
drivers/clocksource/timer-microchip-pit64b.c | 17 ++++-------------
1 file changed, 4 insertions(+), 13 deletions(-)
diff --git a/drivers/clocksource/timer-microchip-pit64b.c b/drivers/clocksource/timer-microchip-pit64b.c
index dd1661604966..0f0d8160660c 100644
--- a/drivers/clocksource/timer-microchip-pit64b.c
+++ b/drivers/clocksource/timer-microchip-pit64b.c
@@ -352,6 +352,7 @@ static int __init mchp_pit64b_init_clksrc(struct mchp_pit64b_timer *timer,
if (!cs)
return -ENOMEM;
+ mchp_pit64b_resume(timer);
mchp_pit64b_reset(timer, ULLONG_MAX, MCHP_PIT64B_MR_CONT, 0);
mchp_pit64b_cs_base = timer->base;
@@ -373,8 +374,7 @@ static int __init mchp_pit64b_init_clksrc(struct mchp_pit64b_timer *timer,
pr_debug("clksrc: Failed to register PIT64B clocksource!\n");
/* Stop timer. */
- writel_relaxed(MCHP_PIT64B_CR_SWRST,
- timer->base + MCHP_PIT64B_CR);
+ mchp_pit64b_suspend(timer);
kfree(cs);
return ret;
@@ -462,19 +462,10 @@ static int __init mchp_pit64b_dt_init_timer(struct device_node *node,
if (ret)
goto irq_unmap;
- ret = clk_prepare_enable(timer.pclk);
- if (ret)
- goto irq_unmap;
-
- if (timer.mode & MCHP_PIT64B_MR_SGCLK) {
- ret = clk_prepare_enable(timer.gclk);
- if (ret)
- goto pclk_unprepare;
-
+ if (timer.mode & MCHP_PIT64B_MR_SGCLK)
clk_rate = clk_get_rate(timer.gclk);
- } else {
+ else
clk_rate = clk_get_rate(timer.pclk);
- }
clk_rate = clk_rate / (MCHP_PIT64B_MODE_TO_PRES(timer.mode) + 1);
if (clkevt)
--
2.32.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 11+ messages in thread* Re: [PATCH 7/7] clocksource/drivers/timer-microchip-pit64b: use mchp_pit64b_{suspend, resume}
2022-02-28 11:19 ` [PATCH 7/7] clocksource/drivers/timer-microchip-pit64b: use mchp_pit64b_{suspend, resume} Claudiu Beznea
@ 2022-02-28 17:37 ` kernel test robot
0 siblings, 0 replies; 11+ messages in thread
From: kernel test robot @ 2022-02-28 17:37 UTC (permalink / raw)
To: Claudiu Beznea, daniel.lezcano, tglx
Cc: llvm, kbuild-all, linux-arm-kernel, linux-kernel, Claudiu Beznea
Hi Claudiu,
I love your patch! Perhaps something to improve:
[auto build test WARNING on tip/timers/core]
[also build test WARNING on soc/for-next linus/master v5.17-rc6 next-20220225]
[cannot apply to daniel-lezcano/clockevents/next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Claudiu-Beznea/clocksource-drivers-timer-microchip-pit64b-fixes-and-improvements/20220228-191933
base: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 35e13e9da9afbce13c1d36465504ece4e65f24fe
config: i386-randconfig-a002-20220228 (https://download.01.org/0day-ci/archive/20220301/202203010158.D812WMzG-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project d271fc04d5b97b12e6b797c6067d3c96a8d7470e)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/a354e98d1b37361a46d6272ffccc149e3b8bbbca
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Claudiu-Beznea/clocksource-drivers-timer-microchip-pit64b-fixes-and-improvements/20220228-191933
git checkout a354e98d1b37361a46d6272ffccc149e3b8bbbca
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/clocksource/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
drivers/clocksource/timer-microchip-pit64b.c:97:27: warning: tentative definition of variable with internal linkage has incomplete non-array type 'struct delay_timer' [-Wtentative-definition-incomplete-type]
static struct delay_timer mchp_pit64b_dt;
^
drivers/clocksource/timer-microchip-pit64b.c:97:15: note: forward declaration of 'struct delay_timer'
static struct delay_timer mchp_pit64b_dt;
^
drivers/clocksource/timer-microchip-pit64b.c:385:16: error: incomplete definition of type 'struct delay_timer'
mchp_pit64b_dt.read_current_timer = mchp_pit64b_dt_read;
~~~~~~~~~~~~~~^
drivers/clocksource/timer-microchip-pit64b.c:97:15: note: forward declaration of 'struct delay_timer'
static struct delay_timer mchp_pit64b_dt;
^
drivers/clocksource/timer-microchip-pit64b.c:386:16: error: incomplete definition of type 'struct delay_timer'
mchp_pit64b_dt.freq = clk_rate;
~~~~~~~~~~~~~~^
drivers/clocksource/timer-microchip-pit64b.c:97:15: note: forward declaration of 'struct delay_timer'
static struct delay_timer mchp_pit64b_dt;
^
drivers/clocksource/timer-microchip-pit64b.c:387:2: error: implicit declaration of function 'register_current_timer_delay' [-Werror,-Wimplicit-function-declaration]
register_current_timer_delay(&mchp_pit64b_dt);
^
>> drivers/clocksource/timer-microchip-pit64b.c:484:1: warning: unused label 'pclk_unprepare' [-Wunused-label]
pclk_unprepare:
^~~~~~~~~~~~~~~
drivers/clocksource/timer-microchip-pit64b.c:97:27: error: tentative definition has type 'struct delay_timer' that is never completed
static struct delay_timer mchp_pit64b_dt;
^
drivers/clocksource/timer-microchip-pit64b.c:97:15: note: forward declaration of 'struct delay_timer'
static struct delay_timer mchp_pit64b_dt;
^
2 warnings and 4 errors generated.
vim +/pclk_unprepare +484 drivers/clocksource/timer-microchip-pit64b.c
625022a5f16061 Claudiu Beznea 2019-12-13 430
625022a5f16061 Claudiu Beznea 2019-12-13 431 static int __init mchp_pit64b_dt_init_timer(struct device_node *node,
625022a5f16061 Claudiu Beznea 2019-12-13 432 bool clkevt)
625022a5f16061 Claudiu Beznea 2019-12-13 433 {
b9c60a741f06ed Claudiu Beznea 2020-01-06 434 struct mchp_pit64b_timer timer;
625022a5f16061 Claudiu Beznea 2019-12-13 435 unsigned long clk_rate;
625022a5f16061 Claudiu Beznea 2019-12-13 436 u32 irq = 0;
625022a5f16061 Claudiu Beznea 2019-12-13 437 int ret;
625022a5f16061 Claudiu Beznea 2019-12-13 438
625022a5f16061 Claudiu Beznea 2019-12-13 439 /* Parse DT node. */
625022a5f16061 Claudiu Beznea 2019-12-13 440 timer.pclk = of_clk_get_by_name(node, "pclk");
625022a5f16061 Claudiu Beznea 2019-12-13 441 if (IS_ERR(timer.pclk))
625022a5f16061 Claudiu Beznea 2019-12-13 442 return PTR_ERR(timer.pclk);
625022a5f16061 Claudiu Beznea 2019-12-13 443
625022a5f16061 Claudiu Beznea 2019-12-13 444 timer.gclk = of_clk_get_by_name(node, "gclk");
625022a5f16061 Claudiu Beznea 2019-12-13 445 if (IS_ERR(timer.gclk))
625022a5f16061 Claudiu Beznea 2019-12-13 446 return PTR_ERR(timer.gclk);
625022a5f16061 Claudiu Beznea 2019-12-13 447
625022a5f16061 Claudiu Beznea 2019-12-13 448 timer.base = of_iomap(node, 0);
625022a5f16061 Claudiu Beznea 2019-12-13 449 if (!timer.base)
625022a5f16061 Claudiu Beznea 2019-12-13 450 return -ENXIO;
625022a5f16061 Claudiu Beznea 2019-12-13 451
625022a5f16061 Claudiu Beznea 2019-12-13 452 if (clkevt) {
625022a5f16061 Claudiu Beznea 2019-12-13 453 irq = irq_of_parse_and_map(node, 0);
625022a5f16061 Claudiu Beznea 2019-12-13 454 if (!irq) {
625022a5f16061 Claudiu Beznea 2019-12-13 455 ret = -ENODEV;
625022a5f16061 Claudiu Beznea 2019-12-13 456 goto io_unmap;
625022a5f16061 Claudiu Beznea 2019-12-13 457 }
625022a5f16061 Claudiu Beznea 2019-12-13 458 }
625022a5f16061 Claudiu Beznea 2019-12-13 459
625022a5f16061 Claudiu Beznea 2019-12-13 460 /* Initialize mode (prescaler + SGCK bit). To be used at runtime. */
0faff1ca60d69f Claudiu Beznea 2022-02-28 461 ret = mchp_pit64b_init_mode(&timer, MCHP_PIT64B_DEF_FREQ);
625022a5f16061 Claudiu Beznea 2019-12-13 462 if (ret)
625022a5f16061 Claudiu Beznea 2019-12-13 463 goto irq_unmap;
625022a5f16061 Claudiu Beznea 2019-12-13 464
a354e98d1b3736 Claudiu Beznea 2022-02-28 465 if (timer.mode & MCHP_PIT64B_MR_SGCLK)
625022a5f16061 Claudiu Beznea 2019-12-13 466 clk_rate = clk_get_rate(timer.gclk);
a354e98d1b3736 Claudiu Beznea 2022-02-28 467 else
625022a5f16061 Claudiu Beznea 2019-12-13 468 clk_rate = clk_get_rate(timer.pclk);
625022a5f16061 Claudiu Beznea 2019-12-13 469 clk_rate = clk_rate / (MCHP_PIT64B_MODE_TO_PRES(timer.mode) + 1);
625022a5f16061 Claudiu Beznea 2019-12-13 470
625022a5f16061 Claudiu Beznea 2019-12-13 471 if (clkevt)
625022a5f16061 Claudiu Beznea 2019-12-13 472 ret = mchp_pit64b_init_clkevt(&timer, clk_rate, irq);
625022a5f16061 Claudiu Beznea 2019-12-13 473 else
625022a5f16061 Claudiu Beznea 2019-12-13 474 ret = mchp_pit64b_init_clksrc(&timer, clk_rate);
625022a5f16061 Claudiu Beznea 2019-12-13 475
625022a5f16061 Claudiu Beznea 2019-12-13 476 if (ret)
625022a5f16061 Claudiu Beznea 2019-12-13 477 goto gclk_unprepare;
625022a5f16061 Claudiu Beznea 2019-12-13 478
625022a5f16061 Claudiu Beznea 2019-12-13 479 return 0;
625022a5f16061 Claudiu Beznea 2019-12-13 480
625022a5f16061 Claudiu Beznea 2019-12-13 481 gclk_unprepare:
625022a5f16061 Claudiu Beznea 2019-12-13 482 if (timer.mode & MCHP_PIT64B_MR_SGCLK)
625022a5f16061 Claudiu Beznea 2019-12-13 483 clk_disable_unprepare(timer.gclk);
625022a5f16061 Claudiu Beznea 2019-12-13 @484 pclk_unprepare:
625022a5f16061 Claudiu Beznea 2019-12-13 485 clk_disable_unprepare(timer.pclk);
625022a5f16061 Claudiu Beznea 2019-12-13 486 irq_unmap:
625022a5f16061 Claudiu Beznea 2019-12-13 487 irq_dispose_mapping(irq);
625022a5f16061 Claudiu Beznea 2019-12-13 488 io_unmap:
625022a5f16061 Claudiu Beznea 2019-12-13 489 iounmap(timer.base);
625022a5f16061 Claudiu Beznea 2019-12-13 490
625022a5f16061 Claudiu Beznea 2019-12-13 491 return ret;
625022a5f16061 Claudiu Beznea 2019-12-13 492 }
625022a5f16061 Claudiu Beznea 2019-12-13 493
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
_______________________________________________
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] 11+ messages in thread