at91rm9200_devices.c 1.6 KB

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