blob: 9b9800ad9aadee5a3bd5ebb9d0caab9b76334513 [file] [log] [blame]
Andreas Bießmann5e1f6c82011-06-12 01:49:13 +00001/*
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
Stelian Pop5ee0c7f2011-11-01 00:00:39 +01008 * Stelian Pop <stelian@popies.net>
Andreas Bießmann5e1f6c82011-06-12 01:49:13 +00009 * Lead Tech Design <www.leadtechdesign.com>
10 *
Wolfgang Denkd79de1d2013-07-08 09:37:19 +020011 * SPDX-License-Identifier: GPL-2.0+
Andreas Bießmann5e1f6c82011-06-12 01:49:13 +000012 */
13
14#include <common.h>
15#include <asm/io.h>
16#include <asm/arch/at91_common.h>
Wenyou Yang57b7f292016-02-03 10:16:49 +080017#include <asm/arch/clk.h>
Andreas Bießmann5e1f6c82011-06-12 01:49:13 +000018#include <asm/arch/gpio.h>
19
20/*
21 * if CONFIG_AT91_GPIO_PULLUP ist set, keep pullups on on all
22 * peripheral pins. Good to have if hardware is soldered optionally
23 * or in case of SPI no slave is selected. Avoid lines to float
24 * needlessly. Use a short local PUP define.
25 *
26 * Due to errata "TXD floats when CTS is inactive" pullups are always
27 * on for TXD pins.
28 */
29#ifdef CONFIG_AT91_GPIO_PULLUP
30# define PUP CONFIG_AT91_GPIO_PULLUP
31#else
32# define PUP 0
33#endif
34
35void at91_serial0_hw_init(void)
36{
Andreas Bießmann5e1f6c82011-06-12 01:49:13 +000037 at91_set_a_periph(AT91_PIO_PORTA, 17, 1); /* TXD0 */
38 at91_set_a_periph(AT91_PIO_PORTA, 18, PUP); /* RXD0 */
Wenyou Yang57b7f292016-02-03 10:16:49 +080039 at91_periph_clk_enable(ATMEL_ID_USART0);
Andreas Bießmann5e1f6c82011-06-12 01:49:13 +000040}
41
42void at91_serial1_hw_init(void)
43{
Andreas Bießmann5e1f6c82011-06-12 01:49:13 +000044 at91_set_a_periph(AT91_PIO_PORTB, 20, PUP); /* RXD1 */
45 at91_set_a_periph(AT91_PIO_PORTB, 21, 1); /* TXD1 */
Wenyou Yang57b7f292016-02-03 10:16:49 +080046 at91_periph_clk_enable(ATMEL_ID_USART1);
Andreas Bießmann5e1f6c82011-06-12 01:49:13 +000047}
48
49void at91_serial2_hw_init(void)
50{
Andreas Bießmann5e1f6c82011-06-12 01:49:13 +000051 at91_set_a_periph(AT91_PIO_PORTA, 22, PUP); /* RXD2 */
52 at91_set_a_periph(AT91_PIO_PORTA, 23, 1); /* TXD2 */
Wenyou Yang57b7f292016-02-03 10:16:49 +080053 at91_periph_clk_enable(ATMEL_ID_USART2);
Andreas Bießmann5e1f6c82011-06-12 01:49:13 +000054}
55
Andreas Bießmann5e1f6c82011-06-12 01:49:13 +000056void at91_seriald_hw_init(void)
57{
58 at91_set_a_periph(AT91_PIO_PORTA, 30, PUP); /* DRXD */
59 at91_set_a_periph(AT91_PIO_PORTA, 31, 1); /* DTXD */
60 /* writing SYS to PCER has no effect on AT91RM9200 */
61}