blob: 7ae05408c013f0b1499ebe797110ef93c2b57b93 [file] [log] [blame]
Haavard Skinnemoen610b3622008-08-29 21:09:49 +02001/*
2 * Copyright (C) 2006, 2008 Atmel Corporation
3 *
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02004 * SPDX-License-Identifier: GPL-2.0+
Haavard Skinnemoen610b3622008-08-29 21:09:49 +02005 */
6#ifndef __ASM_AVR32_ARCH_PORTMUX_H__
7#define __ASM_AVR32_ARCH_PORTMUX_H__
8
9#include <asm/arch/gpio.h>
10
Andreas Bießmann5807e792010-11-04 23:15:31 +000011#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)
Haavard Skinnemoen610b3622008-08-29 21:09:49 +020016
17void portmux_enable_ebi(unsigned int bus_width, unsigned int addr_width,
18 unsigned long flags, unsigned long drive_strength);
19
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)
24
25#ifdef AT32AP700x_CHIP_HAS_USART
26static inline void portmux_enable_usart0(unsigned long drive_strength)
27{
28 portmux_select_peripheral(PORTMUX_PORT_A, (1 << 8) | (1 << 9),
29 PORTMUX_FUNC_B, 0);
30}
31
32static inline void portmux_enable_usart1(unsigned long drive_strength)
33{
34 portmux_select_peripheral(PORTMUX_PORT_A, (1 << 17) | (1 << 18),
35 PORTMUX_FUNC_A, 0);
36}
37
38static inline void portmux_enable_usart2(unsigned long drive_strength)
39{
40 portmux_select_peripheral(PORTMUX_PORT_B, (1 << 26) | (1 << 27),
41 PORTMUX_FUNC_B, 0);
42}
43
44static inline void portmux_enable_usart3(unsigned long drive_strength)
45{
46 portmux_select_peripheral(PORTMUX_PORT_B, (1 << 17) | (1 << 18),
47 PORTMUX_FUNC_B, 0);
48}
49#endif
50#ifdef AT32AP700x_CHIP_HAS_MACB
51void portmux_enable_macb0(unsigned long flags, unsigned long drive_strength);
52void portmux_enable_macb1(unsigned long flags, unsigned long drive_strength);
53
54#define PORTMUX_MACB_RMII (0)
55#define PORTMUX_MACB_MII (1 << 0)
56#define PORTMUX_MACB_SPEED (1 << 1)
57
58#endif
59#ifdef AT32AP700x_CHIP_HAS_MMCI
60void portmux_enable_mmci(unsigned int slot, unsigned long flags,
61 unsigned long drive_strength);
62
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)
66
67#endif
68#ifdef AT32AP700x_CHIP_HAS_SPI
69void portmux_enable_spi0(unsigned long cs_mask, unsigned long drive_strength);
70void portmux_enable_spi1(unsigned long cs_mask, unsigned long drive_strength);
71#endif
Mark Jacksonc563e482009-07-21 11:11:37 +010072#ifdef AT32AP700x_CHIP_HAS_LCDC
73void portmux_enable_lcdc(int pin_config);
74#endif
Haavard Skinnemoen610b3622008-08-29 21:09:49 +020075
76#endif /* __ASM_AVR32_ARCH_PORTMUX_H__ */