Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Andreas Bießmann | 5e1f6c8 | 2011-06-12 01:49:13 +0000 | [diff] [blame] | 2 | /* |
| 3 | * [partely copied from arch/arm/cpu/arm926ejs/at91/arm9260_devices.c] |
| 4 | * |
| 5 | * (C) Copyright 2011 |
Andreas Bießmann | 07dafdb | 2016-05-01 03:46:16 +0200 | [diff] [blame] | 6 | * Andreas Bießmann <andreas@biessmann.org> |
Andreas Bießmann | 5e1f6c8 | 2011-06-12 01:49:13 +0000 | [diff] [blame] | 7 | * |
| 8 | * (C) Copyright 2007-2008 |
Stelian Pop | 5ee0c7f | 2011-11-01 00:00:39 +0100 | [diff] [blame] | 9 | * Stelian Pop <stelian@popies.net> |
Andreas Bießmann | 5e1f6c8 | 2011-06-12 01:49:13 +0000 | [diff] [blame] | 10 | * Lead Tech Design <www.leadtechdesign.com> |
Andreas Bießmann | 5e1f6c8 | 2011-06-12 01:49:13 +0000 | [diff] [blame] | 11 | */ |
| 12 | |
Andreas Bießmann | 5e1f6c8 | 2011-06-12 01:49:13 +0000 | [diff] [blame] | 13 | #include <asm/io.h> |
| 14 | #include <asm/arch/at91_common.h> |
Wenyou Yang | 57b7f29 | 2016-02-03 10:16:49 +0800 | [diff] [blame] | 15 | #include <asm/arch/clk.h> |
Andreas Bießmann | 5e1f6c8 | 2011-06-12 01:49:13 +0000 | [diff] [blame] | 16 | #include <asm/arch/gpio.h> |
| 17 | |
| 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 | |
| 33 | void at91_serial0_hw_init(void) |
| 34 | { |
Andreas Bießmann | 5e1f6c8 | 2011-06-12 01:49:13 +0000 | [diff] [blame] | 35 | at91_set_a_periph(AT91_PIO_PORTA, 17, 1); /* TXD0 */ |
| 36 | at91_set_a_periph(AT91_PIO_PORTA, 18, PUP); /* RXD0 */ |
Wenyou Yang | 57b7f29 | 2016-02-03 10:16:49 +0800 | [diff] [blame] | 37 | at91_periph_clk_enable(ATMEL_ID_USART0); |
Andreas Bießmann | 5e1f6c8 | 2011-06-12 01:49:13 +0000 | [diff] [blame] | 38 | } |
| 39 | |
| 40 | void at91_serial1_hw_init(void) |
| 41 | { |
Andreas Bießmann | 5e1f6c8 | 2011-06-12 01:49:13 +0000 | [diff] [blame] | 42 | at91_set_a_periph(AT91_PIO_PORTB, 20, PUP); /* RXD1 */ |
| 43 | at91_set_a_periph(AT91_PIO_PORTB, 21, 1); /* TXD1 */ |
Wenyou Yang | 57b7f29 | 2016-02-03 10:16:49 +0800 | [diff] [blame] | 44 | at91_periph_clk_enable(ATMEL_ID_USART1); |
Andreas Bießmann | 5e1f6c8 | 2011-06-12 01:49:13 +0000 | [diff] [blame] | 45 | } |
| 46 | |
| 47 | void at91_serial2_hw_init(void) |
| 48 | { |
Andreas Bießmann | 5e1f6c8 | 2011-06-12 01:49:13 +0000 | [diff] [blame] | 49 | at91_set_a_periph(AT91_PIO_PORTA, 22, PUP); /* RXD2 */ |
| 50 | at91_set_a_periph(AT91_PIO_PORTA, 23, 1); /* TXD2 */ |
Wenyou Yang | 57b7f29 | 2016-02-03 10:16:49 +0800 | [diff] [blame] | 51 | at91_periph_clk_enable(ATMEL_ID_USART2); |
Andreas Bießmann | 5e1f6c8 | 2011-06-12 01:49:13 +0000 | [diff] [blame] | 52 | } |
| 53 | |
Andreas Bießmann | 5e1f6c8 | 2011-06-12 01:49:13 +0000 | [diff] [blame] | 54 | void at91_seriald_hw_init(void) |
| 55 | { |
| 56 | at91_set_a_periph(AT91_PIO_PORTA, 30, PUP); /* DRXD */ |
| 57 | at91_set_a_periph(AT91_PIO_PORTA, 31, 1); /* DTXD */ |
| 58 | /* writing SYS to PCER has no effect on AT91RM9200 */ |
| 59 | } |