diff options
author | Pawel Moll <pawel.moll@arm.com> | 2015-01-20 12:25:15 -0500 |
---|---|---|
committer | Lee Jones <lee.jones@linaro.org> | 2015-03-03 11:41:14 -0500 |
commit | f0bd7ccc413f6de0947d6b8e998ef1fb787513ff (patch) | |
tree | 0d641b9ad0c5a2cf744f3aa882cf2bc6e0c0096e | |
parent | fb358e438d5456c29657698cf9f768ee55d6cba2 (diff) |
mfd: vexpress: Remove non-DT code
Now, as all VE platforms have to be booted with DT,
the code handling non-DT case can be removed.
Signed-off-by: Pawel Moll <pawel.moll@arm.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
-rw-r--r-- | drivers/mfd/vexpress-sysreg.c | 71 |
1 files changed, 15 insertions, 56 deletions
diff --git a/drivers/mfd/vexpress-sysreg.c b/drivers/mfd/vexpress-sysreg.c index 8f43ab8fd2d6..3e628df9280c 100644 --- a/drivers/mfd/vexpress-sysreg.c +++ b/drivers/mfd/vexpress-sysreg.c | |||
@@ -47,71 +47,26 @@ | |||
47 | #define SYS_HBI_MASK 0xfff | 47 | #define SYS_HBI_MASK 0xfff |
48 | #define SYS_PROCIDx_HBI_SHIFT 0 | 48 | #define SYS_PROCIDx_HBI_SHIFT 0 |
49 | 49 | ||
50 | #define SYS_MCI_CARDIN (1 << 0) | ||
51 | #define SYS_MCI_WPROT (1 << 1) | ||
52 | |||
53 | #define SYS_MISC_MASTERSITE (1 << 14) | 50 | #define SYS_MISC_MASTERSITE (1 << 14) |
54 | 51 | ||
55 | 52 | void vexpress_flags_set(u32 data) | |
56 | static void __iomem *__vexpress_sysreg_base; | ||
57 | |||
58 | static void __iomem *vexpress_sysreg_base(void) | ||
59 | { | 53 | { |
60 | if (!__vexpress_sysreg_base) { | 54 | static void __iomem *base; |
55 | |||
56 | if (!base) { | ||
61 | struct device_node *node = of_find_compatible_node(NULL, NULL, | 57 | struct device_node *node = of_find_compatible_node(NULL, NULL, |
62 | "arm,vexpress-sysreg"); | 58 | "arm,vexpress-sysreg"); |
63 | 59 | ||
64 | __vexpress_sysreg_base = of_iomap(node, 0); | 60 | base = of_iomap(node, 0); |
65 | } | 61 | } |
66 | 62 | ||
67 | WARN_ON(!__vexpress_sysreg_base); | 63 | if (WARN_ON(!base)) |
68 | 64 | return; | |
69 | return __vexpress_sysreg_base; | ||
70 | } | ||
71 | |||
72 | |||
73 | static int vexpress_sysreg_get_master(void) | ||
74 | { | ||
75 | if (readl(vexpress_sysreg_base() + SYS_MISC) & SYS_MISC_MASTERSITE) | ||
76 | return VEXPRESS_SITE_DB2; | ||
77 | |||
78 | return VEXPRESS_SITE_DB1; | ||
79 | } | ||
80 | |||
81 | void vexpress_flags_set(u32 data) | ||
82 | { | ||
83 | writel(~0, vexpress_sysreg_base() + SYS_FLAGSCLR); | ||
84 | writel(data, vexpress_sysreg_base() + SYS_FLAGSSET); | ||
85 | } | ||
86 | |||
87 | unsigned int vexpress_get_mci_cardin(struct device *dev) | ||
88 | { | ||
89 | return readl(vexpress_sysreg_base() + SYS_MCI) & SYS_MCI_CARDIN; | ||
90 | } | ||
91 | |||
92 | u32 vexpress_get_procid(int site) | ||
93 | { | ||
94 | if (site == VEXPRESS_SITE_MASTER) | ||
95 | site = vexpress_sysreg_get_master(); | ||
96 | 65 | ||
97 | return readl(vexpress_sysreg_base() + (site == VEXPRESS_SITE_DB1 ? | 66 | writel(~0, base + SYS_FLAGSCLR); |
98 | SYS_PROCID0 : SYS_PROCID1)); | 67 | writel(data, base + SYS_FLAGSSET); |
99 | } | 68 | } |
100 | 69 | ||
101 | void __iomem *vexpress_get_24mhz_clock_base(void) | ||
102 | { | ||
103 | return vexpress_sysreg_base() + SYS_24MHZ; | ||
104 | } | ||
105 | |||
106 | |||
107 | void __init vexpress_sysreg_early_init(void __iomem *base) | ||
108 | { | ||
109 | __vexpress_sysreg_base = base; | ||
110 | |||
111 | vexpress_config_set_master(vexpress_sysreg_get_master()); | ||
112 | } | ||
113 | |||
114 | |||
115 | /* The sysreg block is just a random collection of various functions... */ | 70 | /* The sysreg block is just a random collection of various functions... */ |
116 | 71 | ||
117 | static struct syscon_platform_data vexpress_sysreg_sys_id_pdata = { | 72 | static struct syscon_platform_data vexpress_sysreg_sys_id_pdata = { |
@@ -210,6 +165,7 @@ static int vexpress_sysreg_probe(struct platform_device *pdev) | |||
210 | struct resource *mem; | 165 | struct resource *mem; |
211 | void __iomem *base; | 166 | void __iomem *base; |
212 | struct bgpio_chip *mmc_gpio_chip; | 167 | struct bgpio_chip *mmc_gpio_chip; |
168 | int master; | ||
213 | u32 dt_hbi; | 169 | u32 dt_hbi; |
214 | 170 | ||
215 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 171 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
@@ -220,11 +176,14 @@ static int vexpress_sysreg_probe(struct platform_device *pdev) | |||
220 | if (!base) | 176 | if (!base) |
221 | return -ENOMEM; | 177 | return -ENOMEM; |
222 | 178 | ||
223 | vexpress_config_set_master(vexpress_sysreg_get_master()); | 179 | master = readl(base + SYS_MISC) & SYS_MISC_MASTERSITE ? |
180 | VEXPRESS_SITE_DB2 : VEXPRESS_SITE_DB1; | ||
181 | vexpress_config_set_master(master); | ||
224 | 182 | ||
225 | /* Confirm board type against DT property, if available */ | 183 | /* Confirm board type against DT property, if available */ |
226 | if (of_property_read_u32(of_root, "arm,hbi", &dt_hbi) == 0) { | 184 | if (of_property_read_u32(of_root, "arm,hbi", &dt_hbi) == 0) { |
227 | u32 id = vexpress_get_procid(VEXPRESS_SITE_MASTER); | 185 | u32 id = readl(base + (master == VEXPRESS_SITE_DB1 ? |
186 | SYS_PROCID0 : SYS_PROCID1)); | ||
228 | u32 hbi = (id >> SYS_PROCIDx_HBI_SHIFT) & SYS_HBI_MASK; | 187 | u32 hbi = (id >> SYS_PROCIDx_HBI_SHIFT) & SYS_HBI_MASK; |
229 | 188 | ||
230 | if (WARN_ON(dt_hbi != hbi)) | 189 | if (WARN_ON(dt_hbi != hbi)) |