OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [include/] [asm-arm/] [arch-at91rm9200/] [pio.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1276 phoenix
/*
2
 * linux/include/asm-arm/arch-at91rm9200/pio.h
3
 *
4
 *  Copyright (c) 2003 SAN People
5
 *
6
 * This program is free software; you can redistribute it and/or modify
7
 * it under the terms of the GNU General Public License as published by
8
 * the Free Software Foundation; either version 2 of the License, or
9
 * (at your option) any later version.
10
 *
11
 */
12
 
13
#ifndef __ASM_ARCH_PIO_H
14
#define __ASM_ARCH_PIO_H
15
 
16
#include <asm/arch/hardware.h>
17
 
18
static inline void AT91_CfgPIO_USART0(void) {
19
        AT91_SYS->PIOA_PDR = AT91C_PA17_TXD0 | AT91C_PA18_RXD0
20
                | AT91C_PA20_CTS0 | AT91C_PA21_RTS0;
21
}
22
 
23
static inline void AT91_CfgPIO_USART1(void) {
24
        AT91_SYS->PIOB_PDR = AT91C_PB18_RI1 | AT91C_PB19_DTR1
25
                | AT91C_PB20_TXD1 | AT91C_PB21_RXD1 | AT91C_PB23_DCD1
26
                | AT91C_PB24_CTS1 | AT91C_PB25_DSR1 | AT91C_PB26_RTS1;
27
}
28
 
29
static inline void AT91_CfgPIO_USART2(void) {
30
        AT91_SYS->PIOA_PDR = AT91C_PA22_RXD2 | AT91C_PA23_TXD2;
31
}
32
 
33
static inline void AT91_CfgPIO_USART3(void) {
34
        AT91_SYS->PIOA_PDR = AT91C_PA5_TXD3 | AT91C_PA6_RXD3;
35
        AT91_SYS->PIOA_BSR = AT91C_PA5_TXD3 | AT91C_PA6_RXD3;
36
}
37
 
38
static inline void AT91_CfgPIO_DBGU(void) {
39
        AT91_SYS->PIOA_PDR = AT91C_PA31_DTXD | AT91C_PA30_DRXD;
40
}
41
 
42
/*
43
 * Configure Ethernet for RMII mode.
44
 */
45
static inline void AT91_CfgPIO_EMAC_RMII(void) {
46
        AT91_SYS->PIOA_PDR = AT91C_PA16_EMDIO | AT91C_PA15_EMDC | AT91C_PA14_ERXER | AT91C_PA13_ERX1
47
                | AT91C_PA12_ERX0 | AT91C_PA11_ECRS_ECRSDV | AT91C_PA10_ETX1
48
                | AT91C_PA9_ETX0 | AT91C_PA8_ETXEN | AT91C_PA7_ETXCK_EREFCK;
49
        AT91_SYS->PIOB_PDR = AT91C_PB25_EF100 | AT91C_PB19_ERXCK;
50
        AT91_SYS->PIOB_BSR = AT91C_PB25_EF100 | AT91C_PB19_ERXCK;
51
}
52
 
53
/*
54
 * Configure Ethernet for MII mode.
55
 */
56
static inline void AT91_CfgPIO_EMAC_MII(void) {
57
        AT91_SYS->PIOA_PDR = AT91C_PA16_EMDIO | AT91C_PA15_EMDC | AT91C_PA14_ERXER | AT91C_PA13_ERX1
58
                | AT91C_PA12_ERX0 | AT91C_PA11_ECRS_ECRSDV | AT91C_PA10_ETX1
59
                | AT91C_PA9_ETX0 | AT91C_PA8_ETXEN | AT91C_PA7_ETXCK_EREFCK;
60
        AT91_SYS->PIOB_PDR = AT91C_PB25_EF100 | AT91C_PB19_ERXCK | AT91C_PB18_ECOL | AT91C_PB17_ERXDV
61
                | AT91C_PB16_ERX3 | AT91C_PB15_ERX2 | AT91C_PB14_ETXER | AT91C_PB13_ETX3
62
                | AT91C_PB12_ETX2;
63
        AT91_SYS->PIOB_BSR = AT91C_PB25_EF100 | AT91C_PB19_ERXCK | AT91C_PB18_ECOL | AT91C_PB17_ERXDV
64
                | AT91C_PB16_ERX3 | AT91C_PB15_ERX2 | AT91C_PB14_ETXER | AT91C_PB13_ETX3
65
                | AT91C_PB12_ETX2;
66
}
67
 
68
/*
69
 * Enable the Two-Wire interface.
70
 */
71
static inline void AT91_CfgPIO_TWI(void) {
72
        AT91_SYS->PIOA_PDR = AT91C_PA25_TWD | AT91C_PA26_TWCK;
73
        AT91_SYS->PIOA_ASR = AT91C_PA25_TWD | AT91C_PA26_TWCK;
74
}
75
 
76
/*
77
 * Enable the Serial Peripheral Interface.
78
 */
79
static inline void AT91_CfgPIO_SPI(void) {
80
        AT91_SYS->PIOA_PDR = AT91C_PA0_MISO | AT91C_PA1_MOSI | AT91C_PA2_SPCK;
81
}
82
 
83
static inline void AT91_CfgPIO_SPI_CS0(void) {
84
        AT91_SYS->PIOA_PDR = AT91C_PA3_NPCS0;
85
}
86
 
87
static inline void AT91_CfgPIO_SPI_CS1(void) {
88
        AT91_SYS->PIOA_PDR = AT91C_PA4_NPCS1;
89
}
90
 
91
static inline void AT91_CfgPIO_SPI_CS2(void) {
92
        AT91_SYS->PIOA_PDR = AT91C_PA5_NPCS2;
93
}
94
 
95
static inline void AT91_CfgPIO_SPI_CS3(void) {
96
        AT91_SYS->PIOA_PDR = AT91C_PA6_NPCS3;
97
}
98
 
99
/*
100
 * Select the DataFlash card.
101
 */
102
static inline void AT91_CfgPIO_DataFlashCard(void) {
103
        AT91_SYS->PIOB_PER = AT91C_PIO_PB7;
104
        AT91_SYS->PIOB_OER = AT91C_PIO_PB7;
105
        AT91_SYS->PIOB_CODR = AT91C_PIO_PB7;
106
}
107
 
108
/*
109
 * Enable NAND Flash (SmartMedia) interface.
110
 */
111
static inline void AT91_CfgPIO_SmartMedia(void) {
112
        /* enable PC0=SMCE, PC1=SMOE, PC3=SMWE, A21=CLE, A22=ALE */
113
        AT91_SYS->PIOC_ASR = AT91C_PC0_BFCK | AT91C_PC1_BFRDY_SMOE | AT91C_PC3_BFBAA_SMWE;
114
        AT91_SYS->PIOC_PDR = AT91C_PC0_BFCK | AT91C_PC1_BFRDY_SMOE | AT91C_PC3_BFBAA_SMWE;
115
 
116
        /* Configure PC2 as input (signal READY of the SmartMedia) */
117
        AT91_SYS->PIOC_PER = AT91C_PC2_BFAVD;   /* enable direct output enable */
118
        AT91_SYS->PIOC_ODR = AT91C_PC2_BFAVD;   /* disable output */
119
 
120
        /* Configure PB1 as input (signal Card Detect of the SmartMedia) */
121
        AT91_SYS->PIOB_PER = AT91C_PIO_PB1;     /* enable direct output enable */
122
        AT91_SYS->PIOB_ODR = AT91C_PIO_PB1;     /* disable output */
123
}
124
 
125
static inline int AT91_PIO_SmartMedia_RDY(void) {
126
        return (AT91_SYS->PIOC_PDSR & AT91C_PIO_PC2) ? 1 : 0;
127
}
128
 
129
static inline int AT91_PIO_SmartMedia_CardDetect(void) {
130
        return (AT91_SYS->PIOB_PDSR & AT91C_PIO_PB1) ? 1 : 0;
131
}
132
 
133
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.