Skip to content
Snippets Groups Projects
Commit 746dc76b authored by Simon Glass's avatar Simon Glass Committed by Tom Warren
Browse files

tegra: clock: Support enabling external clocks


Add a simple function to enable external clocks.

Signed-off-by: default avatarSimon Glass <sjg@chromium.org>
Signed-off-by: default avatarTom Warren <twarren@nvidia.com>
parent 20edd1ac
No related branches found
No related tags found
No related merge requests found
...@@ -336,4 +336,12 @@ void arch_timer_init(void); ...@@ -336,4 +336,12 @@ void arch_timer_init(void);
void tegra30_set_up_pllp(void); void tegra30_set_up_pllp(void);
/**
* Enable output clock for external peripherals
*
* @param clk_id Clock ID to output (1, 2 or 3)
* @return 0 if OK. -ve on error
*/
int clock_external_output(int clk_id);
#endif /* _TEGRA_CLOCK_H_ */ #endif /* _TEGRA_CLOCK_H_ */
...@@ -17,11 +17,13 @@ ...@@ -17,11 +17,13 @@
/* Tegra SoC common clock control functions */ /* Tegra SoC common clock control functions */
#include <common.h> #include <common.h>
#include <errno.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/arch/clock.h> #include <asm/arch/clock.h>
#include <asm/arch/tegra.h> #include <asm/arch/tegra.h>
#include <asm/arch-tegra/ap.h> #include <asm/arch-tegra/ap.h>
#include <asm/arch-tegra/clk_rst.h> #include <asm/arch-tegra/clk_rst.h>
#include <asm/arch-tegra/pmc.h>
#include <asm/arch-tegra/timer.h> #include <asm/arch-tegra/timer.h>
#include <div64.h> #include <div64.h>
#include <fdtdec.h> #include <fdtdec.h>
...@@ -702,3 +704,18 @@ void tegra30_set_up_pllp(void) ...@@ -702,3 +704,18 @@ void tegra30_set_up_pllp(void)
set_avp_clock_source(SCLK_SOURCE_PLLP_OUT4); set_avp_clock_source(SCLK_SOURCE_PLLP_OUT4);
} }
int clock_external_output(int clk_id)
{
struct pmc_ctlr *pmc = (struct pmc_ctlr *)NV_PA_PMC_BASE;
if (clk_id >= 1 && clk_id <= 3) {
setbits_le32(&pmc->pmc_clk_out_cntrl,
1 << (2 + (clk_id - 1) * 8));
} else {
printf("%s: Unknown output clock id %d\n", __func__, clk_id);
return -EINVAL;
}
return 0;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment