Re: [U-Boot] [PATCH] microblaze: Remove architecture heart beat code

2018-06-11 Thread Geert Uytterhoeven
Hi Linus,

On Mon, Jun 11, 2018 at 10:47 AM Linus Walleij  wrote:
> On Mon, Jun 11, 2018 at 8:09 AM, Michal Simek  wrote:
> > There is no reason to keep this gpio based code in architecture. Use
> > ledtrig-heartbeat.c instead which is much more flexible then this
> > ancient code.
> >
> > Signed-off-by: Michal Simek 
>
> Reviewed-by: Linus Walleij 
>
> Maybe the arch maintainers will complain that the corresponding
> new heartbeat code is not put in place in the same patch, but I
> think the change is so much overdue that I don't see why they
> can't do that themselves if they have interest in it.
>
> BTW: m68k has the same kind of luggage, in the middle of it
> timekeeping code:
> arch/m68k/kernel/time.c

Fixing that means converting m68k to GPIO first, which would take lots of
heartbeats ;-)

Gr{oetje,eeting}s,

Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] microblaze: Remove architecture heart beat code

2018-06-11 Thread Linus Walleij
On Mon, Jun 11, 2018 at 8:09 AM, Michal Simek  wrote:

> There is no reason to keep this gpio based code in architecture. Use
> ledtrig-heartbeat.c instead which is much more flexible then this
> ancient code.
>
> Signed-off-by: Michal Simek 

Reviewed-by: Linus Walleij 

Maybe the arch maintainers will complain that the corresponding
new heartbeat code is not put in place in the same patch, but I
think the change is so much overdue that I don't see why they
can't do that themselves if they have interest in it.

BTW: m68k has the same kind of luggage, in the middle of it
timekeeping code:
arch/m68k/kernel/time.c

Yours,
Linus Walleij
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH] microblaze: Remove architecture heart beat code

2018-06-10 Thread Michal Simek
There is no reason to keep this gpio based code in architecture. Use
ledtrig-heartbeat.c instead which is much more flexible then this
ancient code.

Signed-off-by: Michal Simek 
---

 arch/microblaze/Kconfig.debug   |  7 
 arch/microblaze/include/asm/setup.h |  3 --
 arch/microblaze/kernel/Makefile |  2 --
 arch/microblaze/kernel/heartbeat.c  | 72 -
 arch/microblaze/kernel/timer.c  |  7 
 5 files changed, 91 deletions(-)
 delete mode 100644 arch/microblaze/kernel/heartbeat.c

diff --git a/arch/microblaze/Kconfig.debug b/arch/microblaze/Kconfig.debug
index 331a3bb66297..93a737c8d1a6 100644
--- a/arch/microblaze/Kconfig.debug
+++ b/arch/microblaze/Kconfig.debug
@@ -8,11 +8,4 @@ config TRACE_IRQFLAGS_SUPPORT
 
 source "lib/Kconfig.debug"
 
-config HEART_BEAT
-   bool "Heart beat function for kernel"
-   default n
-   help
- This option turns on/off heart beat kernel functionality.
- First GPIO node is taken.
-
 endmenu
diff --git a/arch/microblaze/include/asm/setup.h 
b/arch/microblaze/include/asm/setup.h
index d5384f6f36f7..a38e4a56e3c6 100644
--- a/arch/microblaze/include/asm/setup.h
+++ b/arch/microblaze/include/asm/setup.h
@@ -19,9 +19,6 @@
 
 extern char *klimit;
 
-void microblaze_heartbeat(void);
-void microblaze_setup_heartbeat(void);
-
 #   ifdef CONFIG_MMU
 extern void mmu_reset(void);
 #   endif /* CONFIG_MMU */
