blob: 73350d15e18df3d2519124ec95df7b91cc7c7084 (
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
|
/*
* Copyright 2016 Sascha Hauer <s.hauer@pengutronix.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#include <common.h>
#include <init.h>
#include <io.h>
#include <linux/err.h>
#define SRC_SCR 0x0
#define SCR_WARM_RESET_ENABLE BIT(0)
static int imx_src_reset_probe(struct device_d *dev)
{
struct resource *res;
u32 val;
void __iomem *membase;
res = dev_request_mem_resource(dev, 0);
if (IS_ERR(res))
return PTR_ERR(res);
membase = IOMEM(res->start);
/*
* Generate cold reset for warm reset sources. Needed for
* some boards to come up properly after reset.
*/
val = readl(membase + SRC_SCR);
val &= ~SCR_WARM_RESET_ENABLE;
writel(val, membase + SRC_SCR);
return 0;
}
static const struct of_device_id imx_src_dt_ids[] = {
{ .compatible = "fsl,imx51-src", },
{ /* sentinel */ },
};
static struct driver_d imx_src_reset_driver = {
.name = "imx-src",
.probe = imx_src_reset_probe,
.of_compatible = DRV_OF_COMPAT(imx_src_dt_ids),
};
static int imx_src_reset_init(void)
{
return platform_driver_register(&imx_src_reset_driver);
}
postcore_initcall(imx_src_reset_init);
|