blob: f42510545c930fae736e471ffd57286c68dc45c4 [file] [log] [blame]
stroesec096c842004-12-16 18:21:17 +00001/*
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>
wdenk07d7e6b2004-12-16 21:44:03 +00007 *
stroesec096c842004-12-16 18:21:17 +00008 * 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+
stroesec096c842004-12-16 18:21:17 +000012 */
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 Vasut7aa03ef2012-09-13 12:32:56 +020022#include <serial.h>
23#include <linux/compiler.h>
24
stroesec096c842004-12-16 18:21:17 +000025#include "../../Marvell/include/memory.h"
26#include "serial.h"
27
stroesec096c842004-12-16 18:21:17 +000028#include "mpsc.h"
29
Wolfgang Denk6405a152006-03-31 18:32:53 +020030DECLARE_GLOBAL_DATA_PTR;
31
Marek Vasut7aa03ef2012-09-13 12:32:56 +020032static int cpci750_serial_init(void)
stroesec096c842004-12-16 18:21:17 +000033{
stroesec096c842004-12-16 18:21:17 +000034 mpsc_init (gd->baudrate);
35
36 return (0);
37}
38
Marek Vasut7aa03ef2012-09-13 12:32:56 +020039static void cpci750_serial_putc(const char c)
stroesec096c842004-12-16 18:21:17 +000040{
41 if (c == '\n')
42 mpsc_putchar ('\r');
43
44 mpsc_putchar (c);
45}
46
Marek Vasut7aa03ef2012-09-13 12:32:56 +020047static int cpci750_serial_getc(void)
stroesec096c842004-12-16 18:21:17 +000048{
49 return mpsc_getchar ();
50}
51
Marek Vasut7aa03ef2012-09-13 12:32:56 +020052static int cpci750_serial_tstc(void)
stroesec096c842004-12-16 18:21:17 +000053{
54 return mpsc_test_char ();
55}
56
Marek Vasut7aa03ef2012-09-13 12:32:56 +020057static void cpci750_serial_setbrg(void)
stroesec096c842004-12-16 18:21:17 +000058{
stroesec096c842004-12-16 18:21:17 +000059 galbrg_set_baudrate (CONFIG_MPSC_PORT, gd->baudrate);
60}
61
Marek Vasut7aa03ef2012-09-13 12:32:56 +020062static struct serial_device cpci750_serial_drv = {
63 .name = "cpci750_serial",
64 .start = cpci750_serial_init,
65 .stop = NULL,
66 .setbrg = cpci750_serial_setbrg,
67 .putc = cpci750_serial_putc,
Marek Vasutd9c64492012-10-06 14:07:02 +000068 .puts = default_serial_puts,
Marek Vasut7aa03ef2012-09-13 12:32:56 +020069 .getc = cpci750_serial_getc,
70 .tstc = cpci750_serial_tstc,
71};
72
73void cpci750_serial_initialize(void)
74{
75 serial_register(&cpci750_serial_drv);
76}
77
78__weak struct serial_device *default_serial_console(void)
79{
80 return &cpci750_serial_drv;
81}
Marek Vasut7aa03ef2012-09-13 12:32:56 +020082
Jon Loeliger4ed9ed62007-07-09 18:24:55 -050083#if defined(CONFIG_CMD_KGDB)
stroesec096c842004-12-16 18:21:17 +000084void 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 Loeliger13f75992007-07-10 10:39:10 -0500107#endif