diff options
Diffstat (limited to 'cpu')
| -rw-r--r-- | cpu/arm920t/at91rm9200/Makefile | 2 | ||||
| -rw-r--r-- | cpu/arm920t/at91rm9200/interrupts.c | 27 | ||||
| -rw-r--r-- | cpu/arm920t/at91rm9200/serial.c | 113 | ||||
| -rw-r--r-- | cpu/arm920t/start.S | 4 | ||||
| -rw-r--r-- | cpu/arm926ejs/at91/.gitignore | 5 | ||||
| -rw-r--r-- | cpu/arm926ejs/at91/Makefile | 2 | ||||
| -rw-r--r-- | cpu/arm926ejs/at91/at91cap9_spi.c | 37 | ||||
| -rw-r--r-- | cpu/arm926ejs/at91/at91sam9260_spi.c | 36 | ||||
| -rw-r--r-- | cpu/arm926ejs/at91/at91sam9261_spi.c | 36 | ||||
| -rw-r--r-- | cpu/arm926ejs/at91/at91sam9263_spi.c | 36 | ||||
| -rw-r--r-- | cpu/arm926ejs/at91/at91sam9rl_spi.c | 18 | ||||
| -rw-r--r-- | cpu/arm926ejs/at91/spi.c | 157 | ||||
| -rw-r--r-- | cpu/arm926ejs/at91/usb.c | 80 | 
13 files changed, 150 insertions, 403 deletions
| diff --git a/cpu/arm920t/at91rm9200/Makefile b/cpu/arm920t/at91rm9200/Makefile index ab4c52c8f..67f17fadf 100644 --- a/cpu/arm920t/at91rm9200/Makefile +++ b/cpu/arm920t/at91rm9200/Makefile @@ -26,7 +26,7 @@ include $(TOPDIR)/config.mk  LIB	= $(obj)lib$(SOC).a  COBJS	= bcm5221.o dm9161.o ether.o i2c.o interrupts.o \ -	  lxt972.o serial.o usb.o spi.o +	  lxt972.o usb.o spi.o  SOBJS	= lowlevel_init.o  SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c) diff --git a/cpu/arm920t/at91rm9200/interrupts.c b/cpu/arm920t/at91rm9200/interrupts.c index 5f0703c2d..cff491664 100644 --- a/cpu/arm920t/at91rm9200/interrupts.c +++ b/cpu/arm920t/at91rm9200/interrupts.c @@ -45,6 +45,8 @@ AT91PS_TC tmr;  static ulong timestamp;  static ulong lastinc; +void board_reset(void) __attribute__((__weak__)); +  int interrupt_init (void)  {  	tmr = AT91C_BASE_TC0; @@ -166,29 +168,14 @@ ulong get_tbclk (void)  void reset_cpu (ulong ignored)  { -#ifdef CONFIG_DBGU -	AT91PS_USART us = (AT91PS_USART) AT91C_BASE_DBGU; -#endif -#ifdef CONFIG_USART0 -	AT91PS_USART us = AT91C_BASE_US0; -#endif -#ifdef CONFIG_USART1 -	AT91PS_USART us = AT91C_BASE_US1; -#endif -#ifdef CONFIG_AT91RM9200DK -	AT91PS_PIO pio = AT91C_BASE_PIOA; -#endif - +#if defined(CONFIG_AT91RM9200_USART)  	/*shutdown the console to avoid strange chars during reset */ -	us->US_CR = (AT91C_US_RSTRX | AT91C_US_RSTTX); - -#ifdef CONFIG_AT91RM9200DK -	/* Clear PA19 to trigger the hard reset */ -	pio->PIO_CODR = 0x00080000; -	pio->PIO_OER  = 0x00080000; -	pio->PIO_PER  = 0x00080000; +	serial_exit();  #endif +	if (board_reset) +		board_reset(); +  	/* this is the way Linux does it */  	/* FIXME: diff --git a/cpu/arm920t/at91rm9200/serial.c b/cpu/arm920t/at91rm9200/serial.c deleted file mode 100644 index d56344549..000000000 --- a/cpu/arm920t/at91rm9200/serial.c +++ /dev/null @@ -1,113 +0,0 @@ -/* - * (C) Copyright 2002 - * Lineo, Inc <www.lineo.com> - * Bernhard Kuhn <bkuhn@lineo.com> - * - * (C) Copyright 2002 - * Sysgo Real-Time Solutions, GmbH <www.elinos.com> - * Marius Groeger <mgroeger@sysgo.de> - * - * (C) Copyright 2002 - * Sysgo Real-Time Solutions, GmbH <www.elinos.com> - * Alex Zuepke <azu@sysgo.de> - * - * Copyright (C) 1999 2000 2001 Erik Mouw (J.A.K.Mouw@its.tudelft.nl) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA - * - */ - -#include <common.h> -#include <asm/io.h> -#include <asm/arch/hardware.h> - -DECLARE_GLOBAL_DATA_PTR; - -#if !defined(CONFIG_DBGU) && !defined(CONFIG_USART0) && !defined(CONFIG_USART1) -#error must define one of CONFIG_DBGU or CONFIG_USART0 or CONFIG_USART1 -#endif - -/* ggi thunder */ -#ifdef CONFIG_DBGU -AT91PS_USART us = (AT91PS_USART) AT91C_BASE_DBGU; -#endif -#ifdef CONFIG_USART0 -AT91PS_USART us = (AT91PS_USART) AT91C_BASE_US0; -#endif -#ifdef CONFIG_USART1 -AT91PS_USART us = (AT91PS_USART) AT91C_BASE_US1; -#endif - -void serial_setbrg (void) -{ -	int baudrate; - -	if ((baudrate = gd->baudrate) <= 0) -		baudrate = CONFIG_BAUDRATE; -	/* MASTER_CLOCK/(16 * baudrate) */ -	us->US_BRGR = (AT91C_MASTER_CLOCK >> 4) / (unsigned)baudrate; -} - -int serial_init (void) -{ -	/* make any port initializations specific to this port */ -#ifdef CONFIG_DBGU -	*AT91C_PIOA_PDR = AT91C_PA31_DTXD | AT91C_PA30_DRXD;	/* PA 31 & 30 */ -	*AT91C_PMC_PCER = 1 << AT91C_ID_SYS;	/* enable clock */ -#endif -#ifdef CONFIG_USART0 -	*AT91C_PIOA_PDR = AT91C_PA17_TXD0 | AT91C_PA18_RXD0; -	*AT91C_PMC_PCER |= 1 << AT91C_ID_USART0;	/* enable clock */ -#endif -#ifdef CONFIG_USART1 -	*AT91C_PIOB_PDR = AT91C_PB21_TXD1 | AT91C_PB20_RXD1; -	*AT91C_PMC_PCER |= 1 << AT91C_ID_USART1;	/* enable clock */ -#endif -	serial_setbrg (); - -	us->US_CR = AT91C_US_RSTRX | AT91C_US_RSTTX; -	us->US_CR = AT91C_US_RXEN | AT91C_US_TXEN; -	us->US_MR = -		(AT91C_US_CLKS_CLOCK | AT91C_US_CHRL_8_BITS | -		 AT91C_US_PAR_NONE | AT91C_US_NBSTOP_1_BIT); -	us->US_IMR = ~0ul; -	return (0); -} - -void serial_putc (const char c) -{ -	if (c == '\n') -		serial_putc ('\r'); -	while ((us->US_CSR & AT91C_US_TXRDY) == 0); -	us->US_THR = c; -} - -void serial_puts (const char *s) -{ -	while (*s) { -		serial_putc (*s++); -	} -} - -int serial_getc (void) -{ -	while ((us->US_CSR & AT91C_US_RXRDY) == 0); -	return us->US_RHR; -} - -int serial_tstc (void) -{ -	return ((us->US_CSR & AT91C_US_RXRDY) == AT91C_US_RXRDY); -} diff --git a/cpu/arm920t/start.S b/cpu/arm920t/start.S index fbcfe6dbc..f610e9f96 100644 --- a/cpu/arm920t/start.S +++ b/cpu/arm920t/start.S @@ -258,11 +258,9 @@ cpu_init_crit:  	 * find a lowlevel_init.S in your board directory.  	 */  	mov	ip, lr -#if	defined(CONFIG_AT91RM9200EK) -#else  	bl	lowlevel_init -#endif +  	mov	lr, ip  	mov	pc, lr  #endif /* CONFIG_SKIP_LOWLEVEL_INIT */ diff --git a/cpu/arm926ejs/at91/.gitignore b/cpu/arm926ejs/at91/.gitignore new file mode 100644 index 000000000..8a8c3b8f2 --- /dev/null +++ b/cpu/arm926ejs/at91/.gitignore @@ -0,0 +1,5 @@ +# +# Generated files +# + +/u-boot.lds diff --git a/cpu/arm926ejs/at91/Makefile b/cpu/arm926ejs/at91/Makefile index f9e739c5c..34e746182 100644 --- a/cpu/arm926ejs/at91/Makefile +++ b/cpu/arm926ejs/at91/Makefile @@ -55,9 +55,7 @@ COBJS-y				+= at91sam9rl_serial.o  COBJS-$(CONFIG_HAS_DATAFLASH)	+= at91sam9rl_spi.o  endif  COBJS-$(CONFIG_AT91_LED)	+= led.o -COBJS-$(CONFIG_HAS_DATAFLASH)	+= spi.o  COBJS-y	+= timer.o -COBJS-y	+= usb.o  SOBJS	= lowlevel_init.o  SRCS    := $(SOBJS:.o=.S) $(COBJS-y:.o=.c) diff --git a/cpu/arm926ejs/at91/at91cap9_spi.c b/cpu/arm926ejs/at91/at91cap9_spi.c index 356a804f7..cd8143bdf 100644 --- a/cpu/arm926ejs/at91/at91cap9_spi.c +++ b/cpu/arm926ejs/at91/at91cap9_spi.c @@ -38,15 +38,27 @@ void at91_spi0_hw_init(unsigned long cs_mask)  	at91_sys_write(AT91_PMC_PCER, 1 << AT91CAP9_ID_SPI0);  	if (cs_mask & (1 << 0)) { -		at91_set_gpio_output(AT91_PIN_PA5, 1); +		at91_set_B_periph(AT91_PIN_PA5, 1);  	}  	if (cs_mask & (1 << 1)) { -		at91_set_gpio_output(AT91_PIN_PA3, 1); +		at91_set_B_periph(AT91_PIN_PA3, 1);  	}  	if (cs_mask & (1 << 2)) { -		at91_set_gpio_output(AT91_PIN_PD0, 1); +		at91_set_B_periph(AT91_PIN_PD0, 1);  	}  	if (cs_mask & (1 << 3)) { +		at91_set_B_periph(AT91_PIN_PD1, 1); +	} +	if (cs_mask & (1 << 4)) { +		at91_set_gpio_output(AT91_PIN_PA5, 1); +	} +	if (cs_mask & (1 << 5)) { +		at91_set_gpio_output(AT91_PIN_PA3, 1); +	} +	if (cs_mask & (1 << 6)) { +		at91_set_gpio_output(AT91_PIN_PD0, 1); +	} +	if (cs_mask & (1 << 7)) {  		at91_set_gpio_output(AT91_PIN_PD1, 1);  	}  } @@ -61,15 +73,28 @@ void at91_spi1_hw_init(unsigned long cs_mask)  	at91_sys_write(AT91_PMC_PCER, 1 << AT91CAP9_ID_SPI1);  	if (cs_mask & (1 << 0)) { -		at91_set_gpio_output(AT91_PIN_PB15, 1); +		at91_set_A_periph(AT91_PIN_PB15, 1);  	}  	if (cs_mask & (1 << 1)) { -		at91_set_gpio_output(AT91_PIN_PB16, 1); +		at91_set_A_periph(AT91_PIN_PB16, 1);  	}  	if (cs_mask & (1 << 2)) { -		at91_set_gpio_output(AT91_PIN_PB17, 1); +		at91_set_A_periph(AT91_PIN_PB17, 1);  	}  	if (cs_mask & (1 << 3)) { +		at91_set_A_periph(AT91_PIN_PB18, 1); +	} +	if (cs_mask & (1 << 4)) { +		at91_set_gpio_output(AT91_PIN_PB15, 1); +	} +	if (cs_mask & (1 << 5)) { +		at91_set_gpio_output(AT91_PIN_PB16, 1); +	} +	if (cs_mask & (1 << 6)) { +		at91_set_gpio_output(AT91_PIN_PB17, 1); +	} +	if (cs_mask & (1 << 7)) {  		at91_set_gpio_output(AT91_PIN_PB18, 1);  	} +  } diff --git a/cpu/arm926ejs/at91/at91sam9260_spi.c b/cpu/arm926ejs/at91/at91sam9260_spi.c index 0105072da..d6fd80ea7 100644 --- a/cpu/arm926ejs/at91/at91sam9260_spi.c +++ b/cpu/arm926ejs/at91/at91sam9260_spi.c @@ -38,15 +38,27 @@ void at91_spi0_hw_init(unsigned long cs_mask)  	at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9260_ID_SPI0);  	if (cs_mask & (1 << 0)) { -		at91_set_gpio_output(AT91_PIN_PA3, 1); +		at91_set_A_periph(AT91_PIN_PA3, 1);  	}  	if (cs_mask & (1 << 1)) { -		at91_set_gpio_output(AT91_PIN_PC11, 1); +		at91_set_B_periph(AT91_PIN_PC11, 1);  	}  	if (cs_mask & (1 << 2)) { -		at91_set_gpio_output(AT91_PIN_PC16, 1); +		at91_set_B_periph(AT91_PIN_PC16, 1);  	}  	if (cs_mask & (1 << 3)) { +		at91_set_B_periph(AT91_PIN_PC17, 1); +	} +	if (cs_mask & (1 << 4)) { +		at91_set_gpio_output(AT91_PIN_PA3, 1); +	} +	if (cs_mask & (1 << 5)) { +		at91_set_gpio_output(AT91_PIN_PC11, 1); +	} +	if (cs_mask & (1 << 6)) { +		at91_set_gpio_output(AT91_PIN_PC16, 1); +	} +	if (cs_mask & (1 << 7)) {  		at91_set_gpio_output(AT91_PIN_PC17, 1);  	}  } @@ -61,15 +73,27 @@ void at91_spi1_hw_init(unsigned long cs_mask)  	at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9260_ID_SPI1);  	if (cs_mask & (1 << 0)) { -		at91_set_gpio_output(AT91_PIN_PB3, 1); +		at91_set_A_periph(AT91_PIN_PB3, 1);  	}  	if (cs_mask & (1 << 1)) { -		at91_set_gpio_output(AT91_PIN_PC5, 1); +		at91_set_B_periph(AT91_PIN_PC5, 1);  	}  	if (cs_mask & (1 << 2)) { -		at91_set_gpio_output(AT91_PIN_PC4, 1); +		at91_set_B_periph(AT91_PIN_PC4, 1);  	}  	if (cs_mask & (1 << 3)) {  		at91_set_gpio_output(AT91_PIN_PC3, 1);  	} +	if (cs_mask & (1 << 4)) { +		at91_set_gpio_output(AT91_PIN_PB3, 1); +	} +	if (cs_mask & (1 << 5)) { +		at91_set_gpio_output(AT91_PIN_PC5, 1); +	} +	if (cs_mask & (1 << 6)) { +		at91_set_gpio_output(AT91_PIN_PC4, 1); +	} +	if (cs_mask & (1 << 7)) { +		at91_set_gpio_output(AT91_PIN_PC3, 1); +	}  } diff --git a/cpu/arm926ejs/at91/at91sam9261_spi.c b/cpu/arm926ejs/at91/at91sam9261_spi.c index f70320d7c..9383dc67d 100644 --- a/cpu/arm926ejs/at91/at91sam9261_spi.c +++ b/cpu/arm926ejs/at91/at91sam9261_spi.c @@ -38,15 +38,27 @@ void at91_spi0_hw_init(unsigned long cs_mask)  	at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9261_ID_SPI0);  	if (cs_mask & (1 << 0)) { -		at91_set_gpio_output(AT91_PIN_PA3, 1); +		at91_set_A_periph(AT91_PIN_PA3, 1);  	}  	if (cs_mask & (1 << 1)) { -		at91_set_gpio_output(AT91_PIN_PA4, 1); +		at91_set_A_periph(AT91_PIN_PA4, 1);  	}  	if (cs_mask & (1 << 2)) { -		at91_set_gpio_output(AT91_PIN_PA5, 1); +		at91_set_A_periph(AT91_PIN_PA5, 1);  	}  	if (cs_mask & (1 << 3)) { +		at91_set_A_periph(AT91_PIN_PA6, 1); +	} +	if (cs_mask & (1 << 4)) { +		at91_set_gpio_output(AT91_PIN_PA3, 1); +	} +	if (cs_mask & (1 << 5)) { +		at91_set_gpio_output(AT91_PIN_PA4, 1); +	} +	if (cs_mask & (1 << 6)) { +		at91_set_gpio_output(AT91_PIN_PA5, 1); +	} +	if (cs_mask & (1 << 7)) {  		at91_set_gpio_output(AT91_PIN_PA6, 1);  	}  } @@ -61,15 +73,27 @@ void at91_spi1_hw_init(unsigned long cs_mask)  	at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9261_ID_SPI1);  	if (cs_mask & (1 << 0)) { -		at91_set_gpio_output(AT91_PIN_PB28, 1); +		at91_set_A_periph(AT91_PIN_PB28, 1);  	}  	if (cs_mask & (1 << 1)) { -		at91_set_gpio_output(AT91_PIN_PA24, 1); +		at91_set_B_periph(AT91_PIN_PA24, 1);  	}  	if (cs_mask & (1 << 2)) { -		at91_set_gpio_output(AT91_PIN_PA25, 1); +		at91_set_B_periph(AT91_PIN_PA25, 1);  	}  	if (cs_mask & (1 << 3)) { +		at91_set_A_periph(AT91_PIN_PA26, 1); +	} +	if (cs_mask & (1 << 4)) { +		at91_set_gpio_output(AT91_PIN_PB28, 1); +	} +	if (cs_mask & (1 << 5)) { +		at91_set_gpio_output(AT91_PIN_PA24, 1); +	} +	if (cs_mask & (1 << 6)) { +		at91_set_gpio_output(AT91_PIN_PA25, 1); +	} +	if (cs_mask & (1 << 7)) {  		at91_set_gpio_output(AT91_PIN_PA26, 1);  	}  } diff --git a/cpu/arm926ejs/at91/at91sam9263_spi.c b/cpu/arm926ejs/at91/at91sam9263_spi.c index 1dda04c97..e52dd6141 100644 --- a/cpu/arm926ejs/at91/at91sam9263_spi.c +++ b/cpu/arm926ejs/at91/at91sam9263_spi.c @@ -38,15 +38,27 @@ void at91_spi0_hw_init(unsigned long cs_mask)  	at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9263_ID_SPI0);  	if (cs_mask & (1 << 0)) { -		at91_set_gpio_output(AT91_PIN_PA5, 1); +		at91_set_B_periph(AT91_PIN_PA5, 1);  	}  	if (cs_mask & (1 << 1)) { -		at91_set_gpio_output(AT91_PIN_PA3, 1); +		at91_set_B_periph(AT91_PIN_PA3, 1);  	}  	if (cs_mask & (1 << 2)) { -		at91_set_gpio_output(AT91_PIN_PA4, 1); +		at91_set_B_periph(AT91_PIN_PA4, 1);  	}  	if (cs_mask & (1 << 3)) { +		at91_set_B_periph(AT91_PIN_PB11, 1); +	} +	if (cs_mask & (1 << 4)) { +		at91_set_gpio_output(AT91_PIN_PA5, 1); +	} +	if (cs_mask & (1 << 5)) { +		at91_set_gpio_output(AT91_PIN_PA3, 1); +	} +	if (cs_mask & (1 << 6)) { +		at91_set_gpio_output(AT91_PIN_PA4, 1); +	} +	if (cs_mask & (1 << 7)) {  		at91_set_gpio_output(AT91_PIN_PB11, 1);  	}  } @@ -61,15 +73,27 @@ void at91_spi1_hw_init(unsigned long cs_mask)  	at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9263_ID_SPI1);  	if (cs_mask & (1 << 0)) { -		at91_set_gpio_output(AT91_PIN_PB15, 1); +		at91_set_A_periph(AT91_PIN_PB15, 1);  	}  	if (cs_mask & (1 << 1)) { -		at91_set_gpio_output(AT91_PIN_PB16, 1); +		at91_set_A_periph(AT91_PIN_PB16, 1);  	}  	if (cs_mask & (1 << 2)) { -		at91_set_gpio_output(AT91_PIN_PB17, 1); +		at91_set_A_periph(AT91_PIN_PB17, 1);  	}  	if (cs_mask & (1 << 3)) { +		at91_set_A_periph(AT91_PIN_PB18, 1); +	} +	if (cs_mask & (1 << 4)) { +		at91_set_gpio_output(AT91_PIN_PB15, 1); +	} +	if (cs_mask & (1 << 5)) { +		at91_set_gpio_output(AT91_PIN_PB16, 1); +	} +	if (cs_mask & (1 << 6)) { +		at91_set_gpio_output(AT91_PIN_PB17, 1); +	} +	if (cs_mask & (1 << 7)) {  		at91_set_gpio_output(AT91_PIN_PB18, 1);  	}  } diff --git a/cpu/arm926ejs/at91/at91sam9rl_spi.c b/cpu/arm926ejs/at91/at91sam9rl_spi.c index aa9c18317..389d6d80d 100644 --- a/cpu/arm926ejs/at91/at91sam9rl_spi.c +++ b/cpu/arm926ejs/at91/at91sam9rl_spi.c @@ -38,15 +38,27 @@ void at91_spi0_hw_init(unsigned long cs_mask)  	at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9RL_ID_SPI);  	if (cs_mask & (1 << 0)) { -		at91_set_gpio_output(AT91_PIN_PA28, 1); +		at91_set_A_periph(AT91_PIN_PA28, 1);  	}  	if (cs_mask & (1 << 1)) { -		at91_set_gpio_output(AT91_PIN_PB7, 1); +		at91_set_B_periph(AT91_PIN_PB7, 1);  	}  	if (cs_mask & (1 << 2)) { -		at91_set_gpio_output(AT91_PIN_PD8, 1); +		at91_set_A_periph(AT91_PIN_PD8, 1);  	}  	if (cs_mask & (1 << 3)) { +		at91_set_B_periph(AT91_PIN_PD9, 1); +	} +	if (cs_mask & (1 << 4)) { +		at91_set_gpio_output(AT91_PIN_PA28, 1); +	} +	if (cs_mask & (1 << 5)) { +		at91_set_gpio_output(AT91_PIN_PB7, 1); +	} +	if (cs_mask & (1 << 6)) { +		at91_set_gpio_output(AT91_PIN_PD8, 1); +	} +	if (cs_mask & (1 << 7)) {  		at91_set_gpio_output(AT91_PIN_PD9, 1);  	}  } diff --git a/cpu/arm926ejs/at91/spi.c b/cpu/arm926ejs/at91/spi.c deleted file mode 100644 index 3eb252c5b..000000000 --- a/cpu/arm926ejs/at91/spi.c +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Driver for ATMEL DataFlash support - * Author : Hamid Ikdoumi (Atmel) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - */ - -#include <common.h> -#include <asm/arch/hardware.h> -#include <asm/arch/gpio.h> -#include <asm/arch/io.h> -#include <asm/arch/at91_pio.h> -#include <asm/arch/at91_spi.h> - -#include <dataflash.h> - -#define AT91_SPI_PCS0_DATAFLASH_CARD	0xE	/* Chip Select 0: NPCS0%1110 */ -#define AT91_SPI_PCS1_DATAFLASH_CARD	0xD	/* Chip Select 0: NPCS0%1101 */ -#define AT91_SPI_PCS3_DATAFLASH_CARD	0x7	/* Chip Select 3: NPCS3%0111 */ - -void AT91F_SpiInit(void) -{ -	/* Reset the SPI */ -	writel(AT91_SPI_SWRST, AT91_BASE_SPI + AT91_SPI_CR); - -	/* Configure SPI in Master Mode with No CS selected !!! */ -	writel(AT91_SPI_MSTR | AT91_SPI_MODFDIS | AT91_SPI_PCS, -	       AT91_BASE_SPI + AT91_SPI_MR); - -	/* Configure CS0 */ -	writel(AT91_SPI_NCPHA | -	       (AT91_SPI_DLYBS & DATAFLASH_TCSS) | -	       (AT91_SPI_DLYBCT & DATAFLASH_TCHS) | -	       ((AT91_MASTER_CLOCK / AT91_SPI_CLK) << 8), -	       AT91_BASE_SPI + AT91_SPI_CSR(0)); - -#ifdef CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS1 -	/* Configure CS1 */ -	writel(AT91_SPI_NCPHA | -	       (AT91_SPI_DLYBS & DATAFLASH_TCSS) | -	       (AT91_SPI_DLYBCT & DATAFLASH_TCHS) | -	       ((AT91_MASTER_CLOCK / AT91_SPI_CLK) << 8), -	       AT91_BASE_SPI + AT91_SPI_CSR(1)); -#endif - -#ifdef CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS3 -	/* Configure CS3 */ -	writel(AT91_SPI_NCPHA | -	       (AT91_SPI_DLYBS & DATAFLASH_TCSS) | -	       (AT91_SPI_DLYBCT & DATAFLASH_TCHS) | -	       ((AT91_MASTER_CLOCK / AT91_SPI_CLK) << 8), -	       AT91_BASE_SPI + AT91_SPI_CSR(3)); -#endif - -	/* SPI_Enable */ -	writel(AT91_SPI_SPIEN, AT91_BASE_SPI + AT91_SPI_CR); - -	while (!(readl(AT91_BASE_SPI + AT91_SPI_SR) & AT91_SPI_SPIENS)); - -	/* -	 * Add tempo to get SPI in a safe state. -	 * Should not be needed for new silicon (Rev B) -	 */ -	udelay(500000); -	readl(AT91_BASE_SPI + AT91_SPI_SR); -	readl(AT91_BASE_SPI + AT91_SPI_RDR); - -} - -void AT91F_SpiEnable(int cs) -{ -	unsigned long mode; - -	switch (cs) { -	case 0:	/* Configure SPI CS0 for Serial DataFlash AT45DBxx */ -		mode = readl(AT91_BASE_SPI + AT91_SPI_MR); -		mode &= 0xFFF0FFFF; -		writel(mode | ((AT91_SPI_PCS0_DATAFLASH_CARD<<16) & AT91_SPI_PCS), -		       AT91_BASE_SPI + AT91_SPI_MR); -		break; -	case 1:	/* Configure SPI CS1 for Serial DataFlash AT45DBxx */ -		mode = readl(AT91_BASE_SPI + AT91_SPI_MR); -		mode &= 0xFFF0FFFF; -		writel(mode | ((AT91_SPI_PCS1_DATAFLASH_CARD<<16) & AT91_SPI_PCS), -		       AT91_BASE_SPI + AT91_SPI_MR); -		break; -	case 3: -		mode = readl(AT91_BASE_SPI + AT91_SPI_MR); -		mode &= 0xFFF0FFFF; -		writel(mode | ((AT91_SPI_PCS3_DATAFLASH_CARD<<16) & AT91_SPI_PCS), -		       AT91_BASE_SPI + AT91_SPI_MR); -		break; -	} - -	/* SPI_Enable */ -	writel(AT91_SPI_SPIEN, AT91_BASE_SPI + AT91_SPI_CR); -} - -unsigned int AT91F_SpiWrite1(AT91PS_DataflashDesc pDesc); - -unsigned int AT91F_SpiWrite(AT91PS_DataflashDesc pDesc) -{ -	unsigned int timeout; - -	pDesc->state = BUSY; - -	writel(AT91_SPI_TXTDIS + AT91_SPI_RXTDIS, AT91_BASE_SPI + AT91_SPI_PTCR); - -	/* Initialize the Transmit and Receive Pointer */ -	writel((unsigned int)pDesc->rx_cmd_pt, AT91_BASE_SPI + AT91_SPI_RPR); -	writel((unsigned int)pDesc->tx_cmd_pt, AT91_BASE_SPI + AT91_SPI_TPR); - -	/* Intialize the Transmit and Receive Counters */ -	writel(pDesc->rx_cmd_size, AT91_BASE_SPI + AT91_SPI_RCR); -	writel(pDesc->tx_cmd_size, AT91_BASE_SPI + AT91_SPI_TCR); - -	if (pDesc->tx_data_size != 0) { -		/* Initialize the Next Transmit and Next Receive Pointer */ -		writel((unsigned int)pDesc->rx_data_pt, AT91_BASE_SPI + AT91_SPI_RNPR); -		writel((unsigned int)pDesc->tx_data_pt, AT91_BASE_SPI + AT91_SPI_TNPR); - -		/* Intialize the Next Transmit and Next Receive Counters */ -		writel(pDesc->rx_data_size, AT91_BASE_SPI + AT91_SPI_RNCR); -		writel(pDesc->tx_data_size, AT91_BASE_SPI + AT91_SPI_TNCR); -	} - -	/* arm simple, non interrupt dependent timer */ -	reset_timer_masked(); -	timeout = 0; - -	writel(AT91_SPI_TXTEN + AT91_SPI_RXTEN, AT91_BASE_SPI + AT91_SPI_PTCR); -	while (!(readl(AT91_BASE_SPI + AT91_SPI_SR) & AT91_SPI_RXBUFF) && -		((timeout = get_timer_masked()) < CONFIG_SYS_SPI_WRITE_TOUT)); -	writel(AT91_SPI_TXTDIS + AT91_SPI_RXTDIS, AT91_BASE_SPI + AT91_SPI_PTCR); -	pDesc->state = IDLE; - -	if (timeout >= CONFIG_SYS_SPI_WRITE_TOUT) { -		printf("Error Timeout\n\r"); -		return DATAFLASH_ERROR; -	} - -	return DATAFLASH_OK; -} diff --git a/cpu/arm926ejs/at91/usb.c b/cpu/arm926ejs/at91/usb.c deleted file mode 100644 index 7c44ad0e9..000000000 --- a/cpu/arm926ejs/at91/usb.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - * (C) Copyright 2006 - * DENX Software Engineering <mk@denx.de> - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - */ - -#include <common.h> - -#if defined(CONFIG_USB_OHCI_NEW) && defined(CONFIG_SYS_USB_OHCI_CPU_INIT) - -#include <asm/arch/hardware.h> -#include <asm/arch/io.h> -#include <asm/arch/at91_pmc.h> - -int usb_cpu_init(void) -{ - -#if defined(CONFIG_AT91CAP9) || defined(CONFIG_AT91SAM9260) || \ -    defined(CONFIG_AT91SAM9263) || defined(CONFIG_AT91SAM9G20) -	/* Enable PLLB */ -	at91_sys_write(AT91_CKGR_PLLBR, CONFIG_SYS_AT91_PLLB); -	while ((at91_sys_read(AT91_PMC_SR) & AT91_PMC_LOCKB) != AT91_PMC_LOCKB) -		; -#endif - -	/* Enable USB host clock. */ -	at91_sys_write(AT91_PMC_PCER, 1 << AT91_ID_UHP); -#ifdef CONFIG_AT91SAM9261 -	at91_sys_write(AT91_PMC_SCER, AT91_PMC_UHP | AT91_PMC_HCK0); -#else -	at91_sys_write(AT91_PMC_SCER, AT91_PMC_UHP); -#endif - -	return 0; -} - -int usb_cpu_stop(void) -{ -	/* Disable USB host clock. */ -	at91_sys_write(AT91_PMC_PCDR, 1 << AT91_ID_UHP); -#ifdef CONFIG_AT91SAM9261 -	at91_sys_write(AT91_PMC_SCDR, AT91_PMC_UHP | AT91_PMC_HCK0); -#else -	at91_sys_write(AT91_PMC_SCDR, AT91_PMC_UHP); -#endif - -#if defined(CONFIG_AT91CAP9) || defined(CONFIG_AT91SAM9260) || \ -    defined(CONFIG_AT91SAM9263) || defined(CONFIG_AT91SAM9G20) -	/* Disable PLLB */ -	at91_sys_write(AT91_CKGR_PLLBR, 0); -	while ((at91_sys_read(AT91_PMC_SR) & AT91_PMC_LOCKB) != 0) -		; -#endif - -	return 0; -} - -int usb_cpu_init_fail(void) -{ -	return usb_cpu_stop(); -} - -#endif /* defined(CONFIG_USB_OHCI) && defined(CONFIG_SYS_USB_OHCI_CPU_INIT) */ |