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@popies.net> 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 30#include <common.h> 31#include <asm/io.h> 32#include <asm/arch/at91_common.h> 33#include <asm/arch/at91_pmc.h> 34#include <asm/arch/gpio.h> 35 36/* 37 * if CONFIG_AT91_GPIO_PULLUP ist set, keep pullups on on all 38 * peripheral pins. Good to have if hardware is soldered optionally 39 * or in case of SPI no slave is selected. Avoid lines to float 40 * needlessly. Use a short local PUP define. 41 * 42 * Due to errata "TXD floats when CTS is inactive" pullups are always 43 * on for TXD pins. 44 */ 45#ifdef CONFIG_AT91_GPIO_PULLUP 46# define PUP CONFIG_AT91_GPIO_PULLUP 47#else 48# define PUP 0 49#endif 50 51void at91_serial0_hw_init(void) 52{ 53 at91_pmc_t *pmc = (at91_pmc_t *)ATMEL_BASE_PMC; 54 55 at91_set_a_periph(AT91_PIO_PORTA, 17, 1); /* TXD0 */ 56 at91_set_a_periph(AT91_PIO_PORTA, 18, PUP); /* RXD0 */ 57 writel(1 << ATMEL_ID_USART0, &pmc->pcer); 58} 59 60void at91_serial1_hw_init(void) 61{ 62 at91_pmc_t *pmc = (at91_pmc_t *)ATMEL_BASE_PMC; 63 64 at91_set_a_periph(AT91_PIO_PORTB, 20, PUP); /* RXD1 */ 65 at91_set_a_periph(AT91_PIO_PORTB, 21, 1); /* TXD1 */ 66 writel(1 << ATMEL_ID_USART1, &pmc->pcer); 67} 68 69void at91_serial2_hw_init(void) 70{ 71 at91_pmc_t *pmc = (at91_pmc_t *)ATMEL_BASE_PMC; 72 73 at91_set_a_periph(AT91_PIO_PORTA, 22, PUP); /* RXD2 */ 74 at91_set_a_periph(AT91_PIO_PORTA, 23, 1); /* TXD2 */ 75 writel(1 << ATMEL_ID_USART2, &pmc->pcer); 76} 77 78void at91_seriald_hw_init(void) 79{ 80 at91_set_a_periph(AT91_PIO_PORTA, 30, PUP); /* DRXD */ 81 at91_set_a_periph(AT91_PIO_PORTA, 31, 1); /* DTXD */ 82 /* writing SYS to PCER has no effect on AT91RM9200 */ 83} 84