portmux.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*
  2. * Copyright (C) 2006, 2008 Atmel Corporation
  3. *
  4. * SPDX-License-Identifier: GPL-2.0+
  5. */
  6. #ifndef __ASM_AVR32_ARCH_PORTMUX_H__
  7. #define __ASM_AVR32_ARCH_PORTMUX_H__
  8. #include <asm/arch/gpio.h>
  9. #define PORTMUX_PORT_A ((void *)ATMEL_BASE_PIOA)
  10. #define PORTMUX_PORT_B ((void *)ATMEL_BASE_PIOB)
  11. #define PORTMUX_PORT_C ((void *)ATMEL_BASE_PIOC)
  12. #define PORTMUX_PORT_D ((void *)ATMEL_BASE_PIOD)
  13. #define PORTMUX_PORT_E ((void *)ATMEL_BASE_PIOE)
  14. void portmux_enable_ebi(unsigned int bus_width, unsigned int addr_width,
  15. unsigned long flags, unsigned long drive_strength);
  16. #define PORTMUX_EBI_CS(x) (1 << (x))
  17. #define PORTMUX_EBI_NAND (1 << 6)
  18. #define PORTMUX_EBI_CF(x) (1 << ((x) + 7))
  19. #define PORTMUX_EBI_NWAIT (1 << 9)
  20. #ifdef AT32AP700x_CHIP_HAS_USART
  21. static inline void portmux_enable_usart0(unsigned long drive_strength)
  22. {
  23. portmux_select_peripheral(PORTMUX_PORT_A, (1 << 8) | (1 << 9),
  24. PORTMUX_FUNC_B, 0);
  25. }
  26. static inline void portmux_enable_usart1(unsigned long drive_strength)
  27. {
  28. portmux_select_peripheral(PORTMUX_PORT_A, (1 << 17) | (1 << 18),
  29. PORTMUX_FUNC_A, 0);
  30. }
  31. static inline void portmux_enable_usart2(unsigned long drive_strength)
  32. {
  33. portmux_select_peripheral(PORTMUX_PORT_B, (1 << 26) | (1 << 27),
  34. PORTMUX_FUNC_B, 0);
  35. }
  36. static inline void portmux_enable_usart3(unsigned long drive_strength)
  37. {
  38. portmux_select_peripheral(PORTMUX_PORT_B, (1 << 17) | (1 << 18),
  39. PORTMUX_FUNC_B, 0);
  40. }
  41. #endif
  42. #ifdef AT32AP700x_CHIP_HAS_MACB
  43. void portmux_enable_macb0(unsigned long flags, unsigned long drive_strength);
  44. void portmux_enable_macb1(unsigned long flags, unsigned long drive_strength);
  45. #define PORTMUX_MACB_RMII (0)
  46. #define PORTMUX_MACB_MII (1 << 0)
  47. #define PORTMUX_MACB_SPEED (1 << 1)
  48. #endif
  49. #ifdef AT32AP700x_CHIP_HAS_MMCI
  50. void portmux_enable_mmci(unsigned int slot, unsigned long flags,
  51. unsigned long drive_strength);
  52. #define PORTMUX_MMCI_4BIT (1 << 0)
  53. #define PORTMUX_MMCI_8BIT (PORTMUX_MMCI_4BIT | (1 << 1))
  54. #define PORTMUX_MMCI_EXT_PULLUP (1 << 2)
  55. #endif
  56. #ifdef AT32AP700x_CHIP_HAS_SPI
  57. void portmux_enable_spi0(unsigned long cs_mask, unsigned long drive_strength);
  58. void portmux_enable_spi1(unsigned long cs_mask, unsigned long drive_strength);
  59. #endif
  60. #ifdef AT32AP700x_CHIP_HAS_LCDC
  61. void portmux_enable_lcdc(int pin_config);
  62. #endif
  63. #endif /* __ASM_AVR32_ARCH_PORTMUX_H__ */