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
6 * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved.
8 #include <linux/timer.h>
10 #include <asm/mips-boards/generic.h>
12 static unsigned int display_count
;
13 static unsigned int max_display_count
;
15 #define LCD_DISPLAY_POS_BASE 0x1f000400
16 #define DISPLAY_LCDINSTRUCTION (0*2)
17 #define DISPLAY_LCDDATA (1*2)
18 #define DISPLAY_CPLDSTATUS (2*2)
19 #define DISPLAY_CPLDDATA (3*2)
20 #define LCD_SETDDRAM 0x80
21 #define LCD_IR_BF 0x80
23 const char display_string
[] = " LINUX ON SEAD3 ";
25 static void scroll_display_message(unsigned long data
);
26 static DEFINE_TIMER(mips_scroll_timer
, scroll_display_message
, HZ
, 0);
28 static void lcd_wait(unsigned int __iomem
*display
)
30 /* Wait for CPLD state machine to become idle. */
31 do { } while (__raw_readl(display
+ DISPLAY_CPLDSTATUS
) & 1);
34 __raw_readl(display
+ DISPLAY_LCDINSTRUCTION
);
36 /* Wait for CPLD state machine to become idle. */
37 do { } while (__raw_readl(display
+ DISPLAY_CPLDSTATUS
) & 1);
38 } while (__raw_readl(display
+ DISPLAY_CPLDDATA
) & LCD_IR_BF
);
41 void mips_display_message(const char *str
)
43 static unsigned int __iomem
*display
;
47 if (unlikely(display
== NULL
))
48 display
= ioremap_nocache(LCD_DISPLAY_POS_BASE
,
51 for (i
= 0; i
< 16; i
++) {
57 __raw_writel((LCD_SETDDRAM
| i
),
58 (display
+ DISPLAY_LCDINSTRUCTION
));
60 __raw_writel(ch
, display
+ DISPLAY_LCDDATA
);
64 static void scroll_display_message(unsigned long data
)
66 mips_display_message(&display_string
[display_count
++]);
67 if (display_count
== max_display_count
)
69 mod_timer(&mips_scroll_timer
, jiffies
+ HZ
);
72 void mips_scroll_message(void)
74 del_timer_sync(&mips_scroll_timer
);
75 max_display_count
= strlen(display_string
) + 1 - 16;
76 mod_timer(&mips_scroll_timer
, jiffies
+ 1);