funcmux.c 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * Copyright (c) 2010-2012, NVIDIA CORPORATION. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: GPL-2.0
  5. */
  6. /* Tegra30 high-level function multiplexing */
  7. #include <common.h>
  8. #include <asm/arch/clock.h>
  9. #include <asm/arch/funcmux.h>
  10. #include <asm/arch/pinmux.h>
  11. int funcmux_select(enum periph_id id, int config)
  12. {
  13. int bad_config = config != FUNCMUX_DEFAULT;
  14. switch (id) {
  15. case PERIPH_ID_UART1:
  16. switch (config) {
  17. case FUNCMUX_UART1_ULPI:
  18. pinmux_set_func(PMUX_PINGRP_ULPI_DATA0_PO1,
  19. PMUX_FUNC_UARTA);
  20. pinmux_set_func(PMUX_PINGRP_ULPI_DATA1_PO2,
  21. PMUX_FUNC_UARTA);
  22. pinmux_set_func(PMUX_PINGRP_ULPI_DATA2_PO3,
  23. PMUX_FUNC_UARTA);
  24. pinmux_set_func(PMUX_PINGRP_ULPI_DATA3_PO4,
  25. PMUX_FUNC_UARTA);
  26. pinmux_tristate_disable(PMUX_PINGRP_ULPI_DATA0_PO1);
  27. pinmux_tristate_disable(PMUX_PINGRP_ULPI_DATA1_PO2);
  28. pinmux_tristate_disable(PMUX_PINGRP_ULPI_DATA2_PO3);
  29. pinmux_tristate_disable(PMUX_PINGRP_ULPI_DATA3_PO4);
  30. break;
  31. }
  32. break;
  33. /* Add other periph IDs here as needed */
  34. default:
  35. debug("%s: invalid periph_id %d", __func__, id);
  36. return -1;
  37. }
  38. if (bad_config) {
  39. debug("%s: invalid config %d for periph_id %d", __func__,
  40. config, id);
  41. return -1;
  42. }
  43. return 0;
  44. }