Skip to content

Commit 66ee935

Browse files
committed
Merge tag 'imx-soc-5.8' of git://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux into arm/soc
i.MX SoC changes for 5.8: - Add soc device support for Vybrid/VF platform. - Move the i.MX soc device registration code from mach-imx to drivers/soc/imx for possible future consolidation with i.MX8 code. - A small fixup to make pcm970_sja1000_platform_data static. * tag 'imx-soc-5.8' of git://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux: soc: imx: move cpu code to drivers/soc/imx ARM: imx: move cpu definitions into a header ARM: imx: use device_initcall for imx_soc_device_init ARM: imx: pcm037: make pcm970_sja1000_platform_data static ARM: vf610: report soc info via soc device Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnd Bergmann <[email protected]>
2 parents 97a2f40 + 52102a3 commit 66ee935

File tree

14 files changed

+285
-217
lines changed

14 files changed

+285
-217
lines changed

arch/arm/mach-imx/common.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ void imx_aips_allow_unprivileged_access(const char *compat);
4949
int mxc_device_init(void);
5050
void imx_set_soc_revision(unsigned int rev);
5151
void imx_init_revision_from_anatop(void);
52-
struct device *imx_soc_device_init(void);
5352
void imx6_enable_rbc(bool enable);
5453
void imx_gpc_check_dt(void);
5554
void imx_gpc_set_arm_power_in_lpm(bool power_off);

arch/arm/mach-imx/cpu.c

Lines changed: 0 additions & 159 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,13 @@
11
// SPDX-License-Identifier: GPL-2.0
22
#include <linux/err.h>
3-
#include <linux/mfd/syscon.h>
43
#include <linux/module.h>
54
#include <linux/io.h>
65
#include <linux/of.h>
76
#include <linux/of_address.h>
8-
#include <linux/regmap.h>
9-
#include <linux/slab.h>
10-
#include <linux/sys_soc.h>
117

128
#include "hardware.h"
139
#include "common.h"
1410

15-
#define OCOTP_UID_H 0x420
16-
#define OCOTP_UID_L 0x410
17-
18-
#define OCOTP_ULP_UID_1 0x4b0
19-
#define OCOTP_ULP_UID_2 0x4c0
20-
#define OCOTP_ULP_UID_3 0x4d0
21-
#define OCOTP_ULP_UID_4 0x4e0
22-
2311
unsigned int __mxc_cpu_type;
2412
static unsigned int imx_soc_revision;
2513

