]>
Commit | Line | Data |
---|---|---|
1eac2a71 SR |
1 | /* |
2 | * (C) Copyright 2001 | |
3 | * Josh Huber <huber@mclx.com>, Mission Critical Linux, Inc. | |
4 | * | |
5 | * modified for marvell db64360 eval board by | |
6 | * Ingo Assmus <ingo.assmus@keymile.com> | |
7 | * | |
8 | * modified for cpci750 board by | |
9 | * Reinhard Arlt <reinhard.arlt@esd-electronics.com> | |
10 | * | |
1a459660 | 11 | * SPDX-License-Identifier: GPL-2.0+ |
1eac2a71 SR |
12 | */ |
13 | ||
14 | /* | |
15 | * serial.c - serial support for esd cpci750 board | |
16 | */ | |
17 | ||
18 | /* supports the MPSC */ | |
19 | ||
20 | #include <common.h> | |
21 | #include <command.h> | |
088a4f3c MV |
22 | #include <serial.h> |
23 | #include <linux/compiler.h> | |
24 | ||
1eac2a71 SR |
25 | #include "../../Marvell/include/memory.h" |
26 | #include "serial.h" | |
27 | ||
28 | #include "mpsc.h" | |
29 | ||
30 | DECLARE_GLOBAL_DATA_PTR; | |
31 | ||
088a4f3c | 32 | static int p3mx_serial_init(void) |
1eac2a71 SR |
33 | { |
34 | mpsc_init (gd->baudrate); | |
35 | ||
36 | return (0); | |
37 | } | |
38 | ||
088a4f3c | 39 | static void p3mx_serial_putc(const char c) |
1eac2a71 SR |
40 | { |
41 | if (c == '\n') | |
42 | mpsc_putchar ('\r'); | |
43 | ||
44 | mpsc_putchar (c); | |
45 | } | |
46 | ||
088a4f3c | 47 | static int p3mx_serial_getc(void) |
1eac2a71 SR |
48 | { |
49 | return mpsc_getchar (); | |
50 | } | |
51 | ||
088a4f3c | 52 | static int p3mx_serial_tstc(void) |
1eac2a71 SR |
53 | { |
54 | return mpsc_test_char (); | |
55 | } | |
56 | ||
088a4f3c | 57 | static void p3mx_serial_setbrg(void) |
1eac2a71 SR |
58 | { |
59 | galbrg_set_baudrate (CONFIG_MPSC_PORT, gd->baudrate); | |
60 | } | |
61 | ||
088a4f3c MV |
62 | static struct serial_device p3mx_serial_drv = { |
63 | .name = "p3mx_serial", | |
64 | .start = p3mx_serial_init, | |
65 | .stop = NULL, | |
66 | .setbrg = p3mx_serial_setbrg, | |
67 | .putc = p3mx_serial_putc, | |
ec3fd689 | 68 | .puts = default_serial_puts, |
088a4f3c MV |
69 | .getc = p3mx_serial_getc, |
70 | .tstc = p3mx_serial_tstc, | |
71 | }; | |
72 | ||
73 | void p3mx_serial_initialize(void) | |
74 | { | |
75 | serial_register(&p3mx_serial_drv); | |
76 | } | |
77 | ||
78 | __weak struct serial_device *default_serial_console(void) | |
79 | { | |
80 | return &p3mx_serial_drv; | |
81 | } | |
088a4f3c | 82 | |
3fe00109 | 83 | #if defined(CONFIG_CMD_KGDB) |
1eac2a71 SR |
84 | void kgdb_serial_init (void) |
85 | { | |
86 | } | |
87 | ||
88 | void putDebugChar (int c) | |
89 | { | |
90 | serial_putc (c); | |
91 | } | |
92 | ||
93 | void putDebugStr (const char *str) | |
94 | { | |
95 | serial_puts (str); | |
96 | } | |
97 | ||
98 | int getDebugChar (void) | |
99 | { | |
100 | return serial_getc (); | |
101 | } | |
102 | ||
103 | void kgdb_interruptible (int yes) | |
104 | { | |
105 | return; | |
106 | } | |
3fe00109 | 107 | #endif |