serial.c 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * linux/arch/arm/mach-pnx4008/serial.c
  3. *
  4. * PNX4008 UART initialization
  5. *
  6. * Copyright: MontaVista Software Inc. (c) 2005
  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 version 2 as
  10. * published by the Free Software Foundation.
  11. */
  12. #include <linux/kernel.h>
  13. #include <linux/types.h>
  14. #include <asm/io.h>
  15. #include <asm/arch/platform.h>
  16. #include <asm/hardware.h>
  17. #include <linux/serial_core.h>
  18. #include <linux/serial_reg.h>
  19. #include <asm/arch/gpio.h>
  20. #include <asm/arch/clock.h>
  21. #define UART_3 0
  22. #define UART_4 1
  23. #define UART_5 2
  24. #define UART_6 3
  25. #define UART_UNKNOWN (-1)
  26. #define UART3_BASE_VA IO_ADDRESS(PNX4008_UART3_BASE)
  27. #define UART4_BASE_VA IO_ADDRESS(PNX4008_UART4_BASE)
  28. #define UART5_BASE_VA IO_ADDRESS(PNX4008_UART5_BASE)
  29. #define UART6_BASE_VA IO_ADDRESS(PNX4008_UART6_BASE)
  30. #define UART_FCR_OFFSET 8
  31. #define UART_FIFO_SIZE 64
  32. void pnx4008_uart_init(void)
  33. {
  34. u32 tmp;
  35. int i = UART_FIFO_SIZE;
  36. __raw_writel(0xC1, UART5_BASE_VA + UART_FCR_OFFSET);
  37. __raw_writel(0xC1, UART3_BASE_VA + UART_FCR_OFFSET);
  38. /* Send a NULL to fix the UART HW bug */
  39. __raw_writel(0x00, UART5_BASE_VA);
  40. __raw_writel(0x00, UART3_BASE_VA);
  41. while (i--) {
  42. tmp = __raw_readl(UART5_BASE_VA);
  43. tmp = __raw_readl(UART3_BASE_VA);
  44. }
  45. __raw_writel(0, UART5_BASE_VA + UART_FCR_OFFSET);
  46. __raw_writel(0, UART3_BASE_VA + UART_FCR_OFFSET);
  47. /* setup wakeup interrupt */
  48. start_int_set_rising_edge(SE_U3_RX_INT);
  49. start_int_ack(SE_U3_RX_INT);
  50. start_int_umask(SE_U3_RX_INT);
  51. start_int_set_rising_edge(SE_U5_RX_INT);
  52. start_int_ack(SE_U5_RX_INT);
  53. start_int_umask(SE_U5_RX_INT);
  54. }