2 * Copyright (C) 2006, 2008 Atmel Corporation
4 * See file CREDITS for list of people who contributed to this
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of
10 * the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
22 #ifndef __ASM_AVR32_ARCH_PORTMUX_H__
23 #define __ASM_AVR32_ARCH_PORTMUX_H__
25 #include <asm/arch/gpio.h>
27 #define PORTMUX_PORT_A ((void *)ATMEL_BASE_PIOA)
28 #define PORTMUX_PORT_B ((void *)ATMEL_BASE_PIOB)
29 #define PORTMUX_PORT_C ((void *)ATMEL_BASE_PIOC)
30 #define PORTMUX_PORT_D ((void *)ATMEL_BASE_PIOD)
31 #define PORTMUX_PORT_E ((void *)ATMEL_BASE_PIOE)
33 void portmux_enable_ebi(unsigned int bus_width, unsigned int addr_width,
34 unsigned long flags, unsigned long drive_strength);
36 #define PORTMUX_EBI_CS(x) (1 << (x))
37 #define PORTMUX_EBI_NAND (1 << 6)
38 #define PORTMUX_EBI_CF(x) (1 << ((x) + 7))
39 #define PORTMUX_EBI_NWAIT (1 << 9)
41 #ifdef AT32AP700x_CHIP_HAS_USART
42 static inline void portmux_enable_usart0(unsigned long drive_strength)
44 portmux_select_peripheral(PORTMUX_PORT_A, (1 << 8) | (1 << 9),
48 static inline void portmux_enable_usart1(unsigned long drive_strength)
50 portmux_select_peripheral(PORTMUX_PORT_A, (1 << 17) | (1 << 18),
54 static inline void portmux_enable_usart2(unsigned long drive_strength)
56 portmux_select_peripheral(PORTMUX_PORT_B, (1 << 26) | (1 << 27),
60 static inline void portmux_enable_usart3(unsigned long drive_strength)
62 portmux_select_peripheral(PORTMUX_PORT_B, (1 << 17) | (1 << 18),
66 #ifdef AT32AP700x_CHIP_HAS_MACB
67 void portmux_enable_macb0(unsigned long flags, unsigned long drive_strength);
68 void portmux_enable_macb1(unsigned long flags, unsigned long drive_strength);
70 #define PORTMUX_MACB_RMII (0)
71 #define PORTMUX_MACB_MII (1 << 0)
72 #define PORTMUX_MACB_SPEED (1 << 1)
75 #ifdef AT32AP700x_CHIP_HAS_MMCI
76 void portmux_enable_mmci(unsigned int slot, unsigned long flags,
77 unsigned long drive_strength);
79 #define PORTMUX_MMCI_4BIT (1 << 0)
80 #define PORTMUX_MMCI_8BIT (PORTMUX_MMCI_4BIT | (1 << 1))
81 #define PORTMUX_MMCI_EXT_PULLUP (1 << 2)
84 #ifdef AT32AP700x_CHIP_HAS_SPI
85 void portmux_enable_spi0(unsigned long cs_mask, unsigned long drive_strength);
86 void portmux_enable_spi1(unsigned long cs_mask, unsigned long drive_strength);
88 #ifdef AT32AP700x_CHIP_HAS_LCDC
89 void portmux_enable_lcdc(int pin_config);
92 #endif /* __ASM_AVR32_ARCH_PORTMUX_H__ */