Tom Rix | 93bed9b | 2009-05-31 12:44:37 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2009 Wind River Systems, Inc. |
| 3 | * Tom Rix <Tom.Rix@windriver.com> |
| 4 | * |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 5 | * SPDX-License-Identifier: GPL-2.0+ |
Tom Rix | 93bed9b | 2009-05-31 12:44:37 +0200 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #ifndef ZOOM2_SERIAL_H |
| 9 | #define ZOOM2_SERIAL_H |
| 10 | |
Marek Vasut | 1b476f9 | 2012-09-23 17:41:25 +0200 | [diff] [blame] | 11 | #include <linux/stringify.h> |
| 12 | |
Tom Rix | 93bed9b | 2009-05-31 12:44:37 +0200 | [diff] [blame] | 13 | extern int zoom2_debug_board_connected (void); |
| 14 | |
| 15 | #define SERIAL_TL16CP754C_BASE 0x10000000 /* Zoom2 Serial chip address */ |
| 16 | |
| 17 | #define QUAD_BASE_0 SERIAL_TL16CP754C_BASE |
| 18 | #define QUAD_BASE_1 (SERIAL_TL16CP754C_BASE + 0x100) |
| 19 | #define QUAD_BASE_2 (SERIAL_TL16CP754C_BASE + 0x200) |
| 20 | #define QUAD_BASE_3 (SERIAL_TL16CP754C_BASE + 0x300) |
| 21 | |
Tom Rix | 93bed9b | 2009-05-31 12:44:37 +0200 | [diff] [blame] | 22 | #define QUAD_INIT(n) \ |
| 23 | int quad_init_##n(void) \ |
| 24 | { \ |
| 25 | return quad_init_dev(QUAD_BASE_##n); \ |
| 26 | } \ |
| 27 | void quad_setbrg_##n(void) \ |
| 28 | { \ |
| 29 | quad_setbrg_dev(QUAD_BASE_##n); \ |
| 30 | } \ |
| 31 | void quad_putc_##n(const char c) \ |
| 32 | { \ |
| 33 | quad_putc_dev(QUAD_BASE_##n, c); \ |
| 34 | } \ |
| 35 | void quad_puts_##n(const char *s) \ |
| 36 | { \ |
| 37 | quad_puts_dev(QUAD_BASE_##n, s); \ |
| 38 | } \ |
| 39 | int quad_getc_##n(void) \ |
| 40 | { \ |
| 41 | return quad_getc_dev(QUAD_BASE_##n); \ |
| 42 | } \ |
| 43 | int quad_tstc_##n(void) \ |
| 44 | { \ |
| 45 | return quad_tstc_dev(QUAD_BASE_##n); \ |
| 46 | } \ |
| 47 | struct serial_device zoom2_serial_device##n = \ |
| 48 | { \ |
Marek Vasut | 5bcdf24 | 2012-09-09 18:48:28 +0200 | [diff] [blame] | 49 | .name = __stringify(n), \ |
| 50 | .start = quad_init_##n, \ |
| 51 | .stop = NULL, \ |
| 52 | .setbrg = quad_setbrg_##n, \ |
| 53 | .getc = quad_getc_##n, \ |
| 54 | .tstc = quad_tstc_##n, \ |
| 55 | .putc = quad_putc_##n, \ |
| 56 | .puts = quad_puts_##n, \ |
Tom Rix | 93bed9b | 2009-05-31 12:44:37 +0200 | [diff] [blame] | 57 | }; |
| 58 | |
| 59 | #endif /* ZOOM2_SERIAL_H */ |