blob: dd11dcd1a1845ae8572d9ecb9babfd5b5ef6956a [file] [log] [blame]
Alexander Shiyanf6544412012-08-06 19:42:32 +04001/*
Alexander Shiyan003236d2013-06-29 10:44:19 +04002 * Maxim (Dallas) MAX3107/8/9, MAX14830 serial driver
Alexander Shiyanf6544412012-08-06 19:42:32 +04003 *
4 * Copyright (C) 2012 Alexander Shiyan <shc_work@mail.ru>
5 *
6 * Based on max3100.c, by Christian Pellegrin <chripell@evolware.org>
7 * Based on max3110.c, by Feng Tang <feng.tang@intel.com>
8 * Based on max3107.c, by Aavamobile
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 */
15
16#ifndef _MAX310X_H_
17#define _MAX310X_H_
18
19/*
20 * Example board initialization data:
21 *
22 * static struct max310x_pdata max3107_pdata = {
23 * .driver_flags = MAX310X_EXT_CLK,
24 * .uart_flags[0] = MAX310X_ECHO_SUPRESS | MAX310X_AUTO_DIR_CTRL,
25 * .frequency = 3686400,
26 * .gpio_base = -1,
27 * };
28 *
29 * static struct spi_board_info spi_device_max3107[] = {
30 * {
31 * .modalias = "max3107",
32 * .irq = IRQ_EINT3,
33 * .bus_num = 1,
34 * .chip_select = 1,
35 * .platform_data = &max3107_pdata,
36 * },
37 * };
38 */
39
Alexander Shiyan003236d2013-06-29 10:44:19 +040040#define MAX310X_MAX_UARTS 4
Alexander Shiyanf6544412012-08-06 19:42:32 +040041
42/* MAX310X platform data structure */
43struct max310x_pdata {
44 /* Flags global to driver */
Alexander Shiyan10d8b342013-06-29 10:44:17 +040045 const u8 driver_flags;
Alexander Shiyanf6544412012-08-06 19:42:32 +040046#define MAX310X_EXT_CLK (0x00000001) /* External clock enable */
Alexander Shiyanf6544412012-08-06 19:42:32 +040047 /* Flags global to UART port */
48 const u8 uart_flags[MAX310X_MAX_UARTS];
49#define MAX310X_LOOPBACK (0x00000001) /* Loopback mode enable */
50#define MAX310X_ECHO_SUPRESS (0x00000002) /* Enable echo supress */
51#define MAX310X_AUTO_DIR_CTRL (0x00000004) /* Enable Auto direction
52 * control (RS-485)
53 */
54 /* Frequency (extrenal clock or crystal) */
55 const int frequency;
56 /* GPIO base number (can be negative) */
57 const int gpio_base;
58 /* Called during startup */
59 void (*init)(void);
60 /* Called before finish */
61 void (*exit)(void);
Alexander Shiyanf6544412012-08-06 19:42:32 +040062};
63
64#endif