summaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-imx/vf610.c
blob: 74d190d7bcc6f4f4ef77622f60bfb0cdb3a457b9 (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
// SPDX-License-Identifier: GPL-2.0-or-later

#include <init.h>
#include <common.h>
#include <io.h>
#include <linux/sizes.h>
#include <mach/imx/generic.h>
#include <mach/imx/revision.h>
#include <mach/imx/vf610.h>
#include <mach/imx/reset-reason.h>
#include <mach/imx/ocotp.h>

static const struct imx_reset_reason vf610_reset_reasons[] = {
	{ VF610_SRC_SRSR_POR_RST,       RESET_POR,   0 },
	{ VF610_SRC_SRSR_WDOG_A5,       RESET_WDG,   0 },
	{ VF610_SRC_SRSR_WDOG_M4,       RESET_WDG,   1 },
	{ VF610_SRC_SRSR_JTAG_RST,      RESET_JTAG,  0 },
	{ VF610_SRC_SRSR_RESETB,        RESET_EXT,   0 },
	{ VF610_SRC_SRSR_SW_RST,        RESET_RST,   0 },
	{ /* sentinel */ }
};

u64 vf610_uid(void)
{
	return imx_ocotp_read_uid(IOMEM(VF610_OCOTP_BASE_ADDR));
}

int vf610_init(void)
{
	const char *cputypestr;
	void __iomem *src = IOMEM(VF610_SRC_BASE_ADDR);

	vf610_boot_save_loc();

	switch (vf610_cpu_type()) {
	case VF610_CPUTYPE_VF610:
		cputypestr = "VF610";
		break;
	case VF610_CPUTYPE_VF600:
		cputypestr = "VF600";
		break;
	case VF610_CPUTYPE_VF510:
		cputypestr = "VF510";
		break;
	case VF610_CPUTYPE_VF500:
		cputypestr = "VF500";
		break;
	default:
		cputypestr = "unknown VFxxx";
		break;
	}

	imx_set_silicon_revision(cputypestr, vf610_cpu_revision());
	imx_set_reset_reason(src + IMX_SRC_SRSR, vf610_reset_reasons);
	pr_info("%s unique ID: %llx\n", cputypestr, vf610_uid());

	return 0;
}