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 | * |
| 5 | * This program is free software; you can redistribute it and/or |
| 6 | * modify it under the terms of the GNU General Public License as |
| 7 | * published by the Free Software Foundation; either version 2 of |
| 8 | * the License, or (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 18 | * MA 02111-1307 USA |
| 19 | * |
| 20 | */ |
| 21 | |
| 22 | #ifndef ZOOM2_SERIAL_H |
| 23 | #define ZOOM2_SERIAL_H |
| 24 | |
Marek Vasut | 1b476f9 | 2012-09-23 17:41:25 +0200 | [diff] [blame] | 25 | #include <linux/stringify.h> |
| 26 | |
Tom Rix | 93bed9b | 2009-05-31 12:44:37 +0200 | [diff] [blame] | 27 | extern int zoom2_debug_board_connected (void); |
| 28 | |
| 29 | #define SERIAL_TL16CP754C_BASE 0x10000000 /* Zoom2 Serial chip address */ |
| 30 | |
| 31 | #define QUAD_BASE_0 SERIAL_TL16CP754C_BASE |
| 32 | #define QUAD_BASE_1 (SERIAL_TL16CP754C_BASE + 0x100) |
| 33 | #define QUAD_BASE_2 (SERIAL_TL16CP754C_BASE + 0x200) |
| 34 | #define QUAD_BASE_3 (SERIAL_TL16CP754C_BASE + 0x300) |
| 35 | |
Tom Rix | 93bed9b | 2009-05-31 12:44:37 +0200 | [diff] [blame] | 36 | #define QUAD_INIT(n) \ |
| 37 | int quad_init_##n(void) \ |
| 38 | { \ |
| 39 | return quad_init_dev(QUAD_BASE_##n); \ |
| 40 | } \ |
| 41 | void quad_setbrg_##n(void) \ |
| 42 | { \ |
| 43 | quad_setbrg_dev(QUAD_BASE_##n); \ |
| 44 | } \ |
| 45 | void quad_putc_##n(const char c) \ |
| 46 | { \ |
| 47 | quad_putc_dev(QUAD_BASE_##n, c); \ |
| 48 | } \ |
| 49 | void quad_puts_##n(const char *s) \ |
| 50 | { \ |
| 51 | quad_puts_dev(QUAD_BASE_##n, s); \ |
| 52 | } \ |
| 53 | int quad_getc_##n(void) \ |
| 54 | { \ |
| 55 | return quad_getc_dev(QUAD_BASE_##n); \ |
| 56 | } \ |
| 57 | int quad_tstc_##n(void) \ |
| 58 | { \ |
| 59 | return quad_tstc_dev(QUAD_BASE_##n); \ |
| 60 | } \ |
| 61 | struct serial_device zoom2_serial_device##n = \ |
| 62 | { \ |
Marek Vasut | 5bcdf24 | 2012-09-09 18:48:28 +0200 | [diff] [blame] | 63 | .name = __stringify(n), \ |
| 64 | .start = quad_init_##n, \ |
| 65 | .stop = NULL, \ |
| 66 | .setbrg = quad_setbrg_##n, \ |
| 67 | .getc = quad_getc_##n, \ |
| 68 | .tstc = quad_tstc_##n, \ |
| 69 | .putc = quad_putc_##n, \ |
| 70 | .puts = quad_puts_##n, \ |
Tom Rix | 93bed9b | 2009-05-31 12:44:37 +0200 | [diff] [blame] | 71 | }; |
| 72 | |
| 73 | #endif /* ZOOM2_SERIAL_H */ |