blob: b4ca44fce18a71288a0197dbf35f06e0e2b708cb [file] [log] [blame]
Allen Martinc037c932012-08-31 08:30:09 +00001/*
Stephen Warrena4bcd672014-01-24 12:46:10 -07002 * (C) Copyright 2010-2014
Allen Martinc037c932012-08-31 08:30:09 +00003 * NVIDIA Corporation <www.nvidia.com>
4 *
Wolfgang Denk1a459662013-07-08 09:37:19 +02005 * SPDX-License-Identifier: GPL-2.0+
Allen Martinc037c932012-08-31 08:30:09 +00006 */
7#include <asm/types.h>
8
9/* Stabilization delays, in usec */
10#define PLL_STABILIZATION_DELAY (300)
11#define IO_STABILIZATION_DELAY (1000)
12
Tom Warren4040ec12013-01-28 13:32:08 +000013#if defined(CONFIG_TEGRA20)
Stephen Warrena4bcd672014-01-24 12:46:10 -070014#define NVBL_PLLP_KHZ 216000
15#define CSITE_KHZ 144000
Tom Warren32edd2e2014-01-24 12:46:14 -070016#elif defined(CONFIG_TEGRA30) || defined(CONFIG_TEGRA114) || \
17 defined(CONFIG_TEGRA124)
Stephen Warrena4bcd672014-01-24 12:46:10 -070018#define NVBL_PLLP_KHZ 408000
19#define CSITE_KHZ 204000
Tom Warren4040ec12013-01-28 13:32:08 +000020#else
21#error "Unknown Tegra chip!"
Tom Warren1b245fe2012-12-11 13:34:13 +000022#endif
Allen Martinc037c932012-08-31 08:30:09 +000023
24#define PLLX_ENABLED (1 << 30)
25#define CCLK_BURST_POLICY 0x20008888
26#define SUPER_CCLK_DIVIDER 0x80000000
27
28/* Calculate clock fractional divider value from ref and target frequencies */
29#define CLK_DIVIDER(REF, FREQ) ((((REF) * 2) / FREQ) - 2)
30
31/* Calculate clock frequency value from reference and clock divider value */
32#define CLK_FREQUENCY(REF, REG) (((REF) * 2) / (REG + 2))
33
34/* AVP/CPU ID */
35#define PG_UP_TAG_0_PID_CPU 0x55555555 /* CPU aka "a9" aka "mpcore" */
36#define PG_UP_TAG_0 0x0
37
38#define CORESIGHT_UNLOCK 0xC5ACCE55;
39
Allen Martinc037c932012-08-31 08:30:09 +000040#define EXCEP_VECTOR_CPU_RESET_VECTOR (NV_PA_EVP_BASE + 0x100)
41#define CSITE_CPU_DBG0_LAR (NV_PA_CSITE_BASE + 0x10FB0)
42#define CSITE_CPU_DBG1_LAR (NV_PA_CSITE_BASE + 0x12FB0)
Tom Warren1b245fe2012-12-11 13:34:13 +000043#define CSITE_CPU_DBG2_LAR (NV_PA_CSITE_BASE + 0x14FB0)
44#define CSITE_CPU_DBG3_LAR (NV_PA_CSITE_BASE + 0x16FB0)
Allen Martinc037c932012-08-31 08:30:09 +000045
46#define FLOW_CTLR_HALT_COP_EVENTS (NV_PA_FLOW_BASE + 4)
47#define FLOW_MODE_STOP 2
48#define HALT_COP_EVENT_JTAG (1 << 28)
49#define HALT_COP_EVENT_IRQ_1 (1 << 11)
50#define HALT_COP_EVENT_FIQ_1 (1 << 9)
51
Tom Warren1b245fe2012-12-11 13:34:13 +000052#define FLOW_MODE_NONE 0
53
54#define SIMPLE_PLLX (CLOCK_ID_XCPU - CLOCK_ID_FIRST_SIMPLE)
55
56struct clk_pll_table {
57 u16 n;
58 u16 m;
59 u8 p;
60 u8 cpcon;
61};
62
63void clock_enable_coresight(int enable);
64void enable_cpu_clock(int enable);
Allen Martinc037c932012-08-31 08:30:09 +000065void halt_avp(void) __attribute__ ((noreturn));
Tom Warren1b245fe2012-12-11 13:34:13 +000066void init_pllx(void);
67void powerup_cpu(void);
68void reset_A9_cpu(int reset);
69void start_cpu(u32 reset_vector);
Tom Warren49493cb2013-04-10 10:32:32 -070070int tegra_get_chip(void);
71int tegra_get_sku_info(void);
72int tegra_get_chip_sku(void);
Tom Warren1b245fe2012-12-11 13:34:13 +000073void adjust_pllp_out_freqs(void);
Tom Warren32edd2e2014-01-24 12:46:14 -070074void pmic_enable_cpu_vdd(void);