Release 4.14 arch/microblaze/kernel/heartbeat.c
/*
* 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 <asm/setup.h>
#include <asm/page.h>
#include <asm/prom.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;
}
}
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Michal Simek | 105 | 99.06% | 1 | 50.00% |
Guenter Roeck | 1 | 0.94% | 1 | 50.00% |
Total | 106 | 100.00% | 2 | 100.00% |
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);
}
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Michal Simek | 120 | 85.71% | 3 | 50.00% |
John Linn | 17 | 12.14% | 1 | 16.67% |
Joe Perches | 2 | 1.43% | 1 | 16.67% |
Guenter Roeck | 1 | 0.71% | 1 | 16.67% |
Total | 140 | 100.00% | 6 | 100.00% |
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Michal Simek | 246 | 91.11% | 3 | 42.86% |
John Linn | 17 | 6.30% | 1 | 14.29% |
Ingo Molnar | 3 | 1.11% | 1 | 14.29% |
Guenter Roeck | 2 | 0.74% | 1 | 14.29% |
Joe Perches | 2 | 0.74% | 1 | 14.29% |
Total | 270 | 100.00% | 7 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.