blob: d4f807191ecd74694075ba3ca2748ff0b80bcbb1 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Steven J. Hill49bffbd2013-03-25 15:05:40 -05002 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
Linus Torvalds1da177e2005-04-16 15:20:36 -07005 *
6 * Display routines for display messages in MIPS boards ascii display.
Steven J. Hill49bffbd2013-03-25 15:05:40 -05007 *
8 * Copyright (C) 1999,2000,2012 MIPS Technologies, Inc.
9 * All rights reserved.
10 * Authors: Carsten Langgaard <carstenl@mips.com>
11 * Steven J. Hill <sjhill@mips.com>
Linus Torvalds1da177e2005-04-16 15:20:36 -070012 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070013#include <linux/compiler.h>
Ralf Baechle79894c72007-05-16 17:54:08 +020014#include <linux/timer.h>
Steven J. Hill49bffbd2013-03-25 15:05:40 -050015#include <linux/io.h>
16
Linus Torvalds1da177e2005-04-16 15:20:36 -070017#include <asm/mips-boards/generic.h>
18
Ralf Baechle79894c72007-05-16 17:54:08 +020019extern const char display_string[];
20static unsigned int display_count;
21static unsigned int max_display_count;
22
Linus Torvalds1da177e2005-04-16 15:20:36 -070023void mips_display_message(const char *str)
24{
Ralf Baechlef1974652007-04-26 15:46:24 +010025 static unsigned int __iomem *display = NULL;
Linus Torvalds1da177e2005-04-16 15:20:36 -070026 int i;
27
28 if (unlikely(display == NULL))
Ralf Baechlef1974652007-04-26 15:46:24 +010029 display = ioremap(ASCII_DISPLAY_POS_BASE, 16*sizeof(int));
Linus Torvalds1da177e2005-04-16 15:20:36 -070030
Steven J. Hill49bffbd2013-03-25 15:05:40 -050031 for (i = 0; i <= 14; i += 2) {
32 if (*str)
33 __raw_writel(*str++, display + i);
34 else
35 __raw_writel(' ', display + i);
Linus Torvalds1da177e2005-04-16 15:20:36 -070036 }
37}
Ralf Baechle79894c72007-05-16 17:54:08 +020038
39static void scroll_display_message(unsigned long data);
40static DEFINE_TIMER(mips_scroll_timer, scroll_display_message, HZ, 0);
41
42static void scroll_display_message(unsigned long data)
43{
44 mips_display_message(&display_string[display_count++]);
45 if (display_count == max_display_count)
46 display_count = 0;
47
48 mod_timer(&mips_scroll_timer, jiffies + HZ);
49}
50
51void mips_scroll_message(void)
52{
53 del_timer_sync(&mips_scroll_timer);
54 max_display_count = strlen(display_string) + 1 - 8;
55 mod_timer(&mips_scroll_timer, jiffies + 1);
56}