GNU Linux-libre 6.7.9-gnu
[releases.git] / arch / arm / mach-imx / mach-imx6sx.c
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * Copyright 2014 Freescale Semiconductor, Inc.
4  */
5
6 #include <linux/irqchip.h>
7 #include <linux/of_platform.h>
8 #include <linux/regmap.h>
9 #include <linux/mfd/syscon.h>
10 #include <linux/mfd/syscon/imx6q-iomuxc-gpr.h>
11 #include <asm/mach/arch.h>
12
13 #include "common.h"
14 #include "cpuidle.h"
15
16 static void __init imx6sx_enet_clk_sel(void)
17 {
18         struct regmap *gpr;
19
20         gpr = syscon_regmap_lookup_by_compatible("fsl,imx6sx-iomuxc-gpr");
21         if (!IS_ERR(gpr)) {
22                 regmap_update_bits(gpr, IOMUXC_GPR1,
23                                    IMX6SX_GPR1_FEC_CLOCK_MUX_SEL_MASK, 0);
24                 regmap_update_bits(gpr, IOMUXC_GPR1,
25                                    IMX6SX_GPR1_FEC_CLOCK_PAD_DIR_MASK, 0);
26         } else {
27                 pr_err("failed to find fsl,imx6sx-iomux-gpr regmap\n");
28         }
29 }
30
31 static inline void imx6sx_enet_init(void)
32 {
33         imx6sx_enet_clk_sel();
34 }
35
36 static void __init imx6sx_init_machine(void)
37 {
38         of_platform_default_populate(NULL, NULL, NULL);
39
40         imx6sx_enet_init();
41         imx_anatop_init();
42         imx6sx_pm_init();
43 }
44
45 static void __init imx6sx_init_irq(void)
46 {
47         imx_gpc_check_dt();
48         imx_init_revision_from_anatop();
49         imx_init_l2cache();
50         imx_src_init();
51         irqchip_init();
52         imx6_pm_ccm_init("fsl,imx6sx-ccm");
53 }
54
55 static void __init imx6sx_init_late(void)
56 {
57         imx6sx_cpuidle_init();
58
59         if (IS_ENABLED(CONFIG_ARM_IMX6Q_CPUFREQ))
60                 platform_device_register_simple("imx6q-cpufreq", -1, NULL, 0);
61 }
62
63 static const char * const imx6sx_dt_compat[] __initconst = {
64         "fsl,imx6sx",
65         NULL,
66 };
67
68 DT_MACHINE_START(IMX6SX, "Freescale i.MX6 SoloX (Device Tree)")
69         .l2c_aux_val    = 0,
70         .l2c_aux_mask   = ~0,
71         .init_irq       = imx6sx_init_irq,
72         .init_machine   = imx6sx_init_machine,
73         .dt_compat      = imx6sx_dt_compat,
74         .init_late      = imx6sx_init_late,
75 MACHINE_END