1*83d290c5STom Rini // SPDX-License-Identifier: GPL-2.0+
26c43f6c8STom Warren /*
36c43f6c8STom Warren  * (C) Copyright 2013-2015
46c43f6c8STom Warren  * NVIDIA Corporation <www.nvidia.com>
56c43f6c8STom Warren  */
66c43f6c8STom Warren 
76c43f6c8STom Warren /* Tegra210 high-level function multiplexing */
86c43f6c8STom Warren 
96c43f6c8STom Warren #include <common.h>
106c43f6c8STom Warren #include <asm/arch/clock.h>
116c43f6c8STom Warren #include <asm/arch/funcmux.h>
126c43f6c8STom Warren #include <asm/arch/pinmux.h>
136c43f6c8STom Warren 
funcmux_select(enum periph_id id,int config)146c43f6c8STom Warren int funcmux_select(enum periph_id id, int config)
156c43f6c8STom Warren {
166c43f6c8STom Warren 	int bad_config = config != FUNCMUX_DEFAULT;
176c43f6c8STom Warren 
186c43f6c8STom Warren 	switch (id) {
196c43f6c8STom Warren 	/*
206c43f6c8STom Warren 	 * Add other periph IDs here as needed.
216c43f6c8STom Warren 	 * Note that all pinmux/pads should have already
226c43f6c8STom Warren 	 * been set up in the board pinmux table in
236c43f6c8STom Warren 	 * pinmux-config-<board>.h for all periphs.
246c43f6c8STom Warren 	 * Leave this in for the odd case where a mux
256c43f6c8STom Warren 	 * needs to be changed on-the-fly.
266c43f6c8STom Warren 	 */
276c43f6c8STom Warren 
286c43f6c8STom Warren 	default:
296c43f6c8STom Warren 		debug("%s: invalid periph_id %d", __func__, id);
306c43f6c8STom Warren 		return -1;
316c43f6c8STom Warren 	}
326c43f6c8STom Warren 
336c43f6c8STom Warren 	if (bad_config) {
346c43f6c8STom Warren 		debug("%s: invalid config %d for periph_id %d", __func__,
356c43f6c8STom Warren 		      config, id);
366c43f6c8STom Warren 		return -1;
376c43f6c8STom Warren 	}
386c43f6c8STom Warren 	return 0;
396c43f6c8STom Warren }
40