at91rm9200_devices.c 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * [partely copied from arch/arm/cpu/arm926ejs/at91/arm9260_devices.c]
  3. *
  4. * (C) Copyright 2011
  5. * Andreas Bießmann <andreas@biessmann.org>
  6. *
  7. * (C) Copyright 2007-2008
  8. * Stelian Pop <stelian@popies.net>
  9. * Lead Tech Design <www.leadtechdesign.com>
  10. *
  11. * SPDX-License-Identifier: GPL-2.0+
  12. */
  13. #include <common.h>
  14. #include <asm/io.h>
  15. #include <asm/arch/at91_common.h>
  16. #include <asm/arch/clk.h>
  17. #include <asm/arch/gpio.h>
  18. /*
  19. * if CONFIG_AT91_GPIO_PULLUP ist set, keep pullups on on all
  20. * peripheral pins. Good to have if hardware is soldered optionally
  21. * or in case of SPI no slave is selected. Avoid lines to float
  22. * needlessly. Use a short local PUP define.
  23. *
  24. * Due to errata "TXD floats when CTS is inactive" pullups are always
  25. * on for TXD pins.
  26. */
  27. #ifdef CONFIG_AT91_GPIO_PULLUP
  28. # define PUP CONFIG_AT91_GPIO_PULLUP
  29. #else
  30. # define PUP 0
  31. #endif
  32. void at91_serial0_hw_init(void)
  33. {
  34. at91_set_a_periph(AT91_PIO_PORTA, 17, 1); /* TXD0 */
  35. at91_set_a_periph(AT91_PIO_PORTA, 18, PUP); /* RXD0 */
  36. at91_periph_clk_enable(ATMEL_ID_USART0);
  37. }
  38. void at91_serial1_hw_init(void)
  39. {
  40. at91_set_a_periph(AT91_PIO_PORTB, 20, PUP); /* RXD1 */
  41. at91_set_a_periph(AT91_PIO_PORTB, 21, 1); /* TXD1 */
  42. at91_periph_clk_enable(ATMEL_ID_USART1);
  43. }
  44. void at91_serial2_hw_init(void)
  45. {
  46. at91_set_a_periph(AT91_PIO_PORTA, 22, PUP); /* RXD2 */
  47. at91_set_a_periph(AT91_PIO_PORTA, 23, 1); /* TXD2 */
  48. at91_periph_clk_enable(ATMEL_ID_USART2);
  49. }
  50. void at91_seriald_hw_init(void)
  51. {
  52. at91_set_a_periph(AT91_PIO_PORTA, 30, PUP); /* DRXD */
  53. at91_set_a_periph(AT91_PIO_PORTA, 31, 1); /* DTXD */
  54. /* writing SYS to PCER has no effect on AT91RM9200 */
  55. }