|
@@ -14,6 +14,7 @@
|
|
|
#include <linux/clk/mxs.h>
|
|
|
#include <linux/clkdev.h>
|
|
|
#include <linux/clocksource.h>
|
|
|
+#include <linux/clk-provider.h>
|
|
|
#include <linux/delay.h>
|
|
|
#include <linux/err.h>
|
|
|
#include <linux/gpio.h>
|
|
@@ -61,6 +62,8 @@
|
|
|
static u32 chipid;
|
|
|
static u32 socid;
|
|
|
|
|
|
+static void __iomem *reset_addr;
|
|
|
+
|
|
|
static inline void __mxs_setl(u32 mask, void __iomem *reg)
|
|
|
{
|
|
|
__raw_writel(mask, reg + MXS_SET_ADDR);
|
|
@@ -393,12 +396,33 @@ static const char __init *mxs_get_revision(void)
|
|
|
u32 rev = mxs_get_cpu_rev();
|
|
|
|
|
|
if (rev != MXS_CHIP_REV_UNKNOWN)
|
|
|
- return kasprintf(GFP_KERNEL, "TO%d.%d", (rev >> 4) & 0xf,
|
|
|
+ return kasprintf(GFP_KERNEL, "%d.%d", (rev >> 4) & 0xf,
|
|
|
rev & 0xf);
|
|
|
else
|
|
|
return kasprintf(GFP_KERNEL, "%s", "Unknown");
|
|
|
}
|
|
|
|
|
|
+#define MX23_CLKCTRL_RESET_OFFSET 0x120
|
|
|
+#define MX28_CLKCTRL_RESET_OFFSET 0x1e0
|
|
|
+
|
|
|
+static int __init mxs_restart_init(void)
|
|
|
+{
|
|
|
+ struct device_node *np;
|
|
|
+
|
|
|
+ np = of_find_compatible_node(NULL, NULL, "fsl,clkctrl");
|
|
|
+ reset_addr = of_iomap(np, 0);
|
|
|
+ if (!reset_addr)
|
|
|
+ return -ENODEV;
|
|
|
+
|
|
|
+ if (of_device_is_compatible(np, "fsl,imx23-clkctrl"))
|
|
|
+ reset_addr += MX23_CLKCTRL_RESET_OFFSET;
|
|
|
+ else
|
|
|
+ reset_addr += MX28_CLKCTRL_RESET_OFFSET;
|
|
|
+ of_node_put(np);
|
|
|
+
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
static void __init mxs_machine_init(void)
|
|
|
{
|
|
|
struct device_node *root;
|
|
@@ -433,21 +457,18 @@ static void __init mxs_machine_init(void)
|
|
|
imx28_evk_init();
|
|
|
else if (of_machine_is_compatible("bluegiga,apx4devkit"))
|
|
|
apx4devkit_init();
|
|
|
- else if (of_machine_is_compatible("crystalfontz,cfa10037") ||
|
|
|
- of_machine_is_compatible("crystalfontz,cfa10049") ||
|
|
|
- of_machine_is_compatible("crystalfontz,cfa10055") ||
|
|
|
- of_machine_is_compatible("crystalfontz,cfa10057"))
|
|
|
+ else if (of_machine_is_compatible("crystalfontz,cfa10036"))
|
|
|
crystalfontz_init();
|
|
|
|
|
|
of_platform_populate(NULL, of_default_bus_match_table,
|
|
|
NULL, parent);
|
|
|
|
|
|
+ mxs_restart_init();
|
|
|
+
|
|
|
if (of_machine_is_compatible("karo,tx28"))
|
|
|
tx28_post_init();
|
|
|
}
|
|
|
|
|
|
-#define MX23_CLKCTRL_RESET_OFFSET 0x120
|
|
|
-#define MX28_CLKCTRL_RESET_OFFSET 0x1e0
|
|
|
#define MXS_CLKCTRL_RESET_CHIP (1 << 1)
|
|
|
|
|
|
/*
|
|
@@ -455,28 +476,16 @@ static void __init mxs_machine_init(void)
|
|
|
*/
|
|
|
static void mxs_restart(enum reboot_mode mode, const char *cmd)
|
|
|
{
|
|
|
- struct device_node *np;
|
|
|
- void __iomem *reset_addr;
|
|
|
+ if (reset_addr) {
|
|
|
+ /* reset the chip */
|
|
|
+ __mxs_setl(MXS_CLKCTRL_RESET_CHIP, reset_addr);
|
|
|
|
|
|
- np = of_find_compatible_node(NULL, NULL, "fsl,clkctrl");
|
|
|
- reset_addr = of_iomap(np, 0);
|
|
|
- if (!reset_addr)
|
|
|
- goto soft;
|
|
|
+ pr_err("Failed to assert the chip reset\n");
|
|
|
|
|
|
- if (of_device_is_compatible(np, "fsl,imx23-clkctrl"))
|
|
|
- reset_addr += MX23_CLKCTRL_RESET_OFFSET;
|
|
|
- else
|
|
|
- reset_addr += MX28_CLKCTRL_RESET_OFFSET;
|
|
|
-
|
|
|
- /* reset the chip */
|
|
|
- __mxs_setl(MXS_CLKCTRL_RESET_CHIP, reset_addr);
|
|
|
-
|
|
|
- pr_err("Failed to assert the chip reset\n");
|
|
|
-
|
|
|
- /* Delay to allow the serial port to show the message */
|
|
|
- mdelay(50);
|
|
|
+ /* Delay to allow the serial port to show the message */
|
|
|
+ mdelay(50);
|
|
|
+ }
|
|
|
|
|
|
-soft:
|
|
|
/* We'll take a jump through zero as a poor second */
|
|
|
soft_restart(0);
|
|
|
}
|
|
@@ -487,6 +496,7 @@ static void __init mxs_timer_init(void)
|
|
|
mx23_clocks_init();
|
|
|
else
|
|
|
mx28_clocks_init();
|
|
|
+ of_clk_init(NULL);
|
|
|
clocksource_of_init();
|
|
|
}
|
|
|
|