2 * Copyright (C) 2006, 2008 Atmel Corporation
4 * SPDX-License-Identifier: GPL-2.0+
6 #ifndef __ASM_AVR32_ARCH_PORTMUX_H__
7 #define __ASM_AVR32_ARCH_PORTMUX_H__
9 #include <asm/arch/gpio.h>
11 #define PORTMUX_PORT_A ((void *)ATMEL_BASE_PIOA)
12 #define PORTMUX_PORT_B ((void *)ATMEL_BASE_PIOB)
13 #define PORTMUX_PORT_C ((void *)ATMEL_BASE_PIOC)
14 #define PORTMUX_PORT_D ((void *)ATMEL_BASE_PIOD)
15 #define PORTMUX_PORT_E ((void *)ATMEL_BASE_PIOE)
17 void portmux_enable_ebi(unsigned int bus_width, unsigned int addr_width,
18 unsigned long flags, unsigned long drive_strength);
20 #define PORTMUX_EBI_CS(x) (1 << (x))
21 #define PORTMUX_EBI_NAND (1 << 6)
22 #define PORTMUX_EBI_CF(x) (1 << ((x) + 7))
23 #define PORTMUX_EBI_NWAIT (1 << 9)
25 #ifdef AT32AP700x_CHIP_HAS_USART
26 static inline void portmux_enable_usart0(unsigned long drive_strength)
28 portmux_select_peripheral(PORTMUX_PORT_A, (1 << 8) | (1 << 9),
32 static inline void portmux_enable_usart1(unsigned long drive_strength)
34 portmux_select_peripheral(PORTMUX_PORT_A, (1 << 17) | (1 << 18),
38 static inline void portmux_enable_usart2(unsigned long drive_strength)
40 portmux_select_peripheral(PORTMUX_PORT_B, (1 << 26) | (1 << 27),
44 static inline void portmux_enable_usart3(unsigned long drive_strength)
46 portmux_select_peripheral(PORTMUX_PORT_B, (1 << 17) | (1 << 18),
50 #ifdef AT32AP700x_CHIP_HAS_MACB
51 void portmux_enable_macb0(unsigned long flags, unsigned long drive_strength);
52 void portmux_enable_macb1(unsigned long flags, unsigned long drive_strength);
54 #define PORTMUX_MACB_RMII (0)
55 #define PORTMUX_MACB_MII (1 << 0)
56 #define PORTMUX_MACB_SPEED (1 << 1)
59 #ifdef AT32AP700x_CHIP_HAS_MMCI
60 void portmux_enable_mmci(unsigned int slot, unsigned long flags,
61 unsigned long drive_strength);
63 #define PORTMUX_MMCI_4BIT (1 << 0)
64 #define PORTMUX_MMCI_8BIT (PORTMUX_MMCI_4BIT | (1 << 1))
65 #define PORTMUX_MMCI_EXT_PULLUP (1 << 2)
68 #ifdef AT32AP700x_CHIP_HAS_SPI
69 void portmux_enable_spi0(unsigned long cs_mask, unsigned long drive_strength);
70 void portmux_enable_spi1(unsigned long cs_mask, unsigned long drive_strength);
72 #ifdef AT32AP700x_CHIP_HAS_LCDC
73 void portmux_enable_lcdc(int pin_config);
76 #endif /* __ASM_AVR32_ARCH_PORTMUX_H__ */