• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2017, ARM Limited and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef HIKEY_PRIVATE_H
8 #define HIKEY_PRIVATE_H
9 
10 #include <common/bl_common.h>
11 
12 #define RANDOM_MAX		0x7fffffffffffffff
13 #define RANDOM_MAGIC		0x9a4dbeaf
14 
15 enum {
16 	DDR_FREQ_150M = 150 * 1000,
17 	DDR_FREQ_266M = 266 * 1000,
18 	DDR_FREQ_400M = 400 * 1000,
19 	DDR_FREQ_533M = 533 * 1000,
20 	DDR_FREQ_800M = 800 * 1000
21 };
22 
23 struct random_serial_num {
24 	uint64_t	magic;
25 	uint64_t	data;
26 	char		serialno[32];
27 };
28 
29 /*
30  * Function and variable prototypes
31  */
32 void hikey_init_mmu_el1(unsigned long total_base,
33 			unsigned long total_size,
34 			unsigned long ro_start,
35 			unsigned long ro_limit,
36 			unsigned long coh_start,
37 			unsigned long coh_limit);
38 void hikey_init_mmu_el3(unsigned long total_base,
39 			unsigned long total_size,
40 			unsigned long ro_start,
41 			unsigned long ro_limit,
42 			unsigned long coh_start,
43 			unsigned long coh_limit);
44 
45 void hikey_ddr_init(unsigned int ddr_freq);
46 void hikey_io_setup(void);
47 
48 void hikey_sp804_init(void);
49 void hikey_gpio_init(void);
50 void hikey_pmussi_init(void);
51 void hikey_hi6553_init(void);
52 void init_mmc0_pll(void);
53 void reset_mmc0_clk(void);
54 void init_media_clk(void);
55 void init_mmc1_pll(void);
56 void reset_mmc1_clk(void);
57 void hikey_mmc_pll_init(void);
58 void hikey_rtc_init(void);
59 
60 int hikey_get_partition_size(const char *arg, int left, char *response);
61 int hikey_get_partition_type(const char *arg, int left, char *response);
62 
63 int hikey_erase(const char *arg);
64 int hikey_flash(const char *arg);
65 int hikey_oem(const char *arg);
66 int hikey_reboot(const char *arg);
67 void hikey_security_setup(void);
68 
69 const char *hikey_init_serialno(void);
70 int hikey_read_serialno(struct random_serial_num *serialno);
71 int hikey_write_serialno(struct random_serial_num *serialno);
72 
73 void init_acpu_dvfs(void);
74 
75 int hikey_set_fip_addr(unsigned int image_id, const char *name);
76 
77 #endif /* HIKEY_PRIVATE_H */
78