101-rt288x_serial_driver_hack.patch 3.1 KB

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