Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
Steven J. Hill | 49bffbd | 2013-03-25 15:05:40 -0500 | [diff] [blame] | 2 | * 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 Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5 | * |
| 6 | * Display routines for display messages in MIPS boards ascii display. |
Steven J. Hill | 49bffbd | 2013-03-25 15:05:40 -0500 | [diff] [blame] | 7 | * |
| 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 Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | #include <linux/compiler.h> |
Ralf Baechle | 79894c7 | 2007-05-16 17:54:08 +0200 | [diff] [blame] | 14 | #include <linux/timer.h> |
Steven J. Hill | 49bffbd | 2013-03-25 15:05:40 -0500 | [diff] [blame] | 15 | #include <linux/io.h> |
| 16 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | #include <asm/mips-boards/generic.h> |
| 18 | |
Ralf Baechle | 79894c7 | 2007-05-16 17:54:08 +0200 | [diff] [blame] | 19 | extern const char display_string[]; |
| 20 | static unsigned int display_count; |
| 21 | static unsigned int max_display_count; |
| 22 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 | void mips_display_message(const char *str) |
| 24 | { |
Ralf Baechle | f197465 | 2007-04-26 15:46:24 +0100 | [diff] [blame] | 25 | static unsigned int __iomem *display = NULL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | int i; |
| 27 | |
| 28 | if (unlikely(display == NULL)) |
Ralf Baechle | f197465 | 2007-04-26 15:46:24 +0100 | [diff] [blame] | 29 | display = ioremap(ASCII_DISPLAY_POS_BASE, 16*sizeof(int)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 30 | |
Steven J. Hill | 49bffbd | 2013-03-25 15:05:40 -0500 | [diff] [blame] | 31 | for (i = 0; i <= 14; i += 2) { |
| 32 | if (*str) |
| 33 | __raw_writel(*str++, display + i); |
| 34 | else |
| 35 | __raw_writel(' ', display + i); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 36 | } |
| 37 | } |
Ralf Baechle | 79894c7 | 2007-05-16 17:54:08 +0200 | [diff] [blame] | 38 | |
| 39 | static void scroll_display_message(unsigned long data); |
| 40 | static DEFINE_TIMER(mips_scroll_timer, scroll_display_message, HZ, 0); |
| 41 | |
| 42 | static 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 | |
| 51 | void 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 | } |