diff options
author | Juergen Beisert <jbe@pengutronix.de> | 2012-06-21 11:12:21 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2012-06-30 12:53:48 +0200 |
commit | af76fae0fe6e70eddb8cc6fb848eea79421a2934 (patch) | |
tree | 915ebe4ba19bb6bdb9c1a371363ac21bcb36ddad /arch | |
parent | a6e358b2f5b219fda18a7bc9348cb969043c19d5 (diff) | |
download | barebox-af76fae0fe6e70eddb8cc6fb848eea79421a2934.tar.gz barebox-af76fae0fe6e70eddb8cc6fb848eea79421a2934.tar.xz |
ARM/MXS: add new way to reset the whole SoC
Currently the watchdog is occupied for system reset. This usage collides with
the dedicated usage of a watchdog. This patch change the behaviour of at least
i.MX23/i.MX28 where the chipset supports a simple and powerful alternative
to reset the whole SoC (including the PMIC).
Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-mxs/Makefile | 6 | ||||
-rw-r--r-- | arch/arm/mach-mxs/reset-imx.c | 61 | ||||
-rw-r--r-- | arch/arm/mach-mxs/soc-imx23.c | 37 | ||||
-rw-r--r-- | arch/arm/mach-mxs/soc-imx28.c | 37 |
4 files changed, 77 insertions, 64 deletions
diff --git a/arch/arm/mach-mxs/Makefile b/arch/arm/mach-mxs/Makefile index 172d928128..c915d50e30 100644 --- a/arch/arm/mach-mxs/Makefile +++ b/arch/arm/mach-mxs/Makefile @@ -1,5 +1,5 @@ -obj-y += imx.o iomux-imx.o reset-imx.o +obj-y += imx.o iomux-imx.o obj-$(CONFIG_DRIVER_VIDEO_STM) += imx_lcd_clk.o -obj-$(CONFIG_ARCH_IMX23) += speed-imx23.o clocksource-imx23.o usb.o -obj-$(CONFIG_ARCH_IMX28) += speed-imx28.o clocksource-imx28.o +obj-$(CONFIG_ARCH_IMX23) += speed-imx23.o clocksource-imx23.o usb.o soc-imx23.o +obj-$(CONFIG_ARCH_IMX28) += speed-imx28.o clocksource-imx28.o soc-imx28.o obj-$(CONFIG_MXS_OCOTP) += ocotp.o diff --git a/arch/arm/mach-mxs/reset-imx.c b/arch/arm/mach-mxs/reset-imx.c deleted file mode 100644 index cfb3548f2a..0000000000 --- a/arch/arm/mach-mxs/reset-imx.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * (C) Copyright 2010 Juergen Beisert - Pengutronix - * - * 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. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - */ - -#include <common.h> -#include <init.h> -#include <notifier.h> -#include <mach/imx-regs.h> -#include <io.h> - -#define HW_RTC_CTRL 0x000 -# define BM_RTC_CTRL_WATCHDOGEN (1 << 4) -#define HW_RTC_CTRL_SET 0x004 -#define HW_RTC_CTRL_CLR 0x008 -#define HW_RTC_CTRL_TOG 0x00C - -#define HW_RTC_WATCHDOG 0x050 -#define HW_RTC_WATCHDOG_SET 0x054 -#define HW_RTC_WATCHDOG_CLR 0x058 -#define HW_RTC_WATCHDOG_TOG 0x05C - -#define WDOG_COUNTER_RATE 1000 /* 1 kHz clock */ - -#define HW_RTC_PERSISTENT1 0x070 -# define BV_RTC_PERSISTENT1_GENERAL__RTC_FORCE_UPDATER 0x80000000 -#define HW_RTC_PERSISTENT1_SET 0x074 -#define HW_RTC_PERSISTENT1_CLR 0x078 -#define HW_RTC_PERSISTENT1_TOG 0x07C - -/* - * Reset the cpu by setting up the watchdog timer and let it time out - * - * TODO There is a much easier way to reset the CPU: Refer bit 2 in - * the HW_CLKCTRL_RESET register, data sheet page 106/4-30 - */ -void __noreturn reset_cpu (unsigned long addr) -{ - writel(WDOG_COUNTER_RATE, IMX_WDT_BASE + HW_RTC_WATCHDOG); - writel(BM_RTC_CTRL_WATCHDOGEN, IMX_WDT_BASE + HW_RTC_CTRL_SET); - writel(BV_RTC_PERSISTENT1_GENERAL__RTC_FORCE_UPDATER, IMX_WDT_BASE + HW_RTC_PERSISTENT1); - - while (1) - ; - /*NOTREACHED*/ -} -EXPORT_SYMBOL(reset_cpu); diff --git a/arch/arm/mach-mxs/soc-imx23.c b/arch/arm/mach-mxs/soc-imx23.c new file mode 100644 index 0000000000..6819b3cf2e --- /dev/null +++ b/arch/arm/mach-mxs/soc-imx23.c @@ -0,0 +1,37 @@ +/* + * (c) 2012 Juergen Beisert <kernel@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. + * + * 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. + * + * Collection of some SoC specific functions + */ + +#include <common.h> +#include <init.h> +#include <mach/imx-regs.h> +#include <io.h> + +#define HW_CLKCTRL_RESET 0x120 +# define HW_CLKCTRL_RESET_CHIP (1 << 1) + +/* Reset the full i.MX23 SoC via a chipset feature */ +void __noreturn reset_cpu(unsigned long addr) +{ + u32 reg; + + reg = readl(IMX_CCM_BASE + HW_CLKCTRL_RESET); + writel(reg | HW_CLKCTRL_RESET_CHIP, IMX_CCM_BASE + HW_CLKCTRL_RESET); + + while (1) + ; + /*NOTREACHED*/ +} +EXPORT_SYMBOL(reset_cpu); diff --git a/arch/arm/mach-mxs/soc-imx28.c b/arch/arm/mach-mxs/soc-imx28.c new file mode 100644 index 0000000000..a181b759cb --- /dev/null +++ b/arch/arm/mach-mxs/soc-imx28.c @@ -0,0 +1,37 @@ +/* + * (c) 2012 Juergen Beisert <kernel@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. + * + * 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. + * + * Collection of some SoC specific functions + */ + +#include <common.h> +#include <init.h> +#include <mach/imx-regs.h> +#include <io.h> + +#define HW_CLKCTRL_RESET 0x1e0 +# define HW_CLKCTRL_RESET_CHIP (1 << 1) + +/* Reset the full i.MX28 SoC via a chipset feature */ +void __noreturn reset_cpu(unsigned long addr) +{ + u32 reg; + + reg = readl(IMX_CCM_BASE + HW_CLKCTRL_RESET); + writel(reg | HW_CLKCTRL_RESET_CHIP, IMX_CCM_BASE + HW_CLKCTRL_RESET); + + while (1) + ; + /*NOTREACHED*/ +} +EXPORT_SYMBOL(reset_cpu); |