blob: 5b7b989860f9646d4f0bd8f52ebd48a121b3411f [file] [log] [blame]
Stefan Roese45993ea2006-11-29 15:42:37 +01001/*
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 *
Wolfgang Denkd79de1d2013-07-08 09:37:19 +020011 * SPDX-License-Identifier: GPL-2.0+
Stefan Roese45993ea2006-11-29 15:42:37 +010012 */
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>
Marek Vasut4dfb1d02012-09-13 12:35:54 +020022#include <serial.h>
23#include <linux/compiler.h>
24
Stefan Roese45993ea2006-11-29 15:42:37 +010025#include "../../Marvell/include/memory.h"
Stefan Roese45993ea2006-11-29 15:42:37 +010026
27#include "mpsc.h"
28
29DECLARE_GLOBAL_DATA_PTR;
30
Marek Vasut4dfb1d02012-09-13 12:35:54 +020031static int p3mx_serial_init(void)
Stefan Roese45993ea2006-11-29 15:42:37 +010032{
33 mpsc_init (gd->baudrate);
34
35 return (0);
36}
37
Marek Vasut4dfb1d02012-09-13 12:35:54 +020038static void p3mx_serial_putc(const char c)
Stefan Roese45993ea2006-11-29 15:42:37 +010039{
40 if (c == '\n')
41 mpsc_putchar ('\r');
42
43 mpsc_putchar (c);
44}
45
Marek Vasut4dfb1d02012-09-13 12:35:54 +020046static int p3mx_serial_getc(void)
Stefan Roese45993ea2006-11-29 15:42:37 +010047{
48 return mpsc_getchar ();
49}
50
Marek Vasut4dfb1d02012-09-13 12:35:54 +020051static int p3mx_serial_tstc(void)
Stefan Roese45993ea2006-11-29 15:42:37 +010052{
53 return mpsc_test_char ();
54}
55
Marek Vasut4dfb1d02012-09-13 12:35:54 +020056static void p3mx_serial_setbrg(void)
Stefan Roese45993ea2006-11-29 15:42:37 +010057{
58 galbrg_set_baudrate (CONFIG_MPSC_PORT, gd->baudrate);
59}
60
Marek Vasut4dfb1d02012-09-13 12:35:54 +020061static struct serial_device p3mx_serial_drv = {
62 .name = "p3mx_serial",
63 .start = p3mx_serial_init,
64 .stop = NULL,
65 .setbrg = p3mx_serial_setbrg,
66 .putc = p3mx_serial_putc,
Marek Vasutd9c64492012-10-06 14:07:02 +000067 .puts = default_serial_puts,
Marek Vasut4dfb1d02012-09-13 12:35:54 +020068 .getc = p3mx_serial_getc,
69 .tstc = p3mx_serial_tstc,
70};
71
72void p3mx_serial_initialize(void)
73{
74 serial_register(&p3mx_serial_drv);
75}
76
77__weak struct serial_device *default_serial_console(void)
78{
79 return &p3mx_serial_drv;
80}
Stefan Roese45993ea2006-11-29 15:42:37 +010081
Jon Loeliger145318c2007-07-09 18:38:39 -050082#if defined(CONFIG_CMD_KGDB)
Stefan Roese45993ea2006-11-29 15:42:37 +010083void kgdb_serial_init (void)
84{
85}
86
87void putDebugChar (int c)
88{
89 serial_putc (c);
90}
91
92void putDebugStr (const char *str)
93{
94 serial_puts (str);
95}
96
97int getDebugChar (void)
98{
99 return serial_getc ();
100}
101
102void kgdb_interruptible (int yes)
103{
104 return;
105}
Jon Loeliger145318c2007-07-09 18:38:39 -0500106#endif