at91rm9200_devices.c 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. * [partely copied from arch/arm/cpu/arm926ejs/at91/arm9260_devices.c]
  3. *
  4. * (C) Copyright 2011
  5. * Andreas Bießmann <andreas.devel@googlemail.com>
  6. *
  7. * (C) Copyright 2007-2008
  8. * Stelian Pop <stelian.pop@leadtechdesign.com>
  9. * Lead Tech Design <www.leadtechdesign.com>
  10. *
  11. * See file CREDITS for list of people who contributed to this
  12. * project.
  13. *
  14. * This program is free software; you can redistribute it and/or
  15. * modify it under the terms of the GNU General Public License as
  16. * published by the Free Software Foundation; either version 2 of
  17. * the License, or (at your option) any later version.
  18. *
  19. * This program is distributed in the hope that it will be useful,
  20. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22. * GNU General Public License for more details.
  23. *
  24. * You should have received a copy of the GNU General Public License
  25. * along with this program; if not, write to the Free Software
  26. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  27. * MA 02111-1307 USA
  28. */
  29. #include <common.h>
  30. #include <asm/io.h>
  31. #include <asm/arch/at91_common.h>
  32. #include <asm/arch/at91_pmc.h>
  33. #include <asm/arch/gpio.h>
  34. /*
  35. * if CONFIG_AT91_GPIO_PULLUP ist set, keep pullups on on all
  36. * peripheral pins. Good to have if hardware is soldered optionally
  37. * or in case of SPI no slave is selected. Avoid lines to float
  38. * needlessly. Use a short local PUP define.
  39. *
  40. * Due to errata "TXD floats when CTS is inactive" pullups are always
  41. * on for TXD pins.
  42. */
  43. #ifdef CONFIG_AT91_GPIO_PULLUP
  44. # define PUP CONFIG_AT91_GPIO_PULLUP
  45. #else
  46. # define PUP 0
  47. #endif
  48. void at91_serial0_hw_init(void)
  49. {
  50. at91_pmc_t *pmc = (at91_pmc_t *)ATMEL_BASE_PMC;
  51. at91_set_a_periph(AT91_PIO_PORTA, 17, 1); /* TXD0 */
  52. at91_set_a_periph(AT91_PIO_PORTA, 18, PUP); /* RXD0 */
  53. writel(1 << ATMEL_ID_USART0, &pmc->pcer);
  54. }
  55. void at91_serial1_hw_init(void)
  56. {
  57. at91_pmc_t *pmc = (at91_pmc_t *)ATMEL_BASE_PMC;
  58. at91_set_a_periph(AT91_PIO_PORTB, 20, PUP); /* RXD1 */
  59. at91_set_a_periph(AT91_PIO_PORTB, 21, 1); /* TXD1 */
  60. writel(1 << ATMEL_ID_USART1, &pmc->pcer);
  61. }
  62. void at91_serial2_hw_init(void)
  63. {
  64. at91_pmc_t *pmc = (at91_pmc_t *)ATMEL_BASE_PMC;
  65. at91_set_a_periph(AT91_PIO_PORTA, 22, PUP); /* RXD2 */
  66. at91_set_a_periph(AT91_PIO_PORTA, 23, 1); /* TXD2 */
  67. writel(1 << ATMEL_ID_USART2, &pmc->pcer);
  68. }
  69. void at91_seriald_hw_init(void)
  70. {
  71. at91_set_a_periph(AT91_PIO_PORTA, 30, PUP); /* DRXD */
  72. at91_set_a_periph(AT91_PIO_PORTA, 31, 1); /* DTXD */
  73. /* writing SYS to PCER has no effect on AT91RM9200 */
  74. }