ARM: rockchip: fix broken build
[linux/fpc-iii.git] / arch / h8300 / kernel / sim-console.c
bloba15edf0565d9e69c3ada3de938e2ac549be5e782
1 /*
2 * arch/h8300/kernel/early_printk.c
4 * Copyright (C) 2009 Yoshinori Sato <ysato@users.sourceforge.jp>
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10 #include <linux/console.h>
11 #include <linux/tty.h>
12 #include <linux/init.h>
13 #include <linux/io.h>
14 #include <linux/platform_device.h>
16 static void sim_write(struct console *co, const char *ptr,
17 unsigned len)
19 register const int fd __asm__("er0") = 1; /* stdout */
20 register const char *_ptr __asm__("er1") = ptr;
21 register const unsigned _len __asm__("er2") = len;
23 __asm__(".byte 0x5e,0x00,0x00,0xc7\n\t" /* jsr @0xc7 (sys_write) */
24 : : "g"(fd), "g"(_ptr), "g"(_len));
27 static struct console sim_console = {
28 .name = "sim_console",
29 .write = sim_write,
30 .setup = NULL,
31 .flags = CON_PRINTBUFFER,
32 .index = -1,
35 static char sim_console_buf[32];
37 static int sim_probe(struct platform_device *pdev)
39 if (sim_console.data)
40 return -EEXIST;
42 if (!strstr(sim_console_buf, "keep"))
43 sim_console.flags |= CON_BOOT;
45 register_console(&sim_console);
46 return 0;
49 static int sim_remove(struct platform_device *pdev)
51 return 0;
54 static struct platform_driver sim_driver = {
55 .probe = sim_probe,
56 .remove = sim_remove,
57 .driver = {
58 .name = "h8300-sim",
59 .owner = THIS_MODULE,
63 early_platform_init_buffer("earlyprintk", &sim_driver,
64 sim_console_buf, ARRAY_SIZE(sim_console_buf));
66 static struct platform_device sim_console_device = {
67 .name = "h8300-sim",
68 .id = 0,
71 static struct platform_device *devices[] __initdata = {
72 &sim_console_device,
75 void __init sim_console_register(void)
77 early_platform_add_devices(devices,
78 ARRAY_SIZE(devices));