@@ -82,150 +70,3 @@ void __init imx_aips_allow_unprivileged_access(
8270
imx_set_aips(aips_base_addr);
8371
}
8472
}
85-
86-
struct device * __init imx_soc_device_init(void)
87-
{
88-
struct soc_device_attribute *soc_dev_attr;
89-
const char *ocotp_compat = NULL;
90-
struct soc_device *soc_dev;
91-
struct device_node *root;
92-
struct regmap *ocotp = NULL;
93-
const char *soc_id;
94-
u64 soc_uid = 0;
95-
u32 val;
96-
int ret;
97-
98-
soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
99-
if (!soc_dev_attr)
100-
return NULL;
101-
102-
soc_dev_attr->family = "Freescale i.MX";
103-
104-
root = of_find_node_by_path("/");
105-
ret = of_property_read_string(root, "model", &soc_dev_attr->machine);
106-
of_node_put(root);
107-
if (ret)
108-
goto free_soc;
109-
110-
switch (__mxc_cpu_type) {
111-
case MXC_CPU_MX1:
112-
soc_id = "i.MX1";
113-
break;
114-
case MXC_CPU_MX21:
115-
soc_id = "i.MX21";
116-
break;
117-
case MXC_CPU_MX25:
118-
soc_id = "i.MX25";
119-
break;
120-
case MXC_CPU_MX27:
121-
soc_id = "i.MX27";
122-
break;
123-
case MXC_CPU_MX31:
124-
soc_id = "i.MX31";
125-
break;
126-
case MXC_CPU_MX35:
127-
soc_id = "i.MX35";
128-
break;
129-
case MXC_CPU_MX51:
130-
soc_id = "i.MX51";
131-
break;
132-
case MXC_CPU_MX53:
133-
soc_id = "i.MX53";
134-
break;
135-
case MXC_CPU_IMX6SL:
136-
ocotp_compat = "fsl,imx6sl-ocotp";
137-
soc_id = "i.MX6SL";
138-
break;
139-
case MXC_CPU_IMX6DL:
140-
ocotp_compat = "fsl,imx6q-ocotp";
141-
soc_id = "i.MX6DL";
142-
break;
143-
case MXC_CPU_IMX6SX:
144-
ocotp_compat = "fsl,imx6sx-ocotp";
145-
soc_id = "i.MX6SX";
146-
break;
147-
case MXC_CPU_IMX6Q:
148-
ocotp_compat = "fsl,imx6q-ocotp";
149-
soc_id = "i.MX6Q";
150-
break;
151-
case MXC_CPU_IMX6UL:
152-
ocotp_compat = "fsl,imx6ul-ocotp";
153-
soc_id = "i.MX6UL";
154-
break;
155-
case MXC_CPU_IMX6ULL:
156-
ocotp_compat = "fsl,imx6ull-ocotp";
157-
soc_id = "i.MX6ULL";
158-
break;
159-
case MXC_CPU_IMX6ULZ:
160-
ocotp_compat = "fsl,imx6ull-ocotp";
161-
soc_id = "i.MX6ULZ";
162-
break;
163-
case MXC_CPU_IMX6SLL:
164-
ocotp_compat = "fsl,imx6sll-ocotp";
165-
soc_id = "i.MX6SLL";
166-
break;
167-
case MXC_CPU_IMX7D:
168-
ocotp_compat = "fsl,imx7d-ocotp";
169-
soc_id = "i.MX7D";
170-
break;
171-
case MXC_CPU_IMX7ULP:
172-
ocotp_compat = "fsl,imx7ulp-ocotp";
173-
soc_id = "i.MX7ULP";
174-
break;
175-
default:
176-
soc_id = "Unknown";
177-
}
178-
soc_dev_attr->soc_id = soc_id;
179-
180-
if (ocotp_compat) {
181-
ocotp = syscon_regmap_lookup_by_compatible(ocotp_compat);
182-
if (IS_ERR(ocotp))
183-
pr_err("%s: failed to find %s regmap!\n", __func__, ocotp_compat);
184-
}
185-
186-
if (!IS_ERR_OR_NULL(ocotp)) {
187-
if (__mxc_cpu_type == MXC_CPU_IMX7ULP) {
188-
regmap_read(ocotp, OCOTP_ULP_UID_4, &val);
189-
soc_uid = val & 0xffff;
190-
regmap_read(ocotp, OCOTP_ULP_UID_3, &val);
191-
soc_uid <<= 16;
192-
soc_uid |= val & 0xffff;
193-
regmap_read(ocotp, OCOTP_ULP_UID_2, &val);
194-
soc_uid <<= 16;
195-
soc_uid |= val & 0xffff;
196-
regmap_read(ocotp, OCOTP_ULP_UID_1, &val);
197-
soc_uid <<= 16;
198-
soc_uid |= val & 0xffff;
199-
} else {
200-
regmap_read(ocotp, OCOTP_UID_H, &val);
201-
soc_uid = val;
202-
regmap_read(ocotp, OCOTP_UID_L, &val);
203-
soc_uid <<= 32;
204-
soc_uid |= val;
205-
}
206-
}
207-
208-
soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%d.%d",
209-
(imx_soc_revision >> 4) & 0xf,
210-
imx_soc_revision & 0xf);
211-
if (!soc_dev_attr->revision)
212-
goto free_soc;
213-
214-
soc_dev_attr->serial_number = kasprintf(GFP_KERNEL, "%016llX", soc_uid);
215-
if (!soc_dev_attr->serial_number)
216-
goto free_rev;
217-
218-
soc_dev = soc_device_register(soc_dev_attr);
219-
if (IS_ERR(soc_dev))
220-
goto free_serial_number;
221-
222-
return soc_device_to_device(soc_dev);
223-
224-
free_serial_number:
225-
kfree(soc_dev_attr->serial_number);
226-
free_rev:
227-
kfree(soc_dev_attr->revision);
228-
free_soc:
229-
kfree(soc_dev_attr);
230-
return NULL;
231-
}

arch/arm/mach-imx/mach-imx6q.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -245,21 +245,15 @@ static void __init imx6q_axi_init(void)
245245

