blob: b75bc723d7f3cb95fd2eb3572728fd9e68ba32b5 [file] [log] [blame]
Haojian Zhuang5f281b32017-05-24 08:45:05 +08001/*
2 * Copyright (c) 2017, ARM Limited and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
Antonio Nino Diaz5eb88372018-11-08 10:20:19 +00007#ifndef HIKEY_PRIVATE_H
8#define HIKEY_PRIVATE_H
Haojian Zhuang5f281b32017-05-24 08:45:05 +08009
Antonio Nino Diaze0f90632018-12-14 00:18:21 +000010#include <common/bl_common.h>
Haojian Zhuang5f281b32017-05-24 08:45:05 +080011
12#define RANDOM_MAX 0x7fffffffffffffff
13#define RANDOM_MAGIC 0x9a4dbeaf
14
Haojian Zhuange18de672018-04-11 19:05:32 +080015enum {
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
Haojian Zhuang5f281b32017-05-24 08:45:05 +080023struct random_serial_num {
24 uint64_t magic;
25 uint64_t data;
26 char serialno[32];
27};
28
29/*
30 * Function and variable prototypes
31 */
32void 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);
38void 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
Haojian Zhuange18de672018-04-11 19:05:32 +080045void hikey_ddr_init(unsigned int ddr_freq);
Haojian Zhuang5f281b32017-05-24 08:45:05 +080046void hikey_io_setup(void);
47
Haojian Zhuang590188a2018-03-05 13:03:53 +080048void hikey_sp804_init(void);
49void hikey_gpio_init(void);
50void hikey_pmussi_init(void);
51void hikey_hi6553_init(void);
52void init_mmc0_pll(void);
53void reset_mmc0_clk(void);
54void init_media_clk(void);
55void init_mmc1_pll(void);
56void reset_mmc1_clk(void);
57void hikey_mmc_pll_init(void);
58void hikey_rtc_init(void);
59
Haojian Zhuang5f281b32017-05-24 08:45:05 +080060int hikey_get_partition_size(const char *arg, int left, char *response);
61int hikey_get_partition_type(const char *arg, int left, char *response);
62
63int hikey_erase(const char *arg);
64int hikey_flash(const char *arg);
65int hikey_oem(const char *arg);
66int hikey_reboot(const char *arg);
Jerome Forissierc52e55f2015-05-04 09:40:03 +020067void hikey_security_setup(void);
Haojian Zhuang5f281b32017-05-24 08:45:05 +080068
69const char *hikey_init_serialno(void);
70int hikey_read_serialno(struct random_serial_num *serialno);
71int hikey_write_serialno(struct random_serial_num *serialno);
72
73void init_acpu_dvfs(void);
74
Haojian Zhuang53e70df2019-09-14 19:18:01 +080075int hikey_set_fip_addr(unsigned int image_id, const char *name);
76
Antonio Nino Diaz5eb88372018-11-08 10:20:19 +000077#endif /* HIKEY_PRIVATE_H */