Commit 1332a2a0694c8e10a5bade397cf83645b2c3fd7e
1 parent
ee1702d75a
Exists in
master
and in
57 other branches
at91sam9/at91cap: move common serial initialisation to cpu
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Showing 13 changed files with 432 additions and 169 deletions Side-by-side Diff
- board/afeb9260/afeb9260.c
- board/atmel/at91cap9adk/at91cap9adk.c
- board/atmel/at91sam9260ek/at91sam9260ek.c
- board/atmel/at91sam9261ek/at91sam9261ek.c
- board/atmel/at91sam9263ek/at91sam9263ek.c
- board/atmel/at91sam9rlek/at91sam9rlek.c
- cpu/arm926ejs/at91/Makefile
- cpu/arm926ejs/at91/at91cap9_serial.c
- cpu/arm926ejs/at91/at91sam9260_serial.c
- cpu/arm926ejs/at91/at91sam9261_serial.c
- cpu/arm926ejs/at91/at91sam9263_serial.c
- cpu/arm926ejs/at91/at91sam9rl_serial.c
- include/asm-arm/arch-at91/at91_common.h
board/afeb9260/afeb9260.c
| ... | ... | @@ -27,6 +27,7 @@ |
| 27 | 27 | #include <asm/arch/at91sam9260.h> |
| 28 | 28 | #include <asm/arch/at91sam9260_matrix.h> |
| 29 | 29 | #include <asm/arch/at91sam9_smc.h> |
| 30 | +#include <asm/arch/at91_common.h> | |
| 30 | 31 | #include <asm/arch/at91_pmc.h> |
| 31 | 32 | #include <asm/arch/at91_rstc.h> |
| 32 | 33 | #include <asm/arch/gpio.h> |
| ... | ... | @@ -44,33 +45,6 @@ |
| 44 | 45 | * Miscelaneous platform dependent initialisations |
| 45 | 46 | */ |
| 46 | 47 | |
| 47 | -static void afeb9260_serial_hw_init(void) | |
| 48 | -{ | |
| 49 | -#ifdef CONFIG_USART0 | |
| 50 | - at91_set_A_periph(AT91_PIN_PB4, 1); /* TXD0 */ | |
| 51 | - at91_set_A_periph(AT91_PIN_PB5, 0); /* RXD0 */ | |
| 52 | - at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9260_ID_US0); | |
| 53 | -#endif | |
| 54 | - | |
| 55 | -#ifdef CONFIG_USART1 | |
| 56 | - at91_set_A_periph(AT91_PIN_PB6, 1); /* TXD1 */ | |
| 57 | - at91_set_A_periph(AT91_PIN_PB7, 0); /* RXD1 */ | |
| 58 | - at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9260_ID_US1); | |
| 59 | -#endif | |
| 60 | - | |
| 61 | -#ifdef CONFIG_USART2 | |
| 62 | - at91_set_A_periph(AT91_PIN_PB8, 1); /* TXD2 */ | |
| 63 | - at91_set_A_periph(AT91_PIN_PB9, 0); /* RXD2 */ | |
| 64 | - at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9260_ID_US2); | |
| 65 | -#endif | |
| 66 | - | |
| 67 | -#ifdef CONFIG_USART3 /* DBGU */ | |
| 68 | - at91_set_A_periph(AT91_PIN_PB14, 0); /* DRXD */ | |
| 69 | - at91_set_A_periph(AT91_PIN_PB15, 1); /* DTXD */ | |
| 70 | - at91_sys_write(AT91_PMC_PCER, 1 << AT91_ID_SYS); | |
| 71 | -#endif | |
| 72 | -} | |
| 73 | - | |
| 74 | 48 | static void afeb9260_nand_hw_init(void) |
| 75 | 49 | { |
| 76 | 50 | unsigned long csa; |
| ... | ... | @@ -201,7 +175,7 @@ |
| 201 | 175 | /* adress of boot parameters */ |
| 202 | 176 | gd->bd->bi_boot_params = PHYS_SDRAM + 0x100; |
| 203 | 177 | |
| 204 | - afeb9260_serial_hw_init(); | |
| 178 | + at91_serial_hw_init(); | |
| 205 | 179 | #ifdef CONFIG_CMD_NAND |
| 206 | 180 | afeb9260_nand_hw_init(); |
| 207 | 181 | #endif |
board/atmel/at91cap9adk/at91cap9adk.c
| ... | ... | @@ -26,6 +26,7 @@ |
| 26 | 26 | #include <asm/arch/at91cap9.h> |
| 27 | 27 | #include <asm/arch/at91cap9_matrix.h> |
| 28 | 28 | #include <asm/arch/at91sam9_smc.h> |
| 29 | +#include <asm/arch/at91_common.h> | |
| 29 | 30 | #include <asm/arch/at91_pmc.h> |
| 30 | 31 | #include <asm/arch/at91_rstc.h> |
| 31 | 32 | #include <asm/arch/gpio.h> |
| ... | ... | @@ -47,33 +48,6 @@ |
| 47 | 48 | * Miscelaneous platform dependent initialisations |
| 48 | 49 | */ |
| 49 | 50 | |
| 50 | -static void at91cap9_serial_hw_init(void) | |
| 51 | -{ | |
| 52 | -#ifdef CONFIG_USART0 | |
| 53 | - at91_set_A_periph(AT91_PIN_PA22, 1); /* TXD0 */ | |
| 54 | - at91_set_A_periph(AT91_PIN_PA23, 0); /* RXD0 */ | |
| 55 | - at91_sys_write(AT91_PMC_PCER, 1 << AT91CAP9_ID_US0); | |
| 56 | -#endif | |
| 57 | - | |
| 58 | -#ifdef CONFIG_USART1 | |
| 59 | - at91_set_A_periph(AT91_PIN_PD0, 1); /* TXD1 */ | |
| 60 | - at91_set_A_periph(AT91_PIN_PD1, 0); /* RXD1 */ | |
| 61 | - at91_sys_write(AT91_PMC_PCER, 1 << AT91CAP9_ID_US1); | |
| 62 | -#endif | |
| 63 | - | |
| 64 | -#ifdef CONFIG_USART2 | |
| 65 | - at91_set_A_periph(AT91_PIN_PD2, 1); /* TXD2 */ | |
| 66 | - at91_set_A_periph(AT91_PIN_PD3, 0); /* RXD2 */ | |
| 67 | - at91_sys_write(AT91_PMC_PCER, 1 << AT91CAP9_ID_US2); | |
| 68 | -#endif | |
| 69 | - | |
| 70 | -#ifdef CONFIG_USART3 /* DBGU */ | |
| 71 | - at91_set_A_periph(AT91_PIN_PC30, 0); /* DRXD */ | |
| 72 | - at91_set_A_periph(AT91_PIN_PC31, 1); /* DTXD */ | |
| 73 | - at91_sys_write(AT91_PMC_PCER, 1 << AT91_ID_SYS); | |
| 74 | -#endif | |
| 75 | -} | |
| 76 | - | |
| 77 | 51 | static void at91cap9_slowclock_hw_init(void) |
| 78 | 52 | { |
| 79 | 53 | /* |
| ... | ... | @@ -367,7 +341,7 @@ |
| 367 | 341 | /* adress of boot parameters */ |
| 368 | 342 | gd->bd->bi_boot_params = PHYS_SDRAM + 0x100; |
| 369 | 343 | |
| 370 | - at91cap9_serial_hw_init(); | |
| 344 | + at91_serial_hw_init(); | |
| 371 | 345 | at91cap9_slowclock_hw_init(); |
| 372 | 346 | at91cap9_nor_hw_init(); |
| 373 | 347 | #ifdef CONFIG_CMD_NAND |
board/atmel/at91sam9260ek/at91sam9260ek.c
| ... | ... | @@ -26,6 +26,7 @@ |
| 26 | 26 | #include <asm/arch/at91sam9260.h> |
| 27 | 27 | #include <asm/arch/at91sam9260_matrix.h> |
| 28 | 28 | #include <asm/arch/at91sam9_smc.h> |
| 29 | +#include <asm/arch/at91_common.h> | |
| 29 | 30 | #include <asm/arch/at91_pmc.h> |
| 30 | 31 | #include <asm/arch/at91_rstc.h> |
| 31 | 32 | #include <asm/arch/gpio.h> |
| ... | ... | @@ -43,33 +44,6 @@ |
| 43 | 44 | * Miscelaneous platform dependent initialisations |
| 44 | 45 | */ |
| 45 | 46 | |
| 46 | -static void at91sam9260ek_serial_hw_init(void) | |
| 47 | -{ | |
| 48 | -#ifdef CONFIG_USART0 | |
| 49 | - at91_set_A_periph(AT91_PIN_PB4, 1); /* TXD0 */ | |
| 50 | - at91_set_A_periph(AT91_PIN_PB5, 0); /* RXD0 */ | |
| 51 | - at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9260_ID_US0); | |
| 52 | -#endif | |
| 53 | - | |
| 54 | -#ifdef CONFIG_USART1 | |
| 55 | - at91_set_A_periph(AT91_PIN_PB6, 1); /* TXD1 */ | |
| 56 | - at91_set_A_periph(AT91_PIN_PB7, 0); /* RXD1 */ | |
| 57 | - at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9260_ID_US1); | |
| 58 | -#endif | |
| 59 | - | |
| 60 | -#ifdef CONFIG_USART2 | |
| 61 | - at91_set_A_periph(AT91_PIN_PB8, 1); /* TXD2 */ | |
| 62 | - at91_set_A_periph(AT91_PIN_PB9, 0); /* RXD2 */ | |
| 63 | - at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9260_ID_US2); | |
| 64 | -#endif | |
| 65 | - | |
| 66 | -#ifdef CONFIG_USART3 /* DBGU */ | |
| 67 | - at91_set_A_periph(AT91_PIN_PB14, 0); /* DRXD */ | |
| 68 | - at91_set_A_periph(AT91_PIN_PB15, 1); /* DTXD */ | |
| 69 | - at91_sys_write(AT91_PMC_PCER, 1 << AT91_ID_SYS); | |
| 70 | -#endif | |
| 71 | -} | |
| 72 | - | |
| 73 | 47 | #ifdef CONFIG_CMD_NAND |
| 74 | 48 | static void at91sam9260ek_nand_hw_init(void) |
| 75 | 49 | { |
| ... | ... | @@ -217,7 +191,7 @@ |
| 217 | 191 | /* adress of boot parameters */ |
| 218 | 192 | gd->bd->bi_boot_params = PHYS_SDRAM + 0x100; |
| 219 | 193 | |
| 220 | - at91sam9260ek_serial_hw_init(); | |
| 194 | + at91_serial_hw_init(); | |
| 221 | 195 | #ifdef CONFIG_CMD_NAND |
| 222 | 196 | at91sam9260ek_nand_hw_init(); |
| 223 | 197 | #endif |
board/atmel/at91sam9261ek/at91sam9261ek.c
| ... | ... | @@ -26,6 +26,7 @@ |
| 26 | 26 | #include <asm/arch/at91sam9261.h> |
| 27 | 27 | #include <asm/arch/at91sam9261_matrix.h> |
| 28 | 28 | #include <asm/arch/at91sam9_smc.h> |
| 29 | +#include <asm/arch/at91_common.h> | |
| 29 | 30 | #include <asm/arch/at91_pmc.h> |
| 30 | 31 | #include <asm/arch/at91_rstc.h> |
| 31 | 32 | #include <asm/arch/gpio.h> |
| ... | ... | @@ -43,33 +44,6 @@ |
| 43 | 44 | * Miscelaneous platform dependent initialisations |
| 44 | 45 | */ |
| 45 | 46 | |
| 46 | -static void at91sam9261ek_serial_hw_init(void) | |
| 47 | -{ | |
| 48 | -#ifdef CONFIG_USART0 | |
| 49 | - at91_set_A_periph(AT91_PIN_PC8, 1); /* TXD0 */ | |
| 50 | - at91_set_A_periph(AT91_PIN_PC9, 0); /* RXD0 */ | |
| 51 | - at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9261_ID_US0); | |
| 52 | -#endif | |
| 53 | - | |
| 54 | -#ifdef CONFIG_USART1 | |
| 55 | - at91_set_A_periph(AT91_PIN_PC12, 1); /* TXD1 */ | |
| 56 | - at91_set_A_periph(AT91_PIN_PC13, 0); /* RXD1 */ | |
| 57 | - at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9261_ID_US1); | |
| 58 | -#endif | |
| 59 | - | |
| 60 | -#ifdef CONFIG_USART2 | |
| 61 | - at91_set_A_periph(AT91_PIN_PC14, 1); /* TXD2 */ | |
| 62 | - at91_set_A_periph(AT91_PIN_PC15, 0); /* RXD2 */ | |
| 63 | - at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9261_ID_US2); | |
| 64 | -#endif | |
| 65 | - | |
| 66 | -#ifdef CONFIG_USART3 /* DBGU */ | |
| 67 | - at91_set_A_periph(AT91_PIN_PA9, 0); /* DRXD */ | |
| 68 | - at91_set_A_periph(AT91_PIN_PA10, 1); /* DTXD */ | |
| 69 | - at91_sys_write(AT91_PMC_PCER, 1 << AT91_ID_SYS); | |
| 70 | -#endif | |
| 71 | -} | |
| 72 | - | |
| 73 | 47 | #ifdef CONFIG_CMD_NAND |
| 74 | 48 | static void at91sam9261ek_nand_hw_init(void) |
| 75 | 49 | { |
| ... | ... | @@ -250,7 +224,7 @@ |
| 250 | 224 | /* adress of boot parameters */ |
| 251 | 225 | gd->bd->bi_boot_params = PHYS_SDRAM + 0x100; |
| 252 | 226 | |
| 253 | - at91sam9261ek_serial_hw_init(); | |
| 227 | + at91_serial_hw_init(); | |
| 254 | 228 | #ifdef CONFIG_CMD_NAND |
| 255 | 229 | at91sam9261ek_nand_hw_init(); |
| 256 | 230 | #endif |
board/atmel/at91sam9263ek/at91sam9263ek.c
| ... | ... | @@ -27,6 +27,7 @@ |
| 27 | 27 | #include <asm/arch/at91sam9263.h> |
| 28 | 28 | #include <asm/arch/at91sam9263_matrix.h> |
| 29 | 29 | #include <asm/arch/at91sam9_smc.h> |
| 30 | +#include <asm/arch/at91_common.h> | |
| 30 | 31 | #include <asm/arch/at91_pmc.h> |
| 31 | 32 | #include <asm/arch/at91_rstc.h> |
| 32 | 33 | #include <asm/arch/gpio.h> |
| ... | ... | @@ -46,33 +47,6 @@ |
| 46 | 47 | * Miscelaneous platform dependent initialisations |
| 47 | 48 | */ |
| 48 | 49 | |
| 49 | -static void at91sam9263ek_serial_hw_init(void) | |
| 50 | -{ | |
| 51 | -#ifdef CONFIG_USART0 | |
| 52 | - at91_set_A_periph(AT91_PIN_PA26, 1); /* TXD0 */ | |
| 53 | - at91_set_A_periph(AT91_PIN_PA27, 0); /* RXD0 */ | |
| 54 | - at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9263_ID_US0); | |
| 55 | -#endif | |
| 56 | - | |
| 57 | -#ifdef CONFIG_USART1 | |
| 58 | - at91_set_A_periph(AT91_PIN_PD0, 1); /* TXD1 */ | |
| 59 | - at91_set_A_periph(AT91_PIN_PD1, 0); /* RXD1 */ | |
| 60 | - at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9263_ID_US1); | |
| 61 | -#endif | |
| 62 | - | |
| 63 | -#ifdef CONFIG_USART2 | |
| 64 | - at91_set_A_periph(AT91_PIN_PD2, 1); /* TXD2 */ | |
| 65 | - at91_set_A_periph(AT91_PIN_PD3, 0); /* RXD2 */ | |
| 66 | - at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9263_ID_US2); | |
| 67 | -#endif | |
| 68 | - | |
| 69 | -#ifdef CONFIG_USART3 /* DBGU */ | |
| 70 | - at91_set_A_periph(AT91_PIN_PC30, 0); /* DRXD */ | |
| 71 | - at91_set_A_periph(AT91_PIN_PC31, 1); /* DTXD */ | |
| 72 | - at91_sys_write(AT91_PMC_PCER, 1 << AT91_ID_SYS); | |
| 73 | -#endif | |
| 74 | -} | |
| 75 | - | |
| 76 | 50 | #ifdef CONFIG_CMD_NAND |
| 77 | 51 | static void at91sam9263ek_nand_hw_init(void) |
| 78 | 52 | { |
| ... | ... | @@ -301,7 +275,7 @@ |
| 301 | 275 | /* adress of boot parameters */ |
| 302 | 276 | gd->bd->bi_boot_params = PHYS_SDRAM + 0x100; |
| 303 | 277 | |
| 304 | - at91sam9263ek_serial_hw_init(); | |
| 278 | + at91_serial_hw_init(); | |
| 305 | 279 | #ifdef CONFIG_CMD_NAND |
| 306 | 280 | at91sam9263ek_nand_hw_init(); |
| 307 | 281 | #endif |
board/atmel/at91sam9rlek/at91sam9rlek.c
| ... | ... | @@ -26,6 +26,7 @@ |
| 26 | 26 | #include <asm/arch/at91sam9rl.h> |
| 27 | 27 | #include <asm/arch/at91sam9rl_matrix.h> |
| 28 | 28 | #include <asm/arch/at91sam9_smc.h> |
| 29 | +#include <asm/arch/at91_common.h> | |
| 29 | 30 | #include <asm/arch/at91_pmc.h> |
| 30 | 31 | #include <asm/arch/at91_rstc.h> |
| 31 | 32 | #include <asm/arch/gpio.h> |
| ... | ... | @@ -43,33 +44,6 @@ |
| 43 | 44 | * Miscelaneous platform dependent initialisations |
| 44 | 45 | */ |
| 45 | 46 | |
| 46 | -static void at91sam9rlek_serial_hw_init(void) | |
| 47 | -{ | |
| 48 | -#ifdef CONFIG_USART0 | |
| 49 | - at91_set_A_periph(AT91_PIN_PA6, 1); /* TXD0 */ | |
| 50 | - at91_set_A_periph(AT91_PIN_PA7, 0); /* RXD0 */ | |
| 51 | - at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9RL_ID_US0); | |
| 52 | -#endif | |
| 53 | - | |
| 54 | -#ifdef CONFIG_USART1 | |
| 55 | - at91_set_A_periph(AT91_PIN_PA11, 1); /* TXD1 */ | |
| 56 | - at91_set_A_periph(AT91_PIN_PA12, 0); /* RXD1 */ | |
| 57 | - at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9RL_ID_US1); | |
| 58 | -#endif | |
| 59 | - | |
| 60 | -#ifdef CONFIG_USART2 | |
| 61 | - at91_set_A_periph(AT91_PIN_PA13, 1); /* TXD2 */ | |
| 62 | - at91_set_A_periph(AT91_PIN_PA14, 0); /* RXD2 */ | |
| 63 | - at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9RL_ID_US2); | |
| 64 | -#endif | |
| 65 | - | |
| 66 | -#ifdef CONFIG_USART3 /* DBGU */ | |
| 67 | - at91_set_A_periph(AT91_PIN_PA21, 0); /* DRXD */ | |
| 68 | - at91_set_A_periph(AT91_PIN_PA22, 1); /* DTXD */ | |
| 69 | - at91_sys_write(AT91_PMC_PCER, 1 << AT91_ID_SYS); | |
| 70 | -#endif | |
| 71 | -} | |
| 72 | - | |
| 73 | 47 | #ifdef CONFIG_CMD_NAND |
| 74 | 48 | static void at91sam9rlek_nand_hw_init(void) |
| 75 | 49 | { |
| ... | ... | @@ -223,7 +197,7 @@ |
| 223 | 197 | /* adress of boot parameters */ |
| 224 | 198 | gd->bd->bi_boot_params = PHYS_SDRAM + 0x100; |
| 225 | 199 | |
| 226 | - at91sam9rlek_serial_hw_init(); | |
| 200 | + at91_serial_hw_init(); | |
| 227 | 201 | #ifdef CONFIG_CMD_NAND |
| 228 | 202 | at91sam9rlek_nand_hw_init(); |
| 229 | 203 | #endif |
cpu/arm926ejs/at91/Makefile
| ... | ... | @@ -25,8 +25,13 @@ |
| 25 | 25 | |
| 26 | 26 | LIB = $(obj)lib$(SOC).a |
| 27 | 27 | |
| 28 | +COBJS-$(CONFIG_AT91CAP9) += at91cap9_serial.o | |
| 29 | +COBJS-$(CONFIG_AT91SAM9260) += at91sam9260_serial.o | |
| 30 | +COBJS-$(CONFIG_AT91SAM9261) += at91sam9261_serial.o | |
| 31 | +COBJS-$(CONFIG_AT91SAM9263) += at91sam9263_serial.o | |
| 32 | +COBJS-$(CONFIG_AT91SAM9RL) += at91sam9rl_serial.o | |
| 33 | +COBJS-$(CONFIG_HAS_DATAFLASH) += spi.o | |
| 28 | 34 | COBJS-y += timer.o |
| 29 | -COBJS-$(CONFIG_HAS_DATAFLASH) +=spi.o | |
| 30 | 35 | COBJS-y += usb.o |
| 31 | 36 | SOBJS = lowlevel_init.o |
| 32 | 37 |
cpu/arm926ejs/at91/at91cap9_serial.c
| 1 | +/* | |
| 2 | + * (C) Copyright 2007-2008 | |
| 3 | + * Stelian Pop <stelian.pop@leadtechdesign.com> | |
| 4 | + * Lead Tech Design <www.leadtechdesign.com> | |
| 5 | + * | |
| 6 | + * See file CREDITS for list of people who contributed to this | |
| 7 | + * project. | |
| 8 | + * | |
| 9 | + * This program is free software; you can redistribute it and/or | |
| 10 | + * modify it under the terms of the GNU General Public License as | |
| 11 | + * published by the Free Software Foundation; either version 2 of | |
| 12 | + * the License, or (at your option) any later version. | |
| 13 | + * | |
| 14 | + * This program is distributed in the hope that it will be useful, | |
| 15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 17 | + * GNU General Public License for more details. | |
| 18 | + * | |
| 19 | + * You should have received a copy of the GNU General Public License | |
| 20 | + * along with this program; if not, write to the Free Software | |
| 21 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | |
| 22 | + * MA 02111-1307 USA | |
| 23 | + */ | |
| 24 | + | |
| 25 | +#include <common.h> | |
| 26 | +#include <asm/arch/at91_common.h> | |
| 27 | +#include <asm/arch/at91_pmc.h> | |
| 28 | +#include <asm/arch/gpio.h> | |
| 29 | +#include <asm/arch/io.h> | |
| 30 | + | |
| 31 | +void at91_serial0_hw_init(void) | |
| 32 | +{ | |
| 33 | + at91_set_A_periph(AT91_PIN_PA22, 1); /* TXD0 */ | |
| 34 | + at91_set_A_periph(AT91_PIN_PA23, 0); /* RXD0 */ | |
| 35 | + at91_sys_write(AT91_PMC_PCER, 1 << AT91CAP9_ID_US0); | |
| 36 | +} | |
| 37 | + | |
| 38 | +void at91_serial1_hw_init(void) | |
| 39 | +{ | |
| 40 | + at91_set_A_periph(AT91_PIN_PD0, 1); /* TXD1 */ | |
| 41 | + at91_set_A_periph(AT91_PIN_PD1, 0); /* RXD1 */ | |
| 42 | + at91_sys_write(AT91_PMC_PCER, 1 << AT91CAP9_ID_US1); | |
| 43 | +} | |
| 44 | + | |
| 45 | +void at91_serial2_hw_init(void) | |
| 46 | +{ | |
| 47 | + at91_set_A_periph(AT91_PIN_PD2, 1); /* TXD2 */ | |
| 48 | + at91_set_A_periph(AT91_PIN_PD3, 0); /* RXD2 */ | |
| 49 | + at91_sys_write(AT91_PMC_PCER, 1 << AT91CAP9_ID_US2); | |
| 50 | +} | |
| 51 | + | |
| 52 | +void at91_serial3_hw_init(void) | |
| 53 | +{ | |
| 54 | + at91_set_A_periph(AT91_PIN_PC30, 0); /* DRXD */ | |
| 55 | + at91_set_A_periph(AT91_PIN_PC31, 1); /* DTXD */ | |
| 56 | + at91_sys_write(AT91_PMC_PCER, 1 << AT91_ID_SYS); | |
| 57 | +} | |
| 58 | + | |
| 59 | +void at91_serial_hw_init(void) | |
| 60 | +{ | |
| 61 | +#ifdef CONFIG_USART0 | |
| 62 | + at91_serial0_hw_init(); | |
| 63 | +#endif | |
| 64 | + | |
| 65 | +#ifdef CONFIG_USART1 | |
| 66 | + at91_serial1_hw_init(); | |
| 67 | +#endif | |
| 68 | + | |
| 69 | +#ifdef CONFIG_USART2 | |
| 70 | + at91_serial2_hw_init(); | |
| 71 | +#endif | |
| 72 | + | |
| 73 | +#ifdef CONFIG_USART3 /* DBGU */ | |
| 74 | + at91_serial3_hw_init(); | |
| 75 | +#endif | |
| 76 | +} |
cpu/arm926ejs/at91/at91sam9260_serial.c
| 1 | +/* | |
| 2 | + * (C) Copyright 2007-2008 | |
| 3 | + * Stelian Pop <stelian.pop@leadtechdesign.com> | |
| 4 | + * Lead Tech Design <www.leadtechdesign.com> | |
| 5 | + * | |
| 6 | + * See file CREDITS for list of people who contributed to this | |
| 7 | + * project. | |
| 8 | + * | |
| 9 | + * This program is free software; you can redistribute it and/or | |
| 10 | + * modify it under the terms of the GNU General Public License as | |
| 11 | + * published by the Free Software Foundation; either version 2 of | |
| 12 | + * the License, or (at your option) any later version. | |
| 13 | + * | |
| 14 | + * This program is distributed in the hope that it will be useful, | |
| 15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 17 | + * GNU General Public License for more details. | |
| 18 | + * | |
| 19 | + * You should have received a copy of the GNU General Public License | |
| 20 | + * along with this program; if not, write to the Free Software | |
| 21 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | |
| 22 | + * MA 02111-1307 USA | |
| 23 | + */ | |
| 24 | + | |
| 25 | +#include <common.h> | |
| 26 | +#include <asm/arch/at91_common.h> | |
| 27 | +#include <asm/arch/at91_pmc.h> | |
| 28 | +#include <asm/arch/gpio.h> | |
| 29 | +#include <asm/arch/io.h> | |
| 30 | + | |
| 31 | +void at91_serial0_hw_init(void) | |
| 32 | +{ | |
| 33 | + at91_set_A_periph(AT91_PIN_PB4, 1); /* TXD0 */ | |
| 34 | + at91_set_A_periph(AT91_PIN_PB5, 0); /* RXD0 */ | |
| 35 | + at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9260_ID_US0); | |
| 36 | +} | |
| 37 | + | |
| 38 | +void at91_serial1_hw_init(void) | |
| 39 | +{ | |
| 40 | + at91_set_A_periph(AT91_PIN_PB6, 1); /* TXD1 */ | |
| 41 | + at91_set_A_periph(AT91_PIN_PB7, 0); /* RXD1 */ | |
| 42 | + at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9260_ID_US1); | |
| 43 | +} | |
| 44 | + | |
| 45 | +void at91_serial2_hw_init(void) | |
| 46 | +{ | |
| 47 | + at91_set_A_periph(AT91_PIN_PB8, 1); /* TXD2 */ | |
| 48 | + at91_set_A_periph(AT91_PIN_PB9, 0); /* RXD2 */ | |
| 49 | + at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9260_ID_US2); | |
| 50 | +} | |
| 51 | + | |
| 52 | +void at91_serial3_hw_init(void) | |
| 53 | +{ | |
| 54 | + at91_set_A_periph(AT91_PIN_PB14, 0); /* DRXD */ | |
| 55 | + at91_set_A_periph(AT91_PIN_PB15, 1); /* DTXD */ | |
| 56 | + at91_sys_write(AT91_PMC_PCER, 1 << AT91_ID_SYS); | |
| 57 | +} | |
| 58 | + | |
| 59 | +void at91_serial_hw_init(void) | |
| 60 | +{ | |
| 61 | +#ifdef CONFIG_USART0 | |
| 62 | + at91_serial0_hw_init(); | |
| 63 | +#endif | |
| 64 | + | |
| 65 | +#ifdef CONFIG_USART1 | |
| 66 | + at91_serial1_hw_init(); | |
| 67 | +#endif | |
| 68 | + | |
| 69 | +#ifdef CONFIG_USART2 | |
| 70 | + at91_serial2_hw_init(); | |
| 71 | +#endif | |
| 72 | + | |
| 73 | +#ifdef CONFIG_USART3 /* DBGU */ | |
| 74 | + at91_serial3_hw_init(); | |
| 75 | +#endif | |
| 76 | +} |
cpu/arm926ejs/at91/at91sam9261_serial.c
| 1 | +/* | |
| 2 | + * (C) Copyright 2007-2008 | |
| 3 | + * Stelian Pop <stelian.pop@leadtechdesign.com> | |
| 4 | + * Lead Tech Design <www.leadtechdesign.com> | |
| 5 | + * | |
| 6 | + * See file CREDITS for list of people who contributed to this | |
| 7 | + * project. | |
| 8 | + * | |
| 9 | + * This program is free software; you can redistribute it and/or | |
| 10 | + * modify it under the terms of the GNU General Public License as | |
| 11 | + * published by the Free Software Foundation; either version 2 of | |
| 12 | + * the License, or (at your option) any later version. | |
| 13 | + * | |
| 14 | + * This program is distributed in the hope that it will be useful, | |
| 15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 17 | + * GNU General Public License for more details. | |
| 18 | + * | |
| 19 | + * You should have received a copy of the GNU General Public License | |
| 20 | + * along with this program; if not, write to the Free Software | |
| 21 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | |
| 22 | + * MA 02111-1307 USA | |
| 23 | + */ | |
| 24 | + | |
| 25 | +#include <common.h> | |
| 26 | +#include <asm/arch/at91_common.h> | |
| 27 | +#include <asm/arch/at91_pmc.h> | |
| 28 | +#include <asm/arch/gpio.h> | |
| 29 | +#include <asm/arch/io.h> | |
| 30 | + | |
| 31 | +void at91_serial0_hw_init(void) | |
| 32 | +{ | |
| 33 | + at91_set_A_periph(AT91_PIN_PC8, 1); /* TXD0 */ | |
| 34 | + at91_set_A_periph(AT91_PIN_PC9, 0); /* RXD0 */ | |
| 35 | + at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9261_ID_US0); | |
| 36 | +} | |
| 37 | + | |
| 38 | +void at91_serial1_hw_init(void) | |
| 39 | +{ | |
| 40 | + at91_set_A_periph(AT91_PIN_PC12, 1); /* TXD1 */ | |
| 41 | + at91_set_A_periph(AT91_PIN_PC13, 0); /* RXD1 */ | |
| 42 | + at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9261_ID_US1); | |
| 43 | +} | |
| 44 | + | |
| 45 | +void at91_serial2_hw_init(void) | |
| 46 | +{ | |
| 47 | + at91_set_A_periph(AT91_PIN_PC14, 1); /* TXD2 */ | |
| 48 | + at91_set_A_periph(AT91_PIN_PC15, 0); /* RXD2 */ | |
| 49 | + at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9261_ID_US2); | |
| 50 | +} | |
| 51 | + | |
| 52 | +void at91_serial3_hw_init(void) | |
| 53 | +{ | |
| 54 | + at91_set_A_periph(AT91_PIN_PA9, 0); /* DRXD */ | |
| 55 | + at91_set_A_periph(AT91_PIN_PA10, 1); /* DTXD */ | |
| 56 | + at91_sys_write(AT91_PMC_PCER, 1 << AT91_ID_SYS); | |
| 57 | +} | |
| 58 | + | |
| 59 | +void at91_serial_hw_init(void) | |
| 60 | +{ | |
| 61 | +#ifdef CONFIG_USART0 | |
| 62 | + at91_serial0_hw_init(); | |
| 63 | +#endif | |
| 64 | + | |
| 65 | +#ifdef CONFIG_USART1 | |
| 66 | + at91_serial1_hw_init(); | |
| 67 | +#endif | |
| 68 | + | |
| 69 | +#ifdef CONFIG_USART2 | |
| 70 | + at91_serial2_hw_init(); | |
| 71 | +#endif | |
| 72 | + | |
| 73 | +#ifdef CONFIG_USART3 /* DBGU */ | |
| 74 | + at91_serial3_hw_init(); | |
| 75 | +#endif | |
| 76 | +} |
cpu/arm926ejs/at91/at91sam9263_serial.c
| 1 | +/* | |
| 2 | + * (C) Copyright 2007-2008 | |
| 3 | + * Stelian Pop <stelian.pop@leadtechdesign.com> | |
| 4 | + * Lead Tech Design <www.leadtechdesign.com> | |
| 5 | + * | |
| 6 | + * See file CREDITS for list of people who contributed to this | |
| 7 | + * project. | |
| 8 | + * | |
| 9 | + * This program is free software; you can redistribute it and/or | |
| 10 | + * modify it under the terms of the GNU General Public License as | |
| 11 | + * published by the Free Software Foundation; either version 2 of | |
| 12 | + * the License, or (at your option) any later version. | |
| 13 | + * | |
| 14 | + * This program is distributed in the hope that it will be useful, | |
| 15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 17 | + * GNU General Public License for more details. | |
| 18 | + * | |
| 19 | + * You should have received a copy of the GNU General Public License | |
| 20 | + * along with this program; if not, write to the Free Software | |
| 21 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | |
| 22 | + * MA 02111-1307 USA | |
| 23 | + */ | |
| 24 | + | |
| 25 | +#include <common.h> | |
| 26 | +#include <asm/arch/at91_common.h> | |
| 27 | +#include <asm/arch/at91_pmc.h> | |
| 28 | +#include <asm/arch/gpio.h> | |
| 29 | +#include <asm/arch/io.h> | |
| 30 | + | |
| 31 | +void at91_serial0_hw_init(void) | |
| 32 | +{ | |
| 33 | + at91_set_A_periph(AT91_PIN_PA26, 1); /* TXD0 */ | |
| 34 | + at91_set_A_periph(AT91_PIN_PA27, 0); /* RXD0 */ | |
| 35 | + at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9263_ID_US0); | |
| 36 | +} | |
| 37 | + | |
| 38 | +void at91_serial1_hw_init(void) | |
| 39 | +{ | |
| 40 | + at91_set_A_periph(AT91_PIN_PD0, 1); /* TXD1 */ | |
| 41 | + at91_set_A_periph(AT91_PIN_PD1, 0); /* RXD1 */ | |
| 42 | + at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9263_ID_US1); | |
| 43 | +} | |
| 44 | + | |
| 45 | +void at91_serial2_hw_init(void) | |
| 46 | +{ | |
| 47 | + at91_set_A_periph(AT91_PIN_PD2, 1); /* TXD2 */ | |
| 48 | + at91_set_A_periph(AT91_PIN_PD3, 0); /* RXD2 */ | |
| 49 | + at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9263_ID_US2); | |
| 50 | +} | |
| 51 | + | |
| 52 | +void at91_serial3_hw_init(void) | |
| 53 | +{ | |
| 54 | + at91_set_A_periph(AT91_PIN_PC30, 0); /* DRXD */ | |
| 55 | + at91_set_A_periph(AT91_PIN_PC31, 1); /* DTXD */ | |
| 56 | + at91_sys_write(AT91_PMC_PCER, 1 << AT91_ID_SYS); | |
| 57 | +} | |
| 58 | + | |
| 59 | +void at91_serial_hw_init(void) | |
| 60 | +{ | |
| 61 | +#ifdef CONFIG_USART0 | |
| 62 | + at91_serial0_hw_init(); | |
| 63 | +#endif | |
| 64 | + | |
| 65 | +#ifdef CONFIG_USART1 | |
| 66 | + at91_serial1_hw_init(); | |
| 67 | +#endif | |
| 68 | + | |
| 69 | +#ifdef CONFIG_USART2 | |
| 70 | + at91_serial2_hw_init(); | |
| 71 | +#endif | |
| 72 | + | |
| 73 | +#ifdef CONFIG_USART3 /* DBGU */ | |
| 74 | + at91_serial3_hw_init(); | |
| 75 | +#endif | |
| 76 | +} |
cpu/arm926ejs/at91/at91sam9rl_serial.c
| 1 | +/* | |
| 2 | + * (C) Copyright 2007-2008 | |
| 3 | + * Stelian Pop <stelian.pop@leadtechdesign.com> | |
| 4 | + * Lead Tech Design <www.leadtechdesign.com> | |
| 5 | + * | |
| 6 | + * See file CREDITS for list of people who contributed to this | |
| 7 | + * project. | |
| 8 | + * | |
| 9 | + * This program is free software; you can redistribute it and/or | |
| 10 | + * modify it under the terms of the GNU General Public License as | |
| 11 | + * published by the Free Software Foundation; either version 2 of | |
| 12 | + * the License, or (at your option) any later version. | |
| 13 | + * | |
| 14 | + * This program is distributed in the hope that it will be useful, | |
| 15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 17 | + * GNU General Public License for more details. | |
| 18 | + * | |
| 19 | + * You should have received a copy of the GNU General Public License | |
| 20 | + * along with this program; if not, write to the Free Software | |
| 21 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | |
| 22 | + * MA 02111-1307 USA | |
| 23 | + */ | |
| 24 | + | |
| 25 | +#include <common.h> | |
| 26 | +#include <asm/arch/at91_common.h> | |
| 27 | +#include <asm/arch/at91_pmc.h> | |
| 28 | +#include <asm/arch/gpio.h> | |
| 29 | +#include <asm/arch/io.h> | |
| 30 | + | |
| 31 | +void at91_serial0_hw_init(void) | |
| 32 | +{ | |
| 33 | + at91_set_A_periph(AT91_PIN_PA6, 1); /* TXD0 */ | |
| 34 | + at91_set_A_periph(AT91_PIN_PA7, 0); /* RXD0 */ | |
| 35 | + at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9RL_ID_US0); | |
| 36 | +} | |
| 37 | + | |
| 38 | +void at91_serial1_hw_init(void) | |
| 39 | +{ | |
| 40 | + at91_set_A_periph(AT91_PIN_PA11, 1); /* TXD1 */ | |
| 41 | + at91_set_A_periph(AT91_PIN_PA12, 0); /* RXD1 */ | |
| 42 | + at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9RL_ID_US1); | |
| 43 | +} | |
| 44 | + | |
| 45 | +void at91_serial2_hw_init(void) | |
| 46 | +{ | |
| 47 | + at91_set_A_periph(AT91_PIN_PA13, 1); /* TXD2 */ | |
| 48 | + at91_set_A_periph(AT91_PIN_PA14, 0); /* RXD2 */ | |
| 49 | + at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9RL_ID_US2); | |
| 50 | +} | |
| 51 | + | |
| 52 | +void at91_serial3_hw_init(void) | |
| 53 | +{ | |
| 54 | + at91_set_A_periph(AT91_PIN_PA21, 0); /* DRXD */ | |
| 55 | + at91_set_A_periph(AT91_PIN_PA22, 1); /* DTXD */ | |
| 56 | + at91_sys_write(AT91_PMC_PCER, 1 << AT91_ID_SYS); | |
| 57 | +} | |
| 58 | + | |
| 59 | +void at91_serial_hw_init(void) | |
| 60 | +{ | |
| 61 | +#ifdef CONFIG_USART0 | |
| 62 | + at91_serial0_hw_init(); | |
| 63 | +#endif | |
| 64 | + | |
| 65 | +#ifdef CONFIG_USART1 | |
| 66 | + at91_serial1_hw_init(); | |
| 67 | +#endif | |
| 68 | + | |
| 69 | +#ifdef CONFIG_USART2 | |
| 70 | + at91_serial2_hw_init(); | |
| 71 | +#endif | |
| 72 | + | |
| 73 | +#ifdef CONFIG_USART3 /* DBGU */ | |
| 74 | + at91_serial3_hw_init(); | |
| 75 | +#endif | |
| 76 | +} |
include/asm-arm/arch-at91/at91_common.h
| 1 | +/* | |
| 2 | + * (C) Copyright 2007-2008 | |
| 3 | + * Stelian Pop <stelian.pop@leadtechdesign.com> | |
| 4 | + * Lead Tech Design <www.leadtechdesign.com> | |
| 5 | + * | |
| 6 | + * See file CREDITS for list of people who contributed to this | |
| 7 | + * project. | |
| 8 | + * | |
| 9 | + * This program is free software; you can redistribute it and/or | |
| 10 | + * modify it under the terms of the GNU General Public License as | |
| 11 | + * published by the Free Software Foundation; either version 2 of | |
| 12 | + * the License, or (at your option) any later version. | |
| 13 | + * | |
| 14 | + * This program is distributed in the hope that it will be useful, | |
| 15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 17 | + * GNU General Public License for more details. | |
| 18 | + * | |
| 19 | + * You should have received a copy of the GNU General Public License | |
| 20 | + * along with this program; if not, write to the Free Software | |
| 21 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | |
| 22 | + * MA 02111-1307 USA | |
| 23 | + */ | |
| 24 | + | |
| 25 | +#ifndef AT91_COMMON_H | |
| 26 | +#define AT91_COMMON_H | |
| 27 | + | |
| 28 | +void at91_serial_hw_init(void); | |
| 29 | +void at91_serial0_hw_init(void); | |
| 30 | +void at91_serial1_hw_init(void); | |
| 31 | +void at91_serial2_hw_init(void); | |
| 32 | +void at91_serial3_hw_init(void); | |
| 33 | + | |
| 34 | +#endif /* AT91_COMMON_H */ |