Blame view

arch/arm/plat-mxc/system.c 1.88 KB
eea643f7f   Juergen Beisert   i.MX2 family: Add...
1
2
3
4
5
  /*
   * Copyright (C) 1999 ARM Limited
   * Copyright (C) 2000 Deep Blue Solutions Ltd
   * Copyright 2006-2007 Freescale Semiconductor, Inc. All Rights Reserved.
   * Copyright 2008 Juergen Beisert, kernel@pengutronix.de
74bef9a4f   Ilya Yanok   mxc: add arch_res...
6
   * Copyright 2009 Ilya Yanok, Emcraft Systems Ltd, yanok@emcraft.com
eea643f7f   Juergen Beisert   i.MX2 family: Add...
7
8
9
10
11
12
13
14
15
16
   *
   * 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.
   *
   * This program is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   * GNU General Public License for more details.
eea643f7f   Juergen Beisert   i.MX2 family: Add...
17
18
19
20
21
   */
  
  #include <linux/kernel.h>
  #include <linux/clk.h>
  #include <linux/io.h>
74bef9a4f   Ilya Yanok   mxc: add arch_res...
22
23
  #include <linux/err.h>
  #include <linux/delay.h>
807dfe704   Arnd Bergmann   ARM: imx: export ...
24
  #include <linux/module.h>
eea643f7f   Juergen Beisert   i.MX2 family: Add...
25

a09e64fbc   Russell King   [ARM] Move includ...
26
  #include <mach/hardware.h>
fd6ac7bb9   Dmitriy Taychenachev   MXC: add basic MX...
27
  #include <mach/common.h>
eea643f7f   Juergen Beisert   i.MX2 family: Add...
28
29
  #include <asm/proc-fns.h>
  #include <asm/system.h>
c2932bf47   Arnaud Patard   efikamx: add reset
30
  #include <asm/mach-types.h>
eea643f7f   Juergen Beisert   i.MX2 family: Add...
31

f548897ff   Shawn Guo   arm/imx: remove c...
32
  void __iomem *(*imx_ioremap)(unsigned long, size_t, unsigned int) = NULL;
807dfe704   Arnd Bergmann   ARM: imx: export ...
33
  EXPORT_SYMBOL_GPL(imx_ioremap);
41e7daf27   Shawn Guo   arm/imx: remove c...
34

be124c942   Sascha Hauer   system.c: runtime...
35
  static void __iomem *wdog_base;
eea643f7f   Juergen Beisert   i.MX2 family: Add...
36
37
38
39
  
  /*
   * Reset the system. It is called by machine_restart().
   */
65ea7884b   Russell King   ARM: restart: mxc...
40
  void mxc_restart(char mode, const char *cmd)
eea643f7f   Juergen Beisert   i.MX2 family: Add...
41
  {
be124c942   Sascha Hauer   system.c: runtime...
42
43
44
45
46
  	unsigned int wcr_enable;
  
  	if (cpu_is_mx1()) {
  		wcr_enable = (1 << 0);
  	} else {
74bef9a4f   Ilya Yanok   mxc: add arch_res...
47
  		struct clk *clk;
eea643f7f   Juergen Beisert   i.MX2 family: Add...
48

2c1f4672f   Fabio Estevam   watchdog: imx: us...
49
  		clk = clk_get_sys("imx2-wdt.0", NULL);
74bef9a4f   Ilya Yanok   mxc: add arch_res...
50
51
  		if (!IS_ERR(clk))
  			clk_enable(clk);
be124c942   Sascha Hauer   system.c: runtime...
52
  		wcr_enable = (1 << 2);
eea643f7f   Juergen Beisert   i.MX2 family: Add...
53
  	}
eea643f7f   Juergen Beisert   i.MX2 family: Add...
54
  	/* Assert SRS signal */
be124c942   Sascha Hauer   system.c: runtime...
55
  	__raw_writew(wcr_enable, wdog_base);
74bef9a4f   Ilya Yanok   mxc: add arch_res...
56
57
58
59
60
61
62
63
64
65
66
  
  	/* wait for reset to assert... */
  	mdelay(500);
  
  	printk(KERN_ERR "Watchdog reset failed to assert reset
  ");
  
  	/* delay to allow the serial port to show the message */
  	mdelay(50);
  
  	/* we'll take a jump through zero as a poor second */
e879c862f   Russell King   ARM: restart: onl...
67
  	soft_restart(0);
eea643f7f   Juergen Beisert   i.MX2 family: Add...
68
  }
be124c942   Sascha Hauer   system.c: runtime...
69
70
71
72
73
  
  void mxc_arch_reset_init(void __iomem *base)
  {
  	wdog_base = base;
  }