246246
static void __init imx6q_init_machine(void)
247247
{
248-
struct device *parent;
249-
250248
if (cpu_is_imx6q() && imx_get_soc_revision() == IMX_CHIP_REVISION_2_0)
251249
imx_print_silicon_rev("i.MX6QP", IMX_CHIP_REVISION_1_0);
252250
else
253251
imx_print_silicon_rev(cpu_is_imx6dl() ? "i.MX6DL" : "i.MX6Q",
254252
imx_get_soc_revision());
255253

256-
parent = imx_soc_device_init();
257-
if (parent == NULL)
258-
pr_warn("failed to initialize soc device\n");
259-
260254
imx6q_enet_phy_init();
261255

262-
of_platform_default_populate(NULL, NULL, parent);
256+
of_platform_default_populate(NULL, NULL, NULL);
263257

264258
imx_anatop_init();
265259
cpu_is_imx6q() ? imx6q_pm_init() : imx6dl_pm_init();

arch/arm/mach-imx/mach-imx6sl.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,7 @@ static void __init imx6sl_init_late(void)
4545

4646
static void __init imx6sl_init_machine(void)
4747
{
48-
struct device *parent;
49-
50-
parent = imx_soc_device_init();
51-
if (parent == NULL)
52-
pr_warn("failed to initialize soc device\n");
53-
54-
of_platform_default_populate(NULL, NULL, parent);
48+
of_platform_default_populate(NULL, NULL, NULL);
5549

5650
if (cpu_is_imx6sl())
5751
imx6sl_fec_init();

arch/arm/mach-imx/mach-imx6sx.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,7 @@ static inline void imx6sx_enet_init(void)
6363

6464
static void __init imx6sx_init_machine(void)
6565
{
66-
struct device *parent;
67-
68-
parent = imx_soc_device_init();
69-
if (parent == NULL)
70-
pr_warn("failed to initialize soc device\n");
71-
72-
of_platform_default_populate(NULL, NULL, parent);
66+
of_platform_default_populate(NULL, NULL, NULL);
7367

7468
imx6sx_enet_init();
7569
imx_anatop_init();

arch/arm/mach-imx/mach-imx6ul.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,7 @@ static inline void imx6ul_enet_init(void)
5555

5656
static void __init imx6ul_init_machine(void)
5757
{
58-
struct device *parent;
59-
60-
parent = imx_soc_device_init();
61-
if (parent == NULL)
62-
pr_warn("failed to initialize soc device\n");
63-
64-
of_platform_default_populate(NULL, NULL, parent);
58+
of_platform_default_populate(NULL, NULL, NULL);
6559
imx6ul_enet_init();
6660
imx_anatop_init();
6761
imx6ul_pm_init();

arch/arm/mach-imx/mach-imx7d.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,6 @@ static inline void imx7d_enet_init(void)
7878

7979
static void __init imx7d_init_machine(void)
8080
{
81-
struct device *parent;
82-
83-
parent = imx_soc_device_init();
84-
if (parent == NULL)
85-
pr_warn("failed to initialize soc device\n");
86-
8781
imx_anatop_init();
8882
imx7d_enet_init();
8983
}

arch/arm/mach-imx/mach-imx7ulp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ static void __init imx7ulp_init_machine(void)
5757

5858
mxc_set_cpu_type(MXC_CPU_IMX7ULP);
5959
imx7ulp_set_revision();
60-
of_platform_default_populate(NULL, NULL, imx_soc_device_init());
60+
of_platform_default_populate(NULL, NULL, NULL);
6161
}
6262

6363
static const char *const imx7ulp_dt_compat[] __initconst = {

arch/arm/mach-imx/mach-pcm037.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ static struct resource pcm970_sja1000_resources[] = {
404404
},
405405
};
406406

407-
struct sja1000_platform_data pcm970_sja1000_platform_data = {
407+
static struct sja1000_platform_data pcm970_sja1000_platform_data = {
408408
.osc_freq = 16000000,
409409
.ocr = OCR_TX1_PULLDOWN | OCR_TX0_PUSHPULL,
410410
.cdr = CDR_CBP,

arch/arm/mach-imx/mach-vf610.c

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,57 @@
33
* Copyright 2012-2013 Freescale Semiconductor, Inc.
44
*/
55

6+
#include <linux/of_address.h>
67
#include <linux/of_platform.h>
8+
#include <linux/io.h>
9+
710
#include <linux/irqchip.h>
811
#include <asm/mach/arch.h>
912
#include <asm/hardware/cache-l2x0.h>
1013

14+
#include "common.h"
15+
#include "hardware.h"
16+
17+
#define MSCM_CPxCOUNT 0x00c
18+
#define MSCM_CPxCFG1 0x014
19+
20+
static void __init vf610_detect_cpu(void)
21+
{
22+
struct device_node *np;
23+
u32 cpxcount, cpxcfg1;
24+
unsigned int cpu_type;
25+
void __iomem *mscm;
26+
27+
np = of_find_compatible_node(NULL, NULL, "fsl,vf610-mscm-cpucfg");
28+
if (WARN_ON(!np))
29+
return;
30+
31+
mscm = of_iomap(np, 0);
32+
of_node_put(np);
33+
34+
if (WARN_ON(!mscm))
35+
return;
36+
37+
cpxcount = readl_relaxed(mscm + MSCM_CPxCOUNT);
38+
cpxcfg1 = readl_relaxed(mscm + MSCM_CPxCFG1);
39+
40+
iounmap(mscm);
41+
42+
cpu_type = cpxcount ? MXC_CPU_VF600 : MXC_CPU_VF500;
43+
44+
if (cpxcfg1)
45+
cpu_type |= MXC_CPU_VFx10;
46+
47+
mxc_set_cpu_type(cpu_type);
48+
}
49+
50+
static void __init vf610_init_machine(void)
51+
{
52+
vf610_detect_cpu();
53+
54+
of_platform_default_populate(NULL, NULL, NULL);
55+
}
56+
1157
static const char * const vf610_dt_compat[] __initconst = {
1258
"fsl,vf500",
1359
"fsl,vf510",
@@ -20,5 +66,6 @@ static const char * const vf610_dt_compat[] __initconst = {
2066
DT_MACHINE_START(VYBRID_VF610, "Freescale Vybrid VF5xx/VF6xx (Device Tree)")
2167
.l2c_aux_val = 0,
2268
.l2c_aux_mask = ~0,
69+
.init_machine = vf610_init_machine,
2370
.dt_compat = vf610_dt_compat,
2471
MACHINE_END

0 commit comments

Comments
 (0)