blob: 28c77a498ea86caa3a0c003fe2f34e13f05e3aa5 [file] [log] [blame]
Jason Liudec11122011-11-25 00:18:02 +00001/*
2 * (C) Copyright 2009
3 * Stefano Babic, DENX Software Engineering, sbabic@denx.de.
4 *
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02005 * SPDX-License-Identifier: GPL-2.0+
Jason Liudec11122011-11-25 00:18:02 +00006 */
7
8#ifndef _SYS_PROTO_H_
9#define _SYS_PROTO_H_
10
Stefan Roese05b0ef42013-04-09 21:06:08 +000011#include <asm/imx-common/regs-common.h>
Fabio Estevam87d87332014-01-26 15:06:40 -020012#include "../arch-imx/cpu.h"
Jason Liudec11122011-11-25 00:18:02 +000013
Stefano Babic14404422014-06-10 10:26:22 +020014#define soc_rev() (get_cpu_rev() & 0xFF)
Peng Fanb3df4da2015-06-11 18:30:35 +080015#define is_soc_rev(rev) (soc_rev() == rev)
Stefano Babic14404422014-06-10 10:26:22 +020016
Gabriel Huau170ceaf2014-07-26 11:35:43 -070017u32 get_nr_cpus(void);
Jason Liudec11122011-11-25 00:18:02 +000018u32 get_cpu_rev(void);
Tim Harvey258d0462015-05-18 07:02:24 -070019u32 get_cpu_speed_grade_hz(void);
Tim Harvey5e0e1932015-05-18 06:56:45 -070020u32 get_cpu_temp_grade(int *minc, int *maxc);
Eric Nelson7d603b92013-08-29 10:57:10 -070021
22/* returns MXC_CPU_ value */
Peng Fanb3df4da2015-06-11 18:30:35 +080023#define cpu_type(rev) (((rev) >> 12) & 0xff)
Eric Nelson7d603b92013-08-29 10:57:10 -070024
Nikita Kiryanov937a1d22014-08-20 15:08:59 +030025/* both macros return/take MXC_CPU_ constants */
26#define get_cpu_type() (cpu_type(get_cpu_rev()))
27#define is_cpu_type(cpu) (get_cpu_type() == cpu)
Eric Nelson7d603b92013-08-29 10:57:10 -070028
Troy Kisky58394932012-10-23 10:57:46 +000029const char *get_imx_type(u32 imxtype);
Troy Kiskyb3aec6a2012-10-23 10:57:48 +000030unsigned imx_ddr_size(void);
Fabio Estevam16e65f62014-11-14 11:27:21 -020031void set_chipselect_size(int const);
Jason Liudec11122011-11-25 00:18:02 +000032
Peng Fan3cfe9712015-06-11 18:30:37 +080033#define is_mx6dqp() ((is_cpu_type(MXC_CPU_MX6Q) || \
34 is_cpu_type(MXC_CPU_MX6D)) && \
35 (soc_rev() >= CHIP_REV_2_0))
36
Jason Liudec11122011-11-25 00:18:02 +000037/*
38 * Initializes on-chip ethernet controllers.
39 * to override, implement board_eth_init()
40 */
41
42int fecmxc_initialize(bd_t *bis);
Fabio Estevam6479f512012-04-29 08:11:13 +000043u32 get_ahb_clk(void);
44u32 get_periph_clk(void);
Stefan Roese05b0ef42013-04-09 21:06:08 +000045
46int mxs_reset_block(struct mxs_register_32 *reg);
47int mxs_wait_mask_set(struct mxs_register_32 *reg,
48 uint32_t mask,
49 unsigned int timeout);
50int mxs_wait_mask_clr(struct mxs_register_32 *reg,
51 uint32_t mask,
52 unsigned int timeout);
Jason Liudec11122011-11-25 00:18:02 +000053#endif