101-rt288x_serial_driver_hack.patch 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. --- a/drivers/tty/serial/8250/Kconfig
  2. +++ b/drivers/tty/serial/8250/Kconfig
  3. @@ -258,6 +258,14 @@ config SERIAL_8250_ACORN
  4. system, say Y to this option. The driver can handle 1, 2, or 3 port
  5. cards. If unsure, say N.
  6. +config SERIAL_8250_RT288X
  7. + bool "Ralink RT288x/RT305x/RT3662/RT3883 serial port support"
  8. + depends on SERIAL_8250 != n && (SOC_RT288X || SOC_RT305X || SOC_RT3883)
  9. + help
  10. + If you have a Ralink RT288x/RT305x SoC based board and want to use the
  11. + serial port, say Y to this option. The driver can handle up to 2 serial
  12. + ports. If unsure, say N.
  13. +
  14. config SERIAL_8250_RM9K
  15. bool "Support for MIPS RM9xxx integrated serial port"
  16. depends on SERIAL_8250 != n && SERIAL_RM9000
  17. --- a/include/linux/serial_core.h
  18. +++ b/include/linux/serial_core.h
  19. @@ -321,7 +321,7 @@ struct uart_port {
  20. #define UPIO_HUB6 (1)
  21. #define UPIO_MEM (2)
  22. #define UPIO_MEM32 (3)
  23. -#define UPIO_AU (4) /* Au1x00 type IO */
  24. +#define UPIO_AU (4) /* Au1x00 and RT288x type IO */
  25. #define UPIO_TSI (5) /* Tsi108/109 type IO */
  26. #define UPIO_RM9000 (6) /* RM9000 type IO */
  27. --- a/drivers/tty/serial/8250/8250.c
  28. +++ b/drivers/tty/serial/8250/8250.c
  29. @@ -292,9 +292,9 @@ static const struct serial8250_config ua
  30. },
  31. };
  32. -#if defined(CONFIG_MIPS_ALCHEMY)
  33. +#if defined(CONFIG_MIPS_ALCHEMY) || defined (CONFIG_SERIAL_8250_RT288X)
  34. -/* Au1x00 UART hardware has a weird register layout */
  35. +/* Au1x00 and RT288x UART hardware has a weird register layout */
  36. static const u8 au_io_in_map[] = {
  37. [UART_RX] = 0,
  38. [UART_IER] = 2,
  39. @@ -516,8 +516,8 @@ static inline void _serial_dl_write(stru
  40. serial_outp(up, UART_DLM, value >> 8 & 0xff);
  41. }
  42. -#if defined(CONFIG_MIPS_ALCHEMY)
  43. -/* Au1x00 haven't got a standard divisor latch */
  44. +#if defined(CONFIG_MIPS_ALCHEMY) || defined (CONFIG_SERIAL_8250_RT288X)
  45. +/* Au1x00 and RT288x haven't got a standard divisor latch */
  46. static int serial_dl_read(struct uart_8250_port *up)
  47. {
  48. if (up->port.iotype == UPIO_AU)
  49. @@ -724,22 +724,19 @@ static int size_fifo(struct uart_8250_po
  50. */
  51. static unsigned int autoconfig_read_divisor_id(struct uart_8250_port *p)
  52. {
  53. - unsigned char old_dll, old_dlm, old_lcr;
  54. + unsigned char old_lcr;
  55. + unsigned int old_dl;
  56. unsigned int id;
  57. old_lcr = serial_inp(p, UART_LCR);
  58. serial_outp(p, UART_LCR, UART_LCR_CONF_MODE_A);
  59. - old_dll = serial_inp(p, UART_DLL);
  60. - old_dlm = serial_inp(p, UART_DLM);
  61. + old_dl = serial_dl_read(p);
  62. - serial_outp(p, UART_DLL, 0);
  63. - serial_outp(p, UART_DLM, 0);
  64. + serial_dl_write(p, 0);
  65. + id = serial_dl_read(p);
  66. - id = serial_inp(p, UART_DLL) | serial_inp(p, UART_DLM) << 8;
  67. -
  68. - serial_outp(p, UART_DLL, old_dll);
  69. - serial_outp(p, UART_DLM, old_dlm);
  70. + serial_dl_write(p, old_dl);
  71. serial_outp(p, UART_LCR, old_lcr);
  72. return id;
  73. @@ -865,7 +862,7 @@ static int broken_efr(struct uart_8250_p
  74. /*
  75. * Exar ST16C2550 "A2" devices incorrectly detect as
  76. * having an EFR, and report an ID of 0x0201. See
  77. - * http://linux.derkeiler.com/Mailing-Lists/Kernel/2004-11/4812.html
  78. + * http://linux.derkeiler.com/Mailing-Lists/Kernel/2004-11/4812.html
  79. */
  80. if (autoconfig_read_divisor_id(up) == 0x0201 && size_fifo(up) == 16)
  81. return 1;