max310x.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * Maxim (Dallas) MAX3107/8 serial driver
  3. *
  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. #ifndef _MAX310X_H_
  16. #define _MAX310X_H_
  17. /*
  18. * Example board initialization data:
  19. *
  20. * static struct max310x_pdata max3107_pdata = {
  21. * .driver_flags = MAX310X_EXT_CLK,
  22. * .uart_flags[0] = MAX310X_ECHO_SUPRESS | MAX310X_AUTO_DIR_CTRL,
  23. * .frequency = 3686400,
  24. * .gpio_base = -1,
  25. * };
  26. *
  27. * static struct spi_board_info spi_device_max3107[] = {
  28. * {
  29. * .modalias = "max3107",
  30. * .irq = IRQ_EINT3,
  31. * .bus_num = 1,
  32. * .chip_select = 1,
  33. * .platform_data = &max3107_pdata,
  34. * },
  35. * };
  36. */
  37. #define MAX310X_MAX_UARTS 1
  38. /* MAX310X platform data structure */
  39. struct max310x_pdata {
  40. /* Flags global to driver */
  41. const u8 driver_flags:2;
  42. #define MAX310X_EXT_CLK (0x00000001) /* External clock enable */
  43. #define MAX310X_AUTOSLEEP (0x00000002) /* Enable AutoSleep mode */
  44. /* Flags global to UART port */
  45. const u8 uart_flags[MAX310X_MAX_UARTS];
  46. #define MAX310X_LOOPBACK (0x00000001) /* Loopback mode enable */
  47. #define MAX310X_ECHO_SUPRESS (0x00000002) /* Enable echo supress */
  48. #define MAX310X_AUTO_DIR_CTRL (0x00000004) /* Enable Auto direction
  49. * control (RS-485)
  50. */
  51. /* Frequency (extrenal clock or crystal) */
  52. const int frequency;
  53. /* GPIO base number (can be negative) */
  54. const int gpio_base;
  55. /* Called during startup */
  56. void (*init)(void);
  57. /* Called before finish */
  58. void (*exit)(void);
  59. /* Suspend callback */
  60. void (*suspend)(int do_suspend);
  61. };
  62. #endif