Haavard Skinnemoen | 610b362 | 2008-08-29 21:09:49 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2006, 2008 Atmel Corporation |
| 3 | * |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 4 | * SPDX-License-Identifier: GPL-2.0+ |
Haavard Skinnemoen | 610b362 | 2008-08-29 21:09:49 +0200 | [diff] [blame] | 5 | */ |
| 6 | #ifndef __ASM_AVR32_ARCH_PORTMUX_H__ |
| 7 | #define __ASM_AVR32_ARCH_PORTMUX_H__ |
| 8 | |
| 9 | #include <asm/arch/gpio.h> |
| 10 | |
Andreas Bießmann | 5807e79 | 2010-11-04 23:15:31 +0000 | [diff] [blame] | 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) |
Haavard Skinnemoen | 610b362 | 2008-08-29 21:09:49 +0200 | [diff] [blame] | 16 | |
| 17 | void 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 |
| 26 | static 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 | |
| 32 | static 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 | |
| 38 | static 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 | |
| 44 | static 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 |
| 51 | void portmux_enable_macb0(unsigned long flags, unsigned long drive_strength); |
| 52 | void 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 |
| 60 | void 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 |
| 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); |
| 71 | #endif |
Mark Jackson | c563e48 | 2009-07-21 11:11:37 +0100 | [diff] [blame] | 72 | #ifdef AT32AP700x_CHIP_HAS_LCDC |
| 73 | void portmux_enable_lcdc(int pin_config); |
| 74 | #endif |
Haavard Skinnemoen | 610b362 | 2008-08-29 21:09:49 +0200 | [diff] [blame] | 75 | |
| 76 | #endif /* __ASM_AVR32_ARCH_PORTMUX_H__ */ |