sccnxp.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*
  2. * NXP (Philips) SCC+++(SCN+++) serial driver
  3. *
  4. * Copyright (C) 2012 Alexander Shiyan <shc_work@mail.ru>
  5. *
  6. * Based on sc26xx.c, by Thomas Bogendörfer (tsbogend@alpha.franken.de)
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. */
  13. #ifndef __SCCNXP_H
  14. #define __SCCNXP_H
  15. #define SCCNXP_MAX_UARTS 2
  16. /* Output lines */
  17. #define LINE_OP0 1
  18. #define LINE_OP1 2
  19. #define LINE_OP2 3
  20. #define LINE_OP3 4
  21. #define LINE_OP4 5
  22. #define LINE_OP5 6
  23. #define LINE_OP6 7
  24. #define LINE_OP7 8
  25. /* Input lines */
  26. #define LINE_IP0 9
  27. #define LINE_IP1 10
  28. #define LINE_IP2 11
  29. #define LINE_IP3 12
  30. #define LINE_IP4 13
  31. #define LINE_IP5 14
  32. #define LINE_IP6 15
  33. /* Signals */
  34. #define DTR_OP 0 /* DTR */
  35. #define RTS_OP 4 /* RTS */
  36. #define DSR_IP 8 /* DSR */
  37. #define CTS_IP 12 /* CTS */
  38. #define DCD_IP 16 /* DCD */
  39. #define RNG_IP 20 /* RNG */
  40. #define DIR_OP 24 /* Special signal for control RS-485.
  41. * Goes high when transmit,
  42. * then goes low.
  43. */
  44. /* Routing control signal 'sig' to line 'line' */
  45. #define MCTRL_SIG(sig, line) ((line) << (sig))
  46. /*
  47. * Example board initialization data:
  48. *
  49. * static struct resource sc2892_resources[] = {
  50. * DEFINE_RES_MEM(UART_PHYS_START, 0x10),
  51. * DEFINE_RES_IRQ(IRQ_EXT2),
  52. * };
  53. *
  54. * static struct sccnxp_pdata sc2892_info = {
  55. * .frequency = 3686400,
  56. * .mctrl_cfg[0] = MCTRL_SIG(DIR_OP, LINE_OP0),
  57. * .mctrl_cfg[1] = MCTRL_SIG(DIR_OP, LINE_OP1),
  58. * };
  59. *
  60. * static struct platform_device sc2892 = {
  61. * .name = "sc2892",
  62. * .id = -1,
  63. * .resource = sc2892_resources,
  64. * .num_resources = ARRAY_SIZE(sc2892_resources),
  65. * .dev = {
  66. * .platform_data = &sc2892_info,
  67. * },
  68. * };
  69. */
  70. /* SCCNXP platform data structure */
  71. struct sccnxp_pdata {
  72. /* Frequency (extrenal clock or crystal) */
  73. int frequency;
  74. /* Shift for A0 line */
  75. const u8 reg_shift;
  76. /* Modem control lines configuration */
  77. const u32 mctrl_cfg[SCCNXP_MAX_UARTS];
  78. /* Called during startup */
  79. void (*init)(void);
  80. /* Called before finish */
  81. void (*exit)(void);
  82. };
  83. #endif