diff --git a/arch/microblaze/kernel/Makefile b/arch/microblaze/kernel/Makefile
index 7e99cf6984a1..3a53378d66d9 100644
--- a/arch/microblaze/kernel/Makefile
+++ b/arch/microblaze/kernel/Makefile
@@ -8,7 +8,6 @@ ifdef CONFIG_FUNCTION_TRACER
 CFLAGS_REMOVE_timer.o = -pg
 CFLAGS_REMOVE_intc.o = -pg
 CFLAGS_REMOVE_early_printk.o = -pg
-CFLAGS_REMOVE_heartbeat.o = -pg
 CFLAGS_REMOVE_ftrace.o = -pg
 CFLAGS_REMOVE_process.o = -pg
 endif
@@ -22,7 +21,6 @@ obj-y += dma.o exceptions.o \
 
 obj-y += cpu/
 
-obj-$(CONFIG_HEART_BEAT)   += heartbeat.o
 obj-$(CONFIG_MODULES)  += microblaze_ksyms.o module.o
 obj-$(CONFIG_MMU)  += misc.o
 obj-$(CONFIG_STACKTRACE)   += stacktrace.o
diff --git a/arch/microblaze/kernel/heartbeat.c 
b/arch/microblaze/kernel/heartbeat.c
deleted file mode 100644
index 2022130139d2..
--- a/arch/microblaze/kernel/heartbeat.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (C) 2007-2009 Michal Simek 
- * Copyright (C) 2007-2009 PetaLogix
- * Copyright (C) 2006 Atmark Techno, Inc.
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License. See the file "COPYING" in the main directory of this archive
- * for more details.
- */
-
-#include 
-#include 
-#include 
-
-#include 
-#include 
-#include 
-
-static unsigned int base_addr;
-
-void microblaze_heartbeat(void)
-{
-   static unsigned int cnt, period, dist;
-
-   if (base_addr) {
-   if (cnt == 0 || cnt == dist)
-   out_be32(base_addr, 1);
-   else if (cnt == 7 || cnt == dist + 7)
-   out_be32(base_addr, 0);
-
-   if (++cnt > period) {
-   cnt = 0;
-   /*
-* The hyperbolic function below modifies the heartbeat
-* period length in dependency of the current (5min)
-* load. It goes through the points f(0)=126, f(1)=86,
-* f(5)=51, f(inf)->30.
-*/
-   period = ((672 << FSHIFT) / (5 * avenrun[0] +
-   (7 << FSHIFT))) + 30;
-   dist = period / 4;
-   }
-   }
-}
-
-void microblaze_setup_heartbeat(void)
-{
-   struct device_node *gpio = NULL;
-   int *prop;
-   int j;
-   const char * const gpio_list[] = {
-   "xlnx,xps-gpio-1.00.a",
-   NULL
-   };
-
-   for (j = 0; gpio_list[j] != NULL; j++) {
-   gpio = of_find_compatible_node(NULL, NULL, gpio_list[j]);
-   if (gpio)
-   break;
-   }
-
-   if (gpio) {
-   base_addr = be32_to_cpup(of_get_property(gpio, "reg", NULL));
-   base_addr = (unsigned long) ioremap(base_addr, PAGE_SIZE);
-   pr_notice("Heartbeat GPIO at 0x%x\n", base_addr);
-
-   /* GPIO is configured as output */
-   prop = (int *) of_get_property(gpio, "xlnx,is-bidir", NULL);
-   if (prop)
-   out_be32(base_addr + 4, 0);
-   }
-}
diff --git a/arch/microblaze/kernel/timer.c b/arch/microblaze/kernel/timer.c
index 7de941cbbd94..a6683484b3a1 100644
--- a/arch/microblaze/kernel/timer.c
+++ b/arch/microblaze/kernel/timer.c
@@ -156,9 +156,6 @@ static inline void timer_ack(void)
 static irqreturn_t timer_interrupt(int irq, void *dev_id)
 {
struct clock_event_device *evt = &clockevent_xilinx_timer;
-#ifdef CONFIG_HEART_BEAT
-   microblaze