blob: 89040a899e137816d81211bb40abfbccc0d55025 [file] [log] [blame]
Stefan Roese1eac2a72006-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 Denk1a459662013-07-08 09:37:19 +020011 * SPDX-License-Identifier: GPL-2.0+
Stefan Roese1eac2a72006-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 Vasut088a4f32012-09-13 12:35:54 +020022#include <serial.h>
23#include <linux/compiler.h>
24
Stefan Roese1eac2a72006-11-29 15:42:37 +010025#include "../../Marvell/include/memory.h"
26#include "serial.h"
27
28#include "mpsc.h"
29
30DECLARE_GLOBAL_DATA_PTR;
31
Marek Vasut088a4f32012-09-13 12:35:54 +020032static int p3mx_serial_init(void)
Stefan Roese1eac2a72006-11-29 15:42:37 +010033{
34 mpsc_init (gd->baudrate);
35
36 return (0);
37}
38
Marek Vasut088a4f32012-09-13 12:35:54 +020039static void p3mx_serial_putc(const char c)
Stefan Roese1eac2a72006-11-29 15:42:37 +010040{
41 if (c == '\n')
42 mpsc_putchar ('\r');
43
44 mpsc_putchar (c);
45}
46
Marek Vasut088a4f32012-09-13 12:35:54 +020047static int p3mx_serial_getc(void)
Stefan Roese1eac2a72006-11-29 15:42:37 +010048{
49 return mpsc_getchar ();
50}
51
Marek Vasut088a4f32012-09-13 12:35:54 +020052static int p3mx_serial_tstc(void)
Stefan Roese1eac2a72006-11-29 15:42:37 +010053{
54 return mpsc_test_char ();
55}
56
Marek Vasut088a4f32012-09-13 12:35:54 +020057static void p3mx_serial_setbrg(void)
Stefan Roese1eac2a72006-11-29 15:42:37 +010058{
59 galbrg_set_baudrate (CONFIG_MPSC_PORT, gd->baudrate);
60}
61
Marek Vasut088a4f32012-09-13 12:35:54 +020062static 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,
Marek Vasutec3fd682012-10-06 14:07:02 +000068 .puts = default_serial_puts,
Marek Vasut088a4f32012-09-13 12:35:54 +020069 .getc = p3mx_serial_getc,
70 .tstc = p3mx_serial_tstc,
71};
72
73void 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}
Marek Vasut088a4f32012-09-13 12:35:54 +020082
Jon Loeliger3fe00102007-07-09 18:38:39 -050083#if defined(CONFIG_CMD_KGDB)
Stefan Roese1eac2a72006-11-29 15:42:37 +010084void kgdb_serial_init (void)
85{
86}
87
88void putDebugChar (int c)
89{
90 serial_putc (c);
91}
92
93void putDebugStr (const char *str)
94{
95 serial_puts (str);
96}
97
98int getDebugChar (void)
99{
100 return serial_getc ();
101}
102
103void kgdb_interruptible (int yes)
104{
105 return;
106}
Jon Loeliger3fe00102007-07-09 18:38:39 -0500107#endif