2018-11-10 15:13:04 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
|
|
|
/*
|
|
|
|
* Copyright (C) 2016 Freescale Semiconductor, Inc.
|
|
|
|
* Copyright 2017-2018 NXP
|
|
|
|
* Author: Dong Aisheng <aisheng.dong@nxp.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/irqchip.h>
|
2019-01-11 06:22:50 +00:00
|
|
|
#include <linux/mfd/syscon.h>
|
2018-11-10 15:13:04 +00:00
|
|
|
#include <linux/of_platform.h>
|
2019-01-11 06:22:50 +00:00
|
|
|
#include <linux/regmap.h>
|
2018-11-10 15:13:04 +00:00
|
|
|
#include <asm/mach/arch.h>
|
|
|
|
|
|
|
|
#include "common.h"
|
2019-01-14 00:54:59 +00:00
|
|
|
#include "cpuidle.h"
|
2018-11-10 15:13:04 +00:00
|
|
|
#include "hardware.h"
|
|
|
|
|
2019-01-11 06:22:50 +00:00
|
|
|
#define SIM_JTAG_ID_REG 0x8c
|
|
|
|
|
|
|
|
static void __init imx7ulp_set_revision(void)
|
|
|
|
{
|
|
|
|
struct regmap *sim;
|
|
|
|
u32 revision;
|
|
|
|
|
|
|
|
sim = syscon_regmap_lookup_by_compatible("fsl,imx7ulp-sim");
|
|
|
|
if (IS_ERR(sim)) {
|
|
|
|
pr_warn("failed to find fsl,imx7ulp-sim regmap!\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (regmap_read(sim, SIM_JTAG_ID_REG, &revision)) {
|
|
|
|
pr_warn("failed to read sim regmap!\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* bit[31:28] of JTAG_ID register defines revision as below from B0:
|
|
|
|
* 0001 B0
|
|
|
|
* 0010 B1
|
|
|
|
*/
|
|
|
|
switch (revision >> 28) {
|
|
|
|
case 1:
|
|
|
|
imx_set_soc_revision(IMX_CHIP_REVISION_2_0);
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
imx_set_soc_revision(IMX_CHIP_REVISION_2_1);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
imx_set_soc_revision(IMX_CHIP_REVISION_1_0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-11-10 15:13:04 +00:00
|
|
|
static void __init imx7ulp_init_machine(void)
|
|
|
|
{
|
|
|
|
imx7ulp_pm_init();
|
|
|
|
|
|
|
|
mxc_set_cpu_type(MXC_CPU_IMX7ULP);
|
2019-01-11 06:22:50 +00:00
|
|
|
imx7ulp_set_revision();
|
2018-11-10 15:13:04 +00:00
|
|
|
of_platform_default_populate(NULL, NULL, imx_soc_device_init());
|
|
|
|
}
|
|
|
|
|
|
|
|
static const char *const imx7ulp_dt_compat[] __initconst = {
|
|
|
|
"fsl,imx7ulp",
|
|
|
|
NULL,
|
|
|
|
};
|
|
|
|
|
2019-01-14 00:54:59 +00:00
|
|
|
static void __init imx7ulp_init_late(void)
|
|
|
|
{
|
|
|
|
imx7ulp_cpuidle_init();
|
|
|
|
}
|
|
|
|
|
2018-11-10 15:13:04 +00:00
|
|
|
DT_MACHINE_START(IMX7ulp, "Freescale i.MX7ULP (Device Tree)")
|
|
|
|
.init_machine = imx7ulp_init_machine,
|
|
|
|
.dt_compat = imx7ulp_dt_compat,
|
2019-01-14 00:54:59 +00:00
|
|
|
.init_late = imx7ulp_init_late,
|
2018-11-10 15:13:04 +00:00
|
|
|
MACHINE_END
|