blob: 57b8f327a237acd2df3811c918ba9df5e75e1990 (
plain)
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
/*
* Copyright (C) 2012 Spreadtrum Communications Inc.
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <linux/io.h>
#include <linux/irqchip/arm-gic.h>
#include <soc/sprd/hardware.h>
static void __iomem *gic_dist_base_addr;
static void __iomem *gic_cpu_base;
void __iomem *sprd_get_gic_dist_base(void)
{
gic_dist_base_addr = (void __iomem *)CORE_GIC_DIS_VA;
return gic_dist_base_addr;
}
void __iomem *sprd_get_gic_cpu_base(void)
{
gic_cpu_base = (void __iomem *)CORE_GIC_CPU_VA;
return gic_cpu_base;
}
int sprd_map_gic(void){
gic_dist_base_addr = (void __iomem *)CORE_GIC_DIS_VA;
gic_cpu_base = (void __iomem *)CORE_GIC_CPU_VA;
return 0;
}
/*
* FIXME: Remove this GIC APIs once common GIG library starts
* supporting it.
*/
void gic_cpu_enable(unsigned int cpu)
{
__raw_writel(0xf0, gic_cpu_base + GIC_CPU_PRIMASK);
__raw_writel(1, gic_cpu_base + GIC_CPU_CTRL);
}
void gic_cpu_disable(unsigned int cpu)
{
__raw_writel(0, gic_cpu_base + GIC_CPU_CTRL);
}
bool gic_dist_disabled(void)
{
return !(__raw_readl(gic_dist_base_addr + GIC_DIST_CTRL) & 0x1);
}
void gic_dist_enable(void)
{
__raw_writel(0x1, gic_dist_base_addr + GIC_DIST_CTRL);
}
void gic_dist_disable(void)
{
__raw_writel(0, gic_dist_base_addr + GIC_CPU_CTRL);
}
void __iomem *sprd_get_scu_base(void)
{
return (void __iomem *)SPRD_CORE_BASE;
}
|