funcmux.c 1.2 KB

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