Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5cf8da7b authored by Michal Simek's avatar Michal Simek
Browse files

microblaze: Remove architecture heart beat code



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: default avatarMichal Simek <michal.simek@xilinx.com>
Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 71ab9115
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -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
+0 −3
Original line number Diff line number Diff line
@@ -19,9 +19,6 @@ extern char cmd_line[COMMAND_LINE_SIZE];

extern char *klimit;

void microblaze_heartbeat(void);
void microblaze_setup_heartbeat(void);

#   ifdef CONFIG_MMU
extern void mmu_reset(void);
#   endif /* CONFIG_MMU */
+0 −2
Original line number Diff line number Diff line
@@ -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
+0 −72
Original line number Diff line number Diff line
/*
 * Copyright (C) 2007-2009 Michal Simek <monstr@monstr.eu>
 * 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 <linux/sched.h>
#include <linux/sched/loadavg.h>
#include <linux/io.h>
#include <linux/of.h>

#include <asm/setup.h>
#include <asm/page.h>

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);
	}
}
+0 −7
Original line number Diff line number Diff line
@@ -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_heartbeat();
#endif
	timer_ack();
	evt->event_handler(evt);
	return IRQ_HANDLED;
@@ -318,10 +315,6 @@ static int __init xilinx_timer_init(struct device_node *timer)
		return ret;
	}

#ifdef CONFIG_HEART_BEAT
	microblaze_setup_heartbeat();
#endif

	ret = xilinx_clocksource_init();
	if (ret)
		return ret;