lin
2025-08-21 57113df3a0e2be01232281fad9a5f2c060567981
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
 * drivers/char/sunxi_sys_info/sunxi-smc.c
 *
 * Copyright(c) 2015-2016 Allwinnertech Co., Ltd.
 *         http://www.allwinnertech.com
 *
 * Author: sunny <superm@allwinnertech.com>
 *
 * allwinner sunxi soc chip version and chip id manager.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 */
 
#ifndef __SUNXI_SMC_H
#define __SUNXI_SMC_H
 
#ifdef CONFIG_SUNXI_SMC
extern int invoke_smc_fn(u32 function_id, u64 arg0, u64 arg1, u64 arg2);
extern u32 sunxi_smc_readl(phys_addr_t addr);
extern int sunxi_smc_writel(u32 value, phys_addr_t addr);
extern int sunxi_smc_probe_secure(void);
extern int sunxi_soc_is_secure(void);
extern int sunxi_smc_copy_arisc_paras(phys_addr_t dest, phys_addr_t src, u32 len);
#else
static inline u32 sunxi_smc_readl(phys_addr_t addr)
{
   void __iomem *vaddr = ioremap(addr, 4);
   u32 ret;
   ret = readl(vaddr);
   iounmap(vaddr);
   return ret;
   return readl((void __iomem *)addr);
}
static inline int sunxi_smc_writel(u32 val, phys_addr_t addr)
{
   void __iomem *vaddr = ioremap(addr, 4);
   writel(val, vaddr);
   iounmap(vaddr);
   return 0;
}
#endif
 
#endif  /* __SUNXI_SMC_H */