diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2012-05-24 12:18:08 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2012-06-30 12:53:36 +0200 |
commit | 364a2bb8ede7566809b28c8d1f498a9388c99f97 (patch) | |
tree | dc36f91f3ef2a3fe0e26df592fe04e0a1427a6e6 /arch | |
parent | a6e358b2f5b219fda18a7bc9348cb969043c19d5 (diff) | |
download | barebox-364a2bb8ede7566809b28c8d1f498a9388c99f97.tar.gz barebox-364a2bb8ede7566809b28c8d1f498a9388c99f97.tar.xz |
ARM mxs: Add mxs_reset_block function
The i.MX23/28 have a reset block to reset several units.
Add a function to support this.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-mxs/Makefile | 2 | ||||
-rw-r--r-- | arch/arm/mach-mxs/common.c | 33 | ||||
-rw-r--r-- | arch/arm/mach-mxs/include/mach/mxs.h | 6 |
3 files changed, 40 insertions, 1 deletions
diff --git a/arch/arm/mach-mxs/Makefile b/arch/arm/mach-mxs/Makefile index 172d928128..268e7dcbd6 100644 --- a/arch/arm/mach-mxs/Makefile +++ b/arch/arm/mach-mxs/Makefile @@ -1,4 +1,4 @@ -obj-y += imx.o iomux-imx.o reset-imx.o +obj-y += imx.o iomux-imx.o reset-imx.o common.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 diff --git a/arch/arm/mach-mxs/common.c b/arch/arm/mach-mxs/common.c new file mode 100644 index 0000000000..3730633c71 --- /dev/null +++ b/arch/arm/mach-mxs/common.c @@ -0,0 +1,33 @@ +#include <common.h> +#include <io.h> +#include <mach/mxs.h> +#include <mach/imx-regs.h> + +#define MXS_BLOCK_SFTRST (1 << 31) +#define MXS_BLOCK_CLKGATE (1 << 30) + +int mxs_reset_block(void __iomem *reg, int just_enable) +{ + /* Clear SFTRST */ + writel(MXS_BLOCK_SFTRST, reg + BIT_CLR); + mdelay(1); + + /* Clear CLKGATE */ + writel(MXS_BLOCK_CLKGATE, reg + BIT_CLR); + + if (!just_enable) { + /* Set SFTRST */ + writel(MXS_BLOCK_SFTRST, reg + BIT_SET); + mdelay(1); + } + + /* Clear SFTRST */ + writel(MXS_BLOCK_SFTRST, reg + BIT_CLR); + mdelay(1); + + /* Clear CLKGATE */ + writel(MXS_BLOCK_CLKGATE, reg + BIT_CLR); + mdelay(1); + + return 0; +} diff --git a/arch/arm/mach-mxs/include/mach/mxs.h b/arch/arm/mach-mxs/include/mach/mxs.h new file mode 100644 index 0000000000..182ed8a998 --- /dev/null +++ b/arch/arm/mach-mxs/include/mach/mxs.h @@ -0,0 +1,6 @@ +#ifndef __MACH_MXS_H +#define __MACH_MXS_H + +int mxs_reset_block(void __iomem *reg, int just_enable); + +#endif /* __MACH_MXS_H